pvr: HWRT creation simplifications.
Signed-off-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com> Reviewed-by: Matt Coster <matt.coster@imgtec.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20092>
This commit is contained in:
@@ -75,33 +75,6 @@ struct pvr_free_list {
|
||||
struct pvr_winsys_free_list *ws_free_list;
|
||||
};
|
||||
|
||||
/* Macrotile information. */
|
||||
struct pvr_rt_mtile_info {
|
||||
uint32_t tile_size_x;
|
||||
uint32_t tile_size_y;
|
||||
|
||||
uint32_t num_tiles_x;
|
||||
uint32_t num_tiles_y;
|
||||
|
||||
uint32_t tiles_per_mtile_x;
|
||||
uint32_t tiles_per_mtile_y;
|
||||
|
||||
uint32_t x_tile_max;
|
||||
uint32_t y_tile_max;
|
||||
|
||||
uint32_t mtiles_x;
|
||||
uint32_t mtiles_y;
|
||||
|
||||
uint32_t mtile_x1;
|
||||
uint32_t mtile_y1;
|
||||
uint32_t mtile_x2;
|
||||
uint32_t mtile_y2;
|
||||
uint32_t mtile_x3;
|
||||
uint32_t mtile_y3;
|
||||
|
||||
uint32_t mtile_stride;
|
||||
};
|
||||
|
||||
struct pvr_rt_dataset {
|
||||
struct pvr_device *device;
|
||||
|
||||
@@ -310,13 +283,12 @@ static inline void pvr_get_samples_in_xy(uint32_t samples,
|
||||
}
|
||||
}
|
||||
|
||||
static void pvr_rt_mtile_info_init(struct pvr_device *device,
|
||||
struct pvr_rt_mtile_info *info,
|
||||
uint32_t width,
|
||||
uint32_t height,
|
||||
uint32_t samples)
|
||||
void pvr_rt_mtile_info_init(const struct pvr_device_info *dev_info,
|
||||
struct pvr_rt_mtile_info *info,
|
||||
uint32_t width,
|
||||
uint32_t height,
|
||||
uint32_t samples)
|
||||
{
|
||||
const struct pvr_device_info *dev_info = &device->pdevice->dev_info;
|
||||
uint32_t samples_in_x;
|
||||
uint32_t samples_in_y;
|
||||
|
||||
@@ -359,8 +331,6 @@ static void pvr_rt_mtile_info_init(struct pvr_device *device,
|
||||
|
||||
info->tiles_per_mtile_x = info->mtile_x1 * samples_in_x;
|
||||
info->tiles_per_mtile_y = info->mtile_y1 * samples_in_y;
|
||||
|
||||
info->mtile_stride = info->mtile_x1 * info->mtile_y1;
|
||||
}
|
||||
|
||||
/* Note that the unit of the return value depends on the GPU. For cores with the
|
||||
@@ -766,174 +736,6 @@ static void pvr_rt_datas_fini(struct pvr_rt_dataset *rt_dataset)
|
||||
pvr_rt_mta_mlist_data_fini(rt_dataset);
|
||||
}
|
||||
|
||||
static uint32_t
|
||||
pvr_rogue_get_cr_isp_mtile_size_val(const struct pvr_device_info *dev_info,
|
||||
uint32_t samples,
|
||||
const struct pvr_rt_mtile_info *mtile_info)
|
||||
{
|
||||
uint32_t samples_per_pixel =
|
||||
PVR_GET_FEATURE_VALUE(dev_info, isp_samples_per_pixel, 0);
|
||||
uint32_t isp_mtile_size;
|
||||
|
||||
pvr_csb_pack (&isp_mtile_size, CR_ISP_MTILE_SIZE, value) {
|
||||
value.x = mtile_info->mtile_x1;
|
||||
value.y = mtile_info->mtile_y1;
|
||||
|
||||
if (samples_per_pixel == 1) {
|
||||
if (samples >= 4)
|
||||
value.x <<= 1;
|
||||
|
||||
if (samples >= 2)
|
||||
value.y <<= 1;
|
||||
} else if (samples_per_pixel == 2) {
|
||||
if (samples >= 8)
|
||||
value.x <<= 1;
|
||||
|
||||
if (samples >= 4)
|
||||
value.y <<= 1;
|
||||
} else if (samples_per_pixel == 4) {
|
||||
if (samples >= 8)
|
||||
value.y <<= 1;
|
||||
} else {
|
||||
assert(!"Unsupported ISP samples per pixel value");
|
||||
}
|
||||
}
|
||||
|
||||
return isp_mtile_size;
|
||||
}
|
||||
|
||||
static uint64_t pvr_rogue_get_cr_multisamplectl_val(uint32_t samples,
|
||||
bool y_flip)
|
||||
{
|
||||
static const struct {
|
||||
uint8_t x[8];
|
||||
uint8_t y[8];
|
||||
} sample_positions[4] = {
|
||||
/* 1 sample */
|
||||
{
|
||||
.x = { 8 },
|
||||
.y = { 8 },
|
||||
},
|
||||
/* 2 samples */
|
||||
{
|
||||
.x = { 12, 4 },
|
||||
.y = { 12, 4 },
|
||||
},
|
||||
/* 4 samples */
|
||||
{
|
||||
.x = { 6, 14, 2, 10 },
|
||||
.y = { 2, 6, 10, 14 },
|
||||
},
|
||||
/* 8 samples */
|
||||
{
|
||||
.x = { 9, 7, 13, 5, 3, 1, 11, 15 },
|
||||
.y = { 5, 11, 9, 3, 13, 7, 15, 1 },
|
||||
},
|
||||
};
|
||||
uint64_t multisamplectl;
|
||||
uint8_t idx;
|
||||
|
||||
idx = util_fast_log2(samples);
|
||||
assert(idx < ARRAY_SIZE(sample_positions));
|
||||
|
||||
pvr_csb_pack (&multisamplectl, CR_PPP_MULTISAMPLECTL, value) {
|
||||
switch (samples) {
|
||||
case 8:
|
||||
value.msaa_x7 = sample_positions[idx].x[7];
|
||||
value.msaa_x6 = sample_positions[idx].x[6];
|
||||
value.msaa_x5 = sample_positions[idx].x[5];
|
||||
value.msaa_x4 = sample_positions[idx].x[4];
|
||||
|
||||
if (y_flip) {
|
||||
value.msaa_y7 = 16U - sample_positions[idx].y[7];
|
||||
value.msaa_y6 = 16U - sample_positions[idx].y[6];
|
||||
value.msaa_y5 = 16U - sample_positions[idx].y[5];
|
||||
value.msaa_y4 = 16U - sample_positions[idx].y[4];
|
||||
} else {
|
||||
value.msaa_y7 = sample_positions[idx].y[7];
|
||||
value.msaa_y6 = sample_positions[idx].y[6];
|
||||
value.msaa_y5 = sample_positions[idx].y[5];
|
||||
value.msaa_y4 = sample_positions[idx].y[4];
|
||||
}
|
||||
|
||||
FALLTHROUGH;
|
||||
case 4:
|
||||
value.msaa_x3 = sample_positions[idx].x[3];
|
||||
value.msaa_x2 = sample_positions[idx].x[2];
|
||||
|
||||
if (y_flip) {
|
||||
value.msaa_y3 = 16U - sample_positions[idx].y[3];
|
||||
value.msaa_y2 = 16U - sample_positions[idx].y[2];
|
||||
} else {
|
||||
value.msaa_y3 = sample_positions[idx].y[3];
|
||||
value.msaa_y2 = sample_positions[idx].y[2];
|
||||
}
|
||||
|
||||
FALLTHROUGH;
|
||||
case 2:
|
||||
value.msaa_x1 = sample_positions[idx].x[1];
|
||||
|
||||
if (y_flip) {
|
||||
value.msaa_y1 = 16U - sample_positions[idx].y[1];
|
||||
} else {
|
||||
value.msaa_y1 = sample_positions[idx].y[1];
|
||||
}
|
||||
|
||||
FALLTHROUGH;
|
||||
case 1:
|
||||
value.msaa_x0 = sample_positions[idx].x[0];
|
||||
|
||||
if (y_flip) {
|
||||
value.msaa_y0 = 16U - sample_positions[idx].y[0];
|
||||
} else {
|
||||
value.msaa_y0 = sample_positions[idx].y[0];
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
unreachable("Unsupported number of samples");
|
||||
}
|
||||
}
|
||||
|
||||
return multisamplectl;
|
||||
}
|
||||
|
||||
static uint32_t
|
||||
pvr_rogue_get_cr_te_aa_val(const struct pvr_device_info *dev_info,
|
||||
uint32_t samples)
|
||||
{
|
||||
uint32_t samples_per_pixel =
|
||||
PVR_GET_FEATURE_VALUE(dev_info, isp_samples_per_pixel, 0);
|
||||
uint32_t te_aa;
|
||||
|
||||
pvr_csb_pack (&te_aa, CR_TE_AA, value) {
|
||||
if (samples_per_pixel == 1) {
|
||||
if (samples >= 2)
|
||||
value.y = true;
|
||||
if (samples >= 4)
|
||||
value.x = true;
|
||||
} else if (samples_per_pixel == 2) {
|
||||
if (samples >= 2)
|
||||
value.x2 = true;
|
||||
if (samples >= 4)
|
||||
value.y = true;
|
||||
if (samples >= 8)
|
||||
value.x = true;
|
||||
} else if (samples_per_pixel == 4) {
|
||||
if (samples >= 2)
|
||||
value.x2 = true;
|
||||
if (samples >= 4)
|
||||
value.y2 = true;
|
||||
if (samples >= 8)
|
||||
value.y = true;
|
||||
} else {
|
||||
assert(!"Unsupported ISP samples per pixel value");
|
||||
}
|
||||
}
|
||||
|
||||
return te_aa;
|
||||
}
|
||||
|
||||
static void pvr_rt_dataset_ws_create_info_init(
|
||||
struct pvr_rt_dataset *rt_dataset,
|
||||
const struct pvr_rt_mtile_info *mtile_info,
|
||||
@@ -947,6 +749,11 @@ static void pvr_rt_dataset_ws_create_info_init(
|
||||
/* Local freelist. */
|
||||
create_info->local_free_list = rt_dataset->local_free_list->ws_free_list;
|
||||
|
||||
create_info->width = rt_dataset->width;
|
||||
create_info->height = rt_dataset->height;
|
||||
create_info->samples = rt_dataset->samples;
|
||||
create_info->layers = rt_dataset->layers;
|
||||
|
||||
/* ISP register values. */
|
||||
if (PVR_HAS_ERN(dev_info, 42307) &&
|
||||
!(PVR_HAS_FEATURE(dev_info, roguexe) && mtile_info->tile_size_x == 16)) {
|
||||
@@ -983,47 +790,6 @@ static void pvr_rt_dataset_ws_create_info_init(
|
||||
create_info->isp_merge_scale_y = fui(value);
|
||||
}
|
||||
|
||||
create_info->isp_mtile_size =
|
||||
pvr_rogue_get_cr_isp_mtile_size_val(dev_info,
|
||||
rt_dataset->samples,
|
||||
mtile_info);
|
||||
|
||||
/* PPP register values. */
|
||||
create_info->ppp_multi_sample_ctl =
|
||||
pvr_rogue_get_cr_multisamplectl_val(rt_dataset->samples, false);
|
||||
create_info->ppp_multi_sample_ctl_y_flipped =
|
||||
pvr_rogue_get_cr_multisamplectl_val(rt_dataset->samples, true);
|
||||
|
||||
pvr_csb_pack (&create_info->ppp_screen, CR_PPP_SCREEN, value) {
|
||||
value.pixxmax = rt_dataset->width - 1;
|
||||
value.pixymax = rt_dataset->height - 1;
|
||||
}
|
||||
|
||||
/* TE register values. */
|
||||
create_info->te_aa =
|
||||
pvr_rogue_get_cr_te_aa_val(dev_info, rt_dataset->samples);
|
||||
|
||||
pvr_csb_pack (&create_info->te_mtile1, CR_TE_MTILE1, value) {
|
||||
value.x1 = mtile_info->mtile_x1;
|
||||
if (!PVR_HAS_FEATURE(dev_info, simple_internal_parameter_format)) {
|
||||
value.x2 = mtile_info->mtile_x2;
|
||||
value.x3 = mtile_info->mtile_x3;
|
||||
}
|
||||
}
|
||||
|
||||
pvr_csb_pack (&create_info->te_mtile2, CR_TE_MTILE2, value) {
|
||||
value.y1 = mtile_info->mtile_y1;
|
||||
if (!PVR_HAS_FEATURE(dev_info, simple_internal_parameter_format)) {
|
||||
value.y2 = mtile_info->mtile_y2;
|
||||
value.y3 = mtile_info->mtile_y3;
|
||||
}
|
||||
}
|
||||
|
||||
pvr_csb_pack (&create_info->te_screen, CR_TE_SCREEN, value) {
|
||||
value.xmax = mtile_info->x_tile_max;
|
||||
value.ymax = mtile_info->y_tile_max;
|
||||
}
|
||||
|
||||
/* Allocations and associated information. */
|
||||
create_info->vheap_table_dev_addr = rt_dataset->vheap_dev_addr;
|
||||
create_info->rtc_dev_addr = rt_dataset->rtc_dev_addr;
|
||||
@@ -1045,10 +811,6 @@ static void pvr_rt_dataset_ws_create_info_init(
|
||||
|
||||
create_info->rgn_header_size =
|
||||
pvr_rt_get_isp_region_size(device, mtile_info);
|
||||
|
||||
/* Miscellaneous. */
|
||||
create_info->mtile_stride = mtile_info->mtile_stride;
|
||||
create_info->max_rts = rt_dataset->layers;
|
||||
}
|
||||
|
||||
VkResult
|
||||
@@ -1072,7 +834,7 @@ pvr_render_target_dataset_create(struct pvr_device *device,
|
||||
assert(height <= rogue_get_render_size_max_y(dev_info));
|
||||
assert(layers > 0 && layers <= PVR_MAX_FRAMEBUFFER_LAYERS);
|
||||
|
||||
pvr_rt_mtile_info_init(device, &mtile_info, width, height, samples);
|
||||
pvr_rt_mtile_info_init(dev_info, &mtile_info, width, height, samples);
|
||||
|
||||
rt_dataset = vk_zalloc(&device->vk.alloc,
|
||||
sizeof(*rt_dataset),
|
||||
@@ -1130,6 +892,7 @@ pvr_render_target_dataset_create(struct pvr_device *device,
|
||||
result =
|
||||
device->ws->ops->render_target_dataset_create(device->ws,
|
||||
&rt_dataset_create_info,
|
||||
dev_info,
|
||||
&rt_dataset->ws_rt_dataset);
|
||||
if (result != VK_SUCCESS)
|
||||
goto err_pvr_rt_datas_fini;
|
||||
|
@@ -33,11 +33,37 @@
|
||||
#include "pvr_types.h"
|
||||
|
||||
struct pvr_device;
|
||||
struct pvr_device_info;
|
||||
struct pvr_free_list;
|
||||
struct pvr_render_ctx;
|
||||
struct pvr_rt_dataset;
|
||||
struct vk_sync;
|
||||
|
||||
/* Macrotile information. */
|
||||
struct pvr_rt_mtile_info {
|
||||
uint32_t tile_size_x;
|
||||
uint32_t tile_size_y;
|
||||
|
||||
uint32_t num_tiles_x;
|
||||
uint32_t num_tiles_y;
|
||||
|
||||
uint32_t tiles_per_mtile_x;
|
||||
uint32_t tiles_per_mtile_y;
|
||||
|
||||
uint32_t x_tile_max;
|
||||
uint32_t y_tile_max;
|
||||
|
||||
uint32_t mtiles_x;
|
||||
uint32_t mtiles_y;
|
||||
|
||||
uint32_t mtile_x1;
|
||||
uint32_t mtile_y1;
|
||||
uint32_t mtile_x2;
|
||||
uint32_t mtile_y2;
|
||||
uint32_t mtile_x3;
|
||||
uint32_t mtile_y3;
|
||||
};
|
||||
|
||||
/* FIXME: Turn 'struct pvr_sub_cmd' into 'struct pvr_job' and change 'struct
|
||||
* pvr_render_job' to subclass it? This is approximately what v3dv does
|
||||
* (although it doesn't subclass).
|
||||
@@ -118,6 +144,12 @@ struct pvr_render_job {
|
||||
uint64_t pds_pr_bgnd_reg_values[ROGUE_NUM_CR_PDS_BGRND_WORDS];
|
||||
};
|
||||
|
||||
void pvr_rt_mtile_info_init(const struct pvr_device_info *dev_info,
|
||||
struct pvr_rt_mtile_info *info,
|
||||
uint32_t width,
|
||||
uint32_t height,
|
||||
uint32_t samples);
|
||||
|
||||
VkResult pvr_free_list_create(struct pvr_device *device,
|
||||
uint32_t initial_size,
|
||||
uint32_t max_size,
|
||||
|
@@ -149,6 +149,11 @@ struct pvr_winsys_rt_dataset_create_info {
|
||||
/* Local freelist */
|
||||
struct pvr_winsys_free_list *local_free_list;
|
||||
|
||||
uint32_t width;
|
||||
uint32_t height;
|
||||
uint32_t samples;
|
||||
uint16_t layers;
|
||||
|
||||
/* ISP register values */
|
||||
uint32_t isp_merge_lower_x;
|
||||
uint32_t isp_merge_lower_y;
|
||||
@@ -156,18 +161,6 @@ struct pvr_winsys_rt_dataset_create_info {
|
||||
uint32_t isp_merge_scale_y;
|
||||
uint32_t isp_merge_upper_x;
|
||||
uint32_t isp_merge_upper_y;
|
||||
uint32_t isp_mtile_size;
|
||||
|
||||
/* PPP register values */
|
||||
uint64_t ppp_multi_sample_ctl;
|
||||
uint64_t ppp_multi_sample_ctl_y_flipped;
|
||||
uint32_t ppp_screen;
|
||||
|
||||
/* TE register values */
|
||||
uint32_t te_aa;
|
||||
uint32_t te_mtile1;
|
||||
uint32_t te_mtile2;
|
||||
uint32_t te_screen;
|
||||
|
||||
/* Allocations and associated information */
|
||||
pvr_dev_addr_t vheap_table_dev_addr;
|
||||
@@ -183,10 +176,6 @@ struct pvr_winsys_rt_dataset_create_info {
|
||||
pvr_dev_addr_t rgn_header_dev_addr;
|
||||
} rt_datas[ROGUE_NUM_RTDATAS];
|
||||
uint64_t rgn_header_size;
|
||||
|
||||
/* Miscellaneous */
|
||||
uint32_t mtile_stride;
|
||||
uint16_t max_rts;
|
||||
};
|
||||
|
||||
struct pvr_winsys_rt_dataset {
|
||||
@@ -438,6 +427,7 @@ struct pvr_winsys_ops {
|
||||
VkResult (*render_target_dataset_create)(
|
||||
struct pvr_winsys *ws,
|
||||
const struct pvr_winsys_rt_dataset_create_info *create_info,
|
||||
const struct pvr_device_info *dev_info,
|
||||
struct pvr_winsys_rt_dataset **const rt_dataset_out);
|
||||
void (*render_target_dataset_destroy)(
|
||||
struct pvr_winsys_rt_dataset *rt_dataset);
|
||||
|
@@ -34,6 +34,8 @@
|
||||
|
||||
#include "fw-api/pvr_rogue_fwif.h"
|
||||
#include "fw-api/pvr_rogue_fwif_rf.h"
|
||||
#include "pvr_csb.h"
|
||||
#include "pvr_job_render.h"
|
||||
#include "pvr_private.h"
|
||||
#include "pvr_srv.h"
|
||||
#include "pvr_srv_bo.h"
|
||||
@@ -46,6 +48,7 @@
|
||||
#include "pvr_winsys.h"
|
||||
#include "util/log.h"
|
||||
#include "util/macros.h"
|
||||
#include "util/u_math.h"
|
||||
#include "vk_alloc.h"
|
||||
#include "vk_log.h"
|
||||
#include "vk_util.h"
|
||||
@@ -159,9 +162,219 @@ void pvr_srv_winsys_free_list_destroy(struct pvr_winsys_free_list *free_list)
|
||||
vk_free(srv_ws->base.alloc, srv_free_list);
|
||||
}
|
||||
|
||||
static uint64_t pvr_rogue_get_cr_multisamplectl_val(uint32_t samples,
|
||||
bool y_flip)
|
||||
{
|
||||
static const struct {
|
||||
uint8_t x[8];
|
||||
uint8_t y[8];
|
||||
} sample_positions[4] = {
|
||||
/* 1 sample */
|
||||
{
|
||||
.x = { 8 },
|
||||
.y = { 8 },
|
||||
},
|
||||
/* 2 samples */
|
||||
{
|
||||
.x = { 12, 4 },
|
||||
.y = { 12, 4 },
|
||||
},
|
||||
/* 4 samples */
|
||||
{
|
||||
.x = { 6, 14, 2, 10 },
|
||||
.y = { 2, 6, 10, 14 },
|
||||
},
|
||||
/* 8 samples */
|
||||
{
|
||||
.x = { 9, 7, 13, 5, 3, 1, 11, 15 },
|
||||
.y = { 5, 11, 9, 3, 13, 7, 15, 1 },
|
||||
},
|
||||
};
|
||||
uint64_t multisamplectl;
|
||||
uint8_t idx;
|
||||
|
||||
idx = util_fast_log2(samples);
|
||||
assert(idx < ARRAY_SIZE(sample_positions));
|
||||
|
||||
pvr_csb_pack (&multisamplectl, CR_PPP_MULTISAMPLECTL, value) {
|
||||
switch (samples) {
|
||||
case 8:
|
||||
value.msaa_x7 = sample_positions[idx].x[7];
|
||||
value.msaa_x6 = sample_positions[idx].x[6];
|
||||
value.msaa_x5 = sample_positions[idx].x[5];
|
||||
value.msaa_x4 = sample_positions[idx].x[4];
|
||||
|
||||
if (y_flip) {
|
||||
value.msaa_y7 = 16U - sample_positions[idx].y[7];
|
||||
value.msaa_y6 = 16U - sample_positions[idx].y[6];
|
||||
value.msaa_y5 = 16U - sample_positions[idx].y[5];
|
||||
value.msaa_y4 = 16U - sample_positions[idx].y[4];
|
||||
} else {
|
||||
value.msaa_y7 = sample_positions[idx].y[7];
|
||||
value.msaa_y6 = sample_positions[idx].y[6];
|
||||
value.msaa_y5 = sample_positions[idx].y[5];
|
||||
value.msaa_y4 = sample_positions[idx].y[4];
|
||||
}
|
||||
|
||||
FALLTHROUGH;
|
||||
case 4:
|
||||
value.msaa_x3 = sample_positions[idx].x[3];
|
||||
value.msaa_x2 = sample_positions[idx].x[2];
|
||||
|
||||
if (y_flip) {
|
||||
value.msaa_y3 = 16U - sample_positions[idx].y[3];
|
||||
value.msaa_y2 = 16U - sample_positions[idx].y[2];
|
||||
} else {
|
||||
value.msaa_y3 = sample_positions[idx].y[3];
|
||||
value.msaa_y2 = sample_positions[idx].y[2];
|
||||
}
|
||||
|
||||
FALLTHROUGH;
|
||||
case 2:
|
||||
value.msaa_x1 = sample_positions[idx].x[1];
|
||||
|
||||
if (y_flip) {
|
||||
value.msaa_y1 = 16U - sample_positions[idx].y[1];
|
||||
} else {
|
||||
value.msaa_y1 = sample_positions[idx].y[1];
|
||||
}
|
||||
|
||||
FALLTHROUGH;
|
||||
case 1:
|
||||
value.msaa_x0 = sample_positions[idx].x[0];
|
||||
|
||||
if (y_flip) {
|
||||
value.msaa_y0 = 16U - sample_positions[idx].y[0];
|
||||
} else {
|
||||
value.msaa_y0 = sample_positions[idx].y[0];
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
unreachable("Unsupported number of samples");
|
||||
}
|
||||
}
|
||||
|
||||
return multisamplectl;
|
||||
}
|
||||
|
||||
static uint32_t
|
||||
pvr_rogue_get_cr_isp_mtile_size_val(const struct pvr_device_info *dev_info,
|
||||
const struct pvr_rt_mtile_info *mtile_info,
|
||||
uint32_t samples)
|
||||
{
|
||||
uint32_t samples_per_pixel =
|
||||
PVR_GET_FEATURE_VALUE(dev_info, isp_samples_per_pixel, 0);
|
||||
uint32_t isp_mtile_size;
|
||||
|
||||
pvr_csb_pack (&isp_mtile_size, CR_ISP_MTILE_SIZE, value) {
|
||||
value.x = mtile_info->mtile_x1;
|
||||
value.y = mtile_info->mtile_y1;
|
||||
|
||||
if (samples_per_pixel == 1) {
|
||||
if (samples >= 4)
|
||||
value.x <<= 1;
|
||||
|
||||
if (samples >= 2)
|
||||
value.y <<= 1;
|
||||
} else if (samples_per_pixel == 2) {
|
||||
if (samples >= 8)
|
||||
value.x <<= 1;
|
||||
|
||||
if (samples >= 4)
|
||||
value.y <<= 1;
|
||||
} else if (samples_per_pixel == 4) {
|
||||
if (samples >= 8)
|
||||
value.y <<= 1;
|
||||
} else {
|
||||
assert(!"Unsupported ISP samples per pixel value");
|
||||
}
|
||||
}
|
||||
|
||||
return isp_mtile_size;
|
||||
}
|
||||
|
||||
static uint32_t pvr_rogue_get_ppp_screen_val(uint32_t width, uint32_t height)
|
||||
{
|
||||
uint32_t val;
|
||||
|
||||
pvr_csb_pack (&val, CR_PPP_SCREEN, state) {
|
||||
state.pixxmax = width;
|
||||
state.pixymax = height;
|
||||
}
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
struct pvr_rogue_cr_te {
|
||||
uint32_t aa;
|
||||
uint32_t mtile1;
|
||||
uint32_t mtile2;
|
||||
uint32_t screen;
|
||||
uint32_t mtile_stride;
|
||||
};
|
||||
|
||||
static void pvr_rogue_ct_te_init(const struct pvr_device_info *dev_info,
|
||||
const struct pvr_rt_mtile_info *mtile_info,
|
||||
uint32_t samples,
|
||||
struct pvr_rogue_cr_te *const te_regs)
|
||||
{
|
||||
uint32_t samples_per_pixel =
|
||||
PVR_GET_FEATURE_VALUE(dev_info, isp_samples_per_pixel, 0);
|
||||
|
||||
pvr_csb_pack (&te_regs->aa, CR_TE_AA, value) {
|
||||
if (samples_per_pixel == 1) {
|
||||
if (samples >= 2)
|
||||
value.y = true;
|
||||
if (samples >= 4)
|
||||
value.x = true;
|
||||
} else if (samples_per_pixel == 2) {
|
||||
if (samples >= 2)
|
||||
value.x2 = true;
|
||||
if (samples >= 4)
|
||||
value.y = true;
|
||||
if (samples >= 8)
|
||||
value.x = true;
|
||||
} else if (samples_per_pixel == 4) {
|
||||
if (samples >= 2)
|
||||
value.x2 = true;
|
||||
if (samples >= 4)
|
||||
value.y2 = true;
|
||||
if (samples >= 8)
|
||||
value.y = true;
|
||||
} else {
|
||||
assert(!"Unsupported ISP samples per pixel value");
|
||||
}
|
||||
}
|
||||
|
||||
pvr_csb_pack (&te_regs->mtile1, CR_TE_MTILE1, value) {
|
||||
value.x1 = mtile_info->mtile_x1;
|
||||
if (!PVR_HAS_FEATURE(dev_info, simple_internal_parameter_format)) {
|
||||
value.x2 = mtile_info->mtile_x2;
|
||||
value.x3 = mtile_info->mtile_x3;
|
||||
}
|
||||
}
|
||||
|
||||
pvr_csb_pack (&te_regs->mtile2, CR_TE_MTILE2, value) {
|
||||
value.y1 = mtile_info->mtile_y1;
|
||||
if (!PVR_HAS_FEATURE(dev_info, simple_internal_parameter_format)) {
|
||||
value.y2 = mtile_info->mtile_y2;
|
||||
value.y3 = mtile_info->mtile_y3;
|
||||
}
|
||||
}
|
||||
|
||||
pvr_csb_pack (&te_regs->screen, CR_TE_SCREEN, value) {
|
||||
value.xmax = mtile_info->x_tile_max;
|
||||
value.ymax = mtile_info->y_tile_max;
|
||||
}
|
||||
|
||||
te_regs->mtile_stride = mtile_info->mtile_x1 * mtile_info->mtile_y1;
|
||||
}
|
||||
|
||||
VkResult pvr_srv_render_target_dataset_create(
|
||||
struct pvr_winsys *ws,
|
||||
const struct pvr_winsys_rt_dataset_create_info *create_info,
|
||||
const struct pvr_device_info *dev_info,
|
||||
struct pvr_winsys_rt_dataset **const rt_dataset_out)
|
||||
{
|
||||
const pvr_dev_addr_t macrotile_addrs[ROGUE_FWIF_NUM_RTDATAS] = {
|
||||
@@ -183,6 +396,9 @@ VkResult pvr_srv_render_target_dataset_create(
|
||||
void *free_lists[ROGUE_FW_MAX_FREELISTS] = { NULL };
|
||||
struct pvr_srv_winsys_rt_dataset *srv_rt_dataset;
|
||||
void *handles[ROGUE_FWIF_NUM_RTDATAS];
|
||||
struct pvr_rogue_cr_te rogue_te_regs;
|
||||
struct pvr_rt_mtile_info mtile_info;
|
||||
uint32_t isp_mtile_size;
|
||||
VkResult result;
|
||||
|
||||
free_lists[ROGUE_FW_LOCAL_FREELIST] = srv_local_free_list->handle;
|
||||
@@ -206,10 +422,25 @@ VkResult pvr_srv_render_target_dataset_create(
|
||||
/* If not 2 the arrays used in the bridge call will require updating. */
|
||||
STATIC_ASSERT(ROGUE_FWIF_NUM_RTDATAS == 2);
|
||||
|
||||
pvr_rt_mtile_info_init(dev_info,
|
||||
&mtile_info,
|
||||
create_info->width,
|
||||
create_info->height,
|
||||
create_info->samples);
|
||||
|
||||
isp_mtile_size = pvr_rogue_get_cr_isp_mtile_size_val(dev_info,
|
||||
&mtile_info,
|
||||
create_info->samples);
|
||||
|
||||
pvr_rogue_ct_te_init(dev_info,
|
||||
&mtile_info,
|
||||
create_info->samples,
|
||||
&rogue_te_regs);
|
||||
|
||||
result = pvr_srv_rgx_create_hwrt_dataset(
|
||||
ws->render_fd,
|
||||
create_info->ppp_multi_sample_ctl_y_flipped,
|
||||
create_info->ppp_multi_sample_ctl,
|
||||
pvr_rogue_get_cr_multisamplectl_val(create_info->samples, true),
|
||||
pvr_rogue_get_cr_multisamplectl_val(create_info->samples, false),
|
||||
macrotile_addrs,
|
||||
pm_mlist_addrs,
|
||||
&create_info->rtc_dev_addr,
|
||||
@@ -223,17 +454,17 @@ VkResult pvr_srv_render_target_dataset_create(
|
||||
create_info->isp_merge_scale_y,
|
||||
create_info->isp_merge_upper_x,
|
||||
create_info->isp_merge_upper_y,
|
||||
create_info->isp_mtile_size,
|
||||
create_info->mtile_stride,
|
||||
create_info->ppp_screen,
|
||||
isp_mtile_size,
|
||||
rogue_te_regs.mtile_stride,
|
||||
pvr_rogue_get_ppp_screen_val(create_info->width, create_info->height),
|
||||
create_info->rgn_header_size,
|
||||
create_info->te_aa,
|
||||
create_info->te_mtile1,
|
||||
create_info->te_mtile2,
|
||||
create_info->te_screen,
|
||||
rogue_te_regs.aa,
|
||||
rogue_te_regs.mtile1,
|
||||
rogue_te_regs.mtile2,
|
||||
rogue_te_regs.screen,
|
||||
create_info->tpc_size,
|
||||
create_info->tpc_stride,
|
||||
create_info->max_rts,
|
||||
create_info->layers,
|
||||
handles);
|
||||
if (result != VK_SUCCESS)
|
||||
goto err_vk_free_srv_rt_dataset;
|
||||
|
@@ -27,6 +27,7 @@
|
||||
#include <stdint.h>
|
||||
#include <vulkan/vulkan.h>
|
||||
|
||||
struct pvr_device_info;
|
||||
struct pvr_winsys;
|
||||
struct pvr_winsys_free_list;
|
||||
struct pvr_winsys_render_ctx;
|
||||
@@ -55,6 +56,7 @@ void pvr_srv_winsys_free_list_destroy(struct pvr_winsys_free_list *free_list);
|
||||
VkResult pvr_srv_render_target_dataset_create(
|
||||
struct pvr_winsys *ws,
|
||||
const struct pvr_winsys_rt_dataset_create_info *create_info,
|
||||
const struct pvr_device_info *dev_info,
|
||||
struct pvr_winsys_rt_dataset **const rt_dataset_out);
|
||||
void pvr_srv_render_target_dataset_destroy(
|
||||
struct pvr_winsys_rt_dataset *rt_dataset);
|
||||
|
Reference in New Issue
Block a user