diff --git a/hw/xfree86/glamor/glamor.c b/hw/xfree86/glamor/glamor.c index 3ac003dc2..109477bad 100644 --- a/hw/xfree86/glamor/glamor.c +++ b/hw/xfree86/glamor/glamor.c @@ -35,19 +35,6 @@ #include #include -#define GL_GLEXT_PROTOTYPES -#define EGL_EGLEXT_PROTOTYPES -#define EGL_DISPLAY_NO_X_MESA - -#if GLAMOR_GLES2 -#include -#else -#include -#endif - -#define MESA_EGL_NO_X11_HEADERS -#include -#include #include "../../../mi/micmap.h" #include @@ -70,27 +57,6 @@ glamor_identify(int flags) xf86Msg(X_INFO, "%s: OpenGL accelerated X.org driver\n", glamor_name); } -struct glamor_screen_private { - EGLDisplay display; - EGLContext context; - EGLImageKHR root; - EGLint major, minor; - - CreateScreenResourcesProcPtr CreateScreenResources; - CloseScreenProcPtr CloseScreen; - int fd; - int cpp; - - PFNEGLCREATEDRMIMAGEMESA egl_create_drm_image_mesa; - PFNEGLEXPORTDRMIMAGEMESA egl_export_drm_image_mesa; - -}; - -static inline struct glamor_screen_private * -glamor_get_screen_private(ScrnInfoPtr scrn) -{ - return (struct glamor_screen_private *) (scrn->driverPrivate); -} Bool glamor_resize(ScrnInfoPtr scrn, int width, int height) @@ -122,7 +88,7 @@ glamor_resize(ScrnInfoPtr scrn, int width, int height) glBindTexture(GL_TEXTURE_2D, texture); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, image); + (glamor->egl_image_target_texture2d_oes)(GL_TEXTURE_2D, image); glamor_set_screen_pixmap_texture(screen, width, height, texture); glamor->root = image; @@ -394,8 +360,10 @@ glamor_screen_init_ddx(int scrnIndex, ScreenPtr screen, int argc, char **argv) glamor->egl_create_drm_image_mesa = (PFNEGLCREATEDRMIMAGEMESA)eglGetProcAddress("eglCreateDRMImageMESA"); glamor->egl_export_drm_image_mesa = (PFNEGLEXPORTDRMIMAGEMESA)eglGetProcAddress("eglExportDRMImageMESA"); + glamor->egl_image_target_texture2d_oes = (PFNGLEGLIMAGETARGETTEXTURE2DOESPROC)eglGetProcAddress("glEGLImageTargetTexture2DOES"); - if (!glamor->egl_create_drm_image_mesa || !glamor->egl_export_drm_image_mesa) { + if (!glamor->egl_create_drm_image_mesa || !glamor->egl_export_drm_image_mesa || + !glamor->egl_image_target_texture2d_oes) { xf86DrvMsg(scrn->scrnIndex, X_ERROR, "eglGetProcAddress() failed\n"); return FALSE; diff --git a/hw/xfree86/glamor/glamor_crtc.c b/hw/xfree86/glamor/glamor_crtc.c index 959201397..ef6ee2946 100644 --- a/hw/xfree86/glamor/glamor_crtc.c +++ b/hw/xfree86/glamor/glamor_crtc.c @@ -478,6 +478,7 @@ drmmode_load_cursor_argb (xf86CrtcPtr crtc, CARD32 *image) { drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; ScrnInfoPtr scrn = crtc->scrn; + struct glamor_screen_private *glamor = glamor_get_screen_private(scrn); if (drmmode_crtc->cursor == NULL) { @@ -490,7 +491,7 @@ drmmode_load_cursor_argb (xf86CrtcPtr crtc, CARD32 *image) GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, drmmode_crtc->cursor); + (glamor->egl_image_target_texture2d_oes)(GL_TEXTURE_2D, drmmode_crtc->cursor); } glBindTexture(GL_TEXTURE_2D, drmmode_crtc->cursor_tex); #ifdef GLAMOR_GLES2 diff --git a/hw/xfree86/glamor/glamor_ddx.h b/hw/xfree86/glamor/glamor_ddx.h index 0e164d3b7..6d9e410f0 100644 --- a/hw/xfree86/glamor/glamor_ddx.h +++ b/hw/xfree86/glamor/glamor_ddx.h @@ -1,6 +1,43 @@ #ifndef GLAMOR_DDX_H #define GLAMOR_DDX_H +#define GL_GLEXT_PROTOTYPES +#define EGL_EGLEXT_PROTOTYPES +#define EGL_DISPLAY_NO_X_MESA + +#if GLAMOR_GLES2 +#include +#include +#else +#include +#endif + +#define MESA_EGL_NO_X11_HEADERS +#include +#include + +struct glamor_screen_private { + EGLDisplay display; + EGLContext context; + EGLImageKHR root; + EGLint major, minor; + + CreateScreenResourcesProcPtr CreateScreenResources; + CloseScreenProcPtr CloseScreen; + int fd; + int cpp; + + PFNEGLCREATEDRMIMAGEMESA egl_create_drm_image_mesa; + PFNEGLEXPORTDRMIMAGEMESA egl_export_drm_image_mesa; + PFNGLEGLIMAGETARGETTEXTURE2DOESPROC egl_image_target_texture2d_oes; +}; + +inline struct glamor_screen_private * +glamor_get_screen_private(ScrnInfoPtr scrn) +{ + return (struct glamor_screen_private *) (scrn->driverPrivate); +} + Bool glamor_resize(ScrnInfoPtr scrn, int width, int height); void glamor_frontbuffer_handle(ScrnInfoPtr scrn, uint32_t *handle, uint32_t *pitch);