GitHub/moto-9609/android_kernel_motorola_exynos9610.git
10 years agodrm/nv50-/disp: audit and version SOR_HDA_ELD method
Ben Skeggs [Sat, 9 Aug 2014 18:10:26 +0000 (04:10 +1000)]
drm/nv50-/disp: audit and version SOR_HDA_ELD method

The full object interfaces are about to be exposed to userspace, so we
need to check for any security-related issues and version the structs
to make it easier to handle any changes we may need in the future.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nv50-/disp: audit and version SOR_PWR method
Ben Skeggs [Sat, 9 Aug 2014 18:10:26 +0000 (04:10 +1000)]
drm/nv50-/disp: audit and version SOR_PWR method

The full object interfaces are about to be exposed to userspace, so we
need to check for any security-related issues and version the structs
to make it easier to handle any changes we may need in the future.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nv50-/disp: audit and version DAC_LOAD method
Ben Skeggs [Sat, 9 Aug 2014 18:10:26 +0000 (04:10 +1000)]
drm/nv50-/disp: audit and version DAC_LOAD method

The full object interfaces are about to be exposed to userspace, so we
need to check for any security-related issues and version the structs
to make it easier to handle any changes we may need in the future.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nv50-/disp: audit and version DAC_PWR method
Ben Skeggs [Sat, 9 Aug 2014 18:10:26 +0000 (04:10 +1000)]
drm/nv50-/disp: audit and version DAC_PWR method

The full object interfaces are about to be exposed to userspace, so we
need to check for any security-related issues and version the structs
to make it easier to handle any changes we may need in the future.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nv50-/disp: share channel creation between nv50/gf110 impls
Ben Skeggs [Sat, 9 Aug 2014 18:10:25 +0000 (04:10 +1000)]
drm/nv50-/disp: share channel creation between nv50/gf110 impls

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nv50/kms: don't assume same class versions for all channels
Ben Skeggs [Sat, 9 Aug 2014 18:10:25 +0000 (04:10 +1000)]
drm/nv50/kms: don't assume same class versions for all channels

One of the next commits will remove some of the class IDs, leaving only
the ones used by NVIDIA which, presumably, mark where functionality
changes actually happened.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/fifo: implement nvif event source
Ben Skeggs [Sat, 9 Aug 2014 18:10:25 +0000 (04:10 +1000)]
drm/nouveau/fifo: implement nvif event source

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/fifo: allow direct access to channel control registers where possible
Ben Skeggs [Sat, 9 Aug 2014 18:10:25 +0000 (04:10 +1000)]
drm/nouveau/fifo: allow direct access to channel control registers where possible

The indirect method has been left in-place here as a fallback path, as
it may not be possible to map the non-PAGE_SIZE aligned control areas
across some chipset+interface combinations.

This isn't a problem for the primary use-case where the core and drm
are linked together in kernel-land, but across a VM or (in the case
where it applies now) between the core in the kernel and a userspace
test tool.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/fifo: audit and version fifo channel classes
Ben Skeggs [Sat, 9 Aug 2014 18:10:25 +0000 (04:10 +1000)]
drm/nouveau/fifo: audit and version fifo channel classes

The full object interfaces are about to be exposed to userspace, so we
need to check for any security-related issues and version the structs
to make it easier to handle any changes we may need in the future.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/device: audit and version NVIF_CONTROL class and methods
Ben Skeggs [Sat, 9 Aug 2014 18:10:25 +0000 (04:10 +1000)]
drm/nouveau/device: audit and version NVIF_CONTROL class and methods

The full object interfaces are about to be exposed to userspace, so we
need to check for any security-related issues and version the structs
to make it easier to handle any changes we may need in the future.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/pm: audit and version NVIF_PERFMON class and methods
Ben Skeggs [Sat, 9 Aug 2014 18:10:24 +0000 (04:10 +1000)]
drm/nouveau/pm: audit and version NVIF_PERFMON class and methods

The full object interfaces are about to be exposed to userspace, so we
need to check for any security-related issues and version the structs
to make it easier to handle any changes we may need in the future.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/dma: audit and version NV_DMA classes
Ben Skeggs [Sat, 9 Aug 2014 18:10:24 +0000 (04:10 +1000)]
drm/nouveau/dma: audit and version NV_DMA classes

The full object interfaces are about to be exposed to userspace, so we
need to check for any security-related issues and version the structs
to make it easier to handle any changes we may need in the future.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/dmaobj: switch to a slightly saner design
Ben Skeggs [Sat, 9 Aug 2014 18:10:24 +0000 (04:10 +1000)]
drm/nouveau/dmaobj: switch to a slightly saner design

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/dmaobj: update to an improved style of class definition
Ben Skeggs [Sat, 9 Aug 2014 18:10:24 +0000 (04:10 +1000)]
drm/nouveau/dmaobj: update to an improved style of class definition

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/device: audit and version NV_DEVICE class
Ben Skeggs [Sat, 9 Aug 2014 18:10:24 +0000 (04:10 +1000)]
drm/nouveau/device: audit and version NV_DEVICE class

The full object interfaces are about to be exposed to userspace, so we
need to check for any security-related issues and version the structs
to make it easier to handle any changes we may need in the future.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau: use ioctl interface for abi16 gpuobj free
Ben Skeggs [Sat, 9 Aug 2014 18:10:23 +0000 (04:10 +1000)]
drm/nouveau: use ioctl interface for abi16 gpuobj free

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau: use ioctl interface for abi16 ntfy alloc
Ben Skeggs [Sat, 9 Aug 2014 18:10:23 +0000 (04:10 +1000)]
drm/nouveau: use ioctl interface for abi16 ntfy alloc

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau: use ioctl interface for abi16 grobj alloc
Ben Skeggs [Sat, 9 Aug 2014 18:10:23 +0000 (04:10 +1000)]
drm/nouveau: use ioctl interface for abi16 grobj alloc

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau: remove as much direct use of core headers as possible
Ben Skeggs [Sat, 9 Aug 2014 18:10:23 +0000 (04:10 +1000)]
drm/nouveau: remove as much direct use of core headers as possible

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau: remove (most) hardcoded object handle usage
Ben Skeggs [Sat, 9 Aug 2014 18:10:23 +0000 (04:10 +1000)]
drm/nouveau: remove (most) hardcoded object handle usage

The PFIFO<->EVO sync buffers will be fixed up later when inter-channel
sync in general is improved.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau: port to nvif client/device/objects
Ben Skeggs [Sat, 9 Aug 2014 18:10:22 +0000 (04:10 +1000)]
drm/nouveau: port to nvif client/device/objects

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau: initial pass at moving to struct nvif_device
Ben Skeggs [Sat, 9 Aug 2014 18:10:22 +0000 (04:10 +1000)]
drm/nouveau: initial pass at moving to struct nvif_device

This is an attempt at isolating some of the changes necessary to port
to NVIF in a separate commit.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau: kill nouveau_dev() + wrap register macros
Ben Skeggs [Sat, 9 Aug 2014 18:10:22 +0000 (04:10 +1000)]
drm/nouveau: kill nouveau_dev() + wrap register macros

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau: fix some usages of the wrong print function
Ben Skeggs [Sat, 9 Aug 2014 18:10:22 +0000 (04:10 +1000)]
drm/nouveau: fix some usages of the wrong print function

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/nvif: import library functions for the ioctl/event interfaces
Ben Skeggs [Sat, 9 Aug 2014 18:10:21 +0000 (04:10 +1000)]
drm/nouveau/nvif: import library functions for the ioctl/event interfaces

This is a wrapper around the interfaces defined in an earlier commit,
and is also used by various userspace (either by a libdrm backend, or
libpciaccess) tools/tests.

In the future this will be extended to handle channels, replacing some
long-unloved code we currently use, and allow fifo/display/mpeg (hi
Ilia ;)) engines to all be exposed in the same way.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/client: add method to retrieve device list
Ben Skeggs [Sat, 9 Aug 2014 18:10:21 +0000 (04:10 +1000)]
drm/nouveau/client: add method to retrieve device list

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/core: remove NV_D0 family
Ben Skeggs [Sat, 9 Aug 2014 18:10:21 +0000 (04:10 +1000)]
drm/nouveau/core: remove NV_D0 family

The one place where it mattered has been replaced with a class check,
which is more appropriate anyway.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/device: add method to retrieve some basic device info
Ben Skeggs [Sat, 9 Aug 2014 18:10:21 +0000 (04:10 +1000)]
drm/nouveau/device: add method to retrieve some basic device info

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/core: import ioctl/event interfaces
Ben Skeggs [Sat, 9 Aug 2014 18:10:20 +0000 (04:10 +1000)]
drm/nouveau/core: import ioctl/event interfaces

This forms the basis for the new APIs that will be exposed to userspace,
giving it access to:

- Object method calls, the immediately useful of which is performance
  counters and the abiity to manipulate the ZBC tables.
- Information on the child classes an object supports, in order to avoid
  having to try all supported classes until successful.
- Notifications, which will be used in the future to inform the client
  if its channel was killed due to a lockup, etc.

This commit imports the interfaces, but are not currently used.  The DRM
portion of the driver will be ported to speak to the core using these
interfaces as much as possible.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/core: add function to return list of supported children
Ben Skeggs [Sat, 9 Aug 2014 18:10:20 +0000 (04:10 +1000)]
drm/nouveau/core: add function to return list of supported children

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/core: rework event interface
Ben Skeggs [Sat, 9 Aug 2014 18:10:20 +0000 (04:10 +1000)]
drm/nouveau/core: rework event interface

This is a lot of prep-work for being able to send event notifications
back to userspace.  Events now contain data, rather than a "something
just happened" signal.

Handler data is now embedded into a containing structure, rather than
being kmalloc()'d, and can optionally have the notify routine handled
in a workqueue.

Various races between suspend/unload with display HPD/DP IRQ handlers
automagically solved as a result.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/core: move handle-based object apis to handle.c
Ben Skeggs [Sat, 9 Aug 2014 18:10:20 +0000 (04:10 +1000)]
drm/nouveau/core: move handle-based object apis to handle.c

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/core: fail creation of zero-argument objects, when arguments are passed
Ben Skeggs [Sat, 9 Aug 2014 18:10:20 +0000 (04:10 +1000)]
drm/nouveau/core: fail creation of zero-argument objects, when arguments are passed

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau: store a pointer to vm in nouveau_cli
Ben Skeggs [Sat, 9 Aug 2014 18:10:20 +0000 (04:10 +1000)]
drm/nouveau: store a pointer to vm in nouveau_cli

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau: store vblank event handler data in nv_crtc
Ben Skeggs [Sat, 9 Aug 2014 18:10:19 +0000 (04:10 +1000)]
drm/nouveau: store vblank event handler data in nv_crtc

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nv50/kms: create ctxdma objects for framebuffers as required
Ben Skeggs [Sat, 9 Aug 2014 18:10:19 +0000 (04:10 +1000)]
drm/nv50/kms: create ctxdma objects for framebuffers as required

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nv50/kms: move framebuffer wrangling out of common code
Ben Skeggs [Sat, 9 Aug 2014 18:10:19 +0000 (04:10 +1000)]
drm/nv50/kms: move framebuffer wrangling out of common code

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau: Bump version from 1.1.1 to 1.1.2
Mario Kleiner [Wed, 6 Aug 2014 04:09:44 +0000 (06:09 +0200)]
drm/nouveau: Bump version from 1.1.1 to 1.1.2

Linux 3.16 fixed multiple bugs in kms pageflip completion events
and timestamping, which were originally introduced in Linux 3.13.

These fixes have been backported to all stable kernels since 3.13.

However, the userspace nouveau-ddx needs to be aware if it is
running on a kernel on which these bugs are fixed, or not.

Bump the patchlevel of the drm driver version to signal this,
so backporting this patch to stable 3.13+ kernels will give the
ddx the required info.

Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Cc: <stable@vger.kernel.org> #v3.13+
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nv50-/sw: use nv50_software_context_dtor....
Ben Skeggs [Thu, 7 Aug 2014 21:21:53 +0000 (07:21 +1000)]
drm/nv50-/sw: use nv50_software_context_dtor....

You would not believe the troubles this caused me...

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nv50-/fb: use dma_mapping_error() to check dma_map_page() result
Ben Skeggs [Tue, 5 Aug 2014 12:03:49 +0000 (22:03 +1000)]
drm/nv50-/fb: use dma_mapping_error() to check dma_map_page() result

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau: Dis/Enable vblank irqs during suspend/resume.
Mario Kleiner [Tue, 29 Jul 2014 00:36:44 +0000 (02:36 +0200)]
drm/nouveau: Dis/Enable vblank irqs during suspend/resume.

Vblank irqs don't get disabled during suspend or driver
unload, which causes irq delivery after "suspend" or
driver unload, at least until the gpu is powered off.
This could race with drm_vblank_cleanup() in the case
of nouveau and cause a use-after-free bug if the driver
is unloaded.

More annoyingly during everyday use, at least on nv50
display engine (likely also others), vblank irqs are
off after a resume from suspend, but the drm doesn't
know this, so all vblank related functionality is dead
after a resume. E.g., all windowed OpenGL clients will
hang at swapbuffers time, as well as many fullscreen
clients in many cases. This makes suspend/resume useless
if one wants to use any OpenGL apps after the resume.

In Linux 3.16, drm_vblank_on() was added, complementing
the older drm_vblank_off()  to solve these problems
elegantly, so use those calls in nouveaus suspend/resume
code.

For kernels 3.8 - 3.15, we need to cherry-pick the
drm_vblank_on() patch to support this patch.

Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Cc: <stable@vger.kernel.org> #v3.16
Cc: <stable@vger.kernel.org> #v3.8+: f275228: drm: Add drm_vblank_on()
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau: platform: update moved Tegra header
Alexandre Courbot [Sat, 26 Jul 2014 09:36:02 +0000 (18:36 +0900)]
drm/nouveau: platform: update moved Tegra header

Header for tegra_powergate functions has moved to soc/tegra/pmc.h.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/gk20a: reclocking support
Alexandre Courbot [Sat, 26 Jul 2014 09:41:41 +0000 (18:41 +0900)]
drm/nouveau/gk20a: reclocking support

Add support for reclocking on GK20A, using a statically-defined pstates
table. The algorithms for calculating the coefficients and setting the
clocks are directly taken from the ChromeOS kernel.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/clk: support for non-BIOS pstates
Alexandre Courbot [Sat, 26 Jul 2014 09:41:40 +0000 (18:41 +0900)]
drm/nouveau/clk: support for non-BIOS pstates

Make nouveau_clock_create() take new two optional arguments: an array
of pstates and its size. When these are specified,
nouveau_clock_create() will use the provided pstates instead of
probing them using the BIOS.

This is useful for platforms which do not provide a BIOS, like Tegra.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/clk: make therm and volt devices optional
Alexandre Courbot [Sat, 26 Jul 2014 09:41:39 +0000 (18:41 +0900)]
drm/nouveau/clk: make therm and volt devices optional

Allow the clock subsystem to operate even if voltage and thermal devices
are not set for the device (for people with watercooling! ;))

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/perfmon: do not forget to destroy the engine context
Samuel Pitoiset [Mon, 21 Jul 2014 09:59:44 +0000 (11:59 +0200)]
drm/nouveau/perfmon: do not forget to destroy the engine context

This fixes a crash when we reload Nouveau DRM.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau: map pages using DMA API
Alexandre Courbot [Thu, 31 Jul 2014 09:09:42 +0000 (18:09 +0900)]
drm/nouveau: map pages using DMA API

The DMA API is the recommended way to map pages no matter what the
underlying bus is. Use the DMA functions for page mapping and remove
currently existing wrappers.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/pwr/macros: Stop playing Russian roulette on data memory
Roy Spliet [Sat, 2 Aug 2014 15:15:01 +0000 (17:15 +0200)]
drm/nouveau/pwr/macros: Stop playing Russian roulette on data memory

Signed-off-by: Roy Spliet <rspliet@eclipso.eu>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nve4/graph: do not crash if no power device present
Alexandre Courbot [Tue, 15 Jul 2014 01:36:11 +0000 (10:36 +0900)]
drm/nve4/graph: do not crash if no power device present

Detect and workaround the absence of a power device so chips that do not
feature one (e.g. GK20A) can still use this driver.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/gk20a: add BAR instance
Alexandre Courbot [Fri, 27 Jun 2014 11:36:54 +0000 (20:36 +0900)]
drm/gk20a: add BAR instance

GK20A's BAR is functionally identical to NVC0's, but do not support
being ioremapped write-combined. Create a BAR instance for GK20A that
reflect that state.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
10 years agodrm/nouveau/bar: add noncached ioremap property
Alexandre Courbot [Fri, 27 Jun 2014 10:28:50 +0000 (19:28 +0900)]
drm/nouveau/bar: add noncached ioremap property

Some BARs (like GK20A's) do not support being ioremapped write-combined.
Add a boolean property to the BAR structure and handle that case in the
Nouveau BO implementation.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
10 years agodrm/nouveau: support for probing platform devices
Alexandre Courbot [Thu, 26 Jun 2014 05:33:32 +0000 (14:33 +0900)]
drm/nouveau: support for probing platform devices

Add a platform driver for Nouveau devices declared using the device tree
or platform data. This driver currently supports GK20A on Tegra
platforms and is only compiled for these platforms if Nouveau is
enabled.

Nouveau will probe the chip type itself using the BOOT0 register, so all
this driver really needs to do is to make sure the module is powered and
its clocks active before calling nouveau_drm_platform_probe().

Heavily based on work done by Thierry Reding.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/kms: restore acceleration before fb_set_suspend() resumes
Ben Skeggs [Mon, 30 Jun 2014 03:18:48 +0000 (13:18 +1000)]
drm/nouveau/kms: restore acceleration before fb_set_suspend() resumes

This *should* be safe these days.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/kms: take more care when pulling down accelerated fbcon
Ben Skeggs [Sat, 28 Jun 2014 10:44:07 +0000 (20:44 +1000)]
drm/nouveau/kms: take more care when pulling down accelerated fbcon

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau: expose pstate selection per-power source in sysfs
Ben Skeggs [Fri, 13 Jun 2014 04:17:09 +0000 (14:17 +1000)]
drm/nouveau: expose pstate selection per-power source in sysfs

echo ac:id >> pstate # select mode when on mains power
echo dc:id >> pstate # select mode when on battery
echo id >> pstate # select mode for both

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/clk: allow selection of different power state for ac vs battery
Ben Skeggs [Fri, 13 Jun 2014 03:23:42 +0000 (13:23 +1000)]
drm/nouveau/clk: allow selection of different power state for ac vs battery

v2:
- s/init/fini/ typo, reported by Alex

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/clk: schedule pstate changes through a workqueue
Ben Skeggs [Fri, 13 Jun 2014 04:58:21 +0000 (14:58 +1000)]
drm/nouveau/clk: schedule pstate changes through a workqueue

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/device: register for acpi events
Ben Skeggs [Fri, 13 Jun 2014 02:42:21 +0000 (12:42 +1000)]
drm/nouveau/device: register for acpi events

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/gk208-/gr: stop touching 0x260 inappropriately
Ben Skeggs [Thu, 12 Jun 2014 12:15:21 +0000 (22:15 +1000)]
drm/gk208-/gr: stop touching 0x260 inappropriately

As a side note.. It's a bit hard to figure out how to name this commit..
GK20A is NVEA, which is before NV108 (GK208).. Confusing.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/gk110b/gr: initvals differ from gk110
Ben Skeggs [Thu, 12 Jun 2014 11:22:32 +0000 (21:22 +1000)]
drm/gk110b/gr: initvals differ from gk110

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/gk104/gr: disable PGOB at init time
Ben Skeggs [Thu, 12 Jun 2014 09:49:08 +0000 (19:49 +1000)]
drm/gk104/gr: disable PGOB at init time

This removes the previous hack that worked on some boards.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/gk104/pwr: implement PGOB disable method
Ben Skeggs [Thu, 12 Jun 2014 08:58:05 +0000 (18:58 +1000)]
drm/gk104/pwr: implement PGOB disable method

As documented at:

ftp://download.nvidia.com/open-gpu-doc/gk104-disable-graphics-power-gating/1/gk104-disable-graphics-power-gating.txt

NVIDIA were not able document the steps necessary to detect whether this
is required or not at this time.  However, they did confirm that this
procedure is safe to perform unconditionally on GK104/6.  GK107 does not
have the power gating feature, and it was recommended that we do not
perform these steps there as the effects were not verified.

The disable path is from observing the binary driver, and not
documented in the link above.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/pwr: tidy
Ben Skeggs [Thu, 12 Jun 2014 08:31:32 +0000 (18:31 +1000)]
drm/nouveau/pwr: tidy

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/ttm: expose CPU address of DMA-allocated pages
Alexandre Courbot [Mon, 4 Aug 2014 09:28:54 +0000 (18:28 +0900)]
drm/ttm: expose CPU address of DMA-allocated pages

Pages allocated using the DMA API have a coherent memory mapping. Make
this mapping visible to drivers so they can decide to use it instead of
creating their own redundant one.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Acked-by: David Airlie <airlied@linux.ie>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agoRevert "drm: drop redundant drm_file->is_master"
Dave Airlie [Thu, 7 Aug 2014 21:30:53 +0000 (07:30 +1000)]
Revert "drm: drop redundant drm_file->is_master"

This reverts commit 48ba813701eb14b3008edefef4a0789b328e278c.

Thanks to Chris:
"drm_file->is_master is not synomous with having drm_file->master ==
drm_file->minor->master. This is because drm_file->master is the same
for all drm_files of the same generation and so when there is a master,
every drm_file believes itself to be the master. Confusion ensues and
things go pear shaped when one file is closed and there is no master
anymore."

Conflicts:
drivers/gpu/drm/drm_drv.c
drivers/gpu/drm/drm_stub.c

10 years agoMerge tag 'drm/tegra/for-3.17-rc1' of git://anongit.freedesktop.org/tegra/linux into...
Dave Airlie [Thu, 7 Aug 2014 09:53:22 +0000 (19:53 +1000)]
Merge tag 'drm/tegra/for-3.17-rc1' of git://anongit.freedesktop.org/tegra/linux into drm-next

drm/tegra: Changes for v3.17-rc1

Mostly some cleanup all over the place. Pitch alignment limitations of
the display controller are now honored and job submission is 64-bit
safe.

The SOR output (used for eDP) properly configures sync signal polarities
according to the display mode rather than hard-coding them to some value
and the number of bits per color is now taken from the panel rather than
hard-coded to properly support 24-bit vs. 18-bit panels.

The DSI controller now properly supports non-continuous clock mode.

GEM objects can now have their flags and tiling mode modified via IOCTLs
to allow buffers imported from Nouveau to be properly displayed. Newer
generations of the Tegra display controller can also detile block linear
buffers at scan-out time.

Finally the driver now properly exports MODULE_DEVICE_TABLEs to allow it
to be automatically loaded when built as a module.

* tag 'drm/tegra/for-3.17-rc1' of git://anongit.freedesktop.org/tegra/linux:
  drm/tegra: add MODULE_DEVICE_TABLEs
  drm/tegra: dc - Reset controller on driver remove
  drm/tegra: Properly align stride for framebuffers
  drm/tegra: sor - Configure proper sync polarities
  drm/tegra: sor - Use bits-per-color from panel
  drm/tegra: Make job submission 64-bit safe
  drm/tegra: Allow non-authenticated processes to create buffer objects
  drm/tegra: Add SET/GET_FLAGS IOCTLs
  drm/tegra: Add SET/GET_TILING IOCTLs
  drm/tegra: Implement more tiling modes
  drm/tegra: dsi - Handle non-continuous clock flag
  drm/tegra: sor - missing unlock on error

10 years agoMerge tag 'drm/panel/for-3.17-rc1' of git://anongit.freedesktop.org/tegra/linux into...
Dave Airlie [Thu, 7 Aug 2014 09:51:52 +0000 (19:51 +1000)]
Merge tag 'drm/panel/for-3.17-rc1' of git://anongit.freedesktop.org/tegra/linux into drm-next

drm/panel: Changes for v3.17-rc1

Panels can now be more finely controlled via .prepare() and .unprepare()
callbacks in addition to .enable() and .disable(). New kerneldoc details
what they are supposed to do and when they should be called.

The simple panel driver gained support for a couple of new panels and it
is now possible to specify additional delays during power up and power
down sequences if panels require it.

DSI devices can now advertise that they support non-continuous clock
mode which will allow DSI host controllers to disable the high speed
clock after transmissions to save power.

* tag 'drm/panel/for-3.17-rc1' of git://anongit.freedesktop.org/tegra/linux: (30 commits)
  drm/panel: simple: Use devm_gpiod_get_optional()
  drm/dsi: Replace upcasting macro by function
  drm/panel: ld9040: Replace upcasting macro by function
  drm/exynos: dp: Modify driver to support drm_panel
  drm/exynos: Move DP setup into commit()
  drm/panel: simple: Add AUO B133HTN01 panel support
  drm/panel: simple: Support delays in panel functions
  drm/panel: simple: Add proper definition for prepare and unprepare
  drm/panel: s6e8aa0: Add proper definition for prepare and unprepare
  drm/panel: ld9040: Add proper definition for prepare and unprepare
  drm/tegra: Add support for panel prepare and unprepare routines
  drm/exynos: dsi: Add support for panel prepare and unprepare routines
  drm/exynos: dpi: Add support for panel prepare and unprepare routines
  drm/panel: simple: Add dummy prepare and unprepare routines
  drm/panel: s6e8aa0: Add dummy prepare and unprepare routines
  drm/panel: ld9040: Add dummy prepare and unprepare routines
  drm/panel: Provide convenience wrapper for .get_modes()
  drm/panel: add .prepare() and .unprepare() functions
  drm/panel: simple: Remove simple-panel compatible
  drm/panel: simple: Add Innolux N116BGE panel support
  ...

10 years agodrm/panel: simple: Use devm_gpiod_get_optional()
Alexandre Courbot [Fri, 25 Jul 2014 14:47:25 +0000 (23:47 +0900)]
drm/panel: simple: Use devm_gpiod_get_optional()

Use the new devm_gpiod_get_optional() to simplify the probe code.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
10 years agodrm/dsi: Replace upcasting macro by function
Thierry Reding [Tue, 5 Aug 2014 07:01:32 +0000 (09:01 +0200)]
drm/dsi: Replace upcasting macro by function

Using a function instead of a macro provides proper type checking.

Signed-off-by: Thierry Reding <treding@nvidia.com>
10 years agodrm/panel: ld9040: Replace upcasting macro by function
Thierry Reding [Tue, 5 Aug 2014 06:59:01 +0000 (08:59 +0200)]
drm/panel: ld9040: Replace upcasting macro by function

Using a function instead of a macro provides proper type checking.

Signed-off-by: Thierry Reding <treding@nvidia.com>
10 years agodrm/exynos: dp: Modify driver to support drm_panel
Ajay Kumar [Thu, 31 Jul 2014 17:42:14 +0000 (23:12 +0530)]
drm/exynos: dp: Modify driver to support drm_panel

Add drm_panel controls to support powerup/down of the
eDP panel, if one is present at the sink side.

Signed-off-by: Ajay Kumar <ajaykumar.rs@samsung.com>
Acked-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
10 years agodrm/exynos: Move DP setup into commit()
Ajay Kumar [Thu, 31 Jul 2014 17:42:13 +0000 (23:12 +0530)]
drm/exynos: Move DP setup into commit()

Add commit callback for exynos_dp, and move the DP link training,
video configuration code from the hotplug handler into commit().

Signed-off-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Ajay Kumar <ajaykumar.rs@samsung.com>
Acked-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
10 years agodrm/panel: simple: Add AUO B133HTN01 panel support
Ajay Kumar [Thu, 31 Jul 2014 17:42:12 +0000 (23:12 +0530)]
drm/panel: simple: Add AUO B133HTN01 panel support

The AUO B133HTN01 is a 13.6" FHD TFT LCD panel connecting to an eDP
interface and with an integrated LED backlight unit.

This panel is used on the Samsung Chromebook 2 (XE503C32).

Signed-off-by: Ajay Kumar <ajaykumar.rs@samsung.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
10 years agodrm/panel: simple: Support delays in panel functions
Ajay Kumar [Thu, 31 Jul 2014 17:42:11 +0000 (23:12 +0530)]
drm/panel: simple: Support delays in panel functions

For most of the panels, we need to provide delays during various stages
of panel power up and power down. Add a structure to hold those delay
values and use them in corresponding functions.

Signed-off-by: Ajay Kumar <ajaykumar.rs@samsung.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
10 years agodrm/panel: simple: Add proper definition for prepare and unprepare
Ajay Kumar [Thu, 31 Jul 2014 17:42:10 +0000 (23:12 +0530)]
drm/panel: simple: Add proper definition for prepare and unprepare

Move out code from enable and disable routines to prepare
and unprepare routines, so that functionality is properly
distributed across all the panel functions.

Signed-off-by: Ajay Kumar <ajaykumar.rs@samsung.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
10 years agodrm/panel: s6e8aa0: Add proper definition for prepare and unprepare
Ajay Kumar [Thu, 31 Jul 2014 17:42:09 +0000 (23:12 +0530)]
drm/panel: s6e8aa0: Add proper definition for prepare and unprepare

Move out code from enable and disable routines to prepare
and unprepare routines, so that functionality is properly
distributed across all the panel functions.

Signed-off-by: Ajay Kumar <ajaykumar.rs@samsung.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
10 years agodrm/panel: ld9040: Add proper definition for prepare and unprepare
Ajay Kumar [Thu, 31 Jul 2014 17:42:08 +0000 (23:12 +0530)]
drm/panel: ld9040: Add proper definition for prepare and unprepare

Move out code from enable and disable routines to prepare
and unprepare routines, so that functionality is properly
distributed across all the panel functions.

Signed-off-by: Ajay Kumar <ajaykumar.rs@samsung.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
10 years agodrm/tegra: Add support for panel prepare and unprepare routines
Ajay Kumar [Thu, 31 Jul 2014 17:42:07 +0000 (23:12 +0530)]
drm/tegra: Add support for panel prepare and unprepare routines

Modify tegra output driver to support the new panel calls:
prepare and unprepare.

Signed-off-by: Ajay Kumar <ajaykumar.rs@samsung.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
10 years agodrm/exynos: dsi: Add support for panel prepare and unprepare routines
Ajay Kumar [Thu, 31 Jul 2014 17:42:06 +0000 (23:12 +0530)]
drm/exynos: dsi: Add support for panel prepare and unprepare routines

Modify exynos_dsi driver to support the new panel calls:
prepare and unprepare.

Signed-off-by: Ajay Kumar <ajaykumar.rs@samsung.com>
Acked-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
10 years agodrm/exynos: dpi: Add support for panel prepare and unprepare routines
Ajay Kumar [Thu, 31 Jul 2014 17:42:05 +0000 (23:12 +0530)]
drm/exynos: dpi: Add support for panel prepare and unprepare routines

Modify exynos_dpi driver to support the new panel calls:
prepare and unprepare.

Signed-off-by: Ajay Kumar <ajaykumar.rs@samsung.com>
Acked-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
10 years agodrm/panel: simple: Add dummy prepare and unprepare routines
Ajay Kumar [Thu, 31 Jul 2014 17:42:04 +0000 (23:12 +0530)]
drm/panel: simple: Add dummy prepare and unprepare routines

This patch adds dummy definition for prepare and unprepare
routines to simple panel driver.

Signed-off-by: Ajay Kumar <ajaykumar.rs@samsung.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
10 years agodrm/panel: s6e8aa0: Add dummy prepare and unprepare routines
Ajay Kumar [Thu, 31 Jul 2014 17:42:03 +0000 (23:12 +0530)]
drm/panel: s6e8aa0: Add dummy prepare and unprepare routines

This patch adds dummy definition for prepare and unprepare
routines to s6e8aa0 panel driver.

Signed-off-by: Ajay Kumar <ajaykumar.rs@samsung.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
10 years agodrm/panel: ld9040: Add dummy prepare and unprepare routines
Ajay Kumar [Thu, 31 Jul 2014 17:42:02 +0000 (23:12 +0530)]
drm/panel: ld9040: Add dummy prepare and unprepare routines

This patch adds dummy definition for prepare and unprepare
routines to ld9040 panel driver.

Signed-off-by: Ajay Kumar <ajaykumar.rs@samsung.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
10 years agodrm/panel: Provide convenience wrapper for .get_modes()
Ajay Kumar [Wed, 30 Jul 2014 10:02:15 +0000 (12:02 +0200)]
drm/panel: Provide convenience wrapper for .get_modes()

Add a convenience wrapper for the struct drm_panel_funcs' .get_modes()
function so that not every driver needs to check that the panel driver
implements the function before calling it.

Signed-off-by: Ajay Kumar <ajaykumar.rs@samsung.com>
[treding: extract from larger patch, commit message]
Signed-off-by: Thierry Reding <treding@nvidia.com>
10 years agodrm/panel: add .prepare() and .unprepare() functions
Ajay Kumar [Thu, 17 Jul 2014 20:43:48 +0000 (02:13 +0530)]
drm/panel: add .prepare() and .unprepare() functions

Panels often require an initialization sequence that consists of three
steps: a) powering up the panel, b) starting transmission of video data
and c) enabling the panel (e.g. turn on backlight). This is usually
necessary to avoid visual glitches at the beginning of video data
transmission.

Similarly, the shutdown sequence is typically done in three steps as
well: a) disable the panel (e.g. turn off backlight), b) cease video
data transmission and c) power down the panel.

Currently drivers can only implement .enable() and .disable() functions,
which is not enough to implement the above sequences. This commit adds a
second pair of functions, .prepare() and .unprepare() to allow more
fine-grained control over when the above steps are performed.

Signed-off-by: Ajay Kumar <ajaykumar.rs@samsung.com>
[treding: rewrite changelog, add kerneldoc]
Signed-off-by: Thierry Reding <treding@nvidia.com>
10 years agodrm/panel: simple: Remove simple-panel compatible
Thierry Reding [Tue, 29 Jul 2014 11:38:56 +0000 (13:38 +0200)]
drm/panel: simple: Remove simple-panel compatible

simple-panel is not a valid panel model, so there is no data (video
timings, etc.) associated with it. Therefore drivers can't do anything
useful with it, so it should not appear in the table of OF matches.

Device trees will always need to specify the exact model of the panel.

Signed-off-by: Thierry Reding <treding@nvidia.com>
10 years agodrm/panel: simple: Add Innolux N116BGE panel support
Thierry Reding [Thu, 3 Jul 2014 12:02:59 +0000 (14:02 +0200)]
drm/panel: simple: Add Innolux N116BGE panel support

The Innolux N116BGE is an 11.6" WXGA TFT LCD panel connecting to an eDP
interface and with an integrated LED backlight unit.

It is used in the Tegra132 Norrin reference design.

Signed-off-by: Thierry Reding <treding@nvidia.com>
10 years agodrm: move drm_stub.c to drm_drv.c
Dave Airlie [Wed, 6 Aug 2014 07:24:25 +0000 (17:24 +1000)]
drm: move drm_stub.c to drm_drv.c

Everyone agrees we should do this,

Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Acked-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
10 years agoMerge branch 'drm-next' of git://people.freedesktop.org/~dvdhrm/linux into drm-next
Dave Airlie [Wed, 6 Aug 2014 07:21:13 +0000 (17:21 +1000)]
Merge branch 'drm-next' of git://people.freedesktop.org/~dvdhrm/linux into drm-next

bunch of cleanups
* 'drm-next' of git://people.freedesktop.org/~dvdhrm/linux:
  drm: mark drm_context support as legacy
  drm: make sysfs device always available for minors
  drm: make minor->index available early
  drm: merge drm_drv.c into drm_ioctl.c
  drm: move module initialization to drm_stub.c
  drm: don't de-authenticate clients on master-close
  drm: drop redundant drm_file->is_master
  drm: extract legacy ctxbitmap flushing

10 years agodrm/i915: lock around link status and link training.
Dave Airlie [Tue, 5 Aug 2014 00:40:20 +0000 (10:40 +1000)]
drm/i915: lock around link status and link training.

We need to take the connection mutex around the link status
check for non-MST case, but also around the MST link training
on short HPDs.

I suspect we actually should have a dpcd lock in the future as
well, that just lock the local copies of dpcd and flags stored
from that.

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>
10 years agoMerge branch 'drm-next-3.17' of git://people.freedesktop.org/~agd5f/linux into drm...
Dave Airlie [Tue, 5 Aug 2014 22:18:21 +0000 (08:18 +1000)]
Merge branch 'drm-next-3.17' of git://people.freedesktop.org/~agd5f/linux into drm-next

- Additional Hawaii fixes
- Support for using the display scaler on non-fixed mode displays
- Support for new firmware format that makes it easier to update
- Enable dpm by default on additional asics
- GPUVM improvements
- Support for uncached and write combined gtt buffers
- Allow allocation of BOs larger than visible vram
- Various other small fixes and improvements

* 'drm-next-3.17' of git://people.freedesktop.org/~agd5f/linux: (57 commits)
  drm/radeon: Prevent hdmi deep color if max_tmds_clock is undefined.
  drm/radeon: Use pflip irqs for pageflip completion if possible. (v2)
  drm/radeon: tweak ACCEL_WORKING2 query for the new firmware for hawaii
  drm/radeon: use packet3 for nop on hawaii with new firmware
  drm/radeon: tweak ACCEL_WORKING2 query for hawaii
  drm/radeon: use packet2 for nop on hawaii with old firmware
  drm/radeon: update IB size estimation for VM
  drm/radeon: split PT setup in more functions
  drm/radeon: add VM GART copy optimization to NI as well
  drm/radeon: take a BO reference on VM cleanup
  drm/radeon: add radeon_bo_ref function
  drm/radeon: remove taking mclk_lock from radeon_bo_unref
  drm/radeon: adjust default radeon_vm_block_size v2
  drm/radeon: try to enable VM flushing once more
  drm/radeon: use an intervall tree to manage the VMA v2
  drm/radeon: remove radeon_bo_clear_va
  drm/radeon: invalidate moved BOs in the VM (v2)
  drm/radeon: re-enable dpm by default on BTC
  drm/radeon: re-enable dpm by default on cayman
  drm/radeon: Only flush HDP cache from idle ioctl if BO is in VRAM
  ...

