pvr: Transfer optimisation remove unused features from API
The transfer command "struct pvr_transfer_cmd" has support for features not used by Vulkan: colour key, pattern, rop blit and alpha blending The whole "struct pvr_transfer_blit" can be removed. Also all code related to transfer alpha blending can be removed. This is an optimisation and doesn't fix any dEQP tests. Signed-off-by: Oskar Rundgren <oskar.rundgren@imgtec.com> Reviewed-by: Frank Binns <frank.binns@imgtec.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22958>
This commit is contained in:
parent
f142eae05f
commit
9e91e06d45
8 changed files with 11 additions and 132 deletions
|
|
@ -169,16 +169,6 @@ enum pvr_resolve_op {
|
|||
PVR_RESOLVE_SAMPLE7,
|
||||
};
|
||||
|
||||
enum pvr_alpha_type {
|
||||
PVR_ALPHA_NONE,
|
||||
PVR_ALPHA_SOURCE,
|
||||
PVR_ALPHA_PREMUL_SOURCE,
|
||||
PVR_ALPHA_GLOBAL,
|
||||
PVR_ALPHA_PREMUL_SOURCE_WITH_GLOBAL,
|
||||
PVR_ALPHA_CUSTOM,
|
||||
PVR_ALPHA_AATEXT,
|
||||
};
|
||||
|
||||
enum pvr_event_state {
|
||||
PVR_EVENT_STATE_SET_BY_HOST,
|
||||
PVR_EVENT_STATE_RESET_BY_HOST,
|
||||
|
|
|
|||
|
|
@ -1038,20 +1038,8 @@ bool pvr_format_is_pbe_downscalable(VkFormat vk_format)
|
|||
}
|
||||
}
|
||||
|
||||
uint32_t pvr_pbe_pixel_num_loads(enum pvr_transfer_pbe_pixel_src pbe_format,
|
||||
uint32_t alpha_type)
|
||||
uint32_t pvr_pbe_pixel_num_loads(enum pvr_transfer_pbe_pixel_src pbe_format)
|
||||
{
|
||||
switch (alpha_type) {
|
||||
default:
|
||||
case PVR_ALPHA_NONE:
|
||||
break;
|
||||
case PVR_ALPHA_SOURCE:
|
||||
case PVR_ALPHA_PREMUL_SOURCE:
|
||||
case PVR_ALPHA_PREMUL_SOURCE_WITH_GLOBAL:
|
||||
case PVR_ALPHA_GLOBAL:
|
||||
return 2U;
|
||||
}
|
||||
|
||||
switch (pbe_format) {
|
||||
case PVR_TRANSFER_PBE_PIXEL_SRC_UU8888:
|
||||
case PVR_TRANSFER_PBE_PIXEL_SRC_US8888:
|
||||
|
|
|
|||
|
|
@ -220,13 +220,6 @@ void pvr_get_hw_clear_color(VkFormat vk_format,
|
|||
VkClearColorValue value,
|
||||
uint32_t packed_out[static const 4]);
|
||||
|
||||
/* TODO: alpha_type is of 'enum pvr_int_pbe_pixel_num_loads' type. See if we can
|
||||
* move that in here. It's currently in pvr_common.h and it doesn't seem
|
||||
* appropriate including that in here. Also moving the definition in here would
|
||||
* make pvr_common.h include this which would mean that the compiler would be
|
||||
* pulling in vulkan specific format stuff.
|
||||
*/
|
||||
uint32_t pvr_pbe_pixel_num_loads(enum pvr_transfer_pbe_pixel_src pbe_format,
|
||||
uint32_t alpha_type);
|
||||
uint32_t pvr_pbe_pixel_num_loads(enum pvr_transfer_pbe_pixel_src pbe_format);
|
||||
|
||||
#endif /* PVR_FORMATS_H */
|
||||
|
|
|
|||
|
|
@ -1459,15 +1459,14 @@ static void pvr_uv_space(const struct pvr_device_info *dev_info,
|
|||
}
|
||||
|
||||
static uint32_t pvr_int_pbe_pixel_num_sampler_and_image_states(
|
||||
enum pvr_transfer_pbe_pixel_src pbe_format,
|
||||
uint32_t alpha_type)
|
||||
enum pvr_transfer_pbe_pixel_src pbe_format)
|
||||
{
|
||||
switch (pbe_format) {
|
||||
case PVR_TRANSFER_PBE_PIXEL_SRC_Y_UV_INTERLEAVED:
|
||||
case PVR_TRANSFER_PBE_PIXEL_SRC_Y_U_V:
|
||||
return 1U;
|
||||
default:
|
||||
return pvr_pbe_pixel_num_loads(pbe_format, alpha_type);
|
||||
return pvr_pbe_pixel_num_loads(pbe_format);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1663,9 +1662,7 @@ pvr_sampler_image_state(struct pvr_transfer_ctx *ctx,
|
|||
for (uint32_t source = 0; source < transfer_cmd->source_count; source++) {
|
||||
struct pvr_tq_layer_properties *layer =
|
||||
&state->shader_props.layer_props;
|
||||
uint32_t max_load =
|
||||
pvr_pbe_pixel_num_loads(layer->pbe_format,
|
||||
state->shader_props.alpha_type);
|
||||
uint32_t max_load = pvr_pbe_pixel_num_loads(layer->pbe_format);
|
||||
|
||||
for (uint32_t load = 0U; load < max_load; load++) {
|
||||
const struct pvr_transfer_cmd_surface *surface;
|
||||
|
|
@ -1685,11 +1682,7 @@ pvr_sampler_image_state(struct pvr_transfer_ctx *ctx,
|
|||
case PVR_TRANSFER_PBE_PIXEL_SRC_F16_U8:
|
||||
if (load > 0U) {
|
||||
surface = &transfer_cmd->dst;
|
||||
|
||||
if (state->shader_props.alpha_type != PVR_ALPHA_NONE)
|
||||
filter = PVR_FILTER_POINT;
|
||||
else
|
||||
filter = transfer_cmd->sources[source].filter;
|
||||
filter = transfer_cmd->sources[source].filter;
|
||||
} else {
|
||||
surface = &transfer_cmd->sources[source].surface;
|
||||
filter = state->filter[source];
|
||||
|
|
@ -1709,8 +1702,7 @@ pvr_sampler_image_state(struct pvr_transfer_ctx *ctx,
|
|||
}
|
||||
|
||||
if (load < pvr_int_pbe_pixel_num_sampler_and_image_states(
|
||||
layer->pbe_format,
|
||||
state->shader_props.alpha_type)) {
|
||||
layer->pbe_format)) {
|
||||
const struct pvr_device_info *dev_info =
|
||||
&transfer_cmd->cmd_buffer->device->pdevice->dev_info;
|
||||
|
||||
|
|
@ -1758,17 +1750,6 @@ static inline uint32_t pvr_dynamic_const_reg_advance(
|
|||
return offset + state->dynamic_const_reg_ptr++;
|
||||
}
|
||||
|
||||
static inline void
|
||||
pvr_dma_global_alpha(const struct pvr_transfer_alpha *alpha,
|
||||
struct pvr_transfer_3d_state *state,
|
||||
const struct pvr_tq_frag_sh_reg_layout *sh_reg_layout,
|
||||
uint32_t *mem_ptr)
|
||||
{
|
||||
float global = (float)alpha->global / 255.0f;
|
||||
|
||||
mem_ptr[pvr_dynamic_const_reg_advance(sh_reg_layout, state)] = fui(global);
|
||||
}
|
||||
|
||||
/** Scales coefficients for sampling. (non normalized). */
|
||||
static inline void
|
||||
pvr_dma_texture_floats(const struct pvr_transfer_cmd *transfer_cmd,
|
||||
|
|
@ -2779,15 +2760,6 @@ static VkResult pvr_3d_copy_blit_core(struct pvr_transfer_ctx *ctx,
|
|||
|
||||
state->shader_props.pick_component =
|
||||
pvr_pick_component_needed(&state->custom_mapping);
|
||||
state->shader_props.alpha_type = transfer_cmd->blit.alpha.type;
|
||||
|
||||
if (state->shader_props.alpha_type != PVR_ALPHA_NONE &&
|
||||
(state->shader_props.layer_props.pbe_format !=
|
||||
PVR_TRANSFER_PBE_PIXEL_SRC_F16F16 &&
|
||||
state->shader_props.layer_props.pbe_format !=
|
||||
PVR_TRANSFER_PBE_PIXEL_SRC_F16_U8)) {
|
||||
return vk_error(device, VK_ERROR_FORMAT_NOT_SUPPORTED);
|
||||
}
|
||||
|
||||
if (state->filter[0] == PVR_FILTER_LINEAR &&
|
||||
pvr_requires_usc_linear_filter(
|
||||
|
|
@ -2849,15 +2821,6 @@ static VkResult pvr_3d_copy_blit_core(struct pvr_transfer_ctx *ctx,
|
|||
if (result != VK_SUCCESS)
|
||||
return result;
|
||||
|
||||
if (state->shader_props.alpha_type == PVR_ALPHA_GLOBAL ||
|
||||
state->shader_props.alpha_type ==
|
||||
PVR_ALPHA_PREMUL_SOURCE_WITH_GLOBAL) {
|
||||
pvr_dma_global_alpha(&transfer_cmd->blit.alpha,
|
||||
state,
|
||||
sh_reg_layout,
|
||||
dma_space);
|
||||
}
|
||||
|
||||
pvr_dma_texture_floats(transfer_cmd, state, sh_reg_layout, dma_space);
|
||||
|
||||
if (transfer_cmd->sources[0].surface.mem_layout ==
|
||||
|
|
@ -4515,8 +4478,6 @@ static VkResult pvr_3d_clip_blit(struct pvr_transfer_ctx *ctx,
|
|||
~(PVR_TRANSFER_CMD_FLAGS_FAST2D | PVR_TRANSFER_CMD_FLAGS_FILL |
|
||||
PVR_TRANSFER_CMD_FLAGS_DSMERGE | PVR_TRANSFER_CMD_FLAGS_PICKD);
|
||||
|
||||
memset(&bg_cmd.blit, 0U, sizeof(bg_cmd.blit));
|
||||
|
||||
bg_cmd.source_count = state->custom_mapping.pass_count > 0U ? 0 : 1;
|
||||
if (bg_cmd.source_count > 0) {
|
||||
struct pvr_transfer_cmd_source *src = &bg_cmd.sources[0];
|
||||
|
|
@ -5474,12 +5435,8 @@ static VkResult pvr_reroute_to_clip(struct pvr_transfer_ctx *ctx,
|
|||
uint32_t pass_idx,
|
||||
bool *finished_out)
|
||||
{
|
||||
const struct pvr_transfer_blit *blit = &transfer_cmd->blit;
|
||||
struct pvr_transfer_cmd clip_transfer_cmd;
|
||||
|
||||
if (blit->alpha.type != PVR_ALPHA_NONE)
|
||||
return vk_error(ctx->device, VK_ERROR_FORMAT_NOT_SUPPORTED);
|
||||
|
||||
clip_transfer_cmd = *transfer_cmd;
|
||||
clip_transfer_cmd.flags |= PVR_TRANSFER_CMD_FLAGS_FAST2D;
|
||||
|
||||
|
|
@ -5506,7 +5463,6 @@ static VkResult pvr_3d_copy_blit(struct pvr_transfer_ctx *ctx,
|
|||
const struct pvr_device_info *const dev_info =
|
||||
&ctx->device->pdevice->dev_info;
|
||||
|
||||
const struct pvr_transfer_blit *blit = &transfer_cmd->blit;
|
||||
struct pvr_transfer_3d_state *state = &prep_data->state;
|
||||
struct pvr_transfer_cmd *active_cmd = transfer_cmd;
|
||||
struct pvr_transfer_cmd int_cmd;
|
||||
|
|
@ -5528,8 +5484,7 @@ static VkResult pvr_3d_copy_blit(struct pvr_transfer_ctx *ctx,
|
|||
if (src->surface.vk_format == transfer_cmd->dst.vk_format &&
|
||||
state->filter[0] == PVR_FILTER_POINT &&
|
||||
src->surface.sample_count <= transfer_cmd->dst.sample_count &&
|
||||
(transfer_cmd->flags & PVR_TRANSFER_CMD_FLAGS_DSMERGE) == 0U &&
|
||||
transfer_cmd->blit.alpha.type == PVR_ALPHA_NONE) {
|
||||
(transfer_cmd->flags & PVR_TRANSFER_CMD_FLAGS_DSMERGE) == 0U) {
|
||||
uint32_t bpp;
|
||||
|
||||
int_cmd = *transfer_cmd;
|
||||
|
|
@ -5583,9 +5538,6 @@ static VkResult pvr_3d_copy_blit(struct pvr_transfer_ctx *ctx,
|
|||
if (state->custom_mapping.pass_count > 0U) {
|
||||
struct pvr_transfer_pass *pass = &state->custom_mapping.passes[pass_idx];
|
||||
|
||||
if (blit->alpha.type != PVR_ALPHA_NONE)
|
||||
return vk_error(ctx->device, VK_ERROR_FORMAT_NOT_SUPPORTED);
|
||||
|
||||
if (active_cmd != &int_cmd) {
|
||||
int_cmd = *active_cmd;
|
||||
active_cmd = &int_cmd;
|
||||
|
|
|
|||
|
|
@ -398,44 +398,6 @@ struct pvr_rect_mapping {
|
|||
bool flip_y;
|
||||
};
|
||||
|
||||
/* Describes an Alpha-Transparency configuration - for Transfer Queue Use. */
|
||||
struct pvr_transfer_alpha {
|
||||
enum pvr_alpha_type type;
|
||||
/* Global alpha value. */
|
||||
uint32_t global;
|
||||
|
||||
/* Custom blend op for rgb. */
|
||||
uint32_t custom_rgb;
|
||||
/* Custom blend op for alpha. */
|
||||
uint32_t custom_alpha;
|
||||
/* Custom global alpha value for alpha output. */
|
||||
uint32_t global2;
|
||||
/* Custom multiplication of global and source alpha. */
|
||||
bool glob_src_mul;
|
||||
/* Custom zero source alpha transparency stage. */
|
||||
bool zero_src_a_trans;
|
||||
|
||||
/* Enable argb1555 alpha components. */
|
||||
bool alpha_components;
|
||||
/* Source alpha value when argb1555 alpha bit is 0. */
|
||||
uint32_t component0;
|
||||
/* Source alpha value when argb1555 alpha bit is 1. */
|
||||
uint32_t component1;
|
||||
};
|
||||
|
||||
struct pvr_transfer_blit {
|
||||
/* 16 bit rop4 (ie two 8 bit rop3's). */
|
||||
uint32_t rop_code;
|
||||
|
||||
/* Color key mask. */
|
||||
uint32_t color_mask;
|
||||
|
||||
/* Alpha blend. */
|
||||
struct pvr_transfer_alpha alpha;
|
||||
|
||||
VkOffset2D offset;
|
||||
};
|
||||
|
||||
struct pvr_transfer_cmd_source {
|
||||
struct pvr_transfer_cmd_surface surface;
|
||||
|
||||
|
|
@ -473,8 +435,6 @@ struct pvr_transfer_cmd {
|
|||
|
||||
VkRect2D scissor;
|
||||
|
||||
struct pvr_transfer_blit blit;
|
||||
|
||||
/* Pointer to cmd buffer this transfer cmd belongs to. This is mainly used
|
||||
* to link buffer objects allocated during job submission into
|
||||
* cmd_buffer::bo_list head.
|
||||
|
|
|
|||
|
|
@ -161,7 +161,8 @@ static uint32_t pvr_transfer_frag_shader_key(
|
|||
hash |= 1;
|
||||
|
||||
shift_hash(hash, 3U);
|
||||
hash |= shader_props->alpha_type;
|
||||
/* alpha type none */
|
||||
hash |= 0;
|
||||
|
||||
#undef shift_hash
|
||||
|
||||
|
|
|
|||
|
|
@ -49,9 +49,6 @@ struct pvr_tq_shader_properties {
|
|||
/* Sample specific channel of pixel. */
|
||||
bool pick_component;
|
||||
|
||||
/* Alpha type from transfer API. */
|
||||
uint32_t alpha_type;
|
||||
|
||||
struct pvr_tq_layer_properties {
|
||||
/* Controls whether we need to send the sample count to the TPU. */
|
||||
bool msaa;
|
||||
|
|
|
|||
|
|
@ -63,7 +63,6 @@ void pvr_uscgen_tq_frag(const struct pvr_tq_shader_properties *shader_props,
|
|||
/* TODO: Unrestrict. */
|
||||
assert(shader_props->full_rate == false);
|
||||
assert(shader_props->pick_component == false);
|
||||
assert(shader_props->alpha_type == 0);
|
||||
|
||||
const struct pvr_tq_layer_properties *layer_props =
|
||||
&shader_props->layer_props;
|
||||
|
|
@ -80,8 +79,7 @@ void pvr_uscgen_tq_frag(const struct pvr_tq_shader_properties *shader_props,
|
|||
assert(layer_props->byte_unwind == 0);
|
||||
assert(layer_props->linear == false);
|
||||
|
||||
loads = pvr_pbe_pixel_num_loads(layer_props->pbe_format,
|
||||
shader_props->alpha_type);
|
||||
loads = pvr_pbe_pixel_num_loads(layer_props->pbe_format);
|
||||
for (uint32_t load = 0; load < loads; ++load) {
|
||||
if (shader_props->iterated) {
|
||||
/* TODO: feed{back,forward} the coeff index to/from shader_info. */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue