Commit Graph

292 Commits

Author SHA1 Message Date
Julien Isorce a77512635e r600: implement resource_get_info
Factoring code with resource_get_handle.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=110443
Signed-off-by: Julien Isorce <jisorce@oblong.com>
Reviewed-by: Dave Airlie airlied@redhat.com
2019-05-03 05:54:28 +00:00
Marek Olšák 6b554d863f winsys/amdgpu,radeon: pass vm_alignment to buffer_from_handle
Acked-by: Christian König <christian.koenig@amd.com>
2018-11-28 20:20:27 -05:00
Marek Olšák 8ad12c8bec gallium: rework PIPE_HANDLE_USAGE_* flags
Only radeonsi uses them, so adjust them to match its needs.
2018-10-30 16:03:02 -04:00
Marek Olšák da72b6296c r600: fix HTILE for NPOT textures with mipmapping
Cc: 18.1 18.2 <mesa-stable@lists.freedesktop.org>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
2018-09-10 15:19:56 -04:00
Marek Olšák 20dd75a926 radeonsi: use storage_samples instead of color_samples in most places
and use pipe_resource::nr_storage_samples instead of
r600_texture::num_color_samples.

Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
2018-07-31 18:28:41 -04:00
Marek Olšák 966f155623 gallium: add storage_sample_count parameter into is_format_supported
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
2018-07-31 18:28:41 -04:00
Konstantin Kharlamov 9b379591c9 r600g: do not use "fast-clear" for small textures (v3)
Ported from radeonsi. Improves windowed glxgears ran as

	vblank_mode=0 glxgears -info -geometry 0+0+512+512

from ≈2270 FPS to ≈2360 FPS. Tested with AMD TURKS.

v2: turned out glxgears ignores the option above, the correct way would
be "512x512+0+0". Now it can be seen 512x512 actually loses 30 FPS.
300×300 however wins around a hundred FPS, and to leave some room in
case results may differ for other cards I want not to nitpick in search
of an optimum but to simply leave 300×300 in the code.
v3: remove redundant braces, and try harder for the mail to stick to
the rest of the series.

Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
Reviewed-by: Gert Wollny <gw.fossdev@gmail.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
2018-07-17 14:47:37 -04:00
Marek Olšák 912b0163dc ac/surface: add EQAA support
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
2018-05-10 18:34:31 -04:00
Ian Romanick d76c204d05 util: Move util_is_power_of_two to bitscan.h and rename to util_is_power_of_two_or_zero
The new name make the zero-input behavior more obvious.  The next
patch adds a new function with different zero-input behavior.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Suggested-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
2018-03-29 14:09:23 -07:00
Marek Olšák f099c3aef1 r600: consolidate PIPE_BIND_SHARED/SCANOUT handling
(Ported from radeonsi commit f70f6baaa3)

Allows cached BOs to be reused in more cases.

Bugzilla: https://bugs.freedesktop.org/105171
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
2018-03-16 17:31:28 +01:00
Dave Airlie 8369fdee8b r600: fix whitespace in recent 1d texture commit.
trivial fix.
2018-02-28 20:16:19 +00:00
Dave Airlie a5853a3333 r600: partly revert disabling tiling for 1d texture.
Previously we had a check for 1d of narrow 2D textures, however
narrow 2d textures caused gpu hangs, but it was correct for 1d
textures.

This fixes a bunch of 1D image piglits for me.

Fixes: 7b8e1c089d (r600/texture: drop lowering 1d/2d images to linear.)
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2018-02-28 04:59:37 +00:00
Marek Olšák 986e467e4c gallium/util: add util_num_layers helper 2017-12-25 14:23:02 +01:00
Dave Airlie 7b8e1c089d r600/texture: drop lowering 1d/2d images to linear.
This appears to cause hangs with compute images. Unless
we can find more specifics, just don't do this for now.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2017-12-06 23:20:20 +00:00
Marek Olšák 2c5f2936af r300,r600,radeonsi: replace RADEON_FLUSH_* with PIPE_FLUSH_*
and handle PIPE_FLUSH_HINT_FINISH in r300.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
2017-11-29 18:21:30 +01:00
Marek Olšák ec15ff78c3 ac: change legacy_surf_level::slice_size to dword units
The next commit will reduce the size even more.

v2: typecast to uint64_t manually
v3: add more typecasts, add asserts

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
2017-11-27 14:44:04 +01:00
Marek Olšák 474b4a9191 ac: pack ac_surface better
r600_texture: 1736 -> 1488 bytes

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
2017-11-27 14:12:38 +01:00
Dave Airlie ac4f175d79 r600: allocate immed buffer resource for images.
In order to image readback we have to execute a MEM_RAT instruction
that needs a buffer to transfer the result into until the shader
can fetch it.

Tested-By: Gert Wollny <gw.fossdev@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2017-11-17 11:31:40 +10:00
Nicolai Hähnle 222a2fb998 util: move os_time.[ch] to src/util
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2017-11-09 11:57:21 +01:00
Dave Airlie bee61d16c8 r600: drop a bunch of post-cayman code. (v2)
Now that Marek has split the two drivers apart, drop a bunch
of unnecessary code from the r600 half. There is probably a bunch
more hiding in the video code.

No piglit regressions on caicos.

v2: fix HAVE_LLVM protected code
Acked-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Acked-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2017-10-10 06:08:42 +10:00
Marek Olšák 06bfb2d28f r600: fork and import gallium/radeon
This marks the end of code sharing between r600 and radeonsi.
It's getting difficult to work on radeonsi without breaking r600.

A lot of functions had to be renamed to prevent linker conflicts.
There are also minor cleanups.

Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
2017-09-26 04:21:14 +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 4069d39465 r600g: remove compute_global_transfer_* calls from texture_transfer_map/unmap
Textures can never have target==PIPE_BUFFER.
2013-09-29 15:18:10 +02:00
Marek Olšák ef6680d3ee r600g: move the low-level buffer functions for multiple rings to drivers/radeon
Also slightly optimize r600_buffer_map_sync_with_rings.
2013-09-29 15:18:09 +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 68f6dec32e r600g: move aux_context and r600_screen_clear_buffer to drivers/radeon
This will be used in the next commit.
2013-09-29 15:18:09 +02:00
Marek Olšák ba650ccf91 r600g: move some debug options to drivers/radeon 2013-09-29 15:18:09 +02:00
Marek Olšák 2814202ef4 r600g,radeonsi: share the async dma interface
r600_texture.c is one step closer to r600g.
2013-09-29 15:18:09 +02:00
Marek Olšák 6f21009cb3 r600g: move r600g-specific functions out of r600_texture.c 2013-09-29 15:18:08 +02:00
Marek Olšák ba29324dba r600g: get rid of r600_texture::array_mode 2013-09-29 15:18:08 +02:00
Marek Olšák 39801d4ba7 r600g,radeonsi: consolidate transfer, cmask, and fmask structures 2013-09-29 15:18:08 +02:00
Grigori Goronzy 56d9a397aa r600g: add support for separately allocated CMASKs
v2: check for NULL cbufs

Signed-off-by: Marek Olšák <marek.olsak@amd.com>
2013-09-20 20:35:55 +02:00
Axel Davy e8f9195e5f gallium, intel: Implements new __DRI_IMAGE_USE_LINEAR and PIPE_BIND_LINEAR flags to enforce no tiling.
Signed-off-by: Axel Davy <axel.davy@ens.fr>
2013-09-06 15:02:34 -07:00
Marek Olšák d5b23dfc1c r600g: move streamout state to drivers/radeon
This streamout state code will be used by radeonsi.

There are new structures r600_common_context and r600_common_screen.
What is inherited by what is shown here:

pipe_context -> r600_common_context -> r600_context
pipe_screen -> r600_common_screen -> r600_screen

The common structures reside in drivers/radeon. Currently they only contain
enough functionality to be able to handle streamout. Eventually I'd like
the whole pipe_screen implementation to be shared and some of the context
stuff too.

This is quite big, but most changes are because of the new structures and
the fact r600_write_value is replaced by radeon_emit.

Thanks to Tom Stellard for fixing the build for r600g/compute.

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 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 94d294137e r600g: don't read back the MSAA depth buffer if the read flag is not set
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2013-07-08 20:25:18 +02:00
Marek Olšák 141b892620 r600g: don't flush the context in texture_transfer_map
the winsys does this automatically

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2013-07-08 20:25:18 +02:00
Marek Olšák ae87aae0c4 r600g: fix texture offset computation for mapped MSAA depth buffers
It was wrong, because the offset shouldn't be applied to MSAA depth buffers.
This small cleanup should prevent such issues in the future.

