From patchwork Tue May 8 04:52:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ezequiel Garcia X-Patchwork-Id: 10385473 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 C26856037F for ; Tue, 8 May 2018 07:11:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B0C8328CD2 for ; Tue, 8 May 2018 07:11:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A5A8328D04; Tue, 8 May 2018 07:11:30 +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=-5.2 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY 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 5960628CD6 for ; Tue, 8 May 2018 07:11:30 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0F8AE6E5BD; Tue, 8 May 2018 07:10:51 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3]) by gabe.freedesktop.org (Postfix) with ESMTPS id F15C06E0A1 for ; Tue, 8 May 2018 04:54:31 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: ezequiel) with ESMTPSA id 826B6263952 From: Ezequiel Garcia To: Gustavo Padovan , Maarten Lankhorst , Sean Paul Subject: [PATCH v2] drm: Allow CAP_DUMB_BUFFERS on !MODESET Date: Tue, 8 May 2018 01:52:01 -0300 Message-Id: <20180508045201.17677-1-ezequiel@collabora.com> X-Mailer: git-send-email 2.16.3 In-Reply-To: <20180504142547.12930-1-ezequiel@collabora.com> References: <20180504142547.12930-1-ezequiel@collabora.com> X-Mailman-Approved-At: Tue, 08 May 2018 07:10:43 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kernel@collabora.com, Ezequiel Garcia , dri-devel@lists.freedesktop.org MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP It's perfectly possible to get dumb buffers out of drivers that don't support modeset. This is the case of vgem, which can be used to export dmabuf to run various tests. Inspired by commit f3f4c4d68a28 ("drm: Allow CAP_PRIME on !MODESET"). Fixes: d5264ed3823a ("drm: Return -ENOTSUPP when called for KMS cap with a non-KMS driver") Signed-off-by: Ezequiel Garcia --- Changes from v1: * Drop the bitwise-OR assignment op drivers/gpu/drm/drm_ioctl.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c index af782911c505..a5b879ce8f2c 100644 --- a/drivers/gpu/drm/drm_ioctl.c +++ b/drivers/gpu/drm/drm_ioctl.c @@ -244,6 +244,9 @@ static int drm_getcap(struct drm_device *dev, void *data, struct drm_file *file_ case DRM_CAP_SYNCOBJ: req->value = drm_core_check_feature(dev, DRIVER_SYNCOBJ); return 0; + case DRM_CAP_DUMB_BUFFER: + req->value = dev->driver->dumb_create ? 1 : 0; + return 0; } /* Other caps only work with KMS drivers */ @@ -251,10 +254,6 @@ static int drm_getcap(struct drm_device *dev, void *data, struct drm_file *file_ return -ENOTSUPP; switch (req->capability) { - case DRM_CAP_DUMB_BUFFER: - if (dev->driver->dumb_create) - req->value = 1; - break; case DRM_CAP_VBLANK_HIGH_CRTC: req->value = 1; break;