xf86-video-intel: 4 commits - src/sna/sna_accel.c src/sna/sna_dri2.c
Chris Wilson
ickle at kemper.freedesktop.org
Tue Jun 17 06:39:01 PDT 2014
src/sna/sna_accel.c | 81 ++++++++++++++++++++++++++++++++++++++--------------
src/sna/sna_dri2.c | 28 ++++++++++-------
2 files changed, 76 insertions(+), 33 deletions(-)
New commits:
commit 0ca25c7b49efa9c83a3ce5b727e5a339a73d8ee0
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Tue Jun 17 14:08:06 2014 +0100
sna: Cache small pixmaps rather than forcing a large fallback for BLT operations
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index 482720b..bd21380 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -11835,8 +11835,32 @@ sna_pixmap_get_source_bo(PixmapPtr pixmap)
if (priv->cpu_damage && priv->cpu_bo)
return kgem_bo_reference(priv->cpu_bo);
- if (!sna_pixmap_move_to_gpu(pixmap, MOVE_READ | MOVE_ASYNC_HINT))
- return NULL;
+ if (!sna_pixmap_move_to_gpu(pixmap, MOVE_READ | MOVE_ASYNC_HINT)) {
+ struct kgem_bo *upload;
+ struct sna *sna = to_sna_from_pixmap(pixmap);
+ BoxRec box;
+
+ box.x1 = box.y1 = 0;
+ box.x2 = pixmap->drawable.width;
+ box.y2 = pixmap->drawable.height;
+
+ if (priv->gpu_damage)
+ return NULL;
+
+ upload = kgem_upload_source_image(&sna->kgem,
+ pixmap->devPrivate.ptr, &box,
+ pixmap->devKind,
+ pixmap->drawable.bitsPerPixel);
+ if (upload == NULL)
+ return NULL;
+ if (pixmap->usage_hint == 0 && priv->gpu_bo == NULL) {
+ DBG(("%s: adding upload cache to pixmap=%ld\n",
+ __FUNCTION__, pixmap->drawable.serialNumber));
+ assert(upload->proxy != NULL);
+ kgem_proxy_bo_attach(upload, &priv->gpu_bo);
+ }
+ return upload;
+ }
return kgem_bo_reference(priv->gpu_bo);
}
commit 322e51a3a552d89e5e5ecbb82a9243f134c8d36f
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Tue Jun 17 13:47:32 2014 +0100
sna: Relax PREFER_GPU so that we don't needless create small GPU bo
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index 5d9723b..482720b 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -3479,18 +3479,32 @@ sna_drawable_use_bo(DrawablePtr drawable, unsigned flags, const BoxRec *box,
goto use_cpu_bo;
}
- if (priv->flush)
+ if (priv->flush) {
+ DBG(("%s: exported target, set PREFER_GPU\n", __FUNCTION__));
flags |= PREFER_GPU;
- if (priv->shm)
+ }
+ if (priv->shm) {
+ DBG(("%s: shm target, discard PREFER_GPU\n", __FUNCTION__));
flags &= ~PREFER_GPU;
- if (priv->pinned)
+ }
+ if (priv->pinned) {
+ DBG(("%s: pinned, never REPLACES\n", __FUNCTION__));
flags &= ~REPLACES;
- if (priv->cpu && (flags & (FORCE_GPU | IGNORE_CPU)) == 0)
+ }
+ if (priv->cpu && (flags & (FORCE_GPU | IGNORE_CPU)) == 0) {
+ DBG(("%s: last on cpu and needs damage, discard PREFER_GPU\n", __FUNCTION__));
+ flags &= ~PREFER_GPU;
+ }
+ if ((flags & FORCE_GPU) == 0 && priv->gpu_bo == NULL && sna_pixmap_choose_tiling(pixmap, DEFAULT_TILING) == I915_TILING_NONE) {
+ DBG(("%s: no gpu bo and linear, discard PREFER_GPU\n", __FUNCTION__));
flags &= ~PREFER_GPU;
+ }
if ((flags & (PREFER_GPU | IGNORE_CPU)) == IGNORE_CPU) {
- if (priv->gpu_bo && (box_covers_pixmap(pixmap, box) || box_inplace(pixmap, box)))
+ if (priv->gpu_bo && (box_covers_pixmap(pixmap, box) || box_inplace(pixmap, box))) {
+ DBG(("%s: not reading damage and large, set PREFER_GPU\n", __FUNCTION__));
flags |= PREFER_GPU;
+ }
}
DBG(("%s: flush=%d, shm=%d, cpu=%d => flags=%x\n",
@@ -14445,7 +14459,7 @@ sna_poly_fill_rect(DrawablePtr draw, GCPtr gc, int n, xRectangle *rect)
DBG(("%s: not using GPU, hint=%x\n", __FUNCTION__, hint));
goto fallback;
}
- if (hint & REPLACES && (flags & 2) == 0 && UNDO)
+ if (hint & REPLACES && UNDO)
kgem_bo_pair_undo(&sna->kgem, priv->gpu_bo, priv->cpu_bo);
if (gc_is_solid(gc, &color)) {
commit 542aeca6e67fc64f9133ca3e27ac8eca28af6d25
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Tue Jun 17 12:26:30 2014 +0100
sna: Tweak creation 8x8 tiled patterns
Avoid reading back from a GTT mmapping.
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index 43fb6b9..5d9723b 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -12256,45 +12256,46 @@ sna_poly_fill_rect_tiled_nxm_blt(DrawablePtr drawable,
PixmapPtr pixmap = get_drawable_pixmap(drawable);
struct sna *sna = to_sna_from_pixmap(pixmap);
PixmapPtr tile = gc->tile.pixmap;
+ int w, h, bpp = tile->drawable.bitsPerPixel;
struct kgem_bo *upload;
- int w, h, cpp;
void *ptr;
bool ret;
DBG(("%s: %dx%d\n", __FUNCTION__,
tile->drawable.width, tile->drawable.height));
+ assert(tile->drawable.height && tile->drawable.height <= 8);
+ assert(tile->drawable.width && tile->drawable.width <= 8);
if (!sna_pixmap_move_to_cpu(tile, MOVE_READ))
return false;
- upload = kgem_create_buffer(&sna->kgem, 8*tile->drawable.bitsPerPixel,
- KGEM_BUFFER_WRITE_INPLACE,
+ upload = kgem_create_buffer(&sna->kgem, 8*bpp,
+ tile->drawable.height < 8 ? KGEM_BUFFER_WRITE : KGEM_BUFFER_WRITE_INPLACE,
&ptr);
if (upload == NULL)
return false;
- assert(tile->drawable.height && tile->drawable.height <= 8);
- assert(tile->drawable.width && tile->drawable.width <= 8);
- assert(has_coherent_ptr(sna, sna_pixmap(tile), MOVE_READ));
- upload->pitch = 8*tile->drawable.bitsPerPixel >> 3; /* for sanity checks */
+ upload->pitch = bpp; /* for sanity checks */
assert(tile->devKind);
- cpp = tile->drawable.bitsPerPixel/8;
+ assert(has_coherent_ptr(sna, sna_pixmap(tile), MOVE_READ));
for (h = 0; h < tile->drawable.height; h++) {
uint8_t *src = (uint8_t *)tile->devPrivate.ptr + tile->devKind*h;
- uint8_t *dst = (uint8_t *)ptr + 8*cpp*h;
+ uint8_t *dst = (uint8_t *)ptr + bpp*h;
- w = tile->drawable.width*cpp;
+ w = tile->drawable.width*bpp/8;
memcpy(dst, src, w);
- while (w < 8*cpp) {
- memcpy(dst+w, dst, w);
+ while (w < bpp) {
+ memcpy(dst+w, src, w);
w *= 2;
}
+ assert(w == bpp);
}
while (h < 8) {
- memcpy((uint8_t*)ptr + h*w, ptr, h*w);
+ memcpy((uint8_t*)ptr + bpp*h, ptr, bpp*h);
h *= 2;
}
+ assert(h == 8);
ret = sna_poly_fill_rect_tiled_8x8_blt(drawable, bo, damage,
upload, gc, n, rect,
diff --git a/src/sna/sna_dri2.c b/src/sna/sna_dri2.c
index 2686b7c..c35e0bd 100644
--- a/src/sna/sna_dri2.c
+++ b/src/sna/sna_dri2.c
@@ -1705,7 +1705,7 @@ sna_dri2_xchg(DrawablePtr draw, DRI2BufferPtr front, DRI2BufferPtr back)
assert(front_bo != back_bo);
DBG(("%s: win=%ld, exchange front=%d/%d and back=%d/%d, pixmap=%ld %dx%d\n",
- __FUNCTION__, win->id,
+ __FUNCTION__, win->drawable.id,
front_bo->handle, front->name,
back_bo->handle, back->name,
pixmap->drawable.serialNumber,
commit 4ff5cc539bc3f88ab9c05dc67c25aab08cbdf859
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Tue Jun 17 10:54:39 2014 +0100
sna/dri2: Fixup failure to do a render copy for DRI2CopyRegion
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
diff --git a/src/sna/sna_dri2.c b/src/sna/sna_dri2.c
index 7c1edbb..2686b7c 100644
--- a/src/sna/sna_dri2.c
+++ b/src/sna/sna_dri2.c
@@ -143,8 +143,8 @@ sna_dri2_get_back(struct sna *sna,
bo = get_private(back)->bo;
assert(bo->refcnt);
- DBG(("%s: back buffer handle=%d, scanout?=%d\n",
- __FUNCTION__, bo->handle, bo->active_scanout));
+ DBG(("%s: back buffer handle=%d, scanout?=%d, refcnt=%d\n",
+ __FUNCTION__, bo->handle, bo->active_scanout, get_private(back)->refcnt));
if (bo->active_scanout == 0) {
DBG(("%s: reuse unattached back\n", __FUNCTION__));
return;
@@ -1006,6 +1006,7 @@ __sna_dri2_copy_region(struct sna *sna, DrawablePtr draw, RegionPtr region,
DamageRegionAppend(&pixmap->drawable, region);
if (wedged(sna)) {
+fallback:
sna_dri2_copy_fallback(sna, draw->bitsPerPixel,
src_bo, sx, sy,
dst_bo, dx, dy,
@@ -1016,10 +1017,11 @@ __sna_dri2_copy_region(struct sna *sna, DrawablePtr draw, RegionPtr region,
flags = COPY_LAST;
if (sync)
flags |= COPY_SYNC;
- sna->render.copy_boxes(sna, GXcopy,
- pixmap, src_bo, sx, sy,
- pixmap, dst_bo, dx, dy,
- boxes, n, flags);
+ if (!sna->render.copy_boxes(sna, GXcopy,
+ pixmap, src_bo, sx, sy,
+ pixmap, dst_bo, dx, dy,
+ boxes, n, flags))
+ goto fallback;
DBG(("%s: flushing? %d\n", __FUNCTION__, sync));
if (sync) { /* STAT! */
@@ -1509,8 +1511,8 @@ can_flip(struct sna * sna,
return false;
}
+ DBG(("%s: yes, pixmap=%ld\n", __FUNCTION__, pixmap->drawable.serialNumber));
assert(dri2_window(win)->front == NULL);
-
return true;
}
@@ -1576,7 +1578,7 @@ can_xchg(struct sna * sna,
return false;
}
- DBG(("%s: yes\n", __FUNCTION__));
+ DBG(("%s: yes, pixmap=%ld\n", __FUNCTION__, pixmap->drawable.serialNumber));
return true;
}
@@ -1683,25 +1685,27 @@ can_xchg_crtc(struct sna *sna,
}
assert(win != win->drawable.pScreen->root);
- DBG(("%s: yes\n", __FUNCTION__));
+ DBG(("%s: yes, pixmap=%ld\n", __FUNCTION__, pixmap->drawable.serialNumber));
return true;
}
static void
sna_dri2_xchg(DrawablePtr draw, DRI2BufferPtr front, DRI2BufferPtr back)
{
+ WindowPtr win = (WindowPtr)draw;
struct kgem_bo *back_bo, *front_bo;
PixmapPtr pixmap;
int tmp;
- pixmap = get_drawable_pixmap(draw);
+ assert(draw->type != DRAWABLE_PIXMAP);
+ pixmap = get_window_pixmap(win);
back_bo = get_private(back)->bo;
front_bo = get_private(front)->bo;
assert(front_bo != back_bo);
- DBG(("%s: exchange front=%d/%d and back=%d/%d, pixmap=%ld %dx%d\n",
- __FUNCTION__,
+ DBG(("%s: win=%ld, exchange front=%d/%d and back=%d/%d, pixmap=%ld %dx%d\n",
+ __FUNCTION__, win->id,
front_bo->handle, front->name,
back_bo->handle, back->name,
pixmap->drawable.serialNumber,
More information about the xorg-commit
mailing list