This commit is contained in:
elwrcl committed 2026-06-06 13:25:15 +03:00
1 parent 04d4dc8b09
commit 818cab85dc
12511 files changed
+6156641

No files matched your search

@@ -0,0 +1,127 @@
/*
* Copyright © 2023 Imagination Technologies Ltd.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#ifndef AXE_1_16M_H
#define AXE_1_16M_H
#include <stdbool.h>
#include "pvr_device_info.h"
#define PVR_DEVICE_IDENT_33_V_11_3 \
.device_id = 0x33011003, .series_name = "A-Series", \
.public_name = "AXE-1-16M", .arch = PVR_DEVICE_ARCH_ROGUE
static const struct pvr_device_features pvr_device_features_33_V_11_3 = {
.has_common_store_size_in_dwords = true,
.has_compute = true,
.has_ipf_creq_pf = true,
.has_isp_max_tiles_in_flight = true,
.has_isp_samples_per_pixel = true,
.has_max_instances_per_pds_task = true,
.has_max_multisample = true,
.has_max_partitions = true,
.has_max_usc_tasks = true,
.has_num_clusters = true,
.has_num_raster_pipes = true,
.has_pbe2_in_xe = true,
.has_pbe_filterable_f16 = true,
.has_pbe_yuv = true,
.has_roguexe = true,
.has_screen_size8K = true,
.has_simple_internal_parameter_format = true,
.has_simple_internal_parameter_format_v2 = true,
.has_simple_parameter_format_version = true,
.has_slc_cache_line_size_bits = true,
.has_tile_size_16x16 = true,
.has_tile_size_x = true,
.has_tile_size_y = true,
.has_tpu_border_colour_enhanced = true,
.has_tpu_extended_integer_lookup = true,
.has_tpu_image_state_v2 = true,
.has_tpu_parallel_instances = true,
.has_unified_store_depth = true,
.has_usc_f16sop_u8 = true,
.has_usc_itr_parallel_instances = true,
.has_usc_min_output_registers_per_pix = true,
.has_usc_pixel_partition_mask = true,
.has_usc_slots = true,
.has_uvs_banks = true,
.has_uvs_pba_entries = true,
.has_uvs_vtx_entries = true,
.has_vdm_cam_size = true,
.has_vdm_degenerate_culling = true,
.common_store_size_in_dwords = 512U * 4U * 4U,
.isp_max_tiles_in_flight = 1U,
.isp_samples_per_pixel = 1U,
.max_instances_per_pds_task = 32U,
.max_multisample = 4U,
.max_partitions = 4U,
.max_usc_tasks = 24U,
.num_clusters = 1U,
.num_raster_pipes = 1U,
.simple_parameter_format_version = 2U,
.slc_cache_line_size_bits = 512U,
.tile_size_x = 16U,
.tile_size_y = 16U,
.tpu_parallel_instances = 1U,
.unified_store_depth = 64U,
.usc_itr_parallel_instances = 4U,
.usc_min_output_registers_per_pix = 1U,
.usc_slots = 14U,
.uvs_banks = 2U,
.uvs_pba_entries = 320U,
.uvs_vtx_entries = 288U,
.vdm_cam_size = 32U,
.has_s8xe = true,
};
static const struct pvr_device_enhancements pvr_device_enhancements_33_15_11_3 = {
.has_ern35421 = true,
.has_ern38748 = true,
.has_ern42307 = true,
.has_ern45493 = true,
};
static const struct pvr_device_quirks pvr_device_quirks_33_15_11_3 = {
.has_brn70165 = true,
.has_brn74056 = true,
};
static const struct pvr_device_info pvr_device_info_33_15_11_3 = {
.ident = {
PVR_DEVICE_IDENT_33_V_11_3,
.b = 33,
.v = 15,
.n = 11,
.c = 3,
},
.features = pvr_device_features_33_V_11_3,
.enhancements = pvr_device_enhancements_33_15_11_3,
.quirks = pvr_device_quirks_33_15_11_3,
};
#endif /* AXE_1_16M_H */
@@ -0,0 +1,125 @@
/*
* Copyright © 2025 Imagination Technologies Ltd.
*
* SPDX-License-Identifier: MIT
*/
#ifndef BXE_2_32_H
#define BXE_2_32_H
#include <stdbool.h>
#include "pvr_device_info.h"
#define PVR_DEVICE_IDENT_36_V_52_182 \
.device_id = 0x36052182, .series_name = "B-Series", \
.public_name = "BXE-2-32", .arch = PVR_DEVICE_ARCH_ROGUE
static const struct pvr_device_features pvr_device_features_36_V_52_182 = {
.has_astc = true,
.has_common_store_size_in_dwords = true,
.has_compute = true,
.has_compute_overlap = true,
.has_fbcdc_algorithm = true,
.has_gpu_multicore_support = true,
/* .has_gs_rta_support = true, */
.has_ipf_creq_pf = true,
.has_isp_max_tiles_in_flight = true,
.has_isp_samples_per_pixel = true,
.has_max_instances_per_pds_task = true,
.has_max_multisample = true,
.has_max_partitions = true,
.has_max_usc_tasks = true,
.has_num_clusters = true,
.has_num_raster_pipes = true,
.has_paired_tiles = true,
.has_pbe2_in_xe = true,
.has_pbe_filterable_f16 = true,
.has_pbe_yuv = true,
.has_pds_ddmadt = true,
.has_roguexe = true,
.has_screen_size8K = true,
.has_simple_internal_parameter_format = true,
.has_simple_internal_parameter_format_v2 = true,
.has_simple_parameter_format_version = true,
.has_slc_cache_line_size_bits = true,
.has_tile_size_16x16 = true,
.has_tile_size_x = true,
.has_tile_size_y = true,
.has_tpu_border_colour_enhanced = true,
.has_tpu_extended_integer_lookup = true,
.has_tpu_image_state_v2 = true,
.has_tpu_parallel_instances = true,
.has_unified_store_depth = true,
.has_usc_alu_roundingmode_rne = true,
.has_usc_f16sop_u8 = true,
.has_usc_itrsmp = true,
.has_usc_itrsmp_enhanced = true,
.has_usc_itr_parallel_instances = true,
.has_usc_min_output_registers_per_pix = true,
.has_usc_pixel_partition_mask = true,
.has_usc_slots = true,
.has_uvs_banks = true,
.has_uvs_pba_entries = true,
.has_uvs_vtx_entries = true,
.has_vdm_cam_size = true,
.has_xpu_max_slaves = true,
.common_store_size_in_dwords = 832U * 4U * 4U,
.fbcdc_algorithm = 50U,
.isp_max_tiles_in_flight = 2U,
.isp_samples_per_pixel = 1U,
.max_instances_per_pds_task = 32U,
.max_multisample = 4U,
.max_partitions = 8U,
.max_usc_tasks = 72U,
.num_clusters = 1U,
.num_raster_pipes = 1U,
.simple_parameter_format_version = 2U,
.slc_cache_line_size_bits = 512U,
.tile_size_x = 16U,
.tile_size_y = 16U,
.tpu_parallel_instances = 2U,
.unified_store_depth = 128U,
.usc_itr_parallel_instances = 8U,
.usc_min_output_registers_per_pix = 2U,
.usc_slots = 32U,
.uvs_banks = 4U,
.uvs_pba_entries = 320U,
.uvs_vtx_entries = 288U,
.vdm_cam_size = 64U,
.xpu_max_slaves = 3U,
.has_s8xe = true,
};
static const struct pvr_device_enhancements
pvr_device_enhancements_36_29_52_182 = {
.has_ern35421 = true,
.has_ern38748 = true,
.has_ern42307 = true,
.has_ern45493 = true,
};
static const struct pvr_device_quirks pvr_device_quirks_36_29_52_182 = {
.has_brn70165 = true,
.has_brn72168 = true,
.has_brn72463 = true,
.has_brn74056 = true,
};
static const struct pvr_device_info pvr_device_info_36_29_52_182 = {
.ident = {
PVR_DEVICE_IDENT_36_V_52_182,
.b = 36,
.v = 29,
.n = 52,
.c = 182,
},
.features = pvr_device_features_36_V_52_182,
.enhancements = pvr_device_enhancements_36_29_52_182,
.quirks = pvr_device_quirks_36_29_52_182,
};
#endif /* BXE_2_32_H */
@@ -0,0 +1,125 @@
/*
* Copyright © 2025 Imagination Technologies Ltd.
*
* SPDX-License-Identifier: MIT
*/
#ifndef BXE_4_32_H
#define BXE_4_32_H
#include <stdbool.h>
#include "pvr_device_info.h"
#define PVR_DEVICE_IDENT_36_V_54_182 \
.device_id = 0x36054182, .series_name = "B-Series", \
.public_name = "BXE-4-32", .arch = PVR_DEVICE_ARCH_ROGUE
static const struct pvr_device_features pvr_device_features_36_V_54_182 = {
.has_astc = true,
.has_common_store_size_in_dwords = true,
.has_compute = true,
.has_compute_overlap = true,
.has_fbcdc_algorithm = true,
.has_gpu_multicore_support = true,
/* .has_gs_rta_support = true, */
.has_ipf_creq_pf = true,
.has_isp_max_tiles_in_flight = true,
.has_isp_samples_per_pixel = true,
.has_max_instances_per_pds_task = true,
.has_max_multisample = true,
.has_max_partitions = true,
.has_max_usc_tasks = true,
.has_num_clusters = true,
.has_num_raster_pipes = true,
.has_paired_tiles = true,
.has_pbe2_in_xe = true,
.has_pbe_filterable_f16 = true,
.has_pbe_yuv = true,
.has_pds_ddmadt = true,
.has_roguexe = true,
.has_screen_size8K = true,
.has_simple_internal_parameter_format = true,
.has_simple_internal_parameter_format_v2 = true,
.has_simple_parameter_format_version = true,
.has_slc_cache_line_size_bits = true,
.has_tile_size_16x16 = true,
.has_tile_size_x = true,
.has_tile_size_y = true,
.has_tpu_border_colour_enhanced = true,
.has_tpu_dm_global_registers = true,
.has_tpu_extended_integer_lookup = true,
.has_tpu_image_state_v2 = true,
.has_tpu_parallel_instances = true,
.has_unified_store_depth = true,
.has_usc_alu_roundingmode_rne = true,
.has_usc_itrsmp = true,
.has_usc_itrsmp_enhanced = true,
.has_usc_f16sop_u8 = true,
.has_usc_itr_parallel_instances = true,
.has_usc_min_output_registers_per_pix = true,
.has_usc_pixel_partition_mask = true,
.has_usc_slots = true,
.has_uvs_banks = true,
.has_uvs_pba_entries = true,
.has_uvs_vtx_entries = true,
.has_vdm_cam_size = true,
.has_xpu_max_slaves = true,
.common_store_size_in_dwords = 1024U * 4U * 4U,
.fbcdc_algorithm = 50U,
.isp_max_tiles_in_flight = 4U,
.isp_samples_per_pixel = 1U,
.max_instances_per_pds_task = 32U,
.max_multisample = 4U,
.max_partitions = 10U,
.max_usc_tasks = 104U,
.num_clusters = 1U,
.num_raster_pipes = 1U,
.simple_parameter_format_version = 2U,
.slc_cache_line_size_bits = 512U,
.tile_size_x = 16U,
.tile_size_y = 16U,
.tpu_parallel_instances = 4U,
.unified_store_depth = 208U,
.usc_itr_parallel_instances = 16U,
.usc_min_output_registers_per_pix = 2U,
.usc_slots = 64U,
.uvs_banks = 8U,
.uvs_pba_entries = 160U,
.uvs_vtx_entries = 144U,
.vdm_cam_size = 64U,
.xpu_max_slaves = 3U,
.has_s8xe = true,
};
static const struct pvr_device_enhancements
pvr_device_enhancements_36_50_54_182 = {
.has_ern35421 = true,
.has_ern38748 = true,
.has_ern42307 = true,
.has_ern45493 = true,
};
static const struct pvr_device_quirks pvr_device_quirks_36_50_54_182 = {
.has_brn70165 = true,
.has_brn72168 = true,
.has_brn72463 = true,
.has_brn74056 = true,
};
static const struct pvr_device_info pvr_device_info_36_50_54_182 = {
.ident = {
PVR_DEVICE_IDENT_36_V_54_182,
.b = 36,
.v = 50,
.n = 54,
.c = 182,
},
.features = pvr_device_features_36_V_54_182,
.enhancements = pvr_device_enhancements_36_50_54_182,
.quirks = pvr_device_quirks_36_50_54_182,
};
#endif /* BXE_4_32_H */
@@ -0,0 +1,240 @@
/*
* Copyright © 2025 Imagination Technologies Ltd.
*
* SPDX-License-Identifier: MIT
*/
#ifndef BXM_4_64_H
#define BXM_4_64_H
#include <stdbool.h>
#include "pvr_device_info.h"
#define PVR_DEVICE_IDENT_36_V_104_182 \
.device_id = 0x36104182, .series_name = "B-Series", \
.public_name = "BXM-4-64", .arch = PVR_DEVICE_ARCH_ROGUE
static const struct pvr_device_features pvr_device_features_36_V_104_182 = {
.has_astc = true,
.has_common_store_size_in_dwords = true,
.has_compute = true,
.has_compute_overlap = true,
.has_fbcdc_algorithm = true,
.has_gpu_multicore_support = true,
/* .has_gs_rta_support = true, */
.has_ipf_creq_pf = true,
.has_isp_max_tiles_in_flight = true,
.has_isp_samples_per_pixel = true,
.has_max_instances_per_pds_task = true,
.has_max_multisample = true,
.has_max_partitions = true,
.has_max_usc_tasks = true,
.has_num_clusters = true,
.has_num_raster_pipes = true,
.has_paired_tiles = true,
.has_pbe2_in_xe = true,
.has_pbe_filterable_f16 = true,
.has_pbe_yuv = true,
.has_pds_ddmadt = true,
.has_roguexe = true,
.has_screen_size8K = true,
.has_simple_internal_parameter_format = true,
.has_simple_internal_parameter_format_v2 = true,
.has_simple_parameter_format_version = true,
.has_slc_cache_line_size_bits = true,
.has_tile_size_16x16 = true,
.has_tile_size_x = true,
.has_tile_size_y = true,
.has_tpu_border_colour_enhanced = true,
.has_tpu_dm_global_registers = true,
.has_tpu_extended_integer_lookup = true,
.has_tpu_image_state_v2 = true,
.has_tpu_parallel_instances = true,
.has_unified_store_depth = true,
.has_usc_alu_roundingmode_rne = true,
.has_usc_f16sop_u8 = true,
.has_usc_itrsmp = true,
.has_usc_itrsmp_enhanced = true,
.has_usc_itr_parallel_instances = true,
.has_usc_min_output_registers_per_pix = true,
.has_usc_pixel_partition_mask = true,
.has_usc_slots = true,
.has_uvs_banks = true,
.has_uvs_pba_entries = true,
.has_uvs_vtx_entries = true,
.has_vdm_cam_size = true,
.has_xpu_max_slaves = true,
.common_store_size_in_dwords = 1216U * 4U * 4U,
.fbcdc_algorithm = 50U,
.isp_max_tiles_in_flight = 6U,
.isp_samples_per_pixel = 1U,
.max_instances_per_pds_task = 32U,
.max_multisample = 4U,
.max_partitions = 12U,
.max_usc_tasks = 156U,
.num_clusters = 1U,
.num_raster_pipes = 1U,
.simple_parameter_format_version = 2U,
.slc_cache_line_size_bits = 512U,
.tile_size_x = 16U,
.tile_size_y = 16U,
.tpu_parallel_instances = 4U,
.unified_store_depth = 256U,
.usc_itr_parallel_instances = 16U,
.usc_min_output_registers_per_pix = 2U,
.usc_slots = 64U,
.uvs_banks = 8U,
.uvs_pba_entries = 160U,
.uvs_vtx_entries = 144U,
.vdm_cam_size = 64U,
.xpu_max_slaves = 3U,
/* Derived features. */
.has_s8xe = true,
};
static const struct pvr_device_enhancements
pvr_device_enhancements_36_52_104_182 = {
.has_ern35421 = true,
.has_ern38748 = true,
.has_ern42307 = true,
.has_ern45493 = true,
};
static const struct pvr_device_quirks pvr_device_quirks_36_52_104_182 = {
.has_brn44079 = true,
.has_brn70165 = true,
.has_brn72168 = true,
.has_brn72463 = true,
.has_brn74056 = true,
};
static const struct pvr_device_info pvr_device_info_36_52_104_182 = {
.ident = {
PVR_DEVICE_IDENT_36_V_104_182,
.b = 36,
.v = 52,
.n = 104,
.c = 182,
},
.features = pvr_device_features_36_V_104_182,
.enhancements = pvr_device_enhancements_36_52_104_182,
.quirks = pvr_device_quirks_36_52_104_182,
};
#define PVR_DEVICE_IDENT_36_V_104_183 \
.device_id = 0x36104183, .series_name = "B-Series", .public_name = "BXM-4-64"
static const struct pvr_device_features pvr_device_features_36_V_104_183 = {
.has_astc = true,
.has_common_store_size_in_dwords = true,
.has_compute = true,
.has_compute_overlap = true,
.has_fbcdc_algorithm = true,
.has_gpu_multicore_support = true,
/* .has_gs_rta_support = true, */
.has_ipf_creq_pf = true,
.has_isp_max_tiles_in_flight = true,
.has_isp_samples_per_pixel = true,
.has_max_instances_per_pds_task = true,
.has_max_multisample = true,
.has_max_partitions = true,
.has_max_usc_tasks = true,
.has_num_clusters = true,
.has_num_raster_pipes = true,
.has_paired_tiles = true,
.has_pbe2_in_xe = true,
.has_pbe_filterable_f16 = true,
.has_pbe_yuv = true,
.has_pds_ddmadt = true,
.has_roguexe = true,
.has_screen_size8K = true,
.has_simple_internal_parameter_format = true,
.has_simple_internal_parameter_format_v2 = true,
.has_simple_parameter_format_version = true,
.has_slc_cache_line_size_bits = true,
.has_tile_size_16x16 = true,
.has_tile_size_x = true,
.has_tile_size_y = true,
.has_tpu_border_colour_enhanced = true,
.has_tpu_dm_global_registers = true,
.has_tpu_extended_integer_lookup = true,
.has_tpu_image_state_v2 = true,
.has_tpu_parallel_instances = true,
.has_unified_store_depth = true,
.has_usc_alu_roundingmode_rne = true,
.has_usc_f16sop_u8 = true,
.has_usc_itrsmp = true,
.has_usc_itrsmp_enhanced = true,
.has_usc_min_output_registers_per_pix = true,
.has_usc_pixel_partition_mask = true,
.has_usc_slots = true,
.has_uvs_banks = true,
.has_uvs_pba_entries = true,
.has_uvs_vtx_entries = true,
.has_vdm_cam_size = true,
.has_xpu_max_slaves = true,
.common_store_size_in_dwords = 1216U * 4U * 4U,
.fbcdc_algorithm = 50U,
.isp_max_tiles_in_flight = 6U,
.isp_samples_per_pixel = 1U,
.max_instances_per_pds_task = 32U,
.max_multisample = 4U,
.max_partitions = 12U,
.max_usc_tasks = 156U,
.num_clusters = 1U,
.num_raster_pipes = 1U,
.simple_parameter_format_version = 2U,
.slc_cache_line_size_bits = 512U,
.tile_size_x = 16U,
.tile_size_y = 16U,
.tpu_parallel_instances = 4U,
.unified_store_depth = 256U,
.usc_min_output_registers_per_pix = 2U,
.usc_slots = 64U,
.uvs_banks = 8U,
.uvs_pba_entries = 160U,
.uvs_vtx_entries = 144U,
.vdm_cam_size = 64U,
.xpu_max_slaves = 3U,
/* Derived features. */
.has_s8xe = true,
.has_usc_itr_parallel_instances = true,
.usc_itr_parallel_instances = 16U,
};
static const struct pvr_device_enhancements
pvr_device_enhancements_36_56_104_183 = {
.has_ern35421 = true,
.has_ern38748 = true,
.has_ern42307 = true,
.has_ern45493 = true,
};
static const struct pvr_device_quirks pvr_device_quirks_36_56_104_183 = {
.has_brn44079 = true,
.has_brn70165 = true,
.has_brn72168 = true,
.has_brn72463 = true,
.has_brn74056 = true,
};
static const struct pvr_device_info pvr_device_info_36_56_104_183 = {
.ident = {
PVR_DEVICE_IDENT_36_V_104_183,
.b = 36,
.v = 56,
.n = 104,
.c = 183,
},
.features = pvr_device_features_36_V_104_183,
.enhancements = pvr_device_enhancements_36_56_104_183,
.quirks = pvr_device_quirks_36_56_104_183,
};
#endif /* BXM_4_64_H */
@@ -0,0 +1,144 @@
/*
* Copyright © 2023 Imagination Technologies Ltd.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#ifndef BXS_4_64_H
#define BXS_4_64_H
#include <stdbool.h>
#include "pvr_device_info.h"
#define PVR_DEVICE_IDENT_36_V_104_796 \
.device_id = 0x36104796, .series_name = "B-Series", \
.public_name = "BXS-4-64", .arch = PVR_DEVICE_ARCH_ROGUE
static const struct pvr_device_features pvr_device_features_36_V_104_796 = {
.has_astc = true,
.has_common_store_size_in_dwords = true,
.has_compute = true,
.has_compute_overlap = true,
.has_fbcdc_algorithm = true,
.has_gpu_multicore_support = true,
/* .has_gs_rta_support = true, */
.has_ipf_creq_pf = true,
.has_isp_max_tiles_in_flight = true,
.has_isp_samples_per_pixel = true,
.has_max_instances_per_pds_task = true,
.has_max_multisample = true,
.has_max_partitions = true,
.has_max_usc_tasks = true,
.has_num_clusters = true,
.has_num_raster_pipes = true,
.has_paired_tiles = true,
.has_pbe2_in_xe = true,
.has_pbe_filterable_f16 = true,
.has_pbe_yuv = true,
.has_pds_ddmadt = true,
.has_roguexe = true,
.has_screen_size8K = true,
.has_simple_internal_parameter_format = true,
.has_simple_internal_parameter_format_v2 = true,
.has_simple_parameter_format_version = true,
.has_slc_cache_line_size_bits = true,
.has_tile_size_16x16 = true,
.has_tile_size_x = true,
.has_tile_size_y = true,
.has_tpu_border_colour_enhanced = true,
.has_tpu_dm_global_registers = true,
.has_tpu_extended_integer_lookup = true,
.has_tpu_image_state_v2 = true,
.has_tpu_parallel_instances = true,
.has_unified_store_depth = true,
.has_usc_alu_roundingmode_rne = true,
.has_usc_f16sop_u8 = true,
.has_usc_itrsmp = true,
.has_usc_itrsmp_enhanced = true,
.has_usc_itr_parallel_instances = true,
.has_usc_min_output_registers_per_pix = true,
.has_usc_pixel_partition_mask = true,
.has_usc_slots = true,
.has_uvs_banks = true,
.has_uvs_pba_entries = true,
.has_uvs_vtx_entries = true,
.has_vdm_cam_size = true,
.has_vdm_degenerate_culling = true,
.has_xpu_max_slaves = true,
.common_store_size_in_dwords = 1344U * 4U * 4U,
.fbcdc_algorithm = 50U,
.isp_max_tiles_in_flight = 6U,
.isp_samples_per_pixel = 4U,
.max_instances_per_pds_task = 32U,
.max_multisample = 4U,
.max_partitions = 16U,
.max_usc_tasks = 156U,
.num_clusters = 1U,
.num_raster_pipes = 1U,
.simple_parameter_format_version = 2U,
.slc_cache_line_size_bits = 512U,
.tile_size_x = 16U,
.tile_size_y = 16U,
.tpu_parallel_instances = 4U,
.unified_store_depth = 256U,
.usc_itr_parallel_instances = 16U,
.usc_min_output_registers_per_pix = 2U,
.usc_slots = 64U,
.uvs_banks = 8U,
.uvs_pba_entries = 160U,
.uvs_vtx_entries = 144U,
.vdm_cam_size = 64U,
.xpu_max_slaves = 3U,
.has_s8xe = true,
};
static const struct pvr_device_enhancements
pvr_device_enhancements_36_53_104_796 = {
.has_ern35421 = true,
.has_ern38748 = true,
.has_ern42307 = true,
.has_ern45493 = true,
};
static const struct pvr_device_quirks pvr_device_quirks_36_53_104_796 = {
.has_brn44079 = true,
.has_brn70165 = true,
.has_brn72168 = true,
.has_brn72463 = true,
.has_brn74056 = true,
};
static const struct pvr_device_info pvr_device_info_36_53_104_796 = {
.ident = {
PVR_DEVICE_IDENT_36_V_104_796,
.b = 36,
.v = 53,
.n = 104,
.c = 796,
},
.features = pvr_device_features_36_V_104_796,
.enhancements = pvr_device_enhancements_36_53_104_796,
.quirks = pvr_device_quirks_36_53_104_796,
};
#endif /* BXS_4_64_H */
+106
View File
@@ -0,0 +1,106 @@
/*
* Copyright © 2025 Imagination Technologies Ltd.
*
* SPDX-License-Identifier: MIT
*/
#ifndef G6110_H
#define G6110_H
#include <stdbool.h>
#include "pvr_device_info.h"
#define PVR_DEVICE_IDENT_5_V_1_46 \
.device_id = 0x6110, .series_name = "Rogue", \
.public_name = "GX6110", .arch = PVR_DEVICE_ARCH_ROGUE
static const struct pvr_device_features pvr_device_features_5_V_1_46 = {
.has_common_store_size_in_dwords = true,
.has_compute = true,
.has_fbcdc_algorithm = true,
/* .has_gs_rta_support = true, */
.has_isp_max_tiles_in_flight = true,
.has_isp_samples_per_pixel = true,
.has_max_instances_per_pds_task = true,
.has_max_multisample = true,
.has_max_partitions = true,
.has_max_usc_tasks = true,
.has_num_clusters = true,
.has_num_raster_pipes = true,
.has_pbe_filterable_f16 = true,
.has_roguexe = true,
.has_slc_cache_line_size_bits = true,
.has_tile_size_x = true,
.has_tile_size_y = true,
.has_tpu_parallel_instances = true,
.has_unified_store_depth = true,
.has_usc_itr_parallel_instances = true,
.has_usc_min_output_registers_per_pix = true,
.has_usc_slots = true,
.has_uvs_banks = true,
.has_uvs_pba_entries = true,
.has_uvs_vtx_entries = true,
.has_vdm_cam_size = true,
.common_store_size_in_dwords = 1344U * 4U * 4U,
.fbcdc_algorithm = 2U,
.isp_max_tiles_in_flight = 1U,
.isp_samples_per_pixel = 2U,
.max_instances_per_pds_task = 32U,
.max_multisample = 4U,
.max_partitions = 12U,
.max_usc_tasks = 96U,
.num_clusters = 1U,
.num_raster_pipes = 1U,
.slc_cache_line_size_bits = 512U,
.tile_size_x = 32U,
.tile_size_y = 32U,
.tpu_parallel_instances = 4U,
.unified_store_depth = 208U,
.usc_itr_parallel_instances = 16U,
.usc_min_output_registers_per_pix = 2U,
.usc_slots = 56U,
.uvs_banks = 8U,
.uvs_pba_entries = 160U,
.uvs_vtx_entries = 144U,
.vdm_cam_size = 64U,
.has_requires_fb_cdc_zls_setup = true,
};
static const struct pvr_device_enhancements pvr_device_enhancements_5_9_1_46 = {
.has_ern35421 = true,
};
static const struct pvr_device_quirks pvr_device_quirks_5_9_1_46 = {
.has_brn44079 = true,
.has_brn47727 = true,
.has_brn48492 = true,
.has_brn48545 = true,
.has_brn49032 = true,
.has_brn49927 = true,
.has_brn51025 = true,
.has_brn51210 = true,
.has_brn52942 = true,
.has_brn58839 = true,
.has_brn62269 = true,
.has_brn66011 = true,
.has_brn70165 = true,
.has_brn74056 = true,
};
static const struct pvr_device_info pvr_device_info_5_9_1_46 = {
.ident = {
PVR_DEVICE_IDENT_5_V_1_46,
.b = 5,
.v = 9,
.n = 1,
.c = 46,
},
.features = pvr_device_features_5_V_1_46,
.enhancements = pvr_device_enhancements_5_9_1_46,
.quirks = pvr_device_quirks_5_9_1_46,
};
#endif /* G6110_H */
+105
View File
@@ -0,0 +1,105 @@
/*
* Copyright © 2025 Imagination Technologies Ltd.
*
* SPDX-License-Identifier: MIT
*/
#ifndef GE7800_H
#define GE7800_H
#include <stdbool.h>
#include "pvr_device_info.h"
#define PVR_DEVICE_IDENT_15_V_1_64 \
.device_id = 0x15001064, .series_name = "Rogue", \
.public_name = "GE7800", .arch = PVR_DEVICE_ARCH_ROGUE
static const struct pvr_device_features pvr_device_features_15_V_1_64 = {
.has_astc = true,
.has_common_store_size_in_dwords = true,
.has_compute = true,
.has_fbcdc_algorithm = true,
/* .has_gs_rta_support = true, */
.has_isp_max_tiles_in_flight = true,
.has_isp_samples_per_pixel = true,
.has_max_instances_per_pds_task = true,
.has_max_multisample = true,
.has_max_partitions = true,
.has_max_usc_tasks = true,
.has_num_clusters = true,
.has_num_raster_pipes = true,
.has_pbe_filterable_f16 = true,
.has_roguexe = true,
.has_slc_cache_line_size_bits = true,
.has_tile_size_x = true,
.has_tile_size_y = true,
.has_tpu_parallel_instances = true,
.has_unified_store_depth = true,
.has_usc_f16sop_u8 = true,
.has_usc_itr_parallel_instances = true,
.has_usc_min_output_registers_per_pix = true,
.has_usc_slots = true,
.has_uvs_banks = true,
.has_uvs_pba_entries = true,
.has_uvs_vtx_entries = true,
.has_vdm_cam_size = true,
.common_store_size_in_dwords = 1344U * 4U * 4U,
.fbcdc_algorithm = 2U,
.isp_max_tiles_in_flight = 2U,
.isp_samples_per_pixel = 2U,
.max_instances_per_pds_task = 32U,
.max_multisample = 4U,
.max_partitions = 12U,
.max_usc_tasks = 96U,
.num_clusters = 1U,
.num_raster_pipes = 1U,
.slc_cache_line_size_bits = 512U,
.tile_size_x = 32U,
.tile_size_y = 32U,
.tpu_parallel_instances = 4U,
.unified_store_depth = 208U,
.usc_itr_parallel_instances = 16U,
.usc_min_output_registers_per_pix = 2U,
.usc_slots = 56U,
.uvs_banks = 8U,
.uvs_pba_entries = 320U,
.uvs_vtx_entries = 288U,
.vdm_cam_size = 128U,
.has_requires_fb_cdc_zls_setup = true,
};
static const struct pvr_device_enhancements
pvr_device_enhancements_15_5_1_64 = {
.has_ern35421 = true,
};
static const struct pvr_device_quirks pvr_device_quirks_15_5_1_64 = {
.has_brn44079 = true,
.has_brn48492 = true,
.has_brn49032 = true,
.has_brn49927 = true,
.has_brn52942 = true,
.has_brn58839 = true,
.has_brn62269 = true,
.has_brn66011 = true,
.has_brn70165 = true,
.has_brn74056 = true,
};
static const struct pvr_device_info pvr_device_info_15_5_1_64 = {
.ident = {
PVR_DEVICE_IDENT_15_V_1_64,
.b = 15,
.v = 5,
.n = 1,
.c = 64,
},
.features = pvr_device_features_15_V_1_64,
.enhancements = pvr_device_enhancements_15_5_1_64,
.quirks = pvr_device_quirks_15_5_1_64,
};
#endif /* GE7800_H */
+233
View File
@@ -0,0 +1,233 @@
/*
* Copyright © 2025 Imagination Technologies Ltd.
*
* SPDX-License-Identifier: MIT
*/
#ifndef GE8300_H
#define GE8300_H
#include <stdbool.h>
#include "pvr_device_info.h"
#define PVR_DEVICE_IDENT_22_V_54_30 \
.device_id = 0x22054030, .series_name = "Rogue", \
.public_name = "GE8300", .arch = PVR_DEVICE_ARCH_ROGUE
static const struct pvr_device_features pvr_device_features_22_V_54_30 = {
.has_astc = true,
.has_common_store_size_in_dwords = true,
.has_compute = true,
.has_compute_overlap = true,
/* .has_gs_rta_support = true, */
.has_ipf_creq_pf = true,
.has_isp_max_tiles_in_flight = true,
.has_isp_samples_per_pixel = true,
.has_max_instances_per_pds_task = true,
.has_max_multisample = true,
.has_max_partitions = true,
.has_max_usc_tasks = true,
.has_num_clusters = true,
.has_num_raster_pipes = true,
.has_pbe2_in_xe = true,
.has_pbe_filterable_f16 = true,
.has_pbe_yuv = true,
.has_roguexe = true,
.has_simple_internal_parameter_format = true,
.has_simple_internal_parameter_format_v1 = true,
.has_simple_parameter_format_version = true,
.has_slc_cache_line_size_bits = true,
.has_tile_size_16x16 = true,
.has_tile_size_x = true,
.has_tile_size_y = true,
.has_tpu_parallel_instances = true,
.has_unified_store_depth = true,
.has_usc_f16sop_u8 = true,
.has_usc_itrsmp = true,
.has_usc_itrsmp_enhanced = true,
.has_usc_itr_parallel_instances = true,
.has_usc_min_output_registers_per_pix = true,
.has_usc_slots = true,
.has_uvs_banks = true,
.has_uvs_pba_entries = true,
.has_uvs_vtx_entries = true,
.has_vdm_cam_size = true,
.common_store_size_in_dwords = 1024U * 4U * 4U,
.isp_max_tiles_in_flight = 4U,
.isp_samples_per_pixel = 1U,
.max_instances_per_pds_task = 32U,
.max_multisample = 4U,
.max_partitions = 10U,
.max_usc_tasks = 104U,
.num_clusters = 1U,
.num_raster_pipes = 1U,
.simple_parameter_format_version = 1U,
.slc_cache_line_size_bits = 512U,
.tile_size_x = 16U,
.tile_size_y = 16U,
.tpu_parallel_instances = 4U,
.unified_store_depth = 208U,
.usc_itr_parallel_instances = 16U,
.usc_min_output_registers_per_pix = 2U,
.usc_slots = 64U,
.uvs_banks = 4U,
.uvs_pba_entries = 320U,
.uvs_vtx_entries = 288U,
.vdm_cam_size = 64U,
.has_s8xe = true,
};
static const struct pvr_device_enhancements
pvr_device_enhancements_22_67_54_30 = {
.has_ern35421 = true,
.has_ern38748 = true,
.has_ern42307 = true,
};
static const struct pvr_device_quirks pvr_device_quirks_22_67_54_30 = {
.has_brn49927 = true,
.has_brn66011 = true,
.has_brn70165 = true,
.has_brn74056 = true,
};
static const struct pvr_device_info pvr_device_info_22_67_54_30 = {
.ident = {
PVR_DEVICE_IDENT_22_V_54_30,
.b = 22,
.v = 67,
.n = 54,
.c = 30,
},
.features = pvr_device_features_22_V_54_30,
.enhancements = pvr_device_enhancements_22_67_54_30,
.quirks = pvr_device_quirks_22_67_54_30,
};
static const struct pvr_device_enhancements
pvr_device_enhancements_22_68_54_30 = {
.has_ern35421 = true,
.has_ern38748 = true,
.has_ern42307 = true,
};
static const struct pvr_device_quirks pvr_device_quirks_22_68_54_30 = {
.has_brn49927 = true,
.has_brn66011 = true,
.has_brn70165 = true,
.has_brn74056 = true,
};
static const struct pvr_device_info pvr_device_info_22_68_54_30 = {
.ident = {
PVR_DEVICE_IDENT_22_V_54_30,
.b = 22,
.v = 68,
.n = 54,
.c = 30,
},
.features = pvr_device_features_22_V_54_30,
.enhancements = pvr_device_enhancements_22_68_54_30,
.quirks = pvr_device_quirks_22_68_54_30,
};
#define PVR_DEVICE_IDENT_22_V_54_38 \
.device_id = 0x22054038, .series_name = "Rogue", .public_name = "GE8300"
static const struct pvr_device_features pvr_device_features_22_V_54_38 = {
.has_astc = true,
.has_common_store_size_in_dwords = true,
.has_compute = true,
.has_compute_overlap = true,
/* .has_gs_rta_support = true, */
.has_ipf_creq_pf = true,
.has_isp_max_tiles_in_flight = true,
.has_isp_samples_per_pixel = true,
.has_max_instances_per_pds_task = true,
.has_max_multisample = true,
.has_max_partitions = true,
.has_max_usc_tasks = true,
.has_num_clusters = true,
.has_num_raster_pipes = true,
.has_pbe2_in_xe = true,
.has_pbe_filterable_f16 = true,
.has_pbe_yuv = true,
.has_roguexe = true,
.has_simple_internal_parameter_format = true,
.has_simple_internal_parameter_format_v1 = true,
.has_simple_parameter_format_version = true,
.has_slc_cache_line_size_bits = true,
.has_tile_size_16x16 = true,
.has_tile_size_x = true,
.has_tile_size_y = true,
.has_tpu_parallel_instances = true,
.has_unified_store_depth = true,
.has_usc_f16sop_u8 = true,
.has_usc_itrsmp = true,
.has_usc_itrsmp_enhanced = true,
.has_usc_min_output_registers_per_pix = true,
.has_usc_slots = true,
.has_uvs_banks = true,
.has_uvs_pba_entries = true,
.has_uvs_vtx_entries = true,
.has_vdm_cam_size = true,
.common_store_size_in_dwords = 1024U * 4U * 4U,
.isp_max_tiles_in_flight = 4U,
.isp_samples_per_pixel = 1U,
.max_instances_per_pds_task = 32U,
.max_multisample = 4U,
.max_partitions = 10U,
.max_usc_tasks = 104U,
.num_clusters = 1U,
.num_raster_pipes = 1U,
.simple_parameter_format_version = 1U,
.slc_cache_line_size_bits = 512U,
.tile_size_x = 16U,
.tile_size_y = 16U,
.tpu_parallel_instances = 4U,
.unified_store_depth = 208U,
.usc_min_output_registers_per_pix = 2U,
.usc_slots = 64U,
.uvs_banks = 4U,
.uvs_pba_entries = 320U,
.uvs_vtx_entries = 288U,
.vdm_cam_size = 64U,
.has_s8xe = true,
.has_usc_itr_parallel_instances = true,
.usc_itr_parallel_instances = 16U,
};
static const struct pvr_device_enhancements
pvr_device_enhancements_22_102_54_38 = {
.has_ern35421 = true,
.has_ern38748 = true,
.has_ern42307 = true,
};
static const struct pvr_device_quirks pvr_device_quirks_22_102_54_38 = {
.has_brn49927 = true,
.has_brn66011 = true,
.has_brn70165 = true,
.has_brn74056 = true,
};
static const struct pvr_device_info pvr_device_info_22_102_54_38 = {
.ident = {
PVR_DEVICE_IDENT_22_V_54_38,
.b = 22,
.v = 102,
.n = 54,
.c = 38,
},
.features = pvr_device_features_22_V_54_38,
.enhancements = pvr_device_enhancements_22_102_54_38,
.quirks = pvr_device_quirks_22_102_54_38,
};
#endif /* GE8300_H */
+251
View File
@@ -0,0 +1,251 @@
/*
* Copyright © 2023 Imagination Technologies Ltd.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#ifndef GX6250_H
#define GX6250_H
#include <stdbool.h>
#include "pvr_device_info.h"
#define PVR_DEVICE_IDENT_4_V_2_51 \
.device_id = 0x6250, .series_name = "Rogue", \
.public_name = "GX6250", .arch = PVR_DEVICE_ARCH_ROGUE
static const struct pvr_device_features pvr_device_features_4_V_2_51 = {
.has_astc = true,
.has_cluster_grouping = true,
.has_common_store_size_in_dwords = true,
.has_compute = true,
.has_compute_morton_capable = true,
.has_compute_overlap = true,
.has_eight_output_registers = true,
.has_fbcdc_algorithm = true,
/* .has_gs_rta_support = true, */
.has_isp_max_tiles_in_flight = true,
.has_isp_samples_per_pixel = true,
.has_max_instances_per_pds_task = true,
.has_max_multisample = true,
.has_max_partitions = true,
.has_max_usc_tasks = true,
.has_num_clusters = true,
.has_num_raster_pipes = true,
.has_pbe_filterable_f16 = true,
.has_pbe_yuv = true,
.has_slc_cache_line_size_bits = true,
.has_slc_mcu_cache_controls = true,
.has_tf_bicubic_filter = true,
.has_tile_size_x = true,
.has_tile_size_y = true,
.has_tpu_array_textures = true,
.has_tpu_extended_integer_lookup = true,
.has_tpu_image_state_v2 = true,
.has_tpu_parallel_instances = true,
.has_unified_store_depth = true,
.has_usc_f16sop_u8 = true,
.has_usc_itrsmp = true,
.has_usc_itr_parallel_instances = true,
.has_usc_min_output_registers_per_pix = true,
.has_usc_slots = true,
.has_uvs_banks = true,
.has_uvs_pba_entries = true,
.has_uvs_vtx_entries = true,
.has_vdm_cam_size = true,
.has_xt_top_infrastructure = true,
.has_zls_subtile = true,
.common_store_size_in_dwords = 1280U * 4U * 4U,
.fbcdc_algorithm = 2,
.isp_max_tiles_in_flight = 4U,
.isp_samples_per_pixel = 2U,
.max_instances_per_pds_task = 32U,
.max_multisample = 8U,
.max_partitions = 8U,
.max_usc_tasks = 56U,
.num_clusters = 2U,
.num_raster_pipes = 1U,
.slc_cache_line_size_bits = 512U,
.tile_size_x = 32U,
.tile_size_y = 32U,
.tpu_parallel_instances = 4U,
.unified_store_depth = 256U,
.usc_itr_parallel_instances = 8U,
.usc_min_output_registers_per_pix = 2U,
.usc_slots = 32U,
.uvs_banks = 8U,
.uvs_pba_entries = 320U,
.uvs_vtx_entries = 288U,
.vdm_cam_size = 256U,
.has_requires_fb_cdc_zls_setup = true,
};
static const struct pvr_device_enhancements pvr_device_enhancements_4_40_2_51 = {
.has_ern35421 = true,
.has_ern38020 = true,
.has_ern38748 = true,
.has_ern42064 = true,
.has_ern42307 = true,
};
static const struct pvr_device_quirks pvr_device_quirks_4_40_2_51 = {
.has_brn44079 = true,
.has_brn47727 = true,
.has_brn48492 = true,
.has_brn48545 = true,
.has_brn49032 = true,
.has_brn49927 = true,
.has_brn51025 = true,
.has_brn51210 = true,
.has_brn51764 = true,
.has_brn52354 = true,
.has_brn52942 = true,
.has_brn58839 = true,
.has_brn62269 = true,
.has_brn66011 = true,
.has_brn70165 = true,
.has_brn74056 = true,
};
static const struct pvr_device_info pvr_device_info_4_40_2_51 = {
.ident = {
PVR_DEVICE_IDENT_4_V_2_51,
.b = 4,
.v = 40,
.n = 2,
.c = 51,
},
.features = pvr_device_features_4_V_2_51,
.enhancements = pvr_device_enhancements_4_40_2_51,
.quirks = pvr_device_quirks_4_40_2_51,
};
#define PVR_DEVICE_IDENT_4_V_2_58 \
.device_id = 0x6250, .series_name = "Rogue", .public_name = "GX6250"
static const struct pvr_device_features pvr_device_features_4_V_2_58 = {
.has_astc = true,
.has_cluster_grouping = true,
.has_common_store_size_in_dwords = true,
.has_compute = true,
.has_compute_morton_capable = true,
.has_compute_overlap = true,
.has_eight_output_registers = true,
.has_fbcdc_algorithm = true,
/* .has_gs_rta_support = true, */
.has_isp_max_tiles_in_flight = true,
.has_isp_samples_per_pixel = true,
.has_max_instances_per_pds_task = true,
.has_max_multisample = true,
.has_max_partitions = true,
.has_max_usc_tasks = true,
.has_num_clusters = true,
.has_num_raster_pipes = true,
.has_pbe_filterable_f16 = true,
.has_pbe_yuv = true,
.has_slc_cache_line_size_bits = true,
.has_slc_mcu_cache_controls = true,
.has_tf_bicubic_filter = true,
.has_tile_size_x = true,
.has_tile_size_y = true,
.has_tpu_array_textures = true,
.has_tpu_extended_integer_lookup = true,
.has_tpu_image_state_v2 = true,
.has_tpu_parallel_instances = true,
.has_unified_store_depth = true,
.has_usc_f16sop_u8 = true,
.has_usc_itrsmp = true,
.has_usc_itr_parallel_instances = true,
.has_usc_min_output_registers_per_pix = true,
.has_usc_slots = true,
.has_uvs_banks = true,
.has_uvs_pba_entries = true,
.has_uvs_vtx_entries = true,
.has_vdm_cam_size = true,
.has_xt_top_infrastructure = true,
.has_zls_subtile = true,
.common_store_size_in_dwords = 1536U * 4U * 4U,
.fbcdc_algorithm = 2,
.isp_max_tiles_in_flight = 4U,
.isp_samples_per_pixel = 2U,
.max_instances_per_pds_task = 32U,
.max_multisample = 8U,
.max_partitions = 8U,
.max_usc_tasks = 56U,
.num_clusters = 2U,
.num_raster_pipes = 1U,
.slc_cache_line_size_bits = 512U,
.tile_size_x = 32U,
.tile_size_y = 32U,
.tpu_parallel_instances = 4U,
.unified_store_depth = 256U,
.usc_itr_parallel_instances = 8U,
.usc_min_output_registers_per_pix = 2U,
.usc_slots = 32U,
.uvs_banks = 8U,
.uvs_pba_entries = 320U,
.uvs_vtx_entries = 288U,
.vdm_cam_size = 256U,
.has_requires_fb_cdc_zls_setup = true,
};
static const struct pvr_device_enhancements pvr_device_enhancements_4_45_2_58 = {
.has_ern35421 = true,
.has_ern38020 = true,
.has_ern38748 = true,
.has_ern42064 = true,
.has_ern42307 = true,
.has_ern45493 = true,
};
static const struct pvr_device_quirks pvr_device_quirks_4_45_2_58 = {
.has_brn44079 = true,
.has_brn49927 = true,
.has_brn51025 = true,
.has_brn51210 = true,
.has_brn51764 = true,
.has_brn52354 = true,
.has_brn52942 = true,
.has_brn58839 = true,
.has_brn62269 = true,
.has_brn66011 = true,
.has_brn70165 = true,
.has_brn74056 = true,
};
static const struct pvr_device_info pvr_device_info_4_45_2_58 = {
.ident = {
PVR_DEVICE_IDENT_4_V_2_58,
.b = 4,
.v = 45,
.n = 2,
.c = 58,
},
.features = pvr_device_features_4_V_2_58,
.enhancements = pvr_device_enhancements_4_45_2_58,
.quirks = pvr_device_quirks_4_45_2_58,
};
#endif /* GX6250_H */
+123
View File
@@ -0,0 +1,123 @@
/*
* Copyright © 2025 Imagination Technologies Ltd.
*
* SPDX-License-Identifier: MIT
*/
#ifndef GX6650_H
#define GX6650_H
#include <stdbool.h>
#include "pvr_device_info.h"
#define PVR_DEVICE_IDENT_4_V_6_62 \
.device_id = 0x6650, .series_name = "Rogue", \
.public_name = "GX6650", .arch = PVR_DEVICE_ARCH_ROGUE
static const struct pvr_device_features pvr_device_features_4_V_6_62 = {
.has_astc = true,
.has_cluster_grouping = true,
.has_common_store_size_in_dwords = true,
.has_compute = true,
.has_compute_morton_capable = true,
.has_compute_overlap = true,
.has_eight_output_registers = true,
.has_fbcdc_algorithm = true,
/* .has_gs_rta_support = true, */
.has_isp_max_tiles_in_flight = true,
.has_isp_samples_per_pixel = true,
.has_max_instances_per_pds_task = true,
.has_max_multisample = true,
.has_max_partitions = true,
.has_max_usc_tasks = true,
.has_num_clusters = true,
.has_num_raster_pipes = true,
.has_pbe_filterable_f16 = true,
.has_pbe_yuv = true,
.has_slc_cache_line_size_bits = true,
.has_slc_mcu_cache_controls = true,
.has_tf_bicubic_filter = true,
.has_tile_size_x = true,
.has_tile_size_y = true,
.has_tpu_array_textures = true,
.has_tpu_extended_integer_lookup = true,
.has_tpu_image_state_v2 = true,
.has_tpu_parallel_instances = true,
.has_unified_store_depth = true,
.has_usc_f16sop_u8 = true,
.has_usc_itrsmp = true,
.has_usc_itr_parallel_instances = true,
.has_usc_min_output_registers_per_pix = true,
.has_usc_slots = true,
.has_uvs_banks = true,
.has_uvs_pba_entries = true,
.has_uvs_vtx_entries = true,
.has_vdm_cam_size = true,
.has_xt_top_infrastructure = true,
.has_zls_subtile = true,
.common_store_size_in_dwords = 1280U * 4U * 4U,
.fbcdc_algorithm = 2U,
.isp_max_tiles_in_flight = 8U,
.isp_samples_per_pixel = 2U,
.max_instances_per_pds_task = 32U,
.max_multisample = 8U,
.max_partitions = 8U,
.max_usc_tasks = 56U,
.num_clusters = 6U,
.num_raster_pipes = 2U,
.slc_cache_line_size_bits = 512U,
.tile_size_x = 32U,
.tile_size_y = 32U,
.tpu_parallel_instances = 4U,
.unified_store_depth = 256U,
.usc_itr_parallel_instances = 8U,
.usc_min_output_registers_per_pix = 2U,
.usc_slots = 32U,
.uvs_banks = 8U,
.uvs_pba_entries = 320U,
.uvs_vtx_entries = 288U,
.vdm_cam_size = 256U,
.has_requires_fb_cdc_zls_setup = true,
};
static const struct pvr_device_enhancements pvr_device_enhancements_4_46_6_62 = {
.has_ern35421 = true,
.has_ern38020 = true,
.has_ern38748 = true,
.has_ern42064 = true,
.has_ern42307 = true,
.has_ern45493 = true,
};
static const struct pvr_device_quirks pvr_device_quirks_4_46_6_62 = {
.has_brn44079 = true,
.has_brn49927 = true,
.has_brn51025 = true,
.has_brn51210 = true,
.has_brn51764 = true,
.has_brn52354 = true,
.has_brn52942 = true,
.has_brn58839 = true,
.has_brn62269 = true,
.has_brn66011 = true,
.has_brn70165 = true,
.has_brn74056 = true,
};
static const struct pvr_device_info pvr_device_info_4_46_6_62 = {
.ident = {
PVR_DEVICE_IDENT_4_V_6_62,
.b = 4,
.v = 46,
.n = 6,
.c = 62,
},
.features = pvr_device_features_4_V_6_62,
.enhancements = pvr_device_enhancements_4_46_6_62,
.quirks = pvr_device_quirks_4_46_6_62,
};
#endif /* GX6650_H */
+24
View File
@@ -0,0 +1,24 @@
# Copyright © 2022 Imagination Technologies Ltd.
# SPDX-License-Identifier: MIT
pvr_device_info_dir = join_paths(meson.current_source_dir(), 'device_info')
libpowervr_common = static_library(
'powervr_common',
[
'pvr_debug.c',
'pvr_device_info.c',
'pvr_dump.c',
'pvr_dump_info.c',
'pvr_util.c',
'pvr_ycbcr.c',
sha1_h,
],
include_directories : [
inc_include,
inc_src,
inc_imagination,
],
c_args : [imagination_c_args, no_override_init_args],
gnu_symbol_visibility : 'hidden',
)
+59
View File
@@ -0,0 +1,59 @@
/*
* Copyright © 2022 Imagination Technologies Ltd.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#include <stdint.h>
#include "util/u_debug.h"
#include "pvr_debug.h"
uint32_t PVR_DEBUG = 0;
/* clang-format off */
static const struct debug_named_value debug_control[] = {
{ "cs", PVR_DEBUG_DUMP_CONTROL_STREAM,
"Dump the contents of the control stream buffer on every job submit." },
{ "bo_track", PVR_DEBUG_TRACK_BOS,
"Track all buffer objects with at least one reference." },
{ "vk_desc", PVR_DEBUG_VK_DUMP_DESCRIPTOR_SET_LAYOUT,
"Dump descriptor set and pipeline layouts." },
{ "info", PVR_DEBUG_INFO,
"Display information about the driver and device." },
DEBUG_NAMED_VALUE_END
};
/* clang-format on */
DEBUG_GET_ONCE_FLAGS_OPTION(pvr_debug, "PVR_DEBUG", debug_control, 0)
#define PVR_DEBUG_SET(x) PVR_DEBUG |= (PVR_DEBUG_##x)
void pvr_process_debug_variable(void)
{
PVR_DEBUG = debug_get_option_pvr_debug();
/* Perform any automatic selections. For example, if one debug option
* implies another it should be set here.
*/
if (PVR_IS_DEBUG_SET(DUMP_CONTROL_STREAM))
PVR_DEBUG_SET(TRACK_BOS);
}
+44
View File
@@ -0,0 +1,44 @@
/*
* Copyright © 2022 Imagination Technologies Ltd.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#ifndef PVR_DEBUG_H
#define PVR_DEBUG_H
#include <stdint.h>
#include "util/macros.h"
extern uint32_t PVR_DEBUG;
/* clang-format off */
#define PVR_IS_DEBUG_SET(x) unlikely(PVR_DEBUG & PVR_DEBUG_##x)
/* clang-format on */
#define PVR_DEBUG_DUMP_CONTROL_STREAM BITFIELD_BIT(0)
#define PVR_DEBUG_TRACK_BOS BITFIELD_BIT(1)
#define PVR_DEBUG_VK_DUMP_DESCRIPTOR_SET_LAYOUT BITFIELD_BIT(2)
#define PVR_DEBUG_INFO BITFIELD_BIT(3)
void pvr_process_debug_variable(void);
#endif /* PVR_DEBUG_H */
+125
View File
@@ -0,0 +1,125 @@
/*
* Copyright © 2022 Imagination Technologies Ltd.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
/* TODO: This file is currently hand-maintained. However, the intention is to
* auto-generate it in the future based on the hwdefs.
*/
#include <assert.h>
#include <errno.h>
#include <string.h>
#include "pvr_device_info.h"
#include "device_info/g6110.h"
#include "device_info/gx6250.h"
#include "device_info/gx6650.h"
#include "device_info/ge7800.h"
#include "device_info/ge8300.h"
#include "device_info/axe-1-16m.h"
#include "device_info/bxe-2-32.h"
#include "device_info/bxe-4-32.h"
#include "device_info/bxm-4-64.h"
#include "device_info/bxs-4-64.h"
#include "util/u_string.h"
static const struct pvr_device_info *device_infos[] = {
/* clang-format off */
&pvr_device_info_4_40_2_51,
&pvr_device_info_4_45_2_58,
&pvr_device_info_4_46_6_62,
&pvr_device_info_5_9_1_46,
&pvr_device_info_15_5_1_64,
&pvr_device_info_22_67_54_30,
&pvr_device_info_22_68_54_30,
&pvr_device_info_22_102_54_38,
&pvr_device_info_33_15_11_3,
&pvr_device_info_36_29_52_182,
&pvr_device_info_36_50_54_182,
&pvr_device_info_36_52_104_182,
&pvr_device_info_36_53_104_796,
&pvr_device_info_36_56_104_183,
/* clang-format on */
};
/**
* Initialize PowerVR device information.
*
* \param info Device info structure to initialize.
* \param bvnc Packed BVNC.
* \return
* * 0 on success, or
* * -%ENODEV if the device is not supported.
*/
int pvr_device_info_init(struct pvr_device_info *info, uint64_t bvnc)
{
#define CASE_PACKED_BVNC_DEVICE_INFO(_b, _v, _n, _c) \
case PVR_BVNC_PACK(_b, _v, _n, _c): \
*info = pvr_device_info_##_b##_##_v##_##_n##_##_c; \
return 0
switch (bvnc) {
CASE_PACKED_BVNC_DEVICE_INFO(4, 40, 2, 51);
CASE_PACKED_BVNC_DEVICE_INFO(4, 45, 2, 58);
CASE_PACKED_BVNC_DEVICE_INFO(4, 46, 6, 62);
CASE_PACKED_BVNC_DEVICE_INFO(5, 9, 1, 46);
CASE_PACKED_BVNC_DEVICE_INFO(15, 5, 1, 64);
CASE_PACKED_BVNC_DEVICE_INFO(22, 67, 54, 30);
CASE_PACKED_BVNC_DEVICE_INFO(22, 68, 54, 30);
CASE_PACKED_BVNC_DEVICE_INFO(22, 102, 54, 38);
CASE_PACKED_BVNC_DEVICE_INFO(33, 15, 11, 3);
CASE_PACKED_BVNC_DEVICE_INFO(36, 29, 52, 182);
CASE_PACKED_BVNC_DEVICE_INFO(36, 50, 54, 182);
CASE_PACKED_BVNC_DEVICE_INFO(36, 52, 104, 182);
CASE_PACKED_BVNC_DEVICE_INFO(36, 53, 104, 796);
CASE_PACKED_BVNC_DEVICE_INFO(36, 56, 104, 183);
}
#undef CASE_PACKED_BVNC_DEVICE_INFO
assert(!"Unsupported Device");
return -ENODEV;
}
/**
* Initialize PowerVR device information from a public name.
*
* \param info Device info structure to initialize.
* \param public_name Device public name.
* \return True if successful.
*/
bool pvr_device_info_init_public_name(struct pvr_device_info *info,
const char *public_name)
{
for (unsigned d = 0; d < ARRAY_SIZE(device_infos); ++d) {
if (strcasecmp(public_name, device_infos[d]->ident.public_name))
continue;
memcpy(info, device_infos[d], sizeof(*info));
return true;
}
return false;
}
+431
View File
@@ -0,0 +1,431 @@
/*
* Copyright © 2022 Imagination Technologies Ltd.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#ifndef PVR_DEVICE_INFO_H
#define PVR_DEVICE_INFO_H
/* TODO: This file is currently hand-maintained. However, the intention is to
* auto-generate it in the future based on the hwdefs.
*/
#include <assert.h>
#include <errno.h>
#include <stdbool.h>
#include <stdint.h>
#include "util/log.h"
#include "util/macros.h"
#define PVR_BVNC_PACK_SHIFT_B 48
#define PVR_BVNC_PACK_SHIFT_V 32
#define PVR_BVNC_PACK_SHIFT_N 16
#define PVR_BVNC_PACK_SHIFT_C 0
#define PVR_BVNC_PACK_MASK_B UINT64_C(0xFFFF000000000000)
#define PVR_BVNC_PACK_MASK_V UINT64_C(0x0000FFFF00000000)
#define PVR_BVNC_PACK_MASK_N UINT64_C(0x00000000FFFF0000)
#define PVR_BVNC_PACK_MASK_C UINT64_C(0x000000000000FFFF)
enum pvr_device_arch {
PVR_DEVICE_ARCH_ROGUE,
};
/**
* Packs B, V, N and C values into a 64-bit unsigned integer.
*
* The packed layout is as follows:
*
* \verbatim
* +--------+--------+--------+-------+
* | 63..48 | 47..32 | 31..16 | 15..0 |
* +========+========+========+=======+
* | B | V | N | C |
* +--------+--------+--------+-------+
* \endverbatim
*
* #pvr_get_packed_bvnc() should be used instead of this macro when a
* #pvr_device_information is available in order to ensure proper type checking.
*
* \param b Branch ID.
* \param v Version ID.
* \param n Number of scalable units.
* \param c Config ID.
* \return Packed BVNC.
*
* \sa #pvr_get_packed_bvnc(), #PVR_BVNC_UNPACK_B(), #PVR_BVNC_UNPACK_V(),
* #PVR_BVNC_UNPACK_N() and #PVR_BVNC_UNPACK_C()
*/
#define PVR_BVNC_PACK(b, v, n, c) \
((((uint64_t)(b) << PVR_BVNC_PACK_SHIFT_B) & PVR_BVNC_PACK_MASK_B) | \
(((uint64_t)(v) << PVR_BVNC_PACK_SHIFT_V) & PVR_BVNC_PACK_MASK_V) | \
(((uint64_t)(n) << PVR_BVNC_PACK_SHIFT_N) & PVR_BVNC_PACK_MASK_N) | \
(((uint64_t)(c) << PVR_BVNC_PACK_SHIFT_C) & PVR_BVNC_PACK_MASK_C))
/**
* Unpacks B value (branch ID) from packed BVNC.
*
* \param bvnc Packed BVNC.
* \return Branch ID.
*
* \sa #PVR_BVNC_UNPACK_V(), #PVR_BVNC_UNPACK_N(), #PVR_BVNC_UNPACK_C(),
* #pvr_get_packed_bvnc() and #PVR_BVNC_PACK()
*/
#define PVR_BVNC_UNPACK_B(bvnc) \
((uint16_t)(((bvnc) & PVR_BVNC_PACK_MASK_B) >> PVR_BVNC_PACK_SHIFT_B))
/**
* Unpacks V value (version ID) from packed BVNC.
*
* \param bvnc Packed BVNC.
* \return Version ID.
*
* \sa #PVR_BVNC_UNPACK_B(), #PVR_BVNC_UNPACK_N(), #PVR_BVNC_UNPACK_C(),
* #pvr_get_packed_bvnc() and #PVR_BVNC_PACK()
*/
#define PVR_BVNC_UNPACK_V(bvnc) \
((uint16_t)(((bvnc) & PVR_BVNC_PACK_MASK_V) >> PVR_BVNC_PACK_SHIFT_V))
/**
* Unpacks N value (number of scalable units) from packed BVNC.
*
* \param bvnc Packed BVNC.
* \return Number of scalable units.
*
* \sa #PVR_BVNC_UNPACK_B(), #PVR_BVNC_UNPACK_V(), #PVR_BVNC_UNPACK_C(),
* #pvr_get_packed_bvnc() and #PVR_BVNC_PACK()
*/
#define PVR_BVNC_UNPACK_N(bvnc) \
((uint16_t)(((bvnc) & PVR_BVNC_PACK_MASK_N) >> PVR_BVNC_PACK_SHIFT_N))
/**
* Unpacks C value (config ID) from packed BVNC.
*
* \param bvnc Packed BVNC.
* \return Config ID.
*
* \sa #PVR_BVNC_UNPACK_B(), #PVR_BVNC_UNPACK_V(), #PVR_BVNC_UNPACK_N(),
* #pvr_get_packed_bvnc() and #PVR_BVNC_PACK()
*/
#define PVR_BVNC_UNPACK_C(bvnc) \
((uint16_t)(((bvnc) & PVR_BVNC_PACK_MASK_C) >> PVR_BVNC_PACK_SHIFT_C))
/**
* Tests whether a physical device has a given feature.
*
* Feature names are derived from those found in #pvr_device_features by
* dropping the 'has_' prefix, which is applied by this macro.
*
* \param dev_info #pvr_device_info object associated with the target physical
* device.
* \param feature Device feature name.
*
* \return
* * true if the named feature is present in the hardware.
* * false if the named feature is not present in the hardware.
*
* \sa #PVR_FEATURE_VALUE() and #PVR_GET_FEATURE_VALUE()
*/
#define PVR_HAS_FEATURE(dev_info, feature) ((dev_info)->features.has_##feature)
/**
* Gets a physical device feature value if feature is supported.
*
* Feature names are derived from those found in #pvr_device_features by
* dropping the 'has_' prefix.
*
* This macro should be used in preference to #PVR_GET_FEATURE_VALUE() as it has
* proper error handling.
*
* \param dev_info #pvr_device_info object associated with the target physical
* device.
* \param feature Feature name.
* \param value_out Feature value.
*
* \return
* * 0 on success, or
* * -%EINVAL if the named feature is not present in the hardware.
*
* \sa #PVR_HAS_FEATURE() and #PVR_GET_FEATURE_VALUE()
*/
#define PVR_FEATURE_VALUE(dev_info, feature, value_out) \
({ \
const struct pvr_device_info *__dev_info = dev_info; \
int __ret = -EINVAL; \
if (__dev_info->features.has_##feature) { \
*(value_out) = __dev_info->features.feature; \
__ret = 0; \
} \
__ret; \
})
/**
* Gets a physical device feature value if supported, but otherwise returns a
* default value.
*
* Feature names are derived from those found in #pvr_device_features by
* dropping the 'has_' prefix.
*
* #PVR_FEATURE_VALUE() should be used in preference to this macro when errors
* can be returned by the caller. This macro is intended for cases where errors
* can't be returned.
*
* \param dev_info #pvr_device_info object associated with the target
* physical device.
* \param feature Feature name.
* \param default_value Default feature value.
*
* \return Feature value.
*
* \sa #PVR_HAS_FEATURE() and #PVR_FEATURE_VALUE()
*/
#define PVR_GET_FEATURE_VALUE(dev_info, feature, default_value) \
({ \
const struct pvr_device_info *__dev_info = dev_info; \
__typeof__(default_value) __ret = default_value; \
if (__dev_info->features.has_##feature) { \
__ret = __dev_info->features.feature; \
} else { \
mesa_logw("Missing " #feature \
" feature (defaulting to: " #default_value ")"); \
assert(0); \
} \
__ret; \
})
/**
* Tests whether a physical device has a given enhancement.
*
* Enhancement numbers are derived from those found in #pvr_device_enhancements
* by dropping the 'has_ern' prefix, which is applied by this macro.
*
* \param dev_info #pvr_device_info object associated with the target physical
* device.
* \param number Enhancement number.
*
* \return
* * true if the enhancement is present in the hardware.
* * false if the enhancement is not present in the hardware.
*/
#define PVR_HAS_ENHANCEMENT(dev_info, number) \
((dev_info)->enhancements.has_ern##number)
/**
* Tests whether a physical device has a given quirk.
*
* Quirk numbers are derived from those found in #pvr_device_quirks by
* dropping the 'has_brn' prefix, which is applied by this macro.
*
* \param dev_info #pvr_device_info object associated with the target physical
* device.
* \param number Quirk number.
*
* \return
* * true if the quirk is present in the hardware.
* * false if the quirk is not present in the hardware.
*/
#define PVR_HAS_QUIRK(dev_info, number) ((dev_info)->quirks.has_brn##number)
struct pvr_device_ident {
enum pvr_device_arch arch;
uint16_t b, v, n, c;
uint32_t device_id;
const char *series_name;
const char *public_name;
};
struct pvr_device_features {
bool has_astc : 1;
bool has_cluster_grouping : 1;
bool has_common_store_size_in_dwords : 1;
bool has_compute : 1;
bool has_compute_morton_capable : 1;
bool has_compute_overlap : 1;
bool has_eight_output_registers : 1;
bool has_fb_cdc_v4 : 1;
bool has_fbcdc_algorithm : 1;
bool has_gpu_multicore_support : 1;
bool has_gs_rta_support : 1;
bool has_ipf_creq_pf : 1;
bool has_isp_max_tiles_in_flight : 1;
bool has_isp_samples_per_pixel : 1;
bool has_max_instances_per_pds_task : 1;
bool has_max_multisample : 1;
bool has_max_partitions : 1;
bool has_max_usc_tasks : 1;
bool has_num_clusters : 1;
bool has_num_raster_pipes : 1;
bool has_paired_tiles : 1;
bool has_pbe2_in_xe : 1;
bool has_pbe_filterable_f16 : 1;
bool has_pbe_stride_align_1pixel : 1;
bool has_pbe_yuv : 1;
bool has_pds_ddmadt : 1;
bool has_roguexe : 1;
bool has_screen_size8K : 1;
bool has_simple_internal_parameter_format : 1;
bool has_simple_internal_parameter_format_v1 : 1;
bool has_simple_internal_parameter_format_v2 : 1;
bool has_simple_parameter_format_version : 1;
bool has_slc_cache_line_size_bits : 1;
bool has_slc_mcu_cache_controls : 1;
bool has_tf_bicubic_filter : 1;
bool has_tile_per_usc : 1;
bool has_tile_size_16x16 : 1;
bool has_tile_size_x : 1;
bool has_tile_size_y : 1;
bool has_tpu_array_textures : 1;
bool has_tpu_border_colour_enhanced : 1;
bool has_tpu_dm_global_registers : 1;
bool has_tpu_extended_integer_lookup : 1;
bool has_tpu_image_state_v2 : 1;
bool has_tpu_parallel_instances : 1;
bool has_unified_store_depth : 1;
bool has_usc_alu_roundingmode_rne : 1;
bool has_usc_f16sop_u8 : 1;
bool has_usc_itrsmp : 1;
bool has_usc_itrsmp_enhanced : 1;
bool has_usc_itr_parallel_instances : 1;
bool has_usc_min_output_registers_per_pix : 1;
bool has_usc_pixel_partition_mask : 1;
bool has_usc_slots : 1;
bool has_uvs_banks : 1;
bool has_uvs_pba_entries : 1;
bool has_uvs_vtx_entries : 1;
bool has_vdm_cam_size : 1;
bool has_vdm_degenerate_culling : 1;
bool has_xpu_max_slaves : 1;
bool has_xt_top_infrastructure : 1;
bool has_zls_subtile : 1;
uint32_t common_store_size_in_dwords;
uint32_t fbcdc_algorithm;
uint32_t isp_max_tiles_in_flight;
uint32_t isp_samples_per_pixel;
uint32_t max_instances_per_pds_task;
uint32_t max_multisample;
uint32_t max_partitions;
uint32_t max_usc_tasks;
uint32_t num_clusters;
uint32_t num_raster_pipes;
uint32_t simple_parameter_format_version;
uint32_t slc_cache_line_size_bits;
uint32_t tile_size_x;
uint32_t tile_size_y;
uint32_t tpu_parallel_instances;
uint32_t unified_store_depth;
uint32_t usc_itr_parallel_instances;
uint32_t usc_min_output_registers_per_pix;
uint32_t usc_slots;
uint32_t uvs_banks;
uint32_t uvs_pba_entries;
uint32_t uvs_vtx_entries;
uint32_t vdm_cam_size;
uint32_t xpu_max_slaves;
/* Derived features. */
bool has_requires_fb_cdc_zls_setup : 1;
bool has_s8xe : 1;
};
struct pvr_device_enhancements {
bool has_ern35421 : 1;
bool has_ern38020 : 1;
bool has_ern38748 : 1;
bool has_ern42064 : 1;
bool has_ern42307 : 1;
bool has_ern45493 : 1;
};
struct pvr_device_quirks {
bool has_brn44079 : 1;
bool has_brn47727 : 1;
bool has_brn48492 : 1;
bool has_brn48545 : 1;
bool has_brn49032 : 1;
bool has_brn49927 : 1;
bool has_brn51025 : 1;
bool has_brn51210 : 1;
bool has_brn51764 : 1;
bool has_brn52354 : 1;
bool has_brn52942 : 1;
bool has_brn58839 : 1;
bool has_brn62269 : 1;
bool has_brn66011 : 1;
bool has_brn70165 : 1;
bool has_brn72168 : 1;
bool has_brn72463 : 1;
bool has_brn74056 : 1;
};
struct pvr_device_info {
struct pvr_device_ident ident;
struct pvr_device_features features;
struct pvr_device_enhancements enhancements;
struct pvr_device_quirks quirks;
};
struct pvr_device_runtime_info {
uint64_t min_free_list_size;
uint64_t max_free_list_size;
uint64_t reserved_shared_size;
uint64_t total_reserved_partition_size;
uint64_t num_phantoms;
uint64_t max_coeffs;
uint64_t cdm_max_local_mem_size_regs;
uint32_t core_count;
};
/**
* Packs B, V, N and C values into a 64-bit unsigned integer.
*
* The packed layout is as follows:
*
* \verbatim
* +--------+--------+--------+-------+
* | 63..48 | 47..32 | 31..16 | 15..0 |
* +========+========+========+=======+
* | B | V | N | C |
* +--------+--------+--------+-------+
* \endverbatim
*
* This should be used in preference to #PVR_BVNC_PACK() when a
* #pvr_device_info is available in order to ensure proper type checking.
*
* \param dev_info Device information.
* \return Packed BVNC.
*/
static ALWAYS_INLINE uint64_t
pvr_get_packed_bvnc(const struct pvr_device_info *dev_info)
{
return PVR_BVNC_PACK(dev_info->ident.b,
dev_info->ident.v,
dev_info->ident.n,
dev_info->ident.c);
}
int pvr_device_info_init(struct pvr_device_info *info, uint64_t bvnc);
bool pvr_device_info_init_public_name(struct pvr_device_info *info,
const char *public_name);
#endif /* PVR_DEVICE_INFO_H */
+299
View File
@@ -0,0 +1,299 @@
/*
* Copyright © 2022 Imagination Technologies Ltd.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#include <inttypes.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include "pvr_dump.h"
#include "pvr_util.h"
#include "util/u_math.h"
const struct pvr_dump_ctx __pvr_dump_ctx_invalid = {
.active_child = &__pvr_dump_ctx_invalid,
};
/*****************************************************************************
Hex dumps
*****************************************************************************/
#define HEX_WORD_SIZE ((unsigned)sizeof(uint32_t))
#define HEX_BYTE_FMT "%02" PRIx8
/* This must be even, and should probably always be a power of 2. */
#define HEX_LINE_SIZE (HEX_WORD_SIZE * 8)
struct pvr_dump_hex_ctx {
struct pvr_dump_ctx base;
const uint8_t *start_ptr;
const uint8_t *end_ptr;
uint64_t nr_bytes;
uint32_t offset_digits;
/* User-modifiable values */
const uint8_t *line_ptr;
uint32_t prev_non_zero_trailing_zero_bytes;
uint64_t prev_non_zero_leading_zero_lines;
const uint8_t *prev_non_zero_line;
uint64_t zero_lines;
};
static bool pvr_dump_hex_ctx_push(struct pvr_dump_hex_ctx *const ctx,
struct pvr_dump_buffer_ctx *const parent_ctx,
const uint64_t nr_bytes)
{
const uint64_t real_nr_bytes = nr_bytes ? nr_bytes
: parent_ctx->remaining_size;
bool ret;
if (parent_ctx->remaining_size < nr_bytes)
return false;
ret = pvr_dump_ctx_push(&ctx->base, &parent_ctx->base);
if (!ret)
return false;
ctx->start_ptr = parent_ctx->ptr;
ctx->end_ptr = ctx->start_ptr + real_nr_bytes;
ctx->nr_bytes = real_nr_bytes;
ctx->offset_digits = u64_hex_digits(real_nr_bytes);
ctx->line_ptr = ctx->start_ptr;
ctx->prev_non_zero_trailing_zero_bytes = 0;
ctx->prev_non_zero_leading_zero_lines = 0;
ctx->prev_non_zero_line = NULL;
ctx->zero_lines = 0;
return true;
}
static struct pvr_dump_buffer_ctx *
pvr_dump_hex_ctx_pop(struct pvr_dump_hex_ctx *const ctx)
{
struct pvr_dump_buffer_ctx *parent;
struct pvr_dump_ctx *parent_base;
if (ctx->line_ptr != ctx->end_ptr) {
ctx->base.ok = false;
return NULL;
}
parent_base = pvr_dump_ctx_pop(&ctx->base);
if (!parent_base)
return NULL;
parent = container_of(parent_base, struct pvr_dump_buffer_ctx, base);
pvr_dump_buffer_advance(parent, ctx->nr_bytes);
return parent;
}
static inline void pvr_dump_hex_print_prefix(const struct pvr_dump_hex_ctx *ctx,
const uint64_t offset)
{
pvr_dump_printf(&ctx->base,
PVR_DUMP_OFFSET_PREFIX,
ctx->offset_digits,
offset);
}
#define pvr_dump_hex_println(ctx, offset, format, args...) \
pvr_dump_println(&(ctx)->base, \
PVR_DUMP_OFFSET_PREFIX format, \
(ctx)->offset_digits, \
offset, \
##args)
#define pvr_dump_hex_println_no_prefix(ctx, format, args...) \
pvr_dump_println(&(ctx)->base, \
"%*c" format, \
(ctx)->offset_digits + 3, \
' ', \
##args)
static void pvr_dump_hex_print_line(const struct pvr_dump_hex_ctx *ctx,
const uint8_t *const line_ptr,
const uint32_t truncate)
{
const uint32_t nr_bytes =
MIN2(HEX_LINE_SIZE - truncate, ctx->end_ptr - line_ptr);
pvr_dump_hex_print_prefix(ctx, line_ptr - ctx->start_ptr);
for (uint32_t i = 0; i < nr_bytes; i++) {
if (i == HEX_LINE_SIZE / 2)
pvr_dump_printf_cont(&ctx->base, " ");
if (i % HEX_WORD_SIZE == 0)
pvr_dump_printf_cont(&ctx->base, " ");
if (line_ptr[i])
pvr_dump_printf_cont(&ctx->base, HEX_BYTE_FMT, line_ptr[i]);
else
pvr_dump_printf_cont(&ctx->base, "..");
}
pvr_dump_print_eol(&ctx->base);
}
static void
pvr_dump_hex_print_zero_lines(const struct pvr_dump_hex_ctx *const ctx,
const uint64_t zero_lines)
{
const uint64_t zero_bytes = zero_lines * HEX_LINE_SIZE;
if (!zero_lines)
return;
/* If we've only buffered a single zero line, print it normally. We don't
* save any space by folding it, and it's more readable this way.
*/
if (zero_lines == 1) {
pvr_dump_hex_print_line(ctx, ctx->prev_non_zero_line + HEX_LINE_SIZE, 0);
return;
}
pvr_dump_hex_println_no_prefix(ctx,
" + %" PRIu64 " zero line%s (%" PRIu64
"/0x%" PRIx64 " bytes)",
zero_lines,
zero_lines == 1 ? "" : "s",
zero_bytes,
zero_bytes);
}
static void
pvr_dump_hex_print_trailing_zeroes(const struct pvr_dump_hex_ctx *const ctx)
{
const uint64_t zero_bytes =
ctx->zero_lines * HEX_LINE_SIZE + ctx->prev_non_zero_trailing_zero_bytes;
if (!ctx->prev_non_zero_trailing_zero_bytes)
return pvr_dump_hex_print_zero_lines(ctx, ctx->zero_lines);
if (!ctx->zero_lines)
return;
pvr_dump_hex_println_no_prefix(ctx,
" + %" PRIu64 "+%" PRIu32
" zero lines (%" PRIu64 "/0x%" PRIx64
" bytes)",
ctx->zero_lines,
ctx->prev_non_zero_trailing_zero_bytes,
zero_bytes,
zero_bytes);
}
static void pvr_dump_hex_process_line(struct pvr_dump_hex_ctx *const ctx,
uint32_t truncate)
{
const uint32_t max_bytes = HEX_LINE_SIZE - truncate;
uint32_t trailing_zero_bytes = max_bytes;
for (uint32_t i = max_bytes; i > 0; i--) {
if (ctx->line_ptr[i - 1]) {
trailing_zero_bytes = HEX_LINE_SIZE - i;
break;
}
}
if (trailing_zero_bytes == max_bytes) {
/* No non-zero words were found in this line; mark it and move on. */
ctx->zero_lines++;
return;
}
/* We have at least one non-zero word in this line. If we have a previous
* non-zero line stored, collapse and print any leading zero-only lines
* before it then print the stored line.
*/
if (ctx->prev_non_zero_line) {
pvr_dump_hex_print_zero_lines(ctx, ctx->prev_non_zero_leading_zero_lines);
pvr_dump_hex_print_line(ctx, ctx->prev_non_zero_line, truncate);
}
/* Now we store the current non-zero line for printing later. This way we
* can treat the last non-zero line specially.
*/
ctx->prev_non_zero_line = ctx->line_ptr;
ctx->prev_non_zero_leading_zero_lines = ctx->zero_lines;
ctx->prev_non_zero_trailing_zero_bytes = trailing_zero_bytes;
ctx->zero_lines = 0;
}
static void pvr_dump_hex(struct pvr_dump_hex_ctx *const ctx)
{
while (ctx->line_ptr < (ctx->end_ptr - HEX_LINE_SIZE)) {
pvr_dump_hex_process_line(ctx, 0);
ctx->line_ptr += HEX_LINE_SIZE;
}
pvr_dump_hex_process_line(ctx,
HEX_LINE_SIZE - (ctx->end_ptr - ctx->line_ptr));
ctx->line_ptr = ctx->end_ptr;
if (ctx->prev_non_zero_line) {
/* If we don't have any zero lines to collapse, print the trailing zeroes
* on the last line.
*/
if (!ctx->zero_lines) {
pvr_dump_hex_print_line(ctx, ctx->prev_non_zero_line, 0);
} else {
pvr_dump_hex_print_zero_lines(ctx,
ctx->prev_non_zero_leading_zero_lines);
pvr_dump_hex_print_line(ctx,
ctx->prev_non_zero_line,
ctx->prev_non_zero_trailing_zero_bytes);
/* Collapse and print any trailing zeroes. */
pvr_dump_hex_print_trailing_zeroes(ctx);
}
} else {
/* We made it to the end of the buffer without ever encountering a
* non-zero word. Make this known.
*/
pvr_dump_hex_println(ctx, UINT64_C(0), " <empty buffer>");
}
pvr_dump_hex_println(ctx, ctx->nr_bytes, " <end of buffer>");
}
bool pvr_dump_buffer_hex(struct pvr_dump_buffer_ctx *const ctx,
const uint64_t nr_bytes)
{
struct pvr_dump_hex_ctx hex_ctx;
if (!pvr_dump_hex_ctx_push(&hex_ctx, ctx, nr_bytes))
return false;
pvr_dump_hex(&hex_ctx);
return !!pvr_dump_hex_ctx_pop(&hex_ctx);
}
+739
View File
@@ -0,0 +1,739 @@
/*
* Copyright © 2022 Imagination Technologies Ltd.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#ifndef PVR_DUMP_H
#define PVR_DUMP_H
#include <inttypes.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include "pvr_types.h"
#include "pvr_util.h"
#include "util/macros.h"
#include "util/u_math.h"
/** BASIC PRINTING **/
#define PVR_DUMP_OFFSET_PREFIX "[%0*" PRIx64 "] "
/** CONTEXTS **/
#define PVR_DUMP_INDENT_SIZE 2U
#define PVR_DUMP_FIELD_COLUMN_WIDTH 36U
/* This is an invalid context used to permanently mark popped contexts as
* unusable. All operations on a context check that it's the "top" context
* by ensuring it has no active child. The only way to remove the active child
* of a context is by popping the active child directly. Assigning an invalid
* context as the active child of a context therefore makes it impossible to
* use.
*/
extern const struct pvr_dump_ctx __pvr_dump_ctx_invalid;
struct pvr_dump_ctx {
/* This is const because only the "top" context should ever be modified. It's
* fine to extract information from the parent context, but not to modify it.
* There is *one* exception: pvr_dump_ctx_pop() must cast away the const to
* return the parent context as the new "top" context. This is considered
* sound because the parent context was not const when assigned here in
* pvr_dump_ctx_push().
*/
const struct pvr_dump_ctx *parent;
/* This is const because it's not meant to be used for access - it's just a
* way of checking if this context is the "top" context (see the comment on
* __pvr_dump_ctx_invalid for more details). Unlike parent, the const
* qualifier here should never be cast away.
*/
const struct pvr_dump_ctx *active_child;
FILE *file;
const char *name;
uint32_t allowed_child_depth;
uint32_t parent_indent;
/* User-modifiable values */
uint32_t indent;
bool ok;
};
static inline uint32_t
__pvr_dump_ctx_get_indent(const struct pvr_dump_ctx *const ctx)
{
return (ctx->parent_indent + ctx->indent) * PVR_DUMP_INDENT_SIZE;
}
struct pvr_dump_buffer_ctx {
struct pvr_dump_ctx base;
const void *initial_ptr;
uint64_t capacity;
/* User-modifiable values */
const void *ptr;
uint64_t remaining_size;
};
#define pvr_dump_printf(ctx, format, args...) \
pvr_dump_printf_cont(ctx, \
"%*s" format, \
__pvr_dump_ctx_get_indent(ctx), \
"", \
##args)
/* Same as pvr_dump_printf(), but with no indent.
* Intended for continuation lines.
*/
#define pvr_dump_printf_cont(ctx, format, args...) \
fprintf((ctx)->file, format, ##args)
#define pvr_dump_println(ctx, format, args...) \
pvr_dump_printf(ctx, format "\n", ##args)
#define pvr_dump_println_cont(ctx, format, args...) \
pvr_dump_printf_cont(ctx, format "\n", ##args)
#define pvr_dump_print_eol(ctx) fprintf((ctx)->file, "\n")
#define pvr_dump_mark_section(ctx, format, args...) \
do { \
pvr_dump_print_eol(ctx); \
pvr_dump_println(ctx, "------- " format " -------", ##args); \
} while (0)
#define pvr_dump_buffer_print_header_prefix(ctx) \
do { \
struct pvr_dump_buffer_ctx *_prefix_ctx = (ctx); \
pvr_dump_printf(&_prefix_ctx->base, \
PVR_DUMP_OFFSET_PREFIX, \
u64_dec_digits(_prefix_ctx->capacity), \
_prefix_ctx->capacity - _prefix_ctx->remaining_size); \
} while (0)
#define pvr_dump_buffer_print_header_line(ctx, format, args...) \
do { \
struct pvr_dump_buffer_ctx *_ctx = (ctx); \
pvr_dump_buffer_print_header_prefix(_ctx); \
pvr_dump_printf_cont(&_ctx->base, format "\n", ##args); \
} while (0)
#define pvr_dump_msg(ctx, prefix, ret, format, args...) \
({ \
bool _ret = (ret); \
struct pvr_dump_ctx *_ctx = (ctx); \
pvr_dump_println(_ctx, "<!" prefix "! " format ">", ##args); \
if (!_ret) \
_ctx->ok = _ret; \
_ret; \
})
#define pvr_dump_error(ctx, format, args...) \
pvr_dump_msg(ctx, "ERROR", false, format, ##args)
#define pvr_dump_warn(ctx, format, args...) \
pvr_dump_msg(ctx, "WARN", true, format, ##args)
static inline bool pvr_dump_ctx_require_top(struct pvr_dump_ctx *const ctx)
{
if (ctx->active_child != NULL)
return pvr_dump_error(ctx, "use of non-top context");
return true;
}
static inline void pvr_dump_indent(struct pvr_dump_ctx *const ctx)
{
ctx->indent++;
}
static inline void pvr_dump_dedent(struct pvr_dump_ctx *const ctx)
{
if (ctx->indent)
ctx->indent--;
}
static inline void __pvr_dump_ctx_init(struct pvr_dump_ctx *const ctx,
const struct pvr_dump_ctx *const parent,
FILE *const file,
const char *const name,
const uint32_t allowed_child_depth,
const uint32_t parent_indent)
{
ctx->parent = parent;
ctx->active_child = NULL;
ctx->file = file;
ctx->name = name;
ctx->allowed_child_depth = allowed_child_depth;
ctx->parent_indent = parent_indent;
ctx->indent = 0;
ctx->ok = true;
}
static inline void __pvr_dump_ctx_mark_popped(struct pvr_dump_ctx *const ctx)
{
ctx->active_child = &__pvr_dump_ctx_invalid;
}
static inline void pvr_dump_begin(struct pvr_dump_ctx *const root_ctx,
FILE *const file,
const char *const name,
const uint32_t max_depth)
{
__pvr_dump_ctx_init(root_ctx, NULL, file, name, max_depth, 0);
flockfile(file);
pvr_dump_println(root_ctx, "======= BEGIN %s =======", name);
}
static inline bool pvr_dump_end(struct pvr_dump_ctx *const root_ctx)
{
/* In order to end a dump, we must be in a root context (no parent) and have
* no active child context.
*/
if (!pvr_dump_ctx_require_top(root_ctx))
return false;
if (root_ctx->parent)
return pvr_dump_error(root_ctx, "ending non-root context");
pvr_dump_println(root_ctx, "======= END %s =======", root_ctx->name);
funlockfile(root_ctx->file);
__pvr_dump_ctx_mark_popped(root_ctx);
return true;
}
static inline bool pvr_dump_ctx_push(struct pvr_dump_ctx *const ctx,
struct pvr_dump_ctx *const parent_ctx)
{
if (!parent_ctx->ok)
return false;
if (!parent_ctx->allowed_child_depth)
return pvr_dump_error(parent_ctx, "context stack depth limit reached");
__pvr_dump_ctx_init(ctx,
parent_ctx,
parent_ctx->file,
parent_ctx->name,
parent_ctx->allowed_child_depth - 1,
parent_ctx->parent_indent + parent_ctx->indent);
parent_ctx->active_child = ctx;
return true;
}
static inline struct pvr_dump_ctx *
pvr_dump_ctx_pop(struct pvr_dump_ctx *const ctx)
{
struct pvr_dump_ctx *const parent = (struct pvr_dump_ctx *)ctx->parent;
if (!pvr_dump_ctx_require_top(ctx))
return NULL;
if (!parent) {
pvr_dump_error(ctx, "popped root context");
return NULL;
}
parent->active_child = NULL;
__pvr_dump_ctx_mark_popped(ctx);
return parent;
}
static inline bool
pvr_dump_buffer_ctx_push(struct pvr_dump_buffer_ctx *const ctx,
struct pvr_dump_ctx *const parent_ctx,
const void *const initial_ptr,
const uint64_t size)
{
if (!pvr_dump_ctx_push(&ctx->base, parent_ctx))
return false;
ctx->initial_ptr = initial_ptr;
ctx->capacity = size;
ctx->ptr = initial_ptr;
ctx->remaining_size = size;
return true;
}
static inline struct pvr_dump_ctx *
pvr_dump_buffer_ctx_pop(struct pvr_dump_buffer_ctx *const ctx)
{
return pvr_dump_ctx_pop(&ctx->base);
}
bool pvr_dump_buffer_hex(struct pvr_dump_buffer_ctx *ctx, uint64_t nr_bytes);
static inline void __pvr_dump_buffer_advance(struct pvr_dump_buffer_ctx *ctx,
const uint64_t nr_bytes)
{
ctx->ptr = (uint8_t *)ctx->ptr + nr_bytes;
ctx->remaining_size -= nr_bytes;
}
static inline bool pvr_dump_buffer_advance(struct pvr_dump_buffer_ctx *ctx,
const uint64_t nr_bytes)
{
if (!ctx->base.ok || !pvr_dump_ctx_require_top(&ctx->base))
return false;
if (nr_bytes > ctx->remaining_size)
return pvr_dump_error(&ctx->base, "advanced past end of context buffer");
__pvr_dump_buffer_advance(ctx, nr_bytes);
return true;
}
static inline void __pvr_dump_buffer_rewind(struct pvr_dump_buffer_ctx *ctx,
const uint32_t nr_bytes)
{
ctx->ptr = (uint8_t *)ctx->ptr - nr_bytes;
ctx->remaining_size += nr_bytes;
}
static inline bool pvr_dump_buffer_rewind(struct pvr_dump_buffer_ctx *ctx,
const uint32_t nr_bytes)
{
if (!ctx->base.ok || !pvr_dump_ctx_require_top(&ctx->base))
return false;
if (nr_bytes > ctx->capacity - ctx->remaining_size)
return pvr_dump_error(&ctx->base, "rewound past start of context buffer");
__pvr_dump_buffer_rewind(ctx, nr_bytes);
return true;
}
static inline bool pvr_dump_buffer_truncate(struct pvr_dump_buffer_ctx *ctx,
const uint64_t remaining_size)
{
if (!ctx->base.ok || !pvr_dump_ctx_require_top(&ctx->base))
return false;
if (remaining_size > ctx->remaining_size)
return pvr_dump_error(&ctx->base, "truncated to larger size");
ctx->remaining_size = remaining_size;
return true;
}
static inline const void *restrict pvr_dump_buffer_peek(
struct pvr_dump_buffer_ctx *const restrict ctx,
const uint64_t nr_bytes)
{
if (!ctx->base.ok || !pvr_dump_ctx_require_top(&ctx->base))
return NULL;
if (nr_bytes > ctx->remaining_size) {
pvr_dump_error(&ctx->base, "peeked past end of context buffer");
return NULL;
}
return ctx->ptr;
}
static inline const void *restrict pvr_dump_buffer_take(
struct pvr_dump_buffer_ctx *const restrict ctx,
const uint64_t nr_bytes)
{
const void *const ptr = pvr_dump_buffer_peek(ctx, nr_bytes);
if (ptr)
__pvr_dump_buffer_advance(ctx, nr_bytes);
return ptr;
}
static inline void
pvr_dump_buffer_restart(struct pvr_dump_buffer_ctx *const ctx)
{
ctx->ptr = ctx->initial_ptr;
ctx->remaining_size = ctx->capacity;
}
/*****************************************************************************
Field printers
*****************************************************************************/
#define pvr_dump_field(ctx, name, format, args...) \
pvr_dump_println(ctx, \
"%-*s : " format, \
PVR_DUMP_FIELD_COLUMN_WIDTH - \
__pvr_dump_ctx_get_indent(ctx), \
name, \
##args)
#define pvr_dump_field_computed(ctx, name, format, raw_format, args...) \
pvr_dump_field(ctx, name, format " (" raw_format ")", ##args)
#define pvr_dump_field_error(ctx, format, args...) \
({ \
struct pvr_dump_ctx *_ctx = (ctx); \
pvr_dump_field(_ctx, "<!ERROR!>", "<" format ">", ##args); \
_ctx->ok = false; \
false; \
})
/*****************************************************************************
Field printers: integers
*****************************************************************************/
static inline void pvr_dump_field_u32(struct pvr_dump_ctx *const ctx,
const char *const name,
const uint32_t value)
{
pvr_dump_field(ctx, name, "%" PRIu32, value);
}
static inline void pvr_dump_field_u32_units(struct pvr_dump_ctx *const ctx,
const char *const name,
const uint32_t value,
const char *const units)
{
pvr_dump_field(ctx, name, "%" PRIu32 " %s", value, units);
}
static inline void pvr_dump_field_u32_offset(struct pvr_dump_ctx *const ctx,
const char *const name,
const uint32_t value,
const uint32_t offset)
{
pvr_dump_field_computed(ctx,
name,
"%" PRIu32,
"%" PRIu32 " + %" PRIu32,
value + offset,
value,
offset);
}
static inline void pvr_dump_field_u32_scaled(struct pvr_dump_ctx *const ctx,
const char *const name,
const uint32_t value,
const uint32_t scale)
{
pvr_dump_field_computed(ctx,
name,
"%" PRIu32,
"%" PRIu32 " x %" PRIu32,
value * scale,
value,
scale);
}
static inline void
pvr_dump_field_u32_scaled_units(struct pvr_dump_ctx *const ctx,
const char *const name,
const uint32_t value,
const uint32_t scale,
const char *const units)
{
pvr_dump_field_computed(ctx,
name,
"%" PRIu32 " %s",
"%" PRIu32 " x %" PRIu32 " %s",
value * scale,
units,
value,
scale,
units);
}
static inline void pvr_dump_field_u32_zero(struct pvr_dump_ctx *const ctx,
const char *const name,
const uint32_t value,
const uint32_t zero_value)
{
if (value)
pvr_dump_field_u32(ctx, name, value);
else
pvr_dump_field_computed(ctx, name, "%" PRIu32, "0", zero_value);
}
static inline void pvr_dump_field_x32(struct pvr_dump_ctx *const ctx,
const char *const name,
const uint32_t value,
const uint32_t chars)
{
pvr_dump_field(ctx,
name,
"0x%0*" PRIx32,
chars,
value & BITFIELD_MASK(chars * 4));
}
static inline void pvr_dump_field_u64(struct pvr_dump_ctx *const ctx,
const char *const name,
const uint64_t value)
{
pvr_dump_field(ctx, name, "%" PRIu64, value);
}
static inline void pvr_dump_field_u64_units(struct pvr_dump_ctx *const ctx,
const char *const name,
const uint64_t value,
const char *const units)
{
pvr_dump_field(ctx, name, "%" PRIu64 " %s", value, units);
}
/*****************************************************************************
Field printers: floating point
*****************************************************************************/
static inline void pvr_dump_field_f32(struct pvr_dump_ctx *const ctx,
const char *const name,
const float value)
{
pvr_dump_field_computed(ctx, name, "%f", "0x%08" PRIx32, value, fui(value));
}
/*****************************************************************************
Field printers: fixed point
*****************************************************************************/
/* clang-format off */
static const char *const __fixed_frac_str_table_4[1 << 4] = {
"0", "0625", "125", "1875", "25", "3125", "375", "4375",
"5", "5625", "625", "6875", "75", "8125", "875", "9375",
};
/* clang-format on */
static inline void pvr_dump_field_uq4_4(struct pvr_dump_ctx *const ctx,
const char *const name,
const uint32_t raw_value)
{
const uint32_t int_part = (raw_value & BITFIELD_RANGE(4, 4)) >> 4;
const uint32_t frac_part = raw_value & BITFIELD_MASK(4);
pvr_dump_field_computed(ctx,
name,
"%" PRIu32 ".%s",
"0x%02" PRIx32, /* Or %0*x where *=(nr_bits+3)/4 */
int_part,
__fixed_frac_str_table_4[frac_part],
raw_value & BITFIELD_MASK(8));
}
static inline void pvr_dump_field_uq4_4_offset(struct pvr_dump_ctx *const ctx,
const char *const name,
const uint32_t raw_value,
const uint32_t raw_offset)
{
const uint32_t raw_offset_value = raw_value + raw_offset;
const uint32_t int_part = (raw_offset_value & BITFIELD_RANGE(4, 4)) >> 4;
const uint32_t frac_part = raw_offset_value & BITFIELD_MASK(4);
pvr_dump_field_computed(ctx,
name,
"%" PRIu32 ".%s",
"0x%02" PRIx32 " + 0x%02" PRIx32,
int_part,
__fixed_frac_str_table_4[frac_part],
raw_value & BITFIELD_MASK(8),
raw_offset);
}
/*****************************************************************************
Field printers: device address
*****************************************************************************/
static inline void pvr_dump_field_addr_non_null(struct pvr_dump_ctx *const ctx,
const char *const name,
const pvr_dev_addr_t value)
{
pvr_dump_field(ctx, name, PVR_DEV_ADDR_FMT, value.addr);
}
static inline void pvr_dump_field_addr(struct pvr_dump_ctx *const ctx,
const char *const name,
const pvr_dev_addr_t value)
{
if (value.addr)
pvr_dump_field_addr_non_null(ctx, name, value);
else
pvr_dump_field(ctx, name, "<null>");
}
static inline void pvr_dump_field_addr_split(struct pvr_dump_ctx *const ctx,
const char *const name,
const pvr_dev_addr_t msb,
const pvr_dev_addr_t lsb)
{
pvr_dump_field_addr(ctx, name, PVR_DEV_ADDR(msb.addr | lsb.addr));
pvr_dump_indent(ctx);
pvr_dump_field_addr_non_null(ctx, "msb", msb);
pvr_dump_field_addr_non_null(ctx, "lsb", lsb);
pvr_dump_dedent(ctx);
}
static inline void pvr_dump_field_addr_offset(struct pvr_dump_ctx *const ctx,
const char *const name,
const pvr_dev_addr_t value,
const pvr_dev_addr_t base)
{
pvr_dump_field_computed(ctx,
name,
PVR_DEV_ADDR_FMT,
PVR_DEV_ADDR_FMT " + " PVR_DEV_ADDR_FMT,
PVR_DEV_ADDR_OFFSET(base, value.addr).addr,
base.addr,
value.addr);
}
/*****************************************************************************
Field printers: enums
*****************************************************************************/
#define pvr_dump_field_enum(ctx, name, value, to_str) \
do { \
__typeof__(value) _value = (value); \
const char *_str = to_str(_value); \
if (!_str) \
_str = "<unknown>"; \
pvr_dump_field_computed(ctx, name, "%s", "%u", _str, _value); \
} while (0)
static inline const char *__bool_to_str(const bool b)
{
return b ? "yes" : "no";
}
/* A bool is just an enum with two values. */
static inline void pvr_dump_field_bool(struct pvr_dump_ctx *const ctx,
const char *const name,
const bool value)
{
pvr_dump_field_enum(ctx, name, value, __bool_to_str);
}
/*****************************************************************************
Field printers: string
*****************************************************************************/
static inline void pvr_dump_field_string(struct pvr_dump_ctx *const ctx,
const char *const name,
const char *const value)
{
pvr_dump_field(ctx, name, "%s", value);
}
/*****************************************************************************
Field printers: not present
*****************************************************************************/
static inline void pvr_dump_field_no_fields(struct pvr_dump_ctx *const ctx)
{
pvr_dump_println(ctx, "<no fields>");
}
static inline void pvr_dump_field_not_present(struct pvr_dump_ctx *const ctx,
const char *const name)
{
pvr_dump_field(ctx, name, "<not present>");
}
/*****************************************************************************
Field printers: helpers for members
*****************************************************************************/
/* clang-format off */
#define pvr_dump_field_member_u32(ctx, compound, member) \
pvr_dump_field_u32(ctx, #member, (compound)->member)
#define pvr_dump_field_member_u32_units(ctx, compound, member, units) \
pvr_dump_field_u32_units(ctx, #member, (compound)->member, units)
#define pvr_dump_field_member_u32_offset(ctx, compound, member, offset) \
pvr_dump_field_u32_offset(ctx, #member, (compound)->member, offset)
#define pvr_dump_field_member_u32_scaled(ctx, compound, member, scale) \
pvr_dump_field_u32_scaled(ctx, #member, (compound)->member, scale)
#define pvr_dump_field_member_u32_scaled_units(ctx, compound, member, scale, units) \
pvr_dump_field_u32_scaled_units(ctx, #member, (compound)->member, scale, units)
#define pvr_dump_field_member_u32_zero(ctx, compound, member, zero_value) \
pvr_dump_field_u32_zero(ctx, #member, (compound)->member, zero_value)
#define pvr_dump_field_member_x32(ctx, compound, member, chars) \
pvr_dump_field_x32(ctx, #member, (compound)->member, chars)
#define pvr_dump_field_member_u64(ctx, compound, member) \
pvr_dump_field_u64(ctx, #member, (compound)->member)
#define pvr_dump_field_member_u64_units(ctx, compound, member, units) \
pvr_dump_field_u64_units(ctx, #member, (compound)->member, units)
#define pvr_dump_field_member_f32(ctx, compound, member) \
pvr_dump_field_f32(ctx, #member, (compound)->member)
#define pvr_dump_field_member_uq4_4(ctx, compound, member) \
pvr_dump_field_uq4_4(ctx, #member, (compound)->member)
#define pvr_dump_field_member_uq4_4_offset(ctx, compound, member, raw_offset) \
pvr_dump_field_uq4_4_offset(ctx, #member, (compound)->member, raw_offset)
#define pvr_dump_field_member_addr(ctx, compound, member) \
pvr_dump_field_addr(ctx, #member, (compound)->member)
#define pvr_dump_field_member_addr_offset(ctx, compound, member, base) \
pvr_dump_field_addr_offset(ctx, #member, (compound)->member, base)
#define pvr_dump_field_member_enum(ctx, compound, member, to_str) \
pvr_dump_field_enum(ctx, #member, (compound)->member, to_str)
#define pvr_dump_field_member_bool(ctx, compound, member) \
pvr_dump_field_bool(ctx, #member, (compound)->member)
#define pvr_dump_field_member_string(ctx, compound, member) \
pvr_dump_field_string(ctx, #member, (compound)->member)
/* clang-format on */
#define pvr_dump_field_member_not_present(ctx, compound, member) \
do { \
(void)&(compound)->member; \
pvr_dump_field_not_present(ctx, #member); \
} while (0)
#endif /* PVR_DUMP_H */
+147
View File
@@ -0,0 +1,147 @@
/*
* Copyright © 2023 Imagination Technologies Ltd.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#include "git_sha1.h"
#include "pvr_dump_info.h"
#include "pvr_dump.h"
static inline void pvr_dump_field_bvnc(struct pvr_dump_ctx *ctx,
const char *const name,
const struct pvr_device_info *info)
{
pvr_dump_field_computed(ctx,
name,
"%" PRIu16 ".%" PRIu16 ".%" PRIu16 ".%" PRIu16,
"0x%08" PRIx64,
info->ident.b,
info->ident.v,
info->ident.n,
info->ident.c,
pvr_get_packed_bvnc(info));
}
static inline void pvr_dump_field_drm_version(struct pvr_dump_ctx *ctx,
const char *const name,
const char *const drm_name,
int drm_version_major,
int drm_version_minor,
int drm_version_patchlevel,
const char *const drm_date)
{
pvr_dump_field(ctx,
name,
"%s %d.%d.%d (%s)",
drm_name,
drm_version_major,
drm_version_minor,
drm_version_patchlevel,
drm_date);
}
static inline void pvr_dump_field_compatible_strings(struct pvr_dump_ctx *ctx,
char *const *comp)
{
char *const *temp_comp = comp;
uint32_t count_log10;
uint32_t index = 0;
if (!*comp) {
pvr_dump_println(ctx, "<empty>");
return;
}
while (*temp_comp++)
index++;
count_log10 = u32_dec_digits(index);
index = 0;
while (*comp)
pvr_dump_println(ctx, "[%0*" PRIu32 "] %s", count_log10, index++, *comp++);
}
void pvr_dump_physical_device_info(const struct pvr_device_dump_info *dump_info)
{
const struct pvr_device_runtime_info *run_info =
dump_info->device_runtime_info;
const struct pvr_device_info *dev_info = dump_info->device_info;
struct pvr_dump_ctx ctx;
pvr_dump_begin(&ctx, stderr, "DEBUG INFORMATION", 1);
pvr_dump_mark_section(&ctx, "General Info");
pvr_dump_indent(&ctx);
pvr_dump_field_string(&ctx, "Public Name", dev_info->ident.public_name);
pvr_dump_field_string(&ctx, "Series Name", dev_info->ident.series_name);
pvr_dump_field_bvnc(&ctx, "BVNC", dev_info);
pvr_dump_field_drm_version(&ctx,
"DRM Display Driver Version",
dump_info->drm_display.name,
dump_info->drm_display.major,
dump_info->drm_display.minor,
dump_info->drm_display.patchlevel,
dump_info->drm_display.date);
pvr_dump_field_drm_version(&ctx,
"DRM Render Driver Version",
dump_info->drm_render.name,
dump_info->drm_render.major,
dump_info->drm_render.minor,
dump_info->drm_render.patchlevel,
dump_info->drm_render.date);
pvr_dump_field_string(&ctx, "MESA ", PACKAGE_VERSION MESA_GIT_SHA1);
pvr_dump_dedent(&ctx);
if (dump_info->drm_display.comp) {
pvr_dump_mark_section(&ctx, "Display Platform Compatible Strings");
pvr_dump_indent(&ctx);
pvr_dump_field_compatible_strings(&ctx, dump_info->drm_display.comp);
pvr_dump_dedent(&ctx);
}
pvr_dump_mark_section(&ctx, "Render Platform Compatible Strings");
pvr_dump_indent(&ctx);
pvr_dump_field_compatible_strings(&ctx, dump_info->drm_render.comp);
pvr_dump_dedent(&ctx);
pvr_dump_print_eol(&ctx);
pvr_dump_mark_section(&ctx, "Runtime Info");
pvr_dump_indent(&ctx);
pvr_dump_field_member_u64(&ctx, run_info, cdm_max_local_mem_size_regs);
pvr_dump_field_member_u64_units(&ctx, run_info, max_free_list_size, "bytes");
pvr_dump_field_member_u64_units(&ctx, run_info, min_free_list_size, "bytes");
pvr_dump_field_member_u64_units(&ctx,
run_info,
reserved_shared_size,
"bytes");
pvr_dump_field_member_u64_units(&ctx,
run_info,
total_reserved_partition_size,
"bytes");
pvr_dump_field_member_u32(&ctx, run_info, core_count);
pvr_dump_field_member_u64(&ctx, run_info, max_coeffs);
pvr_dump_field_member_u64(&ctx, run_info, num_phantoms);
pvr_dump_dedent(&ctx);
pvr_dump_print_eol(&ctx);
pvr_dump_end(&ctx);
}
+44
View File
@@ -0,0 +1,44 @@
/*
* Copyright © 2023 Imagination Technologies Ltd.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#ifndef PVR_DUMP_INFO_H
#define PVR_DUMP_INFO_H
#include "pvr_device_info.h"
struct pvr_device_dump_info {
const struct pvr_device_info *device_info;
const struct pvr_device_runtime_info *device_runtime_info;
struct {
int patchlevel;
int major;
int minor;
const char *name;
const char *date;
char *const *comp;
} drm_display, drm_render;
};
void pvr_dump_physical_device_info(const struct pvr_device_dump_info *dump_info);
#endif
+144
View File
@@ -0,0 +1,144 @@
/*
* Copyright © 2025 Imagination Technologies Ltd.
* SPDX-License-Identifier: MIT
*/
#ifndef PVR_IFACE_H
#define PVR_IFACE_H
/**
* \file pvr_iface.h
*
* \brief USC program interface.
*/
/** Query availability shader data; shared registers. */
enum pvr_query_availability_data {
PVR_QUERY_AVAILABILITY_DATA_INDEX_COUNT,
PVR_QUERY_AVAILABILITY_DATA_INDEX_BO_LO,
PVR_QUERY_AVAILABILITY_DATA_INDEX_BO_HI,
PVR_QUERY_AVAILABILITY_DATA_BO_LO,
PVR_QUERY_AVAILABILITY_DATA_BO_HI,
_PVR_QUERY_AVAILABILITY_DATA_COUNT,
};
/** Query copy shader data; shared registers. */
enum pvr_query_copy_data {
PVR_QUERY_COPY_DATA_INDEX_COUNT,
PVR_QUERY_COPY_DATA_DEST_BO_LO,
PVR_QUERY_COPY_DATA_DEST_BO_HI,
PVR_QUERY_COPY_DATA_AVAILABILITY_BO_LO,
PVR_QUERY_COPY_DATA_AVAILABILITY_BO_HI,
PVR_QUERY_COPY_DATA_RESULT_BO_LO,
PVR_QUERY_COPY_DATA_RESULT_BO_HI,
PVR_QUERY_COPY_DATA_DEST_STRIDE,
PVR_QUERY_COPY_DATA_FLAGS,
_PVR_QUERY_COPY_DATA_COUNT,
};
/** Query reset shader data; shared registers. */
enum pvr_query_reset_data {
PVR_QUERY_RESET_DATA_INDEX_COUNT,
PVR_QUERY_RESET_DATA_RESULT_BO_LO,
PVR_QUERY_RESET_DATA_RESULT_BO_HI,
PVR_QUERY_RESET_DATA_AVAILABILITY_BO_LO,
PVR_QUERY_RESET_DATA_AVAILABILITY_BO_HI,
_PVR_QUERY_RESET_DATA_COUNT,
};
/** Clear attachment shader data; shared registers. */
enum pvr_clear_attach_data {
PVR_CLEAR_ATTACH_DATA_DWORD0,
PVR_CLEAR_ATTACH_DATA_DWORD1,
PVR_CLEAR_ATTACH_DATA_DWORD2,
PVR_CLEAR_ATTACH_DATA_DWORD3,
PVR_CLEAR_ATTACH_DATA_TILE_ADDR_LO,
PVR_CLEAR_ATTACH_DATA_TILE_ADDR_HI,
_PVR_CLEAR_ATTACH_DATA_COUNT,
};
/** SPM load shader data; shared registers. */
enum pvr_spm_load_data {
PVR_SPM_LOAD_DATA_SMP = 0,
PVR_SPM_LOAD_DATA_REG_TEX = 4,
PVR_SPM_LOAD_DATA_BUF_TEX_0 = 8,
PVR_SPM_LOAD_DATA_BUF_ADDR_0 = 12,
PVR_SPM_LOAD_DATA_BUF_ADDR_1 = 14,
PVR_SPM_LOAD_DATA_BUF_TEX_1 = 16,
PVR_SPM_LOAD_DATA_BUF_TEX_2 = 20,
PVR_SPM_LOAD_DATA_BUF_ADDR_2 = 24,
PVR_SPM_LOAD_DATA_BUF_ADDR_3 = 26,
PVR_SPM_LOAD_DATA_BUF_TEX_3 = 28,
PVR_SPM_LOAD_DATA_BUF_TEX_4 = 32,
PVR_SPM_LOAD_DATA_BUF_ADDR_4 = 36,
PVR_SPM_LOAD_DATA_BUF_ADDR_5 = 38,
PVR_SPM_LOAD_DATA_BUF_TEX_5 = 40,
PVR_SPM_LOAD_DATA_BUF_TEX_6 = 44,
PVR_SPM_LOAD_DATA_BUF_ADDR_6 = 48,
_PVR_SPM_LOAD_DATA_COUNT = 50,
};
/** Load/store sr shader data; vertex input registers. */
enum pvr_load_store_sr_data {
PVR_LOAD_STORE_SR_DATA_SIZE_ADDR_LO,
PVR_LOAD_STORE_SR_DATA_SIZE_ADDR_HI,
PVR_LOAD_STORE_SR_DATA_STORE_ADDR_LO,
PVR_LOAD_STORE_SR_DATA_STORE_ADDR_HI,
_PVR_LOAD_STORE_SR_DATA_COUNT,
};
/** IDFWDF shader data; shared registers. */
enum pvr_idfwdf_sr_data {
PVR_IDFWDF_DATA_TEX = 0,
PVR_IDFWDF_DATA_SMP = 4,
PVR_IDFWDF_DATA_ADDR_LO,
PVR_IDFWDF_DATA_ADDR_HI,
_PVR_IDFWDF_DATA_COUNT,
};
#define PVR_IDFWDF_TEX_FORMAT VK_FORMAT_R32G32B32A32_SFLOAT
#define PVR_IDFWDF_TEX_WIDTH 4U
#define PVR_IDFWDF_TEX_HEIGHT 2U
#define PVR_IDFWDF_TEX_STRIDE 4U
/** pck_info and pck_format bitfield helpers. */
#define PVR_PCK_FORMAT_INVALID 0b11111U
#define PVR_PCK_INFO_FORMAT_LENGTH 5U
#define PVR_PCK_INFO_FORMAT_OFFSET 0U
#define PVR_PCK_INFO_SPLIT_OFFSET 5U
#define PVR_PCK_INFO_SCALE_OFFSET 6U
#define PVR_PCK_INFO_ROUNDZERO_OFFSET 7U
#define PVR_PCK_INFO_UNORM_OFFSET 8U
#define PVR_PCK_INFO_SPLIT_BIT BITFIELD_BIT(PVR_PCK_INFO_SPLIT_OFFSET)
#define PVR_PCK_INFO_SCALE_BIT BITFIELD_BIT(PVR_PCK_INFO_SCALE_OFFSET)
#define PVR_PCK_INFO_ROUNDZERO_BIT BITFIELD_BIT(PVR_PCK_INFO_ROUNDZERO_OFFSET)
#define PVR_PCK_INFO_UNORM_BIT BITFIELD_BIT(PVR_PCK_INFO_UNORM_OFFSET)
#endif /* PVR_IFACE_H */
+89
View File
@@ -0,0 +1,89 @@
/*
* Copyright © 2022 Imagination Technologies Ltd.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
/**
* Constants for VkPhysicalDeviceLimits.
*/
#ifndef PVR_LIMITS_H
#define PVR_LIMITS_H
#include "hwdef/rogue_hw_defs.h"
#include "pvr_device_info.h"
#include "util/u_math.h"
#define PVR_MAX_COLOR_ATTACHMENTS PVR_NUM_PBE_EMIT_REGS
#define PVR_MAX_QUEUES 2U
#define PVR_MAX_VIEWPORTS 1U
#define PVR_MAX_NEG_OFFSCREEN_OFFSET 4096U
#define PVR_MAX_MULTIVIEW 6U
#define PVR_MAX_PUSH_CONSTANTS_SIZE 128U
#define PVR_LINE_WIDTH_MIN (1.0f / 16.0f)
#define PVR_LINE_WIDTH_MAX 16.0f
#define PVR_LINE_WIDTH_GRANULARITY (1.0f / 16.0f)
#define PVR_POINT_SIZE_RANGE_MIN 1.0f
#define PVR_POINT_SIZE_RANGE_MAX 511.0f
#define PVR_POINT_SIZE_GRANULARITY 0.0625f
#define PVR_TEX_FORMAT_COUNT \
(ROGUE_TEXSTATE_IMAGE_WORD0_TEXFORMAT_MAX_SIZE + 1U)
#define PVR_MAX_ARRAY_LAYERS (ROGUE_TEXSTATE_IMAGE_WORD1_DEPTH_MAX_SIZE + 1U)
#define PVR_MAX_DESCRIPTOR_SETS 4U
#define PVR_MAX_DESCRIPTOR_SET_UNIFORM_DYNAMIC_BUFFERS 8U
#define PVR_MAX_DESCRIPTOR_SET_STORAGE_DYNAMIC_BUFFERS 8U
#define PVR_MAX_DESCRIPTORS_PER_SET 1024U
#define PVR_MAX_FRAMEBUFFER_LAYERS PVR_MAX_ARRAY_LAYERS
/* The limit is somewhat arbitrary, it just translates into more pds code
* and larger arrays, 32 appears to be the popular (and highest choice) across
* other implementations.
*/
#define PVR_MAX_VERTEX_INPUT_BINDINGS 16U
#define PVR_TEXEL_BUFFER_OFFSET_ALIGNMENT 16U
#define PVR_UNIFORM_BUFFER_OFFSET_ALIGNMENT 4U
#define PVR_STORAGE_BUFFER_OFFSET_ALIGNMENT 4U
#define PVR_MAX_USER_PLANES 8U
/* We need one RenderTarget per supported MSAA mode as each render target
* contains state that is dependent on the sample count of the render that is
* rendering to it.
*
* As we do not know the sample count until we know the renderpass framebuffer
* combination being used, we create one per supported sample mode.
*/
#define PVR_RENDER_TARGETS_PER_FRAMEBUFFER(dev_info) \
({ \
uint32_t __ret = PVR_GET_FEATURE_VALUE(dev_info, max_multisample, 4U); \
util_logbase2(__ret) + 1; \
})
#endif
+74
View File
@@ -0,0 +1,74 @@
/*
* Copyright © 2022 Imagination Technologies Ltd.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#include "pvr_util.h"
/* Generated by floor(n/log2(10)). This is a compact representation of a
* log10(2**n) estimation. Estimations of log2(n) +1/-0 are very fast on modern
* CPUs with clz (or equivalent) instructions, which makes this log2-indexed
* lookup both compact and fast. Assuming an input of log2(x) +1/-0; this lut
* should produce an output of ceil(log10(x)) +0/-1.
*/
const uint8_t est_log10_from_log2[64 + 1] = {
0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4,
5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 9,
10, 10, 10, 11, 11, 11, 12, 12, 12, 12, 13, 13, 13, 14, 14, 14, 15,
15, 15, 15, 16, 16, 16, 17, 17, 17, 18, 18, 18, 18, 19,
};
/* Generated by 10**n with one exception: we make the first power of ten 0
* (instead of 1) to ensure a 0-input produces a single digit (instead of no
* digits).
*/
const uint32_t u32_powers_of_ten[10] = {
UINT32_C(0), UINT32_C(10), UINT32_C(100),
UINT32_C(1000), UINT32_C(10000), UINT32_C(100000),
UINT32_C(1000000), UINT32_C(10000000), UINT32_C(100000000),
UINT32_C(1000000000),
};
/* This is an extension of u32_powers_of_ten to include all possible 64-bit
* values.
*/
const uint64_t u64_powers_of_ten[20] = {
UINT64_C(0),
UINT64_C(10),
UINT64_C(100),
UINT64_C(1000),
UINT64_C(10000),
UINT64_C(100000),
UINT64_C(1000000),
UINT64_C(10000000),
UINT64_C(100000000),
UINT64_C(1000000000),
UINT64_C(10000000000),
UINT64_C(100000000000),
UINT64_C(1000000000000),
UINT64_C(10000000000000),
UINT64_C(100000000000000),
UINT64_C(1000000000000000),
UINT64_C(10000000000000000),
UINT64_C(100000000000000000),
UINT64_C(1000000000000000000),
UINT64_C(10000000000000000000),
};
+102
View File
@@ -0,0 +1,102 @@
/*
* Copyright © 2022 Imagination Technologies Ltd.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#ifndef PVR_UTIL_H
#define PVR_UTIL_H
#include <assert.h>
#include <stdint.h>
#include "pvr_types.h"
#include "util/bitscan.h"
#include "util/u_math.h"
static inline bool pvr_dev_addr_is_aligned(pvr_dev_addr_t addr,
const uint32_t alignment)
{
return util_is_aligned(addr.addr, alignment);
}
/*****************************************************************************
Math functions
*****************************************************************************/
static inline uint32_t u32_bin_digits(uint32_t x)
{
return x == 0 ? 1 : util_last_bit(x);
}
static inline uint32_t u64_bin_digits(uint64_t x)
{
return x == 0 ? 1 : util_last_bit64(x);
}
extern const uint8_t est_log10_from_log2[64 + 1];
extern const uint32_t u32_powers_of_ten[10];
extern const uint64_t u64_powers_of_ten[20];
/*
* This function includes parts of a public-domain log10 algorithm from
* "Bit Twiddling Hacks", an aggregate collection which is:
*
* © 1997-2005 Sean Eron Anderson.
*
* https://graphics.stanford.edu/~seander/bithacks.html#IntegerLog10
*/
static inline uint32_t u32_dec_digits(uint32_t x)
{
/* The value of nr_digits is an estimation of ceil(log10(x)) with variance
* +0/-1 (as per the comment on the estimation lut).
*/
const uint32_t nr_digits = est_log10_from_log2[util_last_bit(x)];
/* We then convert this approximation to a real value by adding 1 iff
* x >= 10**nr_digits using another lut to quickly compute the
* exponentiation. See the comment on u32_powers_of_ten for details of this.
*/
return nr_digits + (x >= u32_powers_of_ten[nr_digits]);
}
/* This function is an extended form of u32_dec_digits(); see the comments on
* that function for details.
*/
static inline uint32_t u64_dec_digits(uint64_t x)
{
const uint32_t nr_digits = est_log10_from_log2[util_last_bit64(x)];
return nr_digits + (x >= u64_powers_of_ten[nr_digits]);
}
static inline uint32_t u32_hex_digits(uint32_t x)
{
const uint32_t binary_digits = u32_bin_digits(x);
return (binary_digits >> 2) + !!(binary_digits & 3);
}
static inline uint32_t u64_hex_digits(uint64_t x)
{
const uint32_t binary_digits = u64_bin_digits(x);
return (binary_digits >> 2) + !!(binary_digits & 3);
}
#endif /* PVR_UTIL_H */
+101
View File
@@ -0,0 +1,101 @@
/*
* Copyright © 2026 Imagination Technologies Ltd.
* SPDX-License-Identifier: MIT
*/
#include "pvr_ycbcr.h"
#include "util/macros.h"
/* number of slots occupied */
#define PVR_YCBCR_SLOTS 9
struct pvr_ycbcr_csc_table_entry {
uint16_t value[32];
} PACKED;
struct pvr_ycbcr_csc_table {
struct pvr_ycbcr_csc_table_entry slots[PVR_YCBCR_SLOTS];
} PACKED;
/* clang-format off */
static const uint16_t RGB_IDENTITY[] = {
0x0000, 0x1ffc, 0x0000,
0x0000, 0x0000, 0x1ffc,
0x1ffc, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000,
};
static const uint16_t YCBCR_IDENTITY_FULL[] = {
0x0000, 0x1ffc, 0x0000,
0x0000, 0x0000, 0x1ffc,
0x1ffc, 0x0000, 0x0000,
0xfff0, 0x0000, 0xfff0,
};
static const uint16_t YCBCR_IDENTITY[] = {
0x0000, 0x253e, 0x0000,
0x0000, 0x0000, 0x2469,
0x2469, 0x0000, 0x0000,
0xfdb9, 0xfdac, 0xfdb9,
};
static const uint16_t YCBCR_709_FULL[] = {
0x1ffc, 0x1ffc, 0x1ffc,
0x0000, 0xfa02, 0x3b5a,
0x325e, 0xf107, 0x0000,
0xe6d1, 0x0a7b, 0xe253,
};
static const uint16_t YCBCR_709[] = {
0x253e, 0x253e, 0x253e,
0x0000, 0xf92e, 0x4390,
0x3957, 0xeef5, 0x0000,
0xe101, 0x099b, 0xdbe4,
};
static const uint16_t YCBCR_601_FULL[] = {
0x1ffc, 0x1ffc, 0x1ffc,
0x0000, 0xf4fe, 0x38ad,
0x2cd8, 0xe929, 0x0000,
0xe994, 0x10ed, 0xe3a9,
};
static const uint16_t YCBCR_601[] = {
0x253e, 0x253e, 0x253e,
0x0000, 0xf378, 0x4085,
0x330c, 0xe5ff, 0x0000,
0xe426, 0x10f0, 0xdd6a,
};
static const uint16_t YCBCR_2020_FULL[] = {
0x1ffc, 0x1ffc, 0x1ffc,
0x0000, 0xfabd, 0x3c2d,
0x2f2a, 0xedba, 0x0000,
0xe86b, 0x0bc5, 0xe1ea,
};
static const uint16_t YCBCR_2020[] = {
0x253e, 0x253e, 0x253e,
0x0000, 0xfa02, 0x4481,
0x35b1, 0xeb32, 0x0000,
0xe2d4, 0x0b12, 0xdb6c,
};
/* clang-format on */
#define fill_slot(table, entry) \
memcpy(&table->slots[PVR_YCBCR_SLOT_##entry].value, entry, sizeof(entry))
void pvr_setup_static_yuv_csc_table(uint8_t *map, uint64_t offset)
{
struct pvr_ycbcr_csc_table *table =
(struct pvr_ycbcr_csc_table *)(&map[offset]);
fill_slot(table, RGB_IDENTITY);
fill_slot(table, YCBCR_IDENTITY_FULL);
fill_slot(table, YCBCR_IDENTITY);
fill_slot(table, YCBCR_709_FULL);
fill_slot(table, YCBCR_709);
fill_slot(table, YCBCR_601_FULL);
fill_slot(table, YCBCR_601);
fill_slot(table, YCBCR_2020_FULL);
fill_slot(table, YCBCR_2020);
}
+23
View File
@@ -0,0 +1,23 @@
/*
* Copyright © 2026 Imagination Technologies Ltd.
* SPDX-License-Identifier: MIT
*/
#ifndef PVR_YCBCR_H
#define PVR_YCBCR_H
#include <stdint.h>
void pvr_setup_static_yuv_csc_table(uint8_t *const heap_ptr,
uint64_t yuv_table_offset_in_bytes);
#define PVR_YCBCR_SLOT_RGB_IDENTITY 0
#define PVR_YCBCR_SLOT_YCBCR_IDENTITY_FULL 1
#define PVR_YCBCR_SLOT_YCBCR_IDENTITY 2
#define PVR_YCBCR_SLOT_YCBCR_709_FULL 3
#define PVR_YCBCR_SLOT_YCBCR_709 4
#define PVR_YCBCR_SLOT_YCBCR_601_FULL 5
#define PVR_YCBCR_SLOT_YCBCR_601 6
#define PVR_YCBCR_SLOT_YCBCR_2020_FULL 7
#define PVR_YCBCR_SLOT_YCBCR_2020 8
#endif /* PVR_YCBCR_H */