summaryrefslogtreecommitdiff
path: root/src/intel_device.c
AgeCommit message (Collapse)Author
2016-07-14intel: Fix fd (and mem) leak when intel_scrn_create failsHans de Goede
The probe functions in intel_module.c call intel_open_device() before calling intel_scrn_create(), but if the later fails because of e.g. an allocation failure they were not cleaning up the resources claimed by intel_open_device(), esp. leaking the fd is a problem because this breaks the fallback to the modesetting driver. This commit fixes this by adding a intel_close_device() cleanup function and calling that when intel_scrn_create() fails. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2015-07-31intel: Refactor i915.ko loading supportChris Wilson
Different OS name the i915 KMS module differently, so make it convenient for us to be able to feed in the right name, or even just try them all and pick the first one that exists! Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-03-25Use AC_HEADER_MAJOR to find how to include major()Chris Wilson
We need to include <sys/mkdev.h> on Solaris. Reported-by: Richard Palo <richard@netbsd.org> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89763 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-10Enable support for render-nodes by default with DRI3Chris Wilson
DRI3 can use render nodes if provided by the kernel, so enable it. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-10dri2: Disable integration with render-nodesChris Wilson
The executive decision has been made to render DRI2 inoperable with render-nodes, so keep on passing the master device path to clients. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-02-10intel: Fix checking for compatible render nodeChris Wilson
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-10-08intel: Store pointer to struct intel_deviceChris Wilson
Beware the barbarians at the gate, who invade and steal your ScrnInfoPtr and its Entity from underneath you. In some configurations, we lose access to the struct intel_device stored on the Entity after initialisation, causing havoc. Workaround this by storing the intel_device that we open in our driverPrivate. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-08-31intel: Only include sys/mount.h on LinuxChris Wilson
We only automount debugfs for Linux, but sys/mount.h on BSD has unmet dependencies breaking the build. Reported-by: Jonathan Gray <jsg@jsg.id.au> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-08-26intel: Limit read to always fit in the bufferChris Wilson
Reported-by: Zdenek Kabelac <zkabelac@redhat.com> Suggested-by: Zdenek Kabelac <zkabelac@redhat.com> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-08-18intel: Only dump debugfs on linuxChris Wilson
Other platforms are not going to have the same debug infrastructure, nor even the same mount(2). Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-08-09intel: If need be, try mounting debugfsChris Wilson
If we require debugging information from debugfs and we cannot find it, silently mount it and dump the information we need. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-08-09intel: Log open clients on master takeover failChris Wilson
If we fail to claim the DRM device as master, dump /debugfs/.../clients so that we can check to see who failed to drop master for us. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-07-23sna: Disable rendering with the DRM device whilst away from VTChris Wilson
As root, X gets away with many things, including submitting commands to the DRM device whilst it is no longer authorised (i.e. when it has relinquished master to another client across a VT switch). In the non-root future, if we attempt to use the device whilst unauthorized the rendering will be lost and we will mark the device as unusable. So flush our render queue to the device around a VT switch. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-24intel: Wait for our expected device node to appearChris Wilson
If the path we want to open for the KMS device is not yet available, wait a short while and try again. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=80397 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-24intel: Wait for the DRM device to loadChris Wilson
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=80397 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-13intel: Check that the fd points to i915 after authorisingChris Wilson
The call to GETPARAM requires either a rendernode or authorisation. Therefore we can only assert that the fd is a valid i915 handle after authorise() and not before. Reported-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-06sna: Report KMS driver versionChris Wilson
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-02intel: Clear structs for valgrindChris Wilson
When probing the module, clear structs passed into unknown ioctls to keep valgrind quiet. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-02intel: Add common routines and configure probing for DRI3Chris Wilson
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-04-09intel: If a non-root user starts X, don't release masterChris Wilson
SET_MASTER and DROP_MASTER are only available to the root user. If we are started as an ordinary user, and we are master by virtue of being the first user of the device, never release our fd or master. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-03-20intel: Do not close server fdsChris Wilson
If we are given an fd by the Xserver, then it is not our responsibility to close it during CloseScreen. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Hans de Goede <hdegoede@redhat.com>
2014-03-20intel: Refactor finding device path if unknownChris Wilson
Since we already lookup the device path if we do not know it after opening the fd, we can remove the special case along the legacy PCI probe path. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-03-18intel: Don't close the fd on probe failure if it is server managedHans de Goede
I hit this corner case when testing a single X server spanning both intel gfx + an usb display link adapter driven by xf86-video-modesetting. In this scenario the intel driver gets its platformProbe method called first, and if it then closes the server managed fd, the xf86-video-modesetting gets EBADFD errors. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2014-03-18uxa: Add support for server managed fds (via intel_device)Chris Wilson
Based on the patch by Hans de Goede, this removes the handling of drmOpen() and DRM_MASTER from within uxa and instead uses the common routines. This reduces the duplicate code from within uxa, and enables new features such as server managed fds. Cc: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-03-13intel: Fallback to drmGetDeviceNameFromFd()Chris Wilson
If we are not supplied the path, call the libdrm function to search for the canonical name for our device. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-03-11intel: Protect against a NULL platform device with server fdChris Wilson
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-03-10intel: Supply a fallback guess for the device pathChris Wilson
If for some reason we have an fd, but no device path, use the likely default path (derived from and validated against the major/minor of the open device fd). Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-03-10intel: Add support for server managed fdsHans de Goede
In the post-modern world, the platform device nodes are handed to a non-privileged Xserver by systemd/logind. We can then query the core for our assigned fd rather than try to open the device for ourselves (which would fail when trying to obtain DRM_MASTER status). A consequence is that we then do not directly control DRM_MASTER status and must act as a delegate of systemd. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2014-02-15intel: export fd_set_cloexec / fd_set_nonblockHans de Goede
Allow fd_set_cloexec / fd_set_nonblock to be used outside of intel_device.c. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2014-02-15intel: Fix fd_set_nonblockHans de Goede
O_NONBLOCK is a status flag not a descriptor flag, so F_GETFL / F_SETFL should be used to modify it. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2014-01-17intel: Silence a compiler warning (-Wshadow)Chris Wilson
intel_device.c: In function 'intel_entity_get_devid': intel_device.c:82:32: warning: declaration of 'index' shadows a global declaration [-Wshadow] Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-10-28sna: Quieten a couple of valgrind warnings about unknown ioctlsChris Wilson
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-10-05intel: Filter out the control bit from the device minorChris Wilson
When computing the render node for the device, filter out the potential control node. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-10-03intel: Allow opening the device only through platform informationChris Wilson
Only fail to open the device based on the PCI address, if and only if we do not have sufficient platform information to find the correct system device. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-10-03intel: Handle fallback probing without match_dataChris Wilson
One extreme fallback path through the xf86PlatformProbe results in a call without any match data. As we have a device by this point, we can simply do a reverse match. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-10-03intel: Remove dependence upon having PciInfoChris Wilson
After some probing mechanisms, we may end up with a valid device without knowing its PCI address a priori. Having a valid device, we can just query it for the correct device id, and can safely abort any path that requires PCI information that we don't have. (Those paths are not valid under such hosting anyway - if it may be required, we could reconstruct the address.) Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-10-03intel: Querying device attributes must be non-NULLChris Wilson
Check first for a NULL platform device before querying the attributes or else suffer a segfault during PCI probing. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-10-03intel: Fix fallout from accident push of ODEV_ATTRIB_FDChris Wilson
This is WIP for passing along a hosted fd. It wasn't meant to be pushed along with the bug fix this morning. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-10-02intel: Query platform fdChris Wilson
Under a compositor, we wish to use the pre-authorized fd passed to us by the host, stashed away in the platform device. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-10-02intel: Pass the platform device along to the open routinesChris Wilson
This allows us to pass along more metadata along with the platform device in future. Currently we pass the device path, but in a hosted environment we should be passing along the authorized fd from the host. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-09-18intel: Compile fixes for base install of SLED11.sp3Chris Wilson
Highlights of that distribution include xorg-xserver-1.6.5, kernel 3.0.76 and gcc-4.3. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-09-07Revert "sna: Add XMir support"Chris Wilson
This reverts commit 42d94356f65972eb7fb8991234a4e9388c4c2031. Ordered-by: The Management.
2013-09-04sna: Add XMir supportChris Wilson
With lots of updates by Christopher James Halse Rogers as he updated the XMir API - but now supposedly frozen! "<RAOF> ickle: I think the xmir api should be pretty much stable now, barring people coming up with more awesome ways of doing things." Signed-off-by: Christopher James Halse Rogers <raof@ubuntu.com> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-08-31sna: Open the device non-blockingChris Wilson
This is essential to prevent deadlocks when running with ZaphodHeads. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-08-23intel: Add experimental rendernode supportChris Wilson
Render nodes allow clients full access to off-screen rendering and GPU offload, without assuming any master responsiblities (for device and display management). As they have a more limited interface, they can be used in a more permissive manner. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-08-09intel: Disable incompatible features whilst hostedChris Wilson
Start adding the infrastructure to disable direct hardware access if X is being run under a system compositor (aka "hosted"). Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-02intel: Move the validation of the KMS device into the open routineChris Wilson
Currently we leak the fd should we open the device node and decide that is not a GEM/KMS kernel driver. The simplest way to perform the cleanup upon failure is to move the checking for GEM/KMS into the device open routine. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-06-30intel: Fix failure code for reporting !drmCheckModesetingSupportedChris Wilson
The new function returns the fd, not a Bool, so the error code must now be -1. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-06-30intel: replace direct ioctl use with drm{Set, Drop}MasterJonathan Gray
Use drmSetMaster/drmDropMaster instead of calling the ioctls directly. Fixes compilation on OpenBSD where these ioctls aren't defined. Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
2013-06-30sna: Store the path used to open the device and pass to DRIChris Wilson
Avoid having to search the device tree once again in order to simply recover the path we used to open the device. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>