All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH libdrm] xf86drm: Make drmNodeIsDRM() public.
@ 2018-11-20  4:30 Christopher James Halse Rogers
  2018-12-17 18:03 ` Emil Velikov
  0 siblings, 1 reply; 4+ messages in thread
From: Christopher James Halse Rogers @ 2018-11-20  4:30 UTC (permalink / raw)
  To: dri-devel; +Cc: Christopher James Halse Rogers

I have wanted this code in Mir, so it's plausibly useful elsewhere,
particularly if the DRM device major number is going to become
dynamic.

Signed-off-by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
---
 xf86drm.c | 2 +-
 xf86drm.h | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/xf86drm.c b/xf86drm.c
index 10df682b..f32cb1bb 100644
--- a/xf86drm.c
+++ b/xf86drm.c
@@ -2767,7 +2767,7 @@ drm_public char *drmGetDeviceNameFromFd(int fd)
     return strdup(name);
 }
 
-static bool drmNodeIsDRM(int maj, int min)
+drm_public bool drmNodeIsDRM(int maj, int min)
 {
 #ifdef __linux__
     char path[64];
diff --git a/xf86drm.h b/xf86drm.h
index 7773d71a..6dc92180 100644
--- a/xf86drm.h
+++ b/xf86drm.h
@@ -37,6 +37,7 @@
 #include <stdarg.h>
 #include <sys/types.h>
 #include <stdint.h>
+#include <stdbool.h>
 #include <drm.h>
 
 #if defined(__cplusplus)
@@ -783,6 +784,8 @@ extern int drmPrimeFDToHandle(int fd, int prime_fd, uint32_t *handle);
 extern char *drmGetPrimaryDeviceNameFromFd(int fd);
 extern char *drmGetRenderDeviceNameFromFd(int fd);
 
+extern bool drmNodeIsDRM(int major, int minor);
+
 #define DRM_BUS_PCI       0
 #define DRM_BUS_USB       1
 #define DRM_BUS_PLATFORM  2
-- 
2.19.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH libdrm] xf86drm: Make drmNodeIsDRM() public.
  2018-11-20  4:30 [PATCH libdrm] xf86drm: Make drmNodeIsDRM() public Christopher James Halse Rogers
@ 2018-12-17 18:03 ` Emil Velikov
  2018-12-17 19:59   ` Eric Anholt
  2018-12-18  6:42   ` Christopher James Halse Rogers
  0 siblings, 2 replies; 4+ messages in thread
From: Emil Velikov @ 2018-12-17 18:03 UTC (permalink / raw)
  To: christopher.halse.rogers; +Cc: ML dri-devel

Hi Christopher,

On Tue, 20 Nov 2018 at 04:30, Christopher James Halse Rogers
<christopher.halse.rogers@canonical.com> wrote:
>
> I have wanted this code in Mir, so it's plausibly useful elsewhere,
> particularly if the DRM device major number is going to become
> dynamic.
>
Can you elaborate/link to the code that uses the major/minor?
Fiddling with those manually is rather error prone most often than not.

Thanks
Emil
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH libdrm] xf86drm: Make drmNodeIsDRM() public.
  2018-12-17 18:03 ` Emil Velikov
@ 2018-12-17 19:59   ` Eric Anholt
  2018-12-18  6:42   ` Christopher James Halse Rogers
  1 sibling, 0 replies; 4+ messages in thread
From: Eric Anholt @ 2018-12-17 19:59 UTC (permalink / raw)
  To: Emil Velikov, christopher.halse.rogers; +Cc: ML dri-devel


[-- Attachment #1.1: Type: text/plain, Size: 525 bytes --]

Emil Velikov <emil.l.velikov@gmail.com> writes:

> Hi Christopher,
>
> On Tue, 20 Nov 2018 at 04:30, Christopher James Halse Rogers
> <christopher.halse.rogers@canonical.com> wrote:
>>
>> I have wanted this code in Mir, so it's plausibly useful elsewhere,
>> particularly if the DRM device major number is going to become
>> dynamic.
>>
> Can you elaborate/link to the code that uses the major/minor?
> Fiddling with those manually is rather error prone most often than not.

Yeah, I think this shouldn't be part of the API.

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH libdrm] xf86drm: Make drmNodeIsDRM() public.
  2018-12-17 18:03 ` Emil Velikov
  2018-12-17 19:59   ` Eric Anholt
@ 2018-12-18  6:42   ` Christopher James Halse Rogers
  1 sibling, 0 replies; 4+ messages in thread
From: Christopher James Halse Rogers @ 2018-12-18  6:42 UTC (permalink / raw)
  To: Emil Velikov, christopher.halse.rogers; +Cc: ML dri-devel

On 18 December 2018 5:03:22 am AEDT, Emil Velikov <emil.l.velikov@gmail.com> wrote:
>Hi Christopher,
>
>On Tue, 20 Nov 2018 at 04:30, Christopher James Halse Rogers
><christopher.halse.rogers@canonical.com> wrote:
>>
>> I have wanted this code in Mir, so it's plausibly useful elsewhere,
>> particularly if the DRM device major number is going to become
>> dynamic.
>>
>Can you elaborate/link to the code that uses the major/minor?
>Fiddling with those manually is rather error prone most often than not.

We have an internal API that mirrors that of logind - taking a (major,minor) pair and returning a usable fd. For input devices, that just means opened O_NONBLOCK; for DRM devices it means calling SetMaster.

Here's the relevant (non-logind) implementation: https://github.com/MirServer/mir/blob/master/src/server/console/linux_virtual_terminal.cpp#L634

Since we by necessity end up pulling out the devnode I guess we could match on a /dev/dri prefix instead. I just noticed this function while doing the drmIsMaster patch and thought it would be convenient for us!

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

end of thread, other threads:[~2018-12-18  6:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-20  4:30 [PATCH libdrm] xf86drm: Make drmNodeIsDRM() public Christopher James Halse Rogers
2018-12-17 18:03 ` Emil Velikov
2018-12-17 19:59   ` Eric Anholt
2018-12-18  6:42   ` Christopher James Halse Rogers

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.