diff --git a/src/imagination/vulkan/pvr_csb_enum_helpers.h b/src/imagination/vulkan/pvr_csb_enum_helpers.h index 5a4d525bbad..55c0dac1bae 100644 --- a/src/imagination/vulkan/pvr_csb_enum_helpers.h +++ b/src/imagination/vulkan/pvr_csb_enum_helpers.h @@ -91,6 +91,49 @@ pvr_pdsinst_doutu_sample_rate_from_rogue(enum rogue_msaa_mode msaa_mode) } } +/****************************************************************************** + PBESTATE + ******************************************************************************/ + +enum pvr_pbe_source_start_pos { + PVR_PBE_STARTPOS_BIT0, + PVR_PBE_STARTPOS_BIT32, + PVR_PBE_STARTPOS_BIT64, + PVR_PBE_STARTPOS_BIT96, + /* The below values are available if has_eight_output_registers feature is + * enabled. + */ + PVR_PBE_STARTPOS_BIT128, + PVR_PBE_STARTPOS_BIT160, + PVR_PBE_STARTPOS_BIT192, + PVR_PBE_STARTPOS_BIT224, +}; + +static inline enum ROGUE_PBESTATE_SOURCE_POS +pvr_pbestate_source_pos(enum pvr_pbe_source_start_pos pos) +{ + switch (pos) { + case PVR_PBE_STARTPOS_BIT0: + case PVR_PBE_STARTPOS_BIT128: + return ROGUE_PBESTATE_SOURCE_POS_START_BIT0; + + case PVR_PBE_STARTPOS_BIT32: + case PVR_PBE_STARTPOS_BIT160: + return ROGUE_PBESTATE_SOURCE_POS_START_BIT32; + + case PVR_PBE_STARTPOS_BIT64: + case PVR_PBE_STARTPOS_BIT192: + return ROGUE_PBESTATE_SOURCE_POS_START_BIT64; + + case PVR_PBE_STARTPOS_BIT96: + case PVR_PBE_STARTPOS_BIT224: + return ROGUE_PBESTATE_SOURCE_POS_START_BIT96; + + default: + unreachable("Undefined PBE source pos."); + } +} + /****************************************************************************** TA ******************************************************************************/ diff --git a/src/imagination/vulkan/pvr_job_common.c b/src/imagination/vulkan/pvr_job_common.c index fb8f31b98d7..6e47b751fdd 100644 --- a/src/imagination/vulkan/pvr_job_common.c +++ b/src/imagination/vulkan/pvr_job_common.c @@ -26,6 +26,7 @@ #include "hwdef/rogue_hw_defs.h" #include "hwdef/rogue_hw_utils.h" +#include "pvr_csb_enum_helpers.h" #include "pvr_device_info.h" #include "pvr_job_common.h" #include "pvr_private.h" @@ -201,10 +202,13 @@ void pvr_pbe_pack_state( state.source_format = surface_params->source_format; - pvr_pbe_get_src_pos(dev_info, - render_params->source_start, - &state.source_pos, - &state.source_pos_offset_128); + state.source_pos = pvr_pbestate_source_pos(render_params->source_start); + if (PVR_HAS_FEATURE(dev_info, eight_output_registers)) { + state.source_pos_offset_128 = render_params->source_start >= + PVR_PBE_STARTPOS_BIT128; + } else { + assert(render_params->source_start < PVR_PBE_STARTPOS_BIT128); + } /* MRT index (Use 0 for a single render target)/ */ state.mrt_index = render_params->mrt_index; diff --git a/src/imagination/vulkan/pvr_job_common.h b/src/imagination/vulkan/pvr_job_common.h index 88a39503e07..8bba8f88ea5 100644 --- a/src/imagination/vulkan/pvr_job_common.h +++ b/src/imagination/vulkan/pvr_job_common.h @@ -29,6 +29,7 @@ #include #include "hwdef/rogue_hw_defs.h" +#include "pvr_csb_enum_helpers.h" #include "pvr_private.h" #include "pvr_types.h" @@ -41,20 +42,6 @@ enum pvr_pbe_gamma { PVR_PBE_GAMMA_ENABLED, }; -enum pvr_pbe_source_start_pos { - PVR_PBE_STARTPOS_BIT0, - PVR_PBE_STARTPOS_BIT32, - PVR_PBE_STARTPOS_BIT64, - PVR_PBE_STARTPOS_BIT96, - /* The below ones are available if has_eight_output_registers feature is - * enabled. - */ - PVR_PBE_STARTPOS_BIT128, - PVR_PBE_STARTPOS_BIT160, - PVR_PBE_STARTPOS_BIT192, - PVR_PBE_STARTPOS_BIT224, -}; - /** * These are parameters specific to the surface being set up and hence can be * typically set up at surface creation time.