summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2016-10-23 20:52:55 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2016-10-23 20:54:03 +0100
commit388fd4a65411f4984768132eab380b9a67f14e3c (patch)
tree07b395f1b0c5ee36cb07bc414cd457cf4316e8a0
parent90172d81ea762eeca4cfb3796fab83cff9f0acaa (diff)
sna: Check current fb id before flip as well as after
More debug sanity checks that pageflips work. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/kgem.c2
-rw-r--r--src/sna/sna_display.c22
2 files changed, 15 insertions, 9 deletions
diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index 20ca9b91..c57624cc 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -5353,7 +5353,7 @@ bool kgem_bo_is_fenced(struct kgem *kgem, struct kgem_bo *bo)
VG_CLEAR(tiling);
tiling.handle = bo->handle;
- tiling.tiling_mode = 0;
+ tiling.tiling_mode = bo->tiling;
(void)do_ioctl(kgem->fd, DRM_IOCTL_I915_GEM_GET_TILING, &tiling);
return tiling.tiling_mode == bo->tiling; /* assume pitch is fine! */
}
diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c
index caa238e7..db2bd146 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -564,6 +564,15 @@ static void assert_scanout(struct kgem *kgem, struct kgem_bo *bo,
#define assert_scanout(k, b, w, h)
#endif
+static void assert_crtc_fb(struct sna *sna, struct sna_crtc *crtc)
+{
+#ifndef NDEBUG
+ struct drm_mode_crtc mode = { .crtc_id = __sna_crtc_id(crtc) };
+ drmIoctl(sna->kgem.fd, DRM_IOCTL_MODE_GETCRTC, &mode);
+ assert(mode.fb_id == fb_id(crtc->bo));
+#endif
+}
+
static unsigned get_fb(struct sna *sna, struct kgem_bo *bo,
int width, int height)
{
@@ -6709,6 +6718,7 @@ sna_page_flip(struct sna *sna,
assert(crtc->bo->refcnt >= crtc->bo->active_scanout);
assert(crtc->flip_bo == NULL);
+ assert_crtc_fb(sna, crtc);
if (data == NULL && crtc->bo == bo)
goto next_crtc;
@@ -8881,6 +8891,7 @@ void sna_mode_redisplay(struct sna *sna)
sna_crtc_redisplay(crtc, &damage, bo);
kgem_bo_submit(&sna->kgem, bo);
+ assert_crtc_fb(sna, sna_crtc);
arg.crtc_id = __sna_crtc_id(sna_crtc);
arg.fb_id = get_fb(sna, bo,
crtc->mode.HDisplay,
@@ -8998,6 +9009,7 @@ disable1:
assert(config->crtc[i]->enabled);
assert(crtc->flip_bo == NULL);
+ assert_crtc_fb(sna, crtc);
arg.crtc_id = __sna_crtc_id(crtc);
arg.user_data = (uintptr_t)crtc;
@@ -9213,14 +9225,6 @@ again:
assert(crtc->bo->active_scanout);
assert(crtc->bo->refcnt >= crtc->bo->active_scanout);
-#ifndef NDEBUG
- {
- struct drm_mode_crtc mode = { .crtc_id = __sna_crtc_id(crtc) };
- drmIoctl(sna->kgem.fd, DRM_IOCTL_MODE_GETCRTC, &mode);
- assert(mode.fb_id == fb_id(crtc->flip_bo));
- }
-#endif
-
crtc->bo->active_scanout--;
kgem_bo_destroy(&sna->kgem, crtc->bo);
@@ -9231,6 +9235,8 @@ again:
crtc->bo = crtc->flip_bo;
crtc->flip_bo = NULL;
+
+ assert_crtc_fb(sna, crtc);
} else {
crtc->flip_bo->active_scanout--;
kgem_bo_destroy(&sna->kgem, crtc->flip_bo);