Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp6706453imm; Tue, 24 Jul 2018 01:23:32 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcpA9OKbcTCy3KziHHYueTayCgmb7sxHmyES2vV8FbCJ4QpZypA2le1SHDCiQzmp4WwY8aj X-Received: by 2002:a63:710d:: with SMTP id m13-v6mr15326774pgc.66.1532420612724; Tue, 24 Jul 2018 01:23:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532420612; cv=none; d=google.com; s=arc-20160816; b=ICY5wg+0zTYB1iEwBkUyRaNpQujF/PNup0ZHw7LdpqiFWYzMmIhdenbcHi5SeyEX0v sK+cExaLH3yv5e4RqqFEYPJjN6hbvq/2vH3fUmiqxSmPPGuMPnm3rsgstBjNubf6aKjR VYASCXVaA7+23JFeN3MuEx+BSuLAaWx9DuO2POXsYfADHIDGySEp41DHVXGc6jbHT682 FOeSimuglrSwYGThrjB36Oq8+TgziK+7hVEN1EwRE4W3HakRJOYHRC4K7lV5cA3F3kz2 60mUu7brQFd9ao3pZP0fBAJnbpbgL8i+D81ey+td1uYE0lITCgvDlnBPhGFTZL34H8Fi Mk4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=9E8+FnnLoFglbvDxoOE0OEE9Yz/Zqme24vhwEd0spz0=; b=Vj5bt3vi5MRLRN1u5BIaEqrcK6sUMd3kbcEAM+j9dpuaQRZD88jIx1x5gfkzLwBGvn JAIQDn6Y/+D/x+PWmjbCkh7D85quHDURiYywubcjdrpCTodLeOdEnZTbyVWKuzwNaLPs U0lAodwEuYeQYwCn4CWPqD44Iy5CDffMPK++fLn7+I63rf8ss4XNDlGdGSPsFFLaVFdG hYYJynh2qqp0FUfrs3l5F8p5eDz6ZV/afJm03a6syde+CB6UWqjmlBXy3rv8utYzpFhI ShlHloNqQRVJxeg++wVQU/f07qysHOB+JCBtYHTMbdrU6GThIVhx6KBVleB8OMgPMhLH AGWQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z21-v6si10842272pgn.365.2018.07.24.01.23.17; Tue, 24 Jul 2018 01:23:32 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388610AbeGXJ1r (ORCPT + 99 others); Tue, 24 Jul 2018 05:27:47 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:58710 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388461AbeGXJ1r (ORCPT ); Tue, 24 Jul 2018 05:27:47 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: robertfoss) with ESMTPSA id CBC3626B847 From: Robert Foss To: gustavo@padovan.org, maarten.lankhorst@linux.intel.com, seanpaul@chromium.org, airlied@linux.ie, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Emil Velikov , Tomasz Figa , Rob Herring , Eric Engestrom , Brian Paul Cc: Tomeu Vizoso , Nicolas Norvez , Robert Foss Subject: [RFC] drm: Allow DRM_IOCTL_MODE_MAP_DUMB for render nodes Date: Tue, 24 Jul 2018 10:22:13 +0200 Message-Id: <20180724082213.25677-1-robert.foss@collabora.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Tomasz Figa There is no particular reason to prevent userspace for using this IOCTL, considering that it already has access to other, platform-specific IOCTLs. This patch makes is possible to have the same userspace code work regardless on the underlying platform, which significantly simplifies the stack. Signed-off-by: Tomasz Figa Reviewed-by: Zach Reizner Signed-off-by: Nicolas Norvez Reviewed-by: Tomasz Figa Signed-off-by: Robert Foss --- I've been looking into enabling a kms_swrast based driver for mesa on the Android platform[1]. But have come up against the issue of dumb buffer related ioctls below not being flagged with DRM_RENDER_ALLOW. DRM_IOCTL_MODE_CREATE_DUMB DRM_IOCTL_MODE_MAP_DUMB To be more precise, I've been seeing a failure due to DRM_IOCTL_MODE_MAP_DUMB not being allowed for /dev/dri/renderD* nodes, and used in mesa kms_sw_displaytarget_map(). As I understand it the DRM_RENDER_ALLOW flag being unset is a very intentional restriction placed on dumb buffers in order to minimize its use. But as far as alternative solutions for software renderers there seems to only be VGEM and mmap()-ing DMABUFs. While it would be convenient from the point of view of software renderers if dumb buffers had more promiscuous permissions, it may be a hard sell upstream. If dumb buffers aren't the way forward, what is? VGEM? Or are there any other preferable ways? [1] https://patchwork.freedesktop.org/series/45966/ drivers/gpu/drm/drm_ioctl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c index 0d4cfb232576..ef716246baf6 100644 --- a/drivers/gpu/drm/drm_ioctl.c +++ b/drivers/gpu/drm/drm_ioctl.c @@ -642,8 +642,8 @@ static const struct drm_ioctl_desc drm_ioctls[] = { DRM_IOCTL_DEF(DRM_IOCTL_MODE_RMFB, drm_mode_rmfb, DRM_UNLOCKED), DRM_IOCTL_DEF(DRM_IOCTL_MODE_PAGE_FLIP, drm_mode_page_flip_ioctl, DRM_MASTER|DRM_UNLOCKED), DRM_IOCTL_DEF(DRM_IOCTL_MODE_DIRTYFB, drm_mode_dirtyfb_ioctl, DRM_MASTER|DRM_UNLOCKED), - DRM_IOCTL_DEF(DRM_IOCTL_MODE_CREATE_DUMB, drm_mode_create_dumb_ioctl, DRM_UNLOCKED), - DRM_IOCTL_DEF(DRM_IOCTL_MODE_MAP_DUMB, drm_mode_mmap_dumb_ioctl, DRM_UNLOCKED), + DRM_IOCTL_DEF(DRM_IOCTL_MODE_CREATE_DUMB, drm_mode_create_dumb_ioctl, DRM_UNLOCKED|DRM_RENDER_ALLOW), + DRM_IOCTL_DEF(DRM_IOCTL_MODE_MAP_DUMB, drm_mode_mmap_dumb_ioctl, DRM_UNLOCKED|DRM_RENDER_ALLOW), DRM_IOCTL_DEF(DRM_IOCTL_MODE_DESTROY_DUMB, drm_mode_destroy_dumb_ioctl, DRM_UNLOCKED), DRM_IOCTL_DEF(DRM_IOCTL_MODE_OBJ_GETPROPERTIES, drm_mode_obj_get_properties_ioctl, DRM_UNLOCKED), DRM_IOCTL_DEF(DRM_IOCTL_MODE_OBJ_SETPROPERTY, drm_mode_obj_set_property_ioctl, DRM_MASTER|DRM_UNLOCKED), -- 2.17.1