1
0
Fork 0
Commit Graph

202 Commits (1888577807ea4e7593d27582b02c5b4126a9a642)

Author SHA1 Message Date
Ben Skeggs 4dc28134a8 drm/nouveau: rename nouveau_drm.h to nouveau_drv.h
Fixes out-of-tree build issue where uapi/drm/nouveau_drm.h gets picked
up instead.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2016-05-20 14:43:04 +10:00
Christian König 98c2872ae9 drm/ttm: implement LRU add callbacks v2
This allows fine grained control for the driver where to add a BO into the LRU.

v2: fix typo in comment

Reviewed-by: Sinclair Yeh <syeh@vmware.com>
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2016-05-04 20:21:38 -04:00
Christian König 8aa6d4fc5f drm/ttm: remove lazy parameter from ttm_bo_wait
Not used any more.

Reviewed-by: Sinclair Yeh <syeh@vmware.com>
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2016-05-04 20:21:26 -04:00
Christian König dfd5e50ea4 drm/ttm: remove use_ticket parameter from ttm_bo_reserve
Not used any more.

Reviewed-by: Sinclair Yeh <syeh@vmware.com>
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2016-05-04 20:21:21 -04:00
Alexandre Courbot 9bcd38de5b drm/nouveau/bo: consider DMA buffers on x86 only
The DMA API has different semantics on different architectures.
Currently on arm64, it can only provide memory from a small pool which
dries up quickly if we attempt to allocate big buffers from it.

Do not consider that option when running on non-x86, since regular TTM
buffers are the (current) best-fit for ARM platforms.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2016-03-14 10:13:32 +10:00
Rasmus Villemoes 4fbbed46dc drm/nouveau: use post-decrement in error handling
We need to use post-decrement to get the dma_map_page undone also for
i==0, and to avoid some very unpleasant behaviour if dma_map_page
failed already at i==0.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Reviewed-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2016-02-19 13:36:05 +10:00
Daniel Vetter a7fb8a23c1 drm: Remove __OS_HAS_AGP
We already express the drm/agp depencies correctly in Kconfig, so we
can rip this remnant from the shared drm core days.

Aside: Pretty much all the #ifdefs in radeon/nouveau could be killed
if ttm would provide dummy functions. I'm not going to volunteer for
that though.

v2: Use IS_ENABLED(CONFIG_AGP) as suggested by Ville

v3: Polish from Ville's review.

Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Christian König <christian.koenig@amd.com> (v2)
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2015-09-30 10:44:48 +02:00
Ben Skeggs 340b0e7c50 drm/nouveau/pci: merge agp handling from nouveau drm
This commit reinstates the pre-DEVINIT AGP fiddling that was broken in
an earlier commit.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2015-08-28 12:40:49 +10:00
Ben Skeggs 26c9e8effe drm/nouveau/device: remove pci/platform_device from common struct
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2015-08-28 12:40:49 +10:00
Ben Skeggs 7e8820fed7 drm/nouveau/device: cleaner abstraction for device resource functions
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2015-08-28 12:40:48 +10:00
Ben Skeggs c85ee6ca79 drm/nouveau/gr: convert to new-style nvkm_engine
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2015-08-28 12:40:47 +10:00
Ben Skeggs 03c8952fb3 drm/nouveau/fb: convert to new-style nvkm_subdev
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2015-08-28 12:40:43 +10:00
Ben Skeggs 3293228174 drm/nouveau/bar: convert to new-style nvkm_subdev
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2015-08-28 12:40:42 +10:00
Ben Skeggs d8e83994aa drm/nouveau/imem: improve management of instance memory
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2015-08-28 12:40:36 +10:00
Ben Skeggs 315a8b2edf drm/nouveau/nvif: use negative oclass identifier for internal classes
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2015-08-28 12:40:32 +10:00
Ben Skeggs a01ca78c8f drm/nouveau/nvif: simplify and tidy library interfaces
A variety of tweaks to the NVIF library interfaces, mostly ripping out
things that turned out to be not so useful.

- Removed refcounting from nvif_object, callers are expected to not be
  stupid instead.
- nvif_client is directly reachable from anything derived from nvif_object,
  removing the need for heuristics to locate it
- _new() versions of interfaces, that allocate memory for the object
  they construct, have been removed.  The vast majority of callers used
  the embedded _init() interfaces.
- No longer storing constructor arguments (and the data returned from
  nvkm) inside nvif_object, it's more or less unused and just wastes
  memory.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2015-08-28 12:40:32 +10:00
