Message ID | 1465076003-26291-12-git-send-email-marcandre.lureau@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Hi, > @@ -218,6 +218,11 @@ typedef struct DisplayChangeListenerOps { > void (*dpy_gl_scanout)(DisplayChangeListener *dcl, > uint32_t backing_id, bool backing_y_0_top, > uint32_t x, uint32_t y, uint32_t w, uint32_t h); > + void (*dpy_gl_scanout2)(DisplayChangeListener *dcl, > + int fd, bool backing_y_0_top, > + uint32_t x, uint32_t y, uint32_t w, uint32_t h, > + uint32_t fd_w, uint32_t fd_h, uint32_t fd_stride, > + int fd_fourcc); Interface looks sane. I'd like to see a more descriptive name than just "2" though. Maybe "dpy_gl_scanout_dmabuf"? And while being at it rename the other one to "dpy_gl_scanout_texture"? Also: please put the spice update into a separate patch. Adding gtk (or sdl2, or both) support would be nice, to see whenever the interface works if qemu needs to import the dma-buf for display. cheers, Gerd
Hi ----- Original Message ----- > Hi, > > > @@ -218,6 +218,11 @@ typedef struct DisplayChangeListenerOps { > > void (*dpy_gl_scanout)(DisplayChangeListener *dcl, > > uint32_t backing_id, bool backing_y_0_top, > > uint32_t x, uint32_t y, uint32_t w, uint32_t > > h); > > + void (*dpy_gl_scanout2)(DisplayChangeListener *dcl, > > + int fd, bool backing_y_0_top, > > + uint32_t x, uint32_t y, uint32_t w, uint32_t > > h, > > + uint32_t fd_w, uint32_t fd_h, uint32_t > > fd_stride, > > + int fd_fourcc); > > Interface looks sane. I'd like to see a more descriptive name than just > "2" though. Maybe "dpy_gl_scanout_dmabuf"? And while being at it > rename the other one to "dpy_gl_scanout_texture"? sounds good > > Also: please put the spice update into a separate patch. ok > > Adding gtk (or sdl2, or both) support would be nice, to see whenever the > interface works if qemu needs to import the dma-buf for display. As I explained in cover, it's not easily doable since gtk/sdl2 use glx, and can't import dmabuf (it needs egl). I could make it work with gtk/egl (but not gtkglarea, sigh, so many UIs and subtle issues)
Hi, > > Adding gtk (or sdl2, or both) support would be nice, to see whenever the > > interface works if qemu needs to import the dma-buf for display. > > As I explained in cover, it's not easily doable since gtk/sdl2 use > glx, and can't import dmabuf (it needs egl). I could make it work with > gtk/egl (but not gtkglarea, sigh, so many UIs and subtle issues) Ah, ok. Was reading a bit too fast it seems, didn't notice the subtile egl vs. glx thing. cheers, Gerd
diff --git a/include/ui/console.h b/include/ui/console.h index 52a5f65..14fd5ad 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -218,6 +218,11 @@ typedef struct DisplayChangeListenerOps { void (*dpy_gl_scanout)(DisplayChangeListener *dcl, uint32_t backing_id, bool backing_y_0_top, uint32_t x, uint32_t y, uint32_t w, uint32_t h); + void (*dpy_gl_scanout2)(DisplayChangeListener *dcl, + int fd, bool backing_y_0_top, + uint32_t x, uint32_t y, uint32_t w, uint32_t h, + uint32_t fd_w, uint32_t fd_h, uint32_t fd_stride, + int fd_fourcc); void (*dpy_gl_update)(DisplayChangeListener *dcl, uint32_t x, uint32_t y, uint32_t w, uint32_t h); @@ -286,6 +291,11 @@ bool dpy_gfx_check_format(QemuConsole *con, void dpy_gl_scanout(QemuConsole *con, uint32_t backing_id, bool backing_y_0_top, uint32_t x, uint32_t y, uint32_t w, uint32_t h); +void dpy_gl_scanout2(QemuConsole *con, + int fd, bool backing_y_0_top, + uint32_t x, uint32_t y, uint32_t w, uint32_t h, + uint32_t fd_w, uint32_t fd_h, uint32_t fd_stride, + int fd_fourcc); void dpy_gl_update(QemuConsole *con, uint32_t x, uint32_t y, uint32_t w, uint32_t h); diff --git a/ui/console.c b/ui/console.c index bf38579..c36f742 100644 --- a/ui/console.c +++ b/ui/console.c @@ -1712,6 +1712,18 @@ void dpy_gl_scanout(QemuConsole *con, x, y, width, height); } +void dpy_gl_scanout2(QemuConsole *con, + int fd, bool backing_y_0_top, + uint32_t x, uint32_t y, uint32_t w, uint32_t h, + uint32_t fd_w, uint32_t fd_h, uint32_t fd_stride, + int fd_fourcc) +{ + assert(con->gl); + con->gl->ops->dpy_gl_scanout2(con->gl, fd, backing_y_0_top, + x, y, w, h, fd_w, fd_h, fd_stride, + fd_fourcc); +} + void dpy_gl_update(QemuConsole *con, uint32_t x, uint32_t y, uint32_t w, uint32_t h) { diff --git a/ui/spice-display.c b/ui/spice-display.c index 0553c5e..06d2e4e 100644 --- a/ui/spice-display.c +++ b/ui/spice-display.c @@ -888,6 +888,24 @@ static void qemu_spice_gl_scanout(DisplayChangeListener *dcl, qemu_spice_gl_monitor_config(ssd, x, y, w, h); } +static void +qemu_spice_gl_scanout2(DisplayChangeListener *dcl, + int fd, bool y_0_top, + uint32_t x, uint32_t y, uint32_t w, uint32_t h, + uint32_t fd_w, uint32_t fd_h, uint32_t fd_stride, + int fd_fourcc) +{ + SimpleSpiceDisplay *ssd = container_of(dcl, SimpleSpiceDisplay, dcl); + + /* note: spice server will close the fd */ + spice_qxl_gl_scanout(&ssd->qxl, fd, + fd_w, + fd_h, + fd_stride, fd_fourcc, y_0_top); + + qemu_spice_gl_monitor_config(ssd, x, y, w, h); +} + static void qemu_spice_gl_update(DisplayChangeListener *dcl, uint32_t x, uint32_t y, uint32_t w, uint32_t h) { @@ -915,6 +933,7 @@ static const DisplayChangeListenerOps display_listener_gl_ops = { .dpy_gl_ctx_get_current = qemu_egl_get_current_context, .dpy_gl_scanout = qemu_spice_gl_scanout, + .dpy_gl_scanout2 = qemu_spice_gl_scanout2, .dpy_gl_update = qemu_spice_gl_update, };