All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm: set DRM_RENDER_ALLOW flag on DRM_IOCTL_MODE_CREATE/DESTROY_DUMB ioctls
@ 2021-06-10 21:36 Dongwon Kim
  2021-06-11  9:47 ` Daniel Vetter
  0 siblings, 1 reply; 4+ messages in thread
From: Dongwon Kim @ 2021-06-10 21:36 UTC (permalink / raw)
  To: dri-devel; +Cc: Dongwon Kim

Render clients should be able to create/destroy dumb object to import
and use it as render buffer in case the default DRM device is different
from the render device (i.e. kmsro).

Signed-off-by: Dongwon Kim <dongwon.kim@intel.com>
---
 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 98ae00661656..f2f72e132741 100644
--- a/drivers/gpu/drm/drm_ioctl.c
+++ b/drivers/gpu/drm/drm_ioctl.c
@@ -685,9 +685,9 @@ static const struct drm_ioctl_desc drm_ioctls[] = {
 	DRM_IOCTL_DEF(DRM_IOCTL_MODE_RMFB, drm_mode_rmfb_ioctl, 0),
 	DRM_IOCTL_DEF(DRM_IOCTL_MODE_PAGE_FLIP, drm_mode_page_flip_ioctl, DRM_MASTER),
 	DRM_IOCTL_DEF(DRM_IOCTL_MODE_DIRTYFB, drm_mode_dirtyfb_ioctl, DRM_MASTER),
-	DRM_IOCTL_DEF(DRM_IOCTL_MODE_CREATE_DUMB, drm_mode_create_dumb_ioctl, 0),
+	DRM_IOCTL_DEF(DRM_IOCTL_MODE_CREATE_DUMB, drm_mode_create_dumb_ioctl, DRM_RENDER_ALLOW),
 	DRM_IOCTL_DEF(DRM_IOCTL_MODE_MAP_DUMB, drm_mode_mmap_dumb_ioctl, 0),
-	DRM_IOCTL_DEF(DRM_IOCTL_MODE_DESTROY_DUMB, drm_mode_destroy_dumb_ioctl, 0),
+	DRM_IOCTL_DEF(DRM_IOCTL_MODE_DESTROY_DUMB, drm_mode_destroy_dumb_ioctl, DRM_RENDER_ALLOW),
 	DRM_IOCTL_DEF(DRM_IOCTL_MODE_OBJ_GETPROPERTIES, drm_mode_obj_get_properties_ioctl, 0),
 	DRM_IOCTL_DEF(DRM_IOCTL_MODE_OBJ_SETPROPERTY, drm_mode_obj_set_property_ioctl, DRM_MASTER),
 	DRM_IOCTL_DEF(DRM_IOCTL_MODE_CURSOR2, drm_mode_cursor2_ioctl, DRM_MASTER),
-- 
2.20.1


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

* Re: [PATCH] drm: set DRM_RENDER_ALLOW flag on DRM_IOCTL_MODE_CREATE/DESTROY_DUMB ioctls
  2021-06-10 21:36 [PATCH] drm: set DRM_RENDER_ALLOW flag on DRM_IOCTL_MODE_CREATE/DESTROY_DUMB ioctls Dongwon Kim
@ 2021-06-11  9:47 ` Daniel Vetter
  2021-06-11 10:39   ` Emil Velikov
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Vetter @ 2021-06-11  9:47 UTC (permalink / raw)
  To: Dongwon Kim; +Cc: dri-devel

On Thu, Jun 10, 2021 at 02:36:59PM -0700, Dongwon Kim wrote:
> Render clients should be able to create/destroy dumb object to import
> and use it as render buffer in case the default DRM device is different
> from the render device (i.e. kmsro).
> 
> Signed-off-by: Dongwon Kim <dongwon.kim@intel.com>

Uh no.

Well I know everyone just hacks around this, but the idea behind dumb
buffer objects is that they're for kms scanout only. Furthermore on many
drivers they allocate a limited resource like CMA memory. Handing that out
like candy isn't a great idea.

And it's exactly those drivers that kmsro currently is used for where the
display driver needs special memory.
-Daniel

> ---
>  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 98ae00661656..f2f72e132741 100644
> --- a/drivers/gpu/drm/drm_ioctl.c
> +++ b/drivers/gpu/drm/drm_ioctl.c
> @@ -685,9 +685,9 @@ static const struct drm_ioctl_desc drm_ioctls[] = {
>  	DRM_IOCTL_DEF(DRM_IOCTL_MODE_RMFB, drm_mode_rmfb_ioctl, 0),
>  	DRM_IOCTL_DEF(DRM_IOCTL_MODE_PAGE_FLIP, drm_mode_page_flip_ioctl, DRM_MASTER),
>  	DRM_IOCTL_DEF(DRM_IOCTL_MODE_DIRTYFB, drm_mode_dirtyfb_ioctl, DRM_MASTER),
> -	DRM_IOCTL_DEF(DRM_IOCTL_MODE_CREATE_DUMB, drm_mode_create_dumb_ioctl, 0),
> +	DRM_IOCTL_DEF(DRM_IOCTL_MODE_CREATE_DUMB, drm_mode_create_dumb_ioctl, DRM_RENDER_ALLOW),
>  	DRM_IOCTL_DEF(DRM_IOCTL_MODE_MAP_DUMB, drm_mode_mmap_dumb_ioctl, 0),
> -	DRM_IOCTL_DEF(DRM_IOCTL_MODE_DESTROY_DUMB, drm_mode_destroy_dumb_ioctl, 0),
> +	DRM_IOCTL_DEF(DRM_IOCTL_MODE_DESTROY_DUMB, drm_mode_destroy_dumb_ioctl, DRM_RENDER_ALLOW),
>  	DRM_IOCTL_DEF(DRM_IOCTL_MODE_OBJ_GETPROPERTIES, drm_mode_obj_get_properties_ioctl, 0),
>  	DRM_IOCTL_DEF(DRM_IOCTL_MODE_OBJ_SETPROPERTY, drm_mode_obj_set_property_ioctl, DRM_MASTER),
>  	DRM_IOCTL_DEF(DRM_IOCTL_MODE_CURSOR2, drm_mode_cursor2_ioctl, DRM_MASTER),
> -- 
> 2.20.1
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

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

* Re: [PATCH] drm: set DRM_RENDER_ALLOW flag on DRM_IOCTL_MODE_CREATE/DESTROY_DUMB ioctls
  2021-06-11  9:47 ` Daniel Vetter
