ipc: Send less information when describing the client

This commit is contained in:
Jakob Bornecrantz 2023-06-20 20:13:16 +01:00 committed by Lubosz Sarnecki
parent 2edf07749b
commit 1920a9f0d7
4 changed files with 35 additions and 25 deletions

View file

@ -289,13 +289,13 @@ ipc_client_connection_init(struct ipc_connection *ipc_c,
return xret;
}
struct ipc_app_state desc = {0};
struct ipc_client_description desc = {0};
desc.info = *i_info;
desc.pid = getpid(); // Extra info.
xret = ipc_call_system_set_client_info(ipc_c, &desc);
xret = ipc_call_instance_describe_client(ipc_c, &desc);
if (xret != XRT_SUCCESS) {
IPC_ERROR(ipc_c, "Failed to set instance info!");
IPC_ERROR(ipc_c, "Failed to set instance description!");
ipc_client_connection_fini(ipc_c);

View file

@ -163,6 +163,23 @@ ipc_handle_instance_get_shm_fd(volatile struct ipc_client_state *ics,
return XRT_SUCCESS;
}
xrt_result_t
ipc_handle_instance_describe_client(volatile struct ipc_client_state *ics,
const struct ipc_client_description *client_desc)
{
ics->client_state.info = client_desc->info;
ics->client_state.pid = client_desc->pid;
IPC_INFO(ics->server,
"Client info\n"
"\tapplication_name: '%s'\n"
"\tpid: %i",
client_desc->info.application_name, //
client_desc->pid); //
return XRT_SUCCESS;
}
xrt_result_t
ipc_handle_system_compositor_get_info(volatile struct ipc_client_state *ics,
struct xrt_system_compositor_info *out_info)
@ -946,22 +963,6 @@ ipc_handle_system_get_client_info(volatile struct ipc_client_state *_ics,
return XRT_SUCCESS;
}
xrt_result_t
ipc_handle_system_set_client_info(volatile struct ipc_client_state *ics, const struct ipc_app_state *client_desc)
{
ics->client_state.info = client_desc->info;
ics->client_state.pid = client_desc->pid;
IPC_INFO(ics->server,
"Client info\n"
"\tapplication_name: '%s'\n"
"\tpid: %i",
client_desc->info.application_name, //
client_desc->pid); //
return XRT_SUCCESS;
}
xrt_result_t
ipc_handle_system_get_clients(volatile struct ipc_client_state *_ics, struct ipc_client_list *list)
{

View file

@ -274,6 +274,15 @@ struct ipc_shared_memory
uint64_t startup_timestamp;
};
/*!
* Initial info from a client when it connects.
*/
struct ipc_client_description
{
pid_t pid;
struct xrt_instance_info info;
};
struct ipc_client_list
{
int32_t ids[IPC_MAX_CLIENTS];

View file

@ -5,6 +5,12 @@
"out_handles": {"type": "xrt_shmem_handle_t"}
},
"instance_describe_client": {
"in": [
{"name": "desc", "type": "struct ipc_client_description"}
]
},
"system_get_client_info": {
"in": [
{"name": "id", "type": "uint32_t"}
@ -14,12 +20,6 @@
]
},
"system_set_client_info": {
"in": [
{"name": "desc", "type": "struct ipc_app_state"}
]
},
"system_get_clients": {
"out": [
{"name": "clients", "type": "struct ipc_client_list"}