openwrt/staging/blogic.git
11 years agodrm: Remove preempt_disable() from vblank timestamping code.
Mario Kleiner [Wed, 30 Oct 2013 04:13:05 +0000 (05:13 +0100)]
drm: Remove preempt_disable() from vblank timestamping code.

Preemption handling will get pushed into the kms
drivers in followup patches, to make timestamping
more robust and PREEMPT_RT friendly.

Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agoMerge branch 'drm-next-3.13' of git://people.freedesktop.org/~agd5f/linux into drm...
Dave Airlie [Tue, 5 Nov 2013 06:22:08 +0000 (16:22 +1000)]
Merge branch 'drm-next-3.13' of git://people.freedesktop.org/~agd5f/linux into drm-next

Initial pull request for radeon drm-next 3.13.  Highlights:
- Enable DPM on a number of asics by default
- Enable audio by default
- Dynamically power down dGPUs on PowerXpress systems
- Lots of bug fixes
* 'drm-next-3.13' of git://people.freedesktop.org/~agd5f/linux: (36 commits)
  drm/radeon: don't share PPLLs on DCE4.1
  drm/radeon/dpm: fix typo in setting smc flag
  drm/radeon: fixup locking inversion between, mmap_sem and reservations
  drm/radeon: clear the page directory using the DMA
  drm/radeon: initially clear page tables
  drm/radeon: drop CP page table updates & cleanup v2
  drm/radeon: add vm_set_page tracepoint
  drm/radeon: rework and fix reset detection v2
  drm/radeon: don't use PACKET2 on CIK
  drm/radeon: fix UVD destroy IB size
  drm/radeon: activate UVD clocks before sending the destroy msg
  drm/radeon/si: fix define for MC_SEQ_TRAIN_WAKEUP_CNTL
  drm/radeon: fix endian handling in rlc buffer setup
  drm/radeon/dpm: retain user selected performance level across state changes
  drm/radeon: disable force performance state when thermal state is active
  drm/radeon: enable DPM by default on r7xx asics
  drm/radeon: enable DPM by default on evergreen asics
  drm/radeon: enable DPM by default on BTC asics
  drm/radeon: enable DPM by default on SI asics
  drm/radeon: enable DPM by default on SUMO/PALM APUs
  ...

11 years agoMerge tag 'drm/for-3.13-rc1' of git://anongit.freedesktop.org/tegra/linux into drm...
Dave Airlie [Tue, 5 Nov 2013 06:21:00 +0000 (16:21 +1000)]
Merge tag 'drm/for-3.13-rc1' of git://anongit.freedesktop.org/tegra/linux into drm-next

drm/tegra: Changes for v3.13-rc1

The biggest part of the changes is the decoupling of the host1x and DRM
drivers followed by the move of Tegra DRM back to drivers/gpu/drm/tegra
from whence it came. There is a lot of cleanup as well, and the drivers
can now be properly unloaded and reloaded.

HDMI support for the Tegra114 SoC was contributed by Mikko Perttunen.

gr2d support was extended to Tegra114 and the gr3d driver that has been
in the works for quite some time finally made it in. All pieces to run
an OpenGL driver on top of an upstream kernel are now available.

Support for syncpoint bases was added by Arto Merilainen. This is useful
for synchronizing between command streams from different engines such as
gr2d and gr3d.

Erik Faye-Lund and Wei Yongjun contributed various small fixes. Thanks!

* tag 'drm/for-3.13-rc1' of git://anongit.freedesktop.org/tegra/linux: (45 commits)
  drm/tegra: Reserve syncpoint base for gr3d
  drm/tegra: Reserve base for gr2d
  drm/tegra: Deliver syncpoint base to user space
  gpu: host1x: Add syncpoint base support
  gpu: host1x: Add 'flags' field to syncpt request
  drm/tegra: Disable clock on probe failure
  gpu: host1x: Disable clock on probe failure
  drm/tegra: Support bottom-up buffer objects
  drm/tegra: Add support for tiled buffer objects
  drm/tegra: Add 3D support
  drm/tegra: Introduce tegra_drm_submit()
  drm/tegra: Use symbolic names for gr2d registers
  drm/tegra: Start connectors with correct DPMS mode
  drm/tegra: hdmi: Enable VDD earlier for hotplug/DDC
  drm/tegra: hdmi: Fix build warnings
  drm/tegra: hdmi: Detect DVI-only displays
  drm/tegra: Add Tegra114 HDMI support
  drm/tegra: hdmi: Parameterize based on compatible property
  drm/tegra: hdmi: Rename tegra{2,3} to tegra{20,30}
  gpu: host1x: Add support for Tegra114
  ...

11 years agoqxl: avoid an oops in the deferred io code.
Dave Airlie [Mon, 4 Nov 2013 06:38:08 +0000 (16:38 +1000)]
qxl: avoid an oops in the deferred io code.

If we are using deferred io due to plymouth or X.org fbdev driver
we will oops in memcpy due to this pointless multiply here,

removing it fixes fbdev to start and not oops.

Cc: stable@vger.kernel.org
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm/radeon: don't share PPLLs on DCE4.1
Alex Deucher [Thu, 31 Oct 2013 20:43:27 +0000 (16:43 -0400)]
drm/radeon: don't share PPLLs on DCE4.1

Sharing PPLLs seems to cause problems on some boards.

Bug:
https://bugs.freedesktop.org/show_bug.cgi?id=45334

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
11 years agodrm/radeon/dpm: fix typo in setting smc flag
Alex Deucher [Fri, 1 Nov 2013 17:30:55 +0000 (13:30 -0400)]
drm/radeon/dpm: fix typo in setting smc flag

PPSMC_EXTRAFLAGS_AC2DC_GPIO5_POLARITY_HIGH should be
set in extraFlags, not systemFlags.

Noticed-by: Sylvain BERTRAND <sylware@legeek.net>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: fixup locking inversion between, mmap_sem and reservations
Maarten Lankhorst [Wed, 9 Oct 2013 12:36:57 +0000 (14:36 +0200)]
drm/radeon: fixup locking inversion between, mmap_sem and reservations

