ui patch queue
Hi,
Here is the ui patch queue with some vnc cleanups, absolute event support for input linux, egl bugfixes and the new eg-headless ui.
please pull,
Gerd
The following changes since commit 76d20ea0f1b26ebd5da2f5fb2fdf3250cde887bb:
Merge remote-tracking branch 'armbru/tags/pull-qapi-2017-05-04-v3' into staging (2017-05-09 15:49:14 -0400)
are available in the git repository at:
git://git.kraxel.org/qemu tags/pull-ui-20170512-1
for you to fetch changes up to 7c9209e7bfb8c09ab5a4cadaa84928d146874a05:
vnc: replace hweight_long() with ctpopl() (2017-05-12 12:36:02 +0200)
----------------------------------------------------------------
ui: add egl-headless
ui: some vnc cleanups
ui: absolute events for input-linux
----------------------------------------------------------------
Cédric Le Goater (1):
vnc: replace hweight_long() with ctpopl()
Gerd Hoffmann (6):
virtio-gpu: move virtio_gpu_gl_block
egl-helpers: drop support for gles and debug logging
egl-helpers: fix display init for x11
egl-helpers: add missing error check
egl: explicitly ask for core context
opengl: add egl-headless display
Philippe Voinov (2):
ui: Support non-zero minimum values for absolute input axes
ui: input-linux: Add absolute event support
Wei Qi (1):
vnc: simple clean up
include/hw/virtio/virtio-gpu.h | 1 + include/qemu/bitops.h | 10 --- include/ui/console.h | 3 + include/ui/egl-helpers.h | 3 +- include/ui/input.h | 11 +-- hw/display/virtio-gpu-3d.c | 16 +++++ hw/display/virtio-gpu.c | 18 +---- hw/input/virtio-input-hid.c | 6 +- ui/egl-context.c | 7 +- ui/egl-headless.c | 158 +++++++++++++++++++++++++++++++++++++++++ ui/egl-helpers.c | 88 +++++++++-------------- ui/gtk-egl.c | 2 +- ui/gtk.c | 4 +- ui/input-linux.c | 25 ++++++- ui/input.c | 31 +++++--- ui/sdl.c | 4 +- ui/sdl2.c | 4 +- ui/spice-input.c | 4 +- ui/vnc-enc-zrle.c | 1 - ui/vnc.c | 10 +-- vl.c | 16 +++++ ui/Makefile.objs | 1 + ui/cocoa.m | 4 +- 23 files changed, 311 insertions(+), 116 deletions(-) create mode 100644 ui/egl-headless.c
[Qemu-devel] [PULL 06/10] egl-helpers: add missing error check
Code didn't check for qemu_egl_init_dpy_mesa() failures, add it.
Message-id: [email protected]
--- ui/egl-helpers.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
ui/egl-helpers.c +6 -1
@@ -80,6 +80,7 @@ static int qemu_egl_rendernode_open(const char *rendernode)int egl_rendernode_init (const char *rendernode) { qemu_egl_rn_fd =-1 ; +int rc; qemu_egl_rn_fd =qemu_egl_rendernode_open (rendernode);if (qemu_egl_rn_fd ==-1 ) {
@@ -93,7 +94,11 @@ int egl_rendernode_init(const char *rendernode) goto err; } -qemu_egl_init_dpy_mesa ((EGLNativeDisplayType )qemu_egl_rn_gbm_dev); + rc =qemu_egl_init_dpy_mesa ((EGLNativeDisplayType )qemu_egl_rn_gbm_dev); +if (rc !=0 ) { +/* qemu_egl_init_dpy_mesa reports error */ + goto err; + }if (!epoxy_has_egl_extension (qemu_egl_display,"EGL_KHR_surfaceless_context" )) {
Signature · 1 line
2.9.3
[Qemu-devel] [PULL 07/10] egl: explicitly ask for core context
In reply to Gerd HoffmannMessage-id: [email protected]
--- ui/egl-context.c | 7 ++++--- ui/egl-helpers.c | 1 + 2 files changed, 5 insertions(+), 3 deletions(-)
ui/egl-context.c +4 -3
@@ -7,9 +7,10 @@ QEMUGLContext qemu_egl_create_context(DisplayChangeListener *dcl, {EGLContext ctx;EGLint ctx_att[] = { -EGL_CONTEXT_CLIENT_VERSION , params->major_ver, -EGL_CONTEXT_MINOR_VERSION_KHR , params->minor_ver, -EGL_NONE +EGL_CONTEXT_OPENGL_PROFILE_MASK ,EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT , +EGL_CONTEXT_CLIENT_VERSION , params->major_ver, +EGL_CONTEXT_MINOR_VERSION_KHR , params->minor_ver, +EGL_NONE }; ctx = eglCreateContext(qemu_egl_display, qemu_egl_config,
ui/egl-helpers.c +1 -0
@@ -296,6 +296,7 @@ int qemu_egl_init_dpy_mesa(EGLNativeDisplayType dpy)EGLContext qemu_egl_init_ctx (void ) {static const EGLint ctx_att_gl[] = { +EGL_CONTEXT_OPENGL_PROFILE_MASK ,EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT ,EGL_NONE };EGLContext ectx;
Signature · 1 line
2.9.3
[Qemu-devel] [PULL 09/10] vnc: simple clean up
In reply to Gerd HoffmannFrom: Wei Qi <[email protected]>
It is unnecessary to assign 'packed_bytes' to 'estimated_bytes', because 'estimated_bytes' unused after assignment.
--- ui/vnc-enc-zrle.c | 1 - 1 file changed, 1 deletion(-)
ui/vnc-enc-zrle.c +0 -1
@@ -163,7 +163,6 @@ static void zrle_choose_palette_rle(VncState *vs, int w, int h,if (packed_bytes < estimated_bytes) { *use_rle = false; *use_palette = true; - estimated_bytes = packed_bytes; } } }
Signature · 1 line
2.9.3
[Qemu-devel] [PULL 10/10] vnc: replace hweight_long() with ctpopl()
In reply to Gerd HoffmannFrom: Cédric Le Goater <[email protected]>
ctpopl() has a better implementation than hweight_long() and ui/vnc.c being the last user of hweight_long(), we can simply remove it.
Message-id: [email protected]
--- include/qemu/bitops.h | 10 ---------- ui/vnc.c | 6 +++--- 2 files changed, 3 insertions(+), 13 deletions(-)
include/qemu/bitops.h +0 -10
@@ -201,16 +201,6 @@ static inline unsigned long find_first_zero_bit(const unsigned long *addr,return find_next_zero_bit (addr, size,0 ); } -static inline unsigned long hweight_long (unsigned long w) -{ -unsigned long count; - -for (count =0 ; w; w >>=1 ) { - count += w &1 ; - } -return count; -} -/** * rol8 - rotate an 8-bit value left * @word: value to rotate
ui/vnc.c +3 -3
@@ -2061,15 +2061,15 @@ static void set_pixel_format(VncState *vs, int bits_per_pixel, } vs->client_pf.rmax = red_max ? red_max :0xFF ; - vs->client_pf.rbits =hweight_long (red_max); + vs->client_pf.rbits =ctpopl (red_max); vs->client_pf.rshift = red_shift; vs->client_pf.rmask = red_max << red_shift; vs->client_pf.gmax = green_max ? green_max :0xFF ; - vs->client_pf.gbits =hweight_long (green_max); + vs->client_pf.gbits =ctpopl (green_max); vs->client_pf.gshift = green_shift; vs->client_pf.gmask = green_max << green_shift; vs->client_pf.bmax = blue_max ? blue_max :0xFF ; - vs->client_pf.bbits =hweight_long (blue_max); + vs->client_pf.bbits =ctpopl (blue_max); vs->client_pf.bshift = blue_shift; vs->client_pf.bmask = blue_max << blue_shift; vs->client_pf.bits_per_pixel = bits_per_pixel;
Signature · 1 line
2.9.3
[Qemu-devel] [PULL 01/10] ui: Support non-zero minimum values for absolute input axes
In reply to Gerd HoffmannFrom: Philippe Voinov <[email protected]>
This patch refactors ui/input.c to support absolute axis minimum values other than 0. All dependent calls to qemu_input_queue_abs have been updated to explicitly supply 0 as the axis minimum value.
Message-id: [email protected]
--- include/ui/input.h | 11 +++++++---- hw/input/virtio-input-hid.c | 6 ++++-- ui/gtk.c | 4 ++-- ui/input.c | 31 ++++++++++++++++++++++--------- ui/sdl.c | 4 ++-- ui/sdl2.c | 4 ++-- ui/spice-input.c | 4 ++-- ui/vnc.c | 4 ++-- ui/cocoa.m | 4 ++-- 9 files changed, 45 insertions(+), 27 deletions(-)
include/ui/input.h +7 -4
@@ -8,7 +8,8 @@#define INPUT_EVENT_MASK_REL (1<<INPUT_EVENT_KIND_REL)#define INPUT_EVENT_MASK_ABS (1<<INPUT_EVENT_KIND_ABS) -#define INPUT_EVENT_ABS_SIZE 0x8000 +#define INPUT_EVENT_ABS_MIN 0x0000 +#define INPUT_EVENT_ABS_MAX 0x7FFFtypedef struct QemuInputHandler QemuInputHandler ;typedef struct QemuInputHandlerState QemuInputHandlerState ;
@@ -54,12 +55,14 @@ void qemu_input_update_buttons(QemuConsole *src, uint32_t *button_map, uint32_t button_old, uint32_t button_new);bool qemu_input_is_absolute (void ); -int qemu_input_scale_axis (int value,int size_in,int size_out); +int qemu_input_scale_axis (int value, +int min_in,int max_in, +int min_out,int max_out);InputEvent *qemu_input_event_new_move (InputEventKind kind,InputAxis axis,int value);void qemu_input_queue_rel (QemuConsole *src,InputAxis axis,int value); -void qemu_input_queue_abs (QemuConsole *src,InputAxis axis, -int value,int size); +void qemu_input_queue_abs (QemuConsole *src,InputAxis axis,int value, +int min_in,int max_in);void qemu_input_check_mode_change (void );void qemu_add_mouse_mode_change_notifier (Notifier *notify);
hw/input/virtio-input-hid.c +4 -2
@@ -484,12 +484,14 @@ static struct virtio_input_config virtio_tablet_config[] = { .select = VIRTIO_INPUT_CFG_ABS_INFO, .subsel = ABS_X, .size = sizeof(virtio_input_absinfo), - .u.abs.max = const_le32(INPUT_EVENT_ABS_SIZE - 1), + .u.abs.min = const_le32(INPUT_EVENT_ABS_MIN), + .u.abs.max = const_le32(INPUT_EVENT_ABS_MAX), },{ .select = VIRTIO_INPUT_CFG_ABS_INFO, .subsel = ABS_Y, .size = sizeof(virtio_input_absinfo), - .u.abs.max = const_le32(INPUT_EVENT_ABS_SIZE - 1), + .u.abs.min = const_le32(INPUT_EVENT_ABS_MIN), + .u.abs.max = const_le32(INPUT_EVENT_ABS_MAX), }, { /* end of list */ }, };
ui/gtk.c +2 -2
@@ -912,9 +912,9 @@ static gboolean gd_motion_event(GtkWidget *widget, GdkEventMotion *motion,return TRUE; }qemu_input_queue_abs (vc->gfx.dcl.con,INPUT_AXIS_X , x, -surface_width (vc->gfx.ds)); +0 ,surface_width (vc->gfx.ds));qemu_input_queue_abs (vc->gfx.dcl.con,INPUT_AXIS_Y , y, -surface_height (vc->gfx.ds)); +0 ,surface_height (vc->gfx.ds));qemu_input_event_sync (); }else if (s->last_set && s->ptr_owner == vc) {qemu_input_queue_rel (vc->gfx.dcl.con,INPUT_AXIS_X , x - s->last_x);
ui/input.c +22 -9
@@ -166,6 +166,11 @@ void qmp_input_send_event(bool has_device, const char *device,qemu_input_event_sync (); } +static int qemu_input_transform_invert_abs_value (int value) +{ +return (int64_t )INPUT_EVENT_ABS_MAX - value +INPUT_EVENT_ABS_MIN ; +} +static void qemu_input_transform_abs_rotate (InputEvent *evt) {InputMoveEvent *move = evt->u.abs.data;
@@ -175,16 +180,16 @@ static void qemu_input_transform_abs_rotate(InputEvent *evt) move->axis =INPUT_AXIS_Y ; }else if (move->axis ==INPUT_AXIS_Y ) { move->axis =INPUT_AXIS_X ; - move->value =INPUT_EVENT_ABS_SIZE -1 - move->value; + move->value =qemu_input_transform_invert_abs_value (move->value); }break ;case 180 : - move->value =INPUT_EVENT_ABS_SIZE -1 - move->value; + move->value =qemu_input_transform_invert_abs_value (move->value);break ;case 270 :if (move->axis ==INPUT_AXIS_X ) { move->axis =INPUT_AXIS_Y ; - move->value =INPUT_EVENT_ABS_SIZE -1 - move->value; + move->value =qemu_input_transform_invert_abs_value (move->value); }else if (move->axis ==INPUT_AXIS_Y ) { move->axis =INPUT_AXIS_X ; }
@@ -467,12 +472,17 @@ bool qemu_input_is_absolute(void)return (s !=NULL ) && (s->handler->mask &INPUT_EVENT_MASK_ABS ); } -int qemu_input_scale_axis (int value,int size_in,int size_out) +int qemu_input_scale_axis (int value, +int min_in,int max_in, +int min_out,int max_out) { -if (size_in <2 ) { -return size_out /2 ; +int64_t range_in = (int64_t )max_in - min_in; +int64_t range_out = (int64_t )max_out - min_out; + +if (range_in <1 ) { +return min_out + range_out /2 ; } -return (int64_t )value * (size_out -1 ) / (size_in -1 ); +return ((int64_t )value - min_in) * range_out / range_in + min_out; } InputEvent *qemu_input_event_new_move(InputEventKind kind,
@@ -496,10 +506,13 @@ void qemu_input_queue_rel(QemuConsole *src, InputAxis axis, int value)qapi_free_InputEvent (evt); } -void qemu_input_queue_abs (QemuConsole *src,InputAxis axis,int value,int size) +void qemu_input_queue_abs (QemuConsole *src,InputAxis axis,int value, +int min_in,int max_in) {InputEvent *evt; -int scaled =qemu_input_scale_axis (value, size,INPUT_EVENT_ABS_SIZE ); +int scaled =qemu_input_scale_axis (value, min_in, max_in, +INPUT_EVENT_ABS_MIN , +INPUT_EVENT_ABS_MAX ); evt =qemu_input_event_new_move (INPUT_EVENT_KIND_ABS , axis, scaled);qemu_input_event_send (src, evt);qapi_free_InputEvent (evt);
ui/sdl.c +2 -2
@@ -490,9 +490,9 @@ static void sdl_send_mouse_event(int dx, int dy, int x, int y, int state)if (qemu_input_is_absolute ()) {qemu_input_queue_abs (dcl->con,INPUT_AXIS_X , x, - real_screen->w); +0 , real_screen->w);qemu_input_queue_abs (dcl->con,INPUT_AXIS_Y , y, - real_screen->h); +0 , real_screen->h); }else {if (guest_cursor) { x -= guest_x;
ui/sdl2.c +2 -2
@@ -298,8 +298,8 @@ static void sdl_send_mouse_event(struct sdl2_console *scon, int dx, int dy, } } } -qemu_input_queue_abs (scon->dcl.con,INPUT_AXIS_X , off_x + x, max_w); -qemu_input_queue_abs (scon->dcl.con,INPUT_AXIS_Y , off_y + y, max_h); +qemu_input_queue_abs (scon->dcl.con,INPUT_AXIS_X , off_x + x,0 , max_w); +qemu_input_queue_abs (scon->dcl.con,INPUT_AXIS_Y , off_y + y,0 , max_h); }else {if (guest_cursor) { x -= guest_x;
ui/spice-input.c +2 -2
@@ -172,8 +172,8 @@ static void tablet_position(SpiceTabletInstance* sin, int x, int y,QemuSpicePointer *pointer =container_of (sin, QemuSpicePointer, tablet);spice_update_buttons (pointer,0 , buttons_state); -qemu_input_queue_abs (NULL ,INPUT_AXIS_X , x, pointer->width); -qemu_input_queue_abs (NULL ,INPUT_AXIS_Y , y, pointer->height); +qemu_input_queue_abs (NULL ,INPUT_AXIS_X , x,0 , pointer->width); +qemu_input_queue_abs (NULL ,INPUT_AXIS_Y , y,0 , pointer->height);qemu_input_event_sync (); }
ui/vnc.c +2 -2
@@ -1556,8 +1556,8 @@ static void pointer_event(VncState *vs, int button_mask, int x, int y) }if (vs->absolute) { -qemu_input_queue_abs (con,INPUT_AXIS_X , x, width); -qemu_input_queue_abs (con,INPUT_AXIS_Y , y, height); +qemu_input_queue_abs (con,INPUT_AXIS_X , x,0 , width); +qemu_input_queue_abs (con,INPUT_AXIS_Y , y,0 , height); }else if (vnc_has_feature (vs,VNC_FEATURE_POINTER_TYPE_CHANGE )) {qemu_input_queue_rel (con,INPUT_AXIS_X , x -0x7FFF );qemu_input_queue_rel (con,INPUT_AXIS_Y , y -0x7FFF );
ui/cocoa.m +2 -2
@@ -749,8 +749,8 @@ QemuCocoaView *cocoaView; * clicks in the titlebar. */ if ([self screenContainsPoint:p]) { - qemu_input_queue_abs(dcl->con, INPUT_AXIS_X, p.x, screen.width); - qemu_input_queue_abs(dcl->con, INPUT_AXIS_Y, screen.height - p.y, screen.height); + qemu_input_queue_abs(dcl->con, INPUT_AXIS_X, p.x, 0, screen.width); + qemu_input_queue_abs(dcl->con, INPUT_AXIS_Y, screen.height - p.y, 0, screen.height); } } else { qemu_input_queue_rel(dcl->con, INPUT_AXIS_X, (int)[event deltaX]);
Signature · 1 line
2.9.3
[Qemu-devel] [PULL 02/10] ui: input-linux: Add absolute event support
In reply to Gerd HoffmannFrom: Philippe Voinov <[email protected]>
This patch adds support for absolute pointer events to the input-linux subsystem. This support was omitted from the original input-linux patch, however most of the code required for it is already in place.
Support for absolute events is especially useful for guests with vga passthrough. Since they have a physical monitor, none of normal channels for sending video output (vnc, etc) are used, meaning they also can't be used to send absolute input events. This leaves QMP as the only option to send absolute input into vga passthrough guests, which is not its intended use and is not efficient.
This patch allows, for example, uinput to be used to create virtual absolute input devices. This lets you build external systems which share physical input devices between guests. Without absolute input capability, such external systems can't seamlessly share pointer devices between guests.
Message-id: [email protected]
--- ui/input-linux.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-)
ui/input-linux.c +24 -1
@@ -169,6 +169,10 @@ struct InputLinux {bool has_abs_x;int num_keys;int num_btns; +int abs_x_min; +int abs_x_max; +int abs_y_min; +int abs_y_max;struct input_event event;int read_offset;
@@ -314,6 +318,18 @@ static void input_linux_handle_mouse(InputLinux *il, struct input_event *event)break ; }break ; +case EV_ABS : +switch (event->code) { +case ABS_X : +qemu_input_queue_abs (NULL ,INPUT_AXIS_X , event->value, + il->abs_x_min, il->abs_x_max); +break ; +case ABS_Y : +qemu_input_queue_abs (NULL ,INPUT_AXIS_Y , event->value, + il->abs_y_min, il->abs_y_max); +break ; + } +break ;case EV_SYN :qemu_input_event_sync ();if (il->wheel !=0 ) {
@@ -351,7 +367,7 @@ static void input_linux_event(void *opaque)if (il->num_keys) {input_linux_handle_keyboard (il, &il->event); } -if (il->has_rel_x && il->num_btns) { +if ((il->has_rel_x || il->has_abs_x) && il->num_btns) {input_linux_handle_mouse (il, &il->event); } }
@@ -364,6 +380,7 @@ static void input_linux_complete(UserCreatable *uc, Error **errp)uint8_t keymap[KEY_CNT /8 ], keystate[KEY_CNT /8 ];unsigned int i;int rc, ver; +struct input_absinfo absinfo;if (!il->evdev) {error_setg (errp,"no input device specified" );
@@ -402,6 +419,12 @@ static void input_linux_complete(UserCreatable *uc, Error **errp) rc =ioctl (il->fd,EVIOCGBIT (EV_ABS ,sizeof (absmap)), &absmap);if (absmap & (1 <<ABS_X )) { il->has_abs_x = true; + rc =ioctl (il->fd,EVIOCGABS (ABS_X ), &absinfo); + il->abs_x_min = absinfo.minimum; + il->abs_x_max = absinfo.maximum; + rc =ioctl (il->fd,EVIOCGABS (ABS_Y ), &absinfo); + il->abs_y_min = absinfo.minimum; + il->abs_y_max = absinfo.maximum; } }
Signature · 1 line
2.9.3
[Qemu-devel] [PULL 03/10] virtio-gpu: move virtio_gpu_gl_block
In reply to Gerd HoffmannMove to virtio-gpu-3d.c where all the other virgl code lives too.
Message-id: [email protected]
--- include/hw/virtio/virtio-gpu.h | 1 + hw/display/virtio-gpu-3d.c | 16 ++++++++++++++++ hw/display/virtio-gpu.c | 18 ++---------------- 3 files changed, 19 insertions(+), 16 deletions(-)
include/hw/virtio/virtio-gpu.h +1 -0
@@ -169,6 +169,7 @@ void virtio_gpu_virgl_process_cmd(VirtIOGPU *g, struct virtio_gpu_ctrl_command *cmd);void virtio_gpu_virgl_fence_poll (VirtIOGPU *g);void virtio_gpu_virgl_reset (VirtIOGPU *g); +void virtio_gpu_gl_block (void *opaque,bool block);int virtio_gpu_virgl_init (VirtIOGPU *g);#endif
hw/display/virtio-gpu-3d.c +16 -0
@@ -600,6 +600,22 @@ void virtio_gpu_virgl_reset(VirtIOGPU *g) } } +void virtio_gpu_gl_block (void *opaque,bool block) +{ +VirtIOGPU *g = opaque; + +if (block) { + g->renderer_blocked++; + }else { + g->renderer_blocked--; + } +assert (g->renderer_blocked >=0 ); + +if (g->renderer_blocked ==0 ) { +virtio_gpu_process_cmdq (g); + } +} +int virtio_gpu_virgl_init (VirtIOGPU *g) {int ret;
hw/display/virtio-gpu.c +2 -16
@@ -929,28 +929,14 @@ static int virtio_gpu_ui_info(void *opaque, uint32_t idx, QemuUIInfo *info)return 0 ; } -static void virtio_gpu_gl_block (void *opaque,bool block) -{ -VirtIOGPU *g = opaque; - -if (block) { - g->renderer_blocked++; - }else { - g->renderer_blocked--; - } -assert (g->renderer_blocked >=0 ); - -if (g->renderer_blocked ==0 ) { -virtio_gpu_process_cmdq (g); - } -} -const GraphicHwOps virtio_gpu_ops = { .invalidate = virtio_gpu_invalidate_display, .gfx_update = virtio_gpu_update_display, .text_update = virtio_gpu_text_update, .ui_info = virtio_gpu_ui_info, +#ifdef CONFIG_VIRGL .gl_block = virtio_gpu_gl_block, +#endif };static const VMStateDescription vmstate_virtio_gpu_scanout = {
Signature · 1 line
2.9.3
[Qemu-devel] [PULL 04/10] egl-helpers: drop support for gles and debug logging
In reply to Gerd HoffmannLeftover from the early opengl days.
Unused now, so delete the dead code.
Message-id: [email protected]
--- include/ui/egl-helpers.h | 2 +- ui/egl-helpers.c | 52 +++++------------------------------------------- ui/gtk-egl.c | 2 +- 3 files changed, 7 insertions(+), 49 deletions(-)
include/ui/egl-helpers.h +1 -1
@@ -21,7 +21,7 @@ int egl_get_fd_for_texture(uint32_t tex_id, EGLint *stride, EGLint *fourcc);EGLSurface qemu_egl_init_surface_x11 (EGLContext ectx,Window win); -int qemu_egl_init_dpy (EGLNativeDisplayType dpy,bool gles,bool debug); +int qemu_egl_init_dpy (EGLNativeDisplayType dpy);EGLContext qemu_egl_init_ctx (void );#endif /* EGL_HELPERS_H */
ui/egl-helpers.c +5 -47
118 lines not on this page · raw message
ui/gtk-egl.c +1 -1
@@ -246,7 +246,7 @@ void gtk_egl_init(void)GdkDisplay *gdk_display =gdk_display_get_default ();Display *x11_display =gdk_x11_display_get_xdisplay (gdk_display); -if (qemu_egl_init_dpy (x11_display, false, false) <0 ) { +if (qemu_egl_init_dpy (x11_display) <0 ) {return ; }
Signature · 1 line
2.9.3
[Qemu-devel] [PULL 05/10] egl-helpers: fix display init for x11
In reply to Gerd HoffmannWhen running on gtk we need X11 platform not mesa platform. Create separate functions for mesa and x11 so we can keep the egl #ifdef mess local to egl-helpers.c
Message-id: [email protected]
--- include/ui/egl-helpers.h | 3 ++- ui/egl-helpers.c | 34 ++++++++++++++++++++++++++-------- ui/gtk-egl.c | 2 +- 3 files changed, 29 insertions(+), 10 deletions(-)
include/ui/egl-helpers.h +2 -1
@@ -21,7 +21,8 @@ int egl_get_fd_for_texture(uint32_t tex_id, EGLint *stride, EGLint *fourcc);EGLSurface qemu_egl_init_surface_x11 (EGLContext ectx,Window win); -int qemu_egl_init_dpy (EGLNativeDisplayType dpy); +int qemu_egl_init_dpy_x11 (EGLNativeDisplayType dpy); +int qemu_egl_init_dpy_mesa (EGLNativeDisplayType dpy);EGLContext qemu_egl_init_ctx (void );#endif /* EGL_HELPERS_H */
ui/egl-helpers.c +26 -8
@@ -93,7 +93,7 @@ int egl_rendernode_init(const char *rendernode) goto err; } -qemu_egl_init_dpy ((EGLNativeDisplayType )qemu_egl_rn_gbm_dev); +qemu_egl_init_dpy_mesa ((EGLNativeDisplayType )qemu_egl_rn_gbm_dev);if (!epoxy_has_egl_extension (qemu_egl_display,"EGL_KHR_surfaceless_context" )) {
@@ -206,20 +206,19 @@ EGLSurface qemu_egl_init_surface_x11(EGLContext ectx, Window win)* platform extensions (EGL_KHR_platform_gbm and friends) yet it doesn't seem * like mesa will be able to advertise these (even though it can do EGL 1.5). */ -static EGLDisplay qemu_egl_get_display (void *native) +static EGLDisplay qemu_egl_get_display (EGLNativeDisplayType native, +EGLenum platform) {EGLDisplay dpy =EGL_NO_DISPLAY ; -#ifdef EGL_MESA_platform_gbm/* In practise any EGL 1.5 implementation would support the EXT extension */ if (epoxy_has_egl_extension (NULL ,"EGL_EXT_platform_base" )) {PFNEGLGETPLATFORMDISPLAYEXTPROC getPlatformDisplayEXT = (void *)eglGetProcAddress ("eglGetPlatformDisplayEXT" ); -if (getPlatformDisplayEXT) { - dpy =getPlatformDisplayEXT (EGL_PLATFORM_GBM_MESA , native,NULL ); +if (getPlatformDisplayEXT && platform !=0 ) { + dpy =getPlatformDisplayEXT (platform, native,NULL ); } } -#endif if (dpy ==EGL_NO_DISPLAY ) {/* fallback */
@@ -228,7 +227,8 @@ static EGLDisplay qemu_egl_get_display(void *native)return dpy; } -int qemu_egl_init_dpy (EGLNativeDisplayType dpy) +static int qemu_egl_init_dpy (EGLNativeDisplayType dpy, +EGLenum platform) {static const EGLint conf_att_gl[] = {EGL_SURFACE_TYPE ,EGL_WINDOW_BIT ,
@@ -243,7 +243,7 @@ int qemu_egl_init_dpy(EGLNativeDisplayType dpy)EGLBoolean b;EGLint n; - qemu_egl_display =qemu_egl_get_display (dpy); + qemu_egl_display =qemu_egl_get_display (dpy, platform);if (qemu_egl_display ==EGL_NO_DISPLAY ) {error_report ("egl: eglGetDisplay failed" );return -1 ;
@@ -270,6 +270,24 @@ int qemu_egl_init_dpy(EGLNativeDisplayType dpy)return 0 ; } +int qemu_egl_init_dpy_x11 (EGLNativeDisplayType dpy) +{ +#ifdef EGL_KHR_platform_x11 +return qemu_egl_init_dpy (dpy,EGL_PLATFORM_X11_KHR ); +#else +return qemu_egl_init_dpy (dpy,0 ); +#endif +} + +int qemu_egl_init_dpy_mesa (EGLNativeDisplayType dpy) +{ +#ifdef EGL_MESA_platform_gbm +return qemu_egl_init_dpy (dpy,EGL_PLATFORM_GBM_MESA ); +#else +return qemu_egl_init_dpy (dpy,0 ); +#endif +} +EGLContext qemu_egl_init_ctx (void ) {static const EGLint ctx_att_gl[] = {
ui/gtk-egl.c +1 -1
@@ -246,7 +246,7 @@ void gtk_egl_init(void)GdkDisplay *gdk_display =gdk_display_get_default ();Display *x11_display =gdk_x11_display_get_xdisplay (gdk_display); -if (qemu_egl_init_dpy (x11_display) <0 ) { +if (qemu_egl_init_dpy_x11 (x11_display) <0 ) {return ; }
Signature · 1 line
2.9.3
[Qemu-devel] [PULL 08/10] opengl: add egl-headless display
In reply to Gerd HoffmannAdd egl-headless user interface. It doesn't provide a real user interface, it only provides opengl support using drm render nodes. It will copy back the bits rendered by the guest using virgl back to a DisplaySurface and kick the usual display update code paths, so spice and vnc and screendump can pick it up.
Use it this way:
qemu -display egl-headless -vnc $display
qemu -display egl-headless -spice gl=off,$args
Note that you should prefer native spice opengl support (-spice gl=on) if possible because that delivers better performance.
Message-id: [email protected]
--- include/ui/console.h | 3 + ui/egl-headless.c | 158 +++++++++++++++++++++++++++++++++++++++++++++++++++ vl.c | 16 ++++++ ui/Makefile.objs | 1 + 4 files changed, 178 insertions(+) create mode 100644 ui/egl-headless.c
include/ui/console.h +3 -0
@@ -527,4 +527,7 @@ static inline void early_gtk_display_init(int opengl) }#endif +/* egl-headless.c */ +void egl_headless_init (void ); +#endif
ui/egl-headless.c new file +158 -0
158 lines not on this page · raw message
vl.c +16 -0
@@ -2050,6 +2050,7 @@ typedef enum DisplayType {DT_SDL ,DT_COCOA ,DT_GTK , +DT_EGL ,DT_NONE , } DisplayType;
@@ -2127,6 +2128,15 @@ static DisplayType select_display(const char *p)error_report ("VNC requires a display argument vnc=<display>" );exit (1 ); } + }else if (strstart (p,"egl-headless" , &opts)) { +#ifdef CONFIG_OPENGL + request_opengl =1 ; + display_opengl =1 ; + display =DT_EGL ; +#else +fprintf (stderr,"egl support is disabled\n" ); +exit (1 ); +#endif }else if (strstart (p,"curses" , &opts)) {#ifdef CONFIG_CURSES display =DT_CURSES ;
@@ -4659,6 +4669,12 @@ int main(int argc, char **argv, char **envp)qemu_spice_display_init (); } +#ifdef CONFIG_OPENGL +if (display_type ==DT_EGL ) { +egl_headless_init (); + } +#endif +if (foreach_device_config (DEV_GDB , gdbserver_start) <0 ) {exit (1 ); }
ui/Makefile.objs +1 -0
@@ -33,6 +33,7 @@ common-obj-y += shader.o common-obj-y += console-gl.o common-obj-y += egl-helpers.o common-obj-y += egl-context.o +common-obj-y += egl-headless.o ifeq ($(CONFIG_GTK_GL),y) common-obj-$(CONFIG_GTK) += gtk-gl-area.o else
Signature · 1 line
2.9.3
Stefan Hajnoczi
AppliedQuoted 61 lines · Gerd Hoffmann
Hi,
Here is the ui patch queue with some vnc cleanups, absolute event support for input linux, egl bugfixes and the new eg-headless ui.
please pull,
GerdThe following changes since commit
76d20ea0f1b26ebd5da2f5fb2fdf3250cde887bb:Merge remote-tracking branch 'armbru/tags/pull-qapi-2017-05-04-v3' into staging (2017-05-09 15:49:14 -0400)
are available in the git repository at:
git://git.kraxel.org/qemutags/pull-ui-20170512-1for you to fetch changes up to
7c9209e7bfb8c09ab5a4cadaa84928d146874a05:vnc: replace
hweight_long()withctpopl()(2017-05-12 12:36:02 +0200)----------------------------------------------------------------
ui: add egl-headless
ui: some vnc cleanups
ui: absolute events for input-linux----------------------------------------------------------------
Cédric Le Goater (1):
vnc: replacehweight_long()withctpopl()Gerd Hoffmann (6):
virtio-gpu: movevirtio_gpu_gl_block
egl-helpers: drop support for gles and debug logging
egl-helpers: fix display init for x11
egl-helpers: add missing error check
egl: explicitly ask for core context
opengl: add egl-headless displayPhilippe Voinov (2):
ui: Support non-zero minimum values for absolute input axes
ui: input-linux: Add absolute event supportWei Qi (1):
vnc: simple clean upinclude/hw/virtio/virtio-gpu.h | 1 + include/qemu/bitops.h | 10 --- include/ui/console.h | 3 + include/ui/egl-helpers.h | 3 +- include/ui/input.h | 11 +-- hw/display/virtio-gpu-3d.c | 16 +++++ hw/display/virtio-gpu.c | 18 +---- hw/input/virtio-input-hid.c | 6 +- ui/egl-context.c | 7 +- ui/egl-headless.c | 158 +++++++++++++++++++++++++++++++++++++++++ ui/egl-helpers.c | 88 +++++++++-------------- ui/gtk-egl.c | 2 +- ui/gtk.c | 4 +- ui/input-linux.c | 25 ++++++- ui/input.c | 31 +++++--- ui/sdl.c | 4 +- ui/sdl2.c | 4 +-
Quoted 9 lines
ui/spice-input.c | 4 +- ui/vnc-enc-zrle.c | 1 - ui/vnc.c | 10 +-- vl.c | 16 +++++ ui/Makefile.objs | 1 + ui/cocoa.m | 4 +- 23 files changed, 311 insertions(+), 116 deletions(-) create mode 100644 ui/egl-headless.c
Thanks, applied to my staging tree:
https://github.com/stefanha/qemu/commits/staging
Stefan