[PATCH weston 1/9] gl-renderer: support format and modifier queries

Daniel Stone daniel at fooishbar.org
Mon Nov 21 20:07:51 UTC 2016


Hi Varad,

On 17 November 2016 at 11:55, Varad Gautam <varadgautam at gmail.com> wrote:
> @@ -1847,6 +1851,69 @@ import_dmabuf(struct gl_renderer *gr,
>  }
>
>  static bool
> +gl_renderer_query_dmabuf_formats(struct weston_compositor *wc,
> +                               int **formats, int *num_formats)
> +{
> +       struct gl_renderer *gr = get_renderer(wc);
> +       EGLint num;
> +
> +       assert(gr->has_dmabuf_import);
> +
> +       if (!gr->query_dmabuf_formats(gr->egl_display, 0, NULL, &num)) {
> +               *num_formats = 0;
> +               return false;
> +       }
> +
> +       *formats = calloc(1, num * sizeof(int));

calloc(num, sizeof(int))

> +static bool
> +gl_renderer_query_dmabuf_modifiers(struct weston_compositor *wc, int format,
> +                                       uint64_t **modifiers,
> +                                       int *num_modifiers)
> +{
> +       struct gl_renderer *gr = get_renderer(wc);
> +       int num;
> +
> +       assert(gr->has_dmabuf_import);
> +
> +       if (!gr->has_dmabuf_import_modifiers ||
> +               !gr->query_dmabuf_modifiers(gr->egl_display, format, 0, NULL,
> +                                           NULL, &num)) {

The test can just be removed here, as there's none for query_dmabuf_formats.

With those fixed:
Reviewed-by: Daniel Stone <daniels at collabora.com>

Cheers,
Daniel


More information about the wayland-devel mailing list