On 18 December 2018 7:07:01 pm NZDT, Christopher James Halse Rogers <chris@cooperteam.net> wrote:
On 18 December 2018 4:35:37 am AEDT, Emil Velikov <emil.l.velikov@gmail.com> wrote:
Hi Christopher,

On Tue, 20 Nov 2018 at 03:37, Christopher James Halse Rogers
<christopher.halse.rogers@canonical.com> wrote:
We can't use drmSetMaster to query whether or not a drm fd is master
because it requires CAP_SYS_ADMIN, even if the fd *is* a master fd.

Can you please mention the exact use case here? You mentioned it over
IRC although it'll be nice to have it here for posterity.

Certainly!

The particular use-case I was hitting was testing my display server in a container, where container-root is not real-root but the implicit-master FD you get by opening the DRM node when there is no current master would be sufficient.

Just assuming the FD we get is master and failing later breaks the platform probing; for example, when run under X11 if we don't check master we'll load the KMS platform and then fail, rather than noticing that KMS won't work and using our X11 backend.

>
Pick DRM_IOCTL_MODE_ATTACHMODE as a long-deprecated ioctl that is
DRM_MASTER but not DRM_ROOT_ONLY as the probe by which we can detect
whether or not the fd is master.

I'm wondering if we cannot extent DRM_IOCTL_GET_CLIENT or another
IOCTL.
What do you think? May I interest you in writing an RFC for the
kernel-side?

I think if I was going to do kernel-side changes if probably just make it so that IOCTL_SET_MASTER just unconditionally succeeded on an fd that was already master?
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Ping!

Is there anything more you'd like to know about my use-case here? Are there any objections to adding drmIsMaster()?