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

Author: Karmjit Mahil <[email protected]>
Date:   Tue Oct  3 15:28:28 2023 +0100

pvr: Fix SPM load shader sample rate

Reported-by: James Glanville <[email protected]>
Signed-off-by: Karmjit Mahil <[email protected]>
Reviewed-by: Frank Binns <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25584>

---

 src/imagination/vulkan/pvr_spm.c                   |  8 ++-
 .../vulkan/usc/programs/pvr_static_shaders.h       | 65 +++++++++++++++++++++-
 2 files changed, 71 insertions(+), 2 deletions(-)

diff --git a/src/imagination/vulkan/pvr_spm.c b/src/imagination/vulkan/pvr_spm.c
index 9e605eb89fc..0a6c50fac31 100644
--- a/src/imagination/vulkan/pvr_spm.c
+++ b/src/imagination/vulkan/pvr_spm.c
@@ -358,15 +358,21 @@ VkResult pvr_device_init_spm_load_state(struct pvr_device 
*device)
       const pvr_dev_addr_t usc_program_dev_addr =
          PVR_DEV_ADDR_OFFSET(usc_bo->dev_addr, usc_aligned_offsets[i]);
       struct pvr_pds_kickusc_program pds_kick_program = { 0 };
+      enum PVRX(PDSINST_DOUTU_SAMPLE_RATE) sample_rate;
 
       pvr_pds_generate_pixel_shader_sa_code_segment(
          &pds_texture_program,
          (uint32_t *)(mem_ptr + pds_texture_aligned_offsets[i]));
 
+      if (spm_load_collection[i].info->msaa_sample_count > 1)
+         sample_rate = PVRX(PDSINST_DOUTU_SAMPLE_RATE_FULL);
+      else
+         sample_rate = PVRX(PDSINST_DOUTU_SAMPLE_RATE_INSTANCE);
+
       pvr_pds_setup_doutu(&pds_kick_program.usc_task_control,
                           usc_program_dev_addr.addr,
                           spm_load_collection[i].info->temps_required,
-                          PVRX(PDSINST_DOUTU_SAMPLE_RATE_INSTANCE),
+                          sample_rate,
                           false);
 
       /* Generated both code and data. */
diff --git a/src/imagination/vulkan/usc/programs/pvr_static_shaders.h 
b/src/imagination/vulkan/usc/programs/pvr_static_shaders.h
index 1deaa43f113..2658bb748c9 100644
--- a/src/imagination/vulkan/usc/programs/pvr_static_shaders.h
+++ b/src/imagination/vulkan/usc/programs/pvr_static_shaders.h
@@ -52,6 +52,7 @@ struct pvr_shader_factory_info {
    uint32_t num_driver_consts;
    const struct pvr_static_buffer *static_const_buffer;
    uint32_t num_static_const;
+   uint32_t msaa_sample_count;
 };
 
 static const uint8_t availability_query_write_shader[144] = { 0 };
@@ -84,6 +85,7 @@ static const struct pvr_shader_factory_info 
availability_query_write_info = {
    0,
    availability_query_write_static_consts,
    0,
+   ~0,
 };
 
 static const uint8_t copy_query_results_shader[384] = { 0 };
@@ -114,6 +116,7 @@ static const struct pvr_shader_factory_info 
copy_query_results_info = {
    0,
    copy_query_results_static_consts,
    0,
+   ~0,
 };
 
 static const uint8_t reset_query_shader_code[136] = { 0 };
@@ -144,6 +147,7 @@ static const struct pvr_shader_factory_info 
reset_query_info = {
    0,
    reset_query_static_consts,
    0,
+   ~0,
 };
 
 static const struct pvr_shader_factory_info
@@ -179,6 +183,7 @@ static const struct pvr_shader_factory_info
       0,
       NULL,
       0,
