GitHub/exynos8895/android_kernel_samsung_universal8895.git
10 years agodrm: Move sg functions into drm_legacy.h
Daniel Vetter [Thu, 11 Sep 2014 05:42:43 +0000 (07:42 +0200)]
drm: Move sg functions into drm_legacy.h

Also sprinkle the drm_legacy_ prefix where missing.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

concurrent buffer reads.

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

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

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

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

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

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

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

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

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

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

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

Conflicts:
drivers/gpu/drm/drm_irq.c

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

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

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

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

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

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

v2: Also drop the EXPORT_SYMBOL, spotted by Mario.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

LVDS panel, make/model described as:

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

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

Tested with panel attached to an Inforce IFC6410 board.

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

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

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

The drm_panel framework is used for panel-specific driver.

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

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

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

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

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

IPUv3 preparations for capture support

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

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

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

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

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

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

..we will not miss you..

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>
10 years agodrm: drop __KERNEL__ protection in drmP.h
David Herrmann [Fri, 29 Aug 2014 10:12:34 +0000 (12:12 +0200)]
drm: drop __KERNEL__ protection in drmP.h

drmP.h is internal to the kernel. No need to keep the __KERNEL__
protection.

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

pte_wrprotect() is only used by drm_vm.c, so move the include there. Also
include it unconditionally, all architectures provide this header!

Furthermore, replace asm/current.h with sched.h, which includes
asm/current.h unconditionally. This way we get the same effect and avoid
direct asm/ includes. Furthermore, drop the weird __alpha__ protection.
It's safe to include sched.h everywhere (and the wait.h comment doesn't
apply, anyway).

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

Move drm_agp_head to drm_agpsupport.h and drm_agp_mem into drm_legacy.h.
Unfortunately, drivers still heavily access drm_agp_head so we cannot
move it to drm_legacy.h. However, at least it's no longer visible in
drmP.h now (it's directly included from it, though).

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

This structure is unused, drop it.

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

In drm_release(), we currently call drm_remove_magic() if the drm_file
has a drm-magic attached. Therefore, once drm_master_release() is called,
the magic-list _must_ be empty.

By dropping the no-op cleanup, we can move "struct drm_magic_entry" to
drm_auth.c and avoid exposing it to all of DRM.

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

Make all the drm_vma_entry handling local to drm_vm.c and hide it from
global headers. This requires to extract the inlined legacy drm_vma_entry
cleanup into a small helper and also move a weirdly placed drm_vma_info
helper into drm_vm.c.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Reviewed-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
10 years agodrm: mark drm_buf and drm_map as legacy
David Herrmann [Fri, 29 Aug 2014 10:12:28 +0000 (12:12 +0200)]
drm: mark drm_buf and drm_map as legacy

Move internal declarations to drm_legacy.h and add drm_legacy_*() prefix
to all legacy functions.

[airlied: add a bit of an explaination to drm_legacy.h]

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Reviewed-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
10 years agodrm/radeon: move drm_buffer to drm/radeon/
David Herrmann [Fri, 29 Aug 2014 10:12:27 +0000 (12:12 +0200)]
drm/radeon: move drm_buffer to drm/radeon/

Radeon UMS is the last user of drm_buffer. Move it out of sight so radeon
can drop it together with UMS.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Reviewed-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
10 years agodrm/qxl: Fix crash in eviction from qxl_release_fence_buffer_objects
Maarten Lankhorst [Wed, 3 Sep 2014 15:02:44 +0000 (17:02 +0200)]
drm/qxl: Fix crash in eviction from qxl_release_fence_buffer_objects

This crash was already here before the conversion, but qxl never leaked
hard enough to hit this.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
10 years agodrm/qxl: fix gaping memory hole
Maarten Lankhorst [Wed, 3 Sep 2014 15:01:28 +0000 (17:01 +0200)]
drm/qxl: fix gaping memory hole

This is how you implement a memory sieve in a driver. ;-)

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
10 years agodrm/qxl: Remove release_lock stupidity
Maarten Lankhorst [Wed, 3 Sep 2014 14:59:41 +0000 (16:59 +0200)]
drm/qxl: Remove release_lock stupidity