op 08-10-13 18:58, Thomas Hellstrom schreef:
> On 10/08/2013 06:47 PM, Jerome Glisse wrote:
>> On Tue, Oct 08, 2013 at 06:29:35PM +0200, Thomas Hellstrom wrote:
>>> On 10/08/2013 04:55 PM, Jerome Glisse wrote:
>>>> On Tue, Oct 08, 2013 at 04:45:18PM +0200, Christian König wrote:
>>>>> Am 08.10.2013 16:33, schrieb Jerome Glisse:
>>>>>> On Tue, Oct 08, 2013 at 04:14:40PM +0200, Maarten Lankhorst wrote:
>>>>>>> Allocate and copy all kernel memory before doing reservations. This prevents a locking
>>>>>>> inversion between mmap_sem and reservation_class, and allows us to drop the trylocking
>>>>>>> in ttm_bo_vm_fault without upsetting lockdep.
>>>>>>>
>>>>>>> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
>>>>>> I would say NAK. Current code only allocate temporary page in AGP case.
>>>>>> So AGP case is userspace -> temp page -> cs checker -> radeon ib.
>>>>>>
>>>>>> Non AGP is directly memcpy to radeon IB.
>>>>>>
>>>>>> Your patch allocate memory memcpy userspace to it and it will then be
>>>>>> memcpy to IB. Which means you introduce an extra memcpy in the process
>>>>>> not something we want.
>>>>> Totally agree. Additional to that there is no good reason to provide
>>>>> anything else than anonymous system memory to the CS ioctl, so the
>>>>> dependency between the mmap_sem and reservations are not really
>>>>> clear to me.
>>>>>
>>>>> Christian.
>>>> I think is that in other code path you take mmap_sem first then reserve
>>>> bo. But here we reserve bo and then we take mmap_sem because of copy
>>> >from user.
>>>> Cheers,
>>>> Jerome
>>>>
>>> Actually the log message is a little confusing. I think the mmap_sem
>>> locking inversion problem is orthogonal to what's being fixed here.
>>>
>>> This patch fixes the possible recursive bo::reserve caused by
>>> malicious user-space handing a pointer to ttm memory so that the ttm
>>> fault handler is called when bos are already reserved. That may
>>> cause a (possibly interruptible) livelock.
>>>
>>> Once that is fixed, we are free to choose the mmap_sem ->
>>> bo::reserve locking order. Currently it's bo::reserve->mmap_sem(),
>>> but the hack required in the ttm fault handler is admittedly a bit
>>> ugly.  The plan is to change the locking order to
>>> mmap_sem->bo::reserve
>>>
>>> I'm not sure if it applies to this particular case, but it should be
>>> possible to make sure that copy_from_user_inatomic() will always
>>> succeed, by making sure the pages are present using
>>> get_user_pages(), and release the pages after
>>> copy_from_user_inatomic() is done. That way there's no need for a
>>> double memcpy slowpath, but if the copied data is very fragmented I
>>> guess the resulting code may look ugly. The get_user_pages()
>>> function will return an error if it hits TTM pages.
>>>
>>> /Thomas
>> get_user_pages + copy_from_user_inatomic is overkill. We should just
>> do get_user_pages which fails with ttm memory and then use copy_highpage
>> helper.
>>
>> Cheers,
>> Jerome
> Yeah, it may well be that that's the preferred solution.
>
> /Thomas
>
I still disagree, and shuffled radeon_ib_get around to be called sooner.

How does the patch below look?
8<-------
Allocate and copy all kernel memory before doing reservations. This prevents a locking
inversion between mmap_sem and reservation_class, and allows us to drop the trylocking
in ttm_bo_vm_fault without upsetting lockdep.

Changes since v1:
- Kill extra memcpy for !AGP case.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Reviewed-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: clear the page directory using the DMA
Christian König [Tue, 29 Oct 2013 19:14:51 +0000 (20:14 +0100)]
drm/radeon: clear the page directory using the DMA

Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: initially clear page tables
Christian König [Tue, 29 Oct 2013 19:14:50 +0000 (20:14 +0100)]
drm/radeon: initially clear page tables

Clear page tables after allocating them in case
we don't completely fill them later.

Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: drop CP page table updates & cleanup v2
Christian König [Wed, 30 Oct 2013 15:51:09 +0000 (11:51 -0400)]
drm/radeon: drop CP page table updates & cleanup v2

The DMA ring seems to be stable now.

v2: remove pt_ring_index as well

Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: add vm_set_page tracepoint
Christian König [Tue, 29 Oct 2013 19:14:48 +0000 (20:14 +0100)]
drm/radeon: add vm_set_page tracepoint

Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: rework and fix reset detection v2
Christian König [Tue, 29 Oct 2013 19:14:47 +0000 (20:14 +0100)]
drm/radeon: rework and fix reset detection v2

Stop fiddling with jiffies, always wait for RADEON_FENCE_JIFFIES_TIMEOUT.
Consolidate the two wait sequence implementations into just one function.
Activate all waiters and remember if the reset was already done instead of
trying to reset from only one thread.

v2: clear reset flag earlier to avoid timeout in IB test

Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: don't use PACKET2 on CIK
Marek Olšák [Wed, 30 Oct 2013 13:41:35 +0000 (14:41 +0100)]
drm/radeon: don't use PACKET2 on CIK

It is said to cause hangs.

Signed-off-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: fix UVD destroy IB size
Christian König [Wed, 30 Oct 2013 11:56:05 +0000 (12:56 +0100)]
drm/radeon: fix UVD destroy IB size

The parameter is in bytes not dwords.

Signed-off-by: Christian König <christian.koenig@amd.com>
Cc: stable@vger.kernel.org
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: activate UVD clocks before sending the destroy msg
Christian König [Wed, 30 Oct 2013 11:56:04 +0000 (12:56 +0100)]
drm/radeon: activate UVD clocks before sending the destroy msg

Make sure the UVD clocks are still active before sending
the destroy message, otherwise the hw might hang.

Signed-off-by: Christian König <christian.koenig@amd.com>
Cc: stable@vger.kernel.org
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon/si: fix define for MC_SEQ_TRAIN_WAKEUP_CNTL
Alex Deucher [Mon, 28 Oct 2013 14:56:23 +0000 (10:56 -0400)]
drm/radeon/si: fix define for MC_SEQ_TRAIN_WAKEUP_CNTL

Typo in the register offset.

Noticed-by: Sylvain BERTRAND <sylware@legeek.net>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
11 years agodrm/radeon: fix endian handling in rlc buffer setup
Alex Deucher [Wed, 23 Oct 2013 22:27:10 +0000 (18:27 -0400)]
drm/radeon: fix endian handling in rlc buffer setup

The buffers needs to be in little endian format.