+      1,
    };
 
 static const uint8_t clear_attachments_1_dw_0_offt_out_mem_shader_code[8] = {
@@ -205,6 +210,7 @@ static const struct pvr_shader_factory_info
       0,
       NULL,
       0,
+      1,
    };
 
 static const uint8_t clear_attachments_2_dw_0_offt_out_reg_shader_code[8] = {
@@ -231,6 +237,7 @@ static const struct pvr_shader_factory_info
       0,
       NULL,
       0,
+      1,
    };
 
 static const uint8_t clear_attachments_2_dw_0_offt_out_mem_shader_code[8] = {
@@ -257,6 +264,7 @@ static const struct pvr_shader_factory_info
       0,
       NULL,
       0,
+      1,
    };
 
 static const uint8_t clear_attachments_3_dw_0_offt_out_reg_shader_code[8] = {
@@ -283,6 +291,7 @@ static const struct pvr_shader_factory_info
       0,
       NULL,
       0,
+      1,
    };
 
 static const uint8_t clear_attachments_3_dw_0_offt_out_mem_shader_code[8] = {
@@ -309,6 +318,7 @@ static const struct pvr_shader_factory_info
       0,
       NULL,
       0,
+      1,
    };
 
 static const uint8_t clear_attachments_4_dw_0_offt_out_reg_shader_code[8] = {
@@ -335,6 +345,7 @@ static const struct pvr_shader_factory_info
       0,
       NULL,
       0,
+      1,
    };
 
 static const uint8_t clear_attachments_4_dw_0_offt_out_mem_shader_code[8] = {
@@ -361,6 +372,7 @@ static const struct pvr_shader_factory_info
       0,
       NULL,
       0,
+      1,
    };
 
 static const uint8_t clear_attachments_1_dw_1_offt_out_reg_shader_code[8] = {
@@ -387,6 +399,7 @@ static const struct pvr_shader_factory_info
       0,
       NULL,
       0,
+      1,
    };
 
 static const uint8_t clear_attachments_1_dw_1_offt_out_mem_shader_code[8] = {
@@ -413,6 +426,7 @@ static const struct pvr_shader_factory_info
       0,
       NULL,
       0,
+      1,
    };
 
 static const uint8_t clear_attachments_2_dw_1_offt_out_reg_shader_code[8] = {
@@ -439,6 +453,7 @@ static const struct pvr_shader_factory_info
       0,
       NULL,
       0,
+      1,
    };
 
 static const uint8_t clear_attachments_2_dw_1_offt_out_mem_shader_code[8] = {
@@ -465,6 +480,7 @@ static const struct pvr_shader_factory_info
       0,
       NULL,
       0,
+      1,
    };
 
 static const uint8_t clear_attachments_3_dw_1_offt_out_reg_shader_code[8] = {
@@ -491,6 +507,7 @@ static const struct pvr_shader_factory_info
       0,
       NULL,
       0,
+      1,
    };
 
 static const uint8_t clear_attachments_3_dw_1_offt_out_mem_shader_code[8] = {
@@ -517,6 +534,7 @@ static const struct pvr_shader_factory_info
       0,
       NULL,
       0,
+      1,
    };
 
 static const uint8_t clear_attachments_4_dw_1_offt_out_reg_shader_code[8] = {
@@ -595,6 +613,7 @@ static const struct pvr_shader_factory_info
       0,
       NULL,
       0,
+      1,
    };
 
 static const uint8_t clear_attachments_1_dw_2_offt_out_mem_shader_code[8] = {
@@ -621,6 +640,7 @@ static const struct pvr_shader_factory_info
       0,
       NULL,
       0,
+      1,
    };
 
 static const uint8_t clear_attachments_2_dw_2_offt_out_reg_shader_code[8] = {
@@ -647,6 +667,7 @@ static const struct pvr_shader_factory_info
       0,
       NULL,
       0,
+      1,
    };
 
 static const uint8_t clear_attachments_2_dw_2_offt_out_mem_shader_code[8] = {
@@ -673,6 +694,7 @@ static const struct pvr_shader_factory_info
       0,
       NULL,
       0,
+      1,
    };
 
 static const uint8_t clear_attachments_3_dw_2_offt_out_reg_shader_code[8] = {
@@ -803,6 +825,7 @@ static const struct pvr_shader_factory_info
       0,
       NULL,
       0,
+      1,
    };
 
 static const uint8_t clear_attachments_1_dw_3_offt_out_mem_shader_code[8] = {
@@ -1505,6 +1528,7 @@ static const struct pvr_shader_factory_info
       0,
       NULL,
       0,
+      1,
    };
 static struct {
    const uint8_t *code;
@@ -1700,6 +1724,7 @@ static const struct pvr_shader_factory_info 
spm_load_1X_1_regs_info = {
    0,
    NULL,
    0,
+   1,
 };
 
 static const uint8_t spm_load_1X_2_regs_shader_code[8] = { 0 };
@@ -1721,6 +1746,7 @@ static const struct pvr_shader_factory_info 
spm_load_1X_2_regs_info = {
    0,
    NULL,
    0,
+   1,
 };
 
 static const uint8_t spm_load_1X_4_regs_shader_code[8] = { 0 };
@@ -1742,6 +1768,7 @@ static const struct pvr_shader_factory_info 
spm_load_1X_4_regs_info = {
    0,
    NULL,
    0,
+   1,
 };
 
 static const uint8_t spm_load_1X_1_buffers_shader_code[8] = { 0 };
@@ -1765,6 +1792,7 @@ static const struct pvr_shader_factory_info 
spm_load_1X_1_buffers_info = {
    0,
    NULL,
    0,
+   1,
 };
 
 static const uint8_t spm_load_1X_2_buffers_shader_code[8] = { 0 };
@@ -1788,6 +1816,7 @@ static const struct pvr_shader_factory_info 
spm_load_1X_2_buffers_info = {
    0,
    NULL,
    0,
+   1,
 };
 
 static const uint8_t spm_load_1X_3_buffers_shader_code[8] = { 0 };
@@ -1811,6 +1840,7 @@ static const struct pvr_shader_factory_info 
spm_load_1X_3_buffers_info = {
    0,
    NULL,
    0,
+   1,
 };
 
 static const uint8_t spm_load_1X_4_buffers_shader_code[8] = { 0 };
@@ -1834,6 +1864,7 @@ static const struct pvr_shader_factory_info 
spm_load_1X_4_buffers_info = {
    0,
    NULL,
    0,
+   1,
 };
 
 static const uint8_t spm_load_1X_5_buffers_shader_code[8] = { 0 };
@@ -1857,6 +1888,7 @@ static const struct pvr_shader_factory_info 
spm_load_1X_5_buffers_info = {
    0,
    NULL,
    0,
+   1,
 };
 
 static const uint8_t spm_load_1X_6_buffers_shader_code[8] = { 0 };
@@ -1880,6 +1912,7 @@ static const struct pvr_shader_factory_info 
spm_load_1X_6_buffers_info = {
    0,
    NULL,
    0,
+   1,
 };
 
 static const uint8_t spm_load_1X_7_buffers_shader_code[8] = { 0 };
@@ -1903,6 +1936,7 @@ static const struct pvr_shader_factory_info 
spm_load_1X_7_buffers_info = {
    0,
    NULL,
    0,
+   1,
 };
 
 static const uint8_t spm_load_2X_1_regs_shader_code[8] = { 0 };
@@ -1924,6 +1958,7 @@ static const struct pvr_shader_factory_info 
spm_load_2X_1_regs_info = {
    0,
    NULL,
    0,
+   2,
 };
 
 static const uint8_t spm_load_2X_2_regs_shader_code[8] = { 0 };
@@ -1945,6 +1980,7 @@ static const struct pvr_shader_factory_info 
spm_load_2X_2_regs_info = {
    0,
    NULL,
    0,
+   2,
 };
 
 static const uint8_t spm_load_2X_4_regs_shader_code[8] = { 0 };
@@ -1966,6 +2002,7 @@ static const struct pvr_shader_factory_info 
spm_load_2X_4_regs_info = {
    0,
    NULL,
    0,
+   2,
 };
 
 static const uint8_t spm_load_2X_1_buffers_shader_code[8] = { 0 };
@@ -1989,6 +2026,7 @@ static const struct pvr_shader_factory_info 
spm_load_2X_1_buffers_info = {
    0,
    NULL,
    0,
+   2,
 };
 
 static const uint8_t spm_load_2X_2_buffers_shader_code[8] = { 0 };
@@ -2012,6 +2050,7 @@ static const struct pvr_shader_factory_info 
spm_load_2X_2_buffers_info = {
    0,
    NULL,
    0,
+   2,
 };
 
 static const uint8_t spm_load_2X_3_buffers_shader_code[8] = { 0 };
@@ -2035,6 +2074,7 @@ static const struct pvr_shader_factory_info 
spm_load_2X_3_buffers_info = {
    0,
    NULL,
    0,
+   2,
 };
 
 static const uint8_t spm_load_2X_4_buffers_shader_code[8] = { 0 };
@@ -2058,6 +2098,7 @@ static const struct pvr_shader_factory_info 
spm_load_2X_4_buffers_info = {
    0,
    NULL,
    0,
+   2,
 };
 
 static const uint8_t spm_load_2X_5_buffers_shader_code[8] = { 0 };
@@ -2081,6 +2122,7 @@ static const struct pvr_shader_factory_info 
spm_load_2X_5_buffers_info = {
    0,
    NULL,
    0,
+   2,
 };
 
 static const uint8_t spm_load_2X_6_buffers_shader_code[8] = { 0 };
@@ -2104,6 +2146,7 @@ static const struct pvr_shader_factory_info 
spm_load_2X_6_buffers_info = {
    0,
    NULL,
    0,
+   2,
 };
 
 static const uint8_t spm_load_2X_7_buffers_shader_code[8] = { 0 };
@@ -2127,6 +2170,7 @@ static const struct pvr_shader_factory_info 
spm_load_2X_7_buffers_info = {
    0,
    NULL,
    0,
+   2,
 };
 
 static const uint8_t spm_load_4X_1_regs_shader_code[8] = { 0 };
@@ -2148,6 +2192,7 @@ static const struct pvr_shader_factory_info 
spm_load_4X_1_regs_info = {
    0,
    NULL,
    0,
+   4,
 };
 
 static const uint8_t spm_load_4X_2_regs_shader_code[8] = { 0 };
@@ -2169,13 +2214,14 @@ static const struct pvr_shader_factory_info 
spm_load_4X_2_regs_info = {
    0,
    NULL,
    0,
+   4,
 };
 
 static const uint8_t spm_load_4X_4_regs_shader_code[8] = { 0 };
 
 static const struct pvr_shader_factory_info spm_load_4X_4_regs_info = {
    0, 0, 0,    0, 0,    0, spm_load_4X_4_regs_shader_code, 0, 0, NULL,
-   0, 0, NULL, 0, NULL, 0,
+   0, 0, NULL, 0, NULL, 0, 4
 };
 
 static const uint8_t spm_load_4X_1_buffers_shader_code[8] = { 0 };
@@ -2199,6 +2245,7 @@ static const struct pvr_shader_factory_info 
spm_load_4X_1_buffers_info = {
    0,
    NULL,
    0,
+   4,
 };
 
 static const uint8_t spm_load_4X_2_buffers_shader_code[8] = { 0 };
@@ -2222,6 +2269,7 @@ static const struct pvr_shader_factory_info 
spm_load_4X_2_buffers_info = {
    0,
    NULL,
    0,
+   4,
 };
 
 static const uint8_t spm_load_4X_3_buffers_shader_code[8] = { 0 };
@@ -2245,6 +2293,7 @@ static const struct pvr_shader_factory_info 
spm_load_4X_3_buffers_info = {
    0,
    NULL,
    0,
+   4,
 };
 
 static const uint8_t spm_load_4X_4_buffers_shader_code[8] = { 0 };
@@ -2268,6 +2317,7 @@ static const struct pvr_shader_factory_info 
spm_load_4X_4_buffers_info = {
    0,
    NULL,
    0,
+   4,
 };
 
 static const uint8_t spm_load_4X_5_buffers_shader_code[8] = { 0 };
@@ -2291,6 +2341,7 @@ static const struct pvr_shader_factory_info 
spm_load_4X_5_buffers_info = {
    0,
    NULL,
    0,
+   4,
 };
 
 static const uint8_t spm_load_4X_6_buffers_shader_code[8] = { 0 };
@@ -2314,6 +2365,7 @@ static const struct pvr_shader_factory_info 
spm_load_4X_6_buffers_info = {
    0,
    NULL,
    0,
+   4,
 };
 
 static const uint8_t spm_load_4X_7_buffers_shader_code[8] = { 0 };
@@ -2337,6 +2389,7 @@ static const struct pvr_shader_factory_info 
spm_load_4X_7_buffers_info = {
    0,
    NULL,
    0,
+   4,
 };
 
 static const uint8_t spm_load_8X_1_regs_shader_code[8] = { 0 };
@@ -2358,6 +2411,7 @@ static const struct pvr_shader_factory_info 
spm_load_8X_1_regs_info = {
    0,
    NULL,
    0,
+   8,
 };
 
 static const uint8_t spm_load_8X_2_regs_shader_code[8] = { 0 };
@@ -2379,6 +2433,7 @@ static const struct pvr_shader_factory_info 
spm_load_8X_2_regs_info = {
    0,
    NULL,
    0,
+   8,
 };
 
 static const uint8_t spm_load_8X_4_regs_shader_code[8] = { 0 };
@@ -2400,6 +2455,7 @@ static const struct pvr_shader_factory_info 
spm_load_8X_4_regs_info = {
    0,
    NULL,
    0,
+   8,
 };
 
 static const uint8_t spm_load_8X_1_buffers_shader_code[8] = { 0 };
@@ -2423,6 +2479,7 @@ static const struct pvr_shader_factory_info 
spm_load_8X_1_buffers_info = {
    0,
    NULL,
    0,
+   8,
 };
 
 static const uint8_t spm_load_8X_2_buffers_shader_code[8] = { 0 };
@@ -2446,6 +2503,7 @@ static const struct pvr_shader_factory_info 
spm_load_8X_2_buffers_info = {
    0,
    NULL,
    0,
+   8,
 };
 
 static const uint8_t spm_load_8X_3_buffers_shader_code[8] = { 0 };
@@ -2469,6 +2527,7 @@ static const struct pvr_shader_factory_info 
spm_load_8X_3_buffers_info = {
    0,
    NULL,
    0,
+   8,
 };
 
 static const uint8_t spm_load_8X_4_buffers_shader_code[8] = { 0 };
@@ -2492,6 +2551,7 @@ static const struct pvr_shader_factory_info 
spm_load_8X_4_buffers_info = {
    0,
    NULL,
    0,
+   8,
 };
 
 static const uint8_t spm_load_8X_5_buffers_shader_code[8] = { 0 };
@@ -2515,6 +2575,7 @@ static const struct pvr_shader_factory_info 
spm_load_8X_5_buffers_info = {
    0,
    NULL,
    0,
+   8,
 };
 
 static const uint8_t spm_load_8X_6_buffers_shader_code[8] = { 0 };
@@ -2538,6 +2599,7 @@ static const struct pvr_shader_factory_info 
spm_load_8X_6_buffers_info = {
    0,
    NULL,
    0,
+   8,
 };
 
 static const uint8_t spm_load_8X_7_buffers_shader_code[8] = { 0 };
@@ -2561,6 +2623,7 @@ static const struct pvr_shader_factory_info 
spm_load_8X_7_buffers_info = {
    0,
    NULL,
    0,
+   8,
 };
 static struct {
    const uint8_t *code;

Reply via email to