mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-24 17:30:12 +01:00
panvk: add core mask driconf options
These can be used to pin an application to specific cores. A tiler mask option is not included because there is no current hardware that includes more than one tiler. Signed-off-by: Benjamin Lee <benjamin.lee@collabora.com> Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34374>
This commit is contained in:
parent
d46e76be02
commit
e8cc44f4bd
5 changed files with 61 additions and 5 deletions
|
|
@ -598,12 +598,11 @@ create_group(struct panvk_queue *queue,
|
|||
};
|
||||
|
||||
struct drm_panthor_group_create gc = {
|
||||
.compute_core_mask = phys_dev->kmod.props.shader_present,
|
||||
.fragment_core_mask = phys_dev->kmod.props.shader_present,
|
||||
.compute_core_mask = phys_dev->compute_core_mask,
|
||||
.fragment_core_mask = phys_dev->fragment_core_mask,
|
||||
.tiler_core_mask = 1,
|
||||
.max_compute_cores = util_bitcount64(phys_dev->kmod.props.shader_present),
|
||||
.max_fragment_cores =
|
||||
util_bitcount64(phys_dev->kmod.props.shader_present),
|
||||
.max_compute_cores = util_bitcount64(phys_dev->compute_core_mask),
|
||||
.max_fragment_cores = util_bitcount64(phys_dev->fragment_core_mask),
|
||||
.max_tiler_cores = 1,
|
||||
.priority = group_priority,
|
||||
.queues = DRM_PANTHOR_OBJ_ARRAY(ARRAY_SIZE(qc), qc),
|
||||
|
|
|
|||
|
|
@ -162,6 +162,11 @@ static const driOptionDescription panvk_dri_options[] = {
|
|||
DRI_CONF_VK_WSI_FORCE_SWAPCHAIN_TO_CURRENT_EXTENT(false)
|
||||
DRI_CONF_VK_X11_IGNORE_SUBOPTIMAL(false)
|
||||
DRI_CONF_SECTION_END
|
||||
|
||||
DRI_CONF_SECTION_MISCELLANEOUS
|
||||
DRI_CONF_PAN_COMPUTE_CORE_MASK(~0ull)
|
||||
DRI_CONF_PAN_FRAGMENT_CORE_MASK(~0ull)
|
||||
DRI_CONF_SECTION_END
|
||||
};
|
||||
|
||||
static void
|
||||
|
|
|
|||
|
|
@ -130,6 +130,39 @@ get_cache_uuid(uint16_t family, void *uuid)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static VkResult
|
||||
get_core_mask(struct panvk_physical_device *device,
|
||||
const struct panvk_instance *instance, const char *option_name,
|
||||
uint64_t *mask)
|
||||
{
|
||||
uint64_t present = device->kmod.props.shader_present;
|
||||
*mask = driQueryOptionu64(&instance->dri_options, option_name) & present;
|
||||
|
||||
if (!*mask)
|
||||
return panvk_errorf(instance, VK_ERROR_INITIALIZATION_FAILED,
|
||||
"None of the cores specified in %s are present. "
|
||||
"Available shader cores are 0x%" PRIx64 ".\n",
|
||||
option_name, present);
|
||||
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
static VkResult
|
||||
get_core_masks(struct panvk_physical_device *device,
|
||||
const struct panvk_instance *instance)
|
||||
{
|
||||
VkResult result;
|
||||
|
||||
result = get_core_mask(device, instance, "pan_compute_core_mask",
|
||||
&device->compute_core_mask);
|
||||
if (result != VK_SUCCESS)
|
||||
return result;
|
||||
result = get_core_mask(device, instance, "pan_fragment_core_mask",
|
||||
&device->fragment_core_mask);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static VkResult
|
||||
get_device_sync_types(struct panvk_physical_device *device,
|
||||
const struct panvk_instance *instance)
|
||||
|
|
@ -1049,6 +1082,10 @@ panvk_physical_device_init(struct panvk_physical_device *device,
|
|||
goto fail;
|
||||
}
|
||||
|
||||
result = get_core_masks(device, instance);
|
||||
if (result != VK_SUCCESS)
|
||||
goto fail;
|
||||
|
||||
result = get_device_sync_types(device, instance);
|
||||
if (result != VK_SUCCESS)
|
||||
goto fail;
|
||||
|
|
|
|||
|
|
@ -52,6 +52,9 @@ struct panvk_physical_device {
|
|||
const struct vk_sync_type *sync_types[3];
|
||||
|
||||
struct wsi_device wsi_device;
|
||||
|
||||
uint64_t compute_core_mask;
|
||||
uint64_t fragment_core_mask;
|
||||
};
|
||||
|
||||
VK_DEFINE_HANDLE_CASTS(panvk_physical_device, vk.base, VkPhysicalDevice,
|
||||
|
|
|
|||
|
|
@ -641,6 +641,18 @@
|
|||
DRI_CONF_OPT_B(disable_conservative_lrz, def, \
|
||||
"Disable conservative LRZ")
|
||||
|
||||
/**
|
||||
* \brief panfrost specific configuration options
|
||||
*/
|
||||
|
||||
#define DRI_CONF_PAN_COMPUTE_CORE_MASK(def) \
|
||||
DRI_CONF_OPT_U64(pan_compute_core_mask, def, 0, UINT64_MAX, \
|
||||
"Bitmask of shader cores that may be used for compute jobs. If unset, defaults to scheduling across all available cores.")
|
||||
|
||||
#define DRI_CONF_PAN_FRAGMENT_CORE_MASK(def) \
|
||||
DRI_CONF_OPT_U64(pan_fragment_core_mask, def, 0, UINT64_MAX, \
|
||||
"Bitmask of shader cores that may be used for fragment jobs. If unset, defaults to scheduling across all available cores.")
|
||||
|
||||
/**
|
||||
* \brief Turnip specific configuration options
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue