GitHub/LineageOS/android_kernel_motorola_exynos9610.git
9 years agodrm: Use max() to make the ioctl alloc size code cleaner
Ville Syrjälä [Fri, 27 Mar 2015 13:51:59 +0000 (15:51 +0200)]
drm: Use max() to make the ioctl alloc size code cleaner

Use max() to make the code to determine the allocation size for
the ioctl data easier to read.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
9 years agodrm: Simplify core vs. drv ioctl handling
Ville Syrjälä [Fri, 27 Mar 2015 13:51:58 +0000 (15:51 +0200)]
drm: Simplify core vs. drv ioctl handling

Now that cmd_drv is gone the handling for core and driver ioctls is
mostly identical, so eliminate the duplication. Also take the
opportunity to simplify the range checks to be less cluttered.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
9 years agodrm: Drop ioctl->cmd_drv
Ville Syrjälä [Fri, 27 Mar 2015 13:51:56 +0000 (15:51 +0200)]
drm: Drop ioctl->cmd_drv

ioctl->cmd_drv is pointless and we can just as well stick the full ioctl
definition into ioctl->cmd.

Cc: Jakob Bornecrantz <jakob@vmware.com>
Cc: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
9 years agodrm: Fix DRM_IOCTL_DEF_DRV()
Ville Syrjälä [Fri, 27 Mar 2015 13:51:55 +0000 (15:51 +0200)]
drm: Fix DRM_IOCTL_DEF_DRV()

Currently DRM_IOCTL_DEF_DRV does '[DRM_IOCTL_NR(DRM_##ioctl)]' which
doesn't make much sense since DRM_##ioctl is already a the raw ioctl
number. So change it to 'DRM_IOCTL_NR(DRM_IOCTL_##ioctl) - DRM_COMMAND_BASE'
which means the DRM_IOCTL_NR() now makes sense, and also this also means
if there's a mistake in the DRM_IOCTL_##ioctl macros we might get a
warning about it (eg. we would have gotten a sparse warning about the
i915 colorkey get/set ioctl being defined to be the same thing).

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
9 years agodrm/atomic-helpers: Properly avoid full modeset dance
Daniel Vetter [Thu, 26 Mar 2015 21:18:40 +0000 (22:18 +0100)]
drm/atomic-helpers: Properly avoid full modeset dance

Legacy setCrtc has a nice fastpath for just updating the frontbuffer
when the output routing doesn't change. Which I of course tried to
keep working, except that I fumbled the job: The helpers correctly
compute ->mode_changed, CRTC updates get correctly skipped but
connector functions are called unconditionally.

Fix this.

v2: For the disable sided connector->state->crtc might be NULL.
Instead look at the old_connector_state->crtc, but still use the new
crtc state for that old crtc. Reported by Thierry.

Reported-and-Tested-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Reviewed-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk> (v1)
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Gustavo Padovan <gustavo.padovan@collabora.co.uk> (v1)
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
9 years agodrm: atomic: Allow setting CRTC active property
Daniel Stone [Thu, 19 Mar 2015 04:33:26 +0000 (04:33 +0000)]
drm: atomic: Allow setting CRTC active property

Before, we would set the property, but also return -EINVAL because of a
broken fallthrough.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
9 years agodrm: atomic: Expose CRTC active property
Daniel Stone [Thu, 19 Mar 2015 04:33:25 +0000 (04:33 +0000)]
drm: atomic: Expose CRTC active property

Active was here, and we allowed users to set it, but not to get it as
well.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
9 years agodrm: crtc_helper: Update hwmode before mode_set call
Daniel Stone [Thu, 19 Mar 2015 04:33:03 +0000 (04:33 +0000)]
drm: crtc_helper: Update hwmode before mode_set call

Just as we provide crtc->mode pre-populated with the requested mode,
move adjusted_mode into hwmode before we call the crtc's mode_set,
making sure to restore it on failure.

Allows drivers which thoughtlessly discard adjusted_mode in their
mode_set hooks (e.g. Exynos) to use hwmode directly, and also provides
some neat symmetry with crtc->mode.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
9 years agodrm: mode: Allow NULL modes for equality check
Daniel Stone [Thu, 19 Mar 2015 04:33:02 +0000 (04:33 +0000)]
drm: mode: Allow NULL modes for equality check

Since we're now using mode == NULL to represent disabled, it's not
wholly surprising that we'd want to compare NULL modes.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
9 years agodrm: fb_helper: Simplify exit condition
Daniel Stone [Thu, 19 Mar 2015 04:33:01 +0000 (04:33 +0000)]
drm: fb_helper: Simplify exit condition

mode is always NULL at this point in the function, so make our intention
clear.

Signed-off-by: Daniel Stone <daniels@collabora.com>
[danvet: Stop clearing mode too to enlist gcc in tracking
uninitialized usage. And remove a space while at it.]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
9 years agodrm: mode: Fix typo in kerneldoc
Daniel Stone [Thu, 19 Mar 2015 04:33:00 +0000 (04:33 +0000)]
drm: mode: Fix typo in kerneldoc

Signed-off-by: Daniel Stone <daniels@collabora.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
9 years agodrm/dp: Print the number of bytes processed for aux nacks
Ville Syrjälä [Thu, 19 Mar 2015 11:38:57 +0000 (13:38 +0200)]
drm/dp: Print the number of bytes processed for aux nacks

When doing a native or i2c aux write the sink will indicate the number
of bytes written even if it the nacks the transfer. When we receive a
nack we just return an error upwards, but it might still be interesting
to see how many bytes made it before the nack. So include that information
in the debug messages.

v2: Also print the message size (Jani)

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
9 years agoMerge branch 'drm/next/rcar-du' of git://linuxtv.org/pinchartl/fbdev into drm-next
Dave Airlie [Sun, 22 Mar 2015 23:34:32 +0000 (09:34 +1000)]
Merge branch 'drm/next/rcar-du' of git://linuxtv.org/pinchartl/fbdev into drm-next

rcar-du fixes

* 'drm/next/rcar-du' of git://linuxtv.org/pinchartl/fbdev:
  drm: rcar-du: Enable the atomic updates API
  drm: rcar-du: Don't initialize event->pipe field
  drm: rcar-du: Fix framebuffer reference leak through plane state
  MAINTAINERS: Remove rcar-du.h entry

9 years agoMerge branch 'drm/next/adv7511' of git://linuxtv.org/pinchartl/fbdev into drm-next
Dave Airlie [Sun, 22 Mar 2015 23:34:08 +0000 (09:34 +1000)]
Merge branch 'drm/next/adv7511' of git://linuxtv.org/pinchartl/fbdev into drm-next

adv7511 fixes.

* 'drm/next/adv7511' of git://linuxtv.org/pinchartl/fbdev:
  drm: adv7511: Refactor power management
  drm: adv7511: Fix nested sleep when reading EDID
  drm: adv7511: Fix DDC error interrupt handling

9 years agoMerge branch 'drm-next-4.1' of git://people.freedesktop.org/~agd5f/linux into drm...
Dave Airlie [Sun, 22 Mar 2015 23:15:02 +0000 (09:15 +1000)]
Merge branch 'drm-next-4.1' of git://people.freedesktop.org/~agd5f/linux into drm-next

- DP MST support (disabled by default)
- non-ATOM aux support (DCE5+)
- output csc support for clamped RGB
- Lots of new queries for profiling, Gallium HUD, etc.
- Misc fixes

* 'drm-next-4.1' of git://people.freedesktop.org/~agd5f/linux: (40 commits)
  drm/radeon: add DisplayPort MST support (v2)
  drm/radeon: improve encoder picking functions (v2)
  drm/radeon: export max link rate calculation
  drm/radeon: add new atombios encoder/transmitter interfaces
  drm/radeon: add some MST registers
  radeon/fb: add wrapper functions around fb connector add/remove
  radeon/cik: add support for short HPD irqs
  radeon/si: add support for short HPD irqs
  radeon/evergreen: add support for short HPD irqs
  radeon: introduce a dp_work handler
  drm/dp_mst: add a function to retrieve vcpi slots
  drm/radeon: program auxch directly (v2)
  drm/radeon: fix doublescan modes (v2)
  drm/radeon: typo in parameter description
  drm/radeon: add support for read reg query from radeon info ioctl
  drm/radeon: add get_allowed_info_register for CIK
  drm/radeon: add get_allowed_info_register for SI
  drm/radeon: add get_allowed_info_register for cayman/TN
  drm/radeon: add get_allowed_info_register for EG/BTC
  drm/radeon: add get_allowed_info_register for r6xx/r7xx
  ...

9 years agodrm/radeon: add DisplayPort MST support (v2)
Dave Airlie [Mon, 23 Feb 2015 23:24:04 +0000 (09:24 +1000)]
drm/radeon: add DisplayPort MST support (v2)

This adds initial DP 1.2 MST support to radeon, on CAYMAN
and up in theory.

This is off by default.

v2: agd5f:
- add UNIPHY3 offsets
- move atom cmd table code into atombios_encoders.c
- whitespace cleanup
- replace some magic numbers with proper defines

Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
9 years agodrm/radeon: improve encoder picking functions (v2)
Dave Airlie [Mon, 23 Feb 2015 23:24:03 +0000 (09:24 +1000)]
drm/radeon: improve encoder picking functions (v2)

For MST we need to be able to pick front end encoders
separate from backend, but only for MST, so we need to
make the encoder picking interface smarter.

v2: agd5f: squash in:
drm/radeon: release digital encoder before asking for new one
Reported-by: Dieter Nützel <Dieter@nuetzel-hh.de>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
9 years agodrm/radeon: export max link rate calculation
Dave Airlie [Mon, 23 Feb 2015 23:24:02 +0000 (09:24 +1000)]
drm/radeon: export max link rate calculation

We need this in the MST code later.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
9 years agodrm/radeon: add new atombios encoder/transmitter interfaces
Dave Airlie [Mon, 23 Feb 2015 23:24:01 +0000 (09:24 +1000)]
drm/radeon: add new atombios encoder/transmitter interfaces

These allow overriding the encoder id with the frontend,
we need this for setting up MST.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
9 years agodrm/radeon: add some MST registers
Dave Airlie [Mon, 23 Feb 2015 23:24:00 +0000 (09:24 +1000)]
drm/radeon: add some MST registers

These registers will be used later to setup

Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
9 years agoradeon/fb: add wrapper functions around fb connector add/remove
Dave Airlie [Mon, 23 Feb 2015 23:23:59 +0000 (09:23 +1000)]
radeon/fb: add wrapper functions around fb connector add/remove

These are just two wrappers to be used in the MST code later.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
9 years agoradeon/cik: add support for short HPD irqs
Alex Deucher [Tue, 24 Feb 2015 17:38:42 +0000 (12:38 -0500)]
radeon/cik: add support for short HPD irqs

This adds support to process short HPD irqs on CIK gpus.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
9 years agoradeon/si: add support for short HPD irqs
Dave Airlie [Mon, 23 Feb 2015 23:23:58 +0000 (09:23 +1000)]
radeon/si: add support for short HPD irqs

This adds support to process short HPD irqs on SI gpus.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
9 years agoradeon/evergreen: add support for short HPD irqs
Dave Airlie [Mon, 23 Feb 2015 23:23:57 +0000 (09:23 +1000)]
radeon/evergreen: add support for short HPD irqs

This adds support for processing short irqs, and triggering
the dp_work.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
9 years agoradeon: introduce a dp_work handler
Dave Airlie [Mon, 23 Feb 2015 23:23:56 +0000 (09:23 +1000)]
radeon: introduce a dp_work handler

This is to be called on short HPD irqs, just introduce
the basic infrastructure for it.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
9 years agodrm/dp_mst: add a function to retrieve vcpi slots
Dave Airlie [Mon, 23 Feb 2015 23:23:55 +0000 (09:23 +1000)]
drm/dp_mst: add a function to retrieve vcpi slots

radeon requires this to get the slots for later filling
out a table on every transition.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
9 years agodrm/radeon: program auxch directly (v2)
Dave Airlie [Thu, 19 Feb 2015 23:21:36 +0000 (09:21 +1000)]
drm/radeon: program auxch directly (v2)

The atombios tables have an unfortunate restriction on only
being able to write 12 bytes, MST really wants 16-bytes here,
and since the hw can do it, we should just write directly to it.

This uses a module option to allow for it now, and maybe
we should provide the old code as a fallback for a while.

v2: (agd5f)
- move registers to a proper register header
- only enable on DCE5+
- enable by default on DCE5+
- Switch pad to aux mode before using it
- reformat instance handling to better match the
  rest of the driver

Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
9 years agodrm/radeon: fix doublescan modes (v2)
Alex Deucher [Tue, 24 Feb 2015 16:29:21 +0000 (11:29 -0500)]
drm/radeon: fix doublescan modes (v2)

Use the correct flags for atom.

v2: handle DRM_MODE_FLAG_DBLCLK

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
9 years agodrm/radeon: typo in parameter description
Vincent Batts [Fri, 6 Mar 2015 21:07:05 +0000 (21:07 +0000)]
drm/radeon: typo in parameter description

"defaul" -> "default"

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
9 years agodrm/radeon: add support for read reg query from radeon info ioctl
Alex Deucher [Wed, 1 Oct 2014 15:26:50 +0000 (11:26 -0400)]
drm/radeon: add support for read reg query from radeon info ioctl

This allows us to query certain registers from userspace
for profiling and harvest configuration.  E.g., it can
be used by the GALLIUM_HUD for profiling the status of
various gfx blocks.

Tested-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
9 years agodrm/radeon: add get_allowed_info_register for CIK
Alex Deucher [Wed, 1 Oct 2014 15:18:46 +0000 (11:18 -0400)]
drm/radeon: add get_allowed_info_register for CIK

Registers that can be fetched from the info ioctl.

Tested-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
9 years agodrm/radeon: add get_allowed_info_register for SI
Alex Deucher [Wed, 1 Oct 2014 14:03:31 +0000 (10:03 -0400)]
drm/radeon: add get_allowed_info_register for SI

Registers that can be fetched from the info ioctl.

Tested-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
9 years agodrm/radeon: add get_allowed_info_register for cayman/TN
Alex Deucher [Wed, 1 Oct 2014 13:51:29 +0000 (09:51 -0400)]
drm/radeon: add get_allowed_info_register for cayman/TN

Registers that can be fetched from the info ioctl.

Tested-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
9 years agodrm/radeon: add get_allowed_info_register for EG/BTC
Alex Deucher [Wed, 1 Oct 2014 13:43:38 +0000 (09:43 -0400)]
drm/radeon: add get_allowed_info_register for EG/BTC

Registers that can be fetched from the info ioctl.

Tested-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
9 years agodrm/radeon: add get_allowed_info_register for r6xx/r7xx
Alex Deucher [Wed, 1 Oct 2014 13:36:57 +0000 (09:36 -0400)]
drm/radeon: add get_allowed_info_register for r6xx/r7xx

Registers that can be fetched from the info ioctl.

Tested-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
9 years agodrm/radeon: add get_allowed_info_register function for r1xx-r5xx
Alex Deucher [Wed, 1 Oct 2014 13:25:27 +0000 (09:25 -0400)]
drm/radeon: add get_allowed_info_register function for r1xx-r5xx

Just a stub.

Tested-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
9 years agodrm/radeon: add new callback for info ioctl register accessor
Alex Deucher [Wed, 1 Oct 2014 13:17:12 +0000 (09:17 -0400)]
drm/radeon: add new callback for info ioctl register accessor

This adds a callback for each asic family to determine what
registers are allowed to be read back via the info ioctl.

The idea here is to allow usermode to query things like GPU status
registers or GPU harvest registers for profiling and determining
the gfx config.

Tested-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
9 years agodrm/radeon: add INFO query for current sclk/mclk
Alex Deucher [Tue, 30 Sep 2014 15:33:30 +0000 (11:33 -0400)]
drm/radeon: add INFO query for current sclk/mclk

Allow the UMDs to query the current sclk/mclk
for profiling, etc.

Tested-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
9 years agodrm/radeon/kv: implement get_current_sclk/mclk
Alex Deucher [Tue, 30 Sep 2014 15:21:23 +0000 (11:21 -0400)]
drm/radeon/kv: implement get_current_sclk/mclk

Will be used for exposing current clocks via INFO ioctl.

Tested-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
9 years agodrm/radeon/tn: implement get_current_sclk/mclk
Alex Deucher [Tue, 30 Sep 2014 15:01:59 +0000 (11:01 -0400)]
drm/radeon/tn: implement get_current_sclk/mclk

Will be used for exposing current clocks via INFO ioctl.

Tested-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
9 years agodrm/radeon/sumo: implement get_current_sclk/mclk
Alex Deucher [Tue, 30 Sep 2014 14:58:22 +0000 (10:58 -0400)]
drm/radeon/sumo: implement get_current_sclk/mclk

Will be used for exposing current clocks via INFO ioctl.

Tested-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
9 years agodrm/radeon/ci: implement get_current_sclk/mclk
Alex Deucher [Tue, 30 Sep 2014 14:54:05 +0000 (10:54 -0400)]
drm/radeon/ci: implement get_current_sclk/mclk

Will be used for exposing current clocks via INFO ioctl.

Tested-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
9 years agodrm/radeon/si: implement get_current_sclk/mclk
Alex Deucher [Tue, 30 Sep 2014 14:50:07 +0000 (10:50 -0400)]
drm/radeon/si: implement get_current_sclk/mclk

Will be used for exposing current clocks via INFO ioctl.

Tested-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
9 years agodrm/radeon/ni: implement get_current_sclk/mclk
Alex Deucher [Tue, 30 Sep 2014 14:46:02 +0000 (10:46 -0400)]
drm/radeon/ni: implement get_current_sclk/mclk

Will be used for exposing current clocks via INFO ioctl.

Tested-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
9 years agodrm/radeon: remove some rv7xx leftovers from btc dpm code
Alex Deucher [Tue, 30 Sep 2014 14:41:15 +0000 (10:41 -0400)]
drm/radeon: remove some rv7xx leftovers from btc dpm code

Some copy paste leftovers.  No functional change.

