Commit Graph

150 Commits (bb584b8fd24e956d68b8f040a5c6cc0190980903)

Author SHA1 Message Date
Emmanuel Vadot 13c9de39a6 libdrm: drmGetDeviceNameFromFd2: Add FreeBSD variant
The FreeBSD variant of drmGetDeviceNameFromFd can already handle
the different node type so just call it.

Signed-off-by: Emmanuel Vadot <manu@FreeBSD.org>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2020-04-21 19:26:54 +02:00
Emmanuel Vadot 41f3a7b3e5 libdrm: Default to PCI for FreeBSD
FreeBSD have some support for DRM on !PCI device but no code is currently
upstream. Default to PCI for now.

Signed-off-by: Emmanuel Vadot <manu@FreeBSD.org>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2020-04-21 19:26:54 +02:00
Emmanuel Vadot 57c50cfc45 libdrm: drmGetMinorNameForFD: Add FreeBSD variant
Use the FreeBSD variant function to obtain the minor name and the
device node.
Return the correct path based on where the node is (drm/ versus dri/).

Signed-off-by: Emmanuel Vadot <manu@FreeBSD.org>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2020-04-21 19:26:54 +02:00
Emmanuel Vadot 6818a50b12 libdrm: drmGetDeviceNameFromFd: Add FreeBSD variant
Get the major/minor via fstat and after checking that this is a drm node
construct the full device node name using devname.
Note that we should be able to use fdevname to avoid calling fstat + devname
but for some reason it doesn't work on drm node (probably due to how the device
node are created in the linux compat code for drm on FreeBSD).

Signed-off-by: Emmanuel Vadot <manu@FreeBSD.org>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2020-04-21 19:26:54 +02:00
Emmanuel Vadot c55a1e564c libdrm: drmGetMinorType: Add FreeBSD version
Resolve the minor type based on the device node path.
The minor type is either in /dev/drm/X where X is the type or
in a Linux-compatible device node in /dev/dri/
This means we need the major number on FreeBSD so add it to the function
arguments.

Signed-off-by: Emmanuel Vadot <manu@FreeBSD.org>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2020-04-21 19:25:36 +02:00
Emmanuel Vadot 4fbcc9a6a7 xf86drm: Remove ifdef for FreeBSD and DRM_MAJOR
FreeBSD devfs only provides on the fly generated major/minor.
The major number is irrelevant for FreeBSD so remove the special case.

Signed-off-by: Emmanuel Vadot <manu@FreeBSD.org>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2020-04-21 18:39:48 +02:00
Emmanuel Vadot 1c8d2b73a6 libdrm: drmNodeIsDRM: Add FreeBSD variant
FreeBSD devfs have on the gly generated major minor so we cannot use them
to test if the device is a drm node.
Instead get the devfs node name and test if it is in a subdirectory "drm/"
or "dri/".
Historycally DRM device on FreeBSD are created in /dev/drm/ and link are
present in /dev/dri/ for compatibility reason.

Signed-off-by: Emmanuel Vadot <manu@FreeBSD.org>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2020-04-21 18:39:48 +02:00
Vasyl Vavrychuk 8a73372e62 xf86drm: fix subsystem type lookup for virtio mmio-based devices
Currently the code assumes that a virtio based device is always located
on the PCI bus.

Modify the parser to make it check the device's parent directory to
determine on which bus it is located.

Output for virtio-pci is the PCI bus.
Output for virtio-mmio is the Platform bus.

Signed-off-by: Vasyl Vavrychuk <vasyl.vavrychuk@opensynergy.com>
Signed-off-by: Mikhail Golubev <Mikhail.Golubev@opensynergy.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
2020-02-24 21:53:41 +00:00
Vasyl Vavrychuk c4eae71d7e xf86drm: generalize the device subsystem type parsing code
Move the code, which used to get the device subsystem type from a device
path in sysfs, to a separate function to be reusable.

Signed-off-by: Vasyl Vavrychuk <vasyl.vavrychuk@opensynergy.com>
Signed-off-by: Mikhail Golubev <Mikhail.Golubev@opensynergy.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
2020-02-24 21:53:41 +00:00
Chunming Zhou 0a7ad7df14 libdrm: wrap new flexible syncobj query interface v2
v2: nit-picks fix

