linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC] drm: Allow DRM_IOCTL_MODE_MAP_DUMB for render nodes
@ 2018-07-24  8:22 Robert Foss
  2018-08-01 14:24 ` Martin Fuzzey
  2018-08-03 12:25 ` Emil Velikov
  0 siblings, 2 replies; 12+ messages in thread
From: Robert Foss @ 2018-07-24  8:22 UTC (permalink / raw)
  To: gustavo, maarten.lankhorst, seanpaul, airlied, dri-devel,
	linux-kernel, Emil Velikov, Tomasz Figa, Rob Herring,
	Eric Engestrom, Brian Paul
  Cc: Tomeu Vizoso, Nicolas Norvez, Robert Foss

From: Tomasz Figa <tfiga@chromium.org>

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 <tfiga@chromium.org>
Reviewed-by: Zach Reizner <zachr@chromium.org>
Signed-off-by: Nicolas Norvez <norvez@chromium.org>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Signed-off-by: Robert Foss <robert.foss@collabora.com>
---

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


^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2018-08-07 13:26 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-24  8:22 [RFC] drm: Allow DRM_IOCTL_MODE_MAP_DUMB for render nodes Robert Foss
2018-08-01 14:24 ` Martin Fuzzey
2018-08-03 12:35   ` Emil Velikov
2018-08-03 15:06     ` Martin Fuzzey
2018-08-03 17:03       ` Emil Velikov
2018-08-03 19:50         ` Sean Paul
2018-08-06 19:05           ` Rob Herring
2018-08-07  9:18             ` Martin Fuzzey
2018-08-07 11:01           ` Emil Velikov
2018-08-07 12:28             ` Daniel Vetter
2018-08-07 13:26               ` Emil Velikov
2018-08-03 12:25 ` Emil Velikov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).