From patchwork Wed Dec 7 13:13:23 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 9464451 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 6B64060236 for ; Wed, 7 Dec 2016 13:13:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 67355283E9 for ; Wed, 7 Dec 2016 13:13:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 59870284D0; Wed, 7 Dec 2016 13:13:27 +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_SIGNED, 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 B930B283E9 for ; Wed, 7 Dec 2016 13:13:26 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B402D6E563; Wed, 7 Dec 2016 13:13:23 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wm0-x244.google.com (mail-wm0-x244.google.com [IPv6:2a00:1450:400c:c09::244]) by gabe.freedesktop.org (Postfix) with ESMTPS id C4E126E563 for ; Wed, 7 Dec 2016 13:13:21 +0000 (UTC) Received: by mail-wm0-x244.google.com with SMTP id g23so27828890wme.1 for ; Wed, 07 Dec 2016 05:13:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Uq1FDEHaaIwMeuW3RSy+heXJJUH95G8GK0k/rSRBK1w=; b=SkieJ3QW1L7/tM2G6NgOh4xydwYpR3PhRBrFbAMqrXsWCvYSdX3yGUkXRKPEKCkn4N vzeNgQHfdlCv7gNyeMeqh1E8LVQz6wkgwd7v0eL9j+gltSWjt/5m9tovEcfF6H8xFBH1 lyFXzYQJ8PePjquQErhevsceyCfOYs7l++U5w= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Uq1FDEHaaIwMeuW3RSy+heXJJUH95G8GK0k/rSRBK1w=; b=LUNVbyqRyiF1Lr383B2Fnw3T2bWpoPpduPP/EipeGbstiT+mGbx17cy7nnvdKcRSBJ log32ADQLI87J95AoCrdb2jTGjh2yTCmC3N+u7N2FPaZ+de0ua6LF4dj0nDMvHu73PO/ DG1BN/kWNj7GjHlxMheJjtVsqha0bgqDTC7xizR7bCGu4jMseEoGt7JI5CI5beN24GhQ fVQN+8MttimZhunv5v6khmoLc5SdfcP5/u1LeqcYwStSiH9ZX0fQbasbCPK4shd4rF+3 ns2g4vhIRdRHugBnRxhjWaVtcImlmRCZqbe0Mk0eiI4UbqIOUb7F2x8Lf1CT4tIz6MEy v2Vg== X-Gm-Message-State: AKaTC03P3KPe3l3dgIXAHCuY77AAThb5N05ThD5WsDsfd1YohbfH49kAUVFQRMkB8x6lGQ== X-Received: by 10.28.107.77 with SMTP id g74mr2503476wmc.109.1481116400112; Wed, 07 Dec 2016 05:13:20 -0800 (PST) Received: from phenom.ffwll.local ([2a02:168:56b5:0:ac27:b86c:7764:9429]) by smtp.gmail.com with ESMTPSA id ab10sm31291566wjc.45.2016.12.07.05.13.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 07 Dec 2016 05:13:19 -0800 (PST) From: Daniel Vetter To: DRI Development Date: Wed, 7 Dec 2016 14:13:23 +0100 Message-Id: <20161207131323.12836-1-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.10.2 MIME-Version: 1.0 Cc: Daniel Vetter , Intel Graphics Development , =?UTF-8?q?Michel=20D=C3=A4nzer?= , Alex Deucher , Daniel Vetter Subject: [Intel-gfx] [PATCH] drm: Allow CAP_PRIME on !MODESET X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP vgem (and our igt tests using vgem) need this. I suspect etnaviv will fare similarly. Fixes: d5264ed3823a ("drm: Return -ENOTSUPP when called for KMS cap with a non-KMS driver") Cc: Michel Dänzer Cc: Alex Deucher Cc: Chris Wilson Signed-off-by: Daniel Vetter Signed-off-by: Daniel Vetter Reviewed-by: Chris Wilson --- drivers/gpu/drm/drm_ioctl.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c index 0a900bd4575d..60bf95644739 100644 --- a/drivers/gpu/drm/drm_ioctl.c +++ b/drivers/gpu/drm/drm_ioctl.c @@ -234,10 +234,15 @@ static int drm_getcap(struct drm_device *dev, void *data, struct drm_file *file_ req->value = 0; - /* Only one cap makes sense with a UMS driver: */ - if (req->capability == DRM_CAP_TIMESTAMP_MONOTONIC) { + /* Only some caps make sense with UMS/render-only drivers. */ + switch (req->capability) ) { + case DRM_CAP_TIMESTAMP_MONOTONIC: req->value = drm_timestamp_monotonic; return 0; + case DRM_CAP_PRIME: + req->value |= dev->driver->prime_fd_to_handle ? DRM_PRIME_CAP_IMPORT : 0; + req->value |= dev->driver->prime_handle_to_fd ? DRM_PRIME_CAP_EXPORT : 0; + return 0; } /* Other caps only work with KMS drivers */ @@ -258,10 +263,6 @@ static int drm_getcap(struct drm_device *dev, void *data, struct drm_file *file_ case DRM_CAP_DUMB_PREFER_SHADOW: req->value = dev->mode_config.prefer_shadow; break; - case DRM_CAP_PRIME: - req->value |= dev->driver->prime_fd_to_handle ? DRM_PRIME_CAP_IMPORT : 0; - req->value |= dev->driver->prime_handle_to_fd ? DRM_PRIME_CAP_EXPORT : 0; - break; case DRM_CAP_ASYNC_PAGE_FLIP: req->value = dev->mode_config.async_page_flip; break;