pvr: Restrict argument to dev_info where possible.

Avoid passing whole device structure. In most of the cases
we only need dev_info from device pointer to check for
features and ERNs.
This commits simply avoids the need to carry device pointer
where ever we go.

Signed-off-by: Rajnesh Kanwal <rajnesh.kanwal@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16897>
This commit is contained in:
Rajnesh Kanwal 2022-05-16 16:37:32 +01:00
parent 4b6c18fea8
commit 2d0f49534f
3 changed files with 16 additions and 16 deletions

View file

@ -696,7 +696,7 @@ static inline uint32_t pvr_stride_from_pitch(uint32_t pitch, VkFormat vk_format)
}
static void pvr_setup_pbe_state(
struct pvr_device *const device,
const struct pvr_device_info *dev_info,
struct pvr_framebuffer *framebuffer,
uint32_t mrt_index,
const struct usc_mrt_resource *mrt_resource,
@ -707,7 +707,6 @@ static void pvr_setup_pbe_state(
uint32_t pbe_cs_words[static const ROGUE_NUM_PBESTATE_STATE_WORDS],
uint64_t pbe_reg_words[static const ROGUE_NUM_PBESTATE_REG_WORDS])
{
const struct pvr_device_info *dev_info = &device->pdevice->dev_info;
const struct pvr_image *image = iview->image;
uint32_t level_pitch = image->mip_levels[iview->vk.base_mip_level].pitch;
@ -817,7 +816,7 @@ static void pvr_setup_pbe_state(
render_params.slice = 0;
render_params.mrt_index = mrt_index;
pvr_pbe_pack_state(device,
pvr_pbe_pack_state(dev_info,
&surface_params,
&render_params,
pbe_cs_words,
@ -867,11 +866,10 @@ pvr_pass_get_pixel_output_width(const struct pvr_render_pass *pass,
return util_next_power_of_two(width);
}
static VkResult pvr_sub_cmd_gfx_job_init(struct pvr_device *device,
static VkResult pvr_sub_cmd_gfx_job_init(const struct pvr_device_info *dev_info,
struct pvr_cmd_buffer *cmd_buffer,
struct pvr_sub_cmd *sub_cmd)
{
const struct pvr_device_info *dev_info = &device->pdevice->dev_info;
struct pvr_render_pass_info *render_pass_info =
&cmd_buffer->state.render_pass_info;
const struct pvr_renderpass_hwsetup_render *hw_render =
@ -898,7 +896,7 @@ static VkResult pvr_sub_cmd_gfx_job_init(struct pvr_device *device,
if (surface->need_resolve)
pvr_finishme("Set up job resolve information.");
pvr_setup_pbe_state(device,
pvr_setup_pbe_state(dev_info,
render_pass_info->framebuffer,
surface->mrt_index,
mrt_resource,
@ -1064,12 +1062,10 @@ static VkResult pvr_sub_cmd_gfx_job_init(struct pvr_device *device,
*/
#define PVR_IDF_WDF_IN_REGISTER_CONST_COUNT 12U
static void pvr_sub_cmd_compute_job_init(struct pvr_device *device,
static void pvr_sub_cmd_compute_job_init(const struct pvr_device_info *dev_info,
struct pvr_cmd_buffer *cmd_buffer,
struct pvr_sub_cmd *sub_cmd)
{
const struct pvr_device_info *dev_info = &device->pdevice->dev_info;
if (sub_cmd->compute.uses_barrier) {
sub_cmd->compute.submit_info.flags |=
PVR_WINSYS_COMPUTE_FLAG_PREVENT_ALL_OVERLAP;
@ -1391,7 +1387,9 @@ static VkResult pvr_cmd_buffer_end_sub_cmd(struct pvr_cmd_buffer *cmd_buffer)
return result;
}
result = pvr_sub_cmd_gfx_job_init(device, cmd_buffer, sub_cmd);
result = pvr_sub_cmd_gfx_job_init(&device->pdevice->dev_info,
cmd_buffer,
sub_cmd);
if (result != VK_SUCCESS) {
state->status = result;
return result;
@ -1408,7 +1406,9 @@ static VkResult pvr_cmd_buffer_end_sub_cmd(struct pvr_cmd_buffer *cmd_buffer)
return result;
}
pvr_sub_cmd_compute_job_init(device, cmd_buffer, sub_cmd);
pvr_sub_cmd_compute_job_init(&device->pdevice->dev_info,
cmd_buffer,
sub_cmd);
break;
case PVR_SUB_CMD_TYPE_TRANSFER:

View file

@ -104,7 +104,7 @@ void pvr_pbe_get_src_format_and_gamma(VkFormat vk_format,
}
}
static void pvr_pbe_get_src_pos(struct pvr_device *device,
static void pvr_pbe_get_src_pos(const struct pvr_device_info *dev_info,
enum pvr_pbe_source_start_pos source_start,
uint32_t *const src_pos_out,
bool *const src_pos_offset_128_out)
@ -126,7 +126,7 @@ static void pvr_pbe_get_src_pos(struct pvr_device *device,
case PVR_PBE_STARTPOS_BIT0:
default:
if (PVR_HAS_FEATURE(&device->pdevice->dev_info, eight_output_registers)) {
if (PVR_HAS_FEATURE(dev_info, eight_output_registers)) {
switch (source_start) {
case PVR_PBE_STARTPOS_BIT128:
*src_pos_out = PVRX(PBESTATE_SOURCE_POS_START_BIT0);
@ -160,7 +160,7 @@ static void pvr_pbe_get_src_pos(struct pvr_device *device,
}
void pvr_pbe_pack_state(
struct pvr_device *device,
const struct pvr_device_info *dev_info,
const struct pvr_pbe_surf_params *surface_params,
const struct pvr_pbe_render_params *render_params,
uint32_t pbe_cs_words[static const ROGUE_NUM_PBESTATE_STATE_WORDS],
@ -201,7 +201,7 @@ void pvr_pbe_pack_state(
state.source_format = surface_params->source_format;
pvr_pbe_get_src_pos(device,
pvr_pbe_get_src_pos(dev_info,
render_params->source_start,
&state.source_pos,
&state.source_pos_offset_128);

View file

@ -125,7 +125,7 @@ struct pvr_pbe_render_params {
};
void pvr_pbe_pack_state(
struct pvr_device *device,
const struct pvr_device_info *dev_info,
const struct pvr_pbe_surf_params *surface_params,
const struct pvr_pbe_render_params *render_params,
uint32_t pbe_cs_words[static const ROGUE_NUM_PBESTATE_STATE_WORDS],