From patchwork Tue Nov 7 20:39:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lepton Wu X-Patchwork-Id: 10048101 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 E86E4603FA for ; Wed, 8 Nov 2017 09:35:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E17992847A for ; Wed, 8 Nov 2017 09:35:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D663529508; Wed, 8 Nov 2017 09:35:42 +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=-4.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9E25F2847A for ; Wed, 8 Nov 2017 09:35:42 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3B7CD6E630; Wed, 8 Nov 2017 09:35:20 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-io0-x244.google.com (mail-io0-x244.google.com [IPv6:2607:f8b0:4001:c06::244]) by gabe.freedesktop.org (Postfix) with ESMTPS id 675886E5E1 for ; Tue, 7 Nov 2017 20:39:43 +0000 (UTC) Received: by mail-io0-x244.google.com with SMTP id 134so3573674ioo.0 for ; Tue, 07 Nov 2017 12:39:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=tR4e21//4dhDAtaKiGgO1v6jp2WqyO39H6Dqsii4HOQ=; b=G1cEEQ5W5p8r3IsXOQgf6O4dhT/oagYotkeVX2pSBrjtyajpK6g40DSdw/Nt6BM83S 2DmwjO6VKzS9NiEoPMJE+Nev0+8qU0Vh/B7FfgJHKk+YdCPxuk6uCob+wLhNCiIX/T8S iS28+KLvYpcuAGOAuyHYhNVDsi6IVaaarfeqs1zTJJvnFd6h4soVp7HvVf/Ftv64DM7O +1HLAF7K1vUdKzjvK34ihkaj6Cfv6saXnqMjvCnBVgqdVBEpZWoCG7pBbn7bAynaApwa I+gUN3+E3R15BPkG75YLhVBzupyRfXHHSFaeoIsi4qUXwawVySpf4RFuaZc5UHQVLodn HUEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=tR4e21//4dhDAtaKiGgO1v6jp2WqyO39H6Dqsii4HOQ=; b=JyQApGtdAFo3RbdlYdcS30drJ0QZHDQNWX8Uxb4e5/6+ruyRbl6s6iNl/tqXS6QMLO JpK/MFx68s8vXHOoIs5BUgJVMDxsKdGLzkqVHu7zRqZzwVtzQ1KmdMhLklh/oUTFX5z8 ljhg/LNv9iQUFT+4T9dxJDheTcJpctlHe/tnxP9wsVmyOFyXxlAFybvNdLJKX8mTEBTU 0oJQCTYwKvLwBonwbwBDWXBH/S1PAoZeoLi9Sko6NTV2Qli7ZlmI5Mptl/7dMU4kSYNW 8GnPVZw8LwMogR3DwkgpW8HDnzyFT2QXNZ2udfFox+EfmfZxeik2HTzu2MCG9TdEijWU ZqAA== X-Gm-Message-State: AJaThX5Omp3AGJN0QglgLVmVy/4zIfMtG3m+3wBptAeT9SQZ8N3VSnm+ UtFTxN8rfbvbuLlC4n/ynHI= X-Google-Smtp-Source: AGs4zMZ91mQW3dn9c7zk70ABhroAeqcY2TZfx6QZ/hv+ZbXPezfUgjYOpgj+HM7MvvdaIykV0QkmZg== X-Received: by 10.107.53.25 with SMTP id c25mr25139ioa.222.1510087182495; Tue, 07 Nov 2017 12:39:42 -0800 (PST) Received: from paxos.mtv.corp.google.com ([2620:0:1000:1611:2907:842a:ad5c:bc94]) by smtp.gmail.com with ESMTPSA id 79sm1223980itu.7.2017.11.07.12.39.41 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 07 Nov 2017 12:39:41 -0800 (PST) From: Lepton Wu To: airlied@linux.ie, kraxel@redhat.com Subject: [PATCH] drm/cirrus drm/virtio: add create_handle support. Date: Tue, 7 Nov 2017 12:39:35 -0800 Message-Id: <20171107203935.159491-1-ytht.net@gmail.com> X-Mailer: git-send-email 2.15.0.403.gc27cc4dac6-goog X-Mailman-Approved-At: Wed, 08 Nov 2017 09:35:18 +0000 Cc: Lepton Wu , dri-devel@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Add create_handle support to cirrus and virtio fb which are used in virtual machines. Without this, screenshot tool in chromium OS can't work. Signed-off-by: Lepton Wu --- drivers/gpu/drm/cirrus/cirrus_main.c | 9 +++++++++ drivers/gpu/drm/virtio/virtgpu_display.c | 12 ++++++++++++ 2 files changed, 21 insertions(+) diff --git a/drivers/gpu/drm/cirrus/cirrus_main.c b/drivers/gpu/drm/cirrus/cirrus_main.c index b5f528543956..26df1e8cd490 100644 --- a/drivers/gpu/drm/cirrus/cirrus_main.c +++ b/drivers/gpu/drm/cirrus/cirrus_main.c @@ -13,6 +13,14 @@ #include "cirrus_drv.h" +static int cirrus_create_handle(struct drm_framebuffer *fb, + struct drm_file* file_priv, + unsigned int* handle) +{ + struct cirrus_framebuffer *cirrus_fb = to_cirrus_framebuffer(fb); + + return drm_gem_handle_create(file_priv, cirrus_fb->obj, handle); +} static void cirrus_user_framebuffer_destroy(struct drm_framebuffer *fb) { @@ -24,6 +32,7 @@ static void cirrus_user_framebuffer_destroy(struct drm_framebuffer *fb) } static const struct drm_framebuffer_funcs cirrus_fb_funcs = { + .create_handle = cirrus_create_handle, .destroy = cirrus_user_framebuffer_destroy, }; diff --git a/drivers/gpu/drm/virtio/virtgpu_display.c b/drivers/gpu/drm/virtio/virtgpu_display.c index b6d52055a11f..274b4206ca96 100644 --- a/drivers/gpu/drm/virtio/virtgpu_display.c +++ b/drivers/gpu/drm/virtio/virtgpu_display.c @@ -71,7 +71,19 @@ virtio_gpu_framebuffer_surface_dirty(struct drm_framebuffer *fb, return virtio_gpu_surface_dirty(virtio_gpu_fb, clips, num_clips); } +static int +virtio_gpu_framebuffer_create_handle(struct drm_framebuffer *fb, + struct drm_file *file_priv, + unsigned int *handle) +{ + struct virtio_gpu_framebuffer *virtio_gpu_fb = + to_virtio_gpu_framebuffer(fb); + + return drm_gem_handle_create(file_priv, virtio_gpu_fb->obj, handle); +} + static const struct drm_framebuffer_funcs virtio_gpu_fb_funcs = { + .create_handle = virtio_gpu_framebuffer_create_handle, .destroy = virtio_gpu_user_framebuffer_destroy, .dirty = virtio_gpu_framebuffer_surface_dirty, };