virtio-gpu-udmabuf: correct naming of QemuDmaBuf size properties

Replace 'width' and 'height' in QemuDmaBuf with 'backing_widht'
and 'backing_height' as these commonly indicate the size of the
whole surface (e.g. guest's Xorg extended display). Then use
'width' and 'height' for sub region in there (e.g. guest's
scanouts).

Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Marc-André Lureau <marcandre.lureau@redhat.com>
Cc: Vivek Kasireddy <vivek.kasireddy@intel.com>
Signed-off-by: Dongwon Kim <dongwon.kim@intel.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20230713040444.32267-1-dongwon.kim@intel.com>
This commit is contained in:
Dongwon Kim 2023-07-12 21:04:44 -07:00 committed by Marc-André Lureau
parent 0d0be87659
commit 9ac06df8b6
6 changed files with 26 additions and 23 deletions

View file

@ -181,13 +181,13 @@ static VGPUDMABuf
} }
dmabuf = g_new0(VGPUDMABuf, 1); dmabuf = g_new0(VGPUDMABuf, 1);
dmabuf->buf.width = fb->width; dmabuf->buf.width = r->width;
dmabuf->buf.height = fb->height; dmabuf->buf.height = r->height;
dmabuf->buf.stride = fb->stride; dmabuf->buf.stride = fb->stride;
dmabuf->buf.x = r->x; dmabuf->buf.x = r->x;
dmabuf->buf.y = r->y; dmabuf->buf.y = r->y;
dmabuf->buf.scanout_width = r->width; dmabuf->buf.backing_width = fb->width;
dmabuf->buf.scanout_height = r->height; dmabuf->buf.backing_height = fb->height;
dmabuf->buf.fourcc = qemu_pixman_to_drm_format(fb->format); dmabuf->buf.fourcc = qemu_pixman_to_drm_format(fb->format);
dmabuf->buf.fd = res->dmabuf_fd; dmabuf->buf.fd = res->dmabuf_fd;
dmabuf->buf.allow_fences = true; dmabuf->buf.allow_fences = true;
@ -218,8 +218,8 @@ int virtio_gpu_update_dmabuf(VirtIOGPU *g,
g->dmabuf.primary[scanout_id] = new_primary; g->dmabuf.primary[scanout_id] = new_primary;
qemu_console_resize(scanout->con, qemu_console_resize(scanout->con,
new_primary->buf.scanout_width, new_primary->buf.width,
new_primary->buf.scanout_height); new_primary->buf.height);
dpy_gl_scanout_dmabuf(scanout->con, &new_primary->buf); dpy_gl_scanout_dmabuf(scanout->con, &new_primary->buf);
if (old_primary) { if (old_primary) {

View file

@ -201,8 +201,8 @@ typedef struct QemuDmaBuf {
uint32_t texture; uint32_t texture;
uint32_t x; uint32_t x;
uint32_t y; uint32_t y;
uint32_t scanout_width; uint32_t backing_width;
uint32_t scanout_height; uint32_t backing_height;
bool y0_top; bool y0_top;
void *sync; void *sync;
int fence_fd; int fence_fd;

View file

@ -415,13 +415,13 @@ static void dbus_scanout_texture(DisplayChangeListener *dcl,
backing_width, backing_height, x, y, w, h); backing_width, backing_height, x, y, w, h);
#ifdef CONFIG_GBM #ifdef CONFIG_GBM
QemuDmaBuf dmabuf = { QemuDmaBuf dmabuf = {
.width = backing_width, .width = w,
.height = backing_height, .height = h,
.y0_top = backing_y_0_top, .y0_top = backing_y_0_top,
.x = x, .x = x,
.y = y, .y = y,
.scanout_width = w, .backing_width = backing_width,
.scanout_height = h, .backing_height = backing_height,
}; };
assert(tex_id); assert(tex_id);

View file

@ -148,8 +148,8 @@ void egl_fb_blit(egl_fb *dst, egl_fb *src, bool flip)
if (src->dmabuf) { if (src->dmabuf) {
x1 = src->dmabuf->x; x1 = src->dmabuf->x;
y1 = src->dmabuf->y; y1 = src->dmabuf->y;
w = src->dmabuf->scanout_width; w = src->dmabuf->width;
h = src->dmabuf->scanout_height; h = src->dmabuf->height;
} }
w = (x1 + w) > src->width ? src->width - x1 : w; w = (x1 + w) > src->width ? src->width - x1 : w;
@ -314,9 +314,9 @@ void egl_dmabuf_import_texture(QemuDmaBuf *dmabuf)
} }
attrs[i++] = EGL_WIDTH; attrs[i++] = EGL_WIDTH;
attrs[i++] = dmabuf->width; attrs[i++] = dmabuf->backing_width;
attrs[i++] = EGL_HEIGHT; attrs[i++] = EGL_HEIGHT;
attrs[i++] = dmabuf->height; attrs[i++] = dmabuf->backing_height;
attrs[i++] = EGL_LINUX_DRM_FOURCC_EXT; attrs[i++] = EGL_LINUX_DRM_FOURCC_EXT;
attrs[i++] = dmabuf->fourcc; attrs[i++] = dmabuf->fourcc;

View file

@ -262,9 +262,10 @@ void gd_egl_scanout_dmabuf(DisplayChangeListener *dcl,
} }
gd_egl_scanout_texture(dcl, dmabuf->texture, gd_egl_scanout_texture(dcl, dmabuf->texture,
dmabuf->y0_top, dmabuf->width, dmabuf->height, dmabuf->y0_top,
dmabuf->x, dmabuf->y, dmabuf->scanout_width, dmabuf->backing_width, dmabuf->backing_height,
dmabuf->scanout_height, NULL); dmabuf->x, dmabuf->y, dmabuf->width,
dmabuf->height, NULL);
if (dmabuf->allow_fences) { if (dmabuf->allow_fences) {
vc->gfx.guest_fb.dmabuf = dmabuf; vc->gfx.guest_fb.dmabuf = dmabuf;
@ -284,7 +285,8 @@ void gd_egl_cursor_dmabuf(DisplayChangeListener *dcl,
if (!dmabuf->texture) { if (!dmabuf->texture) {
return; return;
} }
egl_fb_setup_for_tex(&vc->gfx.cursor_fb, dmabuf->width, dmabuf->height, egl_fb_setup_for_tex(&vc->gfx.cursor_fb,
dmabuf->backing_width, dmabuf->backing_height,
dmabuf->texture, false); dmabuf->texture, false);
} else { } else {
egl_fb_destroy(&vc->gfx.cursor_fb); egl_fb_destroy(&vc->gfx.cursor_fb);

View file

@ -301,9 +301,10 @@ void gd_gl_area_scanout_dmabuf(DisplayChangeListener *dcl,
} }
gd_gl_area_scanout_texture(dcl, dmabuf->texture, gd_gl_area_scanout_texture(dcl, dmabuf->texture,
dmabuf->y0_top, dmabuf->width, dmabuf->height, dmabuf->y0_top,
dmabuf->x, dmabuf->y, dmabuf->scanout_width, dmabuf->backing_width, dmabuf->backing_height,
dmabuf->scanout_height, NULL); dmabuf->x, dmabuf->y, dmabuf->width,
dmabuf->height, NULL);
if (dmabuf->allow_fences) { if (dmabuf->allow_fences) {
vc->gfx.guest_fb.dmabuf = dmabuf; vc->gfx.guest_fb.dmabuf = dmabuf;