This fixes a lockup in "piglit/fbo-depthstencil default_fb -samples=n".

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2013-07-08 20:25:18 +02:00
Marek Olšák 4d59258856 r600g: upsample and downsample MSAA resources for transfers
We did downsample (=resolve) MSAA resources to make ReadPixels work with MSAA
GLX visuals, which was enough for read-only color-only transfers.

This commit makes write color transfers and depth-stencil transfers work
in a similar manner. It does downsampling in transfer_map and upsampling
in transfer_unmap.

Reviewed-by: Brian Paul <brianp@vmware.com>
2013-06-13 03:54:13 +02:00
Marek Olšák 61c995bc47 r600g: rewrite FMASK allocation, fix FMASK texturing with 2 and 4 samples
This fixes and enables texturing with compressed MSAA colorbuffers
on Evergreen and Cayman. For the first time, multisample textures work
on Cayman.

This requires the libdrm flag RADEON_SURF_FMASK.

v2: require libdrm_radeon 2.4.45

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2013-05-15 20:19:45 +02:00
Marek Olšák b692076420 r600g: initialize CMASK and HTILE with the GPU using streamout
This fixes a crash when a resource cannot be mapped to the CPU's address space
because it's too big.

This puts a global pipe_context in r600_screen, which is guarded by a mutex,
so that we can use pipe_context when there isn't one around.
Hopefully our multi-context support is solid.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

NOTE: This is a candidate for the 9.1 branch.
2013-04-23 20:26:20 +02:00
Marek Olšák 413ca78af3 r600g: add a debug flag for printing virtual addresses of resources 2013-04-16 13:56:47 +02:00
Marek Olšák 52efa01de0 r600g: allocate FMASK right after the texture, so that it's aligned with it
This avoids the kernel CS checker errors with MSAA textures.

Reviewed-by: Jerome Glisse <jglisse@redhat.com>
2013-03-11 13:43:36 +01:00
Marek Olšák 4bf0ebdd4f r600g: use a single env var R600_DEBUG, disable bytecode dumping
Only the disassembler is used to dump shaders. Here's a few examples
how to use R600_DEBUG.

Log compute info:
  R600_DEBUG=compute

Dump all shaders:
  R600_DEBUG=fs,vs,gs,ps,cs

Dump pixel shaders only:
  R600_DEBUG=ps

Disable Hyper-Z:
  R600_DEBUG=nohyperz

Disable the LLVM backend:
  R600_DEBUG=nollvm

Or use any combination of the above, or print all options:
  R600_DEBUG=help

Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
2013-03-11 13:43:36 +01:00
Marek Olšák 2ca73bc7f7 r600g: cleanup #include recursion between r600_pipe.h and evergreen_compute.h
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
2013-03-11 13:43:36 +01:00
Marek Olšák 43d3e0cd3d r600g: don't check for R600_ENABLE_S3TC env var 2013-03-11 13:43:36 +01: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 2b9659c9e6 r600g: properly implement S8Z24 depth-stencil format for Evergreen
I should say "fix", but it has never been used until now.
S8Z24 is the format equivalent to the GL_UNSIGNED_INT_24_8 packing,
so we'll start to see it more often with st/mesa now making smart decisions
about formats.

The DB<->CB copy can change the channel ordering for transfers, other than
that, the internal DB format doesn't really matter.

R600-R700 support is possible except shadow mapping.
FMT_24_8 is broken if the SAMPLE_C instruction is used (no idea why).

Also the sampler swizzling was broken in theory and the fact it worked was
a lucky coincidence.

radeonsi might need to port this.

Reviewed-by: Jerome Glisse <jglisse@redhat.com>
2013-02-14 14:51:46 +01:00
Marek Olšák 5c86a728d4 r600g: fix htile buffer leak
NOTE: This is a candidate for the 9.1 branch.
2013-01-31 15:35:18 +01:00
Jerome Glisse 72916698b0 r600g: fix segfault with old kernel
Old kernel do not have dma support, patch pushed were missing some
of the check needed to not use dma.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
2013-01-28 14:51:40 -05:00