xf86-video-intel: 3 commits - src/sna/sna_damage.c src/sna/sna_display.c
Chris Wilson
ickle at kemper.freedesktop.org
Mon Apr 14 22:56:14 PDT 2014
src/sna/sna_damage.c | 29 +++++++++++++++++++----------
src/sna/sna_display.c | 17 +++++++++++++++--
2 files changed, 34 insertions(+), 12 deletions(-)
New commits:
commit 1ed8647aef012d30c602f86fc6f97a0a92d7710f
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Tue Apr 15 06:55:26 2014 +0100
sna: Add a cursor DBG for a failed pwrite update
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 6c43bb0..a2ba5da 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -3262,7 +3262,8 @@ static struct sna_cursor *__sna_get_cursor(struct sna *sna, xf86CrtcPtr crtc)
pwrite.offset = 0;
pwrite.size = 4*size*size;
pwrite.data_ptr = (uintptr_t)image;
- (void)drmIoctl(sna->kgem.fd, DRM_IOCTL_I915_GEM_PWRITE, &pwrite);
+ if (drmIoctl(sna->kgem.fd, DRM_IOCTL_I915_GEM_PWRITE, &pwrite))
+ __DBG(("%s: cursor update (pwrite) failed: %d\n", errno));
free(image);
}
commit cb35b397395cff8ff7f5155759f58c1840bfeeb5
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Mon Apr 14 17:12:37 2014 +0100
sna: Rearrange cursor reuse to avoid sharing rotations
Try not to steal a rotated cursor that is currently in use, or else we
may see a brief flash of corruption.
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 3f2b912..6c43bb0 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -3160,14 +3160,26 @@ static struct sna_cursor *__sna_get_cursor(struct sna *sna, xf86CrtcPtr crtc)
size = sna->cursor.size;
for (cursor = sna->cursor.cursors; cursor; cursor = cursor->next) {
- if (cursor->alloc >= 4*size*size && cursor->serial != sna->cursor.serial) {
+ if (cursor->alloc >= 4*size*size && cursor->rotation == rotation) {
__DBG(("%s: stealing handle=%d, serial=%d, rotation=%d, alloc=%d\n",
__FUNCTION__, cursor->handle, cursor->serial, cursor->rotation, cursor->alloc));
+ assert(cursor->serial != sna->cursor.serial);
break;
}
}
if (cursor == NULL) {
+ for (cursor = sna->cursor.cursors; cursor; cursor = cursor->next) {
+ if (cursor->alloc >= 4*size*size && cursor->serial != sna->cursor.serial) {
+ __DBG(("%s: stealing handle=%d, serial=%d, rotation=%d, alloc=%d\n",
+ __FUNCTION__, cursor->handle, cursor->serial, cursor->rotation, cursor->alloc));
+ assert(cursor->rotation != sna->cursor.rotation);
+ break;
+ }
+ }
+ }
+
+ if (cursor == NULL) {
cursor = __sna_create_cursor(sna);
if (cursor == NULL)
return NULL;
commit fd700c37ee2a68262b1ccfff332dd41ba8599e2c
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Mon Apr 14 16:48:05 2014 +0100
sna: Add some bounds checking asserts to damage
References: https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-video-intel/+bug/1300640
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
diff --git a/src/sna/sna_damage.c b/src/sna/sna_damage.c
index f98c282..d4b3515 100644
--- a/src/sna/sna_damage.c
+++ b/src/sna/sna_damage.c
@@ -155,6 +155,14 @@ static const char *_debug_describe_damage(char *buf, int max,
}
#endif
+static struct sna_damage_box *
+last_box(struct sna_damage *damage)
+{
+ return list_entry(damage->embedded_box.list.prev,
+ struct sna_damage_box,
+ list);
+}
+
static void
reset_embedded_box(struct sna_damage *damage)
{
@@ -242,9 +250,7 @@ static void __sna_damage_reduce(struct sna_damage *damage)
if (damage->mode == DAMAGE_ADD)
nboxes += REGION_NUM_RECTS(region);
- iter = list_entry(damage->embedded_box.list.prev,
- struct sna_damage_box,
- list);
+ iter = last_box(damage);
n = iter->size - damage->remain;
boxes = (BoxRec *)(iter+1);
DBG((" last box count=%d/%d, need=%d\n", n, iter->size, nboxes));
@@ -332,16 +338,13 @@ done:
DBG((" reduce: after region.n=%ld\n", (long)REGION_NUM_RECTS(region)));
}
-
static bool _sna_damage_create_boxes(struct sna_damage *damage,
int count)
{
struct sna_damage_box *box;
int n;
- box = list_entry(damage->embedded_box.list.prev,
- struct sna_damage_box,
- list);
+ box = last_box(damage);
n = 4*box->size;
if (n < count)
n = ALIGN(count, 64);
@@ -388,6 +391,8 @@ restart:
}
DBG((" %s(): new elt\n", __FUNCTION__));
+ assert(damage->remain == 0);
+ assert(damage->box - (BoxRec *)(last_box(damage)+1) == last_box(damage)->size);
if (!_sna_damage_create_boxes(damage, count)) {
unsigned mode;
@@ -442,6 +447,8 @@ restart:
}
DBG((" %s(): new elt\n", __FUNCTION__));
+ assert(damage->remain == 0);
+ assert(damage->box - (BoxRec *)(last_box(damage)+1) == last_box(damage)->size);
if (!_sna_damage_create_boxes(damage, count)) {
unsigned mode;
@@ -502,6 +509,8 @@ restart:
}
DBG((" %s(): new elt\n", __FUNCTION__));
+ assert(damage->remain == 0);
+ assert(damage->box - (BoxRec *)(last_box(damage)+1) == last_box(damage)->size);
if (!_sna_damage_create_boxes(damage, count)) {
unsigned mode;
@@ -562,6 +571,8 @@ restart:
}
DBG((" %s(): new elt\n", __FUNCTION__));
+ assert(damage->remain == 0);
+ assert(damage->box - (BoxRec *)(last_box(damage)+1) == last_box(damage)->size);
if (!_sna_damage_create_boxes(damage, count)) {
unsigned mode;
@@ -1815,9 +1826,7 @@ void _sna_damage_debug_get_region(struct sna_damage *damage, RegionRec *r)
if (damage->mode == DAMAGE_ADD)
nboxes += REGION_NUM_RECTS(r);
- iter = list_entry(damage->embedded_box.list.prev,
- struct sna_damage_box,
- list);
+ iter = last_box(damage);
n = iter->size - damage->remain;
boxes = malloc(sizeof(BoxRec)*nboxes);
if (boxes == NULL)
More information about the xorg-commit
mailing list