docs/system/devices/virtio/virtio-gpu.rst | 121 +++++- hw/display/trace-events | 2 +- hw/display/virtio-gpu-gl.c | 62 +++- hw/display/virtio-gpu-virgl.c | 427 ++++++++++++++++++++-- hw/display/virtio-gpu.c | 15 + include/hw/virtio/virtio-gpu.h | 23 +- include/ui/sdl2.h | 7 + meson.build | 8 +- ui/gtk-egl.c | 17 +- ui/gtk-gl-area.c | 28 +- ui/sdl2-gl.c | 81 +++- ui/sdl2.c | 42 +++ 12 files changed, 760 insertions(+), 73 deletions(-)
Hello,
This is follow up to DRM native context v16 [1] and MAP_FIXED API v10 [2]
virtio-gpu patches that has been reviewed previously and were waiting for
a new release of libvirglrenderer 1.3.0.
[1] https://lore.kernel.org/qemu-devel/20251116125641.2255794-1-dmitry.osipenko@collabora.com/
[2] https://lore.kernel.org/qemu-devel/20260118162856.223796-1-dmitry.osipenko@collabora.com/
Based-on: 20260214-region-v1-1-229f00ae1f38@rsg.ci.i.u-tokyo.ac.jp
Changelog:
v19:- Further improved improved naming of functions and terminology RE
GL context binding. Suggested by Akihiko Odaki.
- Added new patch "ui/gdk: Restore original context after new context
creation" in addition to improved "ui/sdl2: Restore original context"
that now getd actual bound GL context and restores to it instead
of restoring to the console's ctx, for consistency with the rest
of GL context management fixes that ensure context is bound only
when necessary.
- Improved virtio_gpu_virgl_update_render_state() with force_ctx_0()
and unbind_ctx() to make deferred GPU resetting maintain bound GL
context properly.
v18:- Changed dpy_gl_ctx_make_current() to use first scanout when unsetting
virgl's GL ctx0 and improved naming of cmd-processing function.
Suggested by Akihiko Odaki.
- Added "ui/gdk: Unset context after GL operations" patch after
realizing GDK/GL code needed more gdk_gl_context_clear_current().
v17:- Rebased patches on recent upstream, updated doc patches with new
drm native contexts supported by libvirglrenderer.
- Applied minor change that was requested from Akihiko Odaki
by moving virtio_gpu_device_realize() for MAP_FIXED v10.
- Added virtio_gpu_virgl_update_render_state() to virtio_gpu_fence_poll()
that was missed in MAP_FIXED v10.
- Added new patches fixing another GL context switching problem I ran
into recently with virgl commands unexpectedly processed from CPU
thread instead main-loop:
ui/sdl2: Unset context after GL operations
ui/gtk-egl: Unset context after GL operations
virtio-gpu: Unset context after GL operations
Alex Bennée (1):
docs/system: virtio-gpu: Document host/guest requirements
Dmitry Osipenko (18):
ui/gdk: Restore original context after new context creation
ui/sdl2: Restore original context after new context creation
ui/sdl2: Don't disable scanout when display is refreshed
ui/gtk: Don't disable scanout when display is refreshed
ui/sdl2: Unbind context after GL operations
ui/gtk-egl: Unbind context after GL operations
ui/gdk: Unbind context after GL operations
virtio-gpu: Unbind context after GL operations
virtio-gpu: Handle virgl fence creation errors
virtio-gpu: Support asynchronous fencing
virtio-gpu: Support DRM native context
docs/system: virtio-gpu: Add link to Mesa VirGL doc
docs/system: virtio-gpu: Update Venus link
virtio-gpu: Remove superfluous memory_region_set_enabled()
virtio-gpu: Validate hostmem mapping offset
virtio-gpu: Replace finish_unmapping with mapping_state
virtio-gpu: Destroy virgl resources on virtio-gpu reset
virtio-gpu: Support mapping hostmem blobs with map_fixed
Pierre-Eric Pelloux-Prayer (1):
ui/sdl2: Implement dpy dmabuf functions
docs/system/devices/virtio/virtio-gpu.rst | 121 +++++-
hw/display/trace-events | 2 +-
hw/display/virtio-gpu-gl.c | 62 +++-
hw/display/virtio-gpu-virgl.c | 427 ++++++++++++++++++++--
hw/display/virtio-gpu.c | 15 +
include/hw/virtio/virtio-gpu.h | 23 +-
include/ui/sdl2.h | 7 +
meson.build | 8 +-
ui/gtk-egl.c | 17 +-
ui/gtk-gl-area.c | 28 +-
ui/sdl2-gl.c | 81 +++-
ui/sdl2.c | 42 +++
12 files changed, 760 insertions(+), 73 deletions(-)
--
2.52.0
On 2026/02/20 9:16, Dmitry Osipenko wrote: > Hello, > > This is follow up to DRM native context v16 [1] and MAP_FIXED API v10 [2] > virtio-gpu patches that has been reviewed previously and were waiting for > a new release of libvirglrenderer 1.3.0. > > [1] https://lore.kernel.org/qemu-devel/20251116125641.2255794-1-dmitry.osipenko@collabora.com/ > [2] https://lore.kernel.org/qemu-devel/20260118162856.223796-1-dmitry.osipenko@collabora.com/ > > Based-on: 20260214-region-v1-1-229f00ae1f38@rsg.ci.i.u-tokyo.ac.jp > > Changelog: > > v19:- Further improved improved naming of functions and terminology RE > GL context binding. Suggested by Akihiko Odaki. > > - Added new patch "ui/gdk: Restore original context after new context > creation" in addition to improved "ui/sdl2: Restore original context" > that now getd actual bound GL context and restores to it instead > of restoring to the console's ctx, for consistency with the rest > of GL context management fixes that ensure context is bound only > when necessary. > > - Improved virtio_gpu_virgl_update_render_state() with force_ctx_0() > and unbind_ctx() to make deferred GPU resetting maintain bound GL > context properly. Both the new context management improvement and the MAP_FIXED API changes look good to me. For the whole series, Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp> Thank you for completing this change. Regards, Akihiko Odaki > > v18:- Changed dpy_gl_ctx_make_current() to use first scanout when unsetting > virgl's GL ctx0 and improved naming of cmd-processing function. > Suggested by Akihiko Odaki. > > - Added "ui/gdk: Unset context after GL operations" patch after > realizing GDK/GL code needed more gdk_gl_context_clear_current(). > > v17:- Rebased patches on recent upstream, updated doc patches with new > drm native contexts supported by libvirglrenderer. > > - Applied minor change that was requested from Akihiko Odaki > by moving virtio_gpu_device_realize() for MAP_FIXED v10. > > - Added virtio_gpu_virgl_update_render_state() to virtio_gpu_fence_poll() > that was missed in MAP_FIXED v10. > > - Added new patches fixing another GL context switching problem I ran > into recently with virgl commands unexpectedly processed from CPU > thread instead main-loop: > > ui/sdl2: Unset context after GL operations > ui/gtk-egl: Unset context after GL operations > virtio-gpu: Unset context after GL operations > > Alex Bennée (1): > docs/system: virtio-gpu: Document host/guest requirements > > Dmitry Osipenko (18): > ui/gdk: Restore original context after new context creation > ui/sdl2: Restore original context after new context creation > ui/sdl2: Don't disable scanout when display is refreshed > ui/gtk: Don't disable scanout when display is refreshed > ui/sdl2: Unbind context after GL operations > ui/gtk-egl: Unbind context after GL operations > ui/gdk: Unbind context after GL operations > virtio-gpu: Unbind context after GL operations > virtio-gpu: Handle virgl fence creation errors > virtio-gpu: Support asynchronous fencing > virtio-gpu: Support DRM native context > docs/system: virtio-gpu: Add link to Mesa VirGL doc > docs/system: virtio-gpu: Update Venus link > virtio-gpu: Remove superfluous memory_region_set_enabled() > virtio-gpu: Validate hostmem mapping offset > virtio-gpu: Replace finish_unmapping with mapping_state > virtio-gpu: Destroy virgl resources on virtio-gpu reset > virtio-gpu: Support mapping hostmem blobs with map_fixed > > Pierre-Eric Pelloux-Prayer (1): > ui/sdl2: Implement dpy dmabuf functions > > docs/system/devices/virtio/virtio-gpu.rst | 121 +++++- > hw/display/trace-events | 2 +- > hw/display/virtio-gpu-gl.c | 62 +++- > hw/display/virtio-gpu-virgl.c | 427 ++++++++++++++++++++-- > hw/display/virtio-gpu.c | 15 + > include/hw/virtio/virtio-gpu.h | 23 +- > include/ui/sdl2.h | 7 + > meson.build | 8 +- > ui/gtk-egl.c | 17 +- > ui/gtk-gl-area.c | 28 +- > ui/sdl2-gl.c | 81 +++- > ui/sdl2.c | 42 +++ > 12 files changed, 760 insertions(+), 73 deletions(-) >
On 2/20/26 11:35, Akihiko Odaki wrote: > On 2026/02/20 9:16, Dmitry Osipenko wrote: >> Hello, >> >> This is follow up to DRM native context v16 [1] and MAP_FIXED API v10 [2] >> virtio-gpu patches that has been reviewed previously and were waiting for >> a new release of libvirglrenderer 1.3.0. >> >> [1] https://lore.kernel.org/qemu-devel/20251116125641.2255794-1- >> dmitry.osipenko@collabora.com/ >> [2] https://lore.kernel.org/qemu-devel/20260118162856.223796-1- >> dmitry.osipenko@collabora.com/ >> >> Based-on: 20260214-region-v1-1-229f00ae1f38@rsg.ci.i.u-tokyo.ac.jp >> >> Changelog: >> >> v19:- Further improved improved naming of functions and terminology RE >> GL context binding. Suggested by Akihiko Odaki. >> >> - Added new patch "ui/gdk: Restore original context after new >> context >> creation" in addition to improved "ui/sdl2: Restore original >> context" >> that now getd actual bound GL context and restores to it instead >> of restoring to the console's ctx, for consistency with the rest >> of GL context management fixes that ensure context is bound only >> when necessary. >> >> - Improved virtio_gpu_virgl_update_render_state() with force_ctx_0() >> and unbind_ctx() to make deferred GPU resetting maintain bound GL >> context properly. > > Both the new context management improvement and the MAP_FIXED API > changes look good to me. For the whole series, > > Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp> > > Thank you for completing this change. Thanks a lot for your help with the reviews! -- Best regards, Dmitry
On 2/20/26 18:17, Dmitry Osipenko wrote: > On 2/20/26 11:35, Akihiko Odaki wrote: >> On 2026/02/20 9:16, Dmitry Osipenko wrote: >>> Hello, >>> >>> This is follow up to DRM native context v16 [1] and MAP_FIXED API v10 [2] >>> virtio-gpu patches that has been reviewed previously and were waiting for >>> a new release of libvirglrenderer 1.3.0. >>> >>> [1] https://lore.kernel.org/qemu-devel/20251116125641.2255794-1- >>> dmitry.osipenko@collabora.com/ >>> [2] https://lore.kernel.org/qemu-devel/20260118162856.223796-1- >>> dmitry.osipenko@collabora.com/ >>> >>> Based-on: 20260214-region-v1-1-229f00ae1f38@rsg.ci.i.u-tokyo.ac.jp >>> >>> Changelog: >>> >>> v19:- Further improved improved naming of functions and terminology RE >>> GL context binding. Suggested by Akihiko Odaki. >>> >>> - Added new patch "ui/gdk: Restore original context after new >>> context >>> creation" in addition to improved "ui/sdl2: Restore original >>> context" >>> that now getd actual bound GL context and restores to it instead >>> of restoring to the console's ctx, for consistency with the rest >>> of GL context management fixes that ensure context is bound only >>> when necessary. >>> >>> - Improved virtio_gpu_virgl_update_render_state() with force_ctx_0() >>> and unbind_ctx() to make deferred GPU resetting maintain bound GL >>> context properly. >> >> Both the new context management improvement and the MAP_FIXED API >> changes look good to me. For the whole series, >> >> Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp> >> >> Thank you for completing this change. > > Thanks a lot for your help with the reviews! There is report about dbus display not working with this series on [1]. The problem sorted out by adding missing GL ctx re-bindings. Spice display should need similar fix. Will make v20. [1] https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38731#note_3341965 -- Best regards, Dmitry
On 2/24/26 00:18, Dmitry Osipenko wrote: > On 2/20/26 18:17, Dmitry Osipenko wrote: >> On 2/20/26 11:35, Akihiko Odaki wrote: >>> On 2026/02/20 9:16, Dmitry Osipenko wrote: >>>> Hello, >>>> >>>> This is follow up to DRM native context v16 [1] and MAP_FIXED API v10 [2] >>>> virtio-gpu patches that has been reviewed previously and were waiting for >>>> a new release of libvirglrenderer 1.3.0. >>>> >>>> [1] https://lore.kernel.org/qemu-devel/20251116125641.2255794-1- >>>> dmitry.osipenko@collabora.com/ >>>> [2] https://lore.kernel.org/qemu-devel/20260118162856.223796-1- >>>> dmitry.osipenko@collabora.com/ >>>> >>>> Based-on: 20260214-region-v1-1-229f00ae1f38@rsg.ci.i.u-tokyo.ac.jp >>>> >>>> Changelog: >>>> >>>> v19:- Further improved improved naming of functions and terminology RE >>>> GL context binding. Suggested by Akihiko Odaki. >>>> >>>> - Added new patch "ui/gdk: Restore original context after new >>>> context >>>> creation" in addition to improved "ui/sdl2: Restore original >>>> context" >>>> that now getd actual bound GL context and restores to it instead >>>> of restoring to the console's ctx, for consistency with the rest >>>> of GL context management fixes that ensure context is bound only >>>> when necessary. >>>> >>>> - Improved virtio_gpu_virgl_update_render_state() with force_ctx_0() >>>> and unbind_ctx() to make deferred GPU resetting maintain bound GL >>>> context properly. >>> >>> Both the new context management improvement and the MAP_FIXED API >>> changes look good to me. For the whole series, >>> >>> Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp> >>> >>> Thank you for completing this change. >> >> Thanks a lot for your help with the reviews! > > There is report about dbus display not working with this series on [1]. > The problem sorted out by adding missing GL ctx re-bindings. Spice > display should need similar fix. Will make v20. > > [1] > https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38731#note_3341965 After digging further, I realized that touching GTK APIs outside of main-loop thread is troubling as UI toolkits are single threaded, and virtio-gpu interacts with those APIs while processing cmds. I'll abandon this approach with GL context unbinding and instead make virtio-gpu to process commands only from main-loop thread in v20. -- Best regards, Dmitry
On Thu, Feb 19, 2026 at 4:20 PM Dmitry Osipenko <dmitry.osipenko@collabora.com> wrote: > > Hello, > > This is follow up to DRM native context v16 [1] and MAP_FIXED API v10 [2] > virtio-gpu patches that has been reviewed previously and were waiting for > a new release of libvirglrenderer 1.3.0. > > [1] https://lore.kernel.org/qemu-devel/20251116125641.2255794-1-dmitry.osipenko@collabora.com/ > [2] https://lore.kernel.org/qemu-devel/20260118162856.223796-1-dmitry.osipenko@collabora.com/ > > Based-on: 20260214-region-v1-1-229f00ae1f38@rsg.ci.i.u-tokyo.ac.jp > > Changelog: > > v19:- Further improved improved naming of functions and terminology RE > GL context binding. Suggested by Akihiko Odaki. > > - Added new patch "ui/gdk: Restore original context after new context > creation" in addition to improved "ui/sdl2: Restore original context" > that now getd actual bound GL context and restores to it instead > of restoring to the console's ctx, for consistency with the rest > of GL context management fixes that ensure context is bound only > when necessary. > > - Improved virtio_gpu_virgl_update_render_state() with force_ctx_0() > and unbind_ctx() to make deferred GPU resetting maintain bound GL > context properly. > > v18:- Changed dpy_gl_ctx_make_current() to use first scanout when unsetting > virgl's GL ctx0 and improved naming of cmd-processing function. > Suggested by Akihiko Odaki. > > - Added "ui/gdk: Unset context after GL operations" patch after > realizing GDK/GL code needed more gdk_gl_context_clear_current(). > > v17:- Rebased patches on recent upstream, updated doc patches with new > drm native contexts supported by libvirglrenderer. > > - Applied minor change that was requested from Akihiko Odaki > by moving virtio_gpu_device_realize() for MAP_FIXED v10. > > - Added virtio_gpu_virgl_update_render_state() to virtio_gpu_fence_poll() > that was missed in MAP_FIXED v10. > > - Added new patches fixing another GL context switching problem I ran > into recently with virgl commands unexpectedly processed from CPU > thread instead main-loop: > > ui/sdl2: Unset context after GL operations > ui/gtk-egl: Unset context after GL operations > virtio-gpu: Unset context after GL operations > > Alex Bennée (1): > docs/system: virtio-gpu: Document host/guest requirements > > Dmitry Osipenko (18): > ui/gdk: Restore original context after new context creation > ui/sdl2: Restore original context after new context creation > ui/sdl2: Don't disable scanout when display is refreshed > ui/gtk: Don't disable scanout when display is refreshed > ui/sdl2: Unbind context after GL operations > ui/gtk-egl: Unbind context after GL operations > ui/gdk: Unbind context after GL operations > virtio-gpu: Unbind context after GL operations > virtio-gpu: Handle virgl fence creation errors > virtio-gpu: Support asynchronous fencing > virtio-gpu: Support DRM native context > docs/system: virtio-gpu: Add link to Mesa VirGL doc > docs/system: virtio-gpu: Update Venus link > virtio-gpu: Remove superfluous memory_region_set_enabled() > virtio-gpu: Validate hostmem mapping offset > virtio-gpu: Replace finish_unmapping with mapping_state > virtio-gpu: Destroy virgl resources on virtio-gpu reset > virtio-gpu: Support mapping hostmem blobs with map_fixed > > Pierre-Eric Pelloux-Prayer (1): > ui/sdl2: Implement dpy dmabuf functions > > docs/system/devices/virtio/virtio-gpu.rst | 121 +++++- > hw/display/trace-events | 2 +- > hw/display/virtio-gpu-gl.c | 62 +++- > hw/display/virtio-gpu-virgl.c | 427 ++++++++++++++++++++-- > hw/display/virtio-gpu.c | 15 + > include/hw/virtio/virtio-gpu.h | 23 +- > include/ui/sdl2.h | 7 + > meson.build | 8 +- > ui/gtk-egl.c | 17 +- > ui/gtk-gl-area.c | 28 +- > ui/sdl2-gl.c | 81 +++- > ui/sdl2.c | 42 +++ > 12 files changed, 760 insertions(+), 73 deletions(-) > > -- > 2.52.0 > My original r-b's still persist, and this PATCH v19 is t-b. Can't wait to see this land ; )
On 2/20/26 09:51, Yiwei Zhang wrote: > On Thu, Feb 19, 2026 at 4:20 PM Dmitry Osipenko > <dmitry.osipenko@collabora.com> wrote: >> >> Hello, >> >> This is follow up to DRM native context v16 [1] and MAP_FIXED API v10 [2] >> virtio-gpu patches that has been reviewed previously and were waiting for >> a new release of libvirglrenderer 1.3.0. >> >> [1] https://lore.kernel.org/qemu-devel/20251116125641.2255794-1-dmitry.osipenko@collabora.com/ >> [2] https://lore.kernel.org/qemu-devel/20260118162856.223796-1-dmitry.osipenko@collabora.com/ >> >> Based-on: 20260214-region-v1-1-229f00ae1f38@rsg.ci.i.u-tokyo.ac.jp >> >> Changelog: >> >> v19:- Further improved improved naming of functions and terminology RE >> GL context binding. Suggested by Akihiko Odaki. >> >> - Added new patch "ui/gdk: Restore original context after new context >> creation" in addition to improved "ui/sdl2: Restore original context" >> that now getd actual bound GL context and restores to it instead >> of restoring to the console's ctx, for consistency with the rest >> of GL context management fixes that ensure context is bound only >> when necessary. >> >> - Improved virtio_gpu_virgl_update_render_state() with force_ctx_0() >> and unbind_ctx() to make deferred GPU resetting maintain bound GL >> context properly. >> >> v18:- Changed dpy_gl_ctx_make_current() to use first scanout when unsetting >> virgl's GL ctx0 and improved naming of cmd-processing function. >> Suggested by Akihiko Odaki. >> >> - Added "ui/gdk: Unset context after GL operations" patch after >> realizing GDK/GL code needed more gdk_gl_context_clear_current(). >> >> v17:- Rebased patches on recent upstream, updated doc patches with new >> drm native contexts supported by libvirglrenderer. >> >> - Applied minor change that was requested from Akihiko Odaki >> by moving virtio_gpu_device_realize() for MAP_FIXED v10. >> >> - Added virtio_gpu_virgl_update_render_state() to virtio_gpu_fence_poll() >> that was missed in MAP_FIXED v10. >> >> - Added new patches fixing another GL context switching problem I ran >> into recently with virgl commands unexpectedly processed from CPU >> thread instead main-loop: >> >> ui/sdl2: Unset context after GL operations >> ui/gtk-egl: Unset context after GL operations >> virtio-gpu: Unset context after GL operations >> >> Alex Bennée (1): >> docs/system: virtio-gpu: Document host/guest requirements >> >> Dmitry Osipenko (18): >> ui/gdk: Restore original context after new context creation >> ui/sdl2: Restore original context after new context creation >> ui/sdl2: Don't disable scanout when display is refreshed >> ui/gtk: Don't disable scanout when display is refreshed >> ui/sdl2: Unbind context after GL operations >> ui/gtk-egl: Unbind context after GL operations >> ui/gdk: Unbind context after GL operations >> virtio-gpu: Unbind context after GL operations >> virtio-gpu: Handle virgl fence creation errors >> virtio-gpu: Support asynchronous fencing >> virtio-gpu: Support DRM native context >> docs/system: virtio-gpu: Add link to Mesa VirGL doc >> docs/system: virtio-gpu: Update Venus link >> virtio-gpu: Remove superfluous memory_region_set_enabled() >> virtio-gpu: Validate hostmem mapping offset >> virtio-gpu: Replace finish_unmapping with mapping_state >> virtio-gpu: Destroy virgl resources on virtio-gpu reset >> virtio-gpu: Support mapping hostmem blobs with map_fixed >> >> Pierre-Eric Pelloux-Prayer (1): >> ui/sdl2: Implement dpy dmabuf functions >> >> docs/system/devices/virtio/virtio-gpu.rst | 121 +++++- >> hw/display/trace-events | 2 +- >> hw/display/virtio-gpu-gl.c | 62 +++- >> hw/display/virtio-gpu-virgl.c | 427 ++++++++++++++++++++-- >> hw/display/virtio-gpu.c | 15 + >> include/hw/virtio/virtio-gpu.h | 23 +- >> include/ui/sdl2.h | 7 + >> meson.build | 8 +- >> ui/gtk-egl.c | 17 +- >> ui/gtk-gl-area.c | 28 +- >> ui/sdl2-gl.c | 81 +++- >> ui/sdl2.c | 42 +++ >> 12 files changed, 760 insertions(+), 73 deletions(-) >> >> -- >> 2.52.0 >> > > My original r-b's still persist, and this PATCH v19 is t-b. Can't wait > to see this land ; ) Thanks! -- Best regards, Dmitry
© 2016 - 2026 Red Hat, Inc.