[igt-dev] [PATCH i-g-t 2/2] lib/igt_fb: Extract use_convert()

Chris Wilson chris at chris-wilson.co.uk
Mon Sep 30 19:35:59 UTC 2019


Quoting Ville Syrjala (2019-09-18 14:51:56)
> From: Ville Syrjälä <ville.syrjala at linux.intel.com>
> 
> 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 at linux.intel.com>
> ---
>  lib/igt_fb.c | 15 +++++++++++----
>  1 file changed, 11 insertions(+), 4 deletions(-)
> 
> diff --git a/lib/igt_fb.c b/lib/igt_fb.c
> index 612c25d5baed..41c646d655d6 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))

Purely mechanical,
Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
-Chris


More information about the igt-dev mailing list