summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2016-03-10 11:49:26 +1000
committerDave Airlie <airlied@redhat.com>2016-03-10 12:41:33 +1000
commitbf92a32ed278c3a5a0e9b5a9a341467a74d949f8 (patch)
treec3c231a26e6af0424466ef38c2ee5c0239f7989c
parent25ce263fd88684be9370025f93ba3a2bfc72ff1a (diff)
[RFC] glamor: implement write-only preparesglamor-put-image-write-only
For some putimages we know we won't ever care about the data we readback, we are going to trash it with the putimage contents. So implement GLAMOR_ACCESS_WO mode. This will avoid doing the readbacks. Use it for putimages that are copy with a solid planemask. inspired by Ilia and xlock -mode wator which does loads of XYBitmap putimages. Signed-off-by: Dave Airlie <airlied@redhat.com>
-rw-r--r--glamor/glamor_image.c6
-rw-r--r--glamor/glamor_prepare.c9
-rw-r--r--glamor/glamor_priv.h1
3 files changed, 12 insertions, 4 deletions
diff --git a/glamor/glamor_image.c b/glamor/glamor_image.c
index 315874995..87fdcf604 100644
--- a/glamor/glamor_image.c
+++ b/glamor/glamor_image.c
@@ -88,7 +88,11 @@ static void
glamor_put_image_bail(DrawablePtr drawable, GCPtr gc, int depth, int x, int y,
int w, int h, int leftPad, int format, char *bits)
{
- if (glamor_prepare_access_box(drawable, GLAMOR_ACCESS_RW, x, y, w, h))
+ int access = GLAMOR_ACCESS_RW;
+
+ if (gc->alu == GXcopy && glamor_pm_is_solid(gc->depth, gc->planemask))
+ access = GLAMOR_ACCESS_WO;
+ if (glamor_prepare_access_box(drawable, access, x, y, w, h))
fbPutImage(drawable, gc, depth, x, y, w, h, leftPad, format, bits);
glamor_finish_access(drawable);
}
diff --git a/glamor/glamor_prepare.c b/glamor/glamor_prepare.c
index 5a73e6c7d..6de8385e7 100644
--- a/glamor/glamor_prepare.c
+++ b/glamor/glamor_prepare.c
@@ -101,14 +101,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 (priv->map_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->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;
@@ -144,7 +147,7 @@ glamor_fini_pixmap(PixmapPtr pixmap)
pixmap->devPrivate.ptr = NULL;
}
- if (priv->map_access == GLAMOR_ACCESS_RW) {
+ if (priv->map_access == GLAMOR_ACCESS_RW || priv->map_access == GLAMOR_ACCESS_WO) {
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 a70f10eb4..6df10b6ca 100644
--- a/glamor/glamor_priv.h
+++ b/glamor/glamor_priv.h
@@ -317,6 +317,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 {