The locking of release_lock was stupid; t should have been be called with
fence_lock_irq if it was legitimately used. Unfortunately it never protected
anything except the fence implementation correctly.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
10 years agodrm/qxl: enables gem prime helpers for qxl using dummy driver callbacks
Andreas Pokorny [Fri, 8 Aug 2014 08:40:56 +0000 (10:40 +0200)]
drm/qxl: enables gem prime helpers for qxl using dummy driver callbacks

As there should not be any other virtual device that might share buffers,
the callbacks remain empty stubs. Still prime can be used to transfer buffers
between processes that use qxl.

Signed-off-by: Andreas Pokorny <andreas.pokorny@canonical.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
10 years agodrm/qxl: simple crtc page flipping emulated using buffer copy
Andreas Pokorny [Fri, 8 Aug 2014 08:40:55 +0000 (10:40 +0200)]
drm/qxl: simple crtc page flipping emulated using buffer copy

Signed-off-by: Andreas Pokorny <andreas.pokorny@canonical.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
10 years agoMerge branch 'for-airlied-next' of git://people.freedesktop.org/~mlankhorst/linux...
Dave Airlie [Wed, 3 Sep 2014 00:12:24 +0000 (10:12 +1000)]
Merge branch 'for-airlied-next' of git://people.freedesktop.org/~mlankhorst/linux into drm-next

Merge the move to generic fences for TTM using drivers.

* 'for-airlied-next' of git://people.freedesktop.org/~mlankhorst/linux:
  drm/nouveau: use shared fences for readable objects
  drm/nouveau: Keep only a single list for validation.
  drm/ttm: use rcu in core ttm
  drm/vmwgfx: use rcu in vmw_user_dmabuf_synccpu_grab
  drm/radeon: use rcu waits in some ioctls
  drm/nouveau: use rcu in nouveau_gem_ioctl_cpu_prep
  drm/ttm: flip the switch, and convert to dma_fence
  drm/qxl: rework to new fence interface
  drm/nouveau: rework to new fence interface
  drm/vmwgfx: rework to new fence interface, v2
  drm/vmwgfx: get rid of different types of fence_flags entirely
  drm/radeon: use common fence implementation for fences, v4
  drm/ttm: kill off some members to ttm_validate_buffer
  drm/ttm: add interruptible parameter to ttm_eu_reserve_buffers
  drm/ttm: kill fence_lock
  drm/ttm: call ttm_bo_wait while inside a reservation
  drm/nouveau: require reservations for nouveau_fence_sync and nouveau_bo_fence
  drm/nouveau: add reservation to nouveau_gem_ioctl_cpu_prep

10 years agoMerge tag 'drm-intel-next-2014-09-01' of git://anongit.freedesktop.org/drm-intel...
Dave Airlie [Tue, 2 Sep 2014 22:30:48 +0000 (08:30 +1000)]
Merge tag 'drm-intel-next-2014-09-01' of git://anongit.freedesktop.org/drm-intel into drm-next

drm-intel-next-2014-08-22:
- basic code for execlist, which is the fancy new cmd submission on gen8. Still
  disabled by default (Ben, Oscar Mateo, Thomas Daniel et al)
- remove the useless usage of console_lock for I915_FBDEV=n (Chris)
- clean up relations between ctx and ppgtt
- clean up ppgtt lifetime handling (Michel Thierry)
- various cursor code improvements from Ville
- execbuffer code cleanups and secure batch fixes (Chris)
- prep work for dev -> dev_priv transition (Chris)
- some of the prep patches for the seqno -> request object transition (Chris)
- various small improvements all over

* tag 'drm-intel-next-2014-09-01' of git://anongit.freedesktop.org/drm-intel: (86 commits)
  drm/i915: fix suspend/resume for GENs w/o runtime PM support
  drm/i915: Update DRIVER_DATE to 20140822
  drm: fix plane rotation when restoring fbdev configuration
  drm/i915/bdw: Disable execlists by default
  drm/i915/bdw: Enable Logical Ring Contexts (hence, Execlists)
  drm/i915/bdw: Document Logical Rings, LR contexts and Execlists
  drm/i915/bdw: Print context state in debugfs
  drm/i915/bdw: Display context backing obj & ringbuffer info in debugfs
  drm/i915/bdw: Display execlists info in debugfs
  drm/i915/bdw: Disable semaphores for Execlists
  drm/i915/bdw: Make sure gpu reset still works with Execlists
  drm/i915/bdw: Don't write PDP in the legacy way when using LRCs
  drm/i915: Track cursor changes as frontbuffer tracking flushes
  drm/i915/bdw: Help out the ctx switch interrupt handler
  drm/i915/bdw: Avoid non-lite-restore preemptions
  drm/i915/bdw: Handle context switch events
  drm/i915/bdw: Two-stage execlist submit process
  drm/i915/bdw: Write the tail pointer, LRC style
  drm/i915/bdw: Implement context switching (somewhat)
  drm/i915/bdw: Emission of requests with logical rings
  ...

Conflicts:
drivers/gpu/drm/i915/i915_drv.c

10 years agodrm/nouveau: use shared fences for readable objects
Maarten Lankhorst [Wed, 9 Apr 2014 14:19:30 +0000 (16:19 +0200)]
drm/nouveau: use shared fences for readable objects

nouveau keeps track in userspace whether a buffer is being
written to or being read, but it doesn't use that information.

Change this to allow multiple readers on the same bo.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Acked-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau: Keep only a single list for validation.
Maarten Lankhorst [Wed, 9 Apr 2014 14:18:58 +0000 (16:18 +0200)]
drm/nouveau: Keep only a single list for validation.

Maintain the original order to handle VRAM/GART/mixed correctly for <nv50,
it's likely not as important on newer cards.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Acked-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/ttm: use rcu in core ttm
Maarten Lankhorst [Wed, 14 May 2014 13:42:29 +0000 (15:42 +0200)]
drm/ttm: use rcu in core ttm

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
10 years agodrm/vmwgfx: use rcu in vmw_user_dmabuf_synccpu_grab
Maarten Lankhorst [Wed, 14 May 2014 13:41:49 +0000 (15:41 +0200)]
drm/vmwgfx: use rcu in vmw_user_dmabuf_synccpu_grab

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
10 years agodrm/radeon: use rcu waits in some ioctls
Maarten Lankhorst [Wed, 14 May 2014 13:40:49 +0000 (15:40 +0200)]
drm/radeon: use rcu waits in some ioctls

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
10 years agodrm/nouveau: use rcu in nouveau_gem_ioctl_cpu_prep
Maarten Lankhorst [Wed, 14 May 2014 13:38:23 +0000 (15:38 +0200)]
drm/nouveau: use rcu in nouveau_gem_ioctl_cpu_prep

With the conversion to the reservation api this should be safe.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Acked-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/ttm: flip the switch, and convert to dma_fence
Maarten Lankhorst [Wed, 2 Apr 2014 15:14:48 +0000 (17:14 +0200)]
drm/ttm: flip the switch, and convert to dma_fence

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
10 years agodrm/qxl: rework to new fence interface
Maarten Lankhorst [Wed, 2 Apr 2014 10:40:05 +0000 (12:40 +0200)]
drm/qxl: rework to new fence interface

Final driver! \o/

This is not a proper dma_fence because the hardware may never signal
anything, so don't use dma-buf with qxl, ever.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
10 years agodrm/nouveau: rework to new fence interface
Maarten Lankhorst [Thu, 9 Jan 2014 10:03:11 +0000 (11:03 +0100)]
drm/nouveau: rework to new fence interface

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Acked-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/vmwgfx: rework to new fence interface, v2
Maarten Lankhorst [Wed, 26 Mar 2014 13:07:44 +0000 (14:07 +0100)]
drm/vmwgfx: rework to new fence interface, v2

Use the new fence interface on vmwgfx too.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
---
Changes since v1:
Fix a sleeping function called from invalid context in enable_signaling.

10 years agodrm/vmwgfx: get rid of different types of fence_flags entirely
Maarten Lankhorst [Wed, 26 Mar 2014 12:06:24 +0000 (13:06 +0100)]
drm/vmwgfx: get rid of different types of fence_flags entirely

Only one type was ever used. This is needed to simplify the fence
support in the next commit.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
10 years agogpu: ipu-v3: Add ipu_dump()
Steve Longerbeam [Thu, 26 Jun 2014 01:05:55 +0000 (18:05 -0700)]
gpu: ipu-v3: Add ipu_dump()

Adds ipu_dump() which dumps IPU register state to debug.

Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
10 years agogpu: ipu-cpmem: Add ipu_cpmem_dump()
Steve Longerbeam [Thu, 26 Jun 2014 01:05:54 +0000 (18:05 -0700)]
gpu: ipu-cpmem: Add ipu_cpmem_dump()

Adds ipu_cpmem_dump() which dumps a channel's cpmem to debug.

Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
10 years agogpu: ipu-v3: Add more planar formats support
Steve Longerbeam [Thu, 26 Jun 2014 01:05:53 +0000 (18:05 -0700)]
gpu: ipu-v3: Add more planar formats support

Adds support for the following planar and partial-planar formats:

YUV422
NV12
NV16

Signed-off-by: Dmitry Eremin-Solenikov <dmitry_eremin@mentor.com>
Signed-off-by: Mohsin Kazmi <mohsin_kazmi@mentor.com>
Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>
Unified base offset and Y plane offset into a single variable,
moved all ipu_cpmem_set_buffer calls to a single location.
Removed NV21 and NV61 for now. The IDMAC doesn't understand U/V
order for chroma interleaved formats, so we'd need to work around
this by implenting U/V switching via the CSC unit.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
10 years agogpu: ipu-cpmem: Add second buffer support to ipu_cpmem_set_image()
Steve Longerbeam [Thu, 26 Jun 2014 01:05:52 +0000 (18:05 -0700)]
gpu: ipu-cpmem: Add second buffer support to ipu_cpmem_set_image()

Add a second buffer physaddr to struct ipu_image, for double-buffering
support.

Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
10 years agogpu: ipu-cpmem: Add ipu_cpmem_set_rotation()
Steve Longerbeam [Thu, 26 Jun 2014 01:05:51 +0000 (18:05 -0700)]
gpu: ipu-cpmem: Add ipu_cpmem_set_rotation()

Adds ipu_cpmem_set_rotation().

Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
10 years agogpu: ipu-cpmem: Add ipu_cpmem_set_axi_id()
Steve Longerbeam [Thu, 26 Jun 2014 01:05:50 +0000 (18:05 -0700)]
gpu: ipu-cpmem: Add ipu_cpmem_set_axi_id()

Adds ipu_cpmem_set_axi_id() to set which AXI bus master the channel
will use to transfer data onto AXI bus.

Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
10 years agogpu: ipu-cpmem: Add ipu_cpmem_set_block_mode()
Steve Longerbeam [Thu, 26 Jun 2014 01:05:49 +0000 (18:05 -0700)]
gpu: ipu-cpmem: Add ipu_cpmem_set_block_mode()

Adds ipu_cpmem_set_block_mode().

Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
10 years agogpu: ipu-v3: Add ipu_idmac_lock_enable()
Steve Longerbeam [Thu, 26 Jun 2014 01:05:45 +0000 (18:05 -0700)]
gpu: ipu-v3: Add ipu_idmac_lock_enable()

Adds ipu_idmac_lock_enable(), which enables or disables channel
burst locking.

Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
10 years agogpu: ipu-v3: Add ipu_idmac_enable_watermark()
Steve Longerbeam [Thu, 26 Jun 2014 01:05:44 +0000 (18:05 -0700)]
gpu: ipu-v3: Add ipu_idmac_enable_watermark()

Adds the function ipu_idmac_enable_watermark(), which enables or disables
watermarking in the IDMAC channel. Enabling watermarking can increase a
channel's AXI bus arbitration priority.

Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
10 years agogpu: ipu-v3: Add ipu_stride_to_bytes()
Steve Longerbeam [Thu, 26 Jun 2014 01:05:43 +0000 (18:05 -0700)]
gpu: ipu-v3: Add ipu_stride_to_bytes()

Adds ipu_stride_to_bytes(), which converts a pixel stride to bytes,
suitable for passing to cpmem.

Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
10 years agogpu: ipu-v3: Add __ipu_idmac_reset_current_buffer()
Steve Longerbeam [Thu, 26 Jun 2014 01:05:42 +0000 (18:05 -0700)]
gpu: ipu-v3: Add __ipu_idmac_reset_current_buffer()

Adds __ipu_idmac_reset_current_buffer() that resets a channel's
internal current buffer pointer so that transfers start from buffer
0 on the next channel enable.

This operation is required for channel linking to work correctly,
for instance video capture pipelines that carry out image rotations
will fail after the first streaming unless this function is called
for each channel before re-enabling the channels.

Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
10 years agogpu: ipu-v3: Add ipu_idmac_clear_buffer()
Steve Longerbeam [Thu, 26 Jun 2014 01:05:41 +0000 (18:05 -0700)]
gpu: ipu-v3: Add ipu_idmac_clear_buffer()

Add the reverse of ipu_idmac_select_buffer(), that is, clear a buffer
ready status in a channel.

Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
10 years agogpu: ipu-v3: Add ipu_idmac_buffer_is_ready()
Steve Longerbeam [Thu, 26 Jun 2014 01:05:40 +0000 (18:05 -0700)]
gpu: ipu-v3: Add ipu_idmac_buffer_is_ready()

Add ipu_idmac_buffer_is_ready(), returns true if the given buffer in
the given channel is set ready (owned by IPU), or false if not ready
(owned by CPU core).

Support has been added for third buffer, there is no support yet for
triple-buffering in idmac channels, but this function checks
buffer-ready for third buffer in case this support is added later.

Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
10 years agogpu: ipu-v3: Move IDMAC channel names to imx-ipu-v3.h
Steve Longerbeam [Thu, 26 Jun 2014 01:05:39 +0000 (18:05 -0700)]
gpu: ipu-v3: Move IDMAC channel names to imx-ipu-v3.h

Move the IDMAC channel names to imx-ipu-v3.h, to make the names
available outside IPU. Add a couple new channels in the process
(async display BG/FG, channels 24 and 29).

Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
10 years agogpu: ipu-v3: Add helper function checking if pixfmt is planar
Steve Longerbeam [Thu, 26 Jun 2014 01:05:38 +0000 (18:05 -0700)]
gpu: ipu-v3: Add helper function checking if pixfmt is planar

Add simple helper function returning true if passed pixel format is one
of supported planar ones.

Signed-off-by: Dmitry Eremin-Solenikov <dmitry_eremin@mentor.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
10 years agogpu: ipu-v3: Add rotation mode conversion utilities
Steve Longerbeam [Thu, 26 Jun 2014 01:05:37 +0000 (18:05 -0700)]
gpu: ipu-v3: Add rotation mode conversion utilities

