curses: 32bit build fix.
egl: dmabuf modifier support. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQIcBAABAgAGBQJc+mQxAAoJEEy22O7T6HE4RgsP/RZiiTav1VxUIMnnECEMBk+p 2UE4ro886apsF6+D2n/BeISDYoLXhf2cDL1My38WFAKRecWFauPoXmSwPBD2pI6R T4WG/jasuW758xgLpoqAv5+KGJsg8h8e9VOgUr78Ed8K9qyMHY13OPbPLI4emvdI 0Vkb4GnLmAQ4VOyiaLvtaC36+KeEe0sxkYYJASG+IiQf8VQ8/Io8dAeiATct8Fdq Tu3FeidnHFTr9rLFjel/t9zFAY+VNbK3XR/TSQQYQ/6hImOJ0rUO9AueHbIv2brA Qnc2wke8pNGdzvNv8NuNVeqP6TYX/d+vmRMuLZ/oOLPn7gxdg5qk7L5u+wUwbKt9 VLAiWGn1D6udUR81G6hnAZlw/uurGOVLCqlPXT6ZmVyyMW3Oy2PpKJc9sq4Z23yg tZhyiqyBIcG8GaiQtXKsuxijX3zXEBi236B3Y+UbB/9HQbhwPjWVit52+vBZpbIp HohRKiA1Hw+2hkpeKMYQEjryP7n4OS4g6pfazqg6IraaKlgFWvQY3Ki00EiG3MEu 5VtNWyI5tepV05c9tbv4RmP4E2yAsbj0e5gGkA49pHQIFdNz6Qj3Y2uSBGia8LCc rQR8ibbbWbpOt9mfTkaMseIS77rrmZDxqFplM8ESpgKaMApgPbeUxL+w4AJ4KTvm f26snhhD2u6YkP94Ma7z =zvFS -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/kraxel/tags/ui-20190607-pull-request' into staging curses: 32bit build fix. egl: dmabuf modifier support. # gpg: Signature made Fri 07 Jun 2019 14:18:41 BST # gpg: using RSA key 4CB6D8EED3E87138 # gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>" [full] # gpg: aka "Gerd Hoffmann <gerd@kraxel.org>" [full] # gpg: aka "Gerd Hoffmann (private) <kraxel@gmail.com>" [full] # Primary key fingerprint: A032 8CFF B93A 17A7 9901 FE7D 4CB6 D8EE D3E8 7138 * remotes/kraxel/tags/ui-20190607-pull-request: egl-helpers: add modifier support to egl_dmabuf_import_texture() egl-helpers: add modifier support to egl_get_fd_for_texture(). vfio/display: set dmabuf modifier field console: add dmabuf modifier field. ui/curses: Fix build with -m32 Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
9021fcfb88
@ -248,6 +248,7 @@ static VFIODMABuf *vfio_display_get_dmabuf(VFIOPCIDevice *vdev,
|
||||
dmabuf->buf.height = plane.height;
|
||||
dmabuf->buf.stride = plane.stride;
|
||||
dmabuf->buf.fourcc = plane.drm_format;
|
||||
dmabuf->buf.modifier = plane.drm_format_mod;
|
||||
dmabuf->buf.fd = fd;
|
||||
if (plane_type == DRM_PLANE_TYPE_CURSOR) {
|
||||
vfio_display_update_cursor(dmabuf, &plane);
|
||||
|
@ -175,6 +175,7 @@ typedef struct QemuDmaBuf {
|
||||
uint32_t height;
|
||||
uint32_t stride;
|
||||
uint32_t fourcc;
|
||||
uint64_t modifier;
|
||||
uint32_t texture;
|
||||
bool y0_top;
|
||||
} QemuDmaBuf;
|
||||
|
@ -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);
|
||||
|
@ -489,9 +489,9 @@ static uint16_t get_ucs(wchar_t wch, iconv_t conv)
|
||||
memset(&ps, 0, sizeof(ps));
|
||||
ret = wcrtomb(mbch, wch, &ps);
|
||||
if (ret == -1) {
|
||||
fprintf(stderr, "Could not convert 0x%04x "
|
||||
fprintf(stderr, "Could not convert 0x%04lx "
|
||||
"from wchar_t to a multibyte character: %s\n",
|
||||
wch, strerror(errno));
|
||||
(unsigned long)wch, strerror(errno));
|
||||
return 0xFFFD;
|
||||
}
|
||||
|
||||
@ -501,9 +501,9 @@ static uint16_t get_ucs(wchar_t wch, iconv_t conv)
|
||||
such = sizeof(uch);
|
||||
|
||||
if (iconv(conv, &pmbch, &smbch, &puch, &such) == (size_t) -1) {
|
||||
fprintf(stderr, "Could not convert 0x%04x "
|
||||
fprintf(stderr, "Could not convert 0x%04lx "
|
||||
"from a multibyte character to UCS-2 : %s\n",
|
||||
wch, strerror(errno));
|
||||
(unsigned long)wch, strerror(errno));
|
||||
return 0xFFFD;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
@ -228,20 +229,36 @@ 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;
|
||||
#ifdef EGL_DMA_BUF_PLANE0_MODIFIER_LO_EXT
|
||||
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;
|
||||
}
|
||||
#endif
|
||||
attrs[i++] = EGL_NONE;
|
||||
|
||||
image = eglCreateImageKHR(qemu_egl_display,
|
||||
EGL_NO_CONTEXT,
|
||||
EGL_LINUX_DMA_BUF_EXT,
|
||||
|
@ -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