summaryrefslogtreecommitdiffstats
path: root/sys/dev/pci/drm/drm_drv.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Refactor klist insertion and removalvisa2020-12-251-4/+4
| | | | | | | | | | | | Rename klist_{insert,remove}() to klist_{insert,remove}_locked(). These functions assume that the caller has locked the klist. The current state of locking remains intact because the kernel lock is still used with all klists. Add new functions klist_insert() and klist_remove() that lock the klist internally. This allows some code simplification. OK mpi@
* Revise the initialization of the DRM Linux emulation layer such that wekettenis2020-11-141-4/+7
| | | | | | | | only call it when the first drm(4) instance attaches. Also add a cleanup function that gets called when the last drm(4) instance detaches. This makes sure that statically initialized IDR instances always work. ok jsg@, semarie@
* test for gem_size > 0 on pool_destroy() matching pool_init() calljsg2020-07-111-1/+2
| | | | ok kettenis@
* update drm to linux 5.7jsg2020-06-081-337/+1345
| | | | | | | | | | adds kernel support for amdgpu: vega20, raven2, renoir, navi10, navi14 inteldrm: icelake, tigerlake Thanks to the OpenBSD Foundation for sponsoring this work, kettenis@ for helping, patrick@ for helping adapt rockchip drm and many developers for testing.
* Extend drmkqfilter() to support EVFILT_READ and match drmpoll() behavior.mpi2020-05-201-9/+58
| | | | | | | | Locking `event_lock' in filt_drmread() is currently commented out as it requires some refactoring to use proper 'struct drm_minor' like upstream. That said, it is fine as long as all the code is run under KERNEL_LOCK(). ok visa@
* Abstract the head of knote lists. This allows extending the lists,visa2020-04-071-3/+3
| | | | | | for example, with locking assertions. OK mpi@, anton@
* Properly implement the page fault handler for CMA GEM buffers and actuallykettenis2020-03-041-3/+1
| | | | | | make drm(4) attach to rkdrm(4). This makes KMS work on the RK3399 SoC. ok patrick@
* Clean up attachment of PCI drm(4) devices and make the PCI aspects optional.kettenis2020-03-031-47/+41
| | | | ok jsg@
* Replace field f_isfd with field f_flags in struct filterops to allowvisa2020-02-201-2/+2
| | | | | | adding more filter properties without cluttering the struct. OK mpi@, anton@
* remove some unneeded includesjsg2020-01-051-7/+1
|
* Remove unneeded #include <sys/ttycom.h>.visa2020-01-051-2/+1
| | | | OK jsg@
* remove unused TIOCSPGRP / TIOCGPGRP cases in drmjsg2020-01-041-5/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | async/SIGIO use likely came from DR1 context swapping for the "gamma" driver for 3dlabs GMX 2000, removed from the old upstream drm cvs repository in 2004: commit 1430163b4bbf7b00367ea1066c1c5fe85dbeefed Author: Dave Airlie <airlied@linux.ie> Date: Sun Aug 29 12:04:35 2004 +0000 Drop GAMMA DRM from a great height ... linux in 2005: commit 1fad99499afdd2730adb1d53413b91580b1f0662 Author: Dave Airlie <airlied@starflyer.(none)> Date: Fri Aug 5 22:40:34 2005 +1000 drm: remove the gamma driver and further remaining async bits removed from linux in 2013 with commit b0e898ac555e96e7863a5ee95d70f3625f1db5e2 Author: Daniel Vetter <daniel.vetter@ffwll.ch> Date: Thu Aug 8 15:41:23 2013 +0200 drm: remove FASYNC support pointed out by claudio@ ok visa@ kettenis@
* Use C99 designated initializers with struct filterops. In addition,visa2019-12-311-3/+7
| | | | | | make the structs const so that the data are put in .rodata. OK mpi@, deraadt@, anton@, bluhm@
* convert infinite msleep(9) to msleep_nsec(9)jsg2019-12-301-5/+5
| | | | ok mpi@
* Implement a few Linux compat ACPI interfaces and enable the ACPI supportkettenis2019-08-181-1/+15
| | | | | | code in radeon(4) and amdgpu(4). ok jsg@
* enable DRIVER and KMS debug messages when DRMDEBUG is definedjsg2019-07-301-1/+6
| | | | leave out CORE as it is quite noisy
* Remove old unused drm_debug_flag var and make drm_debug (used byjsg2019-07-251-4/+6
| | | | | | | drm_print) a var instead of a define in a header. Makes it easier to change without rebuilding everything and allows the value to be changed at runtime via ddb.
* Improve the interaction between efifb(4), inteldrm(4) and radeondrm(4)kettenis2019-05-041-7/+7
| | | | | | | | | | | | | | | | when we have a serial console by introducing the notion of a "primary" graphics device. The primary graphics device is the one set up and used by firmware (BIOS, UEFI). The goal is to make sure that wsdisplay0 and drm0 reliably attach to the primary graphics device such that X works out of the box even if you have multiple cards or if you are using a serial console. This also fixes the situation where inteldrm(4) or radeondrm(4) would take over the console on UEFI systems even if the kernel was booted with a serial console. ok jsg@
* Allow non-root users to become master when they are the first to open a drmkettenis2019-05-021-8/+4
| | | | | | | device. This matches what Linux does and is a first step towards running X without setuid or root priviliges. ok jsg@
* Make sure only "primary" clients can become master.kettenis2019-04-281-2/+3
| | | | ok jsg@
* Update shared drm code, inteldrm(4) and radeondrm(4) from linux 4.4 tojsg2019-04-141-596/+171
| | | | | | | | | | | | | | | | | | | linux 4.19.34. Adds support for more Intel hardware: Broxton/Apollo Lake (was is_preliminary in 4.4) Amber Lake (another Kaby Lake refresh) Gemini Lake Coffee Lake Whiskey Lake Cannon Lake (though no hardware with Intel graphics ever shipped) Ice Lake (alpha support, hardware not released) This does not add support for new radeon hardware on the AMD side as newer radeons have a different kernel driver (amdgpu). Thanks to the OpenBSD Foundation for sponsoring this work, kettenis@ for helping and a bunch of other developers for testing.
* Implement DRI3/prime support. This allows graphics buffers to be passedkettenis2018-06-251-5/+8
| | | | | | | | between processes using file descriptors. This provides an alternative to eporting them with guesable 32-bit IDs. This implementation does not (yet) allow sharing of graphics buffers between GPUs. ok mpi@, visa@
* add pci_is_root_bus()jsg2018-01-311-1/+2
|
* add drm_invalid_op()jsg2018-01-301-1/+7
|
* add kqueue support to drm(4) by making the drm_sysfs_hotplug_event()robert2018-01-131-1/+51
| | | | | | | | | | | | available on OpenBSD well and by notifying listeners of a device state change using EVFILT_DEVICE and NOTE_CHANGE. drm_sysfs_hotplug_event() gets called when a state change of the device occured, like an hdmi cable has been plugged, this in the future will be used by the modesetting xorg driver to notify desktop environments via randr events to update their screen configuration ok kettenis@
* Implement drm_pci_alloc() and drm_pci_free() and use them to reduce thekettenis2017-07-191-1/+29
| | | | diffs with Linux.
* Ignore entries with specific PCI subvendor/subdevice such that we don'tkettenis2017-07-041-2/+4
| | | | | | | | inadvertedly match the Intel HD Graphics P4000 as a "Quanta transcode" device. Thanks to Joe Gidi for figuring out that I inadvertedly brought this back. Hopefully fixing it this way prevents it from happening again.
* Update inteldrm(4) to code based on Linux 4.4.70. This brings us support forkettenis2017-07-011-5/+13
| | | | | | | | Skylake and Cherryview and better support for Broadwell and Valleyview. Also adds MST support. Some tweaks to the TTM code and radeondrm(4) to keep it working with the updated generic DRM code needed for inteldrm(4). Tested by many.
* Add noop drm SET_MASTER and DROP_MASTER ioctls. This will allowjsg2016-12-011-1/+7
| | | | | | | reducing the local diff in libdrm. We only handle a single master as xorg privdrop has already occurred at the point where the ioctls are issued.
* Add a new DRM_IOCTL_GET_PCIINFO ioctl to have a non driver specific wayjsg2016-11-251-1/+22
| | | | | | | | | | | | | to get pci device ids from a drm fd as an ordinary user. This will be used to provide non-sysfs implementations of functions in libdrm. These functions are required for Mesa >= 13. The ioctl number used is the same as the DRM_IOCTL_ADD_MAP ioctl which was removed when we removed DRI1 support. This was chosen to not collide with new ioctls from linux. ok kettenis@ ok mpi@ on an earlier version
* all pools have their ipl set via pool_setipl, so fold it into pool_init.dlg2016-09-151-3/+2
| | | | | | | | | | | | | | | | | | | | | | the ioff argument to pool_init() is unused and has been for many years, so this replaces it with an ipl argument. because the ipl will be set on init we no longer need pool_setipl. most of these changes have been done with coccinelle using the spatch below. cocci sucks at formatting code though, so i fixed that by hand. the manpage and subr_pool.c bits i did myself. ok tedu@ jmatthew@ @ipl@ expression pp; expression ipl; expression s, a, o, f, m, p; @@ -pool_init(pp, s, a, o, f, m, p); -pool_setipl(pp, ipl); +pool_init(pp, s, a, ipl, f, m, p);
* pool_setipl for cardbus and drm pools.dlg2016-08-241-1/+2
| | | | ok kettenis@
* Get rid of some infrastrcuture that is now obsolete and synchronize some ofkettenis2016-04-081-129/+12
| | | | | | the data structures in drmP.h with Linux 3.14. ok jsg@
* Split out the generic GEM code (like Linux did) and switch it over tokettenis2016-04-051-540/+19
| | | | | | | the vma offset manager. This brings us a little bit more isolation between applications as GEM buffers are now tied to a specific /dev/drmX clone. ok jsg@
* Improve Linux PCI compatibility code.kettenis2016-02-051-4/+10
|
* Use uiomove(9) instead of uiomovei(9). From Martin Natano.kettenis2016-01-091-2/+2
|
* Add pledge "drm", which allows a subset of the drm(4) ioctls. These arekettenis2016-01-061-1/+37
| | | | | | | | | | | | | basically only the ioctls that Linux allows on the so-called "render nodes". For now, it also allows DRM_IOCTL_GET_MAGIC and DRM_IOCTL_GEM_OPEN, as we don't implement prime/dma-buf yet in OpenBSD. That still leaves a big gaping hole, so they will be removed as soon as we can. Based on a diff by robert@, who did all the heavy lifting by studying the behaviour of the chromium GPU process, with some further suggestions by deraadt@. ok jsg@, deraadt@, robert@
* Provide a minimal implementation of the Linux vga_get/vga_put API and use itkettenis2015-12-311-1/+2
| | | | | | | | | | | | | in inteldrm(4). The Intel integrated graphics device has a major design flaw where it needs legacy VGA io access to disable VGA mode completely. This only works if legacy VGA io routing is setup such that it actually reaches the IGD. This typically isn't the case if the primary VGA device is a discrete graphics device. To make sure we don't whack that device we have to temporarily route legacy VGA io access to the IGD. Fixes the "black screen" issue reported by Timo Myrra and others.
* Advertise support for DRM version 1.4. We have support for all the necessarykettenis2015-12-201-2/+2
| | | | | | | | features, and some code (such as the Xorg modesetting driver) actually checks the version. With this change the PCI-based probe method in that driver works. ok jsg@
* Remove drm_gem_object_alloc() and associated infrastructure. It's unused andkettenis2015-11-221-29/+1
| | | | has been removed upstream as well.
* The drm irq stuff isn't actually used on OpenBSD. Using the PCI devicekettenis2015-11-211-3/+1
| | | | | | | | | interrupt line register as the irq number doesn't really work as the contents of that register might be 0, and the code has checks for non-zero irq numbers in places. Insteadmake drm_dev_to_irq() return -1, which is an obviously bogus, but non-zero value. This should fix inteldrm(4) on recent Apple hardware.
* Update drm_irq.c to the version from Linux 3.14.52.kettenis2015-09-261-31/+35
| | | | | | Disable the DRM_IOCTL_IRQ_BUSID and DRM_IOCTL_CONTROL ioctls. These are legacy ioctls for DRI1 support, which we no longer support on OpenBSD.
* Update inteldrm to the code from Linux 3.14.52 (which corresponds tokettenis2015-09-231-14/+95
| | | | | | | | | | | | | | | | | commit 48f8f36a6c8018c2b36ea207aaf68ef5326c5075 on the linux-3.14.y branch of the linux-stable tree). This brings preliminary support for the GPU on Intel's Broadwell CPUs. Don't expect these to work perfectly yet. There are some remaining issues with older hardware as well, but no significant regressions have been uncovered. This also updates some of drm core code. The radeondrm code remains based on Linux 3.8 with some minimal canges to adjust to changes in the core drm APIs. Joint effort with jsg@, who did the initial update of the relevant drm core bits. Committing this early to make sure it gets more testing and make it possible for others to help getting the remaining wrinkles straightened out.
* We actually need an interrupt-safe allocator here, as we call pool_put()kettenis2015-09-061-2/+2
| | | | with a mutex held, so we can't have it sleep.
* Make drm ioctls table driven. Further reduces the diff to linux.jsg2015-04-171-133/+211
| | | | ok kettenis@
* Convert remaining drm ioctl implementation functions to return Linux-stylekettenis2015-04-151-24/+26
| | | | | | negative errno values. ok jsg@
* First step towards making uiomove() take a size_t size argument:miod2015-02-101-2/+2
| | | | | | | - rename uiomove() to uiomovei() and update all its users. - introduce uiomove(), which is similar to uiomovei() but with a size_t. - rewrite uiomovei() as an uiomove() wrapper. ok kettenis@
* Remove DRM_LOCK macros, rename dev_lock to struct_mutex and directlyjsg2015-02-101-38/+38
| | | | call linux style lock functions where these macros were used.
* fix the build when DRMDEBUG is definedjsg2014-09-241-2/+2
|
* Replace all queue *_END macro calls except CIRCLEQ_END with NULL.doug2014-09-131-3/+2
| | | | | | | | CIRCLEQ_* is deprecated and not called in the tree. The other queue types have *_END macros which were added for symmetry with CIRCLEQ_END. They are defined as NULL. There's no reason to keep the other *_END macro calls. ok millert@