- if (edpy->width != backing_width || edpy->height != backing_height) {
- edpy->width = backing_width;
- edpy->height = backing_height;
- glBindTexture(GL_TEXTURE_2D, edpy->blit_texture);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB,
- edpy->width, edpy->height,
- 0, GL_BGRA, GL_UNSIGNED_BYTE, 0);
- glBindFramebuffer(GL_FRAMEBUFFER_EXT, edpy->blit_framebuffer);
- glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
- GL_TEXTURE_2D, edpy->blit_texture, 0);
+}
+
+#ifdef CONFIG_GBM
+
+static void egl_scanout_dmabuf(DisplayChangeListener *dcl,
+ QemuDmaBuf *dmabuf)
+{
+ uint32_t width, height, texture;
+
+ egl_dmabuf_import_texture(dmabuf);
+ texture = qemu_dmabuf_get_texture(dmabuf);
+ if (!texture) {
+ return;
+ }
+
+ width = qemu_dmabuf_get_width(dmabuf);
+ height = qemu_dmabuf_get_height(dmabuf);
+
+ egl_scanout_texture(dcl, texture, false, width, height, 0, 0,
+ width, height, NULL);
+}
+
+static void egl_cursor_dmabuf(DisplayChangeListener *dcl,
+ QemuDmaBuf *dmabuf, bool have_hot,
+ uint32_t hot_x, uint32_t hot_y)
+{
+ uint32_t width, height, texture;
+ egl_dpy *edpy = container_of(dcl, egl_dpy, dcl);
+
+ if (dmabuf) {
+ egl_dmabuf_import_texture(dmabuf);
+ texture = qemu_dmabuf_get_texture(dmabuf);
+ if (!texture) {
+ return;
+ }
+
+ width = qemu_dmabuf_get_width(dmabuf);
+ height = qemu_dmabuf_get_height(dmabuf);
+ egl_fb_setup_for_tex(&edpy->cursor_fb, width, height, texture, false);
+ } else {
+ egl_fb_destroy(&edpy->cursor_fb);