@ 2021-06-11 10:39   ` Emil Velikov
  2021-06-11 21:48     ` Dongwon Kim
  0 siblings, 1 reply; 4+ messages in thread
From: Emil Velikov @ 2021-06-11 10:39 UTC (permalink / raw)
  To: Daniel Vetter; +Cc: Dongwon Kim, ML dri-devel

On Fri, 11 Jun 2021 at 10:47, Daniel Vetter <daniel@ffwll.ch> wrote:
>
> On Thu, Jun 10, 2021 at 02:36:59PM -0700, Dongwon Kim wrote:
> > Render clients should be able to create/destroy dumb object to import
> > and use it as render buffer in case the default DRM device is different
> > from the render device (i.e. kmsro).
> >
> > Signed-off-by: Dongwon Kim <dongwon.kim@intel.com>
>
> Uh no.
>
> Well I know everyone just hacks around this, but the idea behind dumb
> buffer objects is that they're for kms scanout only. Furthermore on many
> drivers they allocate a limited resource like CMA memory. Handing that out
> like candy isn't a great idea.
>
> And it's exactly those drivers that kmsro currently is used for where the
> display driver needs special memory.

Couldn't agree more. Perhaps we should add an inline comment and/or
reference to a thread why?

-Emil

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

* Re: [PATCH] drm: set DRM_RENDER_ALLOW flag on DRM_IOCTL_MODE_CREATE/DESTROY_DUMB ioctls
  2021-06-11 10:39   ` Emil Velikov
@ 2021-06-11 21:48     ` Dongwon Kim
  0 siblings, 0 replies; 4+ messages in thread
From: Dongwon Kim @ 2021-06-11 21:48 UTC (permalink / raw)
  To: Emil Velikov; +Cc: ML dri-devel

Understood. I saw weston client apps were failing to create render buffers
from kmsro driver and found it was because they were not allowed to
create and destroy dumb objects then I came up with this patch. I just thought
it's the simplest solution. I didn't know it violates the rule. I think I should
look into kmsro to make the client app to get the render buffer from
ro-device instead. Thanks

On Fri, Jun 11, 2021 at 11:39:46AM +0100, Emil Velikov wrote:
> On Fri, 11 Jun 2021 at 10:47, Daniel Vetter <daniel@ffwll.ch> wrote:
> >
> > On Thu, Jun 10, 2021 at 02:36:59PM -0700, Dongwon Kim wrote:
> > > Render clients should be able to create/destroy dumb object to import
> > > and use it as render buffer in case the default DRM device is different
> > > from the render device (i.e. kmsro).
> > >
> > > Signed-off-by: Dongwon Kim <dongwon.kim@intel.com>
> >
> > Uh no.
> >
> > Well I know everyone just hacks around this, but the idea behind dumb
> > buffer objects is that they're for kms scanout only. Furthermore on many
> > drivers they allocate a limited resource like CMA memory. Handing that out
> > like candy isn't a great idea.
> >
> > And it's exactly those drivers that kmsro currently is used for where the
> > display driver needs special memory.
> 
> Couldn't agree more. Perhaps we should add an inline comment and/or
> reference to a thread why?
> 
> -Emil

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

end of thread, other threads:[~2021-06-11 21:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-10 21:36 [PATCH] drm: set DRM_RENDER_ALLOW flag on DRM_IOCTL_MODE_CREATE/DESTROY_DUMB ioctls Dongwon Kim
2021-06-11  9:47 ` Daniel Vetter
2021-06-11 10:39   ` Emil Velikov
2021-06-11 21:48     ` Dongwon Kim

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.