Commit Graph

89 Commits (13b99f2a898a67320499e538303a689a270bb7f4)

Author SHA1 Message Date
Thierry Reding 7b1f37f474 xf86drm: Add platform and host1x bus support
ARM SoCs usually have their DRM/KMS devices on the platform bus, so add
support for that to enable these devices to be used with the drmDevice
infrastructure.

NVIDIA Tegra SoCs have an additional level in the hierarchy and DRM/KMS
devices can also be on the host1x bus. This is mostly equivalent to the
platform bus.

v4:
- continue on error to process platform or host1x device

v3:
- guard Linux-specific sysfs parsing code with #ifdef __linux__

v2:
- be careful not to overflow the full name
- read compatible strings into device info

Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
2017-01-20 16:27:20 +01:00
Thierry Reding f8484ccbd1 xf86drm: Add USB support
Allow DRM/KMS devices hosted on USB to be detected by the drmDevice
infrastructure.

v4:
- continue on error to process USB devices

v3:
- guard Linux-specific sysfs parsing code with #ifdef __linux__

v2:
- make sysfs_uevent_get() more flexible using a format string

Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
2017-01-20 16:25:53 +01:00
Thierry Reding 2e57bba870 xf86drm: Factor out drmDeviceAlloc()
Subsequent patches will add support for other bus types to drmDevice and
they will duplicate a lot of the code to allocate a drmDevice. Factor
out the common code so it can be reused.

Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
2017-01-20 16:25:35 +01:00
Taro Yamada 4ecd1ef010 xf86drm: fix null termination of string buffer
The string written to the buffer by read() is not null-terminated,
but currently drmParsePciBusInfo() places null character only at the end of the buffer, not at the end of the
string.
As a result, the string passed to sscanf() contains an uninitialized value.

This patch changes to places null character at the end of the string.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99045
Signed-off-by: Taro Yamada <archer_ame@yahoo.co.jp>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
2017-01-16 14:41:36 +00:00
Thierry Reding e17cad1994 xf86drm: Fix indentation
libdrm uses spaces for indentation. Fix the two inconsistent lines in
this file.

Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
2017-01-12 22:40:41 +01:00
Jonathan Gray eebefaf72c xf86drm: don't fatal on per device error in drmGetDevice[s]2
When iterating over all the device nodes if drmProcessPciDevice()
returned an error for any node the function would return an error,
ignoring any valid nodes.

The result of this on OpenBSD where drmProcessPciDevice() results in
device nodes being opened to issue ioctls to get pci data
was that data obtained from /dev/drm0 would be ignored if /dev/drm1
could not be opened.

Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
2016-12-24 17:06:58 +00:00
Jonathan Gray e2e766d5ac xf86drm: add a non-sysfs version of drmGetDeviceNameFromFd2
Implement a generic drmGetDeviceNameFromFd2() to use on non-linux
systems without sysfs.

v2: remove min < base test as requested by Emil

Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
2016-12-24 17:06:53 +00:00
Jonathan Gray d5cf3f9831 xf86drm: adjust device node path for minor base
When constructing a path to a device node the minor number retrieved
from fstat needs to have the offset of the node type subtracted from it.
Control and render node types have the same major as the primary node
but each has their own block of minor types at fixed offsets.

v2: remove min < base test as requested by Emil

Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
2016-12-24 17:06:49 +00:00
Grazvydas Ignotas 3bc14c8cb9 xf86drm: fix sign-compare warning
xf86drm.c:3601:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     while (expected < sizeof(match)) {
                     ^

Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2016-12-12 14:01:19 +00:00
Jonathan Gray 0825792723 xf86drm: implement an OpenBSD specific drmGetDevice2
DRI devices on OpenBSD are not in their own directory.  They reside in
/dev with a large number of statically generated /dev nodes.

Avoid stat'ing all of /dev on OpenBSD by implementing this custom path.

v2:
   - use drmGetMinorType to get node type
   - adapt to drmProcessPciDevice changes
   - verify drmParseSubsystemType type is PCI
   - add a comment describing why this was added

Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
2016-12-05 17:53:11 +00:00
Jonathan Gray fd190564da xf86drm: implement drmParsePciBusInfo for OpenBSD
Implement drmParsePciBusInfo for OpenBSD by using the new
DRM_IOCTL_GET_PCIINFO ioctl.

v2: use drmGetMinorType to get node type instead of always
    using DRM_NODE_PRIMARY.

Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
2016-12-05 17:53:05 +00:00
Jonathan Gray c0ef1d0788 xf86drm: implement drmParsePciDeviceInfo for OpenBSD
Implement drmParsePciDeviceInfo for OpenBSD by using the new
DRM_IOCTL_GET_PCIINFO ioctl.

v2: adapt to drmParsePciDeviceInfo changes and use drmOpenMinor

Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
2016-12-05 17:53:00 +00:00
Jonathan Gray d05b9f2dde xf86drm: implement drmParseSubsystemType for OpenBSD
Implement drmParseSubsystemType for OpenBSD by always returning
DRM_BUS_PCI.  No non-pci drm drivers are in the kernel and this is
unlikely to change anytime soon as the existing ones aren't permissively
licensed.

Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
2016-12-05 17:52:53 +00:00
Jonathan Gray f189011b36 xf86drm: implement drmGetMinorNameForFD for non-sysfs
Implement drmGetMinorNameForFD for systems without sysfs by
adapting drm_get_device_name_for_fd() from the Mesa loader.

v2: use type parameter to select dev name instead of always
    using DRM_DEV_NAME

Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
2016-12-05 17:52:46 +00:00
Emil Velikov 11687bf418 xf86drm: introduce drmGetDevice[s]2
Relative to the original version, here one can provide a flags bitmask.
Currently only DRM_DEVICE_IGNORE_PCI_REVISION is supported.

Implementation detail:
If it's set, we will only parse the separate sysfs files and we won't
touch the config one. The latter awakes the device (causing delays)
which is the core reason why this API was introduced.

v2:
 - Initialize revision to 0xff if it's unread.
 - Change DRM_DEVICE_IGNORE_PCI_REVISION to DRM_DEVICE_GET_PCI_REVISION
 - Add explicit note that drmGetDevice[s]2 does not retrieve the
revision by default.

v3:
 - Correctly fold drmParsePciDeviceInfo() hunk in this patch.

Cc: Michel Dänzer <michel@daenzer.net>
Cc: Nicolai Hähnle <nhaehnle@gmail.com>
Cc: Mauro Santos <registo.mailling@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98502
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2016-12-05 17:21:56 +00:00
Emil Velikov aae3f318d5 xf86drm: parse the separate sysfs files for vendor... info
Up-to recently (patch should land in 4.10) the kernel did not expose the
PCI device revision field as a separate sysfs file.

Thus one needed too parse the config file to retrieve it. This in
itself wakes up the device, which in some cases can be quite slow.

To avoid that, just check for the separate files and fall-back to the
original if kernel is not new enough.

v3: rework alongside drmGetDevice[s]2

Cc: Michel Dänzer <michel@daenzer.net>
Cc: Nicolai Hähnle <nhaehnle@gmail.com>
Cc: Mauro Santos <registo.mailling@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98502
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2016-12-05 17:21:23 +00:00
Emil Velikov 138d23117c xf86drm: add plumbing to not retrieve PCI device revision
Will be used with the drmGetDevice[s]2 API.

Cc: Michel Dänzer <michel@daenzer.net>
Cc: Nicolai Hähnle <nhaehnle@gmail.com>
Cc: Mauro Santos <registo.mailling@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98502
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
2016-12-05 17:17:35 +00:00
Emil Velikov b40a65d448 xf86drm: use maj/min in drmParsePciDeviceInfo()
Be consistent with drmParsePciBusInfo() and use solely the device
major/minor pair.

Cc: Jonathan Gray <jsg@jsg.id.au>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
2016-12-05 17:17:22 +00:00
Emil Velikov 37d790f7d4 xf86drm: introduce drmGetDeviceNameFromFd2
The original version considered only card devices, while this will pick
the device/node name regardless - card, control, renderD, other...

Current implementation is "linux" specific, in such that it relies on
sysfs/uevent file. At the same time this gives us the flexibility to
support any nodes even future ones, as long as they're within DRM_MAJOR.

Shamelessly copied from mesa, latter by: Gary Wong <gtw@gnu.org>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
2016-11-22 13:54:23 +00:00
Emil Velikov f53d3542c1 xd86drm: read more than 128 bytes of uevent in drmParsePciBusInfo
Some platforms (such as Macs using OF) can have more information in the
uevent file thus reading only the first 128 might not be sufficient.

Bump it to 512, which "should be enough for everybody" ;-)

