pvr: replace transfer EOT binary shaders with run-time compiled shaders
Take the opportunity to tweak the naming of pvr_transfer_ctx_setup_shaders and pvr_transfer_ctx_fini_shaders to make them fit in with the rest of the naming in the driver. Signed-off-by: Frank Binns <frank.binns@imgtec.com> Acked-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21550>
This commit is contained in:
@@ -34,12 +34,13 @@
|
||||
#include "pvr_job_context.h"
|
||||
#include "pvr_pds.h"
|
||||
#include "pvr_private.h"
|
||||
#include "pvr_transfer_eot.h"
|
||||
#include "pvr_types.h"
|
||||
#include "pvr_uscgen.h"
|
||||
#include "pvr_vdm_load_sr.h"
|
||||
#include "pvr_vdm_store_sr.h"
|
||||
#include "pvr_winsys.h"
|
||||
#include "util/macros.h"
|
||||
#include "util/u_dynarray.h"
|
||||
#include "vk_alloc.h"
|
||||
#include "vk_log.h"
|
||||
|
||||
@@ -1200,39 +1201,73 @@ static void pvr_transfer_ctx_ws_create_info_init(
|
||||
create_info->priority = priority;
|
||||
}
|
||||
|
||||
static VkResult pvr_transfer_ctx_setup_shaders(struct pvr_device *device,
|
||||
struct pvr_transfer_ctx *ctx)
|
||||
static VkResult pvr_transfer_eot_shaders_init(struct pvr_device *device,
|
||||
struct pvr_transfer_ctx *ctx)
|
||||
{
|
||||
const uint32_t cache_line_size =
|
||||
rogue_get_slc_cache_line_size(&device->pdevice->dev_info);
|
||||
VkResult result;
|
||||
uint64_t rt_pbe_regs[PVR_TRANSFER_MAX_RENDER_TARGETS];
|
||||
|
||||
/* TODO: Setup USC fragments. */
|
||||
/* Setup start indexes of the shared registers that will contain the PBE
|
||||
* state words for each render target. These must match the indexes used in
|
||||
* pvr_pds_generate_pixel_event(), which is used to generate the
|
||||
* corresponding PDS program in pvr_pbe_setup_emit() via
|
||||
* pvr_pds_generate_pixel_event_data_segment() and
|
||||
* pvr_pds_generate_pixel_event_code_segment().
|
||||
*/
|
||||
/* TODO: store the shared register information somewhere so that it can be
|
||||
* shared with pvr_pbe_setup_emit() rather than having the shared register
|
||||
* indexes and number of shared registers hard coded in
|
||||
* pvr_pds_generate_pixel_event().
|
||||
*/
|
||||
for (uint32_t i = 0; i < ARRAY_SIZE(rt_pbe_regs); i++)
|
||||
rt_pbe_regs[i] = i * PVR_STATE_PBE_DWORDS;
|
||||
|
||||
/* Setup EOT program. */
|
||||
result = pvr_gpu_upload_usc(device,
|
||||
pvr_transfer_eot_usc_code,
|
||||
sizeof(pvr_transfer_eot_usc_code),
|
||||
cache_line_size,
|
||||
&ctx->usc_eot_bo);
|
||||
if (result != VK_SUCCESS)
|
||||
return result;
|
||||
STATIC_ASSERT(ARRAY_SIZE(rt_pbe_regs) == ARRAY_SIZE(ctx->usc_eot_bos));
|
||||
|
||||
STATIC_ASSERT(ARRAY_SIZE(pvr_transfer_eot_usc_offsets) ==
|
||||
ARRAY_SIZE(ctx->transfer_mrts));
|
||||
for (uint32_t i = 0U; i < ARRAY_SIZE(pvr_transfer_eot_usc_offsets); i++) {
|
||||
ctx->transfer_mrts[i] =
|
||||
PVR_DEV_ADDR_OFFSET(ctx->usc_eot_bo->vma->dev_addr,
|
||||
pvr_transfer_eot_usc_offsets[i]);
|
||||
for (uint32_t i = 0; i < ARRAY_SIZE(ctx->usc_eot_bos); i++) {
|
||||
const uint32_t cache_line_size =
|
||||
rogue_get_slc_cache_line_size(&device->pdevice->dev_info);
|
||||
const unsigned rt_count = i + 1;
|
||||
struct util_dynarray eot_bin;
|
||||
VkResult result;
|
||||
|
||||
pvr_uscgen_tq_eot(rt_count, rt_pbe_regs, &eot_bin);
|
||||
|
||||
result = pvr_gpu_upload_usc(device,
|
||||
util_dynarray_begin(&eot_bin),
|
||||
eot_bin.size,
|
||||
cache_line_size,
|
||||
&ctx->usc_eot_bos[i]);
|
||||
util_dynarray_fini(&eot_bin);
|
||||
if (result != VK_SUCCESS) {
|
||||
for (uint32_t j = 0; j < i; j++)
|
||||
pvr_bo_free(device, ctx->usc_eot_bos[j]);
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
static void pvr_transfer_ctx_fini_shaders(struct pvr_device *device,
|
||||
static void pvr_transfer_eot_shaders_fini(struct pvr_device *device,
|
||||
struct pvr_transfer_ctx *ctx)
|
||||
{
|
||||
pvr_bo_free(device, ctx->usc_eot_bo);
|
||||
for (uint32_t i = 0; i < ARRAY_SIZE(ctx->usc_eot_bos); i++)
|
||||
pvr_bo_free(device, ctx->usc_eot_bos[i]);
|
||||
}
|
||||
|
||||
static VkResult pvr_transfer_ctx_shaders_init(struct pvr_device *device,
|
||||
struct pvr_transfer_ctx *ctx)
|
||||
{
|
||||
/* TODO: Setup USC fragments. */
|
||||
|
||||
return pvr_transfer_eot_shaders_init(device, ctx);
|
||||
}
|
||||
|
||||
static void pvr_transfer_ctx_shaders_fini(struct pvr_device *device,
|
||||
struct pvr_transfer_ctx *ctx)
|
||||
{
|
||||
pvr_transfer_eot_shaders_fini(device, ctx);
|
||||
}
|
||||
|
||||
VkResult pvr_transfer_ctx_create(struct pvr_device *const device,
|
||||
@@ -1264,7 +1299,7 @@ VkResult pvr_transfer_ctx_create(struct pvr_device *const device,
|
||||
if (result != VK_SUCCESS)
|
||||
goto err_fini_reset_cmd;
|
||||
|
||||
result = pvr_transfer_ctx_setup_shaders(device, ctx);
|
||||
result = pvr_transfer_ctx_shaders_init(device, ctx);
|
||||
if (result != VK_SUCCESS)
|
||||
goto err_destroy_transfer_ctx;
|
||||
|
||||
@@ -1300,7 +1335,7 @@ err_free_pds_unitex_bos:
|
||||
}
|
||||
}
|
||||
|
||||
pvr_transfer_ctx_fini_shaders(device, ctx);
|
||||
pvr_transfer_ctx_shaders_fini(device, ctx);
|
||||
|
||||
err_destroy_transfer_ctx:
|
||||
device->ws->ops->transfer_ctx_destroy(ctx->ws_ctx);
|
||||
@@ -1327,7 +1362,7 @@ void pvr_transfer_ctx_destroy(struct pvr_transfer_ctx *const ctx)
|
||||
}
|
||||
}
|
||||
|
||||
pvr_transfer_ctx_fini_shaders(device, ctx);
|
||||
pvr_transfer_ctx_shaders_fini(device, ctx);
|
||||
device->ws->ops->transfer_ctx_destroy(ctx->ws_ctx);
|
||||
pvr_ctx_reset_cmd_fini(device, &ctx->reset_cmd);
|
||||
vk_free(&device->vk.alloc, ctx);
|
||||
|
||||
@@ -143,9 +143,7 @@ struct pvr_transfer_ctx {
|
||||
|
||||
struct pvr_winsys_transfer_ctx *ws_ctx;
|
||||
|
||||
/* Multiple on-chip render targets (MRT). */
|
||||
pvr_dev_addr_t transfer_mrts[PVR_TRANSFER_MAX_RENDER_TARGETS];
|
||||
struct pvr_bo *usc_eot_bo;
|
||||
struct pvr_bo *usc_eot_bos[PVR_TRANSFER_MAX_RENDER_TARGETS];
|
||||
|
||||
struct pvr_pds_upload pds_unitex_code[PVR_TRANSFER_MAX_TEXSTATE_DMA]
|
||||
[PVR_TRANSFER_MAX_UNIFORM_DMA];
|
||||
|
||||
@@ -1,47 +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_TRANSFER_EOT_H
|
||||
#define PVR_TRANSFER_EOT_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
static const uint8_t pvr_transfer_eot_usc_code[] = {
|
||||
0x46, 0xa0, 0x80, 0xc2, 0x80, 0x40, 0x80, 0x01, 0x88, 0x00, 0x00, 0xff,
|
||||
0x35, 0x20, 0xc0, 0x80, 0x40, 0x80, 0x01, 0x88, 0x00, 0x00, 0x02, 0x80,
|
||||
0x68, 0xff, 0x46, 0xa0, 0x80, 0xc2, 0x82, 0x40, 0x80, 0x03, 0x88, 0x00,
|
||||
0x00, 0xff, 0xcd, 0xcd, 0x35, 0x20, 0xc0, 0x80, 0x40, 0x80, 0x01, 0x88,
|
||||
0x00, 0x00, 0x02, 0x80, 0x68, 0xff, 0x35, 0x20, 0xc0, 0x82, 0x40, 0x80,
|
||||
0x03, 0x88, 0x00, 0x00, 0x02, 0x80, 0x68, 0xff, 0x46, 0xa0, 0x80, 0xc2,
|
||||
0x84, 0x40, 0x80, 0x05, 0x88, 0x00, 0x00, 0xff,
|
||||
};
|
||||
|
||||
static const uint32_t pvr_transfer_eot_usc_offsets[] = {
|
||||
0,
|
||||
12,
|
||||
40,
|
||||
};
|
||||
|
||||
#endif /* PVR_TRANSFER_EOT_H */
|
||||
Reference in New Issue
Block a user