Marek Olšák
67c2921193
radeonsi: iterate from draw 1 for total/min_direct_count computation
...
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8653 >
2021-01-22 16:45:30 +00:00
Marek Olšák
01e3d28829
radeonsi: enable accidentally disabled fast launch with non-indexed tri strips
...
Only *indexed* triangle strips hang.
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8653 >
2021-01-22 16:45:30 +00:00
Marek Olšák
ea670ac150
radeonsi: skip some code for ALLOW_PRIM_DISCARD_CS if tess or GS is enabled
...
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8653 >
2021-01-22 16:45:30 +00:00
Marek Olšák
59a478b843
radeonsi: move if (sctx->vertex_buffers_dirty) into the upload function
...
This looks unnecessary, but the next commit will build upon it and add
more stuff into the function.
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8653 >
2021-01-22 16:45:30 +00:00
Marek Olšák
26d785fbbd
radeonsi: move y_inverted out of si_viewports
...
for better packing
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8653 >
2021-01-22 16:45:30 +00:00
Marek Olšák
ca2062a394
radeonsi: simplify determining whether render condition is enabled at draw time
...
Read one bool instead of reading one bool and one pointer.
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8653 >
2021-01-22 16:45:30 +00:00
Marek Olšák
5fabeb49d8
radeonsi: don't use rasterizer_discard to validate draws, only check ps_shader
...
Let's just say that PS can never be NULL here.
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8653 >
2021-01-22 16:45:30 +00:00
Marek Olšák
cd42ed34b0
radeonsi: optimize translating index_size to index_type
...
gcc generated a lookup table for the switch. This replaces it with
arithmetics.
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8653 >
2021-01-22 16:45:30 +00:00
Marek Olšák
a0978fffb8
radeonsi: add new possibly faster command submission helpers
...
This decreases the release libgallium_dri.so size without debug symbols
by 16384 bytes. The CPU time spent in si_emit_draw_packets decreased
from 4.5% to 4.1% in viewperf13/catia/plane01.
The previous code did:
cs->current.buf[cs->current.cdw++] = ...;
cs->current.buf[cs->current.cdw++] = ...;
cs->current.buf[cs->current.cdw++] = ...;
cs->current.buf[cs->current.cdw++] = ...;
The new code does:
unsigned num = cs->current.cdw;
uint32_t *buf = cs->current.buf;
buf[num++] = ...;
buf[num++] = ...;
buf[num++] = ...;
buf[num++] = ...;
cs->current.cdw = num;
The code is the same (radeon_emit is redefined as a macro) except that
all set and emit functions must be surrounded by radeon_begin(cs) and
radeon_end().
radeon_packets_added() returns whether there has been any new packets added
since radeon_begin.
radeon_end_update_context_roll(sctx) sets sctx->context_roll = true
if there has been any new packets added since radeon_begin.
For now, the "cs" parameter is intentionally unused in radeon_emit and
radeon_emit_array.
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8653 >
2021-01-22 16:45:29 +00:00
Marek Olšák
bc0508ad38
radeonsi: allow instance_count == 0 on chips that handle it correctly
...
Let's remove this overhead.
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8600 >
2021-01-20 21:53:13 +00:00
Marek Olšák
76d6351dab
radeonsi: don't validate inlinable uniforms at draw time
...
Let's trust the state tracker that it sets inlinable uniforms only
when shaders can use them.
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8600 >
2021-01-20 21:53:13 +00:00
Marek Olšák
185a2472a4
radeonsi: move variables closer to their use in most draw state functions
...
for lower register pressure, though I haven't measured this.
si_draw_vbo will be handled in a future commit.
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8600 >
2021-01-20 21:53:13 +00:00
Marek Olšák
ae5df516f1
radeonsi: clear dirty_atoms and dirty_states only if we entered the emit loop
...
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8600 >
2021-01-20 21:53:13 +00:00
Marek Olšák
2206840f6c
radeonsi: enable the GS tri strip adj workaround with primitive_restart
...
If a primitive restart index occurs after an even number of triangles,
the workaround works.
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8600 >
2021-01-20 21:53:13 +00:00
Marek Olšák
888a45a362
radeonsi: evaluate si_get_vs in si_draw_vbo at compile time
...
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8600 >
2021-01-20 21:53:13 +00:00
Marek Olšák
5f7715083b
radeonsi: evaluate sh_base in si_emit_vs_state at compile time
...
This computes the value at compile time because si_get_user_data_base is
always inlined.
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8600 >
2021-01-20 21:53:13 +00:00
Marek Olšák
88a02d80de
radeonsi: don't set context_roll for non-gfx9 in templated functions
...
It's not needed by other chips.
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8600 >
2021-01-20 21:53:13 +00:00
Marek Olšák
581a96bc44
radeonsi: don't pass pipe_draw_info into si_emit_draw_registers
...
Only two fields are used. It's probably better this way.
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8600 >
2021-01-20 21:53:13 +00:00
Marek Olšák
b06f3c52bf
radeonsi: trim the size of si_vgt_param_key and si_vgt_stages_key
...
These are the minimum sizes we can use.
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8548 >
2021-01-18 01:17:19 +00:00
Marek Olšák
f1e34f125d
radeonsi: don't use si_get_vs_state in most places
...
It's incorrect because si_get_vs_state returns gs_copy_shader for legacy
GS. It was harmless, but let's use si_get_vs, which is simpler.
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8548 >
2021-01-18 01:17:19 +00:00
Marek Olšák
4088b6f293
radeonsi: rearrange condition for streamout workaround on gfx7 and gfx8
...
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8548 >
2021-01-18 01:17:19 +00:00
Marek Olšák
eb22bd2072
radeonsi: get out of si_emit_vs_state early for blit vertex shaders
...
They don't use current_vs_state.
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8548 >
2021-01-18 01:17:19 +00:00
Marek Olšák
73709143d2
radeonsi: remove MRT-draw-calls, spill-draw-calls, spill-compute-calls
...
due to limited usefulness and overhead in si_draw_vbo.
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8548 >
2021-01-18 01:17:19 +00:00
Marek Olšák
f2a5148701
radeonsi: make sctx->vertex_elements always non-NULL
...
Bind a state with 0 vertex elements there.
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8548 >
2021-01-18 01:17:19 +00:00
Marek Olšák
961aa67adf
radeonsi: add a specialized function for CP DMA L2 prefetch
...
This radically simplifies the code to decrease CPU overhead in si_draw_vbo.
The generic CP DMA copy function is too complicated.
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8548 >
2021-01-18 01:17:19 +00:00
Marek Olšák
0eca4660a5
radeonsi: make cik_emit_prefetch_L2 templated and move it to si_state_draw.cpp
...
This is a great candidate for a template. There are a lot of conditions
that are already templated in si_draw_vbo.
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8548 >
2021-01-18 01:17:19 +00:00
Marek Olšák
c43d00dc91
radeonsi: fix si_num_prims_for_vertices for PIPE_PRIM_POLYGON
...
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8548 >
2021-01-18 01:17:19 +00:00
Marek Olšák
6682c1603c
radeonsi: don't compute average vertex count in si_draw_vbo
...
It's probably not needed and we also have draw merging on gfx10,
so we should be able to use total_driver_count in theory.
(I may be wrong, but I don't know if having avg_direct_count really
improves anything)
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8548 >
2021-01-18 01:17:19 +00:00
Marek Olšák
295106c3e7
radeonsi: don't pass pipe_draw_info into si_emit_derived_tess_state
...
Only one field is used.
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8548 >
2021-01-18 01:17:19 +00:00
Marek Olšák
6f74105a34
radeonsi: translate pipe_prim_type only when it changes
...
just sink it into the branch
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8548 >
2021-01-18 01:17:19 +00:00
Marek Olšák
d0d4c4ba1d
radeonsi: don't pass pipe_draw_info into si_emit_ia_multi_vgt_param
...
Only one field is used.
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8548 >
2021-01-18 01:17:19 +00:00
Marek Olšák
53f9bb860b
radeonsi: don't pass pipe_draw_info into si_emit_vs_state
...
only one field is used
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8548 >
2021-01-18 01:17:19 +00:00
Marek Olšák
4056e953fe
radeonsi: move emit_cache_flush functions into si_gfx_cs.c
...
This is a better place for them. They are not inlined anyway.
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8548 >
2021-01-18 01:17:19 +00:00
Pierre-Eric Pelloux-Prayer
07c1504d1b
radeonsi: implement SQTT support
...
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8002 >
2021-01-07 10:10:17 +01:00
Pierre-Eric Pelloux-Prayer
aa9fe1e423
radeonsi: pass radeon_cmdbuf to emit_cache_flush
...
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8002 >
2021-01-07 10:09:25 +01:00
Vinson Lee
8457be1497
radeonsi: Fix typos.
...
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8289 >
2021-01-05 02:25:36 +00:00
Marek Olšák
3b9fb98c4b
radeonsi: disable NGG fast launch with indexed triangle strips to fix a hang
...
This will be added to our TODO list.
Fixes: aaed7a29be - radeonsi: implement GS fast launch for indexed triangle strips
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8022 >
2020-12-16 00:43:48 -05:00
Pierre-Eric Pelloux-Prayer
5eda9673b2
radeonsi: fix si_get_draw_start_count count value
...
Fixes: 0ce68852c1 ("radeonsi: implement multi_draw but supporting only 1 draw")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3932
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8004 >
2020-12-10 09:17:45 +00:00
Marek Olšák
2b09bde1f5
radeonsi: use a C++ template to decrease draw_vbo overhead by 13 %
...
With GALLIUM_THREAD=0 to disable draw merging.
Before:
1, DrawElements ( 1 VBO| 0 UBO| 0 ) w/ no state change, 8736
After:
1, DrawElements ( 1 VBO| 0 UBO| 0 ) w/ no state change, 10059
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7807 >
2020-12-09 16:01:32 -05:00
Marek Olšák
6347b0b5c4
radeonsi: rename si_state_draw.c to .cpp
...
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7807 >
2020-12-09 16:01:32 -05:00