From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Alex Williamson <alex.williamson@redhat.com>,
Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PATCH v2 4/4] egl-helpers: add modifier support to egl_dmabuf_import_texture()
Date: Fri, 24 May 2019 09:01:18 +0200 [thread overview]
Message-ID: <20190524070118.30157-5-kraxel@redhat.com> (raw)
In-Reply-To: <20190524070118.30157-1-kraxel@redhat.com>
Check and use QemuDmaBuf->modifier in egl_dmabuf_import_texture()
for dmabuf imports.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
ui/egl-helpers.c | 32 +++++++++++++++++++++++---------
1 file changed, 23 insertions(+), 9 deletions(-)
diff --git a/ui/egl-helpers.c b/ui/egl-helpers.c
index 0c9716067cfb..87bfd32e8ddb 100644
--- a/ui/egl-helpers.c
+++ b/ui/egl-helpers.c
@@ -229,20 +229,34 @@ int egl_get_fd_for_texture(uint32_t tex_id, EGLint *stride, EGLint *fourcc,
void egl_dmabuf_import_texture(QemuDmaBuf *dmabuf)
{
EGLImageKHR image = EGL_NO_IMAGE_KHR;
- EGLint attrs[] = {
- EGL_DMA_BUF_PLANE0_FD_EXT, dmabuf->fd,
- EGL_DMA_BUF_PLANE0_PITCH_EXT, dmabuf->stride,
- EGL_DMA_BUF_PLANE0_OFFSET_EXT, 0,
- EGL_WIDTH, dmabuf->width,
- EGL_HEIGHT, dmabuf->height,
- EGL_LINUX_DRM_FOURCC_EXT, dmabuf->fourcc,
- EGL_NONE, /* end of list */
- };
+ EGLint attrs[64];
+ int i = 0;
if (dmabuf->texture != 0) {
return;
}
+ attrs[i++] = EGL_WIDTH;
+ attrs[i++] = dmabuf->width;
+ attrs[i++] = EGL_HEIGHT;
+ attrs[i++] = dmabuf->height;
+ attrs[i++] = EGL_LINUX_DRM_FOURCC_EXT;
+ attrs[i++] = dmabuf->fourcc;
+
+ attrs[i++] = EGL_DMA_BUF_PLANE0_FD_EXT;
+ attrs[i++] = dmabuf->fd;
+ attrs[i++] = EGL_DMA_BUF_PLANE0_PITCH_EXT;
+ attrs[i++] = dmabuf->stride;
+ attrs[i++] = EGL_DMA_BUF_PLANE0_OFFSET_EXT;
+ attrs[i++] = 0;
+ if (dmabuf->modifier) {
+ attrs[i++] = EGL_DMA_BUF_PLANE0_MODIFIER_LO_EXT;
+ attrs[i++] = (dmabuf->modifier >> 0) & 0xffffffff;
+ attrs[i++] = EGL_DMA_BUF_PLANE0_MODIFIER_HI_EXT;
+ attrs[i++] = (dmabuf->modifier >> 32) & 0xffffffff;
+ }
+ attrs[i++] = EGL_NONE;
+
image = eglCreateImageKHR(qemu_egl_display,
EGL_NO_CONTEXT,
EGL_LINUX_DMA_BUF_EXT,
--
2.18.1
prev parent reply other threads:[~2019-05-24 7:03 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-24 7:01 [Qemu-devel] [PATCH v2 0/4] add drm modifier support for dmabufs Gerd Hoffmann
2019-05-24 7:01 ` [Qemu-devel] [PATCH v2 1/4] console: add dmabuf modifier field Gerd Hoffmann
2019-05-24 7:01 ` [Qemu-devel] [PATCH v2 2/4] vfio/display: set " Gerd Hoffmann
2019-05-24 13:54 ` Alex Williamson
2019-05-24 7:01 ` [Qemu-devel] [PATCH v2 3/4] egl-helpers: add modifier support to egl_get_fd_for_texture() Gerd Hoffmann
2019-05-24 7:01 ` Gerd Hoffmann [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190524070118.30157-5-kraxel@redhat.com \
--to=kraxel@redhat.com \
--cc=alex.williamson@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.