Noticed-by: Sylvain BERTRAND <sylware@legeek.net>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon/dpm: retain user selected performance level across state changes
Alex Deucher [Wed, 23 Oct 2013 21:31:42 +0000 (17:31 -0400)]
drm/radeon/dpm: retain user selected performance level across state changes

If the user has forced the state high or low, retain that preference
even when we switch power states.

Fixes:
https://bugs.freedesktop.org/show_bug.cgi?id=70654

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: disable force performance state when thermal state is active
Alex Deucher [Wed, 23 Oct 2013 21:22:29 +0000 (17:22 -0400)]
drm/radeon: disable force performance state when thermal state is active

If the thermal state is active, we are in the lowest performance level
to cool down the chip.  Don't let the user force it higher.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: enable DPM by default on r7xx asics
Alex Deucher [Fri, 1 Nov 2013 19:16:02 +0000 (15:16 -0400)]
drm/radeon: enable DPM by default on r7xx asics

Seems to be stable on them.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: enable DPM by default on evergreen asics
Alex Deucher [Fri, 1 Nov 2013 19:11:34 +0000 (15:11 -0400)]
drm/radeon: enable DPM by default on evergreen asics

Seems to be stable on them.  There are still some issues
with the performance states staying in the highest levels
on certain cards when multiple monitors are attached, but
being that the the cards are always in their highest power
state at boot up anyway, this doesn't really change anything
and improves things in all other cases.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: enable DPM by default on BTC asics
Alex Deucher [Wed, 30 Oct 2013 14:18:37 +0000 (10:18 -0400)]
drm/radeon: enable DPM by default on BTC asics

Seems to be stable on them.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: enable DPM by default on SI asics
Alex Deucher [Wed, 23 Oct 2013 21:14:06 +0000 (17:14 -0400)]
drm/radeon: enable DPM by default on SI asics

Seems to be stable on them and improves peformance
as most SI asics have very low boot clocks.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: enable DPM by default on SUMO/PALM APUs
Alex Deucher [Wed, 23 Oct 2013 21:11:06 +0000 (17:11 -0400)]
drm/radeon: enable DPM by default on SUMO/PALM APUs

DPM seems to be stable on these asics and it drastically
improves performance depending on the boot clocks.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon/dpm: only print dpm debugging messages when radeon_dpm=1
Alex Deucher [Wed, 23 Oct 2013 22:35:43 +0000 (18:35 -0400)]
drm/radeon/dpm: only print dpm debugging messages when radeon_dpm=1

Avoids spamming the system log for chips where dpm is enabled by
default, but prints then messages when users force it on for other
asics.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: Implement radeon_pci_shutdown
Markus Trippelsdorf [Wed, 23 Oct 2013 21:07:30 +0000 (17:07 -0400)]
drm/radeon: Implement radeon_pci_shutdown

Currently radeon devices are not properly shutdown during kexec. This
causes a varity of issues, e.g. dpm initialization failures.
Fix this by implementing a radeon_pci_shutdown function, that unloads
the driver cleanly.

Signed-off-by: Markus Trippelsdorf <markus@trippelsdorf.de>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon/audio: write audio/video latency info for DCE6/8
Alex Deucher [Thu, 10 Oct 2013 22:03:06 +0000 (18:03 -0400)]
drm/radeon/audio: write audio/video latency info for DCE6/8

Needed by the hda driver to properly set up synchronization
on the audio side.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
11 years agodrm/radeon/audio: write audio/video latency info for DCE4/5
Alex Deucher [Thu, 10 Oct 2013 21:54:51 +0000 (17:54 -0400)]
drm/radeon/audio: write audio/video latency info for DCE4/5

Needed by the hda driver to properly set up synchronization
on the audio side.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
11 years agodrm/radeon/audio: break out of loops once we match connector
Alex Deucher [Thu, 10 Oct 2013 21:58:27 +0000 (17:58 -0400)]
drm/radeon/audio: break out of loops once we match connector

No need to continue with the loops once we've matched
the appropriate connector.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon/atom: don't call [EN|DIS]ABLE_OUTPUT on DCE4.x
Alex Deucher [Thu, 10 Oct 2013 20:59:49 +0000 (16:59 -0400)]
drm/radeon/atom: don't call [EN|DIS]ABLE_OUTPUT on DCE4.x

The plain [EN|DIS]ABLE functions do the same thing and more
and aren't broken on some systems like [EN|DIS]ABLE_OUTPUT.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon/atom: don't call [EN|DIS]ABLE_OUTPUT on DCE3.x
Alex Deucher [Wed, 23 Oct 2013 20:29:04 +0000 (16:29 -0400)]
drm/radeon/atom: don't call [EN|DIS]ABLE_OUTPUT on DCE3.x

The plain [EN|DIS]ABLE functions do the same thing and more
and aren't broken on some systems like [EN|DIS]ABLE_OUTPUT.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon/si: tell dpm there is a display connected
Alex Deucher [Thu, 10 Oct 2013 16:31:43 +0000 (12:31 -0400)]
drm/radeon/si: tell dpm there is a display connected

On SI asics, the SMC will automatically force the performance
level to the lowest level if there are no displays active.  This
prevents automatic performance scaling on PowerXpress systems or
for offscreen rendering or compute when displays are disabled.

Going forward, it would be best to dynamically change this, but
for now leave scaling enabled.

Fixes:
https://bugs.freedesktop.org/show_bug.cgi?id=69395

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: implement blit copy callback for CIK
Alex Deucher [Tue, 1 Oct 2013 20:36:51 +0000 (16:36 -0400)]
drm/radeon: implement blit copy callback for CIK

Uses the CP ring rather than the DMA ring.  Useful
for debugging and benchmarking.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon/dpm: cleanup a type issue with rv6xx_clocks_per_unit()
Dan Carpenter [Tue, 2 Jul 2013 06:22:55 +0000 (09:22 +0300)]
drm/radeon/dpm: cleanup a type issue with rv6xx_clocks_per_unit()

The rv6xx_clocks_per_unit() function pretends it can set flags in a u64
bitfield but really because "1" is an int it doesn't work for more than
32 bits.  The only caller truncates the high bits away anyway.  I've
just changed it to be a u32.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: plug in blit copy routine for SI
Alex Deucher [Tue, 1 Oct 2013 20:17:14 +0000 (16:17 -0400)]
drm/radeon: plug in blit copy routine for SI

Uses CP DMA packet just like previous asics.
Useful for debugging and benchmarking.  Uses
same packet format as prior asics.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: enable hdmi audio by default
Alex Deucher [Thu, 26 Sep 2013 17:11:18 +0000 (13:11 -0400)]
drm/radeon: enable hdmi audio by default