Tested-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
9 years agodrm/radeon/btc: implement get_current_sclk/mclk
Alex Deucher [Tue, 30 Sep 2014 14:39:30 +0000 (10:39 -0400)]
drm/radeon/btc: implement get_current_sclk/mclk

Will be used for exposing current clocks via INFO ioctl.

Tested-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
9 years agodrm/radeon/rv7xx/eg: implement get_current_sclk/mclk
Alex Deucher [Tue, 30 Sep 2014 14:34:39 +0000 (10:34 -0400)]
drm/radeon/rv7xx/eg: implement get_current_sclk/mclk

Will be used for exposing current clocks via INFO ioctl.

Tested-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
9 years agodrm/radeon/rv6xx: implement get_current_sclk/mclk
Alex Deucher [Tue, 30 Sep 2014 14:27:42 +0000 (10:27 -0400)]
drm/radeon/rv6xx: implement get_current_sclk/mclk

Will be used for exposing current clocks via INFO ioctl.

Tested-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
9 years agodrm/radeon/rs780: implement get_current_sclk/mclk
Alex Deucher [Tue, 30 Sep 2014 14:19:57 +0000 (10:19 -0400)]
drm/radeon/rs780: implement get_current_sclk/mclk

Will be used for exposing current clocks via INFO ioctl.

Tested-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
9 years agodrm/radeon/dpm: add new callbacks to get the current sclk/mclk
Alex Deucher [Tue, 30 Sep 2014 14:12:17 +0000 (10:12 -0400)]
drm/radeon/dpm: add new callbacks to get the current sclk/mclk

Needed to to expose the current clocks via the INFO ioctl.

Tested-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
9 years agodrm/radeon: add INFO query for GPU temperature
Alex Deucher [Tue, 30 Sep 2014 14:04:40 +0000 (10:04 -0400)]
drm/radeon: add INFO query for GPU temperature

Useful for profiling.

Tested-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
9 years agodrm/radeon: dont switch vt on suspend
Maarten Lankhorst [Tue, 13 Jan 2015 08:40:13 +0000 (09:40 +0100)]
drm/radeon: dont switch vt on suspend

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
9 years agodrm/radeon: setup quantization_range in AVI infoframe
Alex Deucher [Mon, 23 Feb 2015 22:14:47 +0000 (17:14 -0500)]
drm/radeon: setup quantization_range in AVI infoframe

If the display supports selectable range, set the range
based on what the user has selected for output csc.

bug:
https://bugs.freedesktop.org/show_bug.cgi?id=83226

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
9 years agodrm/radeon: implement output csc property for DCE5+
Alex Deucher [Mon, 23 Feb 2015 15:59:36 +0000 (10:59 -0500)]
drm/radeon: implement output csc property for DCE5+

Implement the property for DCE5+ asics.  Older asics
require a slightly more complex process.

bug:
https://bugs.freedesktop.org/show_bug.cgi?id=83226

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
9 years agodrm/radeon: add an output_csc property
Alex Deucher [Mon, 23 Feb 2015 15:11:49 +0000 (10:11 -0500)]
drm/radeon: add an output_csc property

This adds the drm property for output csc (e.g.,
transform of output display colorspace).  Currently
only common ones (TV RGB, BT.601, BT.709) are supported,
but bypass and tv rgb are really the only useful ones at
the moment.  Additionally we could expose a user adjustable
matrix in the future.

This commit just adds the property.  The hw support will
be added in subsequent patches.

bug:
https://bugs.freedesktop.org/show_bug.cgi?id=83226

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
9 years agodrm: adv7511: Refactor power management
Laurent Pinchart [Mon, 2 Mar 2015 12:38:52 +0000 (14:38 +0200)]
drm: adv7511: Refactor power management

Remove the internal dependency on DPMS mode for power management by
using a by a powered state boolean instead, and use the new power off
handler at probe time. This ensure that the regmap cache is properly
marked as dirty when the device is probed, and the registers properly
synced during the first power up.

As a side effect this removes the initialization of current_edid_segment
at probe time, as the field will be initialized when the device is
powered on, at the latest right before reading EDID data.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Christian Kohn <christian.kohn@xilinx.com>
Tested-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
9 years agodrm: adv7511: Fix nested sleep when reading EDID
Laurent Pinchart [Wed, 18 Feb 2015 13:19:33 +0000 (15:19 +0200)]
drm: adv7511: Fix nested sleep when reading EDID

The EDID read code waits for the read completion interrupt to occur
using wait_event_interruptible(). The condition passed to the macro
reads I2C registers. This results in sleeping with the task state set
to TASK_INTERRUPTIBLE, triggering a WARN_ON() introduced in commit
8eb23b9f35aae ("sched: Debug nested sleeps").

Fix this by reworking the EDID read code. Instead of checking whether
the read is complete through I2C reads, handle the interrupt registers
in the interrupt handler and update a new edid_read flag accordingly. As
a side effect both the IRQ and polling code paths now process the
interrupt sources through the same code path, simplifying the code.

Cc: stable@vger.kernel.org
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
9 years agodrm: adv7511: Fix DDC error interrupt handling
Laurent Pinchart [Wed, 18 Feb 2015 13:19:33 +0000 (15:19 +0200)]
drm: adv7511: Fix DDC error interrupt handling

The DDC error interrupt bit is located in REG_INT1, not REG_INT0. Update
both the interrupt wait code and the interrupt sources reset code
accordingly.

Cc: stable@vger.kernel.org
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
9 years agodrm: rcar-du: Enable the atomic updates API
Laurent Pinchart [Thu, 26 Feb 2015 19:22:10 +0000 (21:22 +0200)]
drm: rcar-du: Enable the atomic updates API

Set the DRIVER_ATOMIC flag to enable usage of the atomic updates API
with the driver.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
9 years agodrm: rcar-du: Don't initialize event->pipe field
Laurent Pinchart [Thu, 5 Mar 2015 21:46:22 +0000 (23:46 +0200)]
drm: rcar-du: Don't initialize event->pipe field

The field is set by drm_send_vblank_event(), there's no need to
preinitialize it.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
9 years agodrm: rcar-du: Fix framebuffer reference leak through plane state
Laurent Pinchart [Thu, 5 Mar 2015 17:41:04 +0000 (19:41 +0200)]
drm: rcar-du: Fix framebuffer reference leak through plane state

