[PATCH] linux-dmabuf: send deprecated format events
Philipp Zabel
p.zabel at pengutronix.de
Fri Dec 15 17:19:13 UTC 2017
On Fri, 2017-12-15 at 10:51 +0000, Daniel Stone wrote:
> Hi Philipp,
>
> On 15 December 2017 at 10:46, Philipp Zabel <p.zabel at pengutronix.de> wrote:
> > On Fri, 2017-12-15 at 09:46 +0000, Daniel Stone wrote:
> > > On 15 December 2017 at 09:25, Philipp Zabel <p.zabel at pengutronix.de> wrote:
> > > > Send format events instead of the modifier event, if the client binds on
> > > > a protocol version before version 3, skipping formats that only support
> > > > non-linear modifiers.
> > >
> > > Thanks for this! Could I please persuade you to take on one additional
> > > change though?
> > >
> > > Specifically, if has_dmabuf_import_modifiers is not supported,
> > > gl-renderer will return 0 for num_formats. In this case, it seems like
> > > we should send a conservative list: ARGB8888, XRGB8888, and maybe
> > > speculatively the YUV formats we have hardcoded conversions for
> > > (provided we have R8/RG8 support, cf. the patches from Arnaud).
> >
> > Should we modify gl_renderer_query_dmabuf_formats to return that list of
> > hardcoded formats if has_dmabuf_import_modifiers is not supported?
>
> That was exactly what I had in mind.
>
> Cheers,
> Daniel
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/wayland-devel
I haven't tested this yet with has_dmabuf_import_modifiers disabled, but
looking at this, I wonder whether this is the right thing to do.
If has_dmabuf_import_modifiers is set and the driver reports R8/RG88 in
query_dmabuf_formats, shouldn't we add the YUV formats as well?
----------8<----------
gl-renderer: return conservative format list if dmabuf import modifiers unsupported
If the EGL_EXT_image_dma_buf_import_modifiers extension is not
supported, let gl_renderer_query_dmabuf_formats return a hardcoded
fallback list. That list contains ARGB8888, XRGB8888, and if the
GL_EXT_texture_rg extension is supported, YUYV, NV12, YUV420, and
YUV444.
Signed-off-by: Philipp Zabel <p.zabel at pengutronix.de>
diff --git a/libweston/gl-renderer.c b/libweston/gl-renderer.c
index abf556f0..ee31a86d 100644
--- a/libweston/gl-renderer.c
+++ b/libweston/gl-renderer.c
@@ -2088,14 +2088,23 @@ gl_renderer_query_dmabuf_formats(struct weston_compositor *wc,
int **formats, int *num_formats)
{
struct gl_renderer *gr = get_renderer(wc);
+ int fallback_formats[] = {
+ DRM_FORMAT_ARGB8888,
+ DRM_FORMAT_XRGB8888,
+ DRM_FORMAT_YUYV,
+ DRM_FORMAT_NV12,
+ DRM_FORMAT_YUV420,
+ DRM_FORMAT_YUV444,
+ };
+ bool fallback = false;
EGLint num;
assert(gr->has_dmabuf_import);
if (!gr->has_dmabuf_import_modifiers ||
!gr->query_dmabuf_formats(gr->egl_display, 0, NULL, &num)) {
- *num_formats = 0;
- return;
+ num = gr->has_gl_texture_rg ? ARRAY_LENGTH(fallback_formats) : 2;
+ fallback = true;
}
*formats = calloc(num, sizeof(int));
@@ -2103,6 +2112,13 @@ gl_renderer_query_dmabuf_formats(struct weston_compositor *wc,
*num_formats = 0;
return;
}
+
+ if (fallback) {
+ memcpy(formats, fallback_formats, num * sizeof(int));
+ *num_formats = num;
+ return;
+ }
+
if (!gr->query_dmabuf_formats(gr->egl_display, num, *formats, &num)) {
*num_formats = 0;
free(*formats);
---------->8----------
regards
Philipp
More information about the wayland-devel
mailing list