Seems to be stable enough for the majority of users.
It can be disabled on the fly via connector attributes.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: add runtime PM support (v2)
Dave Airlie [Mon, 17 Sep 2012 04:40:31 +0000 (14:40 +1000)]
drm/radeon: add runtime PM support (v2)

This hooks radeon up to the runtime PM system to enable
dynamic power management for secondary GPUs in switchable
and powerxpress laptops.

v2: agd5f: clean up, add module parameter

Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: convert to pmops
Dave Airlie [Thu, 13 Sep 2012 02:02:30 +0000 (12:02 +1000)]
drm/radeon: convert to pmops

This is a pre-requisite for runtime pm on powerxpress systems.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: add a connector property for dither
Alex Deucher [Tue, 24 Sep 2013 21:26:26 +0000 (17:26 -0400)]
drm/radeon: add a connector property for dither

Allows you to enable dither in the display hardware
when the monitor supports lower a lower bpc than the
current framebuffer format.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/radeon: Add support for programming the FMT blocks
Alex Deucher [Mon, 23 Sep 2013 16:22:11 +0000 (12:22 -0400)]
drm/radeon: Add support for programming the FMT blocks

The FMT blocks control how data is sent from the backend
of the display pipe to to monitor.  Proper set up of the
FMT blocks are required for 30bpp formats.  Additionally,
dithering can be enabled on for better display with 18 and
24bpp displays.  The exception is LVDS/eDP which atom
takes care of in the SelectCRTC_Source table.  For now
just enable truncation until we test dithering more.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agodrm/tegra: Reserve syncpoint base for gr3d
Thierry Reding [Mon, 28 Oct 2013 09:23:11 +0000 (10:23 +0100)]
drm/tegra: Reserve syncpoint base for gr3d

Request a syncpoint base to be associated with the gr3d syncpoint.

Signed-off-by: Thierry Reding <treding@nvidia.com>
11 years agodrm/tegra: Reserve base for gr2d
Arto Merilainen [Mon, 14 Oct 2013 12:21:55 +0000 (15:21 +0300)]
drm/tegra: Reserve base for gr2d

This patch modifies the gr2d to reserve a base for syncpoint.

Signed-off-by: Arto Merilainen <amerilainen@nvidia.com>
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
11 years agodrm/tegra: Deliver syncpoint base to user space
Arto Merilainen [Mon, 14 Oct 2013 12:21:54 +0000 (15:21 +0300)]
drm/tegra: Deliver syncpoint base to user space

This patch adds a separate ioctl for delivering syncpoint base number
to user space. If the syncpoint does not have an associated base, the
function returns -ENXIO.

Signed-off-by: Arto Merilainen <amerilainen@nvidia.com>
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
11 years agogpu: host1x: Add syncpoint base support
Arto Merilainen [Mon, 14 Oct 2013 12:21:53 +0000 (15:21 +0300)]
gpu: host1x: Add syncpoint base support

This patch adds support for hardware syncpoint bases. This creates
a simple mechanism to stall the command FIFO until an operation is
completed.

Signed-off-by: Arto Merilainen <amerilainen@nvidia.com>
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
11 years agogpu: host1x: Add 'flags' field to syncpt request
Arto Merilainen [Mon, 14 Oct 2013 12:21:52 +0000 (15:21 +0300)]
gpu: host1x: Add 'flags' field to syncpt request

Functions host1x_syncpt_request() and _host1x_syncpt_alloc() have
been taking a separate boolean flag ('client_managed') for indicating
if the syncpoint value should be tracked by the host1x driver.

This patch converts the field into generic 'flags' field so that
we can easily add more information while requesting a syncpoint.
Clients are adapted to use the new interface accordingly.

Signed-off-by: Arto Merilainen <amerilainen@nvidia.com>
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
11 years agodrm/tegra: Disable clock on probe failure
Wei Yongjun [Mon, 21 Oct 2013 05:38:34 +0000 (13:38 +0800)]
drm/tegra: Disable clock on probe failure

Add a missing clk_disable_unprepare() before returning from the driver's
.probe() function on error.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
11 years agogpu: host1x: Disable clock on probe failure
Wei Yongjun [Mon, 21 Oct 2013 05:37:31 +0000 (13:37 +0800)]
gpu: host1x: Disable clock on probe failure

Add a missing clk_disable_unprepare() before returning from the driver's
.probe() function on error.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
11 years agodrm/tegra: Support bottom-up buffer objects
Thierry Reding [Mon, 7 Oct 2013 07:47:58 +0000 (09:47 +0200)]
drm/tegra: Support bottom-up buffer objects

The gr3d engine renders images bottom-up. Allow buffers that are used
for 3D content to be marked as such and implement support in the display
controller to present them properly.

Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Signed-off-by: Thierry Reding <treding@nvidia.com>
11 years agodrm/tegra: Add support for tiled buffer objects
Thierry Reding [Fri, 4 Oct 2013 20:34:01 +0000 (22:34 +0200)]
drm/tegra: Add support for tiled buffer objects

The gr2d and gr3d engines work more efficiently on buffers with a tiled
memory layout. Allow created buffers to be marked as tiled so that the
display controller can scan them out properly.

Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Signed-off-by: Thierry Reding <treding@nvidia.com>
11 years agodrm/tegra: Add 3D support
Thierry Reding [Thu, 28 Feb 2013 07:08:01 +0000 (08:08 +0100)]
drm/tegra: Add 3D support

Initialize and power the 3D unit on Tegra20, Tegra30 and Tegra114 and
register a channel with the Tegra DRM driver so that the unit can be
used from userspace.

Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Signed-off-by: Thierry Reding <treding@nvidia.com>
11 years agodrm/tegra: Introduce tegra_drm_submit()
Thierry Reding [Thu, 10 Oct 2013 09:00:33 +0000 (11:00 +0200)]
drm/tegra: Introduce tegra_drm_submit()

Command stream submissions are the same across all devices that expose
a channel to userspace, so move the code into a generic function.

Signed-off-by: Thierry Reding <treding@nvidia.com>
11 years agodrm/tegra: Use symbolic names for gr2d registers
Thierry Reding [Mon, 7 Oct 2013 07:55:57 +0000 (09:55 +0200)]
drm/tegra: Use symbolic names for gr2d registers

Instead of using magic numbers for the registers which contain memory
addresses in the firewall table, using symbolic names.

Signed-off-by: Thierry Reding <treding@nvidia.com>
11 years agodrm/tegra: Start connectors with correct DPMS mode
Thierry Reding [Tue, 24 Sep 2013 07:58:08 +0000 (09:58 +0200)]
drm/tegra: Start connectors with correct DPMS mode

A connector's DPMS mode isn't initialized by default, therefore using a
default of 0 (DRM_MODE_DPMS_ON). This can cause problems in that the DRM
core won't explicitly turn on a connector because it thinks that it is
already on.

Signed-off-by: Thierry Reding <treding@nvidia.com>
11 years agodrm/tegra: hdmi: Enable VDD earlier for hotplug/DDC
Mikko Perttunen [Wed, 28 Aug 2013 15:48:39 +0000 (18:48 +0300)]
drm/tegra: hdmi: Enable VDD earlier for hotplug/DDC

The VDD regulator used to be enabled only at tegra_output_hdmi_enable,
which is called after a sink is detected. However, the HDMI hotplug pin
works by returning the voltage supplied by the VDD pin, so this meant
that the hotplug pin was never asserted and the sink was not detected
unless the VDD regulator was set to be always on.

This patch moves the enable to the tegra_hdmi_init() function to make
sure the regulator will get enabled and therefore ensure proper hotplug
detection.

Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
11 years agodrm/tegra: hdmi: Fix build warnings
Thierry Reding [Wed, 16 Oct 2013 17:51:22 +0000 (19:51 +0200)]
drm/tegra: hdmi: Fix build warnings

These seem to show up when building for architectures other than ARM,
which I guess will never happen. The reason why the kbuild test bot ran
into these was a missing dependency which has hence been fixed. Still it
doesn't hurt to fix them anyway.

Reported-by: kbuild test bot <fengguang.wu@intel.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
11 years agodrm/tegra: hdmi: Detect DVI-only displays
Mikko Perttunen [Wed, 28 Aug 2013 15:48:38 +0000 (18:48 +0300)]
drm/tegra: hdmi: Detect DVI-only displays

Use EDID data to determine whether the display supports HDMI or DVI
only. The HDMI output used to assume to be connected to HDMI displays,
but that broke support for DVI displays that don't understand the
interspersed audio/other data.

To be on the safe side, default to DVI if no EDID data is available.

Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
[treding@nvidia.com: move detection to separate function]
Signed-off-by: Thierry Reding <treding@nvidia.com>
11 years agodrm/tegra: Add Tegra114 HDMI support
Mikko Perttunen [Mon, 30 Sep 2013 14:54:47 +0000 (16:54 +0200)]
drm/tegra: Add Tegra114 HDMI support

Tegra114 TMDS configuration requires a new peak_current field and the
driver current override bit has changed position.

Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
11 years agodrm/tegra: hdmi: Parameterize based on compatible property
Thierry Reding [Mon, 14 Oct 2013 07:43:05 +0000 (09:43 +0200)]
drm/tegra: hdmi: Parameterize based on compatible property

Use a structure to parameterize the code to handle differences between
the HDMI hardware on various SoC generations. This removes the need to
clutter the code with checks for individual compatible values.

Signed-off-by: Thierry Reding <treding@nvidia.com>
11 years agodrm/tegra: hdmi: Rename tegra{2,3} to tegra{20,30}
Thierry Reding [Mon, 30 Sep 2013 13:14:41 +0000 (15:14 +0200)]
drm/tegra: hdmi: Rename tegra{2,3} to tegra{20,30}

Everything related to Tegra uses Tegra20 and Tegra30 instead of Tegra2
and Tegra3, respectively. Rename the TMDS arrays in the HDMI driver for
consistency.

Signed-off-by: Thierry Reding <treding@nvidia.com>
11 years agogpu: host1x: Add support for Tegra114
Thierry Reding [Mon, 30 Sep 2013 12:17:39 +0000 (14:17 +0200)]
gpu: host1x: Add support for Tegra114

Tegra114 uses a slightly updated version of host1x with an additional
syncpoint.

Signed-off-by: Thierry Reding <treding@nvidia.com>
11 years agodrm/tegra: Allocate resources at probe time
Thierry Reding [Mon, 14 Oct 2013 12:26:42 +0000 (14:26 +0200)]
drm/tegra: Allocate resources at probe time

Since the .init() and .exit() functions are executed whenever the DRM
driver is loaded or unloaded, care must be taken not to use them for
resource allocation. Otherwise deferred probing cannot be used, since
the .init() and .exit() are not run at probe time. Similarly the code
that frees resources must be run at .remove() time. If it is run from
the .exit() function, it can release resources multiple times.

To handle this more consistently, rename the tegra_output_parse_dt()
function to tegra_output_probe() and introduce tegra_output_remove()
which can be used to free output-related resources.

Signed-off-by: Thierry Reding <treding@nvidia.com>
11 years agodrm/tegra: Properly cleanup and zero out resources
Thierry Reding [Mon, 14 Oct 2013 12:06:02 +0000 (14:06 +0200)]
drm/tegra: Properly cleanup and zero out resources

When the DRM driver is unloaded, all the associated resources must be
cleaned up and zeroed out. This is necessary because of the architecture
of the Tegra DRM driver, where not all subdrivers are unloaded along
with the DRM driver. Therefore device-managed managed won't be freed and
memory cannot be assumed to have been cleared (because it hasn't been
reallocated using kzalloc()) by the time the DRM driver is reloaded. It
is therefore necessary to zero out the structures to prevent strange
errors (such as slab corruptions) from occurring.

Signed-off-by: Thierry Reding <treding@nvidia.com>
11 years agodrm/tegra: Move driver to DRM tree
Thierry Reding [Wed, 9 Oct 2013 08:32:49 +0000 (10:32 +0200)]
drm/tegra: Move driver to DRM tree

In order to make subsystem-wide changes easier, move the Tegra DRM
driver back into the DRM tree.

Signed-off-by: Thierry Reding <treding@nvidia.com>
11 years agogpu: host1x: Use relative include paths
Thierry Reding [Wed, 9 Oct 2013 08:32:54 +0000 (10:32 +0200)]
gpu: host1x: Use relative include paths

This is slightly safer than adding -Idrivers/gpu/host1x to cflags-y.

Signed-off-by: Thierry Reding <treding@nvidia.com>
11 years agodrm/tegra: Move subdevice infrastructure to host1x
Thierry Reding [Mon, 14 Oct 2013 12:43:22 +0000 (14:43 +0200)]
drm/tegra: Move subdevice infrastructure to host1x

The Tegra DRM driver currently uses some infrastructure to defer the DRM
core initialization until all required devices have registered. The same
infrastructure can potentially be used by any other driver that requires
more than a single sub-device of the host1x module.

Make the infrastructure more generic and keep only the DRM specific code
in the DRM part of the driver. Eventually this will make it easy to move
the DRM driver part back to the DRM subsystem.

Signed-off-by: Thierry Reding <treding@nvidia.com>
11 years agogpu: host1x: Expose syncpt and channel functionality
Thierry Reding [Tue, 24 Sep 2013 14:30:32 +0000 (16:30 +0200)]
gpu: host1x: Expose syncpt and channel functionality

Expose the buffer objects, syncpoint and channel functionality in the
public public header so that drivers can use them.

Signed-off-by: Thierry Reding <treding@nvidia.com>
11 years agodrm/tegra: Introduce tegra_drm_client structure
Thierry Reding [Tue, 24 Sep 2013 13:35:40 +0000 (15:35 +0200)]
drm/tegra: Introduce tegra_drm_client structure

This structure derives from host1x_client. DRM-specific fields are moved
from host1x_client to this structure, so that host1x_client can remain
agnostic of DRM.

Signed-off-by: Thierry Reding <treding@nvidia.com>
11 years agogpu: host1x: Make host1x header file public
Thierry Reding [Tue, 24 Sep 2013 11:59:01 +0000 (13:59 +0200)]
gpu: host1x: Make host1x header file public

In preparation to support host1x clients other than DRM, move this
header into a public location.

Signed-off-by: Thierry Reding <treding@nvidia.com>
11 years agodrm/tegra: gem: Miscellaneous cleanups
Thierry Reding [Tue, 24 Sep 2013 14:34:05 +0000 (16:34 +0200)]
drm/tegra: gem: Miscellaneous cleanups

Rename the host1x_to_drm_bo() macro to host1x_to_tegra_bo() for
consistency and fixup various stylistic issues.

Signed-off-by: Thierry Reding <treding@nvidia.com>
11 years agodrm/tegra: Rename gr2d to tegra-gr2d
Thierry Reding [Mon, 14 Oct 2013 12:44:54 +0000 (14:44 +0200)]
drm/tegra: Rename gr2d to tegra-gr2d

Other drivers use the tegra- prefix in their names, so add it to this
driver's name as well for consistency.

Signed-off-by: Thierry Reding <treding@nvidia.com>
11 years agodrm/tegra: gr2d: Miscellaneous cleanups
Thierry Reding [Thu, 26 Sep 2013 14:09:43 +0000 (16:09 +0200)]
drm/tegra: gr2d: Miscellaneous cleanups

Rework the address table code for the host1x firewall. The previous
implementation allocated a bitfield but didn't check for a valid pointer
so it could potentially crash. Instead, embed a static bitmap within the
gr2d structure to avoid the allocation and use the Linux bitmap API to
reduce code complexity.

Don't annotate the driver's .remove() function __exit. Even if built in
the driver can be unloaded via sysfs, so .remove() needs to stick around
after initialization. Also remove the explicit initialization of the
driver's .owner field to THIS_MODULE because that's now handled by the
driver core.

Furthermore make an error message more consistent with other subdrivers,
index the syncpts array for better readability, remove a gratuituous
newline and reorder some variable declarations to make the code easier
to read.

Signed-off-by: Thierry Reding <treding@nvidia.com>
11 years agogpu: host1x: firewall: Refactor register check
Thierry Reding [Thu, 10 Oct 2013 08:24:04 +0000 (10:24 +0200)]
gpu: host1x: firewall: Refactor register check

The same code sequence is used in various places to validate a register
access in the command stream. This can be refactored into a separate
function.

Signed-off-by: Thierry Reding <treding@nvidia.com>
11 years agogpu: host1x: firewall: Rename cmdbuf_id -> cmdbuf
Thierry Reding [Thu, 10 Oct 2013 08:21:58 +0000 (10:21 +0200)]
gpu: host1x: firewall: Rename cmdbuf_id -> cmdbuf

The value stored in this field is a pointer to a command buffer, not an
ID. Avoid some confusion by reflecting that in the field's name.

Signed-off-by: Thierry Reding <treding@nvidia.com>
11 years agogpu: host1x: Fix alignment of function arguments
Thierry Reding [Thu, 10 Oct 2013 08:17:45 +0000 (10:17 +0200)]
gpu: host1x: Fix alignment of function arguments

Arguments on subsequent lines should be aligned with the first argument.
This one occurrence went unnoticed during code review.

Signed-off-by: Thierry Reding <treding@nvidia.com>
11 years agogpu: host1x: Do not discard .remove()
Thierry Reding [Wed, 25 Sep 2013 16:33:31 +0000 (18:33 +0200)]
gpu: host1x: Do not discard .remove()

The device can be unbound from the driver via sysfs, so regardless of
whether the driver is builtin or a module, its .remove() function needs
to stick around.

Signed-off-by: Thierry Reding <treding@nvidia.com>
11 years agogpu: host1x: Cleanup includes
Thierry Reding [Tue, 24 Sep 2013 14:32:47 +0000 (16:32 +0200)]
gpu: host1x: Cleanup includes

Most of the included files are either not required or already included
by some other header file.

Signed-off-by: Thierry Reding <treding@nvidia.com>
11 years agodrm/tegra: Rename host1x_drm_context to tegra_drm_context
Thierry Reding [Thu, 26 Sep 2013 14:08:22 +0000 (16:08 +0200)]
drm/tegra: Rename host1x_drm_context to tegra_drm_context

The structure represents a context associated with a particular process
that has opened the Tegra DRM device and requested a channel. This is a
very DRM-specific notion and has nothing to do with host1x. Rename the
structure to more clearly mark the boundaries between the two.

Signed-off-by: Thierry Reding <treding@nvidia.com>
11 years agodrm/tegra: Rename host1x_drm_file to tegra_drm_file
Thierry Reding [Thu, 26 Sep 2013 14:08:18 +0000 (16:08 +0200)]
drm/tegra: Rename host1x_drm_file to tegra_drm_file

This structure extends drm_file with Tegra DRM specific fields and has
nothing to do with host1x. Rename the structure to more clearly mark the
boundaries between host1x and Tegra DRM.

While at it, move the structure definition out of the header. It's never
used outside of the drm.c source file, so it can be defined within that.

Signed-off-by: Thierry Reding <treding@nvidia.com>
11 years agodrm/tegra: Rename host1x_drm structure to tegra_drm
Thierry Reding [Tue, 24 Sep 2013 11:22:17 +0000 (13:22 +0200)]
drm/tegra: Rename host1x_drm structure to tegra_drm

The host1x and Tegra DRM drivers are currently tightly coupled. Renaming
the structure marks the boundary more clearly.

Signed-off-by: Thierry Reding <treding@nvidia.com>
11 years agodrm/tegra: Cleanup tegra_dc structure
Thierry Reding [Thu, 26 Sep 2013 14:09:19 +0000 (16:09 +0200)]
drm/tegra: Cleanup tegra_dc structure

Remove the unused host1x field from the structure and group the fields
more logically.

Signed-off-by: Thierry Reding <treding@nvidia.com>
11 years agodrm/tegra: Remove unused fields
Thierry Reding [Tue, 24 Sep 2013 10:38:10 +0000 (12:38 +0200)]
drm/tegra: Remove unused fields

Some of the fields in struct host1x_drm haven't been used for a while,
so remove them.

Signed-off-by: Thierry Reding <treding@nvidia.com>
11 years agogpu: host1x: Remove unused Makefile
Thierry Reding [Tue, 8 Oct 2013 14:14:32 +0000 (16:14 +0200)]
gpu: host1x: Remove unused Makefile

Signed-off-by: Thierry Reding <treding@nvidia.com>
11 years agogpu: host1x: check relocs after all gathers are consumed
Erik Faye-Lund [Fri, 4 Oct 2013 20:18:33 +0000 (20:18 +0000)]
gpu: host1x: check relocs after all gathers are consumed

The num_relocs count are passed to the kernel per job, not per gather.

For multi-gather jobs, we would previously fail if there were relocs in
other gathers aside from the first one.

Fix this by simply moving the check until all gathers have been
consumed.

Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
Reviewed-by: Arto Merilainen <amerilainen@nvidia.com>
Acked-By: Terje Bergstrom <tbergstrom@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
11 years agodrm: Fix typo in debug message
Thierry Reding [Wed, 9 Oct 2013 11:33:43 +0000 (13:33 +0200)]
drm: Fix typo in debug message

Fix a typo (iotcl -> ioctl) in the debug message when an unknown IOCTL
is encountered.

Acked-by: David Airlie <airlied@linux.ie>
Signed-off-by: Thierry Reding <treding@nvidia.com>
11 years agodrm: Track the proper DPMS mode of connectors
Thierry Reding [Wed, 2 Oct 2013 13:50:06 +0000 (15:50 +0200)]
drm: Track the proper DPMS mode of connectors

When userspace removes the active framebuffer using DRM_IOCTL_MODE_RMFB,
or explicitly disables the CRTC (by calling drmModeSetCrtc(..., NULL)
for example), a NULL framebuffer will be passed to the .set_config()
implementation of a CRTC. The drm_crtc_helper_set_config() helper will
decide to disable a CRTC when that happens.

To do so, it calls drm_crtc_helper_disable(), which in turn will iterate
over all encoders and decouple them from their connectors and finally
call drm_helper_disable_unused_functions() to clean up and call the
.disable() or .dpms() implementation for each encoder. However, at no
point during this sequence does it track the DPMS mode of a connector,
so it will usually remain on after this.

When a connector is enabled again, drm_helper_connector_dpms() will not
notice that the DPMS mode actually changed and won't do anything, which
causes the connector to stay disabled indefinitely.

To prevent this from happening, explicitly set the connector's DPMS mode
to off when the CRTC is disabled. That way it reflects the correct state
and can be enabled again.

This solves an issue observed when terminating an X server running on
the xf86-video-modesetting driver. Without this patch, the connector
would not be enabled properly and the screen would stay dark.

Acked-by: David Airlie <airlied@linux.ie>
Signed-off-by: Thierry Reding <treding@nvidia.com>
11 years agodrm/sysfs: Do not drop device reference twice
Thierry Reding [Wed, 30 Oct 2013 10:59:05 +0000 (11:59 +0100)]
drm/sysfs: Do not drop device reference twice

device_unregister() already drops its reference to the struct device, so
explicitly calling put_device() before device_unregister() can cause the
device to have been freed before it can be unregistered.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Tested-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Tested-by: Ben Widawsky <ben@bwidawsk.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agoMerge tag 'drm-intel-next-2013-10-18' of git://people.freedesktop.org/~danvet/drm...
Dave Airlie [Fri, 25 Oct 2013 08:35:04 +0000 (09:35 +0100)]
Merge tag 'drm-intel-next-2013-10-18' of git://people.freedesktop.org/~danvet/drm-intel into drm-next

- CRC support from Damien and He Shuang. Long term this should allow us to
  test an awful lot modesetting corner cases automatically. So for me as
  the maintainer this is really big.
