From 41fea4472dec859ddec76bdfa7108ebec71de1e3 Mon Sep 17 00:00:00 2001 From: marha Date: Fri, 21 Mar 2014 19:36:05 +0100 Subject: xserver fontconfig libX11 libXext libxcb mesa git update 21 Mar 2014 xserver commit 4fb31e4824d46edc80bb49b4065152899faa5ac6 libxcb commit cb686b576739deea00180c54697c8b62b8419ae0 libX11 commit 8be4610939b833587954957f5963eb4191b43d19 libXext commit 11aad96bd689d54156064d2e81213dc827a689d1 fontconfig commit 5478192f379d784b421329e4bf72cc780818e467 mesa commit 8d8d0cb09eb8735a04fc36cc4d0e2dc9f9d460eb --- xorg-server/glamor/glamor_egl.c | 129 +++++++++++++++------------------------- 1 file changed, 49 insertions(+), 80 deletions(-) (limited to 'xorg-server/glamor/glamor_egl.c') diff --git a/xorg-server/glamor/glamor_egl.c b/xorg-server/glamor/glamor_egl.c index 05e6bd02e..812342129 100644 --- a/xorg-server/glamor/glamor_egl.c +++ b/xorg-server/glamor/glamor_egl.c @@ -54,10 +54,6 @@ static const char glamor_name[] = "glamor"; -static DevPrivateKeyRec glamor_egl_pixmap_private_key_index; -DevPrivateKey glamor_egl_pixmap_private_key = - &glamor_egl_pixmap_private_key_index; - static void glamor_identify(int flags) { @@ -228,11 +224,13 @@ Bool glamor_egl_create_textured_screen(ScreenPtr screen, int handle, int stride) { ScrnInfoPtr scrn = xf86ScreenToScrn(screen); + struct glamor_pixmap_private *pixmap_priv; struct glamor_egl_screen_private *glamor_egl; PixmapPtr screen_pixmap; glamor_egl = glamor_egl_get_screen_private(scrn); screen_pixmap = screen->GetScreenPixmap(screen); + pixmap_priv = glamor_get_pixmap_private(screen_pixmap); if (!glamor_egl_create_textured_pixmap(screen_pixmap, handle, stride)) { xf86DrvMsg(scrn->scrnIndex, X_ERROR, @@ -240,8 +238,7 @@ glamor_egl_create_textured_screen(ScreenPtr screen, int handle, int stride) return FALSE; } - glamor_egl->front_image = dixLookupPrivate(&screen_pixmap->devPrivates, - glamor_egl_pixmap_private_key); + glamor_egl->front_image = pixmap_priv->base.image; glamor_set_screen_pixmap(screen_pixmap, glamor_egl->back_pixmap); return TRUE; } @@ -282,6 +279,8 @@ glamor_egl_create_textured_pixmap(PixmapPtr pixmap, int handle, int stride) ScrnInfoPtr scrn = xf86ScreenToScrn(screen); struct glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); + struct glamor_pixmap_private *pixmap_priv = + glamor_get_pixmap_private(pixmap); struct glamor_egl_screen_private *glamor_egl; EGLImageKHR image; GLuint texture; @@ -316,7 +315,7 @@ glamor_egl_create_textured_pixmap(PixmapPtr pixmap, int handle, int stride) glamor_create_texture_from_image(glamor_egl, image, &texture); glamor_set_pixmap_type(pixmap, GLAMOR_TEXTURE_DRM); glamor_set_pixmap_texture(pixmap, texture); - dixSetPrivate(&pixmap->devPrivates, glamor_egl_pixmap_private_key, image); + pixmap_priv->base.image = image; ret = TRUE; done: @@ -331,6 +330,8 @@ glamor_egl_create_textured_pixmap_from_gbm_bo(PixmapPtr pixmap, void *bo) ScrnInfoPtr scrn = xf86ScreenToScrn(screen); struct glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); + struct glamor_pixmap_private *pixmap_priv = + glamor_get_pixmap_private(pixmap); struct glamor_egl_screen_private *glamor_egl; EGLImageKHR image; GLuint texture; @@ -350,7 +351,7 @@ glamor_egl_create_textured_pixmap_from_gbm_bo(PixmapPtr pixmap, void *bo) glamor_create_texture_from_image(glamor_egl, image, &texture); glamor_set_pixmap_type(pixmap, GLAMOR_TEXTURE_DRM); glamor_set_pixmap_texture(pixmap, texture); - dixSetPrivate(&pixmap->devPrivates, glamor_egl_pixmap_private_key, image); + pixmap_priv->base.image = image; ret = TRUE; done: @@ -395,6 +396,8 @@ glamor_egl_dri3_fd_name_from_tex(ScreenPtr screen, { #ifdef GLAMOR_HAS_GBM ScrnInfoPtr scrn = xf86ScreenToScrn(screen); + struct glamor_pixmap_private *pixmap_priv = + glamor_get_pixmap_private(pixmap); struct glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); struct glamor_egl_screen_private *glamor_egl; @@ -412,10 +415,8 @@ glamor_egl_dri3_fd_name_from_tex(ScreenPtr screen, glamor_get_context(glamor_priv); - image = dixLookupPrivate(&pixmap->devPrivates, - glamor_egl_pixmap_private_key); - - if (image == EGL_NO_IMAGE_KHR || image == NULL) { + image = pixmap_priv->base.image; + if (!image) { image = eglCreateImageKHR(glamor_egl->display, glamor_egl->context, EGL_GL_TEXTURE_2D_KHR, @@ -424,8 +425,7 @@ glamor_egl_dri3_fd_name_from_tex(ScreenPtr screen, if (image == EGL_NO_IMAGE_KHR) goto failure; - dixSetPrivate(&pixmap->devPrivates, - glamor_egl_pixmap_private_key, image); + pixmap_priv->base.image = image; glamor_set_pixmap_type(pixmap, GLAMOR_TEXTURE_DRM); } @@ -441,10 +441,10 @@ glamor_egl_dri3_fd_name_from_tex(ScreenPtr screen, } else { if (glamor_get_fd_from_bo(glamor_egl->fd, bo, &fd)) { - *stride = pixmap->devKind; - *size = pixmap->devKind * gbm_bo_get_height(bo); } } + *stride = pixmap->devKind; + *size = pixmap->devKind * gbm_bo_get_height(bo); gbm_bo_destroy(bo); failure: @@ -530,20 +530,18 @@ static void _glamor_egl_destroy_pixmap_image(PixmapPtr pixmap) { ScrnInfoPtr scrn = xf86ScreenToScrn(pixmap->drawable.pScreen); - EGLImageKHR image; struct glamor_egl_screen_private *glamor_egl = glamor_egl_get_screen_private(scrn); + struct glamor_pixmap_private *pixmap_priv = + glamor_get_pixmap_private(pixmap); - image = dixLookupPrivate(&pixmap->devPrivates, - glamor_egl_pixmap_private_key); - if (image != EGL_NO_IMAGE_KHR && image != NULL) { + if (pixmap_priv->base.image) { /* Before destroy an image which was attached to * 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); - dixSetPrivate(&pixmap->devPrivates, glamor_egl_pixmap_private_key, - NULL); + eglDestroyImageKHR(glamor_egl->display, pixmap_priv->base.image); + pixmap_priv->base.image = NULL; } } @@ -553,21 +551,21 @@ glamor_egl_exchange_buffers(PixmapPtr front, PixmapPtr back) ScrnInfoPtr scrn = xf86ScreenToScrn(front->drawable.pScreen); struct glamor_egl_screen_private *glamor_egl = glamor_egl_get_screen_private(scrn); - EGLImageKHR old_front_image; - EGLImageKHR new_front_image; + EGLImageKHR temp; + struct glamor_pixmap_private *front_priv = + glamor_get_pixmap_private(front); + struct glamor_pixmap_private *back_priv = + glamor_get_pixmap_private(back); glamor_pixmap_exchange_fbos(front, back); - new_front_image = - dixLookupPrivate(&back->devPrivates, glamor_egl_pixmap_private_key); - old_front_image = - dixLookupPrivate(&front->devPrivates, glamor_egl_pixmap_private_key); - dixSetPrivate(&front->devPrivates, glamor_egl_pixmap_private_key, - new_front_image); - dixSetPrivate(&back->devPrivates, glamor_egl_pixmap_private_key, - old_front_image); + + temp = back_priv->base.image; + back_priv->base.image = front_priv->base.image; + front_priv->base.image = temp; + glamor_set_pixmap_type(front, GLAMOR_TEXTURE_DRM); glamor_set_pixmap_type(back, GLAMOR_TEXTURE_DRM); - glamor_egl->front_image = new_front_image; + glamor_egl->front_image = front_priv->base.image; } @@ -584,24 +582,23 @@ glamor_egl_close_screen(ScreenPtr screen) { ScrnInfoPtr scrn; struct glamor_egl_screen_private *glamor_egl; + struct glamor_pixmap_private *pixmap_priv; PixmapPtr screen_pixmap; - EGLImageKHR back_image; scrn = xf86ScreenToScrn(screen); glamor_egl = glamor_egl_get_screen_private(scrn); screen_pixmap = screen->GetScreenPixmap(screen); + pixmap_priv = glamor_get_pixmap_private(screen_pixmap); - eglDestroyImageKHR(glamor_egl->display,glamor_egl->front_image); - dixSetPrivate(&screen_pixmap->devPrivates, glamor_egl_pixmap_private_key, - NULL); + eglDestroyImageKHR(glamor_egl->display, glamor_egl->front_image); + pixmap_priv->base.image = NULL; glamor_egl->front_image = NULL; + if (glamor_egl->back_pixmap && *glamor_egl->back_pixmap) { - back_image = dixLookupPrivate(&(*glamor_egl->back_pixmap)->devPrivates, - glamor_egl_pixmap_private_key); - if (back_image != NULL && back_image != EGL_NO_IMAGE_KHR) { - eglDestroyImageKHR(glamor_egl->display, back_image); - dixSetPrivate(&(*glamor_egl->back_pixmap)->devPrivates, - glamor_egl_pixmap_private_key, NULL); + pixmap_priv = glamor_get_pixmap_private(*glamor_egl->back_pixmap); + if (pixmap_priv->base.image) { + eglDestroyImageKHR(glamor_egl->display, pixmap_priv->base.image); + pixmap_priv->base.image = NULL; } } @@ -610,25 +607,6 @@ glamor_egl_close_screen(ScreenPtr screen) return screen->CloseScreen(screen); } -static Bool -glamor_egl_has_extension(struct glamor_egl_screen_private *glamor_egl, - const char *extension) -{ - const char *pext; - int ext_len; - - ext_len = strlen(extension); - pext = (const char *) eglQueryString(glamor_egl->display, EGL_EXTENSIONS); - if (pext == NULL || extension == NULL) - return FALSE; - while ((pext = strstr(pext, extension)) != NULL) { - if (pext[ext_len] == ' ' || pext[ext_len] == '\0') - return TRUE; - pext += ext_len; - } - return FALSE; -} - static int glamor_dri3_open(ScreenPtr screen, RRProviderPtr provider, @@ -799,14 +777,14 @@ glamor_egl_init(ScrnInfoPtr scrn, int fd) xf86Msg(X_INFO, "%s: EGL version %s:\n", glamor_name, version); #define GLAMOR_CHECK_EGL_EXTENSION(EXT) \ - if (!glamor_egl_has_extension(glamor_egl, "EGL_" #EXT)) { \ + if (!epoxy_has_egl_extension(glamor_egl->display, "EGL_" #EXT)) { \ ErrorF("EGL_" #EXT " required.\n"); \ return FALSE; \ } #define GLAMOR_CHECK_EGL_EXTENSIONS(EXT1, EXT2) \ - if (!glamor_egl_has_extension(glamor_egl, "EGL_" #EXT1) && \ - !glamor_egl_has_extension(glamor_egl, "EGL_" #EXT2)) { \ + if (!epoxy_has_egl_extension(glamor_egl->display, "EGL_" #EXT1) && \ + !epoxy_has_egl_extension(glamor_egl->display, "EGL_" #EXT2)) { \ ErrorF("EGL_" #EXT1 " or EGL_" #EXT2 " required.\n"); \ return FALSE; \ } @@ -821,8 +799,10 @@ glamor_egl_init(ScrnInfoPtr scrn, int fd) #endif #ifdef GLAMOR_HAS_GBM - if (glamor_egl_has_extension(glamor_egl, "EGL_KHR_gl_texture_2D_image") && - glamor_egl_has_extension(glamor_egl, "EGL_EXT_image_dma_buf_import")) + if (epoxy_has_egl_extension(glamor_egl->display, + "EGL_KHR_gl_texture_2D_image") && + epoxy_has_egl_extension(glamor_egl->display, + "EGL_EXT_image_dma_buf_import")) glamor_egl->dri3_capable = TRUE; #endif @@ -851,20 +831,9 @@ glamor_egl_init(ScrnInfoPtr scrn, int fd) return TRUE; } +/** Stub to retain compatibility with pre-server-1.16 ABI. */ Bool glamor_egl_init_textured_pixmap(ScreenPtr screen) { - ScrnInfoPtr scrn = xf86ScreenToScrn(screen); - struct glamor_egl_screen_private *glamor_egl = - glamor_egl_get_screen_private(scrn); - if (!dixRegisterPrivateKey - (glamor_egl_pixmap_private_key, PRIVATE_PIXMAP, 0)) { - LogMessage(X_WARNING, - "glamor%d: Failed to allocate egl pixmap private\n", - screen->myNum); - return FALSE; - } - if (glamor_egl->dri3_capable) - glamor_enable_dri3(screen); return TRUE; } -- cgit v1.2.3