mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 02:38:04 +02:00
pvr: Move clear VDM state into pvr_clear.h .
Signed-off-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com> Reviewed-by: Frank Binns <frank.binns@imgtec.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20055>
This commit is contained in:
parent
a70b724519
commit
4a9f23c564
4 changed files with 106 additions and 95 deletions
|
|
@ -252,3 +252,79 @@ VkResult pvr_pds_clear_rta_vertex_shader_program_create_and_upload_code(
|
|||
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
void pvr_pack_clear_vdm_state(
|
||||
const struct pvr_device_info *const dev_info,
|
||||
const struct pvr_pds_upload *const program,
|
||||
uint32_t temps,
|
||||
uint32_t index_count,
|
||||
uint32_t vs_output_size_in_bytes,
|
||||
uint32_t state_buffer[const static PVR_CLEAR_VDM_STATE_DWORD_COUNT])
|
||||
{
|
||||
const uint32_t vs_output_size =
|
||||
DIV_ROUND_UP(vs_output_size_in_bytes,
|
||||
PVRX(VDMCTRL_VDM_STATE4_VS_OUTPUT_SIZE_UNIT_SIZE));
|
||||
uint32_t *stream = state_buffer;
|
||||
uint32_t max_instances;
|
||||
uint32_t cam_size;
|
||||
|
||||
pvr_calculate_vertex_cam_size(dev_info,
|
||||
vs_output_size,
|
||||
true,
|
||||
&cam_size,
|
||||
&max_instances);
|
||||
|
||||
pvr_csb_pack (stream, VDMCTRL_VDM_STATE0, state0) {
|
||||
state0.vs_data_addr_present = true;
|
||||
state0.vs_other_present = true;
|
||||
state0.cam_size = cam_size;
|
||||
state0.uvs_scratch_size_select =
|
||||
PVRX(VDMCTRL_UVS_SCRATCH_SIZE_SELECT_FIVE);
|
||||
state0.flatshade_control = PVRX(VDMCTRL_FLATSHADE_CONTROL_VERTEX_0);
|
||||
}
|
||||
stream += pvr_cmd_length(VDMCTRL_VDM_STATE0);
|
||||
|
||||
pvr_csb_pack (stream, VDMCTRL_VDM_STATE2, state2) {
|
||||
state2.vs_pds_data_base_addr = PVR_DEV_ADDR(program->data_offset);
|
||||
}
|
||||
stream += pvr_cmd_length(VDMCTRL_VDM_STATE2);
|
||||
|
||||
pvr_csb_pack (stream, VDMCTRL_VDM_STATE3, state3) {
|
||||
state3.vs_pds_code_base_addr = PVR_DEV_ADDR(program->code_offset);
|
||||
}
|
||||
stream += pvr_cmd_length(VDMCTRL_VDM_STATE3);
|
||||
|
||||
pvr_csb_pack (stream, VDMCTRL_VDM_STATE4, state4) {
|
||||
state4.vs_output_size = vs_output_size;
|
||||
}
|
||||
stream += pvr_cmd_length(VDMCTRL_VDM_STATE4);
|
||||
|
||||
pvr_csb_pack (stream, VDMCTRL_VDM_STATE5, state5) {
|
||||
state5.vs_max_instances = max_instances;
|
||||
/* TODO: Where does the 3 * sizeof(uint32_t) come from? */
|
||||
state5.vs_usc_unified_size =
|
||||
DIV_ROUND_UP(3 * sizeof(uint32_t),
|
||||
PVRX(VDMCTRL_VDM_STATE5_VS_USC_UNIFIED_SIZE_UNIT_SIZE));
|
||||
state5.vs_pds_temp_size =
|
||||
DIV_ROUND_UP(temps,
|
||||
PVRX(VDMCTRL_VDM_STATE5_VS_PDS_TEMP_SIZE_UNIT_SIZE));
|
||||
state5.vs_pds_data_size =
|
||||
DIV_ROUND_UP(program->data_size << 2,
|
||||
PVRX(VDMCTRL_VDM_STATE5_VS_PDS_DATA_SIZE_UNIT_SIZE));
|
||||
}
|
||||
stream += pvr_cmd_length(VDMCTRL_VDM_STATE5);
|
||||
|
||||
pvr_csb_pack (stream, VDMCTRL_INDEX_LIST0, index_list0) {
|
||||
index_list0.index_count_present = true;
|
||||
index_list0.primitive_topology =
|
||||
PVRX(VDMCTRL_PRIMITIVE_TOPOLOGY_TRI_STRIP);
|
||||
}
|
||||
stream += pvr_cmd_length(VDMCTRL_INDEX_LIST0);
|
||||
|
||||
pvr_csb_pack (stream, VDMCTRL_INDEX_LIST2, index_list3) {
|
||||
index_list3.index_count = index_count;
|
||||
}
|
||||
stream += pvr_cmd_length(VDMCTRL_INDEX_LIST2);
|
||||
|
||||
assert((uint64_t)(stream - state_buffer) == PVR_CLEAR_VDM_STATE_DWORD_COUNT);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,12 +27,21 @@
|
|||
#include <stdint.h>
|
||||
#include <vulkan/vulkan_core.h>
|
||||
|
||||
#include "pvr_csb.h"
|
||||
|
||||
#define PVR_CLEAR_VERTEX_COUNT 4
|
||||
#define PVR_CLEAR_VERTEX_COORDINATES 3
|
||||
|
||||
#define PVR_CLEAR_VDM_STATE_DWORD_COUNT \
|
||||
(pvr_cmd_length(VDMCTRL_VDM_STATE0) + pvr_cmd_length(VDMCTRL_VDM_STATE2) + \
|
||||
pvr_cmd_length(VDMCTRL_VDM_STATE3) + pvr_cmd_length(VDMCTRL_VDM_STATE4) + \
|
||||
pvr_cmd_length(VDMCTRL_VDM_STATE5) + pvr_cmd_length(VDMCTRL_INDEX_LIST0) + \
|
||||
pvr_cmd_length(VDMCTRL_INDEX_LIST2))
|
||||
|
||||
struct pvr_bo;
|
||||
struct pvr_cmd_buffer;
|
||||
struct pvr_device;
|
||||
struct pvr_device_info;
|
||||
struct pvr_pds_upload;
|
||||
struct pvr_pds_vertex_shader_program;
|
||||
|
||||
|
|
@ -78,4 +87,12 @@ pvr_pds_clear_rta_vertex_shader_program_create_and_upload_data(
|
|||
pds_upload_out);
|
||||
}
|
||||
|
||||
void pvr_pack_clear_vdm_state(
|
||||
const struct pvr_device_info *const dev_info,
|
||||
const struct pvr_pds_upload *const program,
|
||||
uint32_t temps,
|
||||
uint32_t index_count,
|
||||
uint32_t vs_output_size_in_bytes,
|
||||
uint32_t state_buffer[const static PVR_CLEAR_VDM_STATE_DWORD_COUNT]);
|
||||
|
||||
#endif /* PVR_CLEAR_H */
|
||||
|
|
|
|||
|
|
@ -1684,82 +1684,6 @@ VkResult pvr_emit_ppp_from_template(
|
|||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
static void pvr_device_setup_graphics_static_clear_vdm_state(
|
||||
const struct pvr_device_info *const dev_info,
|
||||
const struct pvr_pds_upload *const program,
|
||||
uint32_t temps,
|
||||
uint32_t index_count,
|
||||
uint32_t vs_output_size_in_bytes,
|
||||
uint32_t state_buffer[const static PVR_CLEAR_VDM_STATE_DWORD_COUNT])
|
||||
{
|
||||
const uint32_t vs_output_size =
|
||||
DIV_ROUND_UP(vs_output_size_in_bytes,
|
||||
PVRX(VDMCTRL_VDM_STATE4_VS_OUTPUT_SIZE_UNIT_SIZE));
|
||||
uint32_t *stream = state_buffer;
|
||||
uint32_t max_instances;
|
||||
uint32_t cam_size;
|
||||
|
||||
pvr_calculate_vertex_cam_size(dev_info,
|
||||
vs_output_size,
|
||||
true,
|
||||
&cam_size,
|
||||
&max_instances);
|
||||
|
||||
pvr_csb_pack (stream, VDMCTRL_VDM_STATE0, state0) {
|
||||
state0.vs_data_addr_present = true;
|
||||
state0.vs_other_present = true;
|
||||
state0.cam_size = cam_size;
|
||||
state0.uvs_scratch_size_select =
|
||||
PVRX(VDMCTRL_UVS_SCRATCH_SIZE_SELECT_FIVE);
|
||||
state0.flatshade_control = PVRX(VDMCTRL_FLATSHADE_CONTROL_VERTEX_0);
|
||||
}
|
||||
stream += pvr_cmd_length(VDMCTRL_VDM_STATE0);
|
||||
|
||||
pvr_csb_pack (stream, VDMCTRL_VDM_STATE2, state2) {
|
||||
state2.vs_pds_data_base_addr = PVR_DEV_ADDR(program->data_offset);
|
||||
}
|
||||
stream += pvr_cmd_length(VDMCTRL_VDM_STATE2);
|
||||
|
||||
pvr_csb_pack (stream, VDMCTRL_VDM_STATE3, state3) {
|
||||
state3.vs_pds_code_base_addr = PVR_DEV_ADDR(program->code_offset);
|
||||
}
|
||||
stream += pvr_cmd_length(VDMCTRL_VDM_STATE3);
|
||||
|
||||
pvr_csb_pack (stream, VDMCTRL_VDM_STATE4, state4) {
|
||||
state4.vs_output_size = vs_output_size;
|
||||
}
|
||||
stream += pvr_cmd_length(VDMCTRL_VDM_STATE4);
|
||||
|
||||
pvr_csb_pack (stream, VDMCTRL_VDM_STATE5, state5) {
|
||||
state5.vs_max_instances = max_instances;
|
||||
/* TODO: Where does the 3 * sizeof(uint32_t) come from? */
|
||||
state5.vs_usc_unified_size =
|
||||
DIV_ROUND_UP(3 * sizeof(uint32_t),
|
||||
PVRX(VDMCTRL_VDM_STATE5_VS_USC_UNIFIED_SIZE_UNIT_SIZE));
|
||||
state5.vs_pds_temp_size =
|
||||
DIV_ROUND_UP(temps,
|
||||
PVRX(VDMCTRL_VDM_STATE5_VS_PDS_TEMP_SIZE_UNIT_SIZE));
|
||||
state5.vs_pds_data_size =
|
||||
DIV_ROUND_UP(program->data_size << 2,
|
||||
PVRX(VDMCTRL_VDM_STATE5_VS_PDS_DATA_SIZE_UNIT_SIZE));
|
||||
}
|
||||
stream += pvr_cmd_length(VDMCTRL_VDM_STATE5);
|
||||
|
||||
pvr_csb_pack (stream, VDMCTRL_INDEX_LIST0, index_list0) {
|
||||
index_list0.index_count_present = true;
|
||||
index_list0.primitive_topology =
|
||||
PVRX(VDMCTRL_PRIMITIVE_TOPOLOGY_TRI_STRIP);
|
||||
}
|
||||
stream += pvr_cmd_length(VDMCTRL_INDEX_LIST0);
|
||||
|
||||
pvr_csb_pack (stream, VDMCTRL_INDEX_LIST2, index_list3) {
|
||||
index_list3.index_count = index_count;
|
||||
}
|
||||
stream += pvr_cmd_length(VDMCTRL_INDEX_LIST2);
|
||||
|
||||
assert((uint64_t)(stream - state_buffer) == PVR_CLEAR_VDM_STATE_DWORD_COUNT);
|
||||
}
|
||||
|
||||
static VkResult
|
||||
pvr_device_init_graphics_static_clear_state(struct pvr_device *device)
|
||||
{
|
||||
|
|
@ -1847,21 +1771,20 @@ pvr_device_init_graphics_static_clear_state(struct pvr_device *device)
|
|||
*/
|
||||
|
||||
/* TODO: Figure out where the 4 * sizeof(uint32_t) comes from. */
|
||||
pvr_device_setup_graphics_static_clear_vdm_state(&device->pdevice->dev_info,
|
||||
&state->pds,
|
||||
pds_program.temps_used,
|
||||
3,
|
||||
4 * sizeof(uint32_t),
|
||||
state->vdm_words);
|
||||
pvr_pack_clear_vdm_state(&device->pdevice->dev_info,
|
||||
&state->pds,
|
||||
pds_program.temps_used,
|
||||
3,
|
||||
4 * sizeof(uint32_t),
|
||||
state->vdm_words);
|
||||
|
||||
/* TODO: Figure out where the 4 * sizeof(uint32_t) comes from. */
|
||||
pvr_device_setup_graphics_static_clear_vdm_state(
|
||||
&device->pdevice->dev_info,
|
||||
&state->pds,
|
||||
pds_program.temps_used,
|
||||
4,
|
||||
4 * sizeof(uint32_t),
|
||||
state->large_clear_vdm_words);
|
||||
pvr_pack_clear_vdm_state(&device->pdevice->dev_info,
|
||||
&state->pds,
|
||||
pds_program.temps_used,
|
||||
4,
|
||||
4 * sizeof(uint32_t),
|
||||
state->large_clear_vdm_words);
|
||||
|
||||
return VK_SUCCESS;
|
||||
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@
|
|||
|
||||
#include "compiler/shader_enums.h"
|
||||
#include "hwdef/rogue_hw_defs.h"
|
||||
#include "pvr_clear.h"
|
||||
#include "pvr_csb.h"
|
||||
#include "pvr_device_info.h"
|
||||
#include "pvr_entrypoints.h"
|
||||
|
|
@ -343,12 +344,6 @@ struct pvr_static_clear_ppp_template {
|
|||
} config;
|
||||
};
|
||||
|
||||
#define PVR_CLEAR_VDM_STATE_DWORD_COUNT \
|
||||
(pvr_cmd_length(VDMCTRL_VDM_STATE0) + pvr_cmd_length(VDMCTRL_VDM_STATE2) + \
|
||||
pvr_cmd_length(VDMCTRL_VDM_STATE3) + pvr_cmd_length(VDMCTRL_VDM_STATE4) + \
|
||||
pvr_cmd_length(VDMCTRL_VDM_STATE5) + pvr_cmd_length(VDMCTRL_INDEX_LIST0) + \
|
||||
pvr_cmd_length(VDMCTRL_INDEX_LIST2))
|
||||
|
||||
struct pvr_compute_query_shader {
|
||||
struct pvr_bo *usc_bo;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue