firefly-linux-kernel-4.4.55.git
10 years agodrm/gk104/fb/ram: make use of training data provided by vbios
Ben Skeggs [Wed, 3 Sep 2014 02:40:04 +0000 (12:40 +1000)]
drm/gk104/fb/ram: make use of training data provided by vbios

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/bios: add support for parsing table at BIT 'M' v2 + 0x09
Ben Skeggs [Mon, 1 Sep 2014 05:42:45 +0000 (15:42 +1000)]
drm/nouveau/bios: add support for parsing table at BIT 'M' v2 + 0x09

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/bios: add support for parsing table at BIT 'M' v2 + 0x05
Ben Skeggs [Mon, 1 Sep 2014 05:33:14 +0000 (15:33 +1000)]
drm/nouveau/bios: add support for parsing table at BIT 'M' v2 + 0x05

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/gk104/fb/ram: fix register for second set of training data
Ben Skeggs [Mon, 1 Sep 2014 01:15:21 +0000 (11:15 +1000)]
drm/gk104/fb/ram: fix register for second set of training data

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/gk104/fb/ram: more random magic in fb init
Ben Skeggs [Mon, 1 Sep 2014 00:48:39 +0000 (10:48 +1000)]
drm/gk104/fb/ram: more random magic in fb init

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/gk104/fb/ram: skip table entry for mode we're already in
Ben Skeggs [Mon, 1 Sep 2014 00:44:57 +0000 (10:44 +1000)]
drm/gk104/fb/ram: skip table entry for mode we're already in

NVIDIA binary driver appears to, not sure if it's for a good reason, but
grasping at straws for some GDDR5 reclocking issues here.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/fb/sddr2: Generate MR values
Roy Spliet [Fri, 5 Sep 2014 00:41:46 +0000 (02:41 +0200)]
drm/nouveau/fb/sddr2: Generate MR values

V2: Always disable DLL reset

Signed-off-by: Roy Spliet <rspliet@eclipso.eu>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/fb/sddr3: Expand MR generation
Roy Spliet [Thu, 4 Sep 2014 14:58:54 +0000 (16:58 +0200)]
drm/nouveau/fb/sddr3: Expand MR generation

Signed-off-by: Roy Spliet <rspliet@eclipso.eu>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nva3/pwr/memx: Match blob's fb access behaviour
Roy Spliet [Thu, 4 Sep 2014 14:58:53 +0000 (16:58 +0200)]
drm/nva3/pwr/memx: Match blob's fb access behaviour

Signed-off-by: Roy Spliet <rspliet@eclipso.eu>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/pwr/memx: Return debugging information
Roy Spliet [Thu, 4 Sep 2014 14:58:52 +0000 (16:58 +0200)]
drm/nouveau/pwr/memx: Return debugging information

Time measured from disabling FB to re-enabling, PPWR_IN reveals status of
heads at the end of script. Helps debug various issues (like flicker).

Signed-off-by: Roy Spliet <rspliet@eclipso.eu>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/pwr/memx: Make FB disable and enable explicit
Roy Spliet [Thu, 4 Sep 2014 14:58:50 +0000 (16:58 +0200)]
drm/nouveau/pwr/memx: Make FB disable and enable explicit

Needs to be done after wait-for-VBLANK, and NVA3 requires register writes
in between.

Rather than hard-coding register writes, just split out fb_disable and
fb_enable.

v2. Squashed "fb/ramnve0: disable fb before reclocking"

Signed-off-by: Roy Spliet <rspliet@eclipso.eu>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nva3/pwr/memx: Implement "wait for VBLANK"
Roy Spliet [Thu, 4 Sep 2014 14:58:49 +0000 (16:58 +0200)]
drm/nva3/pwr/memx: Implement "wait for VBLANK"

Signed-off-by: Roy Spliet <rspliet@eclipso.eu>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/therm/nv84+: do not expose non-calibrated internal temp sensor
Martin Peres [Sun, 24 Aug 2014 21:15:11 +0000 (23:15 +0200)]
drm/nouveau/therm/nv84+: do not expose non-calibrated internal temp sensor

Signed-off-by: Martin Peres <martin.peres@free.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/therm: make sure the temperature settings are sane on nv84+
Martin Peres [Sun, 24 Aug 2014 21:15:10 +0000 (23:15 +0200)]
drm/nouveau/therm: make sure the temperature settings are sane on nv84+

One of my nv92 has a calibrated internal sensor but it displays 0°C
as the default values use sw calibration values to force the temperature
to 0.

Since we cannot read the temperature from the adt7473 present on this board,
let's re-enable the internal reading!

Signed-off-by: Martin Peres <martin.peres@free.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/subdev: add a pfuse subdev v2
Martin Peres [Mon, 25 Aug 2014 22:26:38 +0000 (00:26 +0200)]
drm/nouveau/subdev: add a pfuse subdev v2

We will use this subdev to disable temperature reading on cards that did not
get a sensor calibration in the factory.

v2:
- rename "nouveau_fuse_rd32" to "gxXXX_fuse_rd32" as adviced by Christian Costa
- fold the code a little as adviced by Emil Velikov

Signed-off-by: Martin Peres <martin.peres@free.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nva3/clk: Set intermediate core clock on reclocking
Roy Spliet [Thu, 21 Aug 2014 11:45:17 +0000 (13:45 +0200)]
drm/nva3/clk: Set intermediate core clock on reclocking

Signed-off-by: Roy Spliet <rspliet@eclipso.eu>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nva3/clk: For PLL clocks always make sure the PLL is not in use
Roy Spliet [Thu, 21 Aug 2014 11:45:16 +0000 (13:45 +0200)]
drm/nva3/clk: For PLL clocks always make sure the PLL is not in use

Signed-off-by: Roy Spliet <rspliet@eclipso.eu>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nva3/clk: Abort when PLL doesn't lock
Roy Spliet [Thu, 21 Aug 2014 11:45:15 +0000 (13:45 +0200)]
drm/nva3/clk: Abort when PLL doesn't lock

Signed-off-by: Roy Spliet <rspliet@eclipso.eu>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nva3/clk: HOST clock
Roy Spliet [Thu, 21 Aug 2014 11:45:14 +0000 (13:45 +0200)]
drm/nva3/clk: HOST clock

Signed-off-by: Roy Spliet <rspliet@eclipso.eu>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nva3/clk: Set PLL refclk
Roy Spliet [Thu, 21 Aug 2014 11:45:13 +0000 (13:45 +0200)]
drm/nva3/clk: Set PLL refclk

Signed-off-by: Roy Spliet <rspliet@eclipso.eu>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nva3/clk: Parse clock control registers more accurately
Roy Spliet [Thu, 21 Aug 2014 11:45:12 +0000 (13:45 +0200)]
drm/nva3/clk: Parse clock control registers more accurately

Signed-off-by: Roy Spliet <rspliet@eclipso.eu>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau: Fix duplicate definition of NV04_PFB_BOOT_0_*
Pierre Moreau [Mon, 18 Aug 2014 20:32:53 +0000 (22:32 +0200)]
drm/nouveau: Fix duplicate definition of NV04_PFB_BOOT_0_*

Signed-off-by: Pierre Moreau <pierre.morrow@free.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau: Display Nouveau boot options at launch
Pierre Moreau [Mon, 18 Aug 2014 20:43:24 +0000 (22:43 +0200)]
drm/nouveau: Display Nouveau boot options at launch

