summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorVille Syrjälä <ville.syrjala@linux.intel.com>2019-09-18 16:35:33 +0300
committerVille Syrjälä <ville.syrjala@linux.intel.com>2019-10-03 22:38:52 +0300
commit1601e1571eb0f29a06b64494040b3ea7859a650f (patch)
tree4d6e78d47755fb59309774edb97b042f9755822f /lib
parentf97fcd7bcfe8146660b618021b02eca48fd46b36 (diff)
lib/igt_fb: Extract use_convert()
Extract the "should we use a convert surface?" logic into a small helper in the vein of use_blitter() and use_rendercopy(). Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'lib')
-rw-r--r--lib/igt_fb.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index 612c25d5..41c646d6 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -3192,6 +3192,16 @@ void igt_fb_unmap_buffer(struct igt_fb *fb, void *buffer)
return unmap_bo(fb, buffer);
}
+static bool use_convert(const struct igt_fb *fb)
+{
+ const struct format_desc_struct *f = lookup_drm_format(fb->drm_format);
+
+ return igt_format_is_yuv(fb->drm_format) ||
+ igt_format_is_fp16(fb->drm_format) ||
+ (f->cairo_id == CAIRO_FORMAT_INVALID &&
+ f->pixman_id != PIXMAN_invalid);
+}
+
/**
* igt_get_cairo_surface:
* @fd: open drm file descriptor
@@ -3208,10 +3218,7 @@ cairo_surface_t *igt_get_cairo_surface(int fd, struct igt_fb *fb)
const struct format_desc_struct *f = lookup_drm_format(fb->drm_format);
if (fb->cairo_surface == NULL) {
- if (igt_format_is_yuv(fb->drm_format) ||
- igt_format_is_fp16(fb->drm_format) ||
- ((f->cairo_id == CAIRO_FORMAT_INVALID) &&
- (f->pixman_id != PIXMAN_invalid)))
+ if (use_convert(fb))
create_cairo_surface__convert(fd, fb);
else if (use_blitter(fb) || use_rendercopy(fb) || igt_vc4_is_tiled(fb->modifier))
create_cairo_surface__gpu(fd, fb);