v2: Use sizeof(data)-1 over hardcoded number (Eric).

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98629
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reported-by: Mingcong Bai <jeffbai@aosc.xyz>
Tested-by: Mingcong Bai <jeffbai@aosc.xyz> (v1)
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
2016-11-14 19:53:04 +00:00
Eric Anholt 2d8c01f256 Silence runtime complaints on platform devices
glxgears was spamming this 12 times at startup because of Mesa's
probing of the DRM device code, which doesn't support platform
devices.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-10-21 12:50:56 -07:00
Rob Herring 677cd97dc4 Return an -ENODEV from drmGetDevice() when no device was found.
Fixes crashes in Mesa on platform devices, which expected *device to
have a device when 0 was returned.

(code from a paste by Rob, commit message by anholt)

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2016-10-21 12:50:50 -07:00
Qiang Yu 6c056eecd5 drm: fix drmFreeDevices memory leak on multi GPU setups
When in multi GPU case, devices array may have some
NULL "hole" in between two devices. So check all
array elements and free non-NULL device.

Signed-off-by: Qiang Yu <Qiang.Yu@amd.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
2016-07-20 23:44:40 +01:00
Qiang Yu 3c20893daa drm: drmGetDevice return correct device on multi GPU setups
Currently drmGetDevice always returns the first device it finds under
/dev/dri/.

Move the target device to the start of the list during iteration. This
way during deduplication it'll preserve its place and will be returned
to the user.

v2: Keep the memory leak separate.
v3: Move the drmFoldDuplicatedDevices description

Signed-off-by: Qiang Yu <Qiang.Yu@amd.com>
[Emil Velikov: move drmFoldDuplicatedDevices description, add
changelog, reword commit message]
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
2016-07-20 23:38:35 +01:00
Mike Frysinger 8c8d5dd76f pull in sys/sysmacros.h when available
This header provides major/minor/makedev funcs under most Linux C
libs.  Pull it in to fix building with newer versions that drop the
implicit include via sys/types.h.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94231
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2016-07-06 16:58:38 +01:00
Jan Vesely 50d3c85bdb xf86drm.c: Fix mix of tabs and spaces
Remove whitespace at the end of line.
2016-07-06 16:58:38 +01:00
Nicolai Hähnle 9bdec97a19 xf86drm: ensure proper alignment of pointers in drmProcessPciDevice
Previously, (*device)->businfo.pci would end up misaligned, which results
in undefined behavior.

Signed-off-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
2016-06-10 20:15:15 +02:00
Qiang Yu 70b64073f7 drm: fix multi GPU drmGetDevices only return one device
When multi GPU present, after drmFoldDuplicatedDevices
merge same busid deveces, two different devices may be
seperated by zero in local_devices[]. The for loop
should check all local_devices instead of exit when
meet a zero.

Reviewed-by: Jim Qu <Jim.Qu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Qiang Yu <Qiang.Yu@amd.com>
2016-06-06 12:29:16 -04:00
Eric Engestrom ce97507cfc xf86drm: Fix spelling mistakes
Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
2016-04-07 18:16:01 +01:00
Damien Lespiau 3627f38da9 xf86drm: Bound strstr() to the allocated data
We are reading at most sizeof(data) bytes, but then data may not contain
a terminating '\0', at least in theory, so strstr() may overflow the
stack allocated array.