Add two functions:

- ipu_degrees_to_rot_mode(): converts a degrees, hflip, and vflip setting
  to an IPU rotation mode.
- ipu_rot_mode_to_degrees(): converts an IPU rotation mode with given hflip
  and vflip settings to degrees.

Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
10 years agogpu: ipu-v3: Add ipu_mbus_code_to_colorspace()
Steve Longerbeam [Thu, 26 Jun 2014 01:05:36 +0000 (18:05 -0700)]
gpu: ipu-v3: Add ipu_mbus_code_to_colorspace()

Add ipu_mbus_code_to_colorspace() to find ipu_color_space from a
media bus pixel format code.

Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
10 years agogpu: ipu-v3: smfc: Add ipu_smfc_set_watermark()
Steve Longerbeam [Thu, 26 Jun 2014 01:05:35 +0000 (18:05 -0700)]
gpu: ipu-v3: smfc: Add ipu_smfc_set_watermark()

Adds ipu_smfc_set_watermark() which programs a channel's SMFC FIFO
levels at which the watermark signal is set and cleared.

Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
10 years agogpu: ipu-v3: smfc: Convert to per-channel
Steve Longerbeam [Thu, 26 Jun 2014 01:05:34 +0000 (18:05 -0700)]
gpu: ipu-v3: smfc: Convert to per-channel

Convert the smfc object to be specific to a single smfc channel.
Add ipu_smfc_{get|put} to retrieve and release a single smfc channel
for exclusive use, and add use counter to ipu_smfc_{enable|disable}.

Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
10 years agogpu: ipu-v3: smfc: Move enable/disable to ipu-smfc.c
Steve Longerbeam [Thu, 26 Jun 2014 01:05:33 +0000 (18:05 -0700)]
gpu: ipu-v3: smfc: Move enable/disable to ipu-smfc.c

Move the SMFC module enable/disable helpers into the ipu-smfc submodule.

Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
10 years agogpu: ipu-v3: Add Image Converter unit
Steve Longerbeam [Mon, 11 Aug 2014 11:04:50 +0000 (13:04 +0200)]
gpu: ipu-v3: Add Image Converter unit

Adds the Image Converter (IC) unit.

Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>
Condensed the three CSC setup functions into a single one that
uses static tables to set up the CSC task parameters.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
10 years agogpu: ipu-v3: Add Camera Sensor Interface unit
Steve Longerbeam [Tue, 19 Aug 2014 17:52:40 +0000 (10:52 -0700)]
gpu: ipu-v3: Add Camera Sensor Interface unit

Adds the Camera Sensor Interface (CSI) unit required for video capture.

Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>
Removed the unused clk_get_rate in ipu_csi_init_interface and the
ipu_csi_ccir_err_detection_enable/disable functions.
Checkpatch cleanup.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
10 years agodrm/radeon: use common fence implementation for fences, v4
Maarten Lankhorst [Thu, 9 Jan 2014 10:03:12 +0000 (11:03 +0100)]
drm/radeon: use common fence implementation for fences, v4

Changes since v1:
- Kill the sw interrupt dance, add and use
  radeon_irq_kms_sw_irq_get_delayed instead.
- Change custom wait function, lockdep complained about it.
  Holding exclusive_lock in the wait function might cause deadlocks.
  Instead do all the processing in .enable_signaling, and wait
  on the global fence_queue to pick up gpu resets.
- Process all fences in radeon_gpu_reset after reset to close a race
  with the trylock in enable_signaling.
Changes since v2:
- Small changes to work with the rewritten lockup recovery patches.
Changes since v3:
- Call radeon_fence_schedule_check when exclusive_lock cannot be
  acquired to always cause a wake up.