Signed-off-by: Chunming Zhou <david1.zhou@amd.com>
Cc: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Cc: Christian König <Christian.Koenig@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
For the xf86drm.[ch] part : Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
2019-10-26 03:11:14 +00:00
Eric Engestrom 331e51e32f xf86drm: dedupe drmGetDeviceName() logic
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
2019-07-03 13:06:21 +01:00
Eric Engestrom 6869e4cea7 xf86drm: use max size of drm node name instead of arbitrary size
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
2019-07-03 13:06:21 +01:00
Eric Engestrom 0d5ea07736 xf86drm: dedupe `#define`s
Adapted from a local patch carried by DragonFlyBSD:
bc056f88f7/graphics/libdrm/files/patch-xf86drm.h

Patch is sadly uncredited (a bot authored the commit), so I can't credit
the author here either.

Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
2019-07-03 13:06:21 +01:00
Jonathan Gray 293b95e815 xf86drm: open correct render node on non-linux
drm render nodes have the same major as drm primary devices but offset
the minor by a base of 128.

I expected the name of the device to have numbering starting at 0 when
these non-linux codepaths were added (before OpenBSD had render nodes).

Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
Acked-by: Eric Engestrom <eric.engestrom@intel.com>
2019-07-03 12:28:15 +01:00
Jonathan Gray 13e2c35603 xf86drm: test for render nodes before primary nodes
Unlike Linux the OpenBSD primary "drm" device name is substring of the
"drmR" render node device name and strncmp() tests resulted in render
nodes being flagged as primary nodes.

Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
Acked-by: Eric Engestrom <eric.engestrom@intel.com>
2019-07-03 12:26:54 +01:00
Chunming Zhou 12712eb6e3 add timeline signal/transfer ioctls v2
v2: use one transfer ioctl

Signed-off-by: Chunming Zhou <david1.zhou@amd.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
2019-05-16 12:07:18 +02:00
Chunming Zhou ec6ae51e80 add timeline wait/query ioctl v2
v2: drop export/import

Signed-off-by: Chunming Zhou <david1.zhou@amd.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
2019-05-16 12:07:18 +02:00
Prabhanjan Kandula 225d73fd3b libdrm: Avoid additional drm open close
Avoid additional drm device open and close.

Cc: Sean Paul <seanpaul@chromium.org>
Cc: Alistair Strachan <astrachan@google.com>
Cc: Marissa Wall <marissaw@google.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
2019-04-25 10:57:59 +01:00
Emil Velikov 439a4c0361 Revert "libdrm: Fix issue about differrent domainID but same BDF"
This reverts commit 56c21f877b.

There were issues pointed out during review that were not addressed.
Would love to have this re-land, once those are addressed.
2019-04-17 18:31:31 +01:00
Eric Engestrom 360292c7ab fix various typos
Saw a couple of typos fixes in the patch DragonFlyBSD carries [1], so
I ran codespell (a spell checker for code) on the whole repo.

[1] https://github.com/DragonFlyBSD/DPorts/blob/master/graphics/libdrm/files/patch-xf86drm.c

Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2019-04-17 18:23:25 +01:00
Andreas Baierl 4735ca71af xf86drm: Fix segmentation fault while parsing device info
This fixes a bug, which was introduced with commit ee798b98
"xf85drm: de-duplicate drmParse{Platform.Host1x}{Bus,Device}Info".
where accessing *compatible[i] with i>0 results in a segfault.

Signed-off-by: Andreas Baierl <ichgeh@imkreisrum.de>
Fixes: ee798b9847 "xf85drm: de-duplicate drmParse{Platform.Host1x}{Bus,Device}Info"
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
[Eric: add the same fix to the free() below]
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
2019-03-12 11:55:31 +00:00
Emily Deng 56c21f877b libdrm: Fix issue about differrent domainID but same BDF
For multiple GPUs which has the same BDF, but has different domain ID,
the drmOpenByBusid will return the wrong fd when startx.

The reproduce sequence as below:
1. Call drmOpenByBusid to open Card0, then will return the right fd0, and the
fd0 is master privilege;
2. Call drmOpenByBusid to open Card1. In function drmOpenByBusid, it will
open Card0 first, this time, the fd1 for opening Card0 is not master
privilege, and will call drmSetInterfaceVersion to identify the
domain ID feature, as the fd1 is not master privilege, then drmSetInterfaceVersion
will fail, and then won't compare domain ID, then return the wrong fd for Card1.

Solution:
First loop search the best match fd about drm 1.4.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Emily Deng <Emily.Deng@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2019-02-22 16:02:12 -05:00
Eric Engestrom eba6609b7b xf86drm: fix return type for drmIsMaster()
Xserver has struct members named `bool`, which means the last commit
breaks its build with errors like this:

  error: two or more data types in declaration specifiers
  Bool bool;
       ^

Fix this by making it return a 0/1 integer, with the same semantic as
the boolean it was before.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=109587
Fixes: 17dfe3ac93 "xf86drm: Add drmIsMaster()"
Cc: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2019-02-08 18:52:36 +00:00
Christopher James Halse Rogers 17dfe3ac93 xf86drm: Add drmIsMaster()
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.

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.

This is useful for code that might get master by open()ing the drm device
while no other master exists, but can't call drmSetMaster itself because
it's not running as root or is in a container, where container-root isn't
real-root.

v2: Use the AUTH_MAGIC request rather than MODE_ATTACHMODE, as it's more
    clearly related to master status.

v3: [Emil] Don't expose internals, check for -EACCES.

Signed-off-by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> (v2)
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2019-02-07 17:43:01 +00:00
Emil Velikov ee798b9847 xf85drm: de-duplicate drmParse{Platform.Host1x}{Bus,Device}Info
The functions are virtually identical, fold them up.

v2: foo -> tmp_name (Eric)

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
2019-02-04 15:28:55 +00:00
Emil Velikov 3df8a7f01a xf86drm: fallback to MODALIAS for OF less platform devices
Some devices can lack OF data or it may not be available in the uevent
file. Fallback to the MODALIAS data in those cases.

We strip any leading "MODALIAS=.*:" thus the resulting information is
compatible with existing code in Mesa.

v2: foo -> tmp_name

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Tested-by: Lucas Stach <l.stach@pengutronix.de> (v1)
2019-02-04 15:26:32 +00:00
François Tigeot 8f2e09251e libdrm: Use DRM_IOCTL_GET_PCIINFO on DragonFly
It is a cleaner and less fragile way to get PCI IDs than the one
currently used by local DPorts patches.

Signed-off-by: François Tigeot <ftigeot@wolfpond.org>
2018-12-13 20:39:02 -05:00
François Tigeot 200e9e98a2 xf86drm: implement drmParseSubsystemType for DragonFly
Like on OpenBSD, the DragonFly BSD kernel only contains
pci drm drivers.

Signed-off-by: François Tigeot <ftigeot@wolfpond.org>
2018-12-13 20:39:02 -05:00
Eric Anholt 89700ab0aa drm: Attempt to parse SPI devices as platform bus devices.
For ARM systems with tinydrm displays attached to SPI, the bus name is
/spi but we have platform device info for the rest.  Fixes
eglInitialize() failures on hx8357d since the EGL_EXT_device_drm
changes.

Acked-by: Eric Engestrom <eric.engestrom@intel.com>
2018-11-19 20:36:13 -08:00
Eric Anholt 9b28c5aea3 Avoid hardcoded strlens in drmParseSubsystemType().
Having people count characters is error-prone, when we could just have
a computer do it.

Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
2018-11-19 20:36:02 -08:00
Thomas Hellstrom f839258341 libdrm: Allow dynamic drm majors on linux
To determine whether a device node is a drm device node or not, the code
currently compares the node's major number to the static drm major device
number.

This breaks the standalone vmwgfx driver on XWayland dri clients,
https://cgit.freedesktop.org/mesa/vmwgfx
and any future attempt to introduce dynamic device numbers for drm.

So instead of checking for the device major, instead check for the presence
of the /sys/dev/char/<major>:<minor>/device/drm directory.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
Acked-by: Dave Airlie <airlied@redhat.com>
2018-10-09 14:47:09 +02:00
Lucas De Marchi 26f9ce50e1 libdrm: annotate public functions
This was done with:
nm --dynamic --defined-only build/libdrm.so | \
	grep " T " | \
	grep -v _fini | grep -v _init | \
	cut -d' ' -f3 > /tmp/a.txt

while read sym; do
	read f func line _ <<<$(cscope -d -L -1 $sym)
	if [ ! -z "$f" ]; then
		sed -i "${line}s/^/drm_public /" $f
	fi