10 years agodrm: mark drm_context support as legacy
David Herrmann [Thu, 24 Jul 2014 10:10:04 +0000 (12:10 +0200)]
drm: mark drm_context support as legacy

This renames all drm-context helpers to drm_legacy_*() and moves the
internal definitions into the new drm_legacy.h header. This header is
local to DRM-core and drivers shouldn't access it.

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
10 years agodrm/radeon: Prevent hdmi deep color if max_tmds_clock is undefined.
Mario Kleiner [Tue, 5 Aug 2014 03:23:11 +0000 (05:23 +0200)]
drm/radeon: Prevent hdmi deep color if max_tmds_clock is undefined.

HDMI spec requires a valid max_tmds_clock from edid for hdmi
deep color modes. If a sink violates this, disable deep color.

Also add a hint to user about the deep_color module parameter if
deep color is disabled due to that.

Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
10 years agodrm: make sysfs device always available for minors
David Herrmann [Wed, 23 Jul 2014 09:38:38 +0000 (11:38 +0200)]
drm: make sysfs device always available for minors

For each minor we allocate a sysfs device as minor->kdev. Currently, this
is allocated and registered in drm_minor_register(). This makes it
impossible to add sysfs-attributes to the device before it is registered.
Therefore, they are not added atomically, nor can we move device_add()
*after* ->load() is called.

This patch makes minor->kdev available early, but only adds the device
during minor-registration. Note that the registration is still called
before ->load() as debugfs needs to be split, too. This will be fixed in
follow-ups.

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
10 years agodrm: make minor->index available early
David Herrmann [Wed, 23 Jul 2014 08:34:52 +0000 (10:34 +0200)]
drm: make minor->index available early

Instead of allocating the minor-index during registration, we now do this
during allocation. This way, debug-messages between minor-allocation and
minor-registration will now use the correct minor instead of 0. Same is
done for unregistration vs. free, so debug-messages between
device-shutdown and device-destruction show proper indices.

Even though minor-indices are allocated early, we don't enable minor
lookup early. Instead, we keep the entry set to NULL and replace it during
registration / unregistration. This way, the index is allocated but lookup
only works if registered.

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
10 years agodrm: merge drm_drv.c into drm_ioctl.c
David Herrmann [Wed, 23 Jul 2014 12:14:53 +0000 (14:14 +0200)]
drm: merge drm_drv.c into drm_ioctl.c

All that is left in drm_drv.c is ioctl management. Merge it into
drm_ioctl.c so we have all ioctl management in one file (and the name is
much more fitting).

Maybe we should now rename drm_stub.c to drm_drv.c again?

Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
10 years agodrm: move module initialization to drm_stub.c
David Herrmann [Wed, 23 Jul 2014 10:29:56 +0000 (12:29 +0200)]
drm: move module initialization to drm_stub.c

Most of the new DRM management functions are nowadays in drm_stub.c. By
moving the core module initialization to drm_stub.c we can make several
global variables static and keep the stub-open helper local.

The core files now look like this:
  drm_stub.c: Core management
   drm_drv.c: Ioctl dispatcher
 drm_ioctl.c: Actual ioctl backends
  drm_fops.c: Char-dev file-operations

A follow-up patch will move what is left from drm_drv.c into drm_ioctl.c.

Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
10 years agodrm: don't de-authenticate clients on master-close
David Herrmann [Tue, 22 Jul 2014 15:12:26 +0000 (17:12 +0200)]
drm: don't de-authenticate clients on master-close

If an active DRM-Master closes its device, we deauthenticate all clients
on that master. However, if an inactive DRM-Master closes its device, we
do nothing. This is quite inconsistent and breaks several scenarios:

 1) If this was used as security mechanism, it fails horribly if a master
    closes a device while VT switched away. Furthermore, none of the few
    drivers using ->master_*() callbacks seems to require it, anyway.

 2) If you spawn weston (or any other non-UMS compositor) in background
    while another compositor is active, both will get assigned to the
    same "drm_master" object. If the foreground compositor now exits, all
    clients of both the foreground AND background compositor will be
    de-authenticated leading to unexpected behavior.

Stop this non-sense and keep clients authenticated. We don't do this when
dropping DRM-Master (i.e., switching VTs) so don't do it on active-close
either!

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
10 years agodrm: drop redundant drm_file->is_master
David Herrmann [Tue, 22 Jul 2014 16:46:09 +0000 (18:46 +0200)]
drm: drop redundant drm_file->is_master

The drm_file->is_master field is redundant as it's equivalent to:
    drm_file->master && drm_file->master == drm_file->minor->master

1) "=>"
  Whenever we set drm_file->is_master, we also set:
      drm_file->minor->master = drm_file->master;

  Whenever we clear drm_file->is_master, we also call:
      drm_master_put(&drm_file->minor->master);
  which implicitly clears it to NULL.

2) "<="
  minor->master cannot be set if it is non-NULL. Therefore, it stays as
  is unless a file drops it.

  If minor->master is NULL, it is only set by places that also adjust
  drm_file->is_master.

Therefore, we can safely drop is_master and replace it by an inline helper
that matches:
    drm_file->master && drm_file->master == drm_file->minor->master

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
10 years agodrm: extract legacy ctxbitmap flushing
David Herrmann [Wed, 23 Jul 2014 07:01:12 +0000 (09:01 +0200)]
drm: extract legacy ctxbitmap flushing

The ctxbitmap code is only used by legacy drivers so lets try to keep it
as separated as possible. Furthermore, the locking is non-obvious and
kinda weird with ctxlist_mutex *and* struct_mutex. Keeping all ctxbitmap
access in one file is much easier to review and makes drm_release() more
readable.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>