Plane state duplication takes a reference to the framebuffer stored in
the state, but state destroy doesn't release it. This causes a reference
leak. Fix it.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
9 years agoMAINTAINERS: Remove rcar-du.h entry
Joe Perches [Sun, 8 Mar 2015 19:15:56 +0000 (12:15 -0700)]
MAINTAINERS: Remove rcar-du.h entry

commit 2378ad1228d2 ("drm: rcar-du: Remove platform data support")
removed the file, remove the pattern.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
9 years agoMerge branch 'drm_next' of https://github.com/markyzq/kernel-drm-rockchip into drm...
Dave Airlie [Thu, 19 Mar 2015 04:05:53 +0000 (14:05 +1000)]
Merge branch 'drm_next' of https://github.com/markyzq/kernel-drm-rockchip into drm-next

rockchip fixes.

* 'drm_next' of https://github.com/markyzq/kernel-drm-rockchip:
  drm/rockchip: vop: power off until vop standby take effect
  drm/rockchip: vop: set vop enabled after enable iommu
  drm/rockchip: vop use is_enabled instead of dpms mode
  drm/rockchip: vop: fix vop vsync/hsync polarity
  drm/rockchip: Only alloc a kmap for fbdev gem object

9 years agoMerge tag 'topic/drm-misc-2015-03-18' of git://anongit.freedesktop.org/drm-intel...
Dave Airlie [Thu, 19 Mar 2015 04:03:39 +0000 (14:03 +1000)]
Merge tag 'topic/drm-misc-2015-03-18' of git://anongit.freedesktop.org/drm-intel into drm-next

Another drm-misch pull request. Mostly the fbdev sizes deconfusion series
from Rob, everything else is small stuff all over. And the large i2c over
aux transfers patch, too.

* tag 'topic/drm-misc-2015-03-18' of git://anongit.freedesktop.org/drm-intel:
  drm: check that planes types are correct while initializing CRTC
  drm: change connector to tmp_connector
  drm: Fix some typo mistake of the annotations
  drm: Silence sparse warnings
  drm: %pF is only for function pointers
  drm/fb: handle tiled connectors better
  drm/fb: small cleanup
  drm/rockchip: use correct fb width/height
  drm/exynos: use correct fb width/height
  drm/cma: use correct fb width/height
  drm/atomic: minor kerneldoc typo fix
  drm/fb: document drm_fb_helper_surface_size
  drm/dp: Use large transactions for I2C over AUX
  drm/plane-helper: Fixup mismerge
  drm/atomic: Constify a bunch of functions pointer structs

9 years agodrm: check that planes types are correct while initializing CRTC
Benjamin Gaignard [Tue, 17 Mar 2015 11:05:29 +0000 (12:05 +0100)]
drm: check that planes types are correct while initializing CRTC

Be warned if primary or cursor planes haven't the correct type

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
9 years agodrm: change connector to tmp_connector
John Hunter [Tue, 17 Mar 2015 07:30:28 +0000 (15:30 +0800)]
drm: change connector to tmp_connector

This wasn't too harmful since we already look at connector,
which has the same effect as the loop for any non-cloned configs.
Only when we have a cloned configuration is it important to look
at other connectors. Furthermore existing userspace always changes
dpms on all of them anyway.

Signed-off-by: JohnHunter <zhjwpku@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
9 years agodrm: Fix some typo mistake of the annotations
John Hunter [Tue, 17 Mar 2015 07:30:26 +0000 (15:30 +0800)]
drm: Fix some typo mistake of the annotations

There are some mistakes that the function name in the annotaions
is not matching the real function name.
And some duplication word in annotations

Signed-off-by: John Hunter <zhjwpku@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
9 years agodrm/rockchip: vop: power off until vop standby take effect
Mark Yao [Wed, 4 Feb 2015 05:10:31 +0000 (13:10 +0800)]
drm/rockchip: vop: power off until vop standby take effect

Vop standby will take effect at end of current frame,
if dsp_hold_valid_irq happen, it means vop standby complete.

we must wait standby complete when we want to disable aclk,
if not, memory bus maybe dead.

Reviewed-by: Heiko Stuebner <heiko@sntech.de>
Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
9 years agodrm/rockchip: vop: set vop enabled after enable iommu
Mark Yao [Thu, 22 Jan 2015 10:29:57 +0000 (18:29 +0800)]
drm/rockchip: vop: set vop enabled after enable iommu

there is a Bug that:
  vop_enable()->drm_vblank_on, drm_vblank_on may call vop
enable vblank. if it happen, vblank enable would failed,
then cause irq status error. because is_enabled value is set
after drm_vblank_on.

after enable vop clocks and iommu regs, we can sure that
R/W vop regs and do vop plane flip is safe, so place
is_enabled = true after enable iommu is suitable.

Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
9 years agodrm/rockchip: vop use is_enabled instead of dpms mode
Mark Yao [Thu, 22 Jan 2015 06:37:56 +0000 (14:37 +0800)]
drm/rockchip: vop use is_enabled instead of dpms mode

drm dpms have many power modes: ON,OFF,SUSPEND,STANDBY, etc.
but vop only have enable/disable mode, maybe case such bug:
 --> DRM_DPMS_ON: power on vop
 --> DRM_DPMS_SUSPEND: power off vop
 --> DRM_DPMS_OFF: already power off at SUSPEND, crash
so use a bool val is more suitable.

Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
9 years agodrm/rockchip: vop: fix vop vsync/hsync polarity
Mark Yao [Thu, 22 Jan 2015 03:15:02 +0000 (11:15 +0800)]
drm/rockchip: vop: fix vop vsync/hsync polarity

Vop set wrong vsync/hsync polarity, it may cause some
display problem. known problem is that caused HDMI hdcp
authenticate failed, caused pixel offset with hdmi display.
the polarity description at RK3288 TRM doc:
  dsp_vsync_pol
    VSYNC polarity
      1'b0 : negative
      1'b1 : positive
      dsp_hsync_pol
    HSYNC polarity
      1'b0 : negative
      1'b1 : positive

Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
Tested-by: Caesar Wang <wxt@rock-chips.com>
Tested-by: Heiko Stuebner <heiko@sntech.de>
9 years agodrm/rockchip: Only alloc a kmap for fbdev gem object
Daniel Kurtz [Mon, 12 Jan 2015 06:58:23 +0000 (14:58 +0800)]
drm/rockchip: Only alloc a kmap for fbdev gem object

