Module: Mesa
Branch: main
Commit: bcb34884c23c48b80dbaa3a26345b3073dbe3e64
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=bcb34884c23c48b80dbaa3a26345b3073dbe3e64

Author: Vitaliy Triang3l Kuzmin <trian...@yandex.ru>
Date:   Sat Oct  7 19:40:13 2023 +0300

r600: Remove Gallium dependencies in r600_asm

Signed-off-by: Vitaliy Triang3l Kuzmin <trian...@yandex.ru>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25695>

---

 src/gallium/drivers/r600/evergreen_state.c |  3 ++-
 src/gallium/drivers/r600/r600_asm.c        | 16 +++++++++++-----
 src/gallium/drivers/r600/r600_asm.h        |  6 +++++-
 src/gallium/drivers/r600/r600_pipe.h       |  1 -
 src/gallium/drivers/r600/r600_shader.h     |  1 +
 src/gallium/drivers/r600/r600_state.c      |  3 ++-
 src/gallium/drivers/r600/r600d_common.h    |  2 ++
 7 files changed, 23 insertions(+), 9 deletions(-)

diff --git a/src/gallium/drivers/r600/evergreen_state.c 
b/src/gallium/drivers/r600/evergreen_state.c
index 1699add4252..047cd5ba451 100644
--- a/src/gallium/drivers/r600/evergreen_state.c
+++ b/src/gallium/drivers/r600/evergreen_state.c
@@ -23,6 +23,7 @@
 #include "r600_formats.h"
 #include "r600_shader.h"
 #include "r600_query.h"
+#include "r600d_common.h"
 #include "evergreend.h"
 
 #include "pipe/p_shader_tokens.h"
