ui/console: Use qemu_dmabuf_set_..() helpers instead

This commit updates all occurrences where these fields were
set directly have been updated to utilize helper functions.

v7: removed prefix, "dpy_gl_" from all helpers

v8: Introduction of helpers was removed as those were already added
    by the previous commit

Suggested-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Cc: Philippe Mathieu-Daudé <philmd@linaro.org>
Cc: Daniel P. Berrangé <berrange@redhat.com>
Cc: Vivek Kasireddy <vivek.kasireddy@intel.com>
Signed-off-by: Dongwon Kim <dongwon.kim@intel.com>
Message-Id: <20240508175403.3399895-5-dongwon.kim@intel.com>
This commit is contained in:
Dongwon Kim 2024-05-08 10:54:01 -07:00 committed by Marc-André Lureau
parent 6779a3076f
commit fa6426805b
4 changed files with 16 additions and 14 deletions

View File

@ -348,8 +348,8 @@ void egl_dmabuf_import_texture(QemuDmaBuf *dmabuf)
return; return;
} }
glGenTextures(1, &dmabuf->texture); glGenTextures(1, &texture);
texture = qemu_dmabuf_get_texture(dmabuf); qemu_dmabuf_set_texture(dmabuf, texture);
glBindTexture(GL_TEXTURE_2D, texture); glBindTexture(GL_TEXTURE_2D, texture);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
@ -368,7 +368,7 @@ void egl_dmabuf_release_texture(QemuDmaBuf *dmabuf)
} }
glDeleteTextures(1, &texture); glDeleteTextures(1, &texture);
dmabuf->texture = 0; qemu_dmabuf_set_texture(dmabuf, 0);
} }
void egl_dmabuf_create_sync(QemuDmaBuf *dmabuf) void egl_dmabuf_create_sync(QemuDmaBuf *dmabuf)
@ -382,7 +382,7 @@ void egl_dmabuf_create_sync(QemuDmaBuf *dmabuf)
sync = eglCreateSyncKHR(qemu_egl_display, sync = eglCreateSyncKHR(qemu_egl_display,
EGL_SYNC_NATIVE_FENCE_ANDROID, NULL); EGL_SYNC_NATIVE_FENCE_ANDROID, NULL);
if (sync != EGL_NO_SYNC_KHR) { if (sync != EGL_NO_SYNC_KHR) {
dmabuf->sync = sync; qemu_dmabuf_set_sync(dmabuf, sync);
} }
} }
} }
@ -390,12 +390,14 @@ void egl_dmabuf_create_sync(QemuDmaBuf *dmabuf)
void egl_dmabuf_create_fence(QemuDmaBuf *dmabuf) void egl_dmabuf_create_fence(QemuDmaBuf *dmabuf)
{ {
void *sync = qemu_dmabuf_get_sync(dmabuf); void *sync = qemu_dmabuf_get_sync(dmabuf);
int fence_fd;
if (sync) { if (sync) {
dmabuf->fence_fd = eglDupNativeFenceFDANDROID(qemu_egl_display, fence_fd = eglDupNativeFenceFDANDROID(qemu_egl_display,
sync); sync);
qemu_dmabuf_set_fence_fd(dmabuf, fence_fd);
eglDestroySyncKHR(qemu_egl_display, sync); eglDestroySyncKHR(qemu_egl_display, sync);
dmabuf->sync = NULL; qemu_dmabuf_set_sync(dmabuf, NULL);
} }
} }

View File

@ -87,7 +87,7 @@ void gd_egl_draw(VirtualConsole *vc)
if (!qemu_dmabuf_get_draw_submitted(dmabuf)) { if (!qemu_dmabuf_get_draw_submitted(dmabuf)) {
return; return;
} else { } else {
dmabuf->draw_submitted = false; qemu_dmabuf_set_draw_submitted(dmabuf, false);
} }
} }
#endif #endif
@ -382,7 +382,7 @@ void gd_egl_flush(DisplayChangeListener *dcl,
if (vc->gfx.guest_fb.dmabuf && if (vc->gfx.guest_fb.dmabuf &&
!qemu_dmabuf_get_draw_submitted(vc->gfx.guest_fb.dmabuf)) { !qemu_dmabuf_get_draw_submitted(vc->gfx.guest_fb.dmabuf)) {
graphic_hw_gl_block(vc->gfx.dcl.con, true); graphic_hw_gl_block(vc->gfx.dcl.con, true);
vc->gfx.guest_fb.dmabuf->draw_submitted = true; qemu_dmabuf_set_draw_submitted(vc->gfx.guest_fb.dmabuf, true);
gtk_egl_set_scanout_mode(vc, true); gtk_egl_set_scanout_mode(vc, true);
gtk_widget_queue_draw_area(area, x, y, w, h); gtk_widget_queue_draw_area(area, x, y, w, h);
return; return;

View File

@ -63,7 +63,7 @@ void gd_gl_area_draw(VirtualConsole *vc)
if (!qemu_dmabuf_get_draw_submitted(dmabuf)) { if (!qemu_dmabuf_get_draw_submitted(dmabuf)) {
return; return;
} else { } else {
dmabuf->draw_submitted = false; qemu_dmabuf_set_draw_submitted(dmabuf, false);
} }
} }
#endif #endif
@ -292,7 +292,7 @@ void gd_gl_area_scanout_flush(DisplayChangeListener *dcl,
if (vc->gfx.guest_fb.dmabuf && if (vc->gfx.guest_fb.dmabuf &&
!qemu_dmabuf_get_draw_submitted(vc->gfx.guest_fb.dmabuf)) { !qemu_dmabuf_get_draw_submitted(vc->gfx.guest_fb.dmabuf)) {
graphic_hw_gl_block(vc->gfx.dcl.con, true); graphic_hw_gl_block(vc->gfx.dcl.con, true);
vc->gfx.guest_fb.dmabuf->draw_submitted = true; qemu_dmabuf_set_draw_submitted(vc->gfx.guest_fb.dmabuf, true);
gtk_gl_area_set_scanout_mode(vc, true); gtk_gl_area_set_scanout_mode(vc, true);
} }
gtk_gl_area_queue_render(GTK_GL_AREA(vc->gfx.drawing_area)); gtk_gl_area_queue_render(GTK_GL_AREA(vc->gfx.drawing_area));

View File

@ -598,11 +598,11 @@ void gd_hw_gl_flushed(void *vcon)
QemuDmaBuf *dmabuf = vc->gfx.guest_fb.dmabuf; QemuDmaBuf *dmabuf = vc->gfx.guest_fb.dmabuf;
int fence_fd; int fence_fd;
if (dmabuf->fence_fd >= 0) { fence_fd = qemu_dmabuf_get_fence_fd(dmabuf);
fence_fd = qemu_dmabuf_get_fence_fd(dmabuf); if (fence_fd >= 0) {
qemu_set_fd_handler(fence_fd, NULL, NULL, NULL); qemu_set_fd_handler(fence_fd, NULL, NULL, NULL);
close(fence_fd); close(fence_fd);
dmabuf->fence_fd = -1; qemu_dmabuf_set_fence_fd(dmabuf, -1);
graphic_hw_gl_block(vc->gfx.dcl.con, false); graphic_hw_gl_block(vc->gfx.dcl.con, false);
} }
} }