In general, the data in drm/rockchip GEM objects is never accessed by
the kernel.  The objects are either accessed by a GPU, by display
controller DMA, or by mmap'ing them to user space.  Thus, these
buffers need not be mapped into kernel address space.

The only exception is the fbdev framebuffer(s), which may be written
in-kernel by fbcon.

Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
9 years agodrm: Silence sparse warnings
Ville Syrjälä [Fri, 13 Mar 2015 12:51:25 +0000 (14:51 +0200)]
drm: Silence sparse warnings

../drivers/gpu/drm/drm_vm.c:405:6: warning: symbol 'drm_vm_open_locked' was not declared. Should it be static?
../drivers/gpu/drm/drm_vm.c:431:6: warning: symbol 'drm_vm_close_locked' was not declared. Should it be static?
../drivers/gpu/drm/drm_vm.c:681:5: warning: symbol 'drm_vma_info' was not declared. Should it be static?

../drivers/gpu/drm/drm_pci.c:146:5: warning: symbol 'drm_pci_set_unique' was not declared. Should it be static?
../drivers/gpu/drm/drm_pci.c:216:5: warning: symbol 'drm_irq_by_busid' was not declared. Should it be static?

../drivers/gpu/drm/drm_info.c:47:5: warning: symbol 'drm_name_info' was not declared. Should it be static?
../drivers/gpu/drm/drm_info.c:72:5: warning: symbol 'drm_vm_info' was not declared. Should it be static?
../drivers/gpu/drm/drm_info.c:116:5: warning: symbol 'drm_bufs_info' was not declared. Should it be static?
../drivers/gpu/drm/drm_info.c:159:5: warning: symbol 'drm_clients_info' was not declared. Should it be static?
../drivers/gpu/drm/drm_info.c:209:5: warning: symbol 'drm_gem_name_info' was not declared. Should it be static?

../drivers/gpu/drm/drm_ioc32.c:1019:20: warning: symbol 'drm_compat_ioctls' was not declared. Should it be static?

../drivers/gpu/drm/drm_bridge.c:52:12: warning: function 'drm_bridge_attach' with external linkage has definition

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
9 years agodrm: %pF is only for function pointers
Scott Wood [Thu, 12 Mar 2015 03:13:50 +0000 (22:13 -0500)]
drm: %pF is only for function pointers

Use %pS for actual addresses, otherwise you'll get bad output
on arches like ppc64 where %pF expects a function descriptor.

Signed-off-by: Scott Wood <scottwood@freescale.com>
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
9 years agodrm/fb: handle tiled connectors better
Rob Clark [Wed, 11 Mar 2015 14:23:14 +0000 (10:23 -0400)]
drm/fb: handle tiled connectors better

We don't want tile 0,0 to artificially constrain the size of the legacy
fbdev device.  Instead when reducing fb_size to be the minimum of all
displays, only consider the rightmost and bottommost tiles.

Signed-off-by: Rob Clark <robdclark@gmail.com>
Tested-by: Hai Li <hali@codeaurora.org>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
9 years agodrm/fb: small cleanup
Rob Clark [Wed, 11 Mar 2015 14:23:13 +0000 (10:23 -0400)]
drm/fb: small cleanup

Flip conditional to reduce indentation level of rest of fxn, and use
min/max to make the code clearer.

v2: surface_width -> surface_height typo

Signed-off-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
9 years agodrm/rockchip: use correct fb width/height
Rob Clark [Wed, 11 Mar 2015 14:23:12 +0000 (10:23 -0400)]
drm/rockchip: use correct fb width/height

What is passed to drm_fb_helper_fill_var() should be fb_width/fb_height,
rather than the surface size.

Signed-off-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
9 years agodrm/exynos: use correct fb width/height
Rob Clark [Wed, 11 Mar 2015 14:23:11 +0000 (10:23 -0400)]
drm/exynos: use correct fb width/height

What is passed to drm_fb_helper_fill_var() should be fb_width/fb_height,
rather than the surface size.

Signed-off-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
9 years agodrm/cma: use correct fb width/height
Rob Clark [Wed, 11 Mar 2015 14:23:10 +0000 (10:23 -0400)]
drm/cma: use correct fb width/height

What is passed to drm_fb_helper_fill_var() should be fb_width/fb_height,
rather than the surface size.

Signed-off-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
9 years agodrm/atomic: minor kerneldoc typo fix
Rob Clark [Wed, 11 Mar 2015 14:23:09 +0000 (10:23 -0400)]
drm/atomic: minor kerneldoc typo fix

Signed-off-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
9 years agodrm/fb: document drm_fb_helper_surface_size
Rob Clark [Wed, 11 Mar 2015 14:23:08 +0000 (10:23 -0400)]
drm/fb: document drm_fb_helper_surface_size

There has been some confusion about this struct.  Lack of documentation
probably didn't help.

Signed-off-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
9 years agodrm/dp: Use large transactions for I2C over AUX
Simon Farnsworth [Tue, 10 Feb 2015 18:38:08 +0000 (18:38 +0000)]
drm/dp: Use large transactions for I2C over AUX

Older DisplayPort to DVI-D Dual Link adapters designed by Bizlink have bugs
in their I2C over AUX implementation (fixed in newer revisions). They work
fine with Windows, but fail with Linux.

It turns out that they cannot keep an I2C transaction open unless the
previous read was 16 bytes; shorter reads can only be followed by a zero
byte transfer ending the I2C transaction.

Copy Windows's behaviour, and read 16 bytes at a time. If we get a short
reply, assume that there's a hardware bottleneck, and shrink our read size
to match. For this purpose, use the algorithm in the DisplayPort 1.2 spec,
in the hopes that it'll be closest to what Windows does.

Also provide an unsafe module parameter for testing smaller transfer sizes,
in case there are sinks out there that cannot work with Windows.

