dcc: use multi plane gl scanout message when possible

Signed-off-by: Qiang Yu <yuq825@gmail.com>
Acked-by: Frediano Ziglio <freddy77@gmail.com>
This commit is contained in:
Qiang Yu 2025-03-22 10:48:00 +08:00 committed by Frediano Ziglio
parent e89c37a1da
commit 4f94e844d7
5 changed files with 35 additions and 13 deletions

View File

@ -152,7 +152,7 @@ AM_CONDITIONAL(HAVE_SASL, test "x$have_sasl" = "xyes")
dnl =========================================================================
dnl Check deps
m4_define([SPICE_PROTOCOL_MIN_VER],[0.14.3])
m4_define([SPICE_PROTOCOL_MIN_VER],[0.14.5])
m4_include([subprojects/spice-common/m4/common.m4])
LT_LIB_M

View File

@ -52,7 +52,7 @@ spice_server_include = [include_directories('.')]
spice_server_deps = [dependency('threads')]
spice_server_link_args = []
spice_server_requires = ''
spice_protocol_version='0.14.3'
spice_protocol_version='0.14.5'
#
# Spice common subproject

View File

@ -2380,19 +2380,41 @@ static void marshall_gl_scanout(DisplayChannelClient *dcc,
RedGLScanout *scanout = red_qxl_get_gl_scanout(qxl);
if (scanout != nullptr) {
if (scanout->num_planes <= 1) {
SpiceMsgDisplayGlScanoutUnix msg;
msg.drm_dma_buf_fd = scanout->fd[0];
if (dcc->test_remote_cap(SPICE_DISPLAY_CAP_GL_SCANOUT2)) {
struct : SpiceMsgDisplayGlScanout2Unix {
SpiceGlPlaneUnix _pad_planes[4];
} msg;
msg.width = scanout->width;
msg.height = scanout->height;
msg.stride = scanout->stride[0];
msg.drm_fourcc_format = scanout->fourcc;
msg.fourcc = scanout->fourcc;
msg.flags = scanout->flags;
msg.modifier = scanout->modifier;
msg.num_planes = scanout->num_planes;
dcc->init_send_data(SPICE_MSG_DISPLAY_GL_SCANOUT_UNIX);
spice_marshall_msg_display_gl_scanout_unix(m, &msg);
for (int i = 0; i < scanout->num_planes; i++) {
msg.planes[i].fd = scanout->fd[i];
msg.planes[i].offset = scanout->offset[i];
msg.planes[i].stride = scanout->stride[i];
}
dcc->init_send_data(SPICE_MSG_DISPLAY_GL_SCANOUT2_UNIX);
spice_marshall_msg_display_gl_scanout2_unix(m, &msg);
} else {
spice_error("gl scanout does not support multi plane");
if (scanout->num_planes <= 1) {
SpiceMsgDisplayGlScanoutUnix msg;
msg.drm_dma_buf_fd = scanout->fd[0];
msg.width = scanout->width;
msg.height = scanout->height;
msg.stride = scanout->stride[0];
msg.drm_fourcc_format = scanout->fourcc;
msg.flags = scanout->flags;
dcc->init_send_data(SPICE_MSG_DISPLAY_GL_SCANOUT_UNIX);
spice_marshall_msg_display_gl_scanout_unix(m, &msg);
} else {
spice_warning("gl scanout client does not support multi plane");
}
}
}
red_qxl_put_gl_scanout(qxl, scanout);

View File

@ -417,8 +417,7 @@ void dcc_start(DisplayChannelClient *dcc)
dcc_create_all_streams(dcc);
}
if (red_stream_is_plain_unix(dcc->get_stream()) &&
dcc->test_remote_cap(SPICE_DISPLAY_CAP_GL_SCANOUT)) {
if (dcc->is_gl_client()) {
dcc->pipe_add(dcc_gl_scanout_item_new(dcc, nullptr, 0));
dcc_push_monitors_config(dcc);
}

View File

@ -50,7 +50,8 @@ public:
bool is_gl_client()
{
return red_stream_is_plain_unix(get_stream()) &&
test_remote_cap(SPICE_DISPLAY_CAP_GL_SCANOUT);
(test_remote_cap(SPICE_DISPLAY_CAP_GL_SCANOUT) ||
test_remote_cap(SPICE_DISPLAY_CAP_GL_SCANOUT2));
}
protected: