Commit Graph

84 Commits

Author SHA1 Message Date
Marek Olšák 9807556e86 r600g,radeonsi: use fences provided by the winsys 2013-10-25 11:55:55 +02:00
Marek Olšák e64633e8c3 r600g,radeonsi: share r600_texture.c
The function r600_choose_tiling is new and needs a review.

The only change in functionality is that it enables 2D tiling for compressed
textures on SI. It was probably accidentally turned off.

v2: don't make scanout buffers linear
2013-09-29 15:18:10 +02:00
Marek Olšák 1bb77f81db r600g,radeonsi: consolidate tiling_info initialization
and the util_format_s3tc_init calls too.
2013-09-29 15:18:09 +02:00
Marek Olšák e916267285 radeonsi: move radeonsi-specific functions out of r600_texture.c 2013-09-29 15:18:08 +02:00
Marek Olšák 31169400a0 r600g,radeonsi: remove unused code 2013-09-29 15:18:08 +02:00
Marek Olšák 2993ccab38 radeonsi: bind streamout buffers to VGT and the vertex shader
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2013-09-13 01:04:44 +02:00
Marek Olšák 9eb3b9dc2b radeonsi: initialize the first CS like any other
So that the "init" state is always emitted first and not later in draw_vbo.

This fixes streamout where the "init" state, which disables streamout,
was emitted in draw_vbo after streamout was enabled.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2013-09-13 01:04:44 +02:00
Marek Olšák 2b0a54d6ec radeonsi: integrate shared streamout state
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2013-09-13 01:04:44 +02:00
Marek Olšák a77ee8b548 radeonsi: simplify and improve flushing
This mimics r600g. The R600_CONTEXT_xxx flags are added to rctx->b.flags
and si_emit_cache_flush emits the packets. That's it. The shared radeon code
tells us when the streamout cache should be flushed, so we have to check
the flags anyway.

There is a new atom "cache_flush", because caches must be flushed *after*
resource descriptors are changed in memory.

Functional changes:

* Write caches are flushed at the end of CS and read caches are flushed
  at its beginning.

* Sampler view states are removed from si_state, they only held the flush
  flags.

* Everytime a shader is changed, the I cache is flushed. Is this needed?
  Due to a hw bug, this also flushes the K cache.

* The WRITE_DATA packet is changed to use TC, which fixes a rendering issue
  in openarena. I'm not sure how TC interacts with CP DMA, but for now it
  seems to work better than any other solution I tried. (BTW CIK allows us
  to use TC for CP DMA.)

* Flush the K cache instead of the texture cache when updating resource
  descriptors (due to a hw bug, this also flushes the I cache).
  I think the K cache flush is correct here, but I'm not sure if the texture
  cache should be flushed too (probably not considering we use TC
  for WRITE_DATA, but we don't use TC for CP DMA).

* The number of resource contexts is decreased to 16. With all of these cache
  changes, 4 doesn't work, but 8 works, which suggests I'm actually doing
  the right thing here and the pipeline isn't drained during flushes.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Tested-by: Tom Stellard <thomas.stellard@amd.com>
2013-08-31 01:34:30 +02:00
Marek Olšák aa5c40f97c radeonsi: convert constant buffers to si_descriptors
There is a new "class" si_buffer_resources, which should be good enough for
implementing any kind of buffer bindings (constant buffers, vertex buffers,
streamout buffers, shader storage buffers, etc.)

I don't even keep a copy of pipe_constant_buffer - we don't need it.

The main motivation behind this is to have a well-tested infrastrusture
for setting up streamout buffers.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Tested-by: Tom Stellard <thomas.stellard@amd.com>
2013-08-31 01:34:30 +02:00
Marek Olšák a81c3e00fe radeonsi: use r600_common_context, r600_common_screen, r600_resource
Also r600_hw_context_priv.h and si_state_streamout.c are removed, because
they are no longer needed.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Tested-by: Tom Stellard <thomas.stellard@amd.com>
2013-08-31 01:34:30 +02:00
Marek Olšák d698f19cba r600g,radeonsi: remove unused variables
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Tested-by: Tom Stellard <thomas.stellard@amd.com>
2013-08-31 01:34:29 +02:00
Niels Ole Salscheider 217d2f7359 radeonsi: Do not suspend timer queries
Signed-off-by: Niels Ole Salscheider <niels_ole@salscheider-online.de>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
2013-08-30 23:30:00 +02:00
Christian König f2f7064e56 vl: rename pipe_video_decoder to pipe_video_codec
Signed-off-by: Christian König <christian.koenig@amd.com>
2013-08-19 10:21:15 +02:00
Christian König 53e20b8b41 vl: use a template for create_video_decoder
Signed-off-by: Christian König <christian.koenig@amd.com>
2013-08-19 10:21:14 +02:00
Marek Olšák 356c041167 radeonsi: port texture improvements from r600g
This started as an attempt to add support for MSAA texture transfers and
MSAA depth-stencil decompression for the DB->CB copy path.
It has gotten a bit out of control, but it's for the greater good.

Some changes do not make much sense, they are there just to make it look
like the other driver.

With a few cosmetic modifications, r600_texture.c can be shared with
a symlink.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2013-08-17 01:48:25 +02:00
Marek Olšák f671dfa8aa radeonsi: add FMASK texture binding slots and resource setup (v2)
v2: bind FMASK textures to shader resource slots 16..31

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2013-08-17 01:48:25 +02:00
Marek Olšák 3c3feb38f4 radeonsi: implement FMASK decompression for MSAA texturing
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2013-08-17 01:48:25 +02:00
Marek Olšák 2a4b2e2305 radeonsi: implement MSAA colorbuffer compression for rendering
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2013-08-17 01:48:25 +02:00
Marek Olšák 6d4755a4d7 radeonsi: implement GL_SAMPLE_ALPHA_TO_ONE
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2013-08-17 01:48:25 +02:00
Marek Olšák 07955d4f2b radeonsi: implement uncompressed MSAA rendering and color resolving
This is basic MSAA support which should work with most apps.
Some features are missing, those will be implemented by other commits.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2013-08-17 01:48:25 +02:00
Marek Olšák c8e70e64ac radeonsi: add flexible shader descriptor management and use it for sampler views
It moves all sampler view descriptors to a buffer.
It supports partial resource updates and it can also unbind resources
(required for FMASK texturing).

The buffer contains all sampler view descriptors for one shader stage,
represented as an array. On top of that, there are N arrays in the buffer,
which are used to emulate context registers as implemented by the previous
ASICs (each array is a context).

This uses the RCU synchronization approach to avoid read-after-write hazards
as discussed in the thread:
"radeonsi: add FMASK texture binding slots and resource setup"

CP DMA is used to clear the descriptors at context initialization and to copy
the descriptors from one context to the next.

v2: - use PKT3_DMA_DATA on CIK (I'll test CIK later)
    - turn the bool CP DMA parameters into self-explanatory flags
    - add a nice simple API for packet emission to radeon_winsys.h
    - use 256 contexts, 128 causes texture corruption in openarena
2013-08-17 01:48:25 +02:00
Marek Olšák 363b2805f7 radeonsi: rename r600_resource_texture to r600_texture
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2013-08-15 02:03:02 +02:00
Roland Scheidegger 793e8e3d7e gallium: add condition parameter to render_condition
For conditional rendering this makes it possible to skip rendering
if either the predicate is true or false, as supported by d3d10
(in fact previously it was sort of implied skip rendering if predicate
is false for occlusion predicate, and true for so_overflow predicate).
There's no cap bit for this as presumably all drivers could do it trivially
(but this patch does not implement it for the drivers using true
hw predicates, nvxx, r600, radeonsi, no change is expected for OpenGL
functionality).

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2013-06-18 18:01:24 +02:00
Michel Dänzer 784df2e115 radeonsi: Make border colour state handling safe for integer textures 2013-05-28 09:55:46 +02:00
Michel Dänzer e3befbca5e radeonsi: Handle TGSI_SEMANTIC_CLIPVERTEX
17 more little piglits.

NOTE: This is a candidate for the 9.1 branch.
2013-05-21 17:50:13 +02:00
Michel Dänzer eb19163a4d radeonsi: Initial support for multiple constant buffers
Just enough to support an additional internal constant buffer for the user
clip planes.

NOTE: This is a candidate for the 9.1 branch.
2013-05-21 17:50:12 +02:00
Michel Dänzer 4730dea5f5 radeonsi: Fix handling of TGSI_SEMANTIC_PSIZE
Two more little piglits.

NOTE: This is a candidate for the 9.1 branch.
2013-05-21 17:50:12 +02:00
Christian König 5b2855bfe7 radeon/uvd: add UVD implementation v5
Just everything you need for UVD with r600g and radeonsi.

v2: move UVD code to radeon subdir, clean up build system additions,
    remove an unused SI function, disable tiling on SI for now.
v3: some minor indentation fix and rebased
v4: dpb size calculation fixed
v5: implement proper fall-back in case the kernel doesn't support UVD,
    based on patches from Andreas Boll but cleaned up a bit more.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2013-04-11 17:10:28 +02:00
Tom Stellard 302f53dc20 radeonsi: Add compute support v3
v2:
  - Only dump shaders when env variable is set.

v3:
  - Don't emit VGT registers

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com
2013-04-05 18:43:34 -04:00
Tom Stellard c5e5b3401c gallium: PIPE_COMPUTE_CAP_IR_TARGET - allow drivers to specify a processor v2
This target string now contains four values instead of three.  The old
processor field (which was really being interpreted as arch) has been split
into two fields: processor and arch.  This allows drivers to pass a
more a more detailed description of the hardware to compiler frontends.

v2:
  - Adapt to libclc changes

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
2013-04-05 18:43:34 -04:00
Jerome Glisse 3f7d9710e8 radeonsi: add cs tracing v3
Same as on r600, trace cs execution by writting cs offset after each
states, this allow to pin point lockup inside command stream and
narrow down the scope of lockup investigation.

v2: Use WRITE_DATA packet instead of WRITE_MEM
v3: Remove useless nop packet

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
2013-03-27 11:38:02 -04:00
Marek Olšák 3857f450a6 gallium/util: add helper util_max_layer from r600g 2013-02-26 01:14:05 +01:00
Marek Olšák a84c4edeed radeonsi: add assertions to prevent creation of invalid surfaces
[ Cherry-picked from r600g commit ef11ed61a0 ]

NOTE: This is a candidate for the 9.1 branch.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2013-02-20 12:30:32 +01:00
Marek Olšák 6f6112a2b9 radeonsi: More assorted depth/stencil changes ported from r600g.
[ Squashed port of the following r600g commits: - Michel Dänzer ]

commit 428e37c2da
Author: Marek Olšák <maraeo@gmail.com>
Date:   Tue Oct 2 22:02:54 2012 +0200

    r600g: add in-place DB decompression and texturing with DB tiling

    The decompression is done in-place and only the compressed tiles are
    decompressed. Note: R6xx-R7xx can do that only with Z16 and Z32F.

    The texture unit is programmed to use non-displayable tiling and depth
    ordering of samples, so that it can fetch the texture in the native DB format.

    The latest version of the libdrm surface allocator is required for stencil
    texturing to work. The old one didn't create the mipmap tree correctly.
    We need a separate mipmap tree for stencil, because the stencil mipmap
    offsets are not really depth offsets/4.

    There are still some known bugs, but this should save some memory and it also
    improves performance a little bit in Lightsmark (especially with low
    resolutions; tested with Radeon HD 5000).

    The DB->CB copy is still used for transfers.

commit e2f623f1d6
Author: Marek Olšák <maraeo@gmail.com>
Date:   Sat Jul 28 13:55:59 2012 +0200

    r600g: don't decompress depth or stencil if there isn't any

commit 43e226b6ef
Author: Marek Olšák <maraeo@gmail.com>
Date:   Wed Jul 18 00:32:50 2012 +0200

    r600g: optimize uploading depth textures

    Make it only copy the portion of a depth texture being uploaded and
    not the whole 2D layer.

    There is also a little code cleanup.

commit b242adbe5c
Author: Marek Olšák <maraeo@gmail.com>
Date:   Wed Jul 18 00:17:46 2012 +0200

    r600g: remove needless wrapper r600_texture_depth_flush

commit 611dd52942
Author: Marek Olšák <maraeo@gmail.com>
Date:   Wed Jul 18 00:05:14 2012 +0200

    r600g: init_flushed_depth_texture should be able to report errors

commit 80755ff563
Author: Marek Olšák <maraeo@gmail.com>
Date:   Sat Jul 14 17:06:27 2012 +0200

    r600g: properly track which textures are depth

    This fixes the issue with have_depth_texture never being set to false.

commit fe1fd67556
Author: Marek Olšák <maraeo@gmail.com>
Date:   Sun Jul 8 03:10:37 2012 +0200

    r600g: don't flush depth textures set as colorbuffers

    The only case a depth buffer can be set as a color buffer is when flushing.

    That wasn't always the case, but now this code isn't required anymore.

commit 5a17d8318e
Author: Marek Olšák <maraeo@gmail.com>
Date:   Sun Jul 8 02:14:18 2012 +0200

    r600g: flush depth textures bound to vertex shaders

    This was missing/broken. There are also minor code cleanups.

commit dee58f94af
Author: Marek Olšák <maraeo@gmail.com>
Date:   Sun Jul 8 01:54:24 2012 +0200

    r600g: do fine-grained depth texture flushing

    - maintain a mask of which mipmap levels are dirty (instead of one big flag)
    - only flush what was requested at a given point and not the whole resource
      (most often only one level and one layer has to be flushed)

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
2013-01-21 15:42:28 +01:00
Vadim Girlin bc398f908f radeonsi: improve flushed depth texture handling
Use r600_resource_texture::flished_depth_texture for GPU access, and
allocate it in the VRAM. For transfers we'll allocate texture in the GTT
and store it in the r600_transfer::staging.

Improves performance when flushed depth texture is frequently used by the
GPU, e.g. in Lightsmark

[ Ported from r600g commit 3770847960 ]

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
2013-01-21 15:42:28 +01:00
Marek Olšák bfb405ceee radeonsi: Assorted depth/stencil changes ported from r600g.
[ Squashed port of the following r600g commits: - Michel Dänzer ]

commit c1e8c845ea
Author: Marek Olšák <maraeo@gmail.com>
Date:   Sat Jul 7 19:10:00 2012 +0200

    r600g: inline r600_hw_copy_region

commit 4891c5dc64
Author: Marek Olšák <maraeo@gmail.com>
Date:   Mon Jun 25 22:53:21 2012 +0200

    r600g: inline r600_blit_push_depth and use resource_copy_region

    We are going to have a separate resource for depth texturing and transfers
    and this is just a transfer thing.

commit da98bb6fc1
Author: Marek Olšák <maraeo@gmail.com>
Date:   Mon Jun 25 12:45:32 2012 +0200

    r600g: split flushed depth texture creation and flushing

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
2013-01-21 15:42:28 +01:00
Michel Dänzer 1ace200b2b radeonsi: Set SPI_SHADER_COL_FORMAT to what the pixel shader actually exports.
Instead of deriving it from the colour buffer formats only.

Fixes a number of piglit tests which export depth from the pixel shader.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
2013-01-17 16:57:21 +01:00
Marek Olšák 448cd5ea60 winsys/radeon: don't use BIND flags, add a flag for the cache bufmgr instead 2012-12-12 13:09:54 +01:00
Michel Dänzer 49003a5cb6 radeonsi: Fix sampler views for depth textures.
Consistently reference the flushed depth texture in the sampler view, not the
original one.

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
2012-11-28 13:35:16 +01:00
Michel Dänzer 7708a86464 radeonsi: Implement alpha testing in pixel shader.
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
2012-11-12 15:45:42 +01:00
Christian König 04473db38a radeonsi: start reworking inferred state handling
Instead of tracking the inferred state changes separately
just check if queued and emitted states are the same.

This patch just reworks the update of the SPI map between
vs and ps, but there are probably more cases like this.

Signed-off-by: Christian König <deathsimple@vodafone.de>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2012-09-26 11:04:36 +02:00
Michel Dänzer 9ccaa24f84 radeonsi: Texture border colour fixes.
* Handle arbitrary border colours.
* Use correct packing format for detecting special border colours.

Fixes piglit tex-border-1 and probably many other tests using border colours.

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2012-09-11 11:06:56 +02:00
Christian König de7d3825a0 radeonsi: adjust PIPE_SHADER_CAP_MAX_CONSTS
So it matches what we really can do.

Signed-off-by: Christian König <deathsimple@vodafone.de>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2012-09-04 10:51:26 +02:00
Michel Dänzer f402acdbe2 radeonsi: Use FP16 shader export format when necessary / possible.
Fixes piglit fbo-blending-formats.

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2012-08-27 11:51:56 +02:00
Michel Dänzer d1e40b3d40 radeonsi: Maintain cache of pixel shader variants according to contxt state.
Mostly inspired by r600g commit 4acf71f01e
('r600g: cache shader variants instead of rebuilding v3').

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2012-08-27 11:51:41 +02:00
Michel Dänzer 1b11395a36 radeonsi: Fix symbol conflicts with r600g.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=50389

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2012-08-16 12:01:16 +02:00
Christian König 583c212115 radeonsi: move sync handling into new state handler
So we can remove all the old atom handling.

Signed-off-by: Christian König <deathsimple@vodafone.de>
2012-08-11 09:58:26 +02:00
Christian König 7acb194a7b radeonsi: remove r6xx_flush_and_inv atom
It is not used any more.

Signed-off-by: Christian König <deathsimple@vodafone.de>
2012-08-11 09:58:25 +02:00
Christian König 708337e62e radeonsi: move init state to new state handling
Signed-off-by: Christian König <deathsimple@vodafone.de>
2012-08-11 09:58:25 +02:00