Note also that despite the previous comment in drm_dp_i2c_xfer, this speeds
up native DP EDID reads; Ville Syrjälä <ville.syrjala@linux.intel.com> found
the following changes in his testing:

Device under test:     old  -> with this patch
DP->DVI (OUI 001cf8):  40ms -> 35ms
DP->VGA (OUI 0022b9):  45ms -> 38ms
Zotac DP->2xHDMI:      25ms ->  4ms
Asus PB278 monitor:    22ms ->  3ms

A back of the envelope calculation shows that peak theoretical transfer rate
for 1 byte reads is around 60 kbit/s; with 16 byte reads, this increases to
around 500 kbit/s, which explains the increase in speed.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=55228
Tested-by: Aidan Marks <aidanamarks@gmail.com> (v3)
Signed-off-by: Simon Farnsworth <simon.farnsworth@onelan.co.uk>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
9 years agodrm/plane-helper: Fixup mismerge
Daniel Vetter [Wed, 11 Mar 2015 07:35:47 +0000 (08:35 +0100)]
drm/plane-helper: Fixup mismerge

I somehow manage to screw up applying Laurent's patch in eca93e28c256:
"drm: Check in setcrtc if the primary plane supports the fb pixel
format". It was a conflict with

commit 3461b30b3e171e16498f3d7bc59ab703aec475c8
Author: Daniel Vetter <daniel.vetter@ffwll.ch>
Date:   Thu Mar 5 10:32:44 2015 +0100

    drm/plane-helper: unexport drm_primary_helper_create_plane

and I just didn't check that the solution from wiggle made sense.

Cc: Dan Carpenter <dan.carpenter@oracle.com>
Cc: laurent.pinchart@ideasonboard.com
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: laurent.pinchart@ideasonboard.com
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
9 years agodrm/atomic: Constify a bunch of functions pointer structs
Ville Syrjälä [Tue, 10 Mar 2015 12:35:20 +0000 (14:35 +0200)]
drm/atomic: Constify a bunch of functions pointer structs

Make the helper function pointer structs const to make it clear they
should not be modified.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
9 years agoMerge tag 'topic/drm-misc-2015-03-10' of git://anongit.freedesktop.org/drm-intel...
Dave Airlie [Wed, 11 Mar 2015 02:15:06 +0000 (12:15 +1000)]
Merge tag 'topic/drm-misc-2015-03-10' of git://anongit.freedesktop.org/drm-intel into drm-next

Another pile of misc drm patches all over, mostly polish for atomic. Last
minute rebase was to avoid the broken merge.

* tag 'topic/drm-misc-2015-03-10' of git://anongit.freedesktop.org/drm-intel:
  drm: Check in setcrtc if the primary plane supports the fb pixel format
  drm: Lighten sysfs connector 'status'
  drm/plane-helper: unexport drm_primary_helper_create_plane
  drm: Share plane pixel format check code between legacy and atomic
  drm: Fix trivial typos in comments
  drm/dp: add DPCD definitions from eDP 1.4
  drm/dp: add DPCD definitions from DP 1.1 and 1.2a
  drm: Fixup racy refcounting in plane_force_disable
  drm/i915: Rotation property is now handled in DRM core
  drm: Complete moving rotation property to core
  drm/dp: add DPCD definitions from eDP 1.2
  drm/dp: indentation and ordering cleanups
  drm/atomic-helper: Fix kerneldoc for prepare_planes
  drm: Remove redundant code in the getencoder ioctl

9 years agodrm: Check in setcrtc if the primary plane supports the fb pixel format
Laurent Pinchart [Mon, 9 Mar 2015 08:41:07 +0000 (10:41 +0200)]
drm: Check in setcrtc if the primary plane supports the fb pixel format

Drivers implementing the universal planes API report the list of
supported pixel formats for the primary plane. Make sure the fb passed
to the setcrtc ioctl is compatible.

Drivers not implementing the universal planes API will have no format
reported for the primary plane, skip the check in that case.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
9 years agodrm: Lighten sysfs connector 'status'
Chris Wilson [Fri, 6 Mar 2015 12:36:42 +0000 (12:36 +0000)]
drm: Lighten sysfs connector 'status'

Since the beginning, sysfs/connector/status has done a heavyweight
detection of the current connector status. But no user, such as upowerd
or logind, has ever desired to initiate a probe. Move the probing into a
new attribute so that existing readers get the behaviour they desire.

v2: David Herrmann suggested using "echo detect > /sys/.../status" to
trigger the probing, which is a fine idea. This extends that to also
allow the user to apply the force detection overrides at runtime.

v3: Now with airlied's email address fixed! Requires sysfs_streq()

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: David Herrmann <dh.herrmann@gmail.com>
Cc: Dave Airlie <airlied@redhat.com>
Cc: Alex Deucher <alexdeucher@gmail.com>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
9 years agodrm/plane-helper: unexport drm_primary_helper_create_plane
Daniel Vetter [Thu, 5 Mar 2015 09:32:44 +0000 (10:32 +0100)]
drm/plane-helper: unexport drm_primary_helper_create_plane

We shouldn't tempt driver writers into using this since it uses a
default format list which is likely wrong. And when that's done we can
simplify the code a bit, too.

Noticed while reviewing a patch from Laurent.

Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Matt Roper <matthew.d.roper@intel.com>
Reviewed-by: Matt Roper <matthew.d.roper@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
9 years agodrm: Share plane pixel format check code between legacy and atomic
Laurent Pinchart [Thu, 5 Mar 2015 00:25:43 +0000 (02:25 +0200)]
drm: Share plane pixel format check code between legacy and atomic

Both the legacy and atomic helpers need to check whether a plane
supports a given pixel format. The code is currently duplicated, share
it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
[danvet: Slightly extend the docbook.]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
9 years agodrm: Fix trivial typos in comments
Yannick Guerrini [Wed, 4 Mar 2015 08:30:09 +0000 (09:30 +0100)]
drm: Fix trivial typos in comments

Change 'pixes' to 'pixels'
Change 'enabel' to 'enable'
Change 'enabeling' to 'enabling'

