summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichel Dänzer <michel.daenzer@amd.com>2014-08-05 17:08:47 +0900
committerDave Airlie <airlied@redhat.com>2020-02-04 16:05:52 +1000
commit1967af293370dcb35dd32595ebbc0a5e5e7e6e84 (patch)
tree7ff0fe2aa4cf3cf600db4195d9bf0d782349751d
parent3f169718aab651281c36552585c2033bc1795f59 (diff)
glamor: Add GLAMOR_ACCESS_WO
[airlied: rebased onto master - I left WO alone as it's more like the GL interface review suggested changing it to bits.] Reviewed-by: Dave Airlie <airlied@redhat.com> Signed-off-by: Michel Dänzer <michel.daenzer@amd.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
-rw-r--r--glamor/glamor_prepare.c16
-rw-r--r--glamor/glamor_priv.h1
2 files changed, 12 insertions, 5 deletions
diff --git a/glamor/glamor_prepare.c b/glamor/glamor_prepare.c
index 835c4ebea..1be45519b 100644
--- a/glamor/glamor_prepare.c
+++ b/glamor/glamor_prepare.c
@@ -71,7 +71,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->pbo) {
@@ -86,7 +86,10 @@ glamor_prep_pixmap_box(PixmapPtr pixmap, glamor_access_t access, BoxPtr box)
if (priv->pbo == 0)
glGenBuffers(1, &priv->pbo);
- gl_usage = GL_STREAM_READ;
+ if (access == GLAMOR_ACCESS_WO)
+ gl_usage = GL_STREAM_DRAW;
+ else
+ gl_usage = GL_STREAM_READ;
glamor_priv->suppress_gl_out_of_memory_logging = true;
@@ -119,14 +122,17 @@ glamor_prep_pixmap_box(PixmapPtr pixmap, glamor_access_t access, BoxPtr box)
priv->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 (priv->pbo) {
if (priv->map_access == GLAMOR_ACCESS_RW)
gl_access = GL_READ_WRITE;
+ else if (priv->map_access == GLAMOR_ACCESS_WO)
+ gl_access = GL_WRITE_ONLY;
else
gl_access = GL_READ_ONLY;
@@ -160,7 +166,7 @@ glamor_fini_pixmap(PixmapPtr pixmap)
pixmap->devPrivate.ptr = NULL;
}
- if (priv->map_access == GLAMOR_ACCESS_RW) {
+ if (priv->map_access != GLAMOR_ACCESS_RO) {
glamor_upload_boxes(pixmap,
RegionRects(&priv->prepare_region),
RegionNumRects(&priv->prepare_region),
diff --git a/glamor/glamor_priv.h b/glamor/glamor_priv.h
index 6ccc1c04c..e6adcbae8 100644
--- a/glamor/glamor_priv.h
+++ b/glamor/glamor_priv.h
@@ -312,6 +312,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 {