Commit Graph

233005 Commits

Author SHA1 Message Date
Ben Skeggs d7117e0d4e drm/nv50: enable page flipping
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-02-25 06:45:17 +10:00
Ben Skeggs 1d3fac0c2a drm/nv50-nvc0: activate/update ds channel's framebuffer on modesets
The hw doesn't really appear to be designed to be used the way we have to
use it due to DRI2's design.  This leads us to having to keep the flipped
fb support active at all times.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-02-25 06:45:14 +10:00
Ben Skeggs cdccc70eff drm/nv50-nvc0: initialise display sync channels
Also imports a couple of helper functions that'll be used to implement
page flipping in the following commits..

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-02-25 06:45:11 +10:00
Ben Skeggs 45c4e0aae9 drm/nv50-nvc0: precalculate some fb state when creating them
Just a cleanup, to avoid duplicating parts of nv50_crtc.c's code in
the page flipping routines.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-02-25 06:45:08 +10:00
Ben Skeggs 292deb7a3b drm/nv50-nvc0: tidy evo object creation some more
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-02-25 06:45:05 +10:00
Ben Skeggs 60f60bf1bc drm/nv50-nvc0: request and wait on notification of modeset completion
This should prevent a number of races from occuring, the most obvious of
which will be exposed when we start making use of the "display sync" evo
channel for page flipping.  The DS channel will reject any command stream
that doesn't completely agree with the current "master" state.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-02-25 06:45:02 +10:00
Ben Skeggs f13e435c59 drm/nv50-nvc0: switch to tasklet for display isr bh
We need to be able to have the bh run while possibly spinning waiting for
the EVO notifier to signal.  This apparently happens in some circumstances
with preempt disabled, so our workqueue was never being run.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-02-25 06:44:59 +10:00
Ben Skeggs c7ca4d1b6b drm/nouveau: make vbios parser runnable from an atomic context
The nv50 display isr bh needs to be converted to a tasklet, which means
we can't sleep anymore.  The places we execute vbios init tables are
rare, and not in any way performance critical, so this isn't a huge
problem.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-02-25 06:44:56 +10:00
Ben Skeggs 8348f36d89 drm/nv50-nvc0: include nv50_display in evo debugging
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-02-25 06:44:53 +10:00
Ben Skeggs 33f409df1e drm/nv50-nvc0: tidy evo init failure paths
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-02-25 06:44:51 +10:00
Ben Skeggs 961b6e686e drm/nv50-nvc0: fix ramht entries for multiple evo channels
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-02-25 06:44:48 +10:00
Ben Skeggs 30d81817a2 drm/nv50-nvc0: disp channels have fixed purposes, don't "allocate" them
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-02-25 06:44:45 +10:00
Ben Skeggs 59c0f5780f drm/nv50-nvc0: rename disp->evo to disp->master
More appropriate, and we're about to be using more than just the master
EVO channel.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-02-25 06:44:42 +10:00
Ben Skeggs ef8389a84b drm/nv50-nvc0: move non-sharable display state into private structure
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-02-25 06:44:39 +10:00
Tejun Heo d82f8e6c80 drm/nouveau: use system_wq instead of dev_priv->wq
With cmwq, there's no reason for nouveau to use a dedicated workqueue.
Drop dev_priv->wq and use system_wq instead.  Each work item is sync
flushed when the containing structure is unregistered/destroyed.

Note that this change also makes sure that nv50_gpio_handler is not
freed while the contained work item is still running.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: David Airlie <airlied@linux.ie>
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-02-25 06:44:36 +10:00
Lucas Stach f17811dfa7 drm/nouveau: use I2C_MODULE_PREFIX kernel define
Signed-off-by: Lucas Stach <dev@lynxeye.de>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-02-25 06:44:33 +10:00
Ben Skeggs ec23802d61 drm/nv50: drop explicit yields in favour of smaller PFIFO timeslice
This gives a small, but noticeable performance gain at lower performance
levels, and unchanged at the higher ones.

With this commit, we're now using the same timeslice size as the NVIDIA
binary driver currently does, and dropping an unknown bit that NVIDIA
no longer appear to set.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-02-25 06:44:30 +10:00
Ben Skeggs e3b7ed5e99 drm/nv84: use vm offsets for semaphores
We may well be making more use of semaphores in the future, having the
entire VM available makes requiring DMA objects for each and every
semaphore block unnecessary.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-02-25 06:44:27 +10:00
Ben Skeggs fc772ec48d drm/nv50: 0x50 needs semaphore yields too
Evil, evil chipset.  Worst of both worlds.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-02-25 06:44:25 +10:00
Ben Skeggs ea5f2786a0 drm/nouveau: silence some compiler warnings
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-02-25 06:44:22 +10:00
Ben Skeggs cb1d771aa0 drm/nvc0: implement semaphores for inter-channel sync
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-02-25 06:44:19 +10:00
Ben Skeggs cc8cd6479c drm/nvc0/pfifo: semi-handle a couple more irqs
And also, don't disable PFIFO IRQs completely whenever we recieve one,
just when we don't know about it already.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-02-25 06:44:16 +10:00
Ben Skeggs c3b90a7d4c drm/nv84: switch to new-style semaphores
These are the same semaphores nvc0 will use, and they potentially allow
us to do much cooler things than our current inter-channel sync impl.

