mirror of
https://github.com/utmapp/qemu.git
synced 2026-05-26 13:51:06 +00:00
Revert "Use virgl_renderer_borrow_texture_for_scanout"
This reverts commit 8b9e3062a4c2e243f0f80482385ebccbb8357f71.
This commit is contained in:
@@ -396,87 +396,11 @@ static void virgl_cmd_resource_flush(VirtIOGPU *g,
|
||||
}
|
||||
}
|
||||
|
||||
static GLuint virgl_borrow_texture_for_scanout(uint32_t id, bool *y_0_top,
|
||||
uint32_t *width,
|
||||
uint32_t *height,
|
||||
void **d3d_tex2d)
|
||||
{
|
||||
struct virgl_renderer_texture_info info;
|
||||
int ret;
|
||||
|
||||
memset(&info, 0, sizeof(info));
|
||||
|
||||
ret = virgl_renderer_borrow_texture_for_scanout(id, &info);
|
||||
if (ret == -1) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (y_0_top) {
|
||||
*y_0_top = info.flags & VIRTIO_GPU_RESOURCE_FLAG_Y_0_TOP;
|
||||
}
|
||||
|
||||
if (width) {
|
||||
*width = info.width;
|
||||
}
|
||||
|
||||
if (height) {
|
||||
*height = info.height;
|
||||
}
|
||||
|
||||
if (d3d_tex2d) {
|
||||
*d3d_tex2d = NULL;
|
||||
}
|
||||
|
||||
return info.tex_id;
|
||||
}
|
||||
|
||||
#if VIRGL_VERSION_MAJOR >= 1
|
||||
static GLuint virgl_borrow_d3d_info_for_scanout(uint32_t id, bool *y_0_top,
|
||||
uint32_t *width,
|
||||
uint32_t *height,
|
||||
void **d3d_tex2d)
|
||||
{
|
||||
int ret;
|
||||
struct virgl_renderer_resource_info info;
|
||||
struct virgl_renderer_resource_info_ext ext;
|
||||
void *d3d_tex2d = NULL;
|
||||
|
||||
memset(&ext, 0, sizeof(ext));
|
||||
|
||||
ret = virgl_renderer_resource_get_info_ext(id, &ext);
|
||||
info = ext.base;
|
||||
d3d_tex2d = ext.d3d_tex2d;
|
||||
if (ret) {
|
||||
qemu_log_mask(LOG_GUEST_ERROR,
|
||||
"%s: illegal resource specified %d\n",
|
||||
__func__, id);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (y_0_top) {
|
||||
*y_0_top = info.flags & VIRTIO_GPU_RESOURCE_FLAG_Y_0_TOP;
|
||||
}
|
||||
|
||||
if (width) {
|
||||
*width = info.width;
|
||||
}
|
||||
|
||||
if (height) {
|
||||
*height = info.height;
|
||||
}
|
||||
|
||||
if (d3d_tex2d) {
|
||||
*d3d_tex2d = ext.d3d_tex2d;
|
||||
}
|
||||
|
||||
return info.tex_id;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void virgl_cmd_set_scanout(VirtIOGPU *g,
|
||||
struct virtio_gpu_ctrl_command *cmd)
|
||||
{
|
||||
struct virtio_gpu_set_scanout ss;
|
||||
int ret;
|
||||
|
||||
VIRTIO_GPU_FILL_CMD(ss);
|
||||
trace_virtio_gpu_cmd_set_scanout(ss.scanout_id, ss.resource_id,
|
||||
@@ -491,18 +415,35 @@ static void virgl_cmd_set_scanout(VirtIOGPU *g,
|
||||
g->parent_obj.enable = 1;
|
||||
|
||||
if (ss.resource_id && ss.r.width && ss.r.height) {
|
||||
DisplayGLTextureBorrower borrower;
|
||||
struct virgl_renderer_resource_info info;
|
||||
void *d3d_tex2d = NULL;
|
||||
|
||||
#if VIRGL_VERSION_MAJOR >= 1
|
||||
borrower = virgl_borrow_d3d_info_for_scanout;
|
||||
struct virgl_renderer_resource_info_ext ext;
|
||||
memset(&ext, 0, sizeof(ext));
|
||||
ret = virgl_renderer_resource_get_info_ext(ss.resource_id, &ext);
|
||||
info = ext.base;
|
||||
d3d_tex2d = ext.d3d_tex2d;
|
||||
#else
|
||||
borrower = virgl_borrow_texture_for_scanout;
|
||||
memset(&info, 0, sizeof(info));
|
||||
ret = virgl_renderer_resource_get_info(ss.resource_id, &info);
|
||||
#endif
|
||||
if (ret) {
|
||||
qemu_log_mask(LOG_GUEST_ERROR,
|
||||
"%s: illegal resource specified %d\n",
|
||||
__func__, ss.resource_id);
|
||||
cmd->error = VIRTIO_GPU_RESP_ERR_INVALID_RESOURCE_ID;
|
||||
return;
|
||||
}
|
||||
qemu_console_resize(g->parent_obj.scanout[ss.scanout_id].con,
|
||||
ss.r.width, ss.r.height);
|
||||
virgl_renderer_force_ctx_0();
|
||||
dpy_gl_scanout_texture(
|
||||
g->parent_obj.scanout[ss.scanout_id].con, ss.resource_id,
|
||||
borrower, ss.r.x, ss.r.y, ss.r.width, ss.r.height);
|
||||
g->parent_obj.scanout[ss.scanout_id].con, info.tex_id,
|
||||
info.flags & VIRTIO_GPU_RESOURCE_FLAG_Y_0_TOP,
|
||||
info.width, info.height,
|
||||
ss.r.x, ss.r.y, ss.r.width, ss.r.height,
|
||||
d3d_tex2d);
|
||||
} else {
|
||||
dpy_gfx_replace_surface(
|
||||
g->parent_obj.scanout[ss.scanout_id].con, NULL);
|
||||
|
||||
+14
-11
@@ -131,18 +131,16 @@ struct QemuConsoleClass {
|
||||
ObjectClass parent_class;
|
||||
};
|
||||
|
||||
typedef uint32_t (* DisplayGLTextureBorrower)(uint32_t id, bool *y_0_top,
|
||||
uint32_t *width,
|
||||
uint32_t *height,
|
||||
void **d3d_tex2d);
|
||||
|
||||
typedef struct ScanoutTexture {
|
||||
uint32_t backing_id;
|
||||
DisplayGLTextureBorrower backing_borrow;
|
||||
bool backing_y_0_top;
|
||||
uint32_t backing_width;
|
||||
uint32_t backing_height;
|
||||
uint32_t x;
|
||||
uint32_t y;
|
||||
uint32_t width;
|
||||
uint32_t height;
|
||||
void *d3d_tex2d;
|
||||
} ScanoutTexture;
|
||||
|
||||
typedef struct QemuUIInfo {
|
||||
@@ -242,9 +240,12 @@ typedef struct DisplayChangeListenerOps {
|
||||
/* required if GL */
|
||||
void (*dpy_gl_scanout_texture)(DisplayChangeListener *dcl,
|
||||
uint32_t backing_id,
|
||||
DisplayGLTextureBorrower backing_borrow,
|
||||
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);
|
||||
uint32_t w, uint32_t h,
|
||||
void *d3d_tex2d);
|
||||
/* optional (default to true if has dpy_gl_scanout_dmabuf) */
|
||||
bool (*dpy_has_dmabuf)(DisplayChangeListener *dcl);
|
||||
/* optional */
|
||||
@@ -324,9 +325,11 @@ bool dpy_gfx_check_format(QemuConsole *con,
|
||||
pixman_format_code_t format);
|
||||
|
||||
void dpy_gl_scanout_disable(QemuConsole *con);
|
||||
void dpy_gl_scanout_texture(QemuConsole *con, uint32_t backing_id,
|
||||
DisplayGLTextureBorrower backing_borrow,
|
||||
uint32_t x, uint32_t y, uint32_t w, uint32_t h);
|
||||
void dpy_gl_scanout_texture(QemuConsole *con,
|
||||
uint32_t backing_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,
|
||||
void *d3d_tex2d);
|
||||
void dpy_gl_scanout_dmabuf(QemuConsole *con,
|
||||
QemuDmaBuf *dmabuf);
|
||||
void dpy_gl_cursor_dmabuf(QemuConsole *con, QemuDmaBuf *dmabuf,
|
||||
|
||||
+10
-4
@@ -171,9 +171,12 @@ QEMUGLContext gd_egl_create_context(DisplayGLCtx *dgc,
|
||||
void gd_egl_scanout_disable(DisplayChangeListener *dcl);
|
||||
void gd_egl_scanout_texture(DisplayChangeListener *dcl,
|
||||
uint32_t backing_id,
|
||||
DisplayGLTextureBorrower backing_borrow,
|
||||
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);
|
||||
uint32_t w, uint32_t h,
|
||||
void *d3d_tex2d);
|
||||
void gd_egl_scanout_dmabuf(DisplayChangeListener *dcl,
|
||||
QemuDmaBuf *dmabuf);
|
||||
void gd_egl_cursor_dmabuf(DisplayChangeListener *dcl,
|
||||
@@ -205,9 +208,12 @@ void gd_gl_area_scanout_dmabuf(DisplayChangeListener *dcl,
|
||||
QemuDmaBuf *dmabuf);
|
||||
void gd_gl_area_scanout_texture(DisplayChangeListener *dcl,
|
||||
uint32_t backing_id,
|
||||
DisplayGLTextureBorrower backing_borrow,
|
||||
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);
|
||||
uint32_t w, uint32_t h,
|
||||
void *d3d_tex2d);
|
||||
void gd_gl_area_scanout_disable(DisplayChangeListener *dcl);
|
||||
void gd_gl_area_scanout_flush(DisplayChangeListener *dcl,
|
||||
uint32_t x, uint32_t y, uint32_t w, uint32_t h);
|
||||
|
||||
+5
-2
@@ -88,9 +88,12 @@ int sdl2_gl_make_context_current(DisplayGLCtx *dgc,
|
||||
void sdl2_gl_scanout_disable(DisplayChangeListener *dcl);
|
||||
void sdl2_gl_scanout_texture(DisplayChangeListener *dcl,
|
||||
uint32_t backing_id,
|
||||
DisplayGLTextureBorrower backing_borrow,
|
||||
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);
|
||||
uint32_t w, uint32_t h,
|
||||
void *d3d_tex2d);
|
||||
void sdl2_gl_scanout_flush(DisplayChangeListener *dcl,
|
||||
uint32_t x, uint32_t y, uint32_t w, uint32_t h);
|
||||
|
||||
|
||||
@@ -141,8 +141,8 @@ struct SimpleSpiceDisplay {
|
||||
#if defined(CONFIG_ANGLE)
|
||||
EGLSurface esurface;
|
||||
egl_fb iosurface_fb;
|
||||
DisplayGLTextureBorrower backing_borrow;
|
||||
uint32_t backing_id;
|
||||
GLuint tex_id;
|
||||
bool y_0_top;
|
||||
#endif
|
||||
bool render_cursor;
|
||||
|
||||
|
||||
+17
-8
@@ -288,11 +288,14 @@ static void displaychangelistener_display_console(DisplayChangeListener *dcl,
|
||||
dcl->ops->dpy_gl_scanout_texture) {
|
||||
dcl->ops->dpy_gl_scanout_texture(dcl,
|
||||
con->scanout.texture.backing_id,
|
||||
con->scanout.texture.backing_borrow,
|
||||
con->scanout.texture.backing_y_0_top,
|
||||
con->scanout.texture.backing_width,
|
||||
con->scanout.texture.backing_height,
|
||||
con->scanout.texture.x,
|
||||
con->scanout.texture.y,
|
||||
con->scanout.texture.width,
|
||||
con->scanout.texture.height);
|
||||
con->scanout.texture.height,
|
||||
con->scanout.texture.d3d_tex2d);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1015,25 +1018,31 @@ void dpy_gl_scanout_disable(QemuConsole *con)
|
||||
|
||||
void dpy_gl_scanout_texture(QemuConsole *con,
|
||||
uint32_t backing_id,
|
||||
DisplayGLTextureBorrower backing_borrow,
|
||||
bool backing_y_0_top,
|
||||
uint32_t backing_width,
|
||||
uint32_t backing_height,
|
||||
uint32_t x, uint32_t y,
|
||||
uint32_t width, uint32_t height)
|
||||
uint32_t width, uint32_t height,
|
||||
void *d3d_tex2d)
|
||||
{
|
||||
DisplayState *s = con->ds;
|
||||
DisplayChangeListener *dcl;
|
||||
|
||||
con->scanout.kind = SCANOUT_TEXTURE;
|
||||
con->scanout.texture = (ScanoutTexture) {
|
||||
backing_id, backing_borrow,
|
||||
x, y, width, height
|
||||
backing_id, backing_y_0_top, backing_width, backing_height,
|
||||
x, y, width, height, d3d_tex2d,
|
||||
};
|
||||
QLIST_FOREACH(dcl, &s->listeners, next) {
|
||||
if (con != dcl->con) {
|
||||
continue;
|
||||
}
|
||||
if (dcl->ops->dpy_gl_scanout_texture) {
|
||||
dcl->ops->dpy_gl_scanout_texture(dcl, backing_id, backing_borrow,
|
||||
x, y, width, height);
|
||||
dcl->ops->dpy_gl_scanout_texture(dcl, backing_id,
|
||||
backing_y_0_top,
|
||||
backing_width, backing_height,
|
||||
x, y, width, height,
|
||||
d3d_tex2d);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+5
-2
@@ -94,9 +94,12 @@ dbus_gl_scanout_disable(DisplayChangeListener *dcl)
|
||||
static void
|
||||
dbus_gl_scanout_texture(DisplayChangeListener *dcl,
|
||||
uint32_t tex_id,
|
||||
DisplayGLTextureBorrower backing_borrow,
|
||||
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)
|
||||
uint32_t w, uint32_t h,
|
||||
void *d3d_tex2d)
|
||||
{
|
||||
DBusDisplayConsole *ddc = container_of(dcl, DBusDisplayConsole, dcl);
|
||||
|
||||
|
||||
+2
-21
@@ -491,7 +491,7 @@ static bool dbus_scanout_map(DBusDisplayListener *ddl)
|
||||
#endif /* WIN32 */
|
||||
|
||||
#ifdef CONFIG_OPENGL
|
||||
static void dbus_scanout_borrowed_texture(DisplayChangeListener *dcl,
|
||||
static void dbus_scanout_texture(DisplayChangeListener *dcl,
|
||||
uint32_t tex_id,
|
||||
bool backing_y_0_top,
|
||||
uint32_t backing_width,
|
||||
@@ -540,25 +540,6 @@ static void dbus_scanout_borrowed_texture(DisplayChangeListener *dcl,
|
||||
#endif
|
||||
}
|
||||
|
||||
static void dbus_scanout_texture(DisplayChangeListener *dcl,
|
||||
uint32_t backing_id,
|
||||
DisplayGLTextureBorrower backing_borrow,
|
||||
uint32_t x, uint32_t y,
|
||||
uint32_t w, uint32_t h)
|
||||
{
|
||||
bool backing_y_0_top;
|
||||
uint32_t backing_width;
|
||||
uint32_t backing_height;
|
||||
void *d3d_tex2d;
|
||||
uint32_t tex_id = backing_borrow(backing_id, &backing_y_0_top,
|
||||
&backing_width, &backing_height,
|
||||
&d3d_tex2d);
|
||||
|
||||
dbus_scanout_borrowed_texture(dcl, tex_id, backing_y_0_top,
|
||||
backing_width, backing_height,
|
||||
x, y, w, h, d3d_tex2d);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_GBM
|
||||
static void dbus_cursor_dmabuf(DisplayChangeListener *dcl,
|
||||
QemuDmaBuf *dmabuf, bool have_hot,
|
||||
@@ -798,7 +779,7 @@ static void dbus_gl_gfx_switch(DisplayChangeListener *dcl,
|
||||
int height = surface_height(ddl->ds);
|
||||
|
||||
/* TODO: lazy send dmabuf (there are unnecessary sent otherwise) */
|
||||
dbus_scanout_borrowed_texture(&ddl->dcl, ddl->ds->texture, false,
|
||||
dbus_scanout_texture(&ddl->dcl, ddl->ds->texture, false,
|
||||
width, height, 0, 0, width, height, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
+2
-21
@@ -63,7 +63,7 @@ static void egl_scanout_disable(DisplayChangeListener *dcl)
|
||||
egl_fb_destroy(&edpy->blit_fb);
|
||||
}
|
||||
|
||||
static void egl_scanout_imported_texture(DisplayChangeListener *dcl,
|
||||
static void egl_scanout_texture(DisplayChangeListener *dcl,
|
||||
uint32_t backing_id,
|
||||
bool backing_y_0_top,
|
||||
uint32_t backing_width,
|
||||
@@ -88,25 +88,6 @@ static void egl_scanout_imported_texture(DisplayChangeListener *dcl,
|
||||
}
|
||||
}
|
||||
|
||||
static void egl_scanout_texture(DisplayChangeListener *dcl,
|
||||
uint32_t backing_id,
|
||||
DisplayGLTextureBorrower backing_borrow,
|
||||
uint32_t x, uint32_t y,
|
||||
uint32_t w, uint32_t h)
|
||||
{
|
||||
bool backing_y_0_top;
|
||||
uint32_t backing_width;
|
||||
uint32_t backing_height;
|
||||
void *d3d_tex2d;
|
||||
|
||||
GLuint backing_texture = backing_borrow(backing_id, &backing_y_0_top,
|
||||
&backing_width, &backing_height,
|
||||
&d3d_tex2d);
|
||||
egl_scanout_imported_texture(dcl, backing_texture, backing_y_0_top,
|
||||
backing_width, backing_height,
|
||||
x, y, w, h, d3d_tex2d);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_GBM
|
||||
|
||||
static void egl_scanout_dmabuf(DisplayChangeListener *dcl,
|
||||
@@ -123,7 +104,7 @@ static void egl_scanout_dmabuf(DisplayChangeListener *dcl,
|
||||
width = qemu_dmabuf_get_width(dmabuf);
|
||||
height = qemu_dmabuf_get_height(dmabuf);
|
||||
|
||||
egl_scanout_imported_texture(dcl, texture, false, width, height, 0, 0,
|
||||
egl_scanout_texture(dcl, texture, false, width, height, 0, 0,
|
||||
width, height, NULL);
|
||||
}
|
||||
|
||||
|
||||
+5
-22
@@ -233,7 +233,7 @@ void gd_egl_scanout_disable(DisplayChangeListener *dcl)
|
||||
gtk_egl_set_scanout_mode(vc, false);
|
||||
}
|
||||
|
||||
void gd_egl_scanout_borrowed_texture(DisplayChangeListener *dcl,
|
||||
void gd_egl_scanout_texture(DisplayChangeListener *dcl,
|
||||
uint32_t backing_id, bool backing_y_0_top,
|
||||
uint32_t backing_width, uint32_t backing_height,
|
||||
uint32_t x, uint32_t y,
|
||||
@@ -263,25 +263,8 @@ void gd_egl_scanout_borrowed_texture(DisplayChangeListener *dcl,
|
||||
backing_id, false);
|
||||
}
|
||||
|
||||
void gd_egl_scanout_texture(DisplayChangeListener *dcl, uint32_t backing_id,
|
||||
DisplayGLTextureBorrower backing_borrow,
|
||||
uint32_t x, uint32_t y,
|
||||
uint32_t w, uint32_t h)
|
||||
{
|
||||
bool backing_y_0_top;
|
||||
uint32_t backing_width;
|
||||
uint32_t backing_height;
|
||||
void *d3d_tex2d;
|
||||
|
||||
GLuint backing_texture = backing_borrow(backing_id, &backing_y_0_top,
|
||||
&backing_width, &backing_height,
|
||||
&d3d_tex2d);
|
||||
gd_egl_scanout_borrowed_texture(dcl, backing_texture, backing_y_0_top,
|
||||
backing_width, backing_height,
|
||||
x, y, w, h, d3d_tex2d);
|
||||
}
|
||||
|
||||
void gd_egl_scanout_dmabuf(DisplayChangeListener *dcl, QemuDmaBuf *dmabuf)
|
||||
void gd_egl_scanout_dmabuf(DisplayChangeListener *dcl,
|
||||
QemuDmaBuf *dmabuf)
|
||||
{
|
||||
#ifdef CONFIG_GBM
|
||||
VirtualConsole *vc = container_of(dcl, VirtualConsole, gfx.dcl);
|
||||
@@ -305,8 +288,8 @@ void gd_egl_scanout_dmabuf(DisplayChangeListener *dcl, QemuDmaBuf *dmabuf)
|
||||
backing_height = qemu_dmabuf_get_backing_height(dmabuf);
|
||||
y0_top = qemu_dmabuf_get_y0_top(dmabuf);
|
||||
|
||||
gd_egl_scanout_borrowed_texture(dcl, texture, y0_top, backing_width,
|
||||
backing_height, x, y, width, height, NULL);
|
||||
gd_egl_scanout_texture(dcl, texture, y0_top, backing_width, backing_height,
|
||||
x, y, width, height, NULL);
|
||||
|
||||
if (qemu_dmabuf_get_allow_fences(dmabuf)) {
|
||||
vc->gfx.guest_fb.dmabuf = dmabuf;
|
||||
|
||||
+2
-22
@@ -248,7 +248,7 @@ void gd_gl_area_destroy_context(DisplayGLCtx *dgc, QEMUGLContext ctx)
|
||||
g_clear_object(&ctx);
|
||||
}
|
||||
|
||||
void gd_gl_area_scanout_borrowed_texture(DisplayChangeListener *dcl,
|
||||
void gd_gl_area_scanout_texture(DisplayChangeListener *dcl,
|
||||
uint32_t backing_id,
|
||||
bool backing_y_0_top,
|
||||
uint32_t backing_width,
|
||||
@@ -277,26 +277,6 @@ void gd_gl_area_scanout_borrowed_texture(DisplayChangeListener *dcl,
|
||||
backing_id, false);
|
||||
}
|
||||
|
||||
void gd_gl_area_scanout_texture(DisplayChangeListener *dcl,
|
||||
uint32_t backing_id,
|
||||
DisplayGLTextureBorrower backing_borrow,
|
||||
uint32_t x, uint32_t y,
|
||||
uint32_t w, uint32_t h)
|
||||
{
|
||||
bool backing_y_0_top;
|
||||
uint32_t backing_width;
|
||||
uint32_t backing_height;
|
||||
void *d3d_tex2d;
|
||||
|
||||
GLuint backing_texture = backing_borrow(backing_id, &backing_y_0_top,
|
||||
&backing_width, &backing_height,
|
||||
&d3d_tex2d);
|
||||
gd_gl_area_scanout_borrowed_texture(dcl, backing_texture,
|
||||
backing_y_0_top,
|
||||
backing_width, backing_height,
|
||||
x, y, w, h, d3d_tex2d);
|
||||
}
|
||||
|
||||
void gd_gl_area_scanout_disable(DisplayChangeListener *dcl)
|
||||
{
|
||||
VirtualConsole *vc = container_of(dcl, VirtualConsole, gfx.dcl);
|
||||
@@ -341,7 +321,7 @@ void gd_gl_area_scanout_dmabuf(DisplayChangeListener *dcl,
|
||||
backing_height = qemu_dmabuf_get_backing_height(dmabuf);
|
||||
y0_top = qemu_dmabuf_get_y0_top(dmabuf);
|
||||
|
||||
gd_gl_area_scanout_borrowed_texture(dcl, texture, y0_top,
|
||||
gd_gl_area_scanout_texture(dcl, texture, y0_top,
|
||||
backing_width, backing_height,
|
||||
x, y, width, height, NULL);
|
||||
|
||||
|
||||
+6
-11
@@ -201,22 +201,17 @@ void sdl2_gl_scanout_disable(DisplayChangeListener *dcl)
|
||||
|
||||
void sdl2_gl_scanout_texture(DisplayChangeListener *dcl,
|
||||
uint32_t backing_id,
|
||||
DisplayGLTextureBorrower backing_borrow,
|
||||
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)
|
||||
uint32_t w, uint32_t h,
|
||||
void *d3d_tex2d)
|
||||
{
|
||||
struct sdl2_console *scon = container_of(dcl, struct sdl2_console, dcl);
|
||||
bool backing_y_0_top;
|
||||
uint32_t backing_width;
|
||||
uint32_t backing_height;
|
||||
void *d3d_tex2d;
|
||||
|
||||
assert(scon->opengl);
|
||||
|
||||
GLuint backing_texture = backing_borrow(backing_id, &backing_y_0_top,
|
||||
&backing_width, &backing_height,
|
||||
&d3d_tex2d);
|
||||
|
||||
scon->x = x;
|
||||
scon->y = y;
|
||||
scon->w = w;
|
||||
@@ -227,7 +222,7 @@ void sdl2_gl_scanout_texture(DisplayChangeListener *dcl,
|
||||
|
||||
sdl2_set_scanout_mode(scon, true);
|
||||
egl_fb_setup_for_tex(&scon->guest_fb, backing_width, backing_height,
|
||||
backing_texture, false);
|
||||
backing_id, false);
|
||||
}
|
||||
|
||||
void sdl2_gl_scanout_flush(DisplayChangeListener *dcl,
|
||||
|
||||
+13
-21
@@ -1132,36 +1132,30 @@ static void qemu_spice_gl_scanout_disable(DisplayChangeListener *dcl)
|
||||
spice_iosurface_destroy(ssd);
|
||||
#endif
|
||||
#if defined(CONFIG_ANGLE)
|
||||
ssd->backing_borrow = NULL;
|
||||
ssd->backing_id = -1;
|
||||
ssd->tex_id = -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void qemu_spice_gl_scanout_texture(DisplayChangeListener *dcl,
|
||||
uint32_t backing_id,
|
||||
DisplayGLTextureBorrower backing_borrow,
|
||||
uint32_t tex_id,
|
||||
bool y_0_top,
|
||||
uint32_t backing_width,
|
||||
uint32_t backing_height,
|
||||
uint32_t x, uint32_t y,
|
||||
uint32_t w, uint32_t h)
|
||||
uint32_t w, uint32_t h,
|
||||
void *d3d_tex2d)
|
||||
{
|
||||
SimpleSpiceDisplay *ssd = container_of(dcl, SimpleSpiceDisplay, dcl);
|
||||
EGLint stride = 0, fourcc = 0;
|
||||
int fd = -1;
|
||||
bool y_0_top;
|
||||
uint32_t backing_width;
|
||||
uint32_t backing_height;
|
||||
void *d3d_tex2d;
|
||||
|
||||
GLuint tex_id = backing_borrow(backing_id, &y_0_top,
|
||||
&backing_width, &backing_height,
|
||||
&d3d_tex2d);
|
||||
assert(tex_id);
|
||||
#if defined(CONFIG_GBM)
|
||||
fd = egl_get_fd_for_texture(tex_id, &stride, &fourcc, NULL);
|
||||
#elif defined(CONFIG_IOSURFACE)
|
||||
if (spice_iosurface_resize(ssd, backing_width, backing_height)) {
|
||||
#if defined(CONFIG_ANGLE)
|
||||
ssd->backing_borrow = backing_borrow;
|
||||
ssd->backing_id = backing_id;
|
||||
ssd->tex_id = tex_id;
|
||||
ssd->y_0_top = y_0_top;
|
||||
#endif
|
||||
fd = spice_iosurface_create_fd(ssd, &fourcc);
|
||||
} else {
|
||||
@@ -1253,11 +1247,10 @@ static void qemu_spice_gl_update(DisplayChangeListener *dcl,
|
||||
EGLint stride = 0, fourcc = 0;
|
||||
int fd;
|
||||
bool render_cursor = false;
|
||||
uint32_t texture;
|
||||
#endif
|
||||
bool y_0_top = false; /* FIXME */
|
||||
uint64_t cookie;
|
||||
int fd;
|
||||
uint32_t width, height, texture;
|
||||
|
||||
if (!ssd->have_scanout) {
|
||||
return;
|
||||
@@ -1331,8 +1324,8 @@ static void qemu_spice_gl_update(DisplayChangeListener *dcl,
|
||||
glFlush();
|
||||
}
|
||||
#elif defined(CONFIG_ANGLE) && defined(CONFIG_IOSURFACE)
|
||||
GLuint tex_id = ssd->backing_borrow(ssd->backing_id, &y_0_top,
|
||||
NULL, NULL, NULL);
|
||||
GLuint tex_id = ssd->tex_id;
|
||||
y_0_top = ssd->y_0_top;
|
||||
spice_iosurface_blit(ssd, tex_id, !y_0_top, false);
|
||||
//TODO: cursor stuff
|
||||
#endif
|
||||
@@ -1403,8 +1396,7 @@ static void qemu_spice_display_init_one(QemuConsole *con)
|
||||
#endif
|
||||
#if defined(CONFIG_ANGLE)
|
||||
ssd->esurface = EGL_NO_SURFACE;
|
||||
ssd->backing_borrow = NULL;
|
||||
ssd->backing_id = -1;
|
||||
ssd->tex_id = -1;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user