Can kmssink run with x11 or wayland which is based on drm/kms also?

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

Can kmssink run with x11 or wayland which is based on drm/kms also?

jared Hu
Hi,

I met a problem, if I run kmssink on wayland or x11 backend. Kmssink will report Permission denied. Because xserver and wayland will hold DRM-Master. I wonder if there is a way to run kmssink with wayland and x11?
Reply | Threaded
Open this post in threaded view
|

Re: Can kmssink run with x11 or wayland which is based on drm/kms also?

Victor Jaquez
On Tue, 11 Jul 2017 at 23:17, jared Hu wrote:
> Hi,
>
> I met a problem, if I run kmssink on wayland or x11 backend. Kmssink will
> report Permission denied. Because xserver and wayland will hold DRM-Master.
> I wonder if there is a way to run kmssink with wayland and x11?

AFAIK, there is non.

The DRM access management only allows one master to control the
graphics. You have two options: drop the other master (shutdown x11 or
wl), or to work headless, using a render node (with no visual output).

In short, if you're using x11, you should paint with x11. Same with
wayland.

vmjl
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Can kmssink run with x11 or wayland which is based on drm/kms also?

Nicolas Dufresne-5
In reply to this post by jared Hu
Le mardi 11 juillet 2017 à 23:17 -0700, jared Hu a écrit :
> Hi,
>
> I met a problem, if I run kmssink on wayland or x11 backend. Kmssink will
> report Permission denied. Because xserver and wayland will hold DRM-Master.
> I wonder if there is a way to run kmssink with wayland and x11?

No, kmssink need to be DRM master.

Nicolas
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

