/contrib/sdk/sources/Mesa/Makefile |
---|
13,7 → 13,7 |
STRIP = $(PREFIX)strip |
INC_MESA= -I../newlib/include -I./include -I./src -I./src/glsl -I./src/mesa -I./src/mapi |
INC_EGL= -I../newlib/include -I./include -I../libdrm -I../libdrm/include/drm -I./src/egl/main -I./src/gbm/backends/dri -I./src/gbm/main |
INC_EGL= -I../newlib/include -I../../includes -I./include -I../libdrm -I../libdrm/include/drm -I./src/egl/main -I./src/gbm/backends/dri -I./src/gbm/main |
LIBPATH:= -L../../lib |
46,6 → 46,7 |
src/egl/main/eglstring.c \ |
src/egl/main/eglsurface.c \ |
src/egl/main/eglsync.c \ |
src/gbm/backends/dri/driver_name.c \ |
src/gbm/backends/dri/gbm_dri.c \ |
src/gbm/main/backend.c \ |
src/gbm/main/gbm.c \ |
/contrib/sdk/sources/Mesa/src/gbm/backends/dri/driver_name.c |
---|
28,9 → 28,9 |
#include <stdio.h> |
#include <string.h> |
#include <pciaccess.h> |
#include <kos32sys.h> |
#include <libudev.h> |
#include "gbm_driint.h" |
#define DRIVER_MAP_DRI2_ONLY |
#include "pci_ids/pci_id_driver_map.h" |
38,52 → 38,44 |
char * |
dri_fd_get_driver_name(int fd) |
{ |
struct udev *udev; |
struct udev_device *device, *parent; |
const char *pci_id; |
ioctl_t io; |
struct pci_device device; |
char *driver = NULL; |
int vendor_id, chip_id, i, j; |
int i, j; |
udev = udev_new(); |
device = _gbm_udev_device_new_from_fd(udev, fd); |
if (device == NULL) |
io.handle = fd; |
io.io_code = SRV_GET_PCI_INFO; |
io.input = &device; |
io.inp_size = sizeof(device); |
io.output = NULL; |
io.out_size = 0; |
if (call_service(&io)!=0) |
return NULL; |
parent = udev_device_get_parent(device); |
if (parent == NULL) { |
fprintf(stderr, "gbm: could not get parent device"); |
goto out; |
} |
pci_id = udev_device_get_property_value(parent, "PCI_ID"); |
if (pci_id == NULL || |
sscanf(pci_id, "%x:%x", &vendor_id, &chip_id) != 2) { |
fprintf(stderr, "gbm: malformed or no PCI ID"); |
goto out; |
} |
for (i = 0; driver_map[i].driver; i++) { |
if (vendor_id != driver_map[i].vendor_id) |
for (i = 0; driver_map[i].driver; i++) |
{ |
if (device.vendor_id != driver_map[i].vendor_id) |
continue; |
if (driver_map[i].num_chips_ids == -1) { |
if (driver_map[i].num_chips_ids == -1) |
{ |
driver = strdup(driver_map[i].driver); |
_gbm_log("pci id for %d: %04x:%04x, driver %s", |
fd, vendor_id, chip_id, driver); |
printf("pci id for %d: %04x:%04x, driver %s\n", |
fd, device.vendor_id, device.device_id, driver); |
goto out; |
} |
for (j = 0; j < driver_map[i].num_chips_ids; j++) |
if (driver_map[i].chip_ids[j] == chip_id) { |
if (driver_map[i].chip_ids[j] == device.device_id) |
{ |
driver = strdup(driver_map[i].driver); |
_gbm_log("pci id for %d: %04x:%04x, driver %s", |
fd, vendor_id, chip_id, driver); |
printf("pci id for %d: %04x:%04x, driver %s\n", |
fd, device.vendor_id, device.device_id, driver); |
goto out; |
} |
} |
out: |
udev_device_unref(device); |
udev_unref(udev); |
return driver; |
} |
/contrib/sdk/sources/Mesa/src/gbm/backends/dri/gbm_dri.c |
---|
174,49 → 174,15 |
dri_load_driver(struct gbm_dri_device *dri) |
{ |
const __DRIextension **extensions; |
// char path[PATH_MAX], *search_paths, *p, *next, *end; |
char *search_paths; |
char path[64]; |
search_paths = NULL; |
snprintf(path, sizeof path,"/kolibrios/lib/%s_dri.drv", dri->base.driver_name); |
#if 0 |
dri->driver = load_library(path); |
if (geteuid() == getuid()) { |
/* don't allow setuid apps to use GBM_DRIVERS_PATH */ |
search_paths = getenv("GBM_DRIVERS_PATH"); |
} |
if (search_paths == NULL) |
search_paths = DEFAULT_DRIVER_DIR; |
dri->driver = NULL; |
end = search_paths + strlen(search_paths); |
for (p = search_paths; p < end && dri->driver == NULL; p = next + 1) { |
int len; |
next = strchr(p, ':'); |
if (next == NULL) |
next = end; |
len = next - p; |
#if GLX_USE_TLS |
snprintf(path, sizeof path, |
"%.*s/tls/%s_dri.so", len, p, dri->base.driver_name); |
dri->driver = dlopen(path, RTLD_NOW | RTLD_GLOBAL); |
#endif |
if (dri->driver == NULL) { |
snprintf(path, sizeof path, |
"%.*s/%s_dri.so", len, p, dri->base.driver_name); |
dri->driver = dlopen(path, RTLD_NOW | RTLD_GLOBAL); |
if (dri->driver == NULL) |
fprintf(stderr, "failed to open %s: %s\n", path, dlerror()); |
} |
} |
#endif |
dri->driver = load_library("libGL.dll"); |
if (dri->driver == NULL) { |
fprintf(stderr, "gbm: failed to open any driver (search paths %s)", |
search_paths); |
path); |
return -1; |
} |
243,7 → 209,7 |
const __DRIextension **extensions; |
int ret = 0; |
dri->base.driver_name = strdup("drm"); //dri_fd_get_driver_name(dri->base.base.fd); |
dri->base.driver_name = dri_fd_get_driver_name(dri->base.base.fd); |
if (dri->base.driver_name == NULL) |
return -1; |
588,9 → 554,6 |
dri->image->queryImage(bo->image, __DRI_IMAGE_ATTRIB_STRIDE, |
(int *) &bo->base.base.stride); |
printf("%s handle %d w %d h%d\n",__FUNCTION__, bo->base.base.handle.s32, |
width, height); |
return &bo->base.base; |
} |
/contrib/sdk/sources/Mesa/src/mapi/glapi/glapi.c |
---|
62,3 → 62,8 |
{ |
u_current_set((const struct mapi_table *) dispatch); |
} |
int atexit(void (*func)(void)) |
{ |
return 0; |
}; |
/contrib/sdk/sources/Mesa/src/mapi/glapi/glapi.h |
---|
51,22 → 51,11 |
extern "C" { |
#endif |
#ifdef _GLAPI_NO_EXPORTS |
# define _GLAPI_EXPORT |
#else /* _GLAPI_NO_EXPORTS */ |
# ifdef _WIN32 |
# ifdef _GLAPI_DLL_EXPORTS |
# define _GLAPI_EXPORT __declspec(dllexport) |
# else |
# define _GLAPI_EXPORT __declspec(dllimport) |
# endif |
# elif defined(__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)) |
# define _GLAPI_EXPORT __attribute__((visibility("default"))) |
# else |
# define _GLAPI_EXPORT |
# endif |
#endif /* _GLAPI_NO_EXPORTS */ |
/* Is this needed? It is incomplete anyway. */ |
/contrib/sdk/sources/Mesa/src/mesa/drivers/dri/common/dri_util.c |
---|
627,3 → 627,8 |
assert(fb->Height == dPriv->h); |
} |
} |
int atexit(void (*func)(void)) |
{ |
return 0; |
} |
/contrib/sdk/sources/Mesa/src/mesa/drivers/dri/i915/intel_batchbuffer.c |
---|
68,6 → 68,7 |
drm_intel_bo_unreference(intel->batch.bo); |
} |
#if 0 |
static void |
do_batch_dump(struct intel_context *intel) |
{ |
107,6 → 108,7 |
intel->vtbl.debug_batch(intel); |
} |
} |
#endif |
/* TODO: Push this whole function into bufmgr. |
*/ |
127,8 → 129,8 |
} |
} |
if (unlikely(INTEL_DEBUG & DEBUG_BATCH)) |
do_batch_dump(intel); |
// if (unlikely(INTEL_DEBUG & DEBUG_BATCH)) |
// do_batch_dump(intel); |
if (ret != 0) { |
fprintf(stderr, "intel_do_flush_locked failed: %s\n", strerror(-ret)); |
/contrib/sdk/sources/Mesa/src/mesa/drivers/dri/i915/intel_regions.c |
---|
39,7 → 39,7 |
* last moment. |
*/ |
#include <sys/ioctl.h> |
//#include <sys/ioctl.h> |
#include <errno.h> |
#include "main/hash.h" |
205,6 → 205,7 |
return region; |
} |
#if 0 |
struct intel_region * |
intel_region_alloc_for_fd(struct intel_screen *screen, |
GLuint cpp, |
237,6 → 238,7 |
return region; |
} |
#endif |
void |
intel_region_reference(struct intel_region **dst, struct intel_region *src) |
/contrib/sdk/sources/Mesa/src/mesa/drivers/dri/i915/intel_screen.c |
---|
103,7 → 103,7 |
{ |
struct timespec tp; |
clock_gettime(CLOCK_MONOTONIC, &tp); |
// clock_gettime(CLOCK_MONOTONIC, &tp); |
return tp.tv_sec + tp.tv_nsec / 1000000000.0; |
} |
528,8 → 528,8 |
*value = image->planar_format->components; |
return true; |
case __DRI_IMAGE_ATTRIB_FD: |
if (drm_intel_bo_gem_export_to_prime(image->region->bo, value) == 0) |
return true; |
// if (drm_intel_bo_gem_export_to_prime(image->region->bo, value) == 0) |
// return true; |
return false; |
default: |
return false; |
620,6 → 620,7 |
return image; |
} |
#if 0 |
static __DRIimage * |
intel_create_image_from_fds(__DRIscreen *screen, |
int width, int height, int fourcc, |
664,8 → 665,8 |
return image; |
} |
#endif |
static __DRIimage * |
intel_from_planar(__DRIimage *parent, int plane, void *loaderPrivate) |
{ |
737,7 → 738,7 |
.createImageFromNames = intel_create_image_from_names, |
.fromPlanar = intel_from_planar, |
.createImageFromTexture = intel_create_image_from_texture, |
.createImageFromFds = intel_create_image_from_fds |
// .createImageFromFds = intel_create_image_from_fds |
}; |
static const __DRIextension *intelScreenExtensions[] = { |
758,7 → 759,7 |
gp.param = param; |
gp.value = value; |
ret = drmCommandWriteRead(psp->fd, DRM_I915_GETPARAM, &gp, sizeof(gp)); |
ret = drmIoctl(psp->fd, DRM_IOCTL_I915_GETPARAM, &gp); |
if (ret) { |
if (ret != -EINVAL) |
_mesa_warning(NULL, "drm_i915_getparam: %d", ret); |
768,6 → 769,7 |
return true; |
} |
static bool |
intel_get_boolean(__DRIscreen *psp, int param) |
{ |
1226,7 → 1228,7 |
}; |
/* This is the table of extensions that the loader will dlsym() for. */ |
PUBLIC const __DRIextension *__driDriverExtensions[] = { |
__declspec(dllexport) const __DRIextension *__driDriverExtensions[] = { |
&driCoreExtension.base, |
&driDRI2Extension.base, |
NULL |