From 1041a5895b83e5729d8f2eb9d0a4c29d19a13cee Mon Sep 17 00:00:00 2001 From: "Sergey Semyonov (Serge)" Date: Tue, 17 Dec 2013 12:52:40 +0000 Subject: [PATCH] Mesa-9.2.2: update git-svn-id: svn://kolibrios.org@4373 a494cfbc-eb01-0410-851d-a64ba20cac60 --- .../Mesa/src/egl/drivers/dri2/platform_drm.c | 37 ++++++++++++++++--- 1 file changed, 31 insertions(+), 6 deletions(-) diff --git a/contrib/sdk/sources/Mesa/src/egl/drivers/dri2/platform_drm.c b/contrib/sdk/sources/Mesa/src/egl/drivers/dri2/platform_drm.c index 36c37672f4..a705dc70c3 100644 --- a/contrib/sdk/sources/Mesa/src/egl/drivers/dri2/platform_drm.c +++ b/contrib/sdk/sources/Mesa/src/egl/drivers/dri2/platform_drm.c @@ -43,9 +43,12 @@ #include "egl_dri2.h" -int sna_bitmap_from_handle(bitmap_t *bitmap, uint32_t handle); -void sna_set_bo_handle(bitmap_t *bitmap, int handle); -int sna_blit_tex(bitmap_t *bitmap, int scale, int dst_x, int dst_y, +void* load_library(const char *name); +void *get_proc_address(void *module, char *proc_name); + +int (*blit_bitmap_from_handle)(bitmap_t *bitmap, uint32_t handle); +void (*blit_set_bo_handle)(bitmap_t *bitmap, int handle); +int (*blit_blit_tex)(bitmap_t *bitmap, int scale, int dst_x, int dst_y, int w, int h, int src_x, int src_y); static struct gbm_bo * @@ -379,7 +382,7 @@ dri2_swap_buffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw) bm.max_height = bo->base.base.height; bm.flags = HW_TEX_BLIT; - if( sna_bitmap_from_handle(&bm, bo->base.base.handle.s32)) + if( blit_bitmap_from_handle(&bm, bo->base.base.handle.s32)) { printf("sna_bitmap_from_handle failed\n"); } @@ -391,8 +394,8 @@ dri2_swap_buffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw) // bo->base.base.height, (int)bo->base.base.stride, // bo->base.base.format); - sna_set_bo_handle(&bm, bo->base.base.handle.s32); - sna_blit_tex(&bm, 0, 5, 20, bm.width, bm.height, 0, 0); + blit_set_bo_handle(&bm, bo->base.base.handle.s32); + blit_blit_tex(&bm, 0, 5, 20, bm.width, bm.height, 0, 0); } } #endif @@ -482,6 +485,8 @@ dri2_initialize_drm(_EGLDriver *drv, _EGLDisplay *disp) { struct dri2_egl_display *dri2_dpy; struct gbm_device *gbm; + void *lib; + int fd = -1; int i; @@ -511,6 +516,26 @@ dri2_initialize_drm(_EGLDriver *drv, _EGLDisplay *disp) return EGL_FALSE; } + + lib = load_library("intel-sna.drv"); + if(lib) + { + blit_bitmap_from_handle = get_proc_address(lib,"sna_bitmap_from_handle"); + blit_set_bo_handle = get_proc_address(lib,"sna_set_bo_handle"); + blit_blit_tex = get_proc_address(lib,"sna_blit_tex"); + } + else + { + lib = load_library("intel-uxa.drv"); + if(lib) + { + blit_bitmap_from_handle = get_proc_address(lib,"uxa_bitmap_from_handle"); + blit_set_bo_handle = get_proc_address(lib,"uxa_set_bo_handle"); + blit_blit_tex = get_proc_address(lib,"uxa_blit_tex"); + } + else return EGL_FALSE; + } + dri2_dpy->fd = fd; dri2_dpy->device_name = strdup("drm device"); //dri2_get_device_name_for_fd(dri2_dpy->fd); dri2_dpy->driver_name = dri2_dpy->gbm_dri->base.driver_name;