Message ID | 20250324081922.359369-3-yuq825@gmail.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | ui: support multi plane texture | expand |
Hi On Mon, Mar 24, 2025 at 12:19 PM <yuq825@gmail.com> wrote: > > From: Qiang Yu <yuq825@gmail.com> > > It's used already, just check it explicitly. > > Signed-off-by: Qiang Yu <yuq825@gmail.com> > --- > ui/egl-helpers.c | 10 ++++++---- > 1 file changed, 6 insertions(+), 4 deletions(-) > > diff --git a/ui/egl-helpers.c b/ui/egl-helpers.c > index 72a1405782..45b1b0b700 100644 > --- a/ui/egl-helpers.c > +++ b/ui/egl-helpers.c > @@ -257,6 +257,11 @@ int egl_rendernode_init(const char *rendernode, DisplayGLMode mode) > error_report("egl: EGL_MESA_image_dma_buf_export not supported"); > goto err; > } > + if (!epoxy_has_egl_extension(qemu_egl_display, > + "EGL_EXT_image_dma_buf_import_modifiers")) { > + error_report("egl: EGL_EXT_image_dma_buf_import_modifiers not supported"); > + goto err; > + } > > qemu_egl_rn_ctx = qemu_egl_init_ctx(); > if (!qemu_egl_rn_ctx) { > @@ -308,7 +313,7 @@ void egl_dmabuf_import_texture(QemuDmaBuf *dmabuf) > EGLImageKHR image = EGL_NO_IMAGE_KHR; > EGLint attrs[64]; > int i = 0; > - uint64_t modifier; > + uint64_t modifier = qemu_dmabuf_get_modifier(dmabuf); > uint32_t texture = qemu_dmabuf_get_texture(dmabuf); > > if (texture != 0) { > @@ -328,15 +333,12 @@ void egl_dmabuf_import_texture(QemuDmaBuf *dmabuf) > attrs[i++] = qemu_dmabuf_get_stride(dmabuf)[0]; > attrs[i++] = EGL_DMA_BUF_PLANE0_OFFSET_EXT; > attrs[i++] = 0; > -#ifdef EGL_DMA_BUF_PLANE0_MODIFIER_LO_EXT We should check for that define during meson.build when gbm.found(), to avoid potential later build errors. > - modifier = qemu_dmabuf_get_modifier(dmabuf); > if (modifier) { > attrs[i++] = EGL_DMA_BUF_PLANE0_MODIFIER_LO_EXT; > attrs[i++] = (modifier >> 0) & 0xffffffff; > attrs[i++] = EGL_DMA_BUF_PLANE0_MODIFIER_HI_EXT; > attrs[i++] = (modifier >> 32) & 0xffffffff; > } > -#endif > attrs[i++] = EGL_NONE; > > image = eglCreateImageKHR(qemu_egl_display, > -- > 2.43.0 >
On Mon, Mar 24, 2025 at 6:09 PM Marc-André Lureau <marcandre.lureau@redhat.com> wrote: > > Hi > > On Mon, Mar 24, 2025 at 12:19 PM <yuq825@gmail.com> wrote: > > > > From: Qiang Yu <yuq825@gmail.com> > > > > It's used already, just check it explicitly. > > > > Signed-off-by: Qiang Yu <yuq825@gmail.com> > > --- > > ui/egl-helpers.c | 10 ++++++---- > > 1 file changed, 6 insertions(+), 4 deletions(-) > > > > diff --git a/ui/egl-helpers.c b/ui/egl-helpers.c > > index 72a1405782..45b1b0b700 100644 > > --- a/ui/egl-helpers.c > > +++ b/ui/egl-helpers.c > > @@ -257,6 +257,11 @@ int egl_rendernode_init(const char *rendernode, DisplayGLMode mode) > > error_report("egl: EGL_MESA_image_dma_buf_export not supported"); > > goto err; > > } > > + if (!epoxy_has_egl_extension(qemu_egl_display, > > + "EGL_EXT_image_dma_buf_import_modifiers")) { > > + error_report("egl: EGL_EXT_image_dma_buf_import_modifiers not supported"); > > + goto err; > > + } > > > > qemu_egl_rn_ctx = qemu_egl_init_ctx(); > > if (!qemu_egl_rn_ctx) { > > @@ -308,7 +313,7 @@ void egl_dmabuf_import_texture(QemuDmaBuf *dmabuf) > > EGLImageKHR image = EGL_NO_IMAGE_KHR; > > EGLint attrs[64]; > > int i = 0; > > - uint64_t modifier; > > + uint64_t modifier = qemu_dmabuf_get_modifier(dmabuf); > > uint32_t texture = qemu_dmabuf_get_texture(dmabuf); > > > > if (texture != 0) { > > @@ -328,15 +333,12 @@ void egl_dmabuf_import_texture(QemuDmaBuf *dmabuf) > > attrs[i++] = qemu_dmabuf_get_stride(dmabuf)[0]; > > attrs[i++] = EGL_DMA_BUF_PLANE0_OFFSET_EXT; > > attrs[i++] = 0; > > -#ifdef EGL_DMA_BUF_PLANE0_MODIFIER_LO_EXT > > We should check for that define during meson.build when gbm.found(), > to avoid potential later build errors. > This macro should be in EGL header for many years as this is a 2015 EGL extension. Check the macro in meson.build is not necessary now like you won't check all other EGL macros like EGL_DMA_BUF_PLANE0_OFFSET_EXT. > > - modifier = qemu_dmabuf_get_modifier(dmabuf); > > if (modifier) { > > attrs[i++] = EGL_DMA_BUF_PLANE0_MODIFIER_LO_EXT; > > attrs[i++] = (modifier >> 0) & 0xffffffff; > > attrs[i++] = EGL_DMA_BUF_PLANE0_MODIFIER_HI_EXT; > > attrs[i++] = (modifier >> 32) & 0xffffffff; > > } > > -#endif > > attrs[i++] = EGL_NONE; > > > > image = eglCreateImageKHR(qemu_egl_display, > > -- > > 2.43.0 > > >
Hi On Mon, Mar 24, 2025 at 5:27 PM Qiang Yu <yuq825@gmail.com> wrote: > > On Mon, Mar 24, 2025 at 6:09 PM Marc-André Lureau > <marcandre.lureau@redhat.com> wrote: > > > > Hi > > > > On Mon, Mar 24, 2025 at 12:19 PM <yuq825@gmail.com> wrote: > > > > > > From: Qiang Yu <yuq825@gmail.com> > > > > > > It's used already, just check it explicitly. > > > > > > Signed-off-by: Qiang Yu <yuq825@gmail.com> > > > --- > > > ui/egl-helpers.c | 10 ++++++---- > > > 1 file changed, 6 insertions(+), 4 deletions(-) > > > > > > diff --git a/ui/egl-helpers.c b/ui/egl-helpers.c > > > index 72a1405782..45b1b0b700 100644 > > > --- a/ui/egl-helpers.c > > > +++ b/ui/egl-helpers.c > > > @@ -257,6 +257,11 @@ int egl_rendernode_init(const char *rendernode, DisplayGLMode mode) > > > error_report("egl: EGL_MESA_image_dma_buf_export not supported"); > > > goto err; > > > } > > > + if (!epoxy_has_egl_extension(qemu_egl_display, > > > + "EGL_EXT_image_dma_buf_import_modifiers")) { > > > + error_report("egl: EGL_EXT_image_dma_buf_import_modifiers not supported"); > > > + goto err; > > > + } > > > > > > qemu_egl_rn_ctx = qemu_egl_init_ctx(); > > > if (!qemu_egl_rn_ctx) { > > > @@ -308,7 +313,7 @@ void egl_dmabuf_import_texture(QemuDmaBuf *dmabuf) > > > EGLImageKHR image = EGL_NO_IMAGE_KHR; > > > EGLint attrs[64]; > > > int i = 0; > > > - uint64_t modifier; > > > + uint64_t modifier = qemu_dmabuf_get_modifier(dmabuf); > > > uint32_t texture = qemu_dmabuf_get_texture(dmabuf); > > > > > > if (texture != 0) { > > > @@ -328,15 +333,12 @@ void egl_dmabuf_import_texture(QemuDmaBuf *dmabuf) > > > attrs[i++] = qemu_dmabuf_get_stride(dmabuf)[0]; > > > attrs[i++] = EGL_DMA_BUF_PLANE0_OFFSET_EXT; > > > attrs[i++] = 0; > > > -#ifdef EGL_DMA_BUF_PLANE0_MODIFIER_LO_EXT > > > > We should check for that define during meson.build when gbm.found(), > > to avoid potential later build errors. > > > This macro should be in EGL header for many years as this is a 2015 EGL > extension. Check the macro in meson.build is not necessary now like you > won't check all other EGL macros like EGL_DMA_BUF_PLANE0_OFFSET_EXT. Imho we should still check for those macros, as they are extensions to egl.
On Mon, Mar 24, 2025 at 9:45 PM Marc-André Lureau <marcandre.lureau@gmail.com> wrote: > > Hi > > On Mon, Mar 24, 2025 at 5:27 PM Qiang Yu <yuq825@gmail.com> wrote: > > > > On Mon, Mar 24, 2025 at 6:09 PM Marc-André Lureau > > <marcandre.lureau@redhat.com> wrote: > > > > > > Hi > > > > > > On Mon, Mar 24, 2025 at 12:19 PM <yuq825@gmail.com> wrote: > > > > > > > > From: Qiang Yu <yuq825@gmail.com> > > > > > > > > It's used already, just check it explicitly. > > > > > > > > Signed-off-by: Qiang Yu <yuq825@gmail.com> > > > > --- > > > > ui/egl-helpers.c | 10 ++++++---- > > > > 1 file changed, 6 insertions(+), 4 deletions(-) > > > > > > > > diff --git a/ui/egl-helpers.c b/ui/egl-helpers.c > > > > index 72a1405782..45b1b0b700 100644 > > > > --- a/ui/egl-helpers.c > > > > +++ b/ui/egl-helpers.c > > > > @@ -257,6 +257,11 @@ int egl_rendernode_init(const char *rendernode, DisplayGLMode mode) > > > > error_report("egl: EGL_MESA_image_dma_buf_export not supported"); > > > > goto err; > > > > } > > > > + if (!epoxy_has_egl_extension(qemu_egl_display, > > > > + "EGL_EXT_image_dma_buf_import_modifiers")) { > > > > + error_report("egl: EGL_EXT_image_dma_buf_import_modifiers not supported"); > > > > + goto err; > > > > + } > > > > > > > > qemu_egl_rn_ctx = qemu_egl_init_ctx(); > > > > if (!qemu_egl_rn_ctx) { > > > > @@ -308,7 +313,7 @@ void egl_dmabuf_import_texture(QemuDmaBuf *dmabuf) > > > > EGLImageKHR image = EGL_NO_IMAGE_KHR; > > > > EGLint attrs[64]; > > > > int i = 0; > > > > - uint64_t modifier; > > > > + uint64_t modifier = qemu_dmabuf_get_modifier(dmabuf); > > > > uint32_t texture = qemu_dmabuf_get_texture(dmabuf); > > > > > > > > if (texture != 0) { > > > > @@ -328,15 +333,12 @@ void egl_dmabuf_import_texture(QemuDmaBuf *dmabuf) > > > > attrs[i++] = qemu_dmabuf_get_stride(dmabuf)[0]; > > > > attrs[i++] = EGL_DMA_BUF_PLANE0_OFFSET_EXT; > > > > attrs[i++] = 0; > > > > -#ifdef EGL_DMA_BUF_PLANE0_MODIFIER_LO_EXT > > > > > > We should check for that define during meson.build when gbm.found(), > > > to avoid potential later build errors. > > > > > This macro should be in EGL header for many years as this is a 2015 EGL > > extension. Check the macro in meson.build is not necessary now like you > > won't check all other EGL macros like EGL_DMA_BUF_PLANE0_OFFSET_EXT. > > Imho we should still check for those macros, as they are extensions to egl. > Macros like EGL_DMA_BUF_PLANE0_OFFSET_EXT are also from EGL extension but we don't check them. EGL_DMA_BUF_PLANE0_MODIFIER_LO_EXT makes no difference. And we do need this macro to be always present to make sure exporter and importer of the texture to work correctly. > > -- > Marc-André Lureau
diff --git a/ui/egl-helpers.c b/ui/egl-helpers.c index 72a1405782..45b1b0b700 100644 --- a/ui/egl-helpers.c +++ b/ui/egl-helpers.c @@ -257,6 +257,11 @@ int egl_rendernode_init(const char *rendernode, DisplayGLMode mode) error_report("egl: EGL_MESA_image_dma_buf_export not supported"); goto err; } + if (!epoxy_has_egl_extension(qemu_egl_display, + "EGL_EXT_image_dma_buf_import_modifiers")) { + error_report("egl: EGL_EXT_image_dma_buf_import_modifiers not supported"); + goto err; + } qemu_egl_rn_ctx = qemu_egl_init_ctx(); if (!qemu_egl_rn_ctx) { @@ -308,7 +313,7 @@ void egl_dmabuf_import_texture(QemuDmaBuf *dmabuf) EGLImageKHR image = EGL_NO_IMAGE_KHR; EGLint attrs[64]; int i = 0; - uint64_t modifier; + uint64_t modifier = qemu_dmabuf_get_modifier(dmabuf); uint32_t texture = qemu_dmabuf_get_texture(dmabuf); if (texture != 0) { @@ -328,15 +333,12 @@ void egl_dmabuf_import_texture(QemuDmaBuf *dmabuf) attrs[i++] = qemu_dmabuf_get_stride(dmabuf)[0]; attrs[i++] = EGL_DMA_BUF_PLANE0_OFFSET_EXT; attrs[i++] = 0; -#ifdef EGL_DMA_BUF_PLANE0_MODIFIER_LO_EXT - modifier = qemu_dmabuf_get_modifier(dmabuf); if (modifier) { attrs[i++] = EGL_DMA_BUF_PLANE0_MODIFIER_LO_EXT; attrs[i++] = (modifier >> 0) & 0xffffffff; attrs[i++] = EGL_DMA_BUF_PLANE0_MODIFIER_HI_EXT; attrs[i++] = (modifier >> 32) & 0xffffffff; } -#endif attrs[i++] = EGL_NONE; image = eglCreateImageKHR(qemu_egl_display,