done < /tmp/a.txt

Then the alignment of function arguments were manually fixed all over.
The idea here will be to switch the default visibility to hidden so we
don't export symbols we shouldn't.

Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
2018-09-19 22:46:45 -07:00
Eric Engestrom 9030a0f453 xf86drm: rename "real_path" to "pci_path"
"real_path" was getting confusing when there are other *paths in the
same functions.

Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2018-09-05 18:28:23 +01:00
Eric Engestrom 564995316e xf86drm: merge get_normal_pci_path() into get_real_pci_path()
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2018-09-05 18:28:14 +01:00
Emil Velikov bcb9d976cd xf86drm: fallback to normal path when realpath fails
Earlier commit reworked our sysfs handling to use realpath.
Sadly that backfired since the Firefox sandboxing mechanism rejects
that. Despite the files/folders being in the allowed list, of the
sandboxing mechanism.

Oddly enough, the Chromium sandboxing doesn't complain about any of
this.

Since there are no Firefox releases with the fix, add a temporary
solution which falls back to the original handling.

Sadly, this won't work for virgl.

v2: drop return type - function cannot return NULL (Eric)

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107516
Fixes: a02900133b ("xf86drm: introduce a get_real_pci_path() helper")
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Tested-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
2018-08-24 13:37:33 +01:00
Mariusz Ceier 4519db23ef xf86drm: Fix error path in drmGetDevice2
In drmGetDevice2 when no local device is found or when
drm_device_has_rdev filters out all devices, *device might be left
uninitialized causing drmGetDevice2 to not return error - since
it's only returned when *device == NULL.

Above leads to crash in the firefox in system with amdgpu.

With this change firefox displays:

libGL error: MESA-LOADER: failed to retrieve device information
libGL error: unable to load driver: amdgpu_dri.so
libGL error: driver pointer missing
libGL error: failed to load driver: amdgpu
libGL error: MESA-LOADER: failed to retrieve device information
libGL error: unable to load driver: amdgpu_dri.so
libGL error: driver pointer missing
libGL error: failed to load driver: amdgpu

and doesn't crash.

Bugzilla: https://bugs.freedesktop.org/107384
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Mariusz Ceier <mceier+mesa-dev@gmail.com>
2018-07-30 12:21:32 +02:00
Emil Velikov 3988580e4c xf86drm: Add drmDevice support for virtio_gpu
The GPU almost exclusively lives on the PCI bus, so we expose it as a
normal PCI one.

This allows all existing drmDevice users to work without any changes.

One could wonder why a separate typeset is not introduced, alike say
host1x. Unlike host1x the PCI/platform distinction for virtio provides
no extra information. Plus if needed we can add the separate set at a
later stage.

Here are a few 'features' that virtio seems to be missing:
 - provides extra information on top the plaform devices
 - supports a range of GPU devices
 - is considered hardware description (DT)

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Tested-by: Robert Foss <robert.foss@collabora.com>
Reviewed-by: Robert Foss <robert.foss@collabora.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
2018-07-24 16:25:05 +01:00
Emil Velikov a02900133b xf86drm: introduce a get_real_pci_path() helper
Introduce a helper which gets the real sysfs path for the given pci
device.

In other words, instead opening the /sys/dev/char/*/device symlink, we
opt for the actual /sys/devices/pci*/*/

It folds three (nearly identical) snprintf's and paves the way of adding
extra devices (see next patch) a piece of pie.

v2: use a caller (on stack) provided real_path (Eric)

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Tested-by: Robert Foss <robert.foss@collabora.com> (v1)
Reviewed-by: Robert Foss <robert.foss@collabora.com> (v1)
Reviewed-by: Eric Engestrom <eric@engestrom.ch> (v1)
2018-07-24 16:24:45 +01:00
Emil Velikov 95b262f019 xf86drm: Allocate drmDevicePtr's on stack
Currently we dynamically allocate 16 pointers and reallocate more as
needed.

Instead, allocate the maximum number (256) on stack - the number is
small enough and is unlikely to change in the foreseeable future.

This allows us to simplify the error handling and even shed a few bytes
off the final binary.

