[PATCH 08/27] glamor: Return the stride/size for glamor_dri3_name_from_pixmap(), too.

Eric Anholt eric at anholt.net
Tue Mar 11 14:30:22 PDT 2014


Just like for a caller of glamor_dri3_fd_from_pixmap(), otherwise the
consumer of that named buffer has no idea what GL chose for the
stride.

Signed-off-by: Eric Anholt <eric at anholt.net>
---
 glamor/glamor.c     | 4 ++--
 glamor/glamor.h     | 3 ++-
 glamor/glamor_egl.c | 4 ++--
 3 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/glamor/glamor.c b/glamor/glamor.c
index e298b04..5338d45 100644
--- a/glamor/glamor.c
+++ b/glamor/glamor.c
@@ -647,7 +647,7 @@ glamor_fd_from_pixmap(ScreenPtr screen,
 }
 
 int
-glamor_name_from_pixmap(PixmapPtr pixmap)
+glamor_name_from_pixmap(PixmapPtr pixmap, CARD16 *stride, CARD32 *size)
 {
     glamor_pixmap_private *pixmap_priv;
     glamor_screen_private *glamor_priv =
@@ -663,7 +663,7 @@ glamor_name_from_pixmap(PixmapPtr pixmap)
         return glamor_egl_dri3_fd_name_from_tex(pixmap->drawable.pScreen,
                                                 pixmap,
                                                 pixmap_priv->base.fbo->tex,
-                                                TRUE, NULL, NULL);
+                                                TRUE, stride, size);
     default:
         break;
     }
diff --git a/glamor/glamor.h b/glamor/glamor.h
index be46a52..d05d2f4 100644
--- a/glamor/glamor.h
+++ b/glamor/glamor.h
@@ -210,7 +210,8 @@ extern _X_EXPORT int glamor_fd_from_pixmap(ScreenPtr screen,
  *
  * Returns the name on success, -1 on error.
  * */
-extern _X_EXPORT int glamor_name_from_pixmap(PixmapPtr pixmap);
+extern _X_EXPORT int glamor_name_from_pixmap(PixmapPtr pixmap,
+                                             CARD16 *stride, CARD32 *size);
 
 /* @glamor_pixmap_from_fd: Creates a pixmap to wrap a dma-buf fd.
  *
diff --git a/glamor/glamor_egl.c b/glamor/glamor_egl.c
index f3835af..8123421 100644
--- a/glamor/glamor_egl.c
+++ b/glamor/glamor_egl.c
@@ -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:
-- 
1.9.0



More information about the xorg-devel mailing list