profile/ivi/kernel-x86-ivi.git
12 years agodrm/radeon/kms: add 6xx/7xx CS parser for async DMA (v2)
Alex Deucher [Fri, 18 Nov 2011 15:19:47 +0000 (10:19 -0500)]
drm/radeon/kms: add 6xx/7xx CS parser for async DMA (v2)

Allows us to use the DMA ring from userspace.
DMA doesn't have a good NOP packet in which to embed the
reloc idx, so userspace has to add a reloc for each
buffer used and order them to match the command stream.

v2: fix address bounds checking, reloc indexing

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 years agodrm/radeon: fix htile buffer size computation for command stream checker
Jerome Glisse [Thu, 13 Dec 2012 17:08:11 +0000 (12:08 -0500)]
drm/radeon: fix htile buffer size computation for command stream checker

Fix the size computation of the htile buffer.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 years agodrm/radeon: fix fence locking in the pageflip callback
Daniel Vetter [Tue, 11 Dec 2012 22:42:24 +0000 (23:42 +0100)]
drm/radeon: fix fence locking in the pageflip callback

We need to hold bdev->fence_lock while grabbing a reference to
the fence, to prevent concurrent clearing/changing of the
ttm_bo->sync_obj field.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 years agodrm/radeon: make indirect register access concurrency-safe
Daniel Vetter [Sun, 2 Dec 2012 13:06:15 +0000 (14:06 +0100)]
drm/radeon: make indirect register access concurrency-safe

With the new per-crtc locking mutliple set-cursor calls could happen
in parallel. Out of sheer paranoia I've opted for an irqsave spinlock.
But if there's indeed an access from interrupt contexts to these regs
it's already broken with the old code, so this can likely just be
reduced to a normal spinlock. Otoh the pageflip completion happens
from the vblank irq handler ...

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 years agodrm/radeon: add W|RREG32_IDX for MM_INDEX|DATA based mmio accesss
Daniel Vetter [Sun, 2 Dec 2012 13:02:51 +0000 (14:02 +0100)]
drm/radeon: add W|RREG32_IDX for MM_INDEX|DATA based mmio accesss

Just refactoring to make the next patche simpler. Now all indirect register
access in the new modesetting driver should go through the r100_mm_(w|r)reg
fucntions.

RADEON_READ_MM from the old driver seems to be totally unused, so just kill
it.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 years agoMerge branch 'drm-next-3.8' of git://people.freedesktop.org/~agd5f/linux into drm...
Dave Airlie [Thu, 13 Dec 2012 02:03:22 +0000 (12:03 +1000)]
Merge branch 'drm-next-3.8' of git://people.freedesktop.org/~agd5f/linux into drm-next

* 'drm-next-3.8' of git://people.freedesktop.org/~agd5f/linux:
  drm/radeon: fix fence driver for dma ring when wb is disabled
  drm/radeon/si: add VM CS checker support for CP DMA
  drm/radeon/cayman: add VM CS checker support for CP DMA
  drm/radeon: add support for CP DMA packet to evergreen CS checker
  drm/radeon: add support for CP DMA packet to r6xx/r7xx CS checker
  drm/radeon: add register headers for CP DMA on r6xx-SI
  drm/radeon: improve mc_stop/mc_resume on r5xx-r7xx
  drm/radeon: fix amd afusion gpu setup aka sumo v2
  drm/radeon: do not move bo to different placement at each cs

12 years agodrm/radeon: fix fence driver for dma ring when wb is disabled
Jerome Glisse [Wed, 12 Dec 2012 21:43:15 +0000 (16:43 -0500)]
drm/radeon: fix fence driver for dma ring when wb is disabled

The dma ring can't write to register thus have to write to memory
its fence value. This ensure that it doesn't try to use scratch
register for dma ring fence driver.

Should fix:
https://bugs.freedesktop.org/show_bug.cgi?id=58166

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
12 years agodrm/radeon/si: add VM CS checker support for CP DMA
Alex Deucher [Tue, 4 Dec 2012 00:42:37 +0000 (19:42 -0500)]
drm/radeon/si: add VM CS checker support for CP DMA

Need to verify for copies involving registers.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 years agodrm/radeon/cayman: add VM CS checker support for CP DMA
Alex Deucher [Tue, 4 Dec 2012 00:32:54 +0000 (19:32 -0500)]
drm/radeon/cayman: add VM CS checker support for CP DMA

Need to verify for copies involving registers.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 years agodrm/radeon: add support for CP DMA packet to evergreen CS checker
Alex Deucher [Tue, 4 Dec 2012 00:18:30 +0000 (19:18 -0500)]
drm/radeon: add support for CP DMA packet to evergreen CS checker

Currently only memory and GDS transfers are allowed.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 years agodrm/radeon: add support for CP DMA packet to r6xx/r7xx CS checker
Alex Deucher [Tue, 4 Dec 2012 00:03:23 +0000 (19:03 -0500)]
drm/radeon: add support for CP DMA packet to r6xx/r7xx CS checker

Currently only memory to memory transfers are allowed.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 years agodrm/radeon: add register headers for CP DMA on r6xx-SI
Alex Deucher [Mon, 3 Dec 2012 23:07:25 +0000 (18:07 -0500)]
drm/radeon: add register headers for CP DMA on r6xx-SI

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 years agodrm/radeon: improve mc_stop/mc_resume on r5xx-r7xx
Alex Deucher [Wed, 12 Dec 2012 19:30:32 +0000 (14:30 -0500)]
drm/radeon: improve mc_stop/mc_resume on r5xx-r7xx

Along the same lines of what was done for evergreen+
in the last kernel.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 years agodrm/radeon: fix amd afusion gpu setup aka sumo v2
Jerome Glisse [Tue, 11 Dec 2012 16:56:52 +0000 (11:56 -0500)]
drm/radeon: fix amd afusion gpu setup aka sumo v2

Set the proper number of tile pipe that should be a multiple of
pipe depending on the number of se engine.

Fix:
https://bugs.freedesktop.org/show_bug.cgi?id=56405
https://bugs.freedesktop.org/show_bug.cgi?id=56720

v2: Don't change sumo2

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Cc: stable@vger.kernel.org
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
12 years agodrm/radeon: do not move bo to different placement at each cs
Jerome Glisse [Thu, 29 Nov 2012 15:35:41 +0000 (10:35 -0500)]
drm/radeon: do not move bo to different placement at each cs

The bo creation placement is where the bo will be. Instead of trying
to move bo at each command stream let this work to another worker
thread that will use more advance heuristic.

agd5f: remove leftover unused variable

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
12 years agoMerge branch 'drm-next-3.8' of git://people.freedesktop.org/~agd5f/linux into drm...
Dave Airlie [Mon, 10 Dec 2012 22:46:03 +0000 (08:46 +1000)]
Merge branch 'drm-next-3.8' of git://people.freedesktop.org/~agd5f/linux into drm-next

Alex writes:
"adds support for the
asynchronous DMA engines on r6xx-SI.  These engines are used
for ttm bo moves and VM page table updates currently.  They
could also be exposed via the CS ioctl for userspace use,
but I haven't had a chance to add proper CS checker patches
for them yet.  These patches have been tested extensively
internally for months, so they should be pretty solid."

* 'drm-next-3.8' of git://people.freedesktop.org/~agd5f/linux:
  drm/radeon: use DMA engine for VM page table updates on SI
  drm/radeon: add dma engine support for vm pt updates on si (v2)
  drm/radeon: use DMA engine for VM page table updates on cayman/TN
  drm/radeon: add dma engine support for vm pt updates on ni (v5)
  drm/radeon: use async dma for ttm buffer moves on 6xx-SI
  drm/radeon/kms: add support for dma rings to radeon_test_moves()
  drm/radeon/kms: Add initial support for async DMA on SI
  drm/radeon/kms: Add initial support for async DMA on cayman/TN
  drm/radeon/kms: Add initial support for async DMA on evergreen
  drm/radeon/kms: Add initial support for async DMA on r6xx/r7xx

12 years agodrm/radeon: use DMA engine for VM page table updates on SI
Alex Deucher [Mon, 22 Oct 2012 16:34:39 +0000 (12:34 -0400)]
drm/radeon: use DMA engine for VM page table updates on SI

DMA engine has special packets to facilitate this and it also keeps
the 3D engine free for other things.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 years agodrm/radeon: add dma engine support for vm pt updates on si (v2)
Alex Deucher [Mon, 22 Oct 2012 16:32:54 +0000 (12:32 -0400)]
drm/radeon: add dma engine support for vm pt updates on si (v2)

Async DMA has a special packet for contiguous pt updates
which saves overhead.

v2: rebase

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 years agodrm/radeon: use DMA engine for VM page table updates on cayman/TN
Alex Deucher [Mon, 22 Oct 2012 16:22:39 +0000 (12:22 -0400)]
drm/radeon: use DMA engine for VM page table updates on cayman/TN

DMA engine has special packets to facilitate this and it also keeps
the 3D engine free for other things.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 years agodrm/radeon: add dma engine support for vm pt updates on ni (v5)
Alex Deucher [Mon, 22 Oct 2012 16:19:01 +0000 (12:19 -0400)]
drm/radeon: add dma engine support for vm pt updates on ni (v5)

Async DMA has a special packet for contiguous pt updates
which saves overhead.

v2: leave the CP method enabled for now as doing the updates
in the DMA rings is not working properly yet.

v3: update for 2 level pts

v4: rebase

v5: drop pte/pde packet.  doesn't seem to work on NI.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 years agodrm/radeon: use async dma for ttm buffer moves on 6xx-SI
Alex Deucher [Fri, 20 Jul 2012 17:49:49 +0000 (13:49 -0400)]
drm/radeon: use async dma for ttm buffer moves on 6xx-SI

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 years agodrm/radeon/kms: add support for dma rings to radeon_test_moves()
Alex Deucher [Mon, 4 Jun 2012 22:45:15 +0000 (18:45 -0400)]
drm/radeon/kms: add support for dma rings to radeon_test_moves()

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 years agodrm/radeon/kms: Add initial support for async DMA on SI
Alex Deucher [Tue, 4 Dec 2012 20:28:18 +0000 (15:28 -0500)]
drm/radeon/kms: Add initial support for async DMA on SI

Pretty much the same as cayman.  Some changes to the copy
packets.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 years agodrm/radeon/kms: Add initial support for async DMA on cayman/TN
Alex Deucher [Tue, 4 Dec 2012 20:27:33 +0000 (15:27 -0500)]
drm/radeon/kms: Add initial support for async DMA on cayman/TN

There are 2 async DMA engines on cayman, one at 0xd000 and
one at 0xd800.  The programming interface is the same as
evergreen however there are some changes to the commands
for using vmids.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 years agodrm/radeon/kms: Add initial support for async DMA on evergreen
Alex Deucher [Tue, 4 Dec 2012 20:25:59 +0000 (15:25 -0500)]
drm/radeon/kms: Add initial support for async DMA on evergreen

Pretty similar to 6xx/7xx except the count field increased in the
packet header and the max IB size increased.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 years agodrm/radeon/kms: Add initial support for async DMA on r6xx/r7xx
Alex Deucher [Thu, 27 Sep 2012 19:08:35 +0000 (15:08 -0400)]
drm/radeon/kms: Add initial support for async DMA on r6xx/r7xx

Uses the new multi-ring infrastucture.  6xx/7xx has a single
async DMA ring.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 years agodrm/ttm: remove no_wait_reserve, v3
Maarten Lankhorst [Wed, 28 Nov 2012 11:25:44 +0000 (11:25 +0000)]
drm/ttm: remove no_wait_reserve, v3

All items on the lru list are always reservable, so this is a stupid
thing to keep. Not only that, it is used in a way which would
guarantee deadlocks if it were ever to be set to block on reserve.

This is a lot of churn, but mostly because of the removal of the
argument which can be nested arbitrarily deeply in many places.

No change of code in this patch except removal of the no_wait_reserve
argument, the previous patch removed the use of no_wait_reserve.

v2:
 - Warn if -EBUSY is returned on reservation, all objects on the list
   should be reservable. Adjusted patch slightly due to conflicts.
v3:
 - Focus on no_wait_reserve removal only.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm/ttm: cope with reserved buffers on lru list in ttm_mem_evict_first, v2
Maarten Lankhorst [Wed, 28 Nov 2012 11:25:43 +0000 (11:25 +0000)]
drm/ttm: cope with reserved buffers on lru list in ttm_mem_evict_first, v2

Replace the goto loop with a simple for each loop, and only run the
delayed destroy cleanup if we can reserve the buffer first.

No race occurs, since lru lock is never dropped any more. An empty list
and a list full of unreservable buffers both cause -EBUSY to be returned,
which is identical to the previous situation, because previously buffers
on the lru list were always guaranteed to be reservable.

This should work since currently ttm guarantees items on the lru are
always reservable, and reserving items blockingly with some bo held
are enough to cause you to run into a deadlock.

Currently this is not a concern since removal off the lru list and
reservations are always done with atomically, but when this guarantee
no longer holds, we have to handle this situation or end up with
possible deadlocks.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm/ttm: cope with reserved buffers on swap list in ttm_bo_swapout, v2
Maarten Lankhorst [Wed, 28 Nov 2012 11:25:42 +0000 (11:25 +0000)]
drm/ttm: cope with reserved buffers on swap list in ttm_bo_swapout, v2

Replace the while loop with a simple for each loop, and only run the
delayed destroy cleanup if we can reserve the buffer first.

No race occurs, since lru lock is never dropped any more. An empty list
and a list full of unreservable buffers both cause -EBUSY to be returned,
which is identical to the previous situation.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm/ttm: call ttm_bo_cleanup_refs with reservation and lru lock held, v3
Maarten Lankhorst [Thu, 29 Nov 2012 11:36:54 +0000 (11:36 +0000)]
drm/ttm: call ttm_bo_cleanup_refs with reservation and lru lock held, v3

By removing the unlocking of lru and retaking it immediately, a race is
removed where the bo is taken off the swap list or the lru list between
the unlock and relock. As such the cleanup_refs code can be simplified,
it will attempt to call ttm_bo_wait non-blockingly, and if it fails
it will drop the locks and perform a blocking wait, or return an error
if no_wait_gpu was set.

The need for looping is also eliminated, since swapout and evict_mem_first
will always follow the destruction path, no new fence is allowed
to be attached. As far as I can see this may already have been the case,
but the unlocking / relocking required a complicated loop to deal with
re-reservation.

Changes since v1:
 - Simplify no_wait_gpu case by folding it in with empty ddestroy.
 - Hold a reservation while calling ttm_bo_cleanup_memtype_use again.
Changes since v2:
 - Do not remove bo from lru list while waiting

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm/radeon: allow move_notify to be called without reservation
Maarten Lankhorst [Wed, 28 Nov 2012 11:25:40 +0000 (11:25 +0000)]
drm/radeon: allow move_notify to be called without reservation

The few places that care should have those checks instead.
This allows destruction of bo backed memory without a reservation.
It's required for being able to rework the delayed destroy path,
as it is no longer guaranteed to hold a reservation before unlocking.

However any previous wait is still guaranteed to complete, and it's
one of the last things to be done before the buffer object is freed.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm/ttm: change fence_lock to inner lock
Maarten Lankhorst [Wed, 28 Nov 2012 11:25:39 +0000 (12:25 +0100)]
drm/ttm: change fence_lock to inner lock

This requires changing the order in ttm_bo_cleanup_refs_or_queue to
take the reservation first, as there is otherwise no race free way to
take lru lock before fence_lock.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agoMerge branch 'drm-next-3.8' of git://people.freedesktop.org/~agd5f/linux into drm...
Dave Airlie [Sat, 8 Dec 2012 03:17:07 +0000 (13:17 +1000)]
Merge branch 'drm-next-3.8' of git://people.freedesktop.org/~agd5f/linux into drm-next

Alex writes:
Pretty minor -next pull request.  We some additional new bits waiting
internally for release.  Hopefully Monday we can get at least some of
them out.  The others will probably take a few more weeks.

Highlights of the current request:
- ELD registers for passing audio information to the sound hardware
- Handle GPUVM page faults more gracefully
- Misc fixes

Merge radeon test
* 'drm-next-3.8' of git://people.freedesktop.org/~agd5f/linux: (483 commits)
  drm/radeon: bump driver version for new info ioctl requests
  drm/radeon: fix eDP clk and lane setup for scaled modes
  drm/radeon: add new INFO ioctl requests
  drm/radeon/dce32+: use fractional fb dividers for high clocks
  drm/radeon: use cached memory when evicting for vram on non agp
  drm/radeon: add a CS flag END_OF_FRAME
  drm/radeon: stop page faults from hanging the system (v2)
  drm/radeon/dce4/5: add registers for ELD handling
  drm/radeon/dce3.2: add registers for ELD handling
  radeon: fix pll/ctrc mapping on dce2 and dce3 hardware
  Linux 3.7-rc7
  powerpc/eeh: Do not invalidate PE properly
  Revert "drm/i915: enable rc6 on ilk again"
  ALSA: hda - Fix build without CONFIG_PM
  of/address: sparc: Declare of_iomap as an extern function for sparc again
  PM / QoS: fix wrong error-checking condition
  bnx2x: remove redundant warning log
  vxlan: fix command usage in its doc
  8139cp: revert "set ring address before enabling receiver"
  MPI: Fix compilation on MIPS with GCC 4.4 and newer
  ...

Conflicts:
drivers/gpu/drm/exynos/exynos_drm_encoder.c
drivers/gpu/drm/exynos/exynos_drm_fbdev.c
drivers/gpu/drm/nouveau/core/engine/disp/nv50.c

12 years agodrm/radeon: bump driver version for new info ioctl requests
Alex Deucher [Sat, 8 Dec 2012 01:00:30 +0000 (20:00 -0500)]
drm/radeon: bump driver version for new info ioctl requests

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 years agodrm/radeon: fix eDP clk and lane setup for scaled modes
Alex Deucher [Tue, 4 Dec 2012 21:50:28 +0000 (16:50 -0500)]
drm/radeon: fix eDP clk and lane setup for scaled modes

Need to use the adjusted mode since we are sending native
timing and using the scaler for non-native modes.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Jerome Glisse <jglisse@redhat.com>
cc: stable@vger.kernel.org

12 years agodrm/radeon: add new INFO ioctl requests
Alex Deucher [Tue, 4 Dec 2012 17:55:37 +0000 (12:55 -0500)]
drm/radeon: add new INFO ioctl requests

Add requests to get the number of shader engines (SE) and
the number of SH per SE.  These are needed for geometry
and tesselation shaders in the 3D driver as well as setting
up PA_SC_RASTER_CONFIG on SI asics.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 years agodrm/radeon/dce32+: use fractional fb dividers for high clocks
Alex Deucher [Tue, 13 Nov 2012 23:03:41 +0000 (18:03 -0500)]
drm/radeon/dce32+: use fractional fb dividers for high clocks

Fixes flickering with some high res montiors.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
CC: stable@vger.kernel.org
12 years agodrm/radeon: use cached memory when evicting for vram on non agp
Jerome Glisse [Wed, 28 Nov 2012 18:47:55 +0000 (13:47 -0500)]
drm/radeon: use cached memory when evicting for vram on non agp

Force the use of cached memory when evicting from vram on non agp
hardware. Also force write combine on agp hw. This is to insure
the minimum cache type change when allocating memory and improving
memory eviction especialy on pci/pcie hw.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
12 years agodrm/radeon: add a CS flag END_OF_FRAME
Marek Olšák [Sun, 2 Dec 2012 20:03:33 +0000 (21:03 +0100)]
drm/radeon: add a CS flag END_OF_FRAME

No version bump is required because setting the flag on older DRM has
no effect.

This only reserves the bit and doesn't use it. I assume we will use it
for buffer eviction heuristics.

Signed-off-by: Marek Olšák <maraeo@gmail.com>
12 years agodrm/radeon: stop page faults from hanging the system (v2)
Christian König [Tue, 18 Sep 2012 19:30:44 +0000 (15:30 -0400)]
drm/radeon: stop page faults from hanging the system (v2)

Redirect invalid memory accesses to the default page
instead of locking up the memory controller. Also
enable the invalid memory access interrupts and
start spamming system log with it.

v2 (agd5f): fix up against 2 level PT changes

Signed-off-by: Christian König <deathsimple@vodafone.de>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
12 years agoMerge branch 'connector-to-object-prop' of git://github.com/robclark/kernel-omap4...
Dave Airlie [Thu, 6 Dec 2012 04:08:09 +0000 (14:08 +1000)]
Merge branch 'connector-to-object-prop' of git://github.com/robclark/kernel-omap4 into drm-next

* 'connector-to-object-prop' of git://github.com/robclark/kernel-omap4:
  drm: remove legacy drm_connector_property fxns
  drm/nouveau: drm_connector_property -> drm_object_property
  drm/i915: One more drm_connector_property -> drm_object_property
  drm/i2c: drm_connector_property -> drm_object_property
  drm/vmwgfx: drm_connector_property -> drm_object_property
  drm/udl: drm_connector_property -> drm_object_property
  drm/shmob: drm_connector_property -> drm_object_property
  drm/radeon: drm_connector_property -> drm_object_property
  drm/gma500: drm_connector_property -> drm_object_property

12 years agoMerge branch 'exynos-drm-next' of git://git.kernel.org/pub/scm/linux/kernel/git/daein...
Dave Airlie [Wed, 5 Dec 2012 19:53:10 +0000 (05:53 +1000)]
Merge branch 'exynos-drm-next' of git://git./linux/kernel/git/daeinki/drm-exynos into drm-next

This patch set adds iommu support, userptr feature to g2d, minor fixups
and code cleanups.

And the iommu feature has dependency of the below patches related to
dma mapping framework.

This patch is used to allocate fully physically contiguous memory region.
- add sending AVI and AVI info frames.
  . this adds some codes for composing AVI and AUI info frames
    and send them every VSYNC for HDMI Certification.
- bug fix to previous pull request.
- add some code cleanup

* 'exynos-drm-next' of git://git.kernel.org/pub/scm/linux/kernel/git/daeinki/drm-exynos: (32 commits)
  drm/exynos: sending AVI and AUI info frames
  drm/exynos: Use devm_clk_get in exynos_drm_fimd.c
  drm/exynos: Use devm_* APIs in exynos_hdmi.c
  drm/exynos: Use devm_clk_get in exynos_mixer.c
  drm/exynos: Fix potential NULL pointer dereference
  drm/exynos: Use devm_clk_get in exynos_drm_g2d.c
  drm/exynos: use sgt instead of pages for framebuffer address
  drm: exynos: fix for loosing display mode header during mode adjustment
  drm/exynos: fix memory leak to EDID block
  drm/exynos: remove 'pages' and 'page_size' elements in exynos gem buffer
  drm/exynos: add exynos drm specific fb_mmap function
  drm/exynos: make sure that overlay data are updated
  drm/exynos: add vm_ops to specific gem mmaper
  drm/exynos: add userptr feature for g2d module
  drm/exynos: remove unnecessary sg_alloc_table call
  drm: exynos: fix for mapping of dma buffers
  drm/exynos: remove EXYNOS_BO_NONCONTIG type checking.
  drm/exynos: add iommu support for g2d
  drm/exynos: add iommu support for hdmi driver
  drm/exynos: add iommu support to fimd driver
  ...

12 years agodrm/exynos: sending AVI and AUI info frames
Rahul Sharma [Mon, 26 Nov 2012 05:22:57 +0000 (10:52 +0530)]
drm/exynos: sending AVI and AUI info frames

This patch adds code for composing AVI and AUI info frames
and send them every VSYNC.

This patch is important for hdmi certification.

v3:
- Moved enums, macros to exynos_hdmi.c.
- Corrected hex format.
- Added static to hdmi_reg_infoframe.

v2:
- Added few blank lines.
- Corrected comments format.
- Added comments for 2's Complement calculation for check sum.

v1:
- Remove un-necessary blank lines.
- Change the case of hex constants.

Signed-off-by: Rahul Sharma <rahul.sharma@samsung.com>
Signed-off-by: Fahad Kunnathadi <fahad.k@samsung.com>
Signed-off-by: Shirish S <s.shirish@samsung.com>
Acked-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
12 years agodrm/exynos: Use devm_clk_get in exynos_drm_fimd.c
Sachin Kamat [Mon, 26 Nov 2012 04:17:14 +0000 (09:47 +0530)]
drm/exynos: Use devm_clk_get in exynos_drm_fimd.c

devm_clk_get is device managed and makes error handling and exit code
simpler.
Also fixes an error related to returning 'ret' without initialising
with error code.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
12 years agodrm/exynos: Use devm_* APIs in exynos_hdmi.c
Sachin Kamat [Fri, 23 Nov 2012 08:43:27 +0000 (14:13 +0530)]
drm/exynos: Use devm_* APIs in exynos_hdmi.c

devm_* functions are device managed and make error handling and exit code
simpler.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
12 years agodrm/exynos: Use devm_clk_get in exynos_mixer.c
Sachin Kamat [Fri, 23 Nov 2012 08:43:26 +0000 (14:13 +0530)]
drm/exynos: Use devm_clk_get in exynos_mixer.c

devm_clk_get is device managed and makes error handling and exit code
simpler.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
12 years agodrm/exynos: Fix potential NULL pointer dereference
Sachin Kamat [Fri, 23 Nov 2012 03:41:59 +0000 (09:11 +0530)]
drm/exynos: Fix potential NULL pointer dereference

Pointer was being dereferenced after freeing.

Fixes the following error:
drivers/gpu/drm/exynos/exynos_drm_g2d.c:323 g2d_userptr_put_dma_addr() error:
dereferencing freed memory 'g2d_userptr'

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
12 years agodrm/exynos: Use devm_clk_get in exynos_drm_g2d.c
Sachin Kamat [Fri, 23 Nov 2012 03:41:58 +0000 (09:11 +0530)]
drm/exynos: Use devm_clk_get in exynos_drm_g2d.c

devm_clk_get is device managed and makes error handling and exit code
simpler.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
12 years agodrm/exynos: use sgt instead of pages for framebuffer address
Prathyush K [Thu, 22 Nov 2012 06:48:35 +0000 (12:18 +0530)]
drm/exynos: use sgt instead of pages for framebuffer address

The 'pages' structure in the exynos gem buffer has been
removed. So we get the fix.smem_start from the first sgl
of the scatter gather table.

Signed-off-by: Prathyush K <prathyush.k@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
12 years agodrm: exynos: fix for loosing display mode header during mode adjustment
Rahul Sharma [Tue, 20 Nov 2012 11:28:26 +0000 (16:58 +0530)]
drm: exynos: fix for loosing display mode header during mode adjustment

This patch is to preserve the display mode header during the mode adjustment.
Display mode header is overwritten with the adjusted mode header which is
throwing the stack dump.

Signed-off-by: Rahul Sharma <rahul.sharma@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
12 years agodrm/exynos: fix memory leak to EDID block
Egbert Eich [Tue, 20 Nov 2012 09:30:16 +0000 (04:30 -0500)]
drm/exynos: fix memory leak to EDID block

drm_get_edid() returns a pointer to an EDID block. The caller
is responsible to free this pointer itself.
Here the pointer gets assigned to the local variable raw_edid.
Therefore it should be freed before the variable goes out of
scope.

Signed-off-by: Egbert Eich <eich@suse.de>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
12 years agodrm/exynos: remove 'pages' and 'page_size' elements in exynos gem buffer
Prathyush K [Tue, 20 Nov 2012 10:32:56 +0000 (19:32 +0900)]
drm/exynos: remove 'pages' and 'page_size' elements in exynos gem buffer

Changelog v2:

Removed redundant check for invalid sgl.
Added check for valid page_offset in the beginning of exynos_drm_gem_map_buf.

Changelog v1:

The 'pages' structure is not required since we can use the 'sgt'. Even for
CONTIG buffers, a SGT is created (which will have just one sgl). This SGT
can be used during mmap instead of 'pages'. The 'page_size' element of the
structure is also not used anywhere and is removed.
This patch also fixes a memory leak where the 'pages' structure was being
allocated during gem buffer allocation but not being freed during deallocate.

Signed-off-by: Prathyush K <prathyush.k@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
12 years agodrm/exynos: add exynos drm specific fb_mmap function
Prathyush K [Mon, 19 Nov 2012 08:25:28 +0000 (13:55 +0530)]
drm/exynos: add exynos drm specific fb_mmap function

Changelog v3:

Passing the actual buffer size instead of vm_size to dma_mmap_attrs.

Changelog v2:

Extracting the private data from fb_info structure to obtain the exynos
gem buffer structure. Now, dma address is obtained from the exynos gem
buffer structure and not from smem_start. Also calling dma_mmap_attrs
(instead of dma_mmap_writecombine) with the same attributes used
during allocation.

Changelog v1:

This patch adds a exynos drm specific implementation of fb_mmap
which supports mapping a non-contiguous buffer to user space.

This new function does not assume that the frame buffer is contiguous
and calls dma_mmap_writecombine for mapping the buffer to user space.
dma_mmap_writecombine will be able to map a contiguous buffer as well
as non-contig buffer depending on whether an IOMMU mapping is created
for drm or not.

Signed-off-by: Prathyush K <prathyush.k@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
12 years agodrm/exynos: make sure that overlay data are updated
Inki Dae [Thu, 22 Nov 2012 08:41:23 +0000 (17:41 +0900)]
drm/exynos: make sure that overlay data are updated

Changelog v2:
fix a little bit performance issue to previous patch.
- When drm framebuffer is destroyed, make sure that overlay
  data are updated to real hardwrae for all encoders
  instead of waiting for vblank every page flip request.
  For this, it adds a new function,
  exynos_drm_encoder_complete_scanout function.

Changelog v1:
This patch removes wait_for_vblank call from
exynos_drm_encoder_plane_disable function and move it to
exynos_drm_encoder_plane_commit function.

Disabling dma channel to each plane doens't need vblank
signal to update data to real hardware. But updating
overlay data to real hardware does need vblank signal.

Signed-off-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
12 years agodrm/exynos: add vm_ops to specific gem mmaper
Inki Dae [Thu, 8 Nov 2012 12:52:54 +0000 (21:52 +0900)]
drm/exynos: add vm_ops to specific gem mmaper

Changelog v3:
use drm_file's file object instead of gem object's
- gem object's file represents the shmem storage so
  process-unique file object should be used instead.

Changelog v2:
call mutex_lock before drm_vm_open_locked is called.

Changelog v1:
This patch makes it takes a reference to gem object when
specific gem mmap is requested. For this, it sets
dev->driver->gem_vm_ops to vma->vm_ops.

And this patch is based on exynos-drm-next-iommu branch of
git://git.kernel.org/pub/scm/linux/kernel/git/daeinki/drm-exynos

Signed-off-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
12 years agodrm/exynos: add userptr feature for g2d module
Inki Dae [Sun, 4 Nov 2012 13:48:52 +0000 (05:48 -0800)]
drm/exynos: add userptr feature for g2d module

This patch adds userptr feautre for G2D module.

The userptr means user space address allocated by malloc().
And the purpose of this feature is to make G2D's dma able
to access the user space region.

To user this feature, user should flag G2D_BUF_USRPTR to
offset variable of struct drm_exynos_g2d_cmd and fill
struct drm_exynos_g2d_userptr with user space address
and size for it and then should set a pointer to
drm_exynos_g2d_userptr object to data variable of struct
drm_exynos_g2d_cmd. The last bit of offset variable is used
to check if the cmdlist's buffer type is userptr or not.
If userptr, the g2d driver gets user space address and size
and then gets pages through get_user_pages().
(another case is counted as gem handle)

Below is sample codes:

static void set_cmd(struct drm_exynos_g2d_cmd *cmd,
unsigned long offset, unsigned long data)
{
cmd->offset = offset;
cmd->data = data;
}

static int solid_fill_test(int x, int y, unsigned long userptr)
{
struct drm_exynos_g2d_cmd cmd_gem[5];
struct drm_exynos_g2d_userptr g2d_userptr;
unsigned int gem_nr = 0;
...

g2d_userptr.userptr = userptr;
g2d_userptr.size = x * y * 4;

set_cmd(&cmd_gem[gem_nr++], DST_BASE_ADDR_REG |
G2D_BUF_USERPTR,
(unsigned long)&g2d_userptr);
...
}

int main(int argc, char **argv)
{
unsigned long addr;
...

addr = malloc(x * y * 4);
...

solid_fill_test(x, y, addr);
...
}

And next, the pages are mapped with iommu table and the device
address is set to cmdlist so that G2D's dma can access it.
As you may know, the pages from get_user_pages() are pinned.
In other words, they CAN NOT be migrated and also swapped out.
So the dma access would be safe.

But the use of userptr feature has performance overhead so
this patch also has memory pool to the userptr feature.
Please, assume that user sends cmdlist filled with userptr
and size every time to g2d driver, and the get_user_pages
funcion will be called every time.

The memory pool has maximum 64MB size and the userptr that
user had ever sent, is holded in the memory pool.
This meaning is that if the userptr from user is same as one
in the memory pool, device address to the userptr in the memory
pool is set to cmdlist.

And last, the pages from get_user_pages() will be freed once
user calls free() and the dma access is completed. Actually,
get_user_pages() takes 2 reference counts if the user process
has never accessed user region allocated by malloc(). Then, if
the user calls free(), the page reference count becomes 1 and
becomes 0 with put_page() call. And the reverse holds as well.
This means how the pages backed are used by dma and freed.

This patch is based on "drm/exynos: add iommu support for g2d",
https://patchwork.kernel.org/patch/1629481/

Signed-off-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
12 years agodrm/exynos: remove unnecessary sg_alloc_table call
Prathyush K [Wed, 7 Nov 2012 10:28:58 +0000 (15:58 +0530)]
drm/exynos: remove unnecessary sg_alloc_table call

The function dma_get_sgtable will allocate a sg table internally so
it is not necessary to allocate a sg table before it. The unnecessary
'sg_alloc_table' call is removed.

Signed-off-by: Prathyush K <prathyush.k@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
12 years agodrm: exynos: fix for mapping of dma buffers
Rahul Sharma [Mon, 5 Nov 2012 15:34:29 +0000 (21:04 +0530)]
drm: exynos: fix for mapping of dma buffers

This patch fixes the problem of mapping contigous and non contigous dma buffers.

Currently page struct is calculated from the buf->dma_addr which is not the
physical address. It is replaced by buf->pages which points to the page struct
of the first page of contigous memory chunk. This gives the correct page frame
number for mapping.

Non-contigous dma buffers are described using SG table and SG lists. Each
valid SG List is pointing to a single page or group of pages which are
physically contigous. Current implementation just maps the first page of each
SG List and leave the other pages unmapped, leading to a crash. Given solution
finds the page struct for the faulting page through parsing SG table and map it.

Signed-off-by: Rahul Sharma <rahul.sharma@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
12 years agodrm/exynos: remove EXYNOS_BO_NONCONTIG type checking.
Inki Dae [Fri, 2 Nov 2012 07:10:39 +0000 (16:10 +0900)]
drm/exynos: remove EXYNOS_BO_NONCONTIG type checking.

With iommu support, non-continuous buffer also is supported so
this patch removes these checking from exynos_drm_gem_get/put_dma_addr
funciton.

This patch is based on the below patch set, "drm/exynos: add
iommu support for -next".
http://www.spinics.net/lists/dri-devel/msg29041.html

Signed-off-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
12 years agodrm/exynos: add iommu support for g2d
Inki Dae [Sun, 4 Nov 2012 04:53:24 +0000 (21:53 -0700)]
drm/exynos: add iommu support for g2d

Chagelog v2:
removed unnecessary structure, struct g2d_gem_node.

Chagelog v1:
This patch adds iommu support for g2d driver. For this, it
adds subdrv_probe/remove callback to enable or disable
g2d iommu. And with this patch, in case of using g2d iommu,
we can get or put device address to a gem handle from user
through exynos_drm_gem_get/put_dma_addr(). Actually, these
functions take a reference to a gem handle so that the gem
object used by g2d dma is released properly.

And runqueue_node has a pointer to drm_file object of current
process to manage gem handles to owner.

This patch is based on the below patch set, "drm/exynos: add
iommu support for -next".
     http://www.spinics.net/lists/dri-devel/msg29041.html

Signed-off-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
12 years agodrm/exynos: add iommu support for hdmi driver
Inki Dae [Fri, 19 Oct 2012 08:37:35 +0000 (17:37 +0900)]
drm/exynos: add iommu support for hdmi driver

Changelog v2:
move iommu support feature to mixer side.
And below is Prathyush's comment.

According to the new IOMMU framework for exynos sysmmus,
the owner of the sysmmu-tv is mixer (which is the actual
device that does DMA) and not hdmi.
The mmu-master in sysmmu-tv node is set as below in exynos5250.dtsi
sysmmu-tv {
-
mmu-master = <&mixer>;
};

Changelog v1:
The iommu will be enabled when hdmi sub driver is probed and
will be disabled when removed.

Signed-off-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
12 years agodrm/radeon/dce4/5: add registers for ELD handling
Alex Deucher [Mon, 3 Dec 2012 16:59:21 +0000 (11:59 -0500)]
drm/radeon/dce4/5: add registers for ELD handling

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 years agodrm/radeon/dce3.2: add registers for ELD handling
Alex Deucher [Mon, 3 Dec 2012 16:52:49 +0000 (11:52 -0500)]
drm/radeon/dce3.2: add registers for ELD handling

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 years agodrm: remove legacy drm_connector_property fxns
Rob Clark [Fri, 12 Oct 2012 01:50:56 +0000 (20:50 -0500)]
drm: remove legacy drm_connector_property fxns

Replace references to and remove the connector property fxns, which
have been superseded with the more general object property fxns:

  + drm_connector_attach_property -> drm_object_attach_property
  + drm_connector_property_set_value -> drm_object_property_set_value
  + drm_connector_property_get_value -> drm_object_property_get_value

Signed-off-by: Rob Clark <rob@ti.com>
12 years agodrm/nouveau: drm_connector_property -> drm_object_property
Rob Clark [Fri, 12 Oct 2012 01:42:04 +0000 (20:42 -0500)]
drm/nouveau: drm_connector_property -> drm_object_property

Signed-off-by: Rob Clark <rob@ti.com>
12 years agodrm/i915: One more drm_connector_property -> drm_object_property
Rob Clark [Fri, 12 Oct 2012 01:36:04 +0000 (20:36 -0500)]
drm/i915: One more drm_connector_property -> drm_object_property

One new drm_connector_attach_property() snuck in after the initial patch
was written.

Signed-off-by: Rob Clark <rob@ti.com>
12 years agodrm/i2c: drm_connector_property -> drm_object_property
Rob Clark [Fri, 12 Oct 2012 01:50:10 +0000 (20:50 -0500)]
drm/i2c: drm_connector_property -> drm_object_property

Signed-off-by: Rob Clark <rob@ti.com>
12 years agodrm/vmwgfx: drm_connector_property -> drm_object_property
Rob Clark [Fri, 12 Oct 2012 01:47:14 +0000 (20:47 -0500)]
drm/vmwgfx: drm_connector_property -> drm_object_property

Signed-off-by: Rob Clark <rob@ti.com>
12 years agodrm/udl: drm_connector_property -> drm_object_property
Rob Clark [Fri, 12 Oct 2012 01:46:48 +0000 (20:46 -0500)]
drm/udl: drm_connector_property -> drm_object_property

Signed-off-by: Rob Clark <rob@ti.com>
12 years agodrm/shmob: drm_connector_property -> drm_object_property
Rob Clark [Fri, 12 Oct 2012 01:45:53 +0000 (20:45 -0500)]
drm/shmob: drm_connector_property -> drm_object_property

Signed-off-by: Rob Clark <rob@ti.com>
12 years agodrm/radeon: drm_connector_property -> drm_object_property
Rob Clark [Fri, 12 Oct 2012 01:44:52 +0000 (20:44 -0500)]
drm/radeon: drm_connector_property -> drm_object_property

Signed-off-by: Rob Clark <rob@ti.com>
12 years agodrm/gma500: drm_connector_property -> drm_object_property
Rob Clark [Fri, 12 Oct 2012 01:38:23 +0000 (20:38 -0500)]
drm/gma500: drm_connector_property -> drm_object_property

Signed-off-by: Rob Clark <rob@ti.com>
12 years agodrm/exynos: add iommu support to fimd driver
Inki Dae [Fri, 19 Oct 2012 08:16:36 +0000 (17:16 +0900)]
drm/exynos: add iommu support to fimd driver

The iommu will be enabled when fimd sub driver is probed and
will be disabled when removed.

Signed-off-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
12 years agodrm/exynos: add iommu support for exynos drm framework
Inki Dae [Sat, 20 Oct 2012 14:53:42 +0000 (07:53 -0700)]
drm/exynos: add iommu support for exynos drm framework

Changelog v4:
- fix condition to drm_iommu_detach_device funtion.

Changelog v3:
- add dma_parms->max_segment_size setting of drm_device->dev.
- use devm_kzalloc instead of kzalloc.

Changelog v2:
- fix iommu attach condition.
  . check archdata.dma_ops of drm device instead of
    subdrv device's one.
- code clean to exynos_drm_iommu.c file.
  . remove '#ifdef CONFIG_ARM_DMA_USE_IOMMU' from exynos_drm_iommu.c
    and add it to driver/gpu/drm/exynos/Kconfig.

Changelog v1:
This patch adds iommu support for exynos drm framework with dma mapping
api. In this patch, we used dma mapping api to allocate physical memory
and maps it with iommu table and removed some existing codes and added
new some codes for iommu support.

GEM allocation requires one device object to use dma mapping api so
this patch uses one iommu mapping for all sub drivers. In other words,
all sub drivers have same iommu mapping.

Signed-off-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
12 years agoARM: dma-mapping: add support for DMA_ATTR_FORCE_CONTIGUOUS attribute
Marek Szyprowski [Mon, 15 Oct 2012 14:03:52 +0000 (16:03 +0200)]
ARM: dma-mapping: add support for DMA_ATTR_FORCE_CONTIGUOUS attribute

This patch adds support for DMA_ATTR_FORCE_CONTIGUOUS attribute for
dma_alloc_attrs() in IOMMU-aware implementation. For allocating physically
contiguous buffers Contiguous Memory Allocator is used.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
12 years agocommon: DMA-mapping: add DMA_ATTR_FORCE_CONTIGUOUS attribute
Marek Szyprowski [Mon, 15 Oct 2012 14:03:51 +0000 (16:03 +0200)]
common: DMA-mapping: add DMA_ATTR_FORCE_CONTIGUOUS attribute

This patch adds DMA_ATTR_FORCE_CONTIGUOUS attribute to the DMA-mapping
subsystem.

By default DMA-mapping subsystem is allowed to assemble the buffer
allocated by dma_alloc_attrs() function from individual pages if it can
be mapped as contiguous chunk into device dma address space. By
specifing this attribute the allocated buffer is forced to be contiguous
also in physical memory.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
12 years agodrm: hold event_lock while accessing vblank_event_list
Imre Deak [Fri, 2 Nov 2012 11:30:50 +0000 (13:30 +0200)]
drm: hold event_lock while accessing vblank_event_list

Currently the only users of drm_vblank_off() are i915 and gma500,
neither of which holds the event_lock when calling this function.
Fix this by holding the event_lock while traversing the list.

Signed-off-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
12 years agodrm/exynos: fix lockdep for event_lock wrt. vbl_time_lock
Imre Deak [Fri, 2 Nov 2012 11:30:49 +0000 (13:30 +0200)]
drm/exynos: fix lockdep for event_lock wrt. vbl_time_lock

Currently the exynos driver calls drm_vblank_off() with the event_lock
held, while drm_vblank_off() will lock vbl_time and vblank_time_lock.
This lock dependency chain conflicts with the one in drm_handle_vblank()
where we first lock vblank_time_lock and then the event_lock.

Fix this by removing the above drm_vblank_off() calls which are in fact
never executed: drm_dev->vblank_disable_allowed is only ever non-zero
during driver init, until it's set in {fimd,vidi}_subdrv_probe. Both the
driver init and open code is protected by drm_global_mutex, so the
earliest page flip ioctl can happen only after vblank_disable_allowed is
set to 1. Thus {fimd,vidi}_finish_pageflip - with pending flip events -
will always get called with vblank_disable_allowed being 1.

Signed-off-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
12 years agodrm/exynos: call drm_vblank_put for each queued flip event
Imre Deak [Fri, 2 Nov 2012 11:30:48 +0000 (13:30 +0200)]
drm/exynos: call drm_vblank_put for each queued flip event

It's guaranteed that for each event on pageflip_event_list we have
called drm_vblank_get() - see exynos_drm_crtc_page_flip() - so checking
for this is redundant.

Also we need to call drm_vblank_put() for each event on the list, not
only once, otherwise we'd leak vblank references if there are multiple
events on the list.

Signed-off-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
12 years agodrm/exynos: hold event_lock while accessing pageflip_event_list
Imre Deak [Fri, 2 Nov 2012 11:30:47 +0000 (13:30 +0200)]
drm/exynos: hold event_lock while accessing pageflip_event_list

Signed-off-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
12 years agodrm/exynos: Fix potential NULL pointer dereference in exynos_drm_encoder.c
Sachin Kamat [Mon, 19 Nov 2012 09:20:30 +0000 (14:50 +0530)]
drm/exynos: Fix potential NULL pointer dereference in exynos_drm_encoder.c

Check overlay_ops is not NULL as checked in the previous 'if' condition.
Fixes the following smatch error:
drivers/gpu/drm/exynos/exynos_drm_encoder.c:509 exynos_drm_encoder_plane_disable()
error: we previously assumed 'overlay_ops' could be null (see line 499)

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
12 years agodrm/exynos: Make exynos4/5_fimd_driver_data static
Sachin Kamat [Mon, 19 Nov 2012 09:52:54 +0000 (15:22 +0530)]
drm/exynos: Make exynos4/5_fimd_driver_data static

Fixes the following sparse warnings:
drivers/gpu/drm/exynos/exynos_drm_fimd.c:65:25: warning:
symbol 'exynos4_fimd_driver_data' was not declared. Should it be static?
drivers/gpu/drm/exynos/exynos_drm_fimd.c:69:25: warning:
symbol 'exynos5_fimd_driver_data' was not declared. Should it be static?

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
12 years agodrm/exynos: fix overlay updating issue
Inki Dae [Wed, 14 Nov 2012 11:41:35 +0000 (20:41 +0900)]
drm/exynos: fix overlay updating issue

Chagelog v2:
Move encoder's dpms updating into exynos_drm_encoder_commit
function because when crtc's dpms is updated, encoder's dpms
is updated also. This would induce the issue that encoder
isn't disabled after crtc is disabled.

Changelog v1:
This patch fixes a issue that overlay data aren't applied
to real hardware when dpms off goes to on after setcrtc
was requested like below,
    dpms off -> setcrtc -> dpms off -> dpms on

For this, it makes encoder's dpms to be updated when
setcrtc is requested.

Signed-off-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
12 years agodrm/exynos: remove unnecessary code.
Inki Dae [Wed, 14 Nov 2012 08:28:36 +0000 (17:28 +0900)]
drm/exynos: remove unnecessary code.

plane->fb will be set to new fb after update_plane callback is called
by drm_mode_set_plane()

Signed-off-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
12 years agodrm/exynos: fix linux framebuffer address setting.
Inki Dae [Fri, 9 Nov 2012 07:41:29 +0000 (16:41 +0900)]
drm/exynos: fix linux framebuffer address setting.

With iommu, buffer->dma_addr has device addres so this patch
fixes for physical address to be set to fix.smem_start always.

Signed-off-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
12 years agoMerge branch 'for-airlied' of git://people.freedesktop.org/~danvet/drm-intel into...
Dave Airlie [Thu, 29 Nov 2012 10:23:56 +0000 (20:23 +1000)]
Merge branch 'for-airlied' of git://people.freedesktop.org/~danvet/drm-intel into drm-next

Daniel writes:
Besides the big item of lifting the "preliminary hw support" tag from the
 Haswell code, just small bits&pieces all over:
 - Leftover Haswell patches and some fixes from Paulo
 - LyncPoint PCH support (for hsw)
 - OOM handling improvements from Chris Wilson
 - connector property and send_vblank_event refactorings from Rob Clark
 - random pile of small fixes

 Note that the send_vblank refactorings will cause some locking WARNs to
 show up. Imre has fixed that up, but since all the driver changes outside
 of the drm core have been for exonys, those four patches are merged
 through the exonys-next tree.

