summaryrefslogtreecommitdiffstats
path: root/ui/egl-helpers.c
Commit message (Collapse)AuthorAgeFilesLines
* ui/egl: fix framebuffer readsGerd Hoffmann2019-09-171-3/+3
| | | | | | | | | | | | | | | Fix egl_fb_read() to use the (destination) surface size instead of the (source) framebuffer source for glReadPixels. Pass the DisplaySurface instead of the pixeldata pointer to egl_fb_read() to make this possible. With that in place framebuffer reads work fine even if the surface and framebuffer sizes don't match, so we can remove the guest-triggerable asserts in egl_scanout_flush(). Buglink: https://bugzilla.redhat.com//show_bug.cgi?id=1749659 Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-id: 20190909073911.24787-1-kraxel@redhat.com
* egl-helpers: add modifier support to egl_dmabuf_import_texture()Gerd Hoffmann2019-06-071-9/+25
| | | | | | | | Check and use QemuDmaBuf->modifier in egl_dmabuf_import_texture() for dmabuf imports. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Message-id: 20190529072144.26737-5-kraxel@redhat.com
* egl-helpers: add modifier support to egl_get_fd_for_texture().Gerd Hoffmann2019-06-071-2/+3
| | | | | | | | 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
* ui/egl-helpers: Augment parameter list of egl_texture_blend() to convey ↵Chen Zhang2019-02-051-4/+5
| | | | | | | | | | | | scales of viewport This would help gtk-egl display showing scaled DMABuf cursor images when gtk window was zoomed. A default scale of (1.0, 1.0) was presumed for call sites where no scaling is needed. Signed-off-by: Chen Zhang <tgfbeta@me.com> Message-id: 23B229B3-3095-4DFB-8369-866784808D30@me.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* egl-helpers.h: do not depend on X11 Window type, use EGLNativeWindowTypeAlexander Kanavin2019-01-211-2/+2
| | | | | | | | | | | | | It was assumed that mesa provides the necessary X11 includes, but it is not always the case, as it can be configured without x11 support. Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-id: 20190116113751.17177-1-alex.kanavin@gmail.com [ kraxel: codestyle fix (long line) ] Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* util: promote qemu_egl_rendernode_open() to libqemuutilMarc-André Lureau2018-08-271-49/+2Star
| | | | | | | | | | | vhost-user-gpu will share the same code to open a DRM node. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20180713130916.4153-20-marcandre.lureau@redhat.com> [ kraxel: buildfix: util/drm.o must be CONFIG_OPENGL not CONFIG_LINUX ] Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* Add gles support to egl-helpers, wire up in egl-headless and gtk.Gerd Hoffmann2018-06-261-16/+39
| | | | | | | | | | | | | | | | Add support for OpenGL ES to egl-helpers. Wire up the new option for egl-headless and gtk UIs. egl-headless actually works fine. gtk hits a not-yet implemented code path in libEGL when trying to use gles mode: libEGL warning: FIXME: egl/x11 doesn't support front buffer rendering. (This is mesa 17.2.3). Cc: Tomeu Vizoso <tomeu.vizoso@collabora.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com> Tested-by: Tomeu Vizoso <tomeu.vizoso@collabora.com> Message-id: 20180618112141.23398-1-kraxel@redhat.com
* egl-helpers: add alpha channel to texture formatGerd Hoffmann2018-02-221-1/+1
| | | | | | | | Needed when rendering cursers which (unlike framebuffers) actually are transparent. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Message-id: 20180220110433.20353-4-kraxel@redhat.com
* egl-helpers: add egl_texture_blit and egl_texture_blendGerd Hoffmann2017-10-171-0/+27
| | | | | | | | | | | egl_texture_blit() blits a texture, simliar to egl_fb_blit() but by rendering the texture to the screen instead of using a framebuffer blit. egl_texture_blend() renders a texture with alpha blending, will be used to render the cursor to the screen. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Message-id: 20171010135453.6704-6-kraxel@redhat.com
* egl-helpers: add dmabuf import supportGerd Hoffmann2017-10-171-0/+46
| | | | | | | | Add helper function to import a dma-buf as opengl texture. Also add a helper to release the texture again. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Message-id: 20171010135453.6704-5-kraxel@redhat.com
* egl: misc framebuffer helper improvements.Gerd Hoffmann2017-09-291-8/+18
| | | | | | | | | | | Rename the functions to to say "setup" instead of "create" because they support being called multiple times on the same egl framebuffer. Properly delete unused textures, update function interfaces to support this. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Message-id: 20170927115031.12063-1-kraxel@redhat.com
* egl-helpers: add helpers to handle opengl framebuffersGerd Hoffmann2017-06-211-0/+76
| | | | | | | | Add a collection of egl_fb_*() helper functions to manage and use opengl framebuffers, which is a common pattern in UI code with opengl support. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Message-id: 20170614084149.31314-2-kraxel@redhat.com
* egl: explicitly ask for core contextGerd Hoffmann2017-05-121-0/+1
| | | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Message-id: 20170505104101.30589-6-kraxel@redhat.com
* egl-helpers: add missing error checkGerd Hoffmann2017-05-121-1/+6
| | | | | | | | Code didn't check for qemu_egl_init_dpy_mesa() failures, add it. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-id: 20170505104101.30589-5-kraxel@redhat.com
* egl-helpers: fix display init for x11Gerd Hoffmann2017-05-121-8/+26
| | | | | | | | | | When 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 Fixes: 0ea1523fb6703aa0dcd65e66b59e96fec028e60a Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Message-id: 20170505104101.30589-4-kraxel@redhat.com
* egl-helpers: drop support for gles and debug loggingGerd Hoffmann2017-05-121-47/+5Star
| | | | | | | | | | Leftover from the early opengl days. Unused now, so delete the dead code. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-id: 20170505104101.30589-3-kraxel@redhat.com
* ui/egl-helpers: fix egl 1.5 display initGerd Hoffmann2017-03-271-6/+52
| | | | | | | | | | | Unfortunaly switching to getPlatformDisplayEXT isn't as easy as implemented by 0ea1523fb6703aa0dcd65e66b59e96fec028e60a. See the longish comment for the complete story. Cc: Frediano Ziglio <fziglio@redhat.com> Suggested-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Message-id: 1489997042-1824-1-git-send-email-kraxel@redhat.com
* egl-helpers: Support newer MESA versionsFrediano Ziglio2017-02-201-0/+4
| | | | | | | | | | | According to https://www.khronos.org/registry/EGL/extensions/MESA/EGL_MESA_platform_gbm.txt if MESA_platform_gbm is supported display should be initialized from a GBM handle using eglGetPlatformDisplayEXT. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Message-id: 20170220095055.4234-1-fziglio@redhat.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* spice: allow to specify drm rendernodeMarc-André Lureau2017-02-201-3/+7
| | | | | | | | | When multiple GPU are available, picking the first one isn't always the best choice. Learn to specify a device rendernode. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-id: 20170212112118.16044-1-marcandre.lureau@redhat.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* egl-helpers: Change file licensing to LGPLv2Frediano Ziglio2017-01-101-0/+16
| | | | | | | | | | | | | | | | | | | The relicense permits sharing the code with Spice which is LGPL. All people listed below have agreed to the relicense: - Arei Gonglei; - Cole Robinson; - Gerd Hoffmann; - Peter Maydell. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Cole Robinson <crobinso@redhat.com> Acked-by: Gonglei <arei.gonglei@huawei.com> Acked-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 20161208104539.3045-1-fziglio@redhat.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* ui: egl: Replace fprintf with error_reportCole Robinson2016-06-031-13/+14
| | | | | | | | Signed-off-by: Cole Robinson <crobinso@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-id: c880920f6e40a506394d89dbbe1f67c63d359c17.1463588606.git.crobinso@redhat.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* egl-helpers: fix possible resource leakGonglei2016-05-121-6/+3Star
| | | | | | | | | CID 1352419, using g_strdup_printf instead of asprintf. Signed-off-by: Gonglei <arei.gonglei@huawei.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Message-id: 1463047028-123868-2-git-send-email-arei.gonglei@huawei.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* Use scripts/clean-includes to drop redundant qemu/typedefs.hMarkus Armbruster2016-03-221-1/+0Star
| | | | | | | | | | | | Re-run scripts/clean-includes to apply the previous commit's corrections and updates. Besides redundant qemu/typedefs.h, this only finds a redundant config-host.h include in ui/egl-helpers.c. No idea how that escaped the previous runs. Some manual whitespace trimming around dropped includes squashed in. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* egl-helpers: add functions for render nodes and dma-buf passingGerd Hoffmann2016-02-231-0/+129
| | | | | | | | | Adds helpers to open a drm render node and create a opengl context for it. Also add a helper to export a texture as dma-buf. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
* ui: Clean up includesPeter Maydell2016-02-041-8/+1Star
| | | | | | | | | | Clean up includes so that osdep.h is included first and headers which it implies are not included manually. This commit was created with scripts/clean-includes. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 1454089805-5470-2-git-send-email-peter.maydell@linaro.org
* ui: add egl-helpersGerd Hoffmann2015-05-291-0/+148
Add helper functions to initialize OpenGL using egl. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com>