@@ -2210,7 +2211,7 @@ static void evergreen_emit_constant_buffers(struct 
r600_context *rctx,
 
                va = rbuffer->gpu_address + cb->buffer_offset;
 
-               if (buffer_index < R600_MAX_HW_CONST_BUFFERS) {
+               if (buffer_index < R600_MAX_ALU_CONST_BUFFERS) {
                        radeon_set_context_reg_flag(cs, reg_alu_constbuf_size + 
buffer_index * 4,
                                                    
DIV_ROUND_UP(cb->buffer_size, 256), pkt_flags);
                        radeon_set_context_reg_flag(cs, reg_alu_const_cache + 
buffer_index * 4, va >> 8,
diff --git a/src/gallium/drivers/r600/r600_asm.c 
b/src/gallium/drivers/r600/r600_asm.c
index 071928b9713..045db512ee0 100644
--- a/src/gallium/drivers/r600/r600_asm.c
+++ b/src/gallium/drivers/r600/r600_asm.c
@@ -20,17 +20,18 @@
  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  * USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
+#include "r600_asm.h"
 #include "r600_sq.h"
 #include "r600_opcodes.h"
 #include "r600_formats.h"
-#include "r600_shader.h"
 #include "r600d.h"
+#include "r600d_common.h"
 
 #include <errno.h>
-#include "util/u_bitcast.h"
+#include <string.h>
+#include "compiler/shader_enums.h"
 #include "util/u_memory.h"
 #include "util/u_math.h"
-#include "pipe/p_shader_tokens.h"
 
 #define NUM_OF_CYCLES 3
 #define NUM_OF_COMPONENTS 4
@@ -1085,7 +1086,7 @@ static int r600_bytecode_alloc_inst_kcache_lines(struct 
r600_bytecode *bc,
                        continue;
 
                bank = alu->src[i].kc_bank;
-               assert(bank < R600_MAX_HW_CONST_BUFFERS);
+               assert(bank < R600_MAX_ALU_CONST_BUFFERS);
                line = (sel-512)>>4;
                index_mode = alu->src[i].kc_rel;
 
@@ -2130,7 +2131,12 @@ static int print_src(struct r600_bytecode_alu *alu, 
unsigned idx)
                        need_chan = 1;
                        break;
                case V_SQ_ALU_SRC_LITERAL:
-                       o += fprintf(stderr, "[0x%08X %f]", src->value, 
u_bitcast_u2f(src->value));
+                       {
+                               const uint32_t value_uint32 = src->value;
+                               float value_float;
+                               memcpy(&value_float, &value_uint32, 
sizeof(float));
+                               o += fprintf(stderr, "[0x%08X %f]", 
value_uint32, value_float);
+                       }
                        break;
                case V_SQ_ALU_SRC_0_5:
                        o += fprintf(stderr, "0.5");
diff --git a/src/gallium/drivers/r600/r600_asm.h 
b/src/gallium/drivers/r600/r600_asm.h
index c7afefcd3a4..c199ce92e22 100644
--- a/src/gallium/drivers/r600/r600_asm.h
+++ b/src/gallium/drivers/r600/r600_asm.h
@@ -23,9 +23,13 @@
 #ifndef R600_ASM_H
 #define R600_ASM_H
 
-#include "r600_pipe.h"
+#include "util/format/u_format.h"
+#include "util/list.h"
+#include "amd_family.h"
 #include "r600_isa.h"
 
+#include <stdbool.h>
+#include <stdint.h>
 #include <stdio.h>
 
 #ifdef __cplusplus
diff --git a/src/gallium/drivers/r600/r600_pipe.h 
b/src/gallium/drivers/r600/r600_pipe.h
index da4dbf3f4d2..589b5240d64 100644
--- a/src/gallium/drivers/r600/r600_pipe.h
+++ b/src/gallium/drivers/r600/r600_pipe.h
@@ -75,7 +75,6 @@
 #define R600_MAX_USER_CONST_BUFFERS 15
 #define R600_MAX_DRIVER_CONST_BUFFERS 3
 #define R600_MAX_CONST_BUFFERS (R600_MAX_USER_CONST_BUFFERS + 
R600_MAX_DRIVER_CONST_BUFFERS)
-#define R600_MAX_HW_CONST_BUFFERS 16
 
 /* start driver buffers after user buffers */
 #define R600_BUFFER_INFO_CONST_BUFFER (R600_MAX_USER_CONST_BUFFERS)
diff --git a/src/gallium/drivers/r600/r600_shader.h 
b/src/gallium/drivers/r600/r600_shader.h
index 71c94ec7feb..06e4311c703 100644
--- a/src/gallium/drivers/r600/r600_shader.h
+++ b/src/gallium/drivers/r600/r600_shader.h
@@ -24,6 +24,7 @@
 #define R600_SHADER_H
 
 #include "r600_asm.h"
+#include "r600_pipe.h"
 
 
 #ifdef __cplusplus
diff --git a/src/gallium/drivers/r600/r600_state.c 
b/src/gallium/drivers/r600/r600_state.c
index dd1533905cd..392ab27b81f 100644
--- a/src/gallium/drivers/r600/r600_state.c
+++ b/src/gallium/drivers/r600/r600_state.c
@@ -23,6 +23,7 @@
 #include "r600_formats.h"
 #include "r600_shader.h"
 #include "r600d.h"
+#include "r600d_common.h"
 
 #include "pipe/p_shader_tokens.h"
 #include "util/u_endian.h"
@@ -1721,7 +1722,7 @@ static void r600_emit_constant_buffers(struct 
r600_context *rctx,
                offset = cb->buffer_offset;
 
                if (!gs_ring_buffer) {
-                       assert(buffer_index < R600_MAX_HW_CONST_BUFFERS);
+                       assert(buffer_index < R600_MAX_ALU_CONST_BUFFERS);
                        radeon_set_context_reg(cs, reg_alu_constbuf_size + 
buffer_index * 4,
                                               DIV_ROUND_UP(cb->buffer_size, 
256));
                        radeon_set_context_reg(cs, reg_alu_const_cache + 
buffer_index * 4, offset >> 8);
diff --git a/src/gallium/drivers/r600/r600d_common.h 
b/src/gallium/drivers/r600/r600d_common.h
index 979f26bc7da..9e1b34cbf05 100644
--- a/src/gallium/drivers/r600/r600d_common.h
+++ b/src/gallium/drivers/r600/r600d_common.h
@@ -134,4 +134,6 @@
 #define   EG_S_028C70_FAST_CLEAR(x)                       (((unsigned)(x) & 
0x1) << 17)
 #define   SI_S_028C70_FAST_CLEAR(x)                       (((unsigned)(x) & 
0x1) << 13)
 
+#define R600_MAX_ALU_CONST_BUFFERS 16
+
 #endif

Reply via email to