signature.asc (201 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Can kmssink run with x11 or wayland which is based on drm/kms also?

Jacob Chen-2
Hi,

2017-07-13 1:34 GMT+08:00 Nicolas Dufresne <[hidden email]>:
> Le mardi 11 juillet 2017 à 23:17 -0700, jared Hu a écrit :
>> Hi,
>>
>> I met a problem, if I run kmssink on wayland or x11 backend. Kmssink will
>> report Permission denied. Because xserver and wayland will hold DRM-Master.
>> I wonder if there is a way to run kmssink with wayland and x11?
>
> No, kmssink need to be DRM master.

kmssink can use normal plane, but it should change some codes.

"self->ctrl_fd = open ("/dev/dri/controlD64", O_RDWR); "
"
ret =
drmModeSetPlane (self->ctrl_fd, self->plane_id,
self->crtc_id, fb_id, 0, result.x, result.y, result.w, result.h,
/* source/cropping coordinates are given in Q16 */
src.x << 16, src.y << 16, src.w << 16, src.h << 16);
"

On rockchip platform, it works, thought it will have vsync problem
because of legacy drm api.

>
> Nicolas
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Can kmssink run with x11 or wayland which is based on drm/kms also?

jared Hu
In reply to this post by Nicolas Dufresne-5
Hi Nicolas,

I found kmssink can work with wayland by using control-node "/dev/dri/controlD64". What's the difference between controlD64 and cardx?
Reply | Threaded
Open this post in threaded view
|

Re: Can kmssink run with x11 or wayland which is based on drm/kms also?

Jacob Chen
In reply to this post by Jacob Chen-2
Hi,


2017-07-13 9:23 GMT+08:00 Jacob Chen <[hidden email]>:

> Hi,
>
> 2017-07-13 1:34 GMT+08:00 Nicolas Dufresne <[hidden email]>:
>> Le mardi 11 juillet 2017 à 23:17 -0700, jared Hu a écrit :
>>> Hi,
>>>
>>> I met a problem, if I run kmssink on wayland or x11 backend. Kmssink will
>>> report Permission denied. Because xserver and wayland will hold DRM-Master.
>>> I wonder if there is a way to run kmssink with wayland and x11?
>>
>> No, kmssink need to be DRM master.
>
> kmssink can use normal plane, but it should change some codes.
>
> "self->ctrl_fd = open ("/dev/dri/controlD64", O_RDWR); "
> "
> ret =
> drmModeSetPlane (self->ctrl_fd, self->plane_id,
> self->crtc_id, fb_id, 0, result.x, result.y, result.w, result.h,
> /* source/cropping coordinates are given in Q16 */
> src.x << 16, src.y << 16, src.w << 16, src.h << 16);
> "
>
> On rockchip platform, it works, thought it will have vsync problem
> because of legacy drm api.
>

= = It seems it didn't work with the latest mainline kernel now.
So the only way to run kmssink on wayland or x11 is kernel hack.

comment this funciton.
http://elixir.free-electrons.com/linux/latest/source/drivers/gpu/drm/drm_ioctl.c#L497



>>
>> Nicolas
>> _______________________________________________
>> gstreamer-devel mailing list
>> [hidden email]
>> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>>
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Can kmssink run with x11 or wayland which is based on drm/kms also?

jared Hu
Hi Jacob,

Do you know the rootcause why it cannot work on the lastest mainline kernel. I'am now working on L4.9.11
Reply | Threaded
Open this post in threaded view
|

Re: Can kmssink run with x11 or wayland which is based on drm/kms also?

Jacob Chen
In reply to this post by jared Hu
2017-07-13 13:32 GMT+08:00 jared Hu <[hidden email]>:
> Hi Nicolas,
>
> I found kmssink can work with wayland by using control-node
> "/dev/dri/controlD64". What's the difference between controlD64 and cardx?
>
>

DRM don't allow multi user.
It's a trick that you can use controlD64, because drm don't check
permissions for controlD64.
It have been fixed in kernel 4.12.

You will also meet the double vsync problem when runing kmssink on
wayland, hope it could help you.
https://github.com/rockchip-linux/meta-rockchip-extra/blob/master/meta-demo/meta-player-qt/linux-rockchip/linux-0017-drm-skip-wait-on-vblank-for-set-plane.patch


waylandsink in gstreamer 1.12 have support dmabuf, and a collabora guy
have make weston support drm-atomic  .
I would recommend you to use waylandsink for your project.

>
> --
> View this message in context: http://gstreamer-devel.966125.n4.nabble.com/Can-kmssink-run-with-x11-or-wayland-which-is-based-on-drm-kms-also-tp4683783p4683798.html
> Sent from the GStreamer-devel mailing list archive at Nabble.com.
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Can kmssink run with x11 or wayland which is based on drm/kms also?

Nicolas Dufresne-5
In reply to this post by Jacob Chen
Le jeudi 13 juillet 2017 à 14:48 +0800, Jacob Chen a écrit :

> Hi,
>
>
> 2017-07-13 9:23 GMT+08:00 Jacob Chen <[hidden email]>:
> > Hi,
> >
> > 2017-07-13 1:34 GMT+08:00 Nicolas Dufresne <[hidden email]>:
> > > Le mardi 11 juillet 2017 à 23:17 -0700, jared Hu a écrit :
> > > > Hi,
> > > >
> > > > I met a problem, if I run kmssink on wayland or x11 backend. Kmssink will
> > > > report Permission denied. Because xserver and wayland will hold DRM-Master.
> > > > I wonder if there is a way to run kmssink with wayland and x11?
> > >
> > > No, kmssink need to be DRM master.
> >
> > kmssink can use normal plane, but it should change some codes.
> >
> > "self->ctrl_fd = open ("/dev/dri/controlD64", O_RDWR); "
> > "
> > ret =
> > drmModeSetPlane (self->ctrl_fd, self->plane_id,
> > self->crtc_id, fb_id, 0, result.x, result.y, result.w, result.h,
> > /* source/cropping coordinates are given in Q16 */
> > src.x << 16, src.y << 16, src.w << 16, src.h << 16);
> > "
> >
> > On rockchip platform, it works, thought it will have vsync problem
> > because of legacy drm api.
> >
>
> = = It seems it didn't work with the latest mainline kernel now.
> So the only way to run kmssink on wayland or x11 is kernel hack.
>
> comment this funciton.
> http://elixir.free-electrons.com/linux/latest/source/drivers/gpu/drm/drm_ioctl.c#L497
Which I think make sense, DRM is not really designed for this. As
already mention, you can get a much better experience using waylandsink
instead. The compositor should be responsible for distributing the
rendering across the HW planes and optimizing this.

If you're goal was to use kmssink inside a compositor, that would be
different, but still, I'd be curious in which case an equivalent
application could not be made of waylandsink. So far, the only real use
case I've had for kmssink was for fullscreen playback (security
monitor) and for displaying backup camera while the car infotainment is
being booted.

regards,
Nicolas
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