- HDMI audio fix from Jani.
- VLV dpll computation code refactoring from Ville.
- Fixups for the gpu booster from last time around (Chris).
- Some cleanups in the context code from Ben.
- More watermark work from Ville (we'll be getting there ...).
- vblank timestamp improvements from Ville.
- CONFIG_FB=n support, including drm core changes to make the fbdev
  helpers optional.
- DP link training improvements (Jani).
- mmio vtable from Ben, prep work for future hw.

* tag 'drm-intel-next-2013-10-18' of git://people.freedesktop.org/~danvet/drm-intel: (132 commits)
  drm/i915/dp: don't mention eDP bpp clamping if it doesn't affect bpp
  drm/i915: remove dead code in ironlake_crtc_mode_set
  drm/i915: crc support for hsw
  drm/i915: fix CRC debugfs setup
  drm/i915: wait one vblank when disabling CRCs
  drm/i915: use ->get_vblank_counter for the crc frame counter
  drm/i915: wire up CRC interrupt for ilk/snb
  drm/i915: add CRC #defines for ilk/snb
  drm/i915: extract display_pipe_crc_update
  drm/i915: don't Oops in debugfs for I915_FBDEV=n
  drm/i915: set HDMI pixel clock in audio configuration
  drm/i915: pass mode to ELD write vfuncs
  cpufreq: Add dummy cpufreq_cpu_get/put for CONFIG_CPU_FREQ=n
  drm/i915: check gem bo size when creating framebuffers
  drm/i915: Use unsigned long for obj->user_pin_count
  drm/i915: prevent tiling changes on framebuffer backing storage
  drm/i915: grab dev->struct_mutex around framebuffer_init
  drm/i915: vlv: fix VGA hotplug after modeset
  drm: add support for additional stereo 3D modes
  drm/i915: preserve dispaly init order on ByT
  ...

11 years agodrm/qxl: fix disabling extra monitors from client
Marc-André Lureau [Fri, 18 Oct 2013 14:11:33 +0000 (16:11 +0200)]
drm/qxl: fix disabling extra monitors from client

To disable a monitor, a Spice client sends a monitor config with the
monitor resolution to 0x0.

However, before qxl_crtc_disable() is reached after the hotplug event,
it can happen that another monitor is reconfigured, and
qxl_send_monitors_config() is called with the old config, which will
re-enable the monitor on the client.

Reset config if monitor is found disconnected, during
drm_helper_hpd_irq_event().

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm/qxl: remove unnecessary check
Marc-André Lureau [Fri, 18 Oct 2013 14:11:32 +0000 (16:11 +0200)]
drm/qxl: remove unnecessary check

All hard-coded resolutions are passing this check.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm/qxl: prefer the monitor config resolution
Marc-André Lureau [Fri, 18 Oct 2013 14:11:31 +0000 (16:11 +0200)]
drm/qxl: prefer the monitor config resolution

By default, 1024x768 is the preferred resolution. However, when a
monitor config is given, it should be the only preferred resolution.

Note that the monitor config resolution is passed to
qxl_add_common_modes() to avoid adding a duplicate mode without the
preferred resolution. That would discard the previous monitor config
preferred bit.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm: copy mode type in drm_mode_connector_list_update()
Marc-André Lureau [Fri, 18 Oct 2013 14:11:30 +0000 (16:11 +0200)]
drm: copy mode type in drm_mode_connector_list_update()

In commit 38d5487db7f289be1d56ac7df704ee49ed3213b9, Keith explained:
    This patch simply merges the two mode type bits together; that seems
    reasonable to me, but perhaps only a subset of the bits should be
    used? None of these can be user defined as they all come from
    looking at just the hardware.

However, merging the bits means that a flag becomes sticky. It is not
possible, for example to update the mode type to remove the
DRM_MODE_TYPE_PREFERRED bit.

After a brief discussion with Dave Airlie on irc, it was agreed to
propose that change, instead of introducing another function to remove a
bit from exisiting modes type.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm/qxl: notify that the monitor config changed
Marc-André Lureau [Fri, 18 Oct 2013 14:11:29 +0000 (16:11 +0200)]
drm/qxl: notify that the monitor config changed

drm_helper_hpd_irq_event() only notifies when the connector status
changed. However, Spice monitor config can change while the connector is
connected, to support arbitrary resolution. Do an hotplug event if it
wasn't done by drm_helper_hpd_irq_event().

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm: return if changed in drm_helper_hpd_irq_event()
Marc-André Lureau [Fri, 18 Oct 2013 14:11:28 +0000 (16:11 +0200)]
drm: return if changed in drm_helper_hpd_irq_event()

The caller may want to know whether the configuration was changed, and
if an hotplug event was sent.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agodrm: fix a small spelling
Marc-André Lureau [Fri, 18 Oct 2013 14:11:27 +0000 (16:11 +0200)]
drm: fix a small spelling

Fix a little spelling of drm_crtc_convert_umode() comment.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agoMerge branch 'drm-tda998x-3.12-fixes' of git://ftp.arm.linux.org.uk/~rmk/linux-cubox...
Dave Airlie [Wed, 23 Oct 2013 09:09:56 +0000 (10:09 +0100)]
Merge branch 'drm-tda998x-3.12-fixes' of git://ftp.arm.linux.org.uk/~rmk/linux-cubox into drm-next

Fix build on non-ARM
* 'drm-tda998x-3.12-fixes' of git://ftp.arm.linux.org.uk/~rmk/linux-cubox:
  DRM: Armada: depend on ARM

11 years agoDRM: Armada: depend on ARM
Russell King [Tue, 22 Oct 2013 13:11:36 +0000 (14:11 +0100)]
DRM: Armada: depend on ARM

Armada DRM uses relaxed accessors which are not available on other
platforms.  Limit it to just ARM.

Acked-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
11 years agoMerge branch 'drm-tda998x-3.12' of git://ftp.arm.linux.org.uk/~rmk/linux-cubox into...
Dave Airlie [Tue, 22 Oct 2013 08:38:18 +0000 (09:38 +0100)]
Merge branch 'drm-tda998x-3.12' of git://ftp.arm.linux.org.uk/~rmk/linux-cubox into drm-next

This adds support for the Armada 510 display subsystem found on the
Marvell Dove devices.  This IP is re-used across several different Marvell
SoCs with various tweaks, and this driver has been structured to allow
the other IPs to re-use the bulk of this code; further work in this area
is expected from interested parties.

This has been extensively tested on the SolidRun Cubox platform and
appears to work well there.

[airlied: update for api changes merged previous to this]

11 years agodrm/sysfs: sort out minor and connector device object lifetimes.
Dave Airlie [Fri, 11 Oct 2013 04:07:25 +0000 (14:07 +1000)]
drm/sysfs: sort out minor and connector device object lifetimes.

So drm was abusing device lifetimes, by having embedded device structures
in the minor and connector it meant that the lifetime of the internal drm
objects (drm_minor and drm_connector) were tied to the lifetime of the device
files in sysfs, so if something kept those files opened the current code
would kfree the objects and things would go downhill from there.

Now in reality there is no need for these lifetimes to be so intertwined,
especailly with hotplugging of devices where we wish to remove the sysfs
and userspace facing pieces before we can unwind the internal objects due
to open userspace files or mmaps, so split the objects out so the struct
device is no longer embedded and do what fbdev does and just allocate
and remove the sysfs inodes separately.

Signed-off-by: Dave Airlie <airlied@redhat.com>
11 years agoDRM: Armada: add support for drm tda19988 driver
Russell King [Sat, 4 May 2013 19:08:27 +0000 (20:08 +0100)]
DRM: Armada: add support for drm tda19988 driver

Add support for TDA998x output via the slave driver in the kernel.

Reviewed-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
11 years agoMerge branches 'drm-3.12' and 'tda998x-3.12' into drm-tda998x-3.12
Russell King [Fri, 18 Oct 2013 15:00:02 +0000 (16:00 +0100)]
Merge branches 'drm-3.12' and 'tda998x-3.12' into drm-tda998x-3.12