diff options
-rw-r--r-- | drmtest.c | 58 |
1 files changed, 29 insertions, 29 deletions
@@ -219,7 +219,7 @@ static void drm_zap_mappings(void) /* ------------------------------------------------------------------ */ -static void drm_init_dumb_obj(int fd, bool create_dmabuf) +static void drm_init_dumb_obj(int fd, bool use_pixman, bool create_dmabuf) { struct drm_mode_map_dumb mreq; int rc; @@ -267,6 +267,33 @@ static void drm_init_dumb_obj(int fd, bool create_dmabuf) } } } + + if (use_pixman) { + pxfb = pixman_image_create_bits(fmt->pixman, + creq.width, + creq.height, + (void*)fbmem, + creq.pitch); + pxref = pixman_image_create_bits(fmt->pixman, + creq.width, + creq.height, + NULL, 0); + pxcs = pixman_image_create_bits(PIXMAN_x2r10g10b10, + creq.width, + creq.height, + NULL, 0); + cs = cairo_image_surface_create_for_data((void*)pixman_image_get_data(pxcs), + CAIRO_FORMAT_RGB30, + creq.width, + creq.height, + pixman_image_get_stride(pxcs)); + } else { + cs = cairo_image_surface_create_for_data(fbmem, + fmt->cairo, + creq.width, + creq.height, + creq.pitch); + } } static void drm_init_dumb_fb(bool use_pixman, bool create_dmabuf) @@ -274,7 +301,7 @@ static void drm_init_dumb_fb(bool use_pixman, bool create_dmabuf) uint32_t zero = 0; int rc; - drm_init_dumb_obj(drm_fd, create_dmabuf); + drm_init_dumb_obj(drm_fd, use_pixman, create_dmabuf); if (fmt->fourcc) { rc = drmModeAddFB2(drm_fd, creq.width, creq.height, fmt->fourcc, @@ -297,33 +324,6 @@ static void drm_init_dumb_fb(bool use_pixman, bool create_dmabuf) exit(1); } } - - if (use_pixman) { - pxfb = pixman_image_create_bits(fmt->pixman, - creq.width, - creq.height, - (void*)fbmem, - creq.pitch); - pxref = pixman_image_create_bits(fmt->pixman, - creq.width, - creq.height, - NULL, 0); - pxcs = pixman_image_create_bits(PIXMAN_x2r10g10b10, - creq.width, - creq.height, - NULL, 0); - cs = cairo_image_surface_create_for_data((void*)pixman_image_get_data(pxcs), - CAIRO_FORMAT_RGB30, - creq.width, - creq.height, - pixman_image_get_stride(pxcs)); - } else { - cs = cairo_image_surface_create_for_data(fbmem, - fmt->cairo, - creq.width, - creq.height, - creq.pitch); - } } static void drm_draw_dumb_fb(bool autotest, int updatetest) |