It can help to remove any ambiguity about which options were passed to Nouveau,
especially in case the user had some options set in /etc/modprobe.d/*.conf that
he forgot about, as they won't appear in a dmesg.

Signed-off-by: Pierre Moreau <pierre.morrow@free.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/pwr: wait for scrubbers to finish before uploading new ucode
Ben Skeggs [Mon, 18 Aug 2014 02:41:57 +0000 (12:41 +1000)]
drm/nouveau/pwr: wait for scrubbers to finish before uploading new ucode

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/pwr/fuc: make $r1-$r10 registers callee-saved in kernel.fuc
Martin Peres [Sun, 17 Aug 2014 15:33:14 +0000 (17:33 +0200)]
drm/nouveau/pwr/fuc: make $r1-$r10 registers callee-saved in kernel.fuc

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/pwr/fuc: add ld/st macros
Martin Peres [Sun, 17 Aug 2014 15:33:13 +0000 (17:33 +0200)]
drm/nouveau/pwr/fuc: add ld/st macros

Signed-off-by: Martin Peres <martin.peres@free.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/pwr: add helpers for delay-to-ticks and ticks-to-delay
Martin Peres [Sun, 17 Aug 2014 15:33:12 +0000 (17:33 +0200)]
drm/nouveau/pwr: add helpers for delay-to-ticks and ticks-to-delay

Signed-off-by: Martin Peres <martin.peres@free.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/pwr: add some arith functions (mul32_32_64, subu64 and addu64)
Martin Peres [Sun, 17 Aug 2014 15:33:11 +0000 (17:33 +0200)]
drm/nouveau/pwr: add some arith functions (mul32_32_64, subu64 and addu64)

Signed-off-by: Martin Peres <martin.peres@free.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/pwr: fix the timers implementation with concurent processes
Martin Peres [Sun, 17 Aug 2014 15:33:10 +0000 (17:33 +0200)]
drm/nouveau/pwr: fix the timers implementation with concurent processes

The problem with the current implementation is that adding a timer improperly
checked which process would time up first by not taking into account how much
time elapsed since their timer got scheduled. Rework the re-scheduling
decision t fix this.

The catch with this fix is that we are limited to scheduling timers of up to
2^31 ticks to avoid any potential overflow. Since we are unlikely to need to
wait for more than a second, this won't be a problem :)

Another possible fix would be to decrement the timeouts of all processes but
it would duplicate a lot of code and dealing with edge cases wasn't pretty
last time I checked.

Signed-off-by: Martin Peres <martin.peres@free.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/ppwr: enable ppwr on gm107
Martin Peres [Sun, 17 Aug 2014 15:33:09 +0000 (17:33 +0200)]
drm/nouveau/ppwr: enable ppwr on gm107

For some reason, it is now required to wait a 20 µs after the 0x200 reset of
the engine.

Signed-off-by: Martin Peres <martin.peres@free.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/gm107/therm: add PWM fan support v2
Martin Peres [Sun, 17 Aug 2014 15:33:08 +0000 (17:33 +0200)]
drm/gm107/therm: add PWM fan support v2

v2: change the copyright ownership from "Nouveau Community" to myself, as per
Illia's recommendation.

Signed-off-by: Martin Peres <martin.peres@free.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/therm/fan: do not use the pwm mode when the vbios tells us to use toggle
Martin Peres [Sun, 17 Aug 2014 15:33:07 +0000 (17:33 +0200)]
drm/nouveau/therm/fan: do not use the pwm mode when the vbios tells us to use toggle

Signed-off-by: Martin Peres <martin.peres@free.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/bios/fan: add support for maxwell's fan management table v2
Martin Peres [Sun, 17 Aug 2014 15:33:06 +0000 (17:33 +0200)]
drm/nouveau/bios/fan: add support for maxwell's fan management table v2

Re-use the therm-exported fan structure with only two minor modifications:
- pwm_freq: u16 -> u32;
- add fan_type (toggle or PWM)

v2:
- Do not memset the table to 0 as it erases the pre-set default values

Signed-off-by: Martin Peres <martin.peres@free.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/ltc: allocate tagram from memory that spans all partitions
Ben Skeggs [Tue, 12 Aug 2014 05:16:16 +0000 (15:16 +1000)]
drm/nouveau/ltc: allocate tagram from memory that spans all partitions

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/core/mm: allow allocation to be confined to a specific slice of heap
Ben Skeggs [Tue, 12 Aug 2014 04:30:52 +0000 (14:30 +1000)]
drm/nouveau/core/mm: allow allocation to be confined to a specific slice of heap

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/core/mm: fill in holes with "allocated" nodes
Ben Skeggs [Tue, 12 Aug 2014 03:54:37 +0000 (13:54 +1000)]
drm/nouveau/core/mm: fill in holes with "allocated" nodes

The allocation algorithm doesn't expect there to be holes in the mm, which
causes its alignment/cutoff calculations to choke (and go negative) when
encountering the last chunk of a block before a hole.

The least expensive solution is to simply fill in any holes with nodes
that are pre-marked as being allocated.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/core/mm: dump mm when trying to tear one down that still has allocations
Ben Skeggs [Tue, 12 Aug 2014 04:48:28 +0000 (14:48 +1000)]
drm/nouveau/core/mm: dump mm when trying to tear one down that still has allocations

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/core/mm: modify test for if building a mm with holes in it
Ben Skeggs [Tue, 12 Aug 2014 03:40:42 +0000 (13:40 +1000)]
drm/nouveau/core/mm: modify test for if building a mm with holes in it

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/core/mm: make it clearer what (type == 0) means
Ben Skeggs [Tue, 12 Aug 2014 01:16:58 +0000 (11:16 +1000)]
drm/nouveau/core/mm: make it clearer what (type == 0) means

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/gf100/ltc: translate interrupt status into more meaningful names
Ben Skeggs [Tue, 12 Aug 2014 00:22:31 +0000 (10:22 +1000)]
drm/gf100/ltc: translate interrupt status into more meaningful names

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/ltc: drop workaround for an interrupt storm that no longer happens
Ben Skeggs [Tue, 12 Aug 2014 00:01:13 +0000 (10:01 +1000)]
drm/nouveau/ltc: drop workaround for an interrupt storm that no longer happens

This is really the wrong thing to do, but at the time it was our only
option to prevent worse issues.

We no longer cause quite so much anger from LTC, so it's not needed.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nv50-/disp: add support for completion events
Ben Skeggs [Mon, 11 Aug 2014 04:38:10 +0000 (14:38 +1000)]
drm/nv50-/disp: add support for completion events

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/core: pass related object into notify constructor
Ben Skeggs [Mon, 11 Aug 2014 03:56:56 +0000 (13:56 +1000)]
drm/nouveau/core: pass related object into notify constructor

The event source types/index might need to be derived from it.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau/bar: ioremap only the areas that we're actually using
Ben Skeggs [Mon, 11 Aug 2014 02:23:23 +0000 (12:23 +1000)]
drm/nouveau/bar: ioremap only the areas that we're actually using

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
10 years agoMerge tag 'topic/drm-header-rework-2014-09-12' of git://anongit.freedesktop.org/drm...
Dave Airlie [Fri, 12 Sep 2014 21:01:49 +0000 (07:01 +1000)]
Merge tag 'topic/drm-header-rework-2014-09-12' of git://anongit.freedesktop.org/drm-intel into drm-next

So here's the header cleanup, rebased on top of drm-next. Two new header
files are created here:

- drivers/gpu/drm/drm_internal.h for non-legacy drm.ko private
  declarations.

- include/drm/drm_legacy.h for legacy interfaces used by non-kms drivers.

And of course lots fo stuff gets shuffled into the already existing
drivers/gpu/drm/drm_legacy.h for drm.ko internal stuff.

topic branch smoke-tested in drm-intel-nightly for a bit. And the 0day
tester also worked through it (and found a few places I didn't add a
static to functions).

* tag 'topic/drm-header-rework-2014-09-12' of git://anongit.freedesktop.org/drm-intel:
  drm: Move DRM_MAGIC_HASH_ORDER into drm_drv.c
  drm: Move drm_class to drm_internal.h
  drm: Move LOCK_TEST_WITH_RETURN to <drm/drm_legacy.h>
  drm: Move legacy buffer structures to <drm/drm_legacy.h>
  drm: Move drm_memory.c map support declarations to <drm/drm_legacy.h>
  drm: Purge ioctl forward declarations from drmP.h
  drm: unexport drm_global_mutex
  drm: Move piles of functions from drmP.h to drm_internal.h
  drm: Move vblank related module options into drm_irq.c
  drm: Drop drm_sysfs_class from drmP.h
  drm: Move __drm_pci_free to drm_legacy.h
  drm: Create drm legacy driver header
  drm: Move drm_legacy_vma_flush into drm_legacy.h
  drm: Move sg functions into drm_legacy.h
  drm: Move dma functions into drm_legacy.h

10 years agodrm: Move DRM_MAGIC_HASH_ORDER into drm_drv.c
Daniel Vetter [Wed, 10 Sep 2014 10:44:00 +0000 (12:44 +0200)]
drm: Move DRM_MAGIC_HASH_ORDER into drm_drv.c

Only used in one place ever, so put it right next to that.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm: Move drm_class to drm_internal.h
Daniel Vetter [Wed, 10 Sep 2014 10:43:59 +0000 (12:43 +0200)]
drm: Move drm_class to drm_internal.h

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm: Move LOCK_TEST_WITH_RETURN to <drm/drm_legacy.h>
Daniel Vetter [Wed, 10 Sep 2014 10:43:58 +0000 (12:43 +0200)]
drm: Move LOCK_TEST_WITH_RETURN to <drm/drm_legacy.h>

Unfortunately we can't move struct drm_lock_data easily since
it's embedded into struct drm_master. And figuring out where exactly
this struct should be allocated isn't that simple ...

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm: Move legacy buffer structures to <drm/drm_legacy.h>
Daniel Vetter [Thu, 11 Sep 2014 05:43:25 +0000 (07:43 +0200)]
drm: Move legacy buffer structures to <drm/drm_legacy.h>

A few odd cases:
- mgag200 someho had a totally unused drm_dma_handle_t. Remove it.
- i915 still uses the legacy pci dma alloc api, so grows an include.

Everything else fairly standard.

v2: Include "drm_legacy.h" in drm.ko source files for consistency.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm: Move drm_memory.c map support declarations to <drm/drm_legacy.h>
Daniel Vetter [Wed, 10 Sep 2014 10:43:56 +0000 (12:43 +0200)]
drm: Move drm_memory.c map support declarations to <drm/drm_legacy.h>

And replace the drm_core_ prefix with drm_legacy_ since really, this
isn't core stuff.

Also drop drm_core_dropmap since it's unused.

v2: Fix up i810.ko fully which somehow slipped through.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm: Purge ioctl forward declarations from drmP.h
Daniel Vetter [Wed, 10 Sep 2014 10:43:55 +0000 (12:43 +0200)]
drm: Purge ioctl forward declarations from drmP.h

If we push down the ioctl table in drm_ioctl.c all the forward
declarations in drmP.h are not required any more.

v2: Fold in fixup from Fenugguang Wu to declare functions as static.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm: unexport drm_global_mutex
Daniel Vetter [Wed, 10 Sep 2014 10:43:54 +0000 (12:43 +0200)]
drm: unexport drm_global_mutex

Drivers really, really have no business even looking at this lock. And
thankfully they don't.

So unexport it and move the declaration to drm_internal.h.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm: Move piles of functions from drmP.h to drm_internal.h
Daniel Vetter [Wed, 10 Sep 2014 10:43:53 +0000 (12:43 +0200)]
drm: Move piles of functions from drmP.h to drm_internal.h

This way drivers can't grow crazy ideas any more, and it also
helps a bit in reviewing EXPORT_SYMBOLS.

v2: Even more stuff. Unfortunately we can't move drm_vm_open_locked
because exynos does some horrible stuff with it.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm: Move vblank related module options into drm_irq.c
Daniel Vetter [Wed, 10 Sep 2014 06:16:10 +0000 (08:16 +0200)]
drm: Move vblank related module options into drm_irq.c

This allows us to drop 2 header declarations from drmP.h. The 3rd one
is also used in drm_ioctl.c, so for that create a new drm_internal.h
header for non-legacy non-kms (since we have internal headers for
those parts already) declarations private to drm.ko.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm: Drop drm_sysfs_class from drmP.h
Daniel Vetter [Wed, 10 Sep 2014 10:43:52 +0000 (12:43 +0200)]
drm: Drop drm_sysfs_class from drmP.h

No user at all.

My guess is that this is a leftover from ttm before it used
the more abstract helpers to register/unregister its sysfs
objects (see drm_sysfs.h). At least in the existing history
it was never used.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm: Move __drm_pci_free to drm_legacy.h
Daniel Vetter [Wed, 10 Sep 2014 10:43:51 +0000 (12:43 +0200)]
drm: Move __drm_pci_free to drm_legacy.h

Also sprinkle the customary legacy_ prefix.

Unfortunately we can't move the other functions since i915 is still
using them. Shame on me for that one :(

v2: Fix patch subject as spotted by David Herrmann.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm: Create drm legacy driver header
Daniel Vetter [Wed, 10 Sep 2014 10:43:49 +0000 (12:43 +0200)]
drm: Create drm legacy driver header

And move a few legayc functions to start things over there.

It compiles ...

Inspired by a patch from Dave Airlie, but with a split between drm.ko
private legacy functions and stuff used by drivers.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm: Move drm_legacy_vma_flush into drm_legacy.h
Daniel Vetter [Wed, 10 Sep 2014 10:43:48 +0000 (12:43 +0200)]
drm: Move drm_legacy_vma_flush into drm_legacy.h

Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
10 years agodrm: Move sg functions into drm_legacy.h
Daniel Vetter [Thu, 11 Sep 2014 05:42:43 +0000 (07:42 +0200)]
drm: Move sg functions into drm_legacy.h

Also sprinkle the drm_legacy_ prefix where missing.

v2: Drop extern from function declarations and include "drm_legacy.h"
in drm_scatter.c, spotted by David.

Cc: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm: Move dma functions into drm_legacy.h
Daniel Vetter [Thu, 11 Sep 2014 05:41:51 +0000 (07:41 +0200)]
drm: Move dma functions into drm_legacy.h

Also drop the unneeded EXPORT_SYMBOL and sprinkle drm_legacy_ prefixes
where missing.

v2: Drop the confusing _core_ and drop extern, both suggested by
David.

Cc: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agoMerge tag 'topic/vblank-rework-2014-09-12' of git://anongit.freedesktop.org/drm-intel...
Dave Airlie [Fri, 12 Sep 2014 09:04:53 +0000 (19:04 +1000)]
Merge tag 'topic/vblank-rework-2014-09-12' of git://anongit.freedesktop.org/drm-intel into drm-next

So updated vblank-rework pull request, now with the polish that Mario
requested applied (and reviewed by him). Also with backmerge like you've
requested for easier merging.

The neat thing this finally allows is to immediately disable the vblank
interrupt on the last drm_vblank_put if the hardware has perfectly
accurate vblank counter and timestamp readout support. On i915 that
required piles of small adjustements from Ville since depending upon the
platform and port the vblank happens at different scanout lines.

Of course this is fully opt-in and per-device (we need that since gen2
doesn't have a hw vblank counter).

* tag 'topic/vblank-rework-2014-09-12' of git://anongit.freedesktop.org/drm-intel: (22 commits)
  drm: Clarify vblank ts/scanoutpos sampling #defines
  drm: Simplify return value of drm_get_last_vbltimestamp
  drm: Only update final vblank count when precise ts is available
  drm: Really never disable vblank irqs for offdelay==0
  drm: Use vblank_disable_and_save in drm_vblank_cleanup()
  drm: Remove drm_vblank_cleanup from drm_vblank_init error path.
  drm: Store the vblank timestamp when adjusting the counter during disable
  drm: Fix confusing debug message in drm_update_vblank_count()
  drm/i915: Update scanline_offset only for active crtcs
  drm: Kick start vblank interrupts at drm_vblank_on()
  drm/i915: Opt out of vblank disable timer on >gen2
  drm: Add dev->vblank_disable_immediate flag
  drm: Disable vblank interrupt immediately when drm_vblank_offdelay<0
  drm: Fix race between drm_vblank_off() and drm_queue_vblank_event()
  drm: Fix deadlock between event_lock and vbl_lock/vblank_time_lock
  drm: Reduce the amount of dev->vblank[crtc] in the code
  drm: Avoid random vblank counter jumps if the hardware counter has been reset
  drm: Have the vblank counter account for the time between vblank irq disable and drm_vblank_off()
  drm: Move drm_update_vblank_count()
  drm: Don't clear vblank timestamps when vblank interrupt is disabled
  ...

10 years agodrm/ast: switch to using CACHED by default for sysram
Dave Airlie [Fri, 12 Sep 2014 04:32:40 +0000 (14:32 +1000)]
drm/ast: switch to using CACHED by default for sysram

This fixes problems on ppc64 platforms, where we could end up using
a WC mapping for migrating BOs with memcpy, when really we want to
use cached memory.

Tested-by: Ben Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
10 years agodrm: split ati_pcigart.h out of drmP.h
Dave Airlie [Wed, 10 Sep 2014 08:23:07 +0000 (18:23 +1000)]
drm: split ati_pcigart.h out of drmP.h

Just move this into a separate header file, and make the
two users use it.

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
10 years agoMerge branch 'drm-next-3.18' of git://people.freedesktop.org/~agd5f/linux into drm...
Dave Airlie [Fri, 12 Sep 2014 03:58:27 +0000 (13:58 +1000)]
Merge branch 'drm-next-3.18' of git://people.freedesktop.org/~agd5f/linux into drm-next

concurrent buffer reads.

* 'drm-next-3.18' of git://people.freedesktop.org/~agd5f/linux:
  drm/radeon: allow concurrent buffer reads
  drm/radeon: add the infrastructure for concurrent buffer access
  drm/ttm: allow fence to be added as shared

10 years agodrm/vmwgfx: Fix drm.h include
Josh Boyer [Fri, 5 Sep 2014 17:19:59 +0000 (13:19 -0400)]
drm/vmwgfx: Fix drm.h include

The userspace drm.h include doesn't prefix the drm directory.  This can lead
to compile failures as /usr/include/drm/ isn't in the standard gcc include
paths.  Fix it to be <drm/drm.h>, which matches the rest of the driver drm
header files that get installed into /usr/include/drm.

Red Hat Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1138759

Fixes: 1d7a5cbf8f74e
Reported-by: Jeffrey Bastian <jbastian@redhat.com>
Signed-off-by: Josh Boyer <jwboyer@fedoraproject.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
10 years agodrm/radeon: allow concurrent buffer reads
Christian König [Thu, 4 Sep 2014 18:01:54 +0000 (20:01 +0200)]
drm/radeon: allow concurrent buffer reads

Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
10 years agodrm/radeon: add the infrastructure for concurrent buffer access
Christian König [Thu, 4 Sep 2014 18:01:53 +0000 (20:01 +0200)]
drm/radeon: add the infrastructure for concurrent buffer access

This allows us to specify if we want to sync to
the shared fences of a reservation object or not.

Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
10 years agodrm/ttm: allow fence to be added as shared
Christian König [Thu, 4 Sep 2014 18:01:52 +0000 (20:01 +0200)]
drm/ttm: allow fence to be added as shared

This patch adds a new flag to the ttm_validate_buffer list to
add the fence as shared to the reservation object.

Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
10 years agoMerge remote-tracking branch 'airlied/drm-next' into topic/vblank-rework
Daniel Vetter [Thu, 11 Sep 2014 12:46:53 +0000 (14:46 +0200)]
Merge remote-tracking branch 'airlied/drm-next' into topic/vblank-rework

Dave asked me to do the backmerge before sending him the revised pull
request, so here we go. Nothing fancy in the conflicts, just a few
things changed right next to each another.

Conflicts:
drivers/gpu/drm/drm_irq.c

Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
10 years agodrm: Clarify vblank ts/scanoutpos sampling #defines
Daniel Vetter [Wed, 10 Sep 2014 15:36:11 +0000 (17:36 +0200)]
drm: Clarify vblank ts/scanoutpos sampling #defines

I've read INVBL as "invalid backlight" and got mightly confused.
The #defines are already fairly long and we can afford to extend
them a bit more without resulting in ugly code all over.

I'm not sure how useful the complicated bitmask return value of these
functions really are since no one checks them. But for now let's keep
things as is.

Cc: Mario Kleiner <mario.kleiner.de@gmail.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm: Simplify return value of drm_get_last_vbltimestamp
Daniel Vetter [Wed, 10 Sep 2014 15:36:10 +0000 (17:36 +0200)]
drm: Simplify return value of drm_get_last_vbltimestamp

Imo u32 hints at a register value, but in reality all callers only
care whether the sampled timestamp is precise or not. So give them
just a bool.

Also move the declaration out of drmP.h, it's only used in drm_irq.c.

v2: Also drop the EXPORT_SYMBOL, spotted by Mario.

Cc: Mario Kleiner <mario.kleiner.de@gmail.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
10 years agodrm: Only update final vblank count when precise ts is available
Daniel Vetter [Wed, 10 Sep 2014 15:36:09 +0000 (17:36 +0200)]
drm: Only update final vblank count when precise ts is available

Drivers without a hardware vblank counter simply can't account for the
vblanks that happened while the vblank interrupt was off. To check
this grab a vblank timestamp and if the result is dubious follow the
normal save-and-disable logic.

Drivers should prevent this by setting vblank_disable_allowed = false,
but since running vblank interrupts constantly is not good for power
consumption most drivers lie. Testing for precise vblank timestamps is
the next best thing we can check for.

Suggested-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Cc: Mario Kleiner <mario.kleiner.de@gmail.com>
Cc: Matt Roper <matthew.d.roper@intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
10 years agodrm: Really never disable vblank irqs for offdelay==0
Daniel Vetter [Wed, 10 Sep 2014 15:36:08 +0000 (17:36 +0200)]
drm: Really never disable vblank irqs for offdelay==0

With the new support for immediate vblank disabling we always disabled
the vblank interrupt right away, irrespective of the vblank offdelay
setting.

But being able to let vblanks run forever is fairly useful for
debugging, so restore that behaviour.

Suggested-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Cc: Mario Kleiner <mario.kleiner.de@gmail.com>
Cc: Matt Roper <matthew.d.roper@intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Matt Roper <matthew.d.roper@intel.com>
Reviewed-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
10 years agoMerge branch 'msm-next' of git://people.freedesktop.org/~robclark/linux into drm...
Dave Airlie [Thu, 11 Sep 2014 10:53:57 +0000 (20:53 +1000)]
Merge branch 'msm-next' of git://people.freedesktop.org/~robclark/linux into drm-next

 1) add LVDS support for mdp4 (tested with auo B101XTN01.0 panel)
 2) add B101XTN01.0 panel
 3) bit of gpu refactoring to prepare for addition of addition gpu
generations beyond just a3xx

* 'msm-next' of git://people.freedesktop.org/~robclark/linux:
  drm/msm/adreno: push dump/show stuff to base class
  drm/msm/adreno: bit of init refactoring
  drm/msm/adreno: move decision about what gpu to to load
  drm/msm/adreno: split adreno device out into it's own file
  drm/panel/simple: add optronics B101XTN01.0 (v3)
  drm/msm/mdp4: add LVDS panel support
  drm/msm/mdp4: fix blend setup with multiple crtcs
  drm/msm: update generated headers

10 years agoMerge branch 'drm-next-3.18' of git://people.freedesktop.org/~agd5f/linux into drm...
Dave Airlie [Thu, 11 Sep 2014 09:58:32 +0000 (19:58 +1000)]
Merge branch 'drm-next-3.18' of git://people.freedesktop.org/~agd5f/linux into drm-next

A few more radeon patches for 3.18.  This patch set gives us more
flexibility with respect to buffer placement in vram with respect
to CPU access.  E.g., if you know you will not need CPU access, we can
now pin outside of the CPU window, reducing contention for the
CPU window space.

* 'drm-next-3.18' of git://people.freedesktop.org/~agd5f/linux:
  drm/radeon: add RADEON_GEM_NO_CPU_ACCESS BO creation flag (v4)
  drm/radeon: Clean up assignment of TTM placement lpfn member for pinning
  drm/radeon: Add RADEON_GEM_CPU_ACCESS BO creation flag

10 years agodrm/radeon: add RADEON_GEM_NO_CPU_ACCESS BO creation flag (v4)
Alex Deucher [Thu, 28 Aug 2014 14:59:05 +0000 (10:59 -0400)]
drm/radeon: add RADEON_GEM_NO_CPU_ACCESS BO creation flag (v4)

Allows pinning of buffers in the non-CPU visible portion of
vram.

v2: incorporate Michel's comments.
v3: rebase on Michel's patch
v4: rebase on Michel's v2 patch

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
10 years agodrm/radeon: Clean up assignment of TTM placement lpfn member for pinning
Michel Dänzer [Tue, 9 Sep 2014 01:09:23 +0000 (10:09 +0900)]
drm/radeon: Clean up assignment of TTM placement lpfn member for pinning

This sets the lpfn member to 0 instead of the full domain size. TTM uses
the full domain size when lpfn is 0.

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
10 years agodrm/radeon: Add RADEON_GEM_CPU_ACCESS BO creation flag
Michel Dänzer [Thu, 28 Aug 2014 06:56:00 +0000 (15:56 +0900)]
drm/radeon: Add RADEON_GEM_CPU_ACCESS BO creation flag

This flag is a hint that userspace expects the BO to be accessed by the
CPU. We can use that hint to prevent such BOs from ever being stored in
the CPU inaccessible part of VRAM.

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
10 years agodrm/msm/adreno: push dump/show stuff to base class
Rob Clark [Fri, 5 Sep 2014 19:05:38 +0000 (15:05 -0400)]
drm/msm/adreno: push dump/show stuff to base class

Add ptr to list of interesting registers to 'struct adreno_gpu' and use
that to move most of the debugfs show and register dump bits down into
adreno_gpu.  This will avoid duplication as support for additional
adreno generations is added.

Signed-off-by: Rob Clark <robdclark@gmail.com>
10 years agodrm/msm/adreno: bit of init refactoring
Rob Clark [Fri, 5 Sep 2014 19:03:40 +0000 (15:03 -0400)]
drm/msm/adreno: bit of init refactoring

Push a few bits down into adreno_gpu so they won't have to be duplicated
as support for additional adreno generations is added.

Signed-off-by: Rob Clark <robdclark@gmail.com>
10 years agodrm/msm/adreno: move decision about what gpu to to load
Rob Clark [Fri, 5 Sep 2014 17:30:27 +0000 (13:30 -0400)]
drm/msm/adreno: move decision about what gpu to to load

Move this into into adreno_device, and decide based on gpu revision
rather than just assuming a3xx.

Signed-off-by: Rob Clark <robdclark@gmail.com>
10 years agodrm/msm/adreno: split adreno device out into it's own file
Rob Clark [Fri, 5 Sep 2014 17:06:37 +0000 (13:06 -0400)]
drm/msm/adreno: split adreno device out into it's own file

We'd rather not duplicate these parts as support for additional gpu
generations is added.

Signed-off-by: Rob Clark <robdclark@gmail.com>
10 years agodrm/panel/simple: add optronics B101XTN01.0 (v3)
Rob Clark [Fri, 1 Aug 2014 21:01:06 +0000 (17:01 -0400)]
drm/panel/simple: add optronics B101XTN01.0 (v3)

LVDS panel, make/model described as:

AU Optronics Corporation - B101XTN01.0 (H/W:0A)

See:
http://www.encore-electronic.com/media/B101XTN01.0.pdf

Tested with panel attached to an Inforce IFC6410 board.

Signed-off-by: Rob Clark <robdclark@gmail.com>
10 years agodrm/msm/mdp4: add LVDS panel support
Rob Clark [Fri, 1 Aug 2014 17:08:11 +0000 (13:08 -0400)]
drm/msm/mdp4: add LVDS panel support

LVDS panel support uses the LCDC (parallel) encoder.  Unlike with HDMI,
there is not a separate LVDS block, so no need to split things into a
bridge+connector.  Nor is there is anything re-used with mdp5.

Note that there can be some regulators shared between HDMI and LVDS (in
particular, on apq8064, ext_3v3p), so we should not use the _exclusive()
variants of devm_regulator_get().

The drm_panel framework is used for panel-specific driver.

Signed-off-by: Rob Clark <robdclark@gmail.com>
10 years agodrm/msm/mdp4: fix blend setup with multiple crtcs
Rob Clark [Wed, 6 Aug 2014 11:43:12 +0000 (07:43 -0400)]
drm/msm/mdp4: fix blend setup with multiple crtcs

In particular, blend_setup() should not overwrite the other crtc's mixer
settings.  Also, the encoder needs to be able to specify the mixer-id
explicitly, since both LVDS and DTV use 'INTF_LVDC_DTV', so we cannot
guess the mixer-id from the interface.

Signed-off-by: Rob Clark <robdclark@gmail.com>
10 years agodrm/msm: update generated headers
Rob Clark [Fri, 1 Aug 2014 12:26:56 +0000 (08:26 -0400)]
drm/msm: update generated headers

In particular, pick up the definitions for a handful of LVDS related
registers.

Signed-off-by: Rob Clark <robdclark@gmail.com>
10 years agoMerge tag 'ipu-3.18' of git://git.pengutronix.de/git/pza/linux into drm-next
Dave Airlie [Wed, 10 Sep 2014 09:43:29 +0000 (19:43 +1000)]
Merge tag 'ipu-3.18' of git://git.pengutronix.de/git/pza/linux into drm-next

IPUv3 preparations for capture support

* tag 'ipu-3.18' of git://git.pengutronix.de/git/pza/linux: (26 commits)
  gpu: ipu-v3: Add ipu_dump()
  gpu: ipu-cpmem: Add ipu_cpmem_dump()
  gpu: ipu-v3: Add more planar formats support
  gpu: ipu-cpmem: Add second buffer support to ipu_cpmem_set_image()
  gpu: ipu-cpmem: Add ipu_cpmem_set_rotation()
  gpu: ipu-cpmem: Add ipu_cpmem_set_axi_id()
  gpu: ipu-cpmem: Add ipu_cpmem_set_block_mode()
  gpu: ipu-v3: Add ipu_idmac_lock_enable()
  gpu: ipu-v3: Add ipu_idmac_enable_watermark()
  gpu: ipu-v3: Add ipu_stride_to_bytes()
  gpu: ipu-v3: Add __ipu_idmac_reset_current_buffer()
  gpu: ipu-v3: Add ipu_idmac_clear_buffer()
  gpu: ipu-v3: Add ipu_idmac_buffer_is_ready()
  gpu: ipu-v3: Move IDMAC channel names to imx-ipu-v3.h
  gpu: ipu-v3: Add helper function checking if pixfmt is planar
  gpu: ipu-v3: Add rotation mode conversion utilities
  gpu: ipu-v3: Add ipu_mbus_code_to_colorspace()
  gpu: ipu-v3: smfc: Add ipu_smfc_set_watermark()
  gpu: ipu-v3: smfc: Convert to per-channel
  gpu: ipu-v3: smfc: Move enable/disable to ipu-smfc.c
  ...

10 years agodrm: move drm-lock API to drm_legacy.h
David Herrmann [Fri, 29 Aug 2014 10:12:46 +0000 (12:12 +0200)]
drm: move drm-lock API to drm_legacy.h

Same as the other legacy APIs, most of this is internal, so prefix it with
drm_legacy_* and move into drm_legacy.h.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Reviewed-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
10 years agodrm: merge drm_usb into udl
David Herrmann [Fri, 29 Aug 2014 10:12:45 +0000 (12:12 +0200)]
drm: merge drm_usb into udl

This merges all the remains of drm_usb into its only user, udl. We can
then drop all the drm_usb stuff, including dev->usbdev.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Reviewed-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>
10 years agodrm: Goody bye, drm_bus!
David Herrmann [Fri, 29 Aug 2014 10:12:44 +0000 (12:12 +0200)]
drm: Goody bye, drm_bus!

..we will not miss you..

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Reviewed-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>
10 years agodrm: add driver->set_busid() callback
David Herrmann [Fri, 29 Aug 2014 10:12:43 +0000 (12:12 +0200)]
drm: add driver->set_busid() callback

One step closer to dropping all the drm_bus_* code:
Add a driver->set_busid() callback and make all drivers use the generic
helpers. Nouveau is the only driver that uses two different bus-types with
the same drm_driver. This is totally broken if both buses are available on
the same machine (unlikely, but lets be safe). Therefore, we create two
different drivers for each platform during module_init() and set the
set_busid() callback respectively.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Reviewed-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
10 years agodrm: drop unused drm_master->unique_size
David Herrmann [Fri, 29 Aug 2014 10:12:42 +0000 (12:12 +0200)]
drm: drop unused drm_master->unique_size

This field is unused and there is really no reason to optimize
unique-allocations. Drop it.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Reviewed-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>
10 years agodrm: simplify drm_*_set_unique()
David Herrmann [Fri, 29 Aug 2014 10:12:41 +0000 (12:12 +0200)]
drm: simplify drm_*_set_unique()

Lets use kasprintf() to avoid pre-allocating the buffer. This is really
nothing to optimize for speed and the input is trusted, so kasprintf() is
just fine.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Reviewed-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>
10 years agodrm: move remaining includes in drmP.h to the top
David Herrmann [Fri, 29 Aug 2014 10:12:40 +0000 (12:12 +0200)]
drm: move remaining includes in drmP.h to the top

Including headers somewhere else but at the top is ugly, deprecated and
was used in early days only to speed up compile-times. Those days are
over. Make headers independent and then move the inclusions to the top.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Reviewed-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
10 years agodrm: inline "struct drm_sigdata"
David Herrmann [Fri, 29 Aug 2014 10:12:39 +0000 (12:12 +0200)]
drm: inline "struct drm_sigdata"

The sigdata structure is only used to group two fields in drm_device.
Inline it and make it an unnamed object.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Reviewed-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
10 years agodrm: Use vblank_disable_and_save in drm_vblank_cleanup()
Mario Kleiner [Wed, 6 Aug 2014 01:22:46 +0000 (03:22 +0200)]
drm: Use vblank_disable_and_save in drm_vblank_cleanup()

Calling vblank_disable_fn() will cause that function to no-op
if !dev->vblank_disable_allowed for some kms drivers, e.g.,
on nouveau-kms. This can cause the gpu vblank irq's to not get
disabled before freeing the dev->vblank array, so if a
vblank irq fires and calls into drm_handle_vblank() after
drm_vblank_cleanup() completes, it will cause use-after-free
access to dev->vblank array.

Call vblank_disable_and_save unconditionally, so vblank irqs
are guaranteed to be off, before we delete the data structures
on which they operate.

Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
[danvet: Fix subsystem name in patch subject.]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
10 years agodrm: drop DRM_DEBUG_CODE
David Herrmann [Fri, 29 Aug 2014 10:12:38 +0000 (12:12 +0200)]
drm: drop DRM_DEBUG_CODE

DRM_DEBUG_CODE is currently always set, so distributions enable it. The
only reason to keep support in code is if developers wanted to disable
debug support. Sounds unlikely.

All the DRM_DEBUG() printks are still guarded by a drm_debug read. So if
its cacheline is read once, they're discarded pretty fast.. There should
hardly be any performance penalty, it's even guarded by unlikely().

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Reviewed-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
10 years agodrm: order includes alphabetically in drmP.h
David Herrmann [Fri, 29 Aug 2014 10:12:37 +0000 (12:12 +0200)]
drm: order includes alphabetically in drmP.h

It is hardly possible to review the drmP.h includes, anymore. Order them
alphabetically, linux/ first, then asm/ and then local drm/ includes.

Since a long time ago, kernel headers have been converted to include
required headers themselves. No-one cares whether that means the compiler
has to include a header multiple times. In fact, GCC already does some
optimization regarding multiple inclusions if a sorrounding #ifndef is
present.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Acked-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
10 years agodrm: move __OS_HAS_AGP into drm_agpsupport.h
David Herrmann [Fri, 29 Aug 2014 10:12:36 +0000 (12:12 +0200)]
drm: move __OS_HAS_AGP into drm_agpsupport.h

With drm_memory.h gone, there is no header left that uses __OS_HAS_AGP.
Move it into drm_agpsupport.h (which is itself included from drmP.h) to
hide it harder from public eyes.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
10 years agodrm: merge drm_memory.h into drm_memory.c
David Herrmann [Fri, 29 Aug 2014 10:12:35 +0000 (12:12 +0200)]
drm: merge drm_memory.h into drm_memory.c

The drm_memory.h header is only used to define PAGE_AGP, which is only
used in drm_memory.c. Fold the header into drm_memory.c and drop it.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>