[PATCH 1/2] glamor: Add GLAMOR_ACCESS_WO

Michel Dänzer michel at daenzer.net
Tue Aug 5 01:08:47 PDT 2014


From: Michel Dänzer <michel.daenzer at amd.com>

Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
---
 glamor/glamor_prepare.c | 13 +++++++++----
 glamor/glamor_priv.h    |  1 +
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/glamor/glamor_prepare.c b/glamor/glamor_prepare.c
index 561c55d..3e370b7 100644
--- a/glamor/glamor_prepare.c
+++ b/glamor/glamor_prepare.c
@@ -69,7 +69,7 @@ glamor_prep_pixmap_box(PixmapPtr pixmap, glamor_access_t access, BoxPtr box)
         if (!RegionNotEmpty(&region))
             return TRUE;
 
-        if (access == GLAMOR_ACCESS_RW)
+        if (access != GLAMOR_ACCESS_RO)
             FatalError("attempt to remap buffer as writable");
 
         if (priv->base.pbo) {
@@ -86,6 +86,8 @@ glamor_prep_pixmap_box(PixmapPtr pixmap, glamor_access_t access, BoxPtr box)
 
             if (access == GLAMOR_ACCESS_RW)
                 gl_usage = GL_DYNAMIC_DRAW;
+            else if (access == GLAMOR_ACCESS_WO)
+                gl_usage = GL_STREAM_DRAW;
             else
                 gl_usage = GL_STREAM_READ;
 
@@ -102,14 +104,17 @@ glamor_prep_pixmap_box(PixmapPtr pixmap, glamor_access_t access, BoxPtr box)
         priv->base.map_access = access;
     }
 
-    glamor_download_boxes(pixmap, RegionRects(&region), RegionNumRects(&region),
-                          0, 0, 0, 0, pixmap->devPrivate.ptr, pixmap->devKind);
+    if (access != GLAMOR_ACCESS_WO)
+        glamor_download_boxes(pixmap, RegionRects(&region), RegionNumRects(&region),
+                              0, 0, 0, 0, pixmap->devPrivate.ptr, pixmap->devKind);
 
     RegionUninit(&region);
 
     if (glamor_priv->has_rw_pbo) {
         if (priv->base.map_access == GLAMOR_ACCESS_RW)
             gl_access = GL_READ_WRITE;
+        else if (priv->base.map_access == GLAMOR_ACCESS_WO)
+            gl_access = GL_WRITE_ONLY;
         else
             gl_access = GL_READ_ONLY;
 
@@ -145,7 +150,7 @@ glamor_fini_pixmap(PixmapPtr pixmap)
         pixmap->devPrivate.ptr = NULL;
     }
 
-    if (priv->base.map_access == GLAMOR_ACCESS_RW) {
+    if (priv->base.map_access != GLAMOR_ACCESS_RO) {
         glamor_upload_boxes(pixmap,
                             RegionRects(&priv->base.prepare_region),
                             RegionNumRects(&priv->base.prepare_region),
diff --git a/glamor/glamor_priv.h b/glamor/glamor_priv.h
index 385c027..91af6fc 100644
--- a/glamor/glamor_priv.h
+++ b/glamor/glamor_priv.h
@@ -302,6 +302,7 @@ typedef struct glamor_screen_private {
 typedef enum glamor_access {
     GLAMOR_ACCESS_RO,
     GLAMOR_ACCESS_RW,
+    GLAMOR_ACCESS_WO,
 } glamor_access_t;
 
 enum glamor_fbo_state {
-- 
2.0.1



More information about the xorg-devel mailing list