From patchwork Sat Jun 4 21:33:20 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: 9154977 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 0FE8C60574 for ; Sat, 4 Jun 2016 21:39:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 01A5027BFA for ; Sat, 4 Jun 2016 21:39:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E95412824A; Sat, 4 Jun 2016 21:39:22 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 7176527BFA for ; Sat, 4 Jun 2016 21:39:22 +0000 (UTC) Received: from localhost ([::1]:34221 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b9JHt-0002N5-2d for patchwork-qemu-devel@patchwork.kernel.org; Sat, 04 Jun 2016 17:39:21 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44802) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b9JCe-0006Bw-Gh for qemu-devel@nongnu.org; Sat, 04 Jun 2016 17:33:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b9JCc-0005vI-DQ for qemu-devel@nongnu.org; Sat, 04 Jun 2016 17:33:55 -0400 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]:36184) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b9JCc-0005vB-3j for qemu-devel@nongnu.org; Sat, 04 Jun 2016 17:33:54 -0400 Received: by mail-wm0-x241.google.com with SMTP id m124so6198562wme.3 for ; Sat, 04 Jun 2016 14:33:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8qZXAPjqQGjyhExPXm4sU5vn5Mj7TaWWAdQTyKIMB00=; b=FcSJW/AhJi52dBvq9uGr5wHP+9fYBRKc6/A964mwMqX88HQbM1uFsIhVp2gs50KaHt NJUKL2s22Q3T61yJhCG1xeVOaKcBTVPxFeZIBK+A9H9ERfeEUbb5azvE4U6HEbzMCgdI LqMzgHcyUOOwnA1/jY2pJEWZw/UGP2E2L7ZLSJzDyJVxuGuC2XSC2+RdqBwyowA+0IT2 oYtA3mJy46N8P5wizKzN+/fl7r/bSgwtZVGEN6wUoC4XsHM5wu+vwWRD7KluS2jN5Kj8 hGjrtoG3BIBRJ56YhrWZq7vePBUR7zi4vuVPmyNh7rhtxNZ6MlkdkbR6vwTMtBP0xUXt dfnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=8qZXAPjqQGjyhExPXm4sU5vn5Mj7TaWWAdQTyKIMB00=; b=SDIWSeDDyMRJTIns+pSmb0Dj2p+PIdoE+EgYqIus3PMmUE3hZKh6OdtiAk7kBT9+E6 WjcPdHVneDFyEqoU7Kptsp6O8uErIsVOULx7E29MhhzlE+YCJKGAzSVG39axAqZmvYCg uckce0+3pVDeh3g6AAC7ZfdJAyA+YM4Tw7RP7G7uRBHtFljWOt+zBsQeYdg2FgJ2o4kp L0YrkM2ZlheoAdcvlHDJC/p0j03Xt5nhxR8jGVCrN02liQnUnYE0JCmYrn2KTu0sqeyz z0y7MJSnEGOvkAryqMYvq3azXKJWkO3GuVp4nHT/rVpPt3O7q/mblwOdWutIqtFyE6Ww WzsQ== X-Gm-Message-State: ALyK8tIzBg7O16YIEeXwRAEezK3cHhD/qhmdp4C8aeCL1qYneRjnrOJNqSsbURUGHFffUw== X-Received: by 10.194.153.65 with SMTP id ve1mr8852434wjb.106.1465076033164; Sat, 04 Jun 2016 14:33:53 -0700 (PDT) Received: from localhost (APoitiers-110-1-1-235.w193-248.abo.wanadoo.fr. [193.248.103.235]) by smtp.gmail.com with ESMTPSA id v5sm12331267wjv.36.2016.06.04.14.33.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 04 Jun 2016 14:33:52 -0700 (PDT) From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Date: Sat, 4 Jun 2016 23:33:20 +0200 Message-Id: <1465076003-26291-12-git-send-email-marcandre.lureau@redhat.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1465076003-26291-1-git-send-email-marcandre.lureau@redhat.com> References: <1465076003-26291-1-git-send-email-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::241 Subject: [Qemu-devel] [RFC 11/14] console: add dpy_gl_scanout2() 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 Add a new scanout callback that doesn't require any gl context in qemu (importing a dmabuf fd would require qemu egl&gl contexts, and would be unnecessary when using spice anyway) Signed-off-by: Marc-André Lureau --- include/ui/console.h | 10 ++++++++++ ui/console.c | 12 ++++++++++++ ui/spice-display.c | 19 +++++++++++++++++++ 3 files changed, 41 insertions(+) diff --git a/include/ui/console.h b/include/ui/console.h index 52a5f65..14fd5ad 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -218,6 +218,11 @@ typedef struct DisplayChangeListenerOps { void (*dpy_gl_scanout)(DisplayChangeListener *dcl, uint32_t backing_id, bool backing_y_0_top, uint32_t x, uint32_t y, uint32_t w, uint32_t h); + void (*dpy_gl_scanout2)(DisplayChangeListener *dcl, + int fd, bool backing_y_0_top, + uint32_t x, uint32_t y, uint32_t w, uint32_t h, + uint32_t fd_w, uint32_t fd_h, uint32_t fd_stride, + int fd_fourcc); void (*dpy_gl_update)(DisplayChangeListener *dcl, uint32_t x, uint32_t y, uint32_t w, uint32_t h); @@ -286,6 +291,11 @@ bool dpy_gfx_check_format(QemuConsole *con, void dpy_gl_scanout(QemuConsole *con, uint32_t backing_id, bool backing_y_0_top, uint32_t x, uint32_t y, uint32_t w, uint32_t h); +void dpy_gl_scanout2(QemuConsole *con, + int fd, bool backing_y_0_top, + uint32_t x, uint32_t y, uint32_t w, uint32_t h, + uint32_t fd_w, uint32_t fd_h, uint32_t fd_stride, + int fd_fourcc); void dpy_gl_update(QemuConsole *con, uint32_t x, uint32_t y, uint32_t w, uint32_t h); diff --git a/ui/console.c b/ui/console.c index bf38579..c36f742 100644 --- a/ui/console.c +++ b/ui/console.c @@ -1712,6 +1712,18 @@ void dpy_gl_scanout(QemuConsole *con, x, y, width, height); } +void dpy_gl_scanout2(QemuConsole *con, + int fd, bool backing_y_0_top, + uint32_t x, uint32_t y, uint32_t w, uint32_t h, + uint32_t fd_w, uint32_t fd_h, uint32_t fd_stride, + int fd_fourcc) +{ + assert(con->gl); + con->gl->ops->dpy_gl_scanout2(con->gl, fd, backing_y_0_top, + x, y, w, h, fd_w, fd_h, fd_stride, + fd_fourcc); +} + void dpy_gl_update(QemuConsole *con, 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 0553c5e..06d2e4e 100644 --- a/ui/spice-display.c +++ b/ui/spice-display.c @@ -888,6 +888,24 @@ static void qemu_spice_gl_scanout(DisplayChangeListener *dcl, qemu_spice_gl_monitor_config(ssd, x, y, w, h); } +static void +qemu_spice_gl_scanout2(DisplayChangeListener *dcl, + int fd, bool y_0_top, + uint32_t x, uint32_t y, uint32_t w, uint32_t h, + uint32_t fd_w, uint32_t fd_h, uint32_t fd_stride, + int fd_fourcc) +{ + SimpleSpiceDisplay *ssd = container_of(dcl, SimpleSpiceDisplay, dcl); + + /* note: spice server will close the fd */ + spice_qxl_gl_scanout(&ssd->qxl, fd, + fd_w, + fd_h, + fd_stride, fd_fourcc, y_0_top); + + qemu_spice_gl_monitor_config(ssd, x, y, w, h); +} + static void qemu_spice_gl_update(DisplayChangeListener *dcl, uint32_t x, uint32_t y, uint32_t w, uint32_t h) { @@ -915,6 +933,7 @@ static const DisplayChangeListenerOps display_listener_gl_ops = { .dpy_gl_ctx_get_current = qemu_egl_get_current_context, .dpy_gl_scanout = qemu_spice_gl_scanout, + .dpy_gl_scanout2 = qemu_spice_gl_scanout2, .dpy_gl_update = qemu_spice_gl_update, };