aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote-tracking branch 'freedesktop/master' into aosp/masterJohn Stultz2018-04-131-46/+197
|\ | | | | | | | | | | | | This merges the freedesktop/master branch into aosp/master Change-Id: I3104d45924f67d37808154d04c15518394204478 Signed-off-by: John Stultz <john.stultz@linaro.org>
| * libdrm: Use readdir instead of readdir_r to avoid build warningsJohn Stultz2018-03-221-19/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * meson,configure: include config.h automaticallyEric Engestrom2018-03-201-3/+0
| | | | | | | | | | | | | | | | | | 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>
| * meson,configure: always define UDEVEric Engestrom2018-03-201-4/+4
| | | | | | | | | | | | Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com> Reviewed-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
| * fix return value for syncobj waitChunming Zhou2018-02-061-1/+1
| | | | | | | | | | | | | | otherwise -ETIME is missed. Signed-off-by: Chunming Zhou <david1.zhou@amd.com> Reviewed-by: Christian König <christian.koenig@amd.com>
| * drm: Fix 32-bit drmSyncobjWait.Bas Nieuwenhuizen2018-02-061-1/+1
| | | | | | | | | | | | | | | | 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>
| * drm: Add CrtcGetSequence and CrtcQueueSequence IOCTLs [v2]Keith Packard2017-12-171-0/+37
| | | | | | | | | | | | | | | | | | | | | | 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>
| * drm: Add drmSyncobjReset & drmSyncobjSignal wrappers.Bas Nieuwenhuizen2017-12-171-0/+26
| | | | | | | | | | | | | | anv already uses the ioctls but does not use libdrm, so these were not wrapped yet. Signed-off-by: Dave Airlie <airlied@redhat.com>
| * drm/syncobj: fix some whitespace issuesDave Airlie2017-10-251-19/+19
| | | | | | | | | | | | These had tabs, just remove them. Signed-off-by: Dave Airlie <airlied@redhat.com>
| * drm: add drmSyncobjWait wrapperMarek Olšák2017-10-121-0/+22
| | | | | | | | Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
| * xf86drm: continue with next device if drmProcessUsbDevice failsEmil Velikov2017-07-201-1/+1
| | | | | | | | | | | | | | | | Analogous to previous commit (and the rest of the codebase), simply discard the device if we cannot parse it. Fixes: f8484ccbd12 ("xf86drm: Add USB support") Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
| * xf86drm: continue after drmProcessPlatformDevice failureGurchetan Singh2017-07-201-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On ChromeOS devices, readdir() processes the directory in the following order: -NAME- -TYPE- . n/a .. n/a vgem n/a card1 DRM_BUS_PLATFORM renderD129 DRM_BUS_PLATFORM card0 DRM_BUS_PCI renderD128 DRM_BUS_PCI controlD64 DRM_BUS_PCI In drmGetDevices2, after drmProcessPlatformDevice fails for /dev/dri/card1, we don't process the remaining directory entries. As such, Vulkan fails to initialize since Mesa uses drmGetDevices2. To fix this, continue if drmProcessPlatformDevice fails. Fixes: 7b1f37f474d ("xf86drm: Add platform and host1x bus support") Reviewed-by: Emil Velikov <emil.velikov@collabora.com> [Emil: correct the host1x platforms as well] Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
| * Remove redundant memclearcoypu2017-07-071-2/+0
| | | | | | | | | | | | drmMalloc will zero out the memory for us Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
| * libdrm: add drm syncobj create/destroy/import/exportDave Airlie2017-06-281-0/+81
| | | | | | | | | | | | | | These ioctls are now in drm next so add the first set of libdrm APIs. Reviewed-by: Eric Anholt <eric@anholt.net> Signed-off-by: Dave Airlie <airlied@redhat.com>
| * Fix stray caller of drmCompareDevicesAdam Jackson2017-05-041-1/+1
| | | | | | | | Signed-off-by: Adam Jackson <ajax@redhat.com>
| * Export drmDevicesEqualAdam Jackson2017-05-041-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | drmCompareBusInfo was almost this already, but it wasn't exported, its name didn't match its functionality, and while it almost looks like it was usable for sorting due to memcmp it wouldn't work if you had multiple bus types. I don't really want to think about defining a sensible sort order for bus types, so let's at least make it less of a trap for the caller. Invert its boolean sense to be 'true if equal', rename it to describe the types it actually operates on, and export. Reviewed-by: Eric Anholt <eric@anholt.net> Reviewed-by: Emil Velikov <emil.velilkov@collabora.com> Signed-off-by: Adam Jackson <ajax@redhat.com>
| * xf86drm: remove memory leaks in drmGetBusid/drmGetReservedContextListSeung-Woo Kim2017-04-031-6/+12
| | | | | | | | | | | | | | | | | | In error path of drmGetBusid() and drmGetReservedContextList(), there are memory leaks for error path. So this removes them. Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com> Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com> Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
* | libdrm: Avoid additional drm open closeandroid-p-preview-1android-o-mr1-iot-preview-8android-o-mr1-iot-preview-7android-n-iot-release-lg-thinq-wk7Prabhanjan Kandula2018-01-251-2/+2
|/ | | | | | | | Avoid additional drm device open and close. Bug: 72380158 Change-Id: I9475a23bbd1e011e637ece75321e3cda1e117e7e CRs-fixed: 2135104
* xf86drm: Reuse sysfs_uevent_get()Thierry Reding2017-01-201-48/+18
| | | | | | | | | | | | Recent patches for USB, platform and host1x bus support introduced the sysfs_uevent_get() function that provides a generic way of parsing the sysfs uevent file that is associated with each device in Linux. Open-coded variants of this still exist in other places, so make those reuse the new function to remove some code duplication. Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com> Signed-off-by: Thierry Reding <treding@nvidia.com>
* xf86drm: Add platform and host1x bus supportThierry Reding2017-01-201-0/+300
| | | | | | | | | | | | | | | | | | | | | | | 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>
* xf86drm: Add USB supportThierry Reding2017-01-201-0/+175
| | | | | | | | | | | | | | | | | 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>
* xf86drm: Factor out drmDeviceAlloc()Thierry Reding2017-01-201-27/+51
| | | | | | | | | 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>
* xf86drm: fix null termination of string bufferTaro Yamada2017-01-161-2/+2
| | | | | | | | | | | | | 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>
* xf86drm: Fix indentationThierry Reding2017-01-121-2/+2
| | | | | | | | 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>
* xf86drm: don't fatal on per device error in drmGetDevice[s]2Jonathan Gray2016-12-241-2/+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>
* xf86drm: add a non-sysfs version of drmGetDeviceNameFromFd2Jonathan Gray2016-12-241-2/+42
| | | | | | | | | | 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>
* xf86drm: adjust device node path for minor baseJonathan Gray2016-12-241-4/+12
| | | | | | | | | | | | 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>
* xf86drm: fix sign-compare warningGrazvydas Ignotas2016-12-121-1/+1
| | | | | | | | | 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>
* xf86drm: implement an OpenBSD specific drmGetDevice2Jonathan Gray2016-12-051-0/+62
| | | | | | | | | | | | | | | | 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>
* xf86drm: implement drmParsePciBusInfo for OpenBSDJonathan Gray2016-12-051-0/+24
| | | | | | | | | | | 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>
* xf86drm: implement drmParsePciDeviceInfo for OpenBSDJonathan Gray2016-12-051-0/+41
| | | | | | | | | | 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>
* xf86drm: implement drmParseSubsystemType for OpenBSDJonathan Gray2016-12-051-0/+2
| | | | | | | | | | 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>
* xf86drm: implement drmGetMinorNameForFD for non-sysfsJonathan Gray2016-12-051-1/+34
| | | | | | | | | | | 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>
* xf86drm: introduce drmGetDevice[s]2Emil Velikov2016-12-051-8/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* xf86drm: parse the separate sysfs files for vendor... infoEmil Velikov2016-12-051-4/+54
| | | | | | | | | | | | | | | | | | | | 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>
* xf86drm: add plumbing to not retrieve PCI device revisionEmil Velikov2016-12-051-5/+9
| | | | | | | | | | 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>
* xf86drm: use maj/min in drmParsePciDeviceInfo()Emil Velikov2016-12-051-7/+6
| | | | | | | | 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>
* xf86drm: introduce drmGetDeviceNameFromFd2Emil Velikov2016-11-221-0/+51
| | | | | | | | | | | | | 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>
* xd86drm: read more than 128 bytes of uevent in drmParsePciBusInfoEmil Velikov2016-11-141-2/+2
| | | | | | | | | | | | | | | 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>
* Silence runtime complaints on platform devicesEric Anholt2016-10-211-2/+0
| | | | | | | | | 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>
* Return an -ENODEV from drmGetDevice() when no device was found.Rob Herring2016-10-211-0/+2
| | | | | | | | | | | 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>
* drm: fix drmFreeDevices memory leak on multi GPU setupsQiang Yu2016-07-201-2/+3
| | | | | | | | | 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>
* drm: drmGetDevice return correct device on multi GPU setupsQiang Yu2016-07-201-5/+15
| | | | | | | | | | | | | | | | | 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>
* pull in sys/sysmacros.h when availableMike Frysinger2016-07-061-2/+5
| | | | | | | | | 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>
* xf86drm.c: Fix mix of tabs and spacesJan Vesely2016-07-061-723/+721
| | | | Remove whitespace at the end of line.
* xf86drm: ensure proper alignment of pointers in drmProcessPciDeviceNicolai Hähnle2016-06-101-1/+1
| | | | | | | | 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>
* drm: fix multi GPU drmGetDevices only return one deviceQiang Yu2016-06-061-1/+4
| | | | | | | | | | | | 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>
* xf86drm: Fix spelling mistakesEric Engestrom2016-04-071-1/+1
| | | | | Signed-off-by: Eric Engestrom <eric@engestrom.ch> Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
* xf86drm: Bound strstr() to the allocated dataDamien Lespiau2016-01-221-1/+2
| | | | | | | | | | | 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>
* xf86drm: Handle unrecognized subsystems safely in drmGetDevice[s]()Matt Roper2015-10-201-2/+2
| | | | | | | | | | | | | 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>