[Glamor] [PATCH] glamor: use function pointer for eglDestroyImageKHR

root peng.li at intel.com
Thu Jan 12 18:53:11 PST 2012


for some EGL driver, it may not export eglDestroyImageKHR directly,
so we have to get this function pointer through eglGetProcAddress.

Signed-off-by: Li Peng <peng.li at intel.com>
---
 src/glamor_egl.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/glamor_egl.c b/src/glamor_egl.c
index 28a48ca..8c621f1 100644
--- a/src/glamor_egl.c
+++ b/src/glamor_egl.c
@@ -92,6 +92,7 @@ struct glamor_egl_screen_private {
 	struct gbm_device *gbm;
 
 	PFNEGLCREATEIMAGEKHRPROC egl_create_image_khr;
+	PFNEGLDESTROYIMAGEKHRPROC egl_destroy_image_khr;
 	PFNGLEGLIMAGETARGETTEXTURE2DOESPROC egl_image_target_texture2d_oes;
 	struct glamor_gl_dispatch *dispatch;
 };
@@ -187,7 +188,7 @@ glamor_egl_create_textured_screen(ScreenPtr screen, int handle, int stride)
 	}
 
 	if (glamor_egl->root) {
-		eglDestroyImageKHR(glamor_egl->display, glamor_egl->root);
+		glamor_egl->egl_destroy_image_khr(glamor_egl->display, glamor_egl->root);
 		glamor_egl->root = EGL_NO_IMAGE_KHR;
 	}
 
@@ -258,7 +259,7 @@ glamor_egl_destroy_textured_pixmap(PixmapPtr pixmap)
  			 * a texture. we must call glFlush to make sure the 
  			 * operation on that texture has been done.*/
 			glamor_block_handler(pixmap->drawable.pScreen);
-			eglDestroyImageKHR(glamor_egl->display, image);
+			glamor_egl->egl_destroy_image_khr(glamor_egl->display, glamor_egl->root);
 		}
 	}
 	glamor_destroy_textured_pixmap(pixmap);
@@ -272,7 +273,7 @@ glamor_egl_close_screen(ScreenPtr screen)
 	    glamor_egl_get_screen_private(scrn);
 	glamor_fini(screen);
 
-	eglDestroyImageKHR(glamor_egl->display, glamor_egl->root);
+	glamor_egl->egl_destroy_image_khr(glamor_egl->display, glamor_egl->root);
 
 	glamor_egl->root = EGL_NO_IMAGE_KHR;
 
@@ -363,6 +364,9 @@ glamor_egl_init(ScrnInfoPtr scrn, int fd)
 	glamor_egl->egl_create_image_khr = (PFNEGLCREATEIMAGEKHRPROC)
 	    eglGetProcAddress("eglCreateImageKHR");
 
+	glamor_egl->egl_destroy_image_khr = (PFNEGLDESTROYIMAGEKHRPROC)
+	    eglGetProcAddress("eglDestroyImageKHR");
+
 	glamor_egl->egl_image_target_texture2d_oes =
 	    (PFNGLEGLIMAGETARGETTEXTURE2DOESPROC)
 	    eglGetProcAddress("glEGLImageTargetTexture2DOES");
-- 
1.7.2.2



More information about the Glamor mailing list