Meh, I've forgotten to cherry-pick an important fix from Ben for a
regression in the 3.8 gen6+ gtt code. New pull request below. While I'm at
it, the hdmi VIC patch for the drm edid code is still in my queue, I'll
send you that in the next 3.8-fixes pull.

* 'for-airlied' of git://people.freedesktop.org/~danvet/drm-intel: (33 commits)
  drm/i915: Fix pte updates in ggtt clear range
  drm/i915: promote Haswell to full support
  drm/i915: Report the origin of the LVDS fixed panel mode
  drm/i915: LVDS fallback to fixed-mode if EDID not present
  drm/i915/sdvo: kfree the intel_sdvo_connector, not drm_connector, on destroy
  drm/i915: drm_connector_property -> drm_object_property
  drm/i915: use drm_send_vblank_event() helper
  drm/i915: Use pci_resource functions for BARs.
  drm/i915: Borrow our struct_mutex for the direct reclaim
  drm/i915: Defer assignment of obj->gtt_space until after all possible mallocs
  drm/i915: Apply the IBX transcoder A w/a for HDMI to SDVO as well
  drm/i915: implement WaMbcDriverBootEnable on Haswell
  drm/i915: fix intel_ddi_get_cdclk_freq for ULT machines
  drm/i915: make the panel fitter work on pipes B and C on Haswell
  drm/i915: make the panel fitter work on pipes B and C on IVB
  drm/i915: don't intel_crt_init if DDI A has 4 lanes
  drm/i915: make DP work on LPT-LP machines
  drm/i915: fix false positive "Unclaimed write" messages
  drm/i915: use cpu/pch transcoder on intel_enable_pipe
  drm/i915: don't limit Haswell CRT encoder to pipe A
  ...

12 years agodrm/i915: Fix pte updates in ggtt clear range
Ben Widawsky [Tue, 27 Nov 2012 05:52:54 +0000 (21:52 -0800)]
drm/i915: Fix pte updates in ggtt clear range

This bug was introduced by me:
commit e76e9aebcdbfebae8f4cd147e3c0f800d36e97f3
Author: Ben Widawsky <ben@bwidawsk.net>
Date:   Sun Nov 4 09:21:27 2012 -0800

    drm/i915: Stop using AGP layer for GEN6+

The existing code uses memset_io which follows memset semantics in only
guaranteeing a write of individual bytes. Since a PTE entry is 4 bytes,
this can only be correct if the scratch page address is 0.

This caused unsightly errors when we clear the range at load time,
though I'm not really sure what the heck is referencing that memory
anyway. I caught this is because I believe we have some other bug where
the display is doing reads of memory we feel should be cleared (or we
are relying on scratch pages to be a specific value).

Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
12 years agodrm: tegra: Add maintainers entry
Thierry Reding [Wed, 28 Nov 2012 19:45:28 +0000 (20:45 +0100)]
drm: tegra: Add maintainers entry

Add myself as the maintainer of the NVIDIA Tegra DRM driver.

Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Acked-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm/pci: add missing variable initialization
Jingoo Han [Thu, 29 Nov 2012 04:26:05 +0000 (13:26 +0900)]
drm/pci: add missing variable initialization

Fixed build warning as below:

drivers/gpu/drm/drm_pci.c: In function 'drm_pcie_get_speed_cap_mask':
drivers/gpu/drm/drm_pci.c:496:9: warning: 'lnkcap' may be used uninitialized in this function [-Wuninitialized]
drivers/gpu/drm/drm_pci.c:497:10: warning: 'lnkcap2' may be used uninitialized in this function [-Wuninitialized]

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
12 years agodrm/nouveau/device: Remove duplicate inclusion of core/device.h
Sachin Kamat [Tue, 20 Nov 2012 06:05:32 +0000 (11:35 +0530)]
drm/nouveau/device: Remove duplicate inclusion of core/device.h

core/device.h was included twice.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
12 years agodrm/nouveau: remove duplicate inclusion of nouveau_ttm.h
Sachin Kamat [Tue, 20 Nov 2012 05:53:50 +0000 (11:23 +0530)]
drm/nouveau: remove duplicate inclusion of nouveau_ttm.h

nouveau_ttm.h was included twice.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
12 years agodrm/nouveau/fifo: trigger engine context unload before zeroing context pointer
Ben Skeggs [Tue, 27 Nov 2012 01:05:36 +0000 (11:05 +1000)]
drm/nouveau/fifo: trigger engine context unload before zeroing context pointer

Fixes a PCE0 page fault noticed on NVD9 during module unload.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
12 years agodrm/nouveau: prevent log mangling
Daniel J Blueman [Sat, 24 Nov 2012 02:11:46 +0000 (10:11 +0800)]
drm/nouveau: prevent log mangling

On 3.7-rc6, add missing newline to to prevent the following kernel log
line getting appended to the current one after switching the integrated
GPU and suspending the discrete GPU.

Signed-off-by: Daniel J Blueman <daniel@quora.org>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
12 years agodrm/nouveau: unpin various bo's before destroying
Marcin Slusarz [Sun, 25 Nov 2012 22:04:23 +0000 (23:04 +0100)]
drm/nouveau: unpin various bo's before destroying

These objects leak VRAM - but only on module unload.

Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
12 years agodrm/nouveau: unpin pushbuffer bo before destroying it
Marcin Slusarz [Sun, 25 Nov 2012 22:02:28 +0000 (23:02 +0100)]
drm/nouveau: unpin pushbuffer bo before destroying it

Fixes GART leak (as accounted by nouveau_drm.gem.gart_available).

Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
12 years agodrm/nouveau: remove misleading comment from nouveau_prime_new
Marcin Slusarz [Sun, 25 Nov 2012 22:01:28 +0000 (23:01 +0100)]
drm/nouveau: remove misleading comment from nouveau_prime_new

Copy/pasted from nouveau_gem_new.

Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
12 years agodrm/nouveau: raise reporting levels of some messages
Marcin Slusarz [Sun, 25 Nov 2012 22:00:57 +0000 (23:00 +0100)]
drm/nouveau: raise reporting levels of some messages

Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
12 years agodrm/nouveau/core: fix the assumption that NVDEV_XXXX is always under 32
Martin Peres [Mon, 26 Nov 2012 23:30:32 +0000 (00:30 +0100)]
drm/nouveau/core: fix the assumption that NVDEV_XXXX is always under 32

It fixes a bug that would have been introduced when adding more
sudevs/engines.

Signed-off-by: Martin Peres <martin.peres@labri.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
12 years agodrm/nouveau/ppp: remove nouveau_ppp base class
Ben Skeggs [Fri, 23 Nov 2012 01:20:11 +0000 (11:20 +1000)]
drm/nouveau/ppp: remove nouveau_ppp base class

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
12 years agonve0/ppp: enable support via nvc0's implementation
Ben Skeggs [Fri, 23 Nov 2012 01:14:49 +0000 (11:14 +1000)]
nve0/ppp: enable support via nvc0's implementation

NVIDIA also appear to use the same class on Fermi/Kepler for PPP.

Will allow use of the engine if firmware (nvXX_fuc086) provided.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>