[PATCH v3] glamor: Make glamor_name_from_pixmap work without DRI3

Mark Kettenis kettenis at openbsd.org
Thu Nov 19 12:14:39 PST 2015


This function is used by the modesetting driver to implement DRI2 and
shouldn't fail on systems that don't support DRI3.  Remove the check
for DRI3 and rename glamor_egl_dri3_fd_name_from_tex to
glamor_egl_fd_name_from_tex.

Signed-off-by: Mark Kettenis <kettenis at openbsd.org>
---
 glamor/glamor.c               | 18 ++++++++----------
 glamor/glamor.h               |  6 +++---
 glamor/glamor_egl.c           |  8 ++++----
 glamor/glamor_egl_stubs.c     |  8 ++++----
 hw/xwayland/xwayland-glamor.c |  8 ++++----
 5 files changed, 23 insertions(+), 25 deletions(-)

diff --git a/glamor/glamor.c b/glamor/glamor.c
index 116d10c..f626f2d 100644
--- a/glamor/glamor.c
+++ b/glamor/glamor.c
@@ -758,10 +758,10 @@ glamor_fd_from_pixmap(ScreenPtr screen,
     case GLAMOR_TEXTURE_ONLY:
         if (!glamor_pixmap_ensure_fbo(pixmap, GL_RGBA, 0))
             return -1;
-        return glamor_egl_dri3_fd_name_from_tex(screen,
-                                                pixmap,
-                                                pixmap_priv->fbo->tex,
-                                                FALSE, stride, size);
+        return glamor_egl_fd_name_from_tex(screen,
+                                           pixmap,
+                                           pixmap_priv->fbo->tex,
+                                           FALSE, stride, size);
     default:
         break;
     }
@@ -775,17 +775,15 @@ glamor_name_from_pixmap(PixmapPtr pixmap, CARD16 *stride, CARD32 *size)
     glamor_screen_private *glamor_priv =
         glamor_get_screen_private(pixmap->drawable.pScreen);
 
-    if (!glamor_priv->dri3_enabled)
-        return -1;
     switch (pixmap_priv->type) {
     case GLAMOR_TEXTURE_DRM:
     case GLAMOR_TEXTURE_ONLY:
         if (!glamor_pixmap_ensure_fbo(pixmap, GL_RGBA, 0))
             return -1;
-        return glamor_egl_dri3_fd_name_from_tex(pixmap->drawable.pScreen,
-                                                pixmap,
-                                                pixmap_priv->fbo->tex,
-                                                TRUE, stride, size);
+        return glamor_egl_fd_name_from_tex(pixmap->drawable.pScreen,
+                                           pixmap,
+                                           pixmap_priv->fbo->tex,
+                                           TRUE, stride, size);
     default:
         break;
     }
diff --git a/glamor/glamor.h b/glamor/glamor.h
index a4e0655..296dad5 100644
--- a/glamor/glamor.h
+++ b/glamor/glamor.h
@@ -140,9 +140,9 @@ extern _X_EXPORT void glamor_pixmap_exchange_fbos(PixmapPtr front,
 
 /* The DDX is not supposed to call these three functions */
 extern _X_EXPORT void glamor_enable_dri3(ScreenPtr screen);
-extern _X_EXPORT int glamor_egl_dri3_fd_name_from_tex(ScreenPtr, PixmapPtr,
-                                                      unsigned int, Bool,
-                                                      CARD16 *, CARD32 *);
+extern _X_EXPORT int glamor_egl_fd_name_from_tex(ScreenPtr, PixmapPtr,
+                                                 unsigned int, Bool,
+                                                 CARD16 *, CARD32 *);
 
 extern _X_EXPORT struct gbm_device *glamor_egl_get_gbm_device(ScreenPtr screen);
 
diff --git a/glamor/glamor_egl.c b/glamor/glamor_egl.c
index ea0443d..3ca5931 100644
--- a/glamor/glamor_egl.c
+++ b/glamor/glamor_egl.c
@@ -426,10 +426,10 @@ glamor_gbm_bo_from_pixmap(ScreenPtr screen, PixmapPtr pixmap)
 }
 
 int
-glamor_egl_dri3_fd_name_from_tex(ScreenPtr screen,
-                                 PixmapPtr pixmap,
-                                 unsigned int tex,
-                                 Bool want_name, CARD16 *stride, CARD32 *size)
+glamor_egl_fd_name_from_tex(ScreenPtr screen,
+                            PixmapPtr pixmap,
+                            unsigned int tex,
+                            Bool want_name, CARD16 *stride, CARD32 *size)
 {
 #ifdef GLAMOR_HAS_GBM
     struct glamor_egl_screen_private *glamor_egl;
diff --git a/glamor/glamor_egl_stubs.c b/glamor/glamor_egl_stubs.c
index 40f7fcc..08a1a55 100644
--- a/glamor/glamor_egl_stubs.c
+++ b/glamor/glamor_egl_stubs.c
@@ -36,10 +36,10 @@ glamor_egl_screen_init(ScreenPtr screen, struct glamor_context *glamor_ctx)
 }
 
 int
-glamor_egl_dri3_fd_name_from_tex(ScreenPtr screen,
-                                 PixmapPtr pixmap,
-                                 unsigned int tex,
-                                 Bool want_name, CARD16 *stride, CARD32 *size)
+glamor_egl_fd_name_from_tex(ScreenPtr screen,
+                            PixmapPtr pixmap,
+                            unsigned int tex,
+                            Bool want_name, CARD16 *stride, CARD32 *size)
 {
     return 0;
 }
diff --git a/hw/xwayland/xwayland-glamor.c b/hw/xwayland/xwayland-glamor.c
index ebaf05a..9428688 100644
--- a/hw/xwayland/xwayland-glamor.c
+++ b/hw/xwayland/xwayland-glamor.c
@@ -401,10 +401,10 @@ xwl_screen_init_glamor(struct xwl_screen *xwl_screen,
 }
 
 int
-glamor_egl_dri3_fd_name_from_tex(ScreenPtr screen,
-                                 PixmapPtr pixmap,
-                                 unsigned int tex,
-                                 Bool want_name, CARD16 *stride, CARD32 *size)
+glamor_egl_fd_name_from_tex(ScreenPtr screen,
+                            PixmapPtr pixmap,
+                            unsigned int tex,
+                            Bool want_name, CARD16 *stride, CARD32 *size)
 {
     return 0;
 }
-- 
2.6.3



More information about the xorg-devel mailing list