Lets switch to them where possible now for some testing.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-02-25 06:44:13 +10:00
Ben Skeggs e0435120a8 drm/nv40: support for 39-bit dma addresses on native PCIE chipsets
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-02-25 06:44:10 +10:00
Ben Skeggs 7948758d27 drm/nv40: implement support for on-chip PCIEGART
v2. moved nv44 pciegart table back to instmem, where it's not
    accessible by userspace clients.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-02-25 06:44:04 +10:00
Ben Skeggs 58e6c7a918 drm/nouveau: introduce new gart type, and name _SGDMA more appropriately
In preparation for the addition of a new nv40 backend, we'll need to be
able to distinguish between a paged dma object and the on-chip GART.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-02-25 06:30:15 +10:00
Ben Skeggs efa58db3de drm/nouveau: move + rename some stuff in nouveau_sgdma.c
In preparation for the addition of a new nv40 pcie backend.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2011-02-25 06:30:05 +10:00
Ben Skeggs e11d57ca0b Merge remote-tracking branch 'airlied/drm-core-next' into drm-nouveau-next 2011-02-25 06:17:07 +10:00
Dave Airlie a2c06ee2fe Revert "ttm: Include the 'struct dev' when using the DMA API."
This reverts commit 5a893fc28f.

This causes a use after free in the ttm free alloc pages path,
when it tries to get the be after the be has been destroyed.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-02-23 14:24:01 +10:00
Dave Airlie 63871f89d1 Merge branch 'drm-mm-cleanup' into drm-next
* drm-mm-cleanup:
  radeon: move blit functions to radeon_asic.h
  radeon: kill decls for inline functions
  radeon: consolidate asic-specific function decls for r600 & later
  drm/radeon: kill radeon_bo->gobj pointer
  drm/radeon: introduce gem_to_radeon_bo helper
  drm/radeon: embed struct drm_gem_object
  drm: mm: add helper to unwind scan state
  drm: mm: add api for embedding struct drm_mm_node
  drm: mm: extract node insert helper functions
  drm: mm: track free areas implicitly
  drm/nouveau: don't munge in drm_mm internals
2011-02-23 12:07:27 +10:00
Dave Airlie de1e7cd63a Merge branch 'stable/ttm.pci-api.v5' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen into drm-next
* 'stable/ttm.pci-api.v5' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen:
  ttm: Include the 'struct dev' when using the DMA API.
  nouveau/ttm/PCIe: Use dma_addr if TTM has set it.
  radeon/ttm/PCIe: Use dma_addr if TTM has set it.
  ttm: Expand (*populate) to support an array of DMA addresses.
  ttm: Utilize the DMA API for pages that have TTM_PAGE_FLAG_DMA32 set.
  ttm: Introduce a placeholder for DMA (bus) addresses.
2011-02-23 12:06:39 +10:00
Chris Wilson 7811bddb66 drm: Remove unused members from struct drm_open_hash
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-02-23 11:16:40 +10:00
Chris Wilson 4cb81ac202 drm: Trim the GEM mmap offset hashtab
Using an order 19 drm_ht for the mmap offsets is a little obscene. That
means that will a fully populated GTT with every single object mmaped at
least once in its lifetime, there will be exactly one object in each
bucket.

Typically systems only have at most a few thousand objects, though you
may see a KDE desktop hit 50000. And most of those should never be
mapped... On my systems, just using an order 10 ht would still have an
average occupancy less than 1, so apply a small safety factor and
use an order 12 ht, like the other mmap offset ht.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-02-23 11:15:39 +10:00
Chris Wilson b1f559ecdc drm: Mark constant arrays of drm_display_mode const
... and fixup some methods to accept the constant argument.

Now that constant module arrays are loaded into read-only memory, using
const appropriately has some benefits beyond warning the programmer
about likely mistakes.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-02-23 11:13:11 +10:00
Dave Airlie 60b212f8dd drm/radeon: overhaul texture checking. (v3)
the texture checking code didn't work for block formats like s3tc,
this overhauls it to work for all types.

v2: add texture array support.
v3: add subsampled formats

Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-02-23 11:10:22 +10:00
Ben Skeggs 82ef594efb drm/ttm: call driver move_notify() when doing system->tt bo moves
Nouveau doesn't have enough information at ttm_backend_func.bind() time
to implement things like tiled GART, or to keep a buffer at a constant
address in the GPU virtual address space no matter where in physical
memory it's placed.

To resolve this, nouveau will handle binding of all buffers to the GPU
itself from the move_notify() hook.  This commit ensures it's called
for all buffer moves.

