diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2013-05-30 14:57:56 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2013-05-30 15:06:42 +0100 |
commit | 08b33ba8f12bb4bc425ca1bc40e2660e446e2c65 (patch) | |
tree | 5d27f5f8efd24294882e83da3a3897f935f45d8e /src | |
parent | a9acc8dbb436e1e523e7d7c0f3c41946a2d0f245 (diff) |
sna: Assert that an existing scanout is the desired size
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src')
-rw-r--r-- | src/sna/sna_display.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c index 6cade448..3231ca03 100644 --- a/src/sna/sna_display.c +++ b/src/sna/sna_display.c @@ -145,6 +145,25 @@ uint32_t sna_crtc_to_plane(xf86CrtcPtr crtc) return to_sna_crtc(crtc)->plane; } +#ifndef NDEBUG +static void gem_close(int fd, uint32_t handle); +static void assert_scanout(struct kgem *kgem, struct kgem_bo *bo, + int width, int height) +{ + struct drm_mode_fb_cmd info; + + assert(bo->scanout); + + VG_CLEAR(info); + info.fb_id = bo->delta; + + assert(drmIoctl(kgem->fd, DRM_IOCTL_MODE_GETFB, &info) == 0); + gem_close(kgem->fd, info.handle); + + assert(width == info.width && height == info.height); +} +#endif + static unsigned get_fb(struct sna *sna, struct kgem_bo *bo, int width, int height) { @@ -157,6 +176,7 @@ static unsigned get_fb(struct sna *sna, struct kgem_bo *bo, if (bo->delta) { DBG(("%s: reusing fb=%d for handle=%d\n", __FUNCTION__, bo->delta, bo->handle)); + assert_scanout(&sna->kgem, bo, width, height); return bo->delta; } |