ipc: Implement performance settings interface

Used to implement XR_EXT_performance_settings.
This commit is contained in:
huanchen 2023-08-23 16:17:40 +08:00 committed by Jakob Bornecrantz
parent 3d5c16fdba
commit 1f658ba2be
3 changed files with 37 additions and 0 deletions

View file

@ -770,6 +770,17 @@ ipc_compositor_discard_frame(struct xrt_compositor *xc, int64_t frame_id)
IPC_CHK_ALWAYS_RET(icc->ipc_c, xret, "ipc_call_compositor_discard_frame");
}
static xrt_result_t
ipc_compositor_set_performance_level(struct xrt_compositor *xc,
enum xrt_perf_domain domain,
enum xrt_perf_set_level level)
{
struct ipc_client_compositor *icc = ipc_client_compositor(xc);
xrt_result_t xret;
xret = ipc_call_compositor_set_performance_level(icc->ipc_c, domain, level);
IPC_CHK_ALWAYS_RET(icc->ipc_c, xret, "ipc_call_compositor_set_performance_level");
}
static xrt_result_t
ipc_compositor_set_thread_hint(struct xrt_compositor *xc, enum xrt_thread_hint hint, uint32_t thread_id)
{
@ -838,6 +849,7 @@ ipc_compositor_init(struct ipc_client_compositor *icc, struct xrt_compositor_nat
icc->base.base.set_thread_hint = ipc_compositor_set_thread_hint;
icc->base.base.get_display_refresh_rate = ipc_compositor_get_display_refresh_rate;
icc->base.base.request_display_refresh_rate = ipc_compositor_request_display_refresh_rate;
icc->base.base.set_performance_level = ipc_compositor_set_performance_level;
// Using in wait frame.
os_precise_sleeper_init(&icc->sleeper);

View file

@ -709,6 +709,24 @@ ipc_handle_compositor_request_display_refresh_rate(volatile struct ipc_client_st
return xrt_comp_request_display_refresh_rate(ics->xc, display_refresh_rate_hz);
}
xrt_result_t
ipc_handle_compositor_set_performance_level(volatile struct ipc_client_state *ics,
enum xrt_perf_domain domain,
enum xrt_perf_set_level level)
{
IPC_TRACE_MARKER();
if (ics->xc == NULL) {
return XRT_ERROR_IPC_COMPOSITOR_NOT_CREATED;
}
if (ics->xc->set_performance_level == NULL) {
return XRT_ERROR_IPC_FAILURE;
}
return xrt_comp_set_performance_level(ics->xc, domain, level);
}
static bool
_update_projection_layer(struct xrt_compositor *xc,
volatile struct ipc_client_state *ics,

View file

@ -212,6 +212,13 @@
]
},
"compositor_set_performance_level": {
"in": [
{"name": "domain", "type": "enum xrt_perf_domain"},
{"name": "level", "type": "enum xrt_perf_set_level"}
]
},
"compositor_set_thread_hint": {
"in": [
{"name": "hint", "type": "enum xrt_thread_hint"},