Mesa (main): pvr: Pass device info struct in pds generator.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Jun 7 14:02:37 UTC 2022


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

Author: Rajnesh Kanwal <rajnesh.kanwal at imgtec.com>
Date:   Mon May 16 14:26:43 2022 +0100

pvr: Pass device info struct in pds generator.

Fixes a potential NULL pointer dereference.

Signed-off-by: Rajnesh Kanwal <rajnesh.kanwal at imgtec.com>
Reviewed-by: Frank Binns <frank.binns at imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16897>

---

 src/imagination/vulkan/pds/pvr_pds.h | 4 ++--
 src/imagination/vulkan/pvr_device.c  | 4 +++-
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/imagination/vulkan/pds/pvr_pds.h b/src/imagination/vulkan/pds/pvr_pds.h
index e7a4e7ab74c..97668ee02a7 100644
--- a/src/imagination/vulkan/pds/pvr_pds.h
+++ b/src/imagination/vulkan/pds/pvr_pds.h
@@ -715,8 +715,8 @@ uint32_t *pvr_pds_vertex_shader_sa(
    const struct pvr_device_info *dev_info);
 
 /* Pixel Event */
-#define pvr_pds_set_sizes_pixel_event(X) \
-   pvr_pds_generate_pixel_event(X, NULL, PDS_GENERATE_SIZES, NULL)
+#define pvr_pds_set_sizes_pixel_event(X, Y) \
+   pvr_pds_generate_pixel_event(X, NULL, PDS_GENERATE_SIZES, Y)
 
 #define pvr_pds_generate_pixel_event_data_segment(X, Y, Z) \
    pvr_pds_generate_pixel_event(X, Y, PDS_GENERATE_DATA_SEGMENT, Z)
diff --git a/src/imagination/vulkan/pvr_device.c b/src/imagination/vulkan/pvr_device.c
index d283191c62f..c7ae95a61bc 100644
--- a/src/imagination/vulkan/pvr_device.c
+++ b/src/imagination/vulkan/pvr_device.c
@@ -1001,6 +1001,7 @@ static VkResult pvr_device_init_compute_fence_program(struct pvr_device *device)
  * pvr_srv_setup_static_pixel_event_program().
  */
 static void pvr_device_get_pixel_event_pds_program_data_size(
+   const struct pvr_device_info *dev_info,
    uint32_t *const data_size_in_dwords_out)
 {
    struct pvr_pds_event_program program = {
@@ -1008,7 +1009,7 @@ static void pvr_device_get_pixel_event_pds_program_data_size(
       .num_emit_word_pairs = 0,
    };
 
-   pvr_pds_set_sizes_pixel_event(&program);
+   pvr_pds_set_sizes_pixel_event(&program, dev_info);
 
    *data_size_in_dwords_out = program.data_size;
 }
@@ -1177,6 +1178,7 @@ VkResult pvr_CreateDevice(VkPhysicalDevice physicalDevice,
     * on each kick.
     */
    pvr_device_get_pixel_event_pds_program_data_size(
+      &pdevice->dev_info,
       &device->pixel_event_data_size_in_dwords);
 
    device->global_queue_job_count = 0;



More information about the mesa-commit mailing list