Signed-off-by: Yannick Guerrini <yguerrini@tomshardware.fr>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
9 years agodrm/dp: add DPCD definitions from eDP 1.4
Jani Nikula [Fri, 27 Feb 2015 11:11:14 +0000 (13:11 +0200)]
drm/dp: add DPCD definitions from eDP 1.4

Add a number of DPCD definitions from eDP 1.4.

v2: s/DP_ALPM_LOCK_TIMEOUT_ERROR_STATUS/DP_ALPM_LOCK_TIMEOUT_ERROR/
   (Sonika)

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Sonika Jindal <sonika.jindal@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
9 years agodrm/dp: add DPCD definitions from DP 1.1 and 1.2a
Jani Nikula [Fri, 27 Feb 2015 11:10:38 +0000 (13:10 +0200)]
drm/dp: add DPCD definitions from DP 1.1 and 1.2a

Add a number of DPCD definitions from DP 1.1 and 1.2a.

v2: drop wrong DP version reference, rename DP training set macros
(Sonika).

Reviewed-by: Sonika Jindal <sonika.jindal@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
9 years agodrm: Fixup racy refcounting in plane_force_disable
Daniel Vetter [Fri, 27 Feb 2015 11:58:13 +0000 (12:58 +0100)]
drm: Fixup racy refcounting in plane_force_disable

Originally it was impossible to be dropping the last refcount in this
function since there was always one around still from the idr. But in

commit 83f45fc360c8e16a330474860ebda872d1384c8c
Author: Daniel Vetter <daniel.vetter@ffwll.ch>
Date:   Wed Aug 6 09:10:18 2014 +0200

    drm: Don't grab an fb reference for the idr

we've switched to weak references, broke that assumption but forgot to
fix it up.

Since we still force-disable planes it's only possible to hit this
when racing multiple rmfb with fbdev restoring or similar evil things.
As long as userspace is nice it's impossible to hit the BUG_ON.

But the BUG_ON would most likely be hit from fbdev code, which usually
invovles the console_lock besides all modeset locks. So very likely
we'd never get the bug reports if this was hit in the wild, hence
better be safe than sorry and backport.

Spotted by Matt Roper while reviewing other patches.

Cc: stable@vger.kernel.org
Cc: Matt Roper <matthew.d.roper@intel.com>
Reviewed-by: Matt Roper <matthew.d.roper@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
9 years agodrm/i915: Rotation property is now handled in DRM core
Tvrtko Ursulin [Thu, 26 Feb 2015 13:49:18 +0000 (13:49 +0000)]
drm/i915: Rotation property is now handled in DRM core

So no need to have code which never gets called in the driver.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Matt Roper <matthew.d.roper@intel.com>
Cc: dri-devel@lists.freedesktop.org
Reviewed-by: Matt Roper <matthew.d.roper@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
9 years agodrm: Complete moving rotation property to core
Tvrtko Ursulin [Thu, 26 Feb 2015 13:49:17 +0000 (13:49 +0000)]
drm: Complete moving rotation property to core

Commit 1da30627fc511a57c9bd23a02c97f0576379f761 "drm: Add rotation value to
plane state" moved the rotation property to DRM core but only did the set
property part. This does the get property part as well.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Matt Roper <matthew.d.roper@intel.com>
Cc: dri-devel@lists.freedesktop.org
Reviewed-by: Matt Roper <matthew.d.roper@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
9 years agodrm/dp: add DPCD definitions from eDP 1.2
Jani Nikula [Wed, 25 Feb 2015 12:46:53 +0000 (14:46 +0200)]
drm/dp: add DPCD definitions from eDP 1.2

Mostly display control related DPCD addresses.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Sonika Jindal <sonika.jindal@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
9 years agodrm/dp: indentation and ordering cleanups
Jani Nikula [Wed, 25 Feb 2015 12:46:51 +0000 (14:46 +0200)]
drm/dp: indentation and ordering cleanups

Keep the DPCD macros ordered by address, and make indentation conform to
the rest of the file.

commit e045d20bef41707dbba676e58624b54f9f39e172
Author: Sonika Jindal <sonika.jindal@intel.com>
Date:   Thu Feb 19 13:16:44 2015 +0530

    drm: Adding edp1.4 specific dpcd macros

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Sonika Jindal <sonika.jindal@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
9 years agodrm/atomic-helper: Fix kerneldoc for prepare_planes
Daniel Vetter [Thu, 26 Feb 2015 13:17:38 +0000 (14:17 +0100)]
drm/atomic-helper: Fix kerneldoc for prepare_planes

Copypaste-fail from cleanup_planes. Reported by Tvrtko.

Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
9 years agodrm: Remove redundant code in the getencoder ioctl
Daniel Vetter [Wed, 25 Feb 2015 16:52:05 +0000 (17:52 +0100)]
drm: Remove redundant code in the getencoder ioctl

When enabling atomic state object for this ioctl in

commit abd69c55dd8f1f71b33b8c6165217f4329db8f25
Author: Daniel Vetter <daniel.vetter@ffwll.ch>
Date:   Tue Nov 25 23:50:05 2014 +0100

    drm: Handle atomic state properly in kms getfoo ioctl

I've forgotten to remove this hunk in one of the later revisions.
drm_encoder_get_crtc already does this.

Cc: Rob Clark <robdclark@gmail.com>
Cc: Sean Paul <seanpaul@chromium.org>
Reviewed-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
9 years agodrm/i915: Fix struct_mutex deadlock due to merge fumble
Ville Syrjälä [Mon, 9 Mar 2015 19:08:37 +0000 (21:08 +0200)]
drm/i915: Fix struct_mutex deadlock due to merge fumble

commit a8c6ecb3be7029881f7c95e5e201a629094a4e1a
Merge: 8dd0eb35 9eccca0
Author: Dave Airlie <airlied@redhat.com>
Date:   Mon Mar 9 19:58:30 2015 +1000

    Merge tag 'v4.0-rc3' into drm-next

managed to pick the wrong code to resolve the conflict and left us with
a mutex_lock(struct_mutex) without the mutex_unlock(struct_mutex) leading
to a deadlock. Fix the problem by recovering the correct code which doesn't
need the lock.

Cc: Dave Airlie <airlied@redhat.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>