Make sure that data always contains at least one '\0'.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2016-01-22 15:50:17 +00:00
Matt Roper ba5a6ecf81 xf86drm: Handle unrecognized subsystems safely in drmGetDevice[s]()
Both drmGetDevice() and drmGetDevices() currently print a warning when
they encounter an unknown (non-PCI) subsystem type for a device node,
but they still proceed to assume that the drmDevicePtr was initialized
and try to add it to the local device array.  Add a 'continue' to the
error case handling to bypass the rest of the processing for devices we
can't handle.

Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
2015-10-20 18:45:23 +01:00
Matt Roper cf0f036e3d xf86drm: Fix error handling for drmGetDevice()
Some of the error conditions in drmGetDevice() can lead to us calling
closedir(NULL) or leaking memory.  Fix these conditions the same way we
did for drmGetDevices() in commit:

        commit 8c4a1cbd98
        Author: Matt Roper <matthew.d.roper@intel.com>
        Date:   Wed Sep 30 09:30:51 2015 -0700

            xf86drm: Fix error handling for drmGetDevices()

Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
2015-10-20 18:44:58 +01:00
Michel Dänzer 3045523de2 Fix void pointer arithmetic in drmProcessPciDevice
Arithmetic on void pointers is a GCC extension.

  CC       libdrm_la-xf86drm.lo
../xf86drm.c: In function 'drmProcessPciDevice':
../xf86drm.c:3017:10: warning: pointer of type 'void *' used in arithmetic [-Wpointer-arith]
     addr += sizeof(drmDevice);
          ^
../xf86drm.c:3020:10: warning: pointer of type 'void *' used in arithmetic [-Wpointer-arith]
     addr += DRM_NODE_MAX * sizeof(void *);
          ^
../xf86drm.c:3023:14: warning: pointer of type 'void *' used in arithmetic [-Wpointer-arith]
         addr += max_node_str;
              ^
../xf86drm.c:3035:14: warning: pointer of type 'void *' used in arithmetic [-Wpointer-arith]
         addr += sizeof(drmPciBusInfo);
              ^

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2015-10-14 12:48:52 +09:00
Matt Roper 8c4a1cbd98 xf86drm: Fix error handling for drmGetDevices()
If the opendir() call in drmGetDevices() returns failure, we jump to an
error label that calls closedir() and then returns.  However this means
that we're calling closedir(NULL) which may not be safe on all
implementations.  We are also leaking the local_devices array that was
allocated before the opendir() call.

Fix both of these issues by jumping to an earlier error label (to free
local_devices) and guarding the closedir() call with a NULL test.

Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
[Emil Velikov: make the teardown symmetrical, remove the NULL check]
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2015-10-02 13:17:03 +01:00
Felix Janda 4031dc17bb xf86drm: include <limits.h> for PATH_MAX
fixes compilation error with musl libc and Solaris based platforms.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92082
Signed-off-by: Felix Janda <felix.janda@posteo.de>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
2015-09-28 17:59:55 +01:00
Emil Velikov f3c6740f0c xf86drm: remove makedev() hack/workaround
Back when this was introduced commit 569da5a42eb(Merged glxmisc-3-0-0)
sys/sysmacros.h was used instead of the respecive headers (as per the
manual).

We've been handling it correctly for a little while now - in Linux, BSD
and Solaris. Thus we can drop this workaround.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2015-09-21 17:59:45 +01:00
Emil Velikov ccedf66b65 xf86drm: add drm{Get,Free}Device
Similar interface to the *Devices() ones but they obtain/free the
information of the opened device (as given by its fd).

Note there is a fair bit of duplication between the two Get functions,
and anyone interested is more than welcome to consolidate it.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
2015-09-21 17:43:08 +01:00
Emil Velikov fae59d7234 xf86drm: split out drmProcessPciDevice and drmFoldDuplicatedDevices
Will be reused in the next commit.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
2015-09-21 17:43:06 +01:00
Emil Velikov 8415a00a3f xf86drm: warn on missing drmGetMinorNameForFD implementation
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
2015-09-21 17:43:03 +01:00
Emil Velikov 291b2bb92c xf86drm: move ifdef __linux__ guards where needed
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
2015-09-21 17:42:57 +01:00
Emil Velikov 5f68d31820 xf86drm: rework drmGetDevices()
Do a once off memory allocation for each drmDevice.

This allows us to ease the error handling and simplify the
de-duplication loop. As part of this we need to rework drmFreeDevice()
such so that it frees the relevant hunks, rather than leaving that to
the caller.

Some memory stats from the drmdevice test

before: 22 allocs, 22 frees, 66,922 bytes allocated
after:   9 allocs, 9 frees, 66,436 bytes allocated

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
2015-09-21 17:42:53 +01:00
Emil Velikov bc2aca9e22 xf86drm: rename drmSameDevice to drmCompareBusInfo
Move away form the boolean name, change the return value
appropriately and check if either argument is NULL.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
2015-09-21 17:42:48 +01:00
Emil Velikov a250fceaaa xf86drm: move the final linux specific bits out of drmGetDevices
Third and final piece of making drmGetDevices less crazy/ugly.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
2015-09-21 17:42:46 +01:00
Emil Velikov ef5192e9c7 xf86drm: move platform details to drmParsePciDeviceInfo()
As with previous commit let's try to keep drmGetDevices clean of linux
specifics.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
2015-09-21 17:42:43 +01:00
Emil Velikov 536e0deba3 xf86drm: flex platform specifics into drmParsePciBusInfo
This will allow one to reuse the core drmGetDevices implementation on
other platforms. Keeping all the platform specifics in ParseFoo.

On the plus side this saves a bit of code :)

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
2015-09-21 17:42:40 +01:00
Rob Clark eb7c2d5e63 drm: make individual drm_server_info fxns optional
For android / drm_gralloc, we want to hook up our own debug_print()
without bothering with the reset of it.

Signed-off-by: Rob Clark <robdclark@gmail.com>
2015-09-04 08:40:57 -04:00
Emil Velikov b556ea127e drm: add interface to get drm devices on the system v3
For mutiple GPU support, the devices on the system should be enumerated
to get necessary information about each device, and the drmGetDevices
interface is added for this. Currently only PCI devices are supported for
the enumeration.

Typical usage:
int count;
drmDevicePtr *foo;
count = drmGetDevices(NULL, 0);
foo = calloc(count, sizeof(drmDevicePtr));
count = drmGetDevices(foo, count);
/* find proper device, open correct device node, etc */
drmFreeDevices(foo, count);
free(foo);

v2: [Jammy Zhou]
 - return a list of devices, rather than nodes
v3: [Jammy Zhou]
 - fix the signed extension for PCI device info

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
2015-08-24 17:36:28 +01:00
Mathias Tillman 5c42b5e36a drm: fix the usage after free
For readdir_r(), the next directory entry is returned in caller-allocted
buffer (pointered by pent here).

https://bugs.freedesktop.org/show_bug.cgi?id=91704

Signed-off-by: Mathias Tillman <master.homer@gmail.com>
Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
2015-08-24 11:11:20 +02:00
Jonathan Gray fc083322b0 xf86drm: use the correct device minor names on OpenBSD
Add defines for the device minor names and make use of them
in drmGetMinorName() so the correct paths will be used on OpenBSD.

v2: don't add new defines to xf86drm.h to keep them out of the API
    as requested by Emil.

Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
2015-07-29 18:04:15 +01:00
Jonathan Gray 66c3afb75f xf86drm: correct the OpenBSD DRM_MAJOR define
As far as I can tell no OpenBSD platform ever used 81
for a drm major.  While the value was added to libdrm in 2003
or earlier drm didn't appear in OpenBSD till 2007.

Of the OpenBSD platforms that support drm amd64/macppc/sparc64
use a major of 87, i386 uses 88.

v2: rearrange ifdefs as suggested by Emil.

Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
2015-07-29 18:04:15 +01:00