egl-helpers: add modifier support to egl_get_fd_for_texture().
Add modifier parameter to egl_get_fd_for_texture(), to return the used modifier on dmabuf exports. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Message-id: 20190529072144.26737-4-kraxel@redhat.com
This commit is contained in:
parent
a6c9d5da08
commit
5fc1fb62af
@ -36,7 +36,8 @@ extern struct gbm_device *qemu_egl_rn_gbm_dev;
|
||||
extern EGLContext qemu_egl_rn_ctx;
|
||||
|
||||
int egl_rendernode_init(const char *rendernode, DisplayGLMode mode);
|
||||
int egl_get_fd_for_texture(uint32_t tex_id, EGLint *stride, EGLint *fourcc);
|
||||
int egl_get_fd_for_texture(uint32_t tex_id, EGLint *stride, EGLint *fourcc,
|
||||
EGLuint64KHR *modifier);
|
||||
|
||||
void egl_dmabuf_import_texture(QemuDmaBuf *dmabuf);
|
||||
void egl_dmabuf_release_texture(QemuDmaBuf *dmabuf);
|
||||
|
@ -200,7 +200,8 @@ err:
|
||||
return -1;
|
||||
}
|
||||
|
||||
int egl_get_fd_for_texture(uint32_t tex_id, EGLint *stride, EGLint *fourcc)
|
||||
int egl_get_fd_for_texture(uint32_t tex_id, EGLint *stride, EGLint *fourcc,
|
||||
EGLuint64KHR *modifier)
|
||||
{
|
||||
EGLImageKHR image;
|
||||
EGLint num_planes, fd;
|
||||
@ -214,7 +215,7 @@ int egl_get_fd_for_texture(uint32_t tex_id, EGLint *stride, EGLint *fourcc)
|
||||
}
|
||||
|
||||
eglExportDMABUFImageQueryMESA(qemu_egl_display, image, fourcc,
|
||||
&num_planes, NULL);
|
||||
&num_planes, modifier);
|
||||
if (num_planes != 1) {
|
||||
eglDestroyImageKHR(qemu_egl_display, image);
|
||||
return -1;
|
||||
|
@ -888,7 +888,8 @@ static void spice_gl_switch(DisplayChangeListener *dcl,
|
||||
if (ssd->ds) {
|
||||
surface_gl_create_texture(ssd->gls, ssd->ds);
|
||||
fd = egl_get_fd_for_texture(ssd->ds->texture,
|
||||
&stride, &fourcc);
|
||||
&stride, &fourcc,
|
||||
NULL);
|
||||
if (fd < 0) {
|
||||
surface_gl_destroy_texture(ssd->gls, ssd->ds);
|
||||
return;
|
||||
@ -945,7 +946,7 @@ static void qemu_spice_gl_scanout_texture(DisplayChangeListener *dcl,
|
||||
int fd = -1;
|
||||
|
||||
assert(tex_id);
|
||||
fd = egl_get_fd_for_texture(tex_id, &stride, &fourcc);
|
||||
fd = egl_get_fd_for_texture(tex_id, &stride, &fourcc, NULL);
|
||||
if (fd < 0) {
|
||||
fprintf(stderr, "%s: failed to get fd for texture\n", __func__);
|
||||
return;
|
||||
@ -1063,7 +1064,7 @@ static void qemu_spice_gl_update(DisplayChangeListener *dcl,
|
||||
egl_fb_setup_new_tex(&ssd->blit_fb,
|
||||
dmabuf->width, dmabuf->height);
|
||||
fd = egl_get_fd_for_texture(ssd->blit_fb.texture,
|
||||
&stride, &fourcc);
|
||||
&stride, &fourcc, NULL);
|
||||
spice_qxl_gl_scanout(&ssd->qxl, fd,
|
||||
dmabuf->width, dmabuf->height,
|
||||
stride, fourcc, false);
|
||||
|
Loading…
Reference in New Issue
Block a user