pvr: Add core count info and pvr_device_runtime_info.

Signed-off-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15880>
This commit is contained in:
Karmjit Mahil 2022-02-23 13:51:55 +00:00 committed by Marge Bot
parent 93fbaae7d5
commit 76ee1671f6
6 changed files with 83 additions and 4 deletions

View file

@ -355,7 +355,9 @@ static VkResult pvr_physical_device_init(struct pvr_physical_device *pdevice,
goto err_vk_free_master_path; goto err_vk_free_master_path;
} }
ret = pdevice->ws->ops->device_info_init(pdevice->ws, &pdevice->dev_info); ret = pdevice->ws->ops->device_info_init(pdevice->ws,
&pdevice->dev_info,
&pdevice->dev_runtime_info);
if (ret) { if (ret) {
result = VK_ERROR_INITIALIZATION_FAILED; result = VK_ERROR_INITIALIZATION_FAILED;
goto err_pvr_winsys_destroy; goto err_pvr_winsys_destroy;

View file

@ -201,6 +201,10 @@ struct pvr_physical_device {
struct pvr_winsys *ws; struct pvr_winsys *ws;
struct pvr_device_info dev_info; struct pvr_device_info dev_info;
struct pvr_device_runtime_info {
uint32_t core_count;
} dev_runtime_info;
VkPhysicalDeviceMemoryProperties memory; VkPhysicalDeviceMemoryProperties memory;
uint8_t pipeline_cache_uuid[VK_UUID_SIZE]; uint8_t pipeline_cache_uuid[VK_UUID_SIZE];

View file

@ -40,6 +40,7 @@
#include "util/vma.h" #include "util/vma.h"
struct pvr_device_info; struct pvr_device_info;
struct pvr_device_runtime_info;
/* device virtual address */ /* device virtual address */
typedef struct pvr_dev_addr { typedef struct pvr_dev_addr {
@ -357,7 +358,8 @@ struct pvr_winsys_render_submit_info {
struct pvr_winsys_ops { struct pvr_winsys_ops {
void (*destroy)(struct pvr_winsys *ws); void (*destroy)(struct pvr_winsys *ws);
int (*device_info_init)(struct pvr_winsys *ws, int (*device_info_init)(struct pvr_winsys *ws,
struct pvr_device_info *dev_info); struct pvr_device_info *dev_info,
struct pvr_device_runtime_info *runtime_info);
void (*get_heaps_info)(struct pvr_winsys *ws, void (*get_heaps_info)(struct pvr_winsys *ws,
struct pvr_winsys_heaps *heaps); struct pvr_winsys_heaps *heaps);

View file

@ -328,10 +328,13 @@ static void pvr_srv_winsys_destroy(struct pvr_winsys *ws)
pvr_srv_connection_destroy(fd); pvr_srv_connection_destroy(fd);
} }
static int pvr_srv_winsys_device_info_init(struct pvr_winsys *ws, static int
struct pvr_device_info *dev_info) pvr_srv_winsys_device_info_init(struct pvr_winsys *ws,
struct pvr_device_info *dev_info,
struct pvr_device_runtime_info *runtime_info)
{ {
struct pvr_srv_winsys *srv_ws = to_pvr_srv_winsys(ws); struct pvr_srv_winsys *srv_ws = to_pvr_srv_winsys(ws);
VkResult result;
int ret; int ret;
ret = pvr_device_info_init(dev_info, srv_ws->bvnc); ret = pvr_device_info_init(dev_info, srv_ws->bvnc);
@ -344,6 +347,17 @@ static int pvr_srv_winsys_device_info_init(struct pvr_winsys *ws,
return ret; return ret;
} }
if (PVR_HAS_FEATURE(dev_info, gpu_multicore_support)) {
result = pvr_srv_get_multicore_info(srv_ws->render_fd,
0,
NULL,
&runtime_info->core_count);
if (result != VK_SUCCESS)
return -ENODEV;
} else {
runtime_info->core_count = 1;
}
return 0; return 0;
} }

View file

@ -125,6 +125,42 @@ void pvr_srv_connection_destroy(int fd)
} }
} }
VkResult pvr_srv_get_multicore_info(int fd,
uint32_t caps_size,
uint64_t *caps,
uint32_t *num_cores)
{
struct pvr_srv_bridge_getmulticoreinfo_cmd cmd = {
.caps = caps,
.caps_size = caps_size,
};
struct pvr_srv_bridge_getmulticoreinfo_ret ret = {
.caps = caps,
.error = PVR_SRV_ERROR_BRIDGE_CALL_FAILED,
};
int result;
result = pvr_srv_bridge_call(fd,
PVR_SRV_BRIDGE_SRVCORE,
PVR_SRV_BRIDGE_SRVCORE_GETMULTICOREINFO,
&cmd,
sizeof(cmd),
&ret,
sizeof(ret));
if (result || ret.error != PVR_SRV_OK) {
return vk_bridge_err(VK_ERROR_INITIALIZATION_FAILED,
"PVR_SRV_BRIDGE_SRVCORE_GETMULTICOREINFO",
ret);
}
if (!num_cores)
*num_cores = ret.num_cores;
return VK_SUCCESS;
}
VkResult pvr_srv_alloc_sync_primitive_block(int fd, VkResult pvr_srv_alloc_sync_primitive_block(int fd,
void **const handle_out, void **const handle_out,
void **const pmr_out, void **const pmr_out,

View file

@ -40,6 +40,7 @@
#define PVR_SRV_BRIDGE_SRVCORE_CONNECT 0UL #define PVR_SRV_BRIDGE_SRVCORE_CONNECT 0UL
#define PVR_SRV_BRIDGE_SRVCORE_DISCONNECT 1UL #define PVR_SRV_BRIDGE_SRVCORE_DISCONNECT 1UL
#define PVR_SRV_BRIDGE_SRVCORE_GETMULTICOREINFO 12U
#define PVR_SRV_BRIDGE_SYNC 2UL #define PVR_SRV_BRIDGE_SYNC 2UL
@ -175,6 +176,21 @@ struct pvr_srv_bridge_disconnect_ret {
enum pvr_srv_error error; enum pvr_srv_error error;
} PACKED; } PACKED;
/******************************************************************************
PVR_SRV_BRIDGE_SRVCORE_GETMULTICOREINFO structs
******************************************************************************/
struct pvr_srv_bridge_getmulticoreinfo_cmd {
uint64_t *caps;
uint32_t caps_size;
} PACKED;
struct pvr_srv_bridge_getmulticoreinfo_ret {
uint64_t *caps;
enum pvr_srv_error error;
uint32_t num_cores;
} PACKED;
/****************************************************************************** /******************************************************************************
PVR_SRV_BRIDGE_SYNC_ALLOCSYNCPRIMITIVEBLOCK struct PVR_SRV_BRIDGE_SYNC_ALLOCSYNCPRIMITIVEBLOCK struct
******************************************************************************/ ******************************************************************************/
@ -711,6 +727,11 @@ struct drm_srvkm_cmd {
VkResult pvr_srv_connection_create(int fd, uint64_t *const bvnc_out); VkResult pvr_srv_connection_create(int fd, uint64_t *const bvnc_out);
void pvr_srv_connection_destroy(int fd); void pvr_srv_connection_destroy(int fd);
VkResult pvr_srv_get_multicore_info(int fd,
uint32_t caps_size,
uint64_t *caps,
uint32_t *num_cores);
VkResult pvr_srv_alloc_sync_primitive_block(int fd, VkResult pvr_srv_alloc_sync_primitive_block(int fd,
void **const handle_out, void **const handle_out,
void **const pmr_out, void **const pmr_out,