- Reset irqs from hangup check.
- Drop reading seqno in the callback, use cached value.
- Fix indentation in radeon_fence_default_wait
- Add a radeon_test_signaled function, drop a few test_bit calls.
- Make to_radeon_fence global.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
10 years agodrm/ttm: kill off some members to ttm_validate_buffer
Maarten Lankhorst [Thu, 9 Jan 2014 10:03:08 +0000 (11:03 +0100)]
drm/ttm: kill off some members to ttm_validate_buffer

This reorders the list to keep track of what buffers are reserved,
so previous members are always unreserved.

This gets rid of some bookkeeping that's no longer needed,
while simplifying the code some.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
10 years agodrm/ttm: add interruptible parameter to ttm_eu_reserve_buffers
Maarten Lankhorst [Thu, 9 Jan 2014 10:03:08 +0000 (11:03 +0100)]
drm/ttm: add interruptible parameter to ttm_eu_reserve_buffers

It seems some drivers really want this as a parameter,
like vmwgfx.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
10 years agodrm/ttm: kill fence_lock
Maarten Lankhorst [Tue, 21 Jan 2014 12:07:31 +0000 (13:07 +0100)]
drm/ttm: kill fence_lock

No users are left, kill it off! :D
Conversion to the reservation api is next on the list, after
that the functionality can be restored with rcu.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
10 years agodrm/ttm: call ttm_bo_wait while inside a reservation
Maarten Lankhorst [Tue, 21 Jan 2014 12:07:01 +0000 (13:07 +0100)]
drm/ttm: call ttm_bo_wait while inside a reservation

This is the last remaining function that doesn't use the reservation
lock completely to fence off access to a buffer.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
10 years agodrm/nouveau: require reservations for nouveau_fence_sync and nouveau_bo_fence
Maarten Lankhorst [Tue, 21 Jan 2014 12:02:14 +0000 (13:02 +0100)]
drm/nouveau: require reservations for nouveau_fence_sync and nouveau_bo_fence

This will ensure we always hold the required lock when calling those functions.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Acked-by: Ben Skeggs <bskeggs@redhat.com>
10 years agodrm/nouveau: add reservation to nouveau_gem_ioctl_cpu_prep
Maarten Lankhorst [Tue, 21 Jan 2014 12:00:24 +0000 (13:00 +0100)]
drm/nouveau: add reservation to nouveau_gem_ioctl_cpu_prep

Apart from some code inside ttm itself and nouveau_bo_vma_del,
this is the only place where ttm_bo_wait is used without a reservation.
Fix this so we can remove the fence_lock later on.

After the switch to rcu the reservation lock will be
removed again.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Acked-by: Ben Skeggs <bskeggs@redhat.com>
10 years agoMerge branch 'drm-next-3.18' of git://people.freedesktop.org/~agd5f/linux into drm...
Dave Airlie [Thu, 28 Aug 2014 03:45:45 +0000 (13:45 +1000)]
Merge branch 'drm-next-3.18' of git://people.freedesktop.org/~agd5f/linux into drm-next

Just clearing out my -next queue before I go on vacation.  Two UVD
improvements that depend on the ttm change you just merged.

* 'drm-next-3.18' of git://people.freedesktop.org/~agd5f/linux:
  drm/radeon: preallocate mem for UVD create/destroy msg
  drm/radeon: allow UVD to use a second 256MB segment

10 years agodrm/radeon: preallocate mem for UVD create/destroy msg
Christian König [Fri, 22 Aug 2014 12:25:55 +0000 (14:25 +0200)]
drm/radeon: preallocate mem for UVD create/destroy msg

llocating memory for UVD create and destroy messages can fail, which is
rather annoying when this happens in the middle of a GPU reset. Try to
avoid this condition by preallocating a page for those dummy messages.

Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
10 years agodrm/radeon: allow UVD to use a second 256MB segment
Christian König [Thu, 21 Aug 2014 10:18:12 +0000 (12:18 +0200)]
drm/radeon: allow UVD to use a second 256MB segment

This improves concurrent stream decoding.

Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>