[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 18/21] ui/egl: query ANGLE d3d device
From: |
marcandre . lureau |
Subject: |
[PATCH 18/21] ui/egl: query ANGLE d3d device |
Date: |
Tue, 6 Jun 2023 15:56:55 +0400 |
From: Marc-André Lureau <marcandre.lureau@redhat.com>
Check if ANGLE is being used with D3D backend.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
include/ui/egl-helpers.h | 1 +
ui/egl-helpers.c | 32 +++++++++++++++++++++++++++++++-
ui/trace-events | 3 +++
3 files changed, 35 insertions(+), 1 deletion(-)
diff --git a/include/ui/egl-helpers.h b/include/ui/egl-helpers.h
index 6e2f0c49a6..4b8c0d2281 100644
--- a/include/ui/egl-helpers.h
+++ b/include/ui/egl-helpers.h
@@ -12,6 +12,7 @@
extern EGLDisplay *qemu_egl_display;
extern EGLConfig qemu_egl_config;
extern DisplayGLMode qemu_egl_mode;
+extern bool qemu_egl_angle_d3d;
typedef struct egl_fb {
int width;
diff --git a/ui/egl-helpers.c b/ui/egl-helpers.c
index 1169e19adb..589cb80b66 100644
--- a/ui/egl-helpers.c
+++ b/ui/egl-helpers.c
@@ -15,16 +15,19 @@
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
#include "qemu/osdep.h"
+
#include "qemu/drm.h"
#include "qemu/error-report.h"
#include "ui/console.h"
#include "ui/egl-helpers.h"
#include "sysemu/sysemu.h"
#include "qapi/error.h"
+#include "trace.h"
EGLDisplay *qemu_egl_display;
EGLConfig qemu_egl_config;
DisplayGLMode qemu_egl_mode;
+bool qemu_egl_angle_d3d;
/* ------------------------------------------------------------------ */
@@ -555,7 +558,34 @@ int qemu_egl_init_dpy_win32(EGLNativeDisplayType dpy,
DisplayGLMode mode)
if (mode == DISPLAYGL_MODE_ON) {
mode = DISPLAYGL_MODE_ES;
}
- return qemu_egl_init_dpy(dpy, 0, mode);
+
+ if (qemu_egl_init_dpy(dpy, 0, mode) < 0) {
+ return -1;
+ }
+
+#ifdef EGL_D3D11_DEVICE_ANGLE
+ if (epoxy_has_egl_extension(qemu_egl_display, "EGL_EXT_device_query")) {
+ EGLDeviceEXT device;
+ void *d3d11_device;
+
+ if (!eglQueryDisplayAttribEXT(qemu_egl_display,
+ EGL_DEVICE_EXT,
+ (EGLAttrib *)&device)) {
+ return 0;
+ }
+
+ if (!eglQueryDeviceAttribEXT(device,
+ EGL_D3D11_DEVICE_ANGLE,
+ (EGLAttrib *)&d3d11_device)) {
+ return 0;
+ }
+
+ trace_egl_init_d3d11_device(device);
+ qemu_egl_angle_d3d = device != NULL;
+ }
+#endif
+
+ return 0;
}
#endif
diff --git a/ui/trace-events b/ui/trace-events
index b17c3d7893..55f13d76d4 100644
--- a/ui/trace-events
+++ b/ui/trace-events
@@ -161,3 +161,6 @@ dbus_clipboard_register(const char *bus_name) "peer %s"
dbus_clipboard_unregister(const char *bus_name) "peer %s"
dbus_scanout_texture(uint32_t tex_id, bool backing_y_0_top, uint32_t
backing_width, uint32_t backing_height, uint32_t x, uint32_t y, uint32_t w,
uint32_t h) "tex_id:%u y0top:%d back:%ux%u %u+%u-%ux%u"
dbus_gl_gfx_switch(void *p) "surf: %p"
+
+# egl-helpers.c
+egl_init_d3d11_device(void *p) "d3d device: %p"
--
2.40.1
- [PATCH 07/21] tests: make dbus-display-test work on win32, (continued)
- [PATCH 07/21] tests: make dbus-display-test work on win32, marcandre . lureau, 2023/06/06
- [PATCH 08/21] ui/dbus: introduce "Interfaces" properties, marcandre . lureau, 2023/06/06
- [PATCH 10/21] virtio-gpu/win32: allocate shareable 2d resources/images, marcandre . lureau, 2023/06/06
- [PATCH 11/21] ui/dbus: use shared memory when possible on win32, marcandre . lureau, 2023/06/06
- [PATCH 12/21] ui: add egl-headless support on win32, marcandre . lureau, 2023/06/06
- [PATCH 13/21] ui/egl: default to GLES on windows, marcandre . lureau, 2023/06/06
- [PATCH 14/21] ui: add egl_fb_read_rect(), marcandre . lureau, 2023/06/06
- [PATCH 15/21] ui/dbus: add GL support on win32, marcandre . lureau, 2023/06/06
- [PATCH 16/21] ui/dbus: add some GL traces, marcandre . lureau, 2023/06/06
- [PATCH 18/21] ui/egl: query ANGLE d3d device,
marcandre . lureau <=
- [PATCH 17/21] virtio-gpu-virgl: teach it to get the QEMU EGL display, marcandre . lureau, 2023/06/06
- [PATCH 19/21] ui: add optional d3d texture pointer to scanout texture, marcandre . lureau, 2023/06/06
- [PATCH 20/21] virtio-gpu-virgl: use D3D11_SHARE_TEXTURE when available, marcandre . lureau, 2023/06/06
- [PATCH 21/21] ui/dbus: use shared D3D11 Texture2D when possible, marcandre . lureau, 2023/06/06
- [PATCH 09/21] console/win32: allocate shareable display surface, marcandre . lureau, 2023/06/06