Ben Skeggs b1e4553cb1 drm/nouveau/fb: cosmetic changes
This is purely preparation for upcoming commits, there should be no
code changes here.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2015-08-28 12:40:08 +10:00
Ben Skeggs 990b454704 drm/nouveau: support for buffer moves via MaxwellDmaCopyA
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2015-04-14 17:00:57 +10:00
Ben Skeggs be83cd4ef9 drm/nouveau: finalise nvkm namespace switch (no binary change)
The namespace of NVKM is being changed to nvkm_ instead of nouveau_,
which will be used for the DRM part of the driver.  This is being
done in order to make it very clear as to what part of the driver a
given symbol belongs to, and as a minor step towards splitting the
DRM driver out to be able to stand on its own (for virt).

Because there's already a large amount of churn here anyway, this is
as good a time as any to also switch to NVIDIA's device and chipset
naming to ease collaboration with them.

A comparison of objdump disassemblies proves no code changes.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2015-01-22 12:18:07 +10:00
Ben Skeggs 989aa5b76a drm/nouveau/nvif: namespace of nvkm accessors (no binary change)
NVKM is having it's namespace switched to nvkm_, which will conflict
with these functions (which are workarounds for the fact that as of
yet, we still aren't able to split DRM and NVKM completely).

A comparison of objdump disassemblies proves no code changes.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2015-01-22 12:17:49 +10:00
Ben Skeggs 5ce3bf3c72 drm/nouveau/mmu: rename from vmmgr (no binary change)
Switch to NVIDIA's name for the device.

The namespace of NVKM is being changed to nvkm_ instead of nouveau_,
which will be used for the DRM part of the driver.  This is being
done in order to make it very clear as to what part of the driver a
given symbol belongs to, and as a minor step towards splitting the
DRM driver out to be able to stand on its own (for virt).

Because there's already a large amount of churn here anyway, this is
as good a time as any to also switch to NVIDIA's device and chipset
naming to ease collaboration with them.

A comparison of objdump disassemblies proves no code changes.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2015-01-22 12:17:43 +10:00
Rickard Strandqvist 26b40d81d7 drm/nouveau/bo: Remove unused function
Remove the function nouveau_bo_rd16() that is not used anywhere.

This was partially found by using a static code analysis program
called cppcheck.

Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2015-01-22 12:15:06 +10:00
Alexandre Courbot dcccdc143f drm/nouveau: fix missing return statement in nouveau_ttm_tt_unpopulate
nouveau_ttm_tt_unpopulate() is supposed to return right after calling
ttm_dma_unpopulate() in the case of a coherent buffer. The return
statement was omitted, leading to the pages being unmapped twice. Fix
this.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-12-22 08:37:37 +10:00
Ben Skeggs ad76b3f7c7 drm/nouveau: teach nouveau_bo_pin() how to force a contig vram allocation
We have the ability to move buffers around in the kernel if necessary,
and should probably use it rather than failing if userspace passes us
a non-contig buffer for a plane.

The NOUVEAU_GEM_TILE_NONCONTIG flag from userspace will become a mere
initial placement hint once all the relevant paths have been updated.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-12-02 15:44:09 +10:00
Ben Skeggs 50ab2e5206 drm/nouveau: we need pin_refcnt for nouveau_bo_placement_set()
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-12-02 15:44:02 +10:00
Ben Skeggs 6aac6ced4e drm/nouveau: fix pin refcnt leak in failure path
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-12-02 15:44:00 +10:00
Alexandre Courbot b22870ba6a drm/nouveau: synchronize BOs when required
On architectures for which access to GPU memory is non-coherent,
caches need to be flushed and invalidated explicitly when BO control
changes between CPU and GPU.

This patch adds buffer synchronization functions which invokes the
correct API (PCI or DMA) to ensure synchronization is effective.

Based on the TTM DMA cache helper patches by Lucas Stach.

Signed-off-by: Lucas Stach <dev@lynxeye.de>
Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-12-02 15:44:00 +10:00
Alexandre Courbot c3a0c771e5 drm/nouveau: implement explicitly coherent BOs
Allow nouveau_bo_new() to recognize the TTM_PL_FLAG_UNCACHED flag, which
means that we want the allocated BO to be perfectly coherent between the
CPU and GPU. This is useful on non-coherent architectures for which we
do not want to manually sync some rarely-accessed buffers: typically,
fences and pushbuffers.

A TTM BO allocated with the TTM_PL_FLAG_UNCACHED on a non-coherent
architecture will be populated using the DMA API, and accesses to it
performed using the coherent mapping performed by dma_alloc_coherent().

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-12-02 15:43:59 +10:00
Alexandre Courbot 5be5a15a43 drm/nouveau: warn when moving a pinned object
Pinned BOs are supposed to remain in their current location until
unpinned. Display a warning for the supposedly-erroneous case where we
are trying to move such objects.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-12-02 15:43:58 +10:00
Maarten Lankhorst bb6178b04f drm/nouveau: export reservation_object from dmabuf to ttm
Adds an extra argument to nouveau_bo_new, which is only used in nouveau_prime.c.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
2014-10-01 11:11:15 +02:00
Maarten Lankhorst f4f4e3e3e9 drm/ttm: add reservation_object as argument to ttm_bo_init
This allows importing reservation objects from dma-bufs.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
2014-09-30 14:04:00 +02:00
Maarten Lankhorst e3be4c230d drm/nouveau: specify if interruptible wait is desired in nouveau_fence_sync
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
2014-09-30 14:04:00 +02:00
Maarten Lankhorst 809e9447b9 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>
2014-09-02 17:28:48 +02:00
Maarten Lankhorst f2c24b83ae drm/ttm: flip the switch, and convert to dma_fence
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
2014-09-02 16:41:50 +02:00
Maarten Lankhorst 29ba89b237 drm/nouveau: rework to new fence interface
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Acked-by: Ben Skeggs <bskeggs@redhat.com>
2014-09-02 16:41:50 +02:00
Maarten Lankhorst dd7cfd6412 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>
2014-09-01 10:16:43 +02:00
Maarten Lankhorst bdaf7ddf65 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>
2014-09-01 10:16:43 +02:00
Christian König f1217ed09f drm/ttm: move fpfn and lpfn into each placement v2
This allows us to more fine grained specify where to place the buffer object.

v2: rebased on drm-next, add bochs changes as well

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2014-08-27 13:16:04 +02:00
Ben Skeggs 5c13cac149 drm/nouveau: kill unused variable warning if !__OS_HAS_AGP
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-08-15 07:58:38 +10:00
Ben Skeggs f392ec4b1d drm/nouveau: use ram info from nvif_device
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-08-10 05:28:12 +10:00
Ben Skeggs fdb751ef2b drm/nouveau: remove as much direct use of core headers as possible
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-08-10 05:13:16 +10:00
Ben Skeggs f45f55c4bb drm/nouveau: remove (most) hardcoded object handle usage
The PFIFO<->EVO sync buffers will be fixed up later when inter-channel
sync in general is improved.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-08-10 05:13:15 +10:00
Ben Skeggs 0ad72863ea drm/nouveau: port to nvif client/device/objects
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-08-10 05:13:14 +10:00
Ben Skeggs 967e7bde87 drm/nouveau: initial pass at moving to struct nvif_device
This is an attempt at isolating some of the changes necessary to port
to NVIF in a separate commit.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-08-10 05:13:13 +10:00
Ben Skeggs db2bec187d drm/nouveau: kill nouveau_dev() + wrap register macros
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-08-10 05:13:11 +10:00
Ben Skeggs fa2bade99a drm/nouveau: fix some usages of the wrong print function
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-08-10 05:13:10 +10:00
Ben Skeggs 3ee6f5b503 drm/nouveau: store a pointer to vm in nouveau_cli
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-08-10 05:12:59 +10:00
Alexandre Courbot fd1496a0fc drm/nouveau: map pages using DMA API
The DMA API is the recommended way to map pages no matter what the
underlying bus is. Use the DMA functions for page mapping and remove
currently existing wrappers.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2014-08-10 05:11:11 +10:00
Alexandre Courbot e2a4e78cdc drm/nouveau/bar: add noncached ioremap property
Some BARs (like GK20A's) do not support being ioremapped write-combined.
Add a boolean property to the BAR structure and handle that case in the
Nouveau BO implementation.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
2014-08-10 05:11:10 +10:00
Thierry Reding ee3939e079 drm/ttm: Fix a few sparse warnings
The final parameter to ttm_bo_reserve() is a pointer, therefore callers
should use NULL instead of 0.

Fixes a bunch of sparse warnings of this type:

	warning: Using plain integer as NULL pointer

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2014-07-22 10:58:21 +10:00