signature.asc (201 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Can kmssink run with x11 or wayland which is based on drm/kms also?

Jacob Chen
Hi Nicolas,

2017-07-13 22:23 GMT+08:00 Nicolas Dufresne <[hidden email]>:

> Le jeudi 13 juillet 2017 à 14:48 +0800, Jacob Chen a écrit :
>> Hi,
>>
>>
>> 2017-07-13 9:23 GMT+08:00 Jacob Chen <[hidden email]>:
>> > Hi,
>> >
>> > 2017-07-13 1:34 GMT+08:00 Nicolas Dufresne <[hidden email]>:
>> > > Le mardi 11 juillet 2017 à 23:17 -0700, jared Hu a écrit :
>> > > > Hi,
>> > > >
>> > > > I met a problem, if I run kmssink on wayland or x11 backend. Kmssink will
>> > > > report Permission denied. Because xserver and wayland will hold DRM-Master.
>> > > > I wonder if there is a way to run kmssink with wayland and x11?
>> > >
>> > > No, kmssink need to be DRM master.
>> >
>> > kmssink can use normal plane, but it should change some codes.
>> >
>> > "self->ctrl_fd = open ("/dev/dri/controlD64", O_RDWR); "
>> > "
>> > ret =
>> > drmModeSetPlane (self->ctrl_fd, self->plane_id,
>> > self->crtc_id, fb_id, 0, result.x, result.y, result.w, result.h,
>> > /* source/cropping coordinates are given in Q16 */
>> > src.x << 16, src.y << 16, src.w << 16, src.h << 16);
>> > "
>> >
>> > On rockchip platform, it works, thought it will have vsync problem
>> > because of legacy drm api.
>> >
>>
>> = = It seems it didn't work with the latest mainline kernel now.
>> So the only way to run kmssink on wayland or x11 is kernel hack.
>>
>> comment this funciton.
>> http://elixir.free-electrons.com/linux/latest/source/drivers/gpu/drm/drm_ioctl.c#L497
>
> Which I think make sense, DRM is not really designed for this. As
> already mention, you can get a much better experience using waylandsink
> instead. The compositor should be responsible for distributing the
> rendering across the HW planes and optimizing this.
>
> If you're goal was to use kmssink inside a compositor, that would be
> different, but still, I'd be curious in which case an equivalent
> application could not be made of waylandsink. So far, the only real use
> case I've had for kmssink was for fullscreen playback (security
> monitor) and for displaying backup camera while the car infotainment is
> being booted.
>

Waylandsink is great, but there still are some issues for people to use.

1.Patches for supporting atomic mode-setting by Wayland's Weston are
not yet merged, so Weston still can't use drm overlay render.
2.If somethings cover the video window, weston will back to GPU
Render, which lead to lag(especially the TV Box targeted SOC that
usually have a weak GPU).
3.It can't work with qt multimedia.

With some simple kernel hack + kmssink
we can use kmssink on wayland/x11/qt eglfs.
We get the idea form Kodi and Plex, they already use this way in
amlogic platform(though fb + ffmpeg, not drm + gstreamer).  ; )

1. I can use "transparent UI + bottom video layer" to show items
overlay the vdieo layer.
2. It work well with qt multimedia.
3. No system environmental dependency

> regards,
> Nicolas
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Can kmssink run with x11 or wayland which is based on drm/kms also?

jared Hu
In reply to this post by Nicolas Dufresne-5
Hi Nicolas and Jacob,

we want to use kmssink because of kms/drm has multiscreen support. We want to implement multiscreen feature later on kmssink. In addition, our project is base on eglfs, wayland and x11. We need a platform independence videosink.

Hi Jacob,

You mean the lastest kernel does permission check on controlD?
Reply | Threaded
Open this post in threaded view
|

Re: Can kmssink run with x11 or wayland which is based on drm/kms also?

jared Hu
In reply to this post by Jacob Chen
Hi Jacob,

I checked the kernel commit log, this commit is the reason why this control node doesn't work.

----------------------------------------------------------------------------------------------------------
commit 8a357d10043c75e980e7fcdb60d2b913491564af
Author: Daniel Vetter <daniel.vetter@ffwll.ch>
Date:   Fri Oct 28 10:10:50 2016 +0200

    drm: Nerf DRM_CONTROL nodes
   
    Looking at the ioctl permission checks I noticed that it's impossible
    to import gem buffers into a control nodes, and fd2handle/handle2fd
    also don't work, so no joy with dma-bufs.
   
    The only way to do anything with a control node is by drawing stuff
    into a dumb buffer and displaying that. I suspect control nodes are an
    entirely unused thing, and a cursory check shows that there does not
    seem to be any callers of drmOpenControl nor of the other drmOpen
    functions using DRM_MODE_CONTROL.
   
    Since I don't like dead uabi, let's remove it. But since this would be
    a really big change I think it's better to start out small by simply
    not registering anything. We can garbage-collect the dead code later
    on, once we're sure it's really not used anywhere.
   
    Acked-by: Dave Airlie <airlied@gmail.com>
    Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
    Link: http://patchwork.freedesktop.org/patch/msgid/20161028081050.1042-1-daniel.vetter@ffwll.ch
--------------------------------------------------------------------------------------------------------------

And in later commit, they add a fake control node symbol link. Is there any other way to use kmssink with x11 and wayland without kernel hacking?