Talked to Dave about the impact on radeon, which uses move_notify, it
doesn't look like anything should break there.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Thomas Hellstrom <thomas@shipmail.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-02-23 11:09:24 +10:00
Rob Clark 9da12b6aeb drm: psuedocolor support for ARGB modes
If there is an alpha channel, need to mask in 1's in the alpha channel
to prevent the fb from being completely transparent.

Signed-off-by: Rob Clark <rob@ti.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-02-23 11:09:13 +10:00
Daniel Vetter 4546b2c1d6 radeon: move blit functions to radeon_asic.h
Reviewed-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-02-23 10:35:23 +10:00
Daniel Vetter 053688ce03 radeon: kill decls for inline functions
Reviewed-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-02-23 10:35:22 +10:00
Daniel Vetter 3574dda485 radeon: consolidate asic-specific function decls for r600 & later
Now all the asic specific stuff ist mostly hid in radeon_asic.*

Reviewed-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-02-23 10:35:20 +10:00
Daniel Vetter 31c3603d83 drm/radeon: kill radeon_bo->gobj pointer
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-02-23 10:35:17 +10:00
Daniel Vetter 7e4d15d90a drm/radeon: introduce gem_to_radeon_bo helper
... and switch it to container_of upcasting.

v2: converted new pageflip code-paths.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-02-23 10:34:47 +10:00
Daniel Vetter 441921d530 drm/radeon: embed struct drm_gem_object
Unconditionally initialize the drm gem object - it's not
worth the trouble not to for the few kernel objects.

This patch only changes the place of the drm gem object,
access is still done via pointers.

v2: Uncoditionally align the size in radeon_bo_create. At
least the r600/evergreen blit code didn't to this, angering
the paranoid gem code.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-02-23 10:33:03 +10:00
Daniel Vetter ae0cec2880 drm: mm: add helper to unwind scan state
With the switch to implicit free space accounting one pointer
got unused when scanning. Use it to create a single-linked list
to ensure correct unwinding of the scan state.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-02-23 10:32:57 +10:00
Daniel Vetter b0b7af1884 drm: mm: add api for embedding struct drm_mm_node
The old api has a two-step process: First search for a suitable
free hole, then allocate from that specific hole. No user used
this to do anything clever. So drop it for the embeddable variant
of the drm_mm api (the old one retains this ability, for the time
being).

With struct drm_mm_node embedded, we cannot track allocations
anymore by checking for a NULL pointer. So keep track of this
and add a small helper drm_mm_node_allocated.

Also add a function to move allocations between different struct
drm_mm_node.

v2: Implement suggestions by Chris Wilson.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-02-23 10:32:51 +10:00
Daniel Vetter 9fc935debb drm: mm: extract node insert helper functions
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-02-23 10:32:43 +10:00
Daniel Vetter ea7b1dd448 drm: mm: track free areas implicitly
The idea is to track free holes implicitly by marking the allocation
immediatly preceeding a hole.

To avoid an ugly corner case add a dummy head_node to struct drm_mm
to track the hole that spans to complete allocation area when the
memory manager is empty.

To guarantee that there's always a preceeding/following node (that might
be marked as hole_follows == 1), move the mm->node_list list_head to the
head_node.

The main allocator and fair-lru scan code actually becomes simpler.
Only the debug code slightly suffers because free areas are no longer
explicit.

Also add drm_mm_for_each_node (which will be much more useful when
struct drm_mm_node is embeddable).

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-02-23 10:32:34 +10:00
Daniel Vetter 31a5b8ce8f drm/nouveau: don't munge in drm_mm internals
Nouveau was checking drm_mm internals on teardown to see whether the
memory manager was initialized. Hide these internals in a small
inline helper function.

Acked-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-02-23 10:18:20 +10:00
Konrad Rzeszutek Wilk 5a893fc28f ttm: Include the 'struct dev' when using the DMA API.
This makes the accounting when using 'debug_dma_dump_mappings()'
and CONFIG_DMA_API_DEBUG=y be assigned to the correct device
instead of 'fallback'.

No functional change - just cosmetic.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
2011-02-22 13:26:23 -05:00
Konrad Rzeszutek Wilk e0138c26cd nouveau/ttm/PCIe: Use dma_addr if TTM has set it.
If the TTM layer has used the DMA API to setup pages that are
TTM_PAGE_FLAG_DMA32 (look at patch titled: "ttm: Utilize the
DMA API for pages that have TTM_PAGE_FLAG_DMA32 set"), lets
use it when programming the GART in the PCIe type cards.

This patch skips doing the pci_map_page (and pci_unmap_page) if
there is a DMA addresses passed in for that page. If the dma_address
is zero (or DMA_ERROR_CODE), then we continue on with our old
behaviour.

[v2: Added a review-by tag]

Reviewed-by: Thomas Hellstrom <thomas@shipmail.org>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Tested-by: Ian Campbell <ian.campbell@citrix.com>
2011-02-18 17:27:49 -05:00