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

Author: Frank Binns <[email protected]>
Date:   Thu Feb 23 22:15:35 2023 +0000

pvr: replace nop binary shader with run-time compiled shader

Signed-off-by: Frank Binns <[email protected]>
Reviewed-by: Karmjit Mahil <[email protected]>
Reviewed-by: Matt Coster <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21536>

---

 src/imagination/vulkan/meson.build                |  1 +
 src/imagination/vulkan/pvr_device.c               | 10 +++++--
 src/imagination/vulkan/usc/programs/pvr_nop_usc.h | 35 -----------------------
 3 files changed, 8 insertions(+), 38 deletions(-)

diff --git a/src/imagination/vulkan/meson.build 
b/src/imagination/vulkan/meson.build
index 2237510db88..9e2806fbebb 100644
--- a/src/imagination/vulkan/meson.build
+++ b/src/imagination/vulkan/meson.build
@@ -70,6 +70,7 @@ pvr_files = files(
 
 pvr_includes = [
   include_directories('usc/programs'),
+  include_directories('usc'),
   include_directories('winsys'),
   libpowervr_pds_includes,
 ]
diff --git a/src/imagination/vulkan/pvr_device.c 
b/src/imagination/vulkan/pvr_device.c
index 180e955ecbe..6ad7cf92a4e 100644
--- a/src/imagination/vulkan/pvr_device.c
+++ b/src/imagination/vulkan/pvr_device.c
@@ -49,11 +49,11 @@
 #include "pvr_hardcode.h"
 #include "pvr_job_render.h"
 #include "pvr_limits.h"
-#include "pvr_nop_usc.h"
 #include "pvr_pds.h"
 #include "pvr_private.h"
 #include "pvr_tex_state.h"
 #include "pvr_types.h"
+#include "pvr_uscgen.h"
 #include "pvr_winsys.h"
 #include "rogue/rogue.h"
 #include "util/build_id.h"
@@ -1525,15 +1525,19 @@ static VkResult pvr_device_init_nop_program(struct 
pvr_device *device)
    const uint32_t cache_line_size =
       rogue_get_slc_cache_line_size(&device->pdevice->dev_info);
    struct pvr_pds_kickusc_program program = { 0 };
+   struct util_dynarray nop_usc_bin;
    uint32_t staging_buffer_size;
    uint32_t *staging_buffer;
    VkResult result;
 
+   pvr_uscgen_nop(&nop_usc_bin);
+
    result = pvr_gpu_upload_usc(device,
-                               pvr_nop_usc_code,
-                               sizeof(pvr_nop_usc_code),
+                               util_dynarray_begin(&nop_usc_bin),
+                               nop_usc_bin.size,
                                cache_line_size,
                                &device->nop_program.usc);
+   util_dynarray_fini(&nop_usc_bin);
    if (result != VK_SUCCESS)
       return result;
 
diff --git a/src/imagination/vulkan/usc/programs/pvr_nop_usc.h 
b/src/imagination/vulkan/usc/programs/pvr_nop_usc.h
deleted file mode 100644
index a8843b9abb1..00000000000
--- a/src/imagination/vulkan/usc/programs/pvr_nop_usc.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright © 2022 Imagination Technologies Ltd.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to 
deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 
THE
- * SOFTWARE.
- */
-
-/* Auto-generated file - don't edit */
-
-#ifndef PVR_NOP_USC_H
-#define PVR_NOP_USC_H
-
-#include <stdint.h>
-
-static const uint8_t pvr_nop_usc_code[] = {
-   0x04, 0x80, 0xEE, 0x00, 0xF2, 0xFF, 0xFF, 0xFF,
-};
-
-#endif /* PVR_NOP_USC_H */

Reply via email to