Commit Graph

19 Commits

Author SHA1 Message Date
Jean-Sébastien Pédron
85cfd0daea drm: Fix dev->ioctl_count references leak
This fixes the following error:
kernel: error: [drm:pid1167:drm_release] *ERROR* Device busy: 2

Because of that, drm_lastclose() was not called, leading to a few memory
leaks once the driver was unloaded.

MFC after:	1 week
2016-03-11 18:59:15 +00:00
Jean-Sébastien Pédron
740be6d755 drm/i915: Update to match Linux 3.8.13
This update brings initial support for Haswell GPUs.

Tested by:	Many users of FreeBSD, PC-BSD and HardenedBSD
Relnotes:	yes
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D5554
2016-03-08 20:33:02 +00:00
Jean-Sébastien Pédron
455fa6518a drm: Update the device-independent code to match Linux 3.8.13
This update brings few features:
    o  Support for the setmaster/dropmaster ioctls. For instance, they
       are used to run multiple X servers simultaneously.
    o  Support for minor devices. The only user-visible change is a new
       entry in /dev/dri but it is useless at the moment. This is a
       first step to support render nodes [1].

The main benefit is to greatly reduce the diff with Linux (at the
expense of an unreadable commit diff). Hopefully, next upgrades will be
easier.

No updates were made to the drivers, beside adapting them to API
changes.

[1] https://en.wikipedia.org/wiki/Direct_Rendering_Manager#Render_nodes

Tested by:	Many people
MFC after:	1 month
Relnotes:	yes
2015-03-17 18:50:33 +00:00
Konstantin Belousov
47671d1bab An update for the i915 GPU driver, which brings the code up to Linux
commit 4d93914ae3db4a897ead4b.  Some related drm infrastructure
changes are imported as needed.

Biggest update is the rewrite of the i915 gem io to more closely
follow Linux model, althought the mechanism used by FreeBSD port is
different.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 month
2015-01-21 16:10:37 +00:00
Eygene Ryabinkin
317d2b1e5c DRM2: fix off-by-one overflow in ioctl processing
Call to the driver-specific ioctl used to process ioctl number
that will lead to the out-of-bounds access to the ioctl handler
array.

PR:		193367
Approved by:	kib
MFC after:	1 week
2014-11-28 12:14:59 +00:00
Hans Petter Selasky
af3b2549c4 Pull in r267961 and r267973 again. Fix for issues reported will follow. 2014-06-28 03:56:17 +00:00
Glen Barber
37a107a407 Revert r267961, r267973:
These changes prevent sysctl(8) from returning proper output,
such as:

 1) no output from sysctl(8)
 2) erroneously returning ENOMEM with tools like truss(1)
    or uname(1)
 truss: can not get etype: Cannot allocate memory
2014-06-27 22:05:21 +00:00
Hans Petter Selasky
3da1cf1e88 Extend the meaning of the CTLFLAG_TUN flag to automatically check if
there is an environment variable which shall initialize the SYSCTL
during early boot. This works for all SYSCTL types both statically and
dynamically created ones, except for the SYSCTL NODE type and SYSCTLs
which belong to VNETs. A new flag, CTLFLAG_NOFETCH, has been added to
be used in the case a tunable sysctl has a custom initialisation
function allowing the sysctl to still be marked as a tunable. The
kernel SYSCTL API is mostly the same, with a few exceptions for some
special operations like iterating childrens of a static/extern SYSCTL
node. This operation should probably be made into a factored out
common macro, hence some device drivers use this. The reason for
changing the SYSCTL API was the need for a SYSCTL parent OID pointer
and not only the SYSCTL parent OID list pointer in order to quickly
generate the sysctl path. The motivation behind this patch is to avoid
parameter loading cludges inside the OFED driver subsystem. Instead of
adding special code to the OFED driver subsystem to post-load tunables
into dynamically created sysctls, we generalize this in the kernel.

Other changes:
- Corrected a possibly incorrect sysctl name from "hw.cbb.intr_mask"
to "hw.pcic.intr_mask".
- Removed redundant TUNABLE statements throughout the kernel.
- Some minor code rewrites in connection to removing not needed
TUNABLE statements.
- Added a missing SYSCTL_DECL().
- Wrapped two very long lines.
- Avoid malloc()/free() inside sysctl string handling, in case it is
called to initialize a sysctl from a tunable, hence malloc()/free() is
not ready when sysctls from the sysctl dataset are registered.
- Bumped FreeBSD version to indicate SYSCTL API change.

MFC after:	2 weeks
Sponsored by:	Mellanox Technologies
2014-06-27 16:33:43 +00:00
Jean-Sébastien Pédron
05ad6397b3 drm: Support DRM_CAP_TIMESTAMP_MONOTONIC capability
This fixes DPMS with KDE and radeonkms. Without this, the display would
freeze when the monitor is put into sleep state, and only resumes after
several dozens of minutes once the monitor is powered on again.

Tested by:	Mathias Picker <Mathias.Picker@virtual-earth.de>
2013-11-17 16:07:52 +00:00
Jean-Sébastien Pédron
92cf4f8de0 drm: In drm_mmap_single, try ttm_bo_mmap_single() before drm_gem_mmap_single()
In drivers such as the Radeon driver, the DRIVER_GEM features flag is
set but TTM is used to mmap buffer object.
2013-08-25 00:34:44 +00:00
Jean-Sébastien Pédron
5eaeb54990 drm: Fix cleanup if device initialization fails
This plugs some memory leaks.
2013-08-25 00:22:34 +00:00
Jean-Sébastien Pédron
22f61fe5d4 drm: Use driver-provided "use_msi" callback to determine if MSI is blacklisted
For now, keep the static array for i915. But eventually, it should be
moved to a callback in the driver itself.
2013-08-25 00:13:53 +00:00
Jean-Sébastien Pédron
e3b7062fce drm: Call drm_global_init() & drm_global_release() at module load/unload 2013-08-24 15:47:15 +00:00
Konstantin Belousov
e6cd8542ed Import the preliminary port of the TTM.
The early commit is done to facilitate the off-tree work on the
porting of the Radeon driver.

Sponsored by:	The FreeBSD Foundation
Debugged and tested by:	    dumbbell
MFC after:	1 month
2013-03-05 09:49:34 +00:00
Gleb Smirnoff
c109de1e07 - If DRM_DEBUG_DEFAULT_ON is defined, then initialize drm_debug_flagi to
all supported debugging bits.
- If DRM_DEBUG_DEFAULT_ON isn't defined, then initialize drm_debug_flag
  to zero.

DRM_DEBUG_DEFAULT_ON is defined when module is build with -DDEBUG_DRM
or if kernel config has 'options DEBUG_DRM'.

Reviewed by:	kib
2012-11-02 05:26:33 +00:00
Kevin Lo
9823d52705 Revert previous commit...
Pointyhat to:	kevlo (myself)
2012-10-10 08:36:38 +00:00
Kevin Lo
a10cee30c9 Prefer NULL over 0 for pointers 2012-10-09 08:27:40 +00:00
Konstantin Belousov
d1c3436c1c Add drm and i915 ioctl translations for 32 bit process on 64 bit host.
Submitted by:	meowthink@gmail.com
MFC after:	2 weeks
2012-08-18 18:26:25 +00:00
Konstantin Belousov
e27f871969 Add the code for new Intel GPU driver, which supports GEM, KMS and
works with new generations of GPUs (IronLake, SandyBridge and
supposedly IvyBridge).

The driver is not connected to the build yet.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2012-05-22 11:07:44 +00:00