v2:
 - add a define & description behind the magic 256
 - report error to strerr and skip when over 256 device nodes

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Tested-by: Robert Foss <robert.foss@collabora.com> (v1)
Reviewed-by: Robert Foss <robert.foss@collabora.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch> (v1)
2018-07-24 16:24:31 +01:00
Emil Velikov f808fee90d xf86drm: Fold drmDevice processing into process_device() helper
Don't duplicate the nearly identical code across the two call sites.
It improves legibility and the diff stat seems nice.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Tested-by: Robert Foss <robert.foss@collabora.com>
Reviewed-by: Robert Foss <robert.foss@collabora.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
2018-07-24 16:24:26 +01:00
Emil Velikov 56e72d3f2e xf86drm: introduce drm_device_has_rdev() helper
Currently we match the opened drmDevice fd with each drmDevice we
process.

Move that after all the devices are processed and folded, via the
drm_device_has_rdev(). This makes the code easier to follow and allows
us to unify the massive process loop across drmGetDevice2 and
drmGetDevices2. That in itself is coming with a later commit.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Tested-by: Robert Foss <robert.foss@collabora.com>
Reviewed-by: Robert Foss <robert.foss@collabora.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
2018-07-24 16:24:14 +01:00
Emil Velikov 7f52a0ebf7 xf86drm: drmGetDevice2: error out if the fd has unknown subsys
Currently one can open() any /dev node. If it's unknown
drmParseSubsystemType() will return an error.

Track that and bail as needed.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Tested-by: Robert Foss <robert.foss@collabora.com>
Reviewed-by: Robert Foss <robert.foss@collabora.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
2018-07-24 16:24:04 +01:00
Michel Dänzer 35615697f7 Always pass O_CLOEXEC when opening DRM file descriptors
Reviewed-by: Christian König <christian.koenig@amd.com>
2018-05-22 18:05:19 +02:00
Kevin Strasser f34b6942ec xf86drm: Be sure to closedir before return
removed in commit bb45ce4e3a

Adding it back as it is still needed in the case where we don't find a
match.

Signed-off-by: Kevin Strasser <kevin.strasser@intel.com>
Fixes: bb45ce4e3a "libdrm: Use readdir instead of readdir_r to
                             avoid build warnings"$
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
2018-05-21 15:06:48 +01:00
John Stultz bb45ce4e3a libdrm: Use readdir instead of readdir_r to avoid build warnings
Building libdrm under AOSP, we see the following build warning:
external/libdrm/xf86drm.c:2861:12: warning: 'readdir_r' is deprecated: readdir_r is deprecated; use readdir instead [-Wdeprecated-declarations]
    while (readdir_r(sysdir, pent, &ent) == 0 && ent != NULL) {
           ^

Building on Linux with glibc produces the same warning.
Thus, this patch replaces readdir_r with readdir.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=102031
Cc: Robert Foss <robert.foss@collabora.com>
Cc: Rob Herring <robh@kernel.org>
Cc: Stefan Schake <stschake@gmail.com>
Cc: John Stultz <john.stultz@linaro.org>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
[Emil Velikov: remove unused variables, Eric]
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
2018-03-22 16:47:47 +00:00
Eric Engestrom 0926f0af54 meson,configure: include config.h automatically
This will prevent any more missing `#include "config.h"` bug, at the
cost of having to recompile some files that didn't need to be when
changing build options.

Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2018-03-20 18:19:26 +00:00
Eric Engestrom 07585200e9 meson,configure: always define UDEV
Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
2018-03-20 14:31:14 +00:00
Chunming Zhou bde3b9b689 fix return value for syncobj wait
otherwise -ETIME is missed.

Signed-off-by: Chunming Zhou <david1.zhou@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
2018-02-07 11:23:01 +08:00
Bas Nieuwenhuizen b1e63d9ee6 drm: Fix 32-bit drmSyncobjWait.
Otherwise we get an EFAULT, at least on a 64-bit kernel.

Fixes: 2048a9e7 "drm: add drmSyncobjWait wrapper"
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
2018-02-06 18:15:32 +01:00
Keith Packard d4331dda5b drm: Add CrtcGetSequence and CrtcQueueSequence IOCTLs [v2]
These provide a crtc-id based interface to get the current sequence
(frame) number and to queue an event to be delivered at a specific sequence.

v2: Remove FIRST_PIXEL_OUT flag. This has been removed from the
    proposed kernel API

Signed-off-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2017-12-18 10:04:02 +10:00