xf86-video-intel: 4 commits - src/sna/sna_accel.c src/sna/sna_display.c
Chris Wilson
ickle at kemper.freedesktop.org
Thu Jun 27 05:02:53 PDT 2013
src/sna/sna_accel.c | 98 +++++++++++++++++++++++++++++++++++++-------------
src/sna/sna_display.c | 10 +++++
2 files changed, 84 insertions(+), 24 deletions(-)
New commits:
commit 2f2f439c9cfdd394ad2b9a125db51e2dba7d3ff7
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Thu Jun 27 12:58:58 2013 +0100
sna: Fake the output physical width/height from the CRTC size
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c
index aafde15..e1199d9 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -54,6 +54,10 @@
#define KNOWN_MODE_FLAGS ((1<<14)-1)
+#ifndef DEFAULT_DPI
+#define DEFAULT_DPI 96
+#endif
+
#if 0
#define __DBG DBG
#else
@@ -3079,6 +3083,12 @@ static bool sna_probe_initial_configuration(struct sna *sna)
output->crtc = crtc;
crtc->enabled = TRUE;
+
+ if (output->mm_width == 0 ||
+ output->mm_height == 0) {
+ output->mm_height = (crtc->desiredMode.VDisplay * 254) / (10*DEFAULT_DPI);
+ output->mm_width = (crtc->desiredMode.HDisplay * 254) / (10*DEFAULT_DPI);
+ }
}
break;
}
commit 5124f35168c0cc162cf5e8bcaafdf756945f6ca9
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Thu Jun 27 12:32:24 2013 +0100
sna: Support operations inplace on CPU mappings of a region
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 2bbca72..3783933 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -2341,6 +2341,56 @@ sna_drawable_move_region_to_cpu(DrawablePtr drawable,
priv->mapped = false;
}
+ if (priv->gpu_damage &&
+ (DAMAGE_IS_ALL(priv->gpu_damage) ||
+ sna_damage_contains_box__no_reduce(priv->gpu_damage,
+ ®ion->extents)) &&
+ priv->gpu_bo->tiling == I915_TILING_NONE &&
+ (priv->gpu_bo->domain == DOMAIN_CPU || sna->kgem.has_llc) &&
+ ((flags & (MOVE_WRITE | MOVE_ASYNC_HINT)) == 0 ||
+ !__kgem_bo_is_busy(&sna->kgem, priv->gpu_bo))) {
+ DBG(("%s: try to operate inplace (CPU)\n", __FUNCTION__));
+ assert(priv->cow == NULL || (flags & MOVE_WRITE) == 0);
+
+ assert(!priv->mapped);
+ pixmap->devPrivate.ptr =
+ kgem_bo_map__cpu(&sna->kgem, priv->gpu_bo);
+ if (pixmap->devPrivate.ptr != NULL) {
+ assert(has_coherent_map(sna, priv->gpu_bo));
+ assert(IS_CPU_MAP(priv->gpu_bo->map));
+ pixmap->devKind = priv->gpu_bo->pitch;
+ priv->cpu = true;
+ priv->mapped = true;
+ if (flags & MOVE_WRITE) {
+ if (!DAMAGE_IS_ALL(priv->gpu_damage)) {
+ sna_damage_add(&priv->gpu_damage, region);
+ if (sna_damage_is_all(&priv->gpu_damage,
+ pixmap->drawable.width,
+ pixmap->drawable.height)) {
+ DBG(("%s: replaced entire pixmap, destroying CPU shadow\n",
+ __FUNCTION__));
+ assert(priv->cpu == false || (priv->mapped && IS_CPU_MAP(priv->gpu_bo->map)));
+ sna_damage_destroy(&priv->cpu_damage);
+ list_del(&priv->flush_list);
+ } else
+ sna_damage_subtract(&priv->cpu_damage,
+ region);
+ }
+ priv->clear = false;
+ }
+ assert_pixmap_damage(pixmap);
+ kgem_bo_sync__cpu_full(&sna->kgem, priv->gpu_bo,
+ FORCE_FULL_SYNC || flags & MOVE_WRITE);
+ assert(pixmap->devPrivate.ptr == (void *)((unsigned long)priv->gpu_bo->map & ~3));
+ assert((flags & MOVE_WRITE) == 0 || !kgem_bo_is_busy(priv->gpu_bo));
+ assert_pixmap_damage(pixmap);
+ if (dx | dy)
+ RegionTranslate(region, -dx, -dy);
+ DBG(("%s: operate inplace (CPU)\n", __FUNCTION__));
+ return true;
+ }
+ }
+
if ((priv->clear || (flags & MOVE_READ) == 0) &&
priv->cpu_bo && !priv->cpu_bo->flush &&
__kgem_bo_is_busy(&sna->kgem, priv->cpu_bo)) {
commit 18ee5c20d5f8f1752b89f2377e9b9c3f1c140d53
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Thu Jun 27 11:49:33 2013 +0100
sna: We can read from cloned pixmaps inplace - so long as we don't write
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 efe00ee..2bbca72 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -1770,7 +1770,7 @@ static inline bool operate_inplace(struct sna_pixmap *priv, unsigned flags)
assert((flags & MOVE_ASYNC_HINT) == 0);
- if (priv->cow) {
+ if (priv->cow && flags & MOVE_WRITE) {
DBG(("%s: no, has COW\n", __FUNCTION__));
return false;
}
@@ -1837,7 +1837,7 @@ _sna_pixmap_move_to_cpu(PixmapPtr pixmap, unsigned int flags)
pixmap_inplace(sna, pixmap, priv, true) &&
sna_pixmap_create_mappable_gpu(pixmap, true)) {
DBG(("%s: write inplace\n", __FUNCTION__));
- assert(priv->cow == NULL);
+ assert(priv->cow == NULL || (flags & MOVE_WRITE) == 0);
assert(!priv->shm);
assert(priv->gpu_bo->exec == NULL);
assert((flags & MOVE_READ) == 0 || priv->cpu_damage == NULL);
@@ -1899,7 +1899,7 @@ skip_inplace_map:
pixmap_inplace(sna, pixmap, priv, (flags & MOVE_READ) == 0) &&
sna_pixmap_create_mappable_gpu(pixmap, (flags & MOVE_READ) == 0)) {
DBG(("%s: try to operate inplace (GTT)\n", __FUNCTION__));
- assert(priv->cow == NULL);
+ assert(priv->cow == NULL || (flags & MOVE_WRITE) == 0);
assert((flags & MOVE_READ) == 0 || priv->cpu_damage == NULL);
/* XXX only sync for writes? */
kgem_bo_submit(&sna->kgem, priv->gpu_bo);
@@ -1941,7 +1941,7 @@ skip_inplace_map:
((flags & (MOVE_WRITE | MOVE_ASYNC_HINT)) == 0 ||
!__kgem_bo_is_busy(&sna->kgem, priv->gpu_bo))) {
DBG(("%s: try to operate inplace (CPU)\n", __FUNCTION__));
- assert(priv->cow == NULL);
+ assert(priv->cow == NULL || (flags & MOVE_WRITE) == 0);
assert(!priv->mapped);
pixmap->devPrivate.ptr =
@@ -2292,7 +2292,7 @@ sna_drawable_move_region_to_cpu(DrawablePtr drawable,
region_inplace(sna, pixmap, region, priv, (flags & MOVE_READ) == 0) &&
sna_pixmap_create_mappable_gpu(pixmap, false)) {
DBG(("%s: try to operate inplace\n", __FUNCTION__));
- assert(priv->cow == NULL);
+ assert(priv->cow == NULL || (flags & MOVE_WRITE) == 0);
/* XXX only sync for writes? */
kgem_bo_submit(&sna->kgem, priv->gpu_bo);
assert(priv->gpu_bo->exec == NULL);
commit 36993618b4c5d4fa1fde7800eaaa711b074bd623
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Thu Jun 27 10:48:23 2013 +0100
sna: Tweak ordering of userptr temporary mappings for uploads
There are a few more circumstances where the temporary mapping is
beneficial, such as pixmaps that are only shadow copies or operations
that require reads on the destination.
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 a0e3114..efe00ee 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -5089,11 +5089,27 @@ sna_copy_boxes(DrawablePtr src, DrawablePtr dst, GCPtr gc,
return;
}
+ if (src_priv) {
+ bool ret;
+
+ RegionTranslate(region, src_dx, src_dy);
+ ret = sna_drawable_move_region_to_cpu(&src_pixmap->drawable,
+ region, MOVE_READ);
+ RegionTranslate(region, -src_dx, -src_dy);
+ if (!ret)
+ goto fallback;
+
+ assert(!src_priv->mapped);
+ if (src_pixmap->devPrivate.ptr == NULL)
+ /* uninitialised!*/
+ return;
+ }
+
if (USE_USERPTR_UPLOADS &&
- src_priv == NULL &&
sna->kgem.has_userptr &&
- box_inplace(src_pixmap, ®ion->extents) &&
- __kgem_bo_is_busy(&sna->kgem, bo)) {
+ (alu != GXcopy ||
+ (box_inplace(src_pixmap, ®ion->extents)) &&
+ __kgem_bo_is_busy(&sna->kgem, bo))) {
struct kgem_bo *src_bo;
bool ok = false;
@@ -5126,22 +5142,6 @@ sna_copy_boxes(DrawablePtr src, DrawablePtr dst, GCPtr gc,
}
}
- if (src_priv) {
- bool ret;
-
- RegionTranslate(region, src_dx, src_dy);
- ret = sna_drawable_move_region_to_cpu(&src_pixmap->drawable,
- region, MOVE_READ);
- RegionTranslate(region, -src_dx, -src_dy);
- if (!ret)
- goto fallback;
-
- assert(!src_priv->mapped);
- if (src_pixmap->devPrivate.ptr == NULL)
- /* uninitialised!*/
- return;
- }
-
if (alu != GXcopy) {
PixmapPtr tmp;
struct kgem_bo *src_bo;
More information about the xorg-commit
mailing list