Cairo surface creation will fail if stride of provided buffer is not
same as expected by cairo. This fails for vmwgfx odd length framebuffer
as in vmwgfx stride is always width * bpp.

Signed-off-by: Deepak Rawat <dra...@vmware.com>
---
 lib/igt_fb.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index ba995a1a..2724e323 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -1349,6 +1349,9 @@ static void create_cairo_surface__gtt(int fd, struct 
igt_fb *fb)
                ptr = gem_mmap__gtt(fd, fb->gem_handle, fb->size,
                                    PROT_READ | PROT_WRITE);
 
+       igt_require(fb->stride == cairo_format_stride_for_width(
+               drm_format_to_cairo(fb->drm_format), fb->width));
+
        fb->cairo_surface =
                cairo_image_surface_create_for_data(ptr,
                                                    
drm_format_to_cairo(fb->drm_format),
-- 
2.17.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to