From patchwork Tue Jun 14 13:44:09 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Patchwork-Id: 9175857 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9931360772 for ; Tue, 14 Jun 2016 13:50:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 897962793B for ; Tue, 14 Jun 2016 13:50:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7E11328047; Tue, 14 Jun 2016 13:50:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id DAB9D2793B for ; Tue, 14 Jun 2016 13:50:00 +0000 (UTC) Received: from localhost ([::1]:35401 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bCoj8-00051Y-VA for patchwork-qemu-devel@patchwork.kernel.org; Tue, 14 Jun 2016 09:49:59 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33995) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bCodj-0007xz-KK for qemu-devel@nongnu.org; Tue, 14 Jun 2016 09:44:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bCodd-0000Cr-8q for qemu-devel@nongnu.org; Tue, 14 Jun 2016 09:44:23 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48337) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bCodd-0000Cd-0J for qemu-devel@nongnu.org; Tue, 14 Jun 2016 09:44:17 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 92D6D3B717 for ; Tue, 14 Jun 2016 13:44:16 +0000 (UTC) Received: from localhost (ovpn-116-80.phx2.redhat.com [10.3.116.80]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u5EDiFTa011681; Tue, 14 Jun 2016 09:44:16 -0400 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Date: Tue, 14 Jun 2016 15:44:09 +0200 Message-Id: <1465911849-30423-4-git-send-email-marcandre.lureau@redhat.com> In-Reply-To: <1465911849-30423-1-git-send-email-marcandre.lureau@redhat.com> References: <1465911849-30423-1-git-send-email-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Tue, 14 Jun 2016 13:44:16 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 3/3] virgl: pass whole GL scanout dimensions X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , kraxel@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Marc-André Lureau Spice client needs the whole GL texture dimension to be able to show a scanout with a monitor offset (different than +0+0). Furthermore, this fixes a crash when calling surface_{width,height}() after dpy_gfx_replace_surface(con, NULL) was called in virgl_cmd_set_scanout() Signed-off-by: Marc-André Lureau --- hw/display/virtio-gpu-3d.c | 5 +++-- include/ui/console.h | 2 ++ include/ui/gtk.h | 1 + include/ui/sdl2.h | 1 + ui/console.c | 2 ++ ui/gtk-egl.c | 1 + ui/sdl2-gl.c | 1 + ui/spice-display.c | 6 +++--- 8 files changed, 14 insertions(+), 5 deletions(-) diff --git a/hw/display/virtio-gpu-3d.c b/hw/display/virtio-gpu-3d.c index 29918a0..d6c8c6e 100644 --- a/hw/display/virtio-gpu-3d.c +++ b/hw/display/virtio-gpu-3d.c @@ -171,13 +171,14 @@ static void virgl_cmd_set_scanout(VirtIOGPU *g, virgl_renderer_force_ctx_0(); dpy_gl_scanout(g->scanout[ss.scanout_id].con, info.tex_id, info.flags & 1 /* FIXME: Y_0_TOP */, + info.width, info.height, ss.r.x, ss.r.y, ss.r.width, ss.r.height); } else { if (ss.scanout_id != 0) { dpy_gfx_replace_surface(g->scanout[ss.scanout_id].con, NULL); } dpy_gl_scanout(g->scanout[ss.scanout_id].con, 0, false, - 0, 0, 0, 0); + 0, 0, 0, 0, 0, 0); } g->scanout[ss.scanout_id].resource_id = ss.resource_id; } @@ -580,7 +581,7 @@ void virtio_gpu_virgl_reset(VirtIOGPU *g) if (i != 0) { dpy_gfx_replace_surface(g->scanout[i].con, NULL); } - dpy_gl_scanout(g->scanout[i].con, 0, false, 0, 0, 0, 0); + dpy_gl_scanout(g->scanout[i].con, 0, false, 0, 0, 0, 0, 0, 0); } } diff --git a/include/ui/console.h b/include/ui/console.h index 52a5f65..c2d75ff 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -217,6 +217,7 @@ typedef struct DisplayChangeListenerOps { void (*dpy_gl_scanout)(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, uint32_t w, uint32_t h); void (*dpy_gl_update)(DisplayChangeListener *dcl, uint32_t x, uint32_t y, uint32_t w, uint32_t h); @@ -285,6 +286,7 @@ bool dpy_gfx_check_format(QemuConsole *con, void dpy_gl_scanout(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 dpy_gl_update(QemuConsole *con, uint32_t x, uint32_t y, uint32_t w, uint32_t h); diff --git a/include/ui/gtk.h b/include/ui/gtk.h index 2bf60f3..a764404 100644 --- a/include/ui/gtk.h +++ b/include/ui/gtk.h @@ -101,6 +101,7 @@ QEMUGLContext gd_egl_create_context(DisplayChangeListener *dcl, QEMUGLParams *params); void gd_egl_scanout(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, uint32_t w, uint32_t h); void gd_egl_scanout_flush(DisplayChangeListener *dcl, diff --git a/include/ui/sdl2.h b/include/ui/sdl2.h index 3f0b57b..683bb6a 100644 --- a/include/ui/sdl2.h +++ b/include/ui/sdl2.h @@ -64,6 +64,7 @@ QEMUGLContext sdl2_gl_get_current_context(DisplayChangeListener *dcl); void sdl2_gl_scanout(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, uint32_t w, uint32_t h); void sdl2_gl_scanout_flush(DisplayChangeListener *dcl, diff --git a/ui/console.c b/ui/console.c index ce1e105..c24bfe4 100644 --- a/ui/console.c +++ b/ui/console.c @@ -1709,11 +1709,13 @@ QEMUGLContext dpy_gl_ctx_get_current(QemuConsole *con) void dpy_gl_scanout(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 width, uint32_t height) { assert(con->gl); con->gl->ops->dpy_gl_scanout(con->gl, backing_id, backing_y_0_top, + backing_width, backing_height, x, y, width, height); } diff --git a/ui/gtk-egl.c b/ui/gtk-egl.c index 431457c..3f5d328 100644 --- a/ui/gtk-egl.c +++ b/ui/gtk-egl.c @@ -172,6 +172,7 @@ QEMUGLContext gd_egl_create_context(DisplayChangeListener *dcl, void gd_egl_scanout(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, uint32_t w, uint32_t h) { diff --git a/ui/sdl2-gl.c b/ui/sdl2-gl.c index a324eca..039645d 100644 --- a/ui/sdl2-gl.c +++ b/ui/sdl2-gl.c @@ -186,6 +186,7 @@ QEMUGLContext sdl2_gl_get_current_context(DisplayChangeListener *dcl) void sdl2_gl_scanout(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, uint32_t w, uint32_t h) { diff --git a/ui/spice-display.c b/ui/spice-display.c index 142c941..b511ff6 100644 --- a/ui/spice-display.c +++ b/ui/spice-display.c @@ -857,6 +857,8 @@ static QEMUGLContext qemu_spice_gl_create_context(DisplayChangeListener *dcl, static void qemu_spice_gl_scanout(DisplayChangeListener *dcl, 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) { @@ -879,9 +881,7 @@ static void qemu_spice_gl_scanout(DisplayChangeListener *dcl, assert(!tex_id || fd >= 0); /* note: spice server will close the fd */ - spice_qxl_gl_scanout(&ssd->qxl, fd, - surface_width(ssd->ds), - surface_height(ssd->ds), + spice_qxl_gl_scanout(&ssd->qxl, fd, backing_width, backing_height, stride, fourcc, y_0_top); qemu_spice_gl_monitor_config(ssd, x, y, w, h);