83 lines
3.2 KiB
Diff
83 lines
3.2 KiB
Diff
From 644f84e916d40d6341de91687a3dc9b0eecd13a4 Mon Sep 17 00:00:00 2001
|
|
From: Patrick Nicolas <patricknicolas@laposte.net>
|
|
Date: Thu, 27 Feb 2025 22:45:36 +0100
|
|
Subject: [PATCH 10/11] c/main: allow custom pacing app factory
|
|
|
|
---
|
|
src/xrt/compositor/main/comp_compositor.c | 10 ++++++----
|
|
src/xrt/compositor/main/comp_main_interface.h | 4 ++++
|
|
src/xrt/targets/common/target_instance.c | 2 +-
|
|
3 files changed, 11 insertions(+), 5 deletions(-)
|
|
|
|
diff --git a/src/xrt/compositor/main/comp_compositor.c b/src/xrt/compositor/main/comp_compositor.c
|
|
index 26c341385..36e3297f7 100644
|
|
--- a/src/xrt/compositor/main/comp_compositor.c
|
|
+++ b/src/xrt/compositor/main/comp_compositor.c
|
|
@@ -983,6 +983,7 @@ compositor_init_renderer(struct comp_compositor *c)
|
|
xrt_result_t
|
|
comp_main_create_system_compositor(struct xrt_device *xdev,
|
|
const struct comp_target_factory *ctf,
|
|
+ struct u_pacing_app_factory *upaf,
|
|
struct xrt_system_compositor **out_xsysc)
|
|
{
|
|
COMP_TRACE_MARKER();
|
|
@@ -1183,10 +1184,11 @@ comp_main_create_system_compositor(struct xrt_device *xdev,
|
|
}
|
|
|
|
// Standard app pacer.
|
|
- struct u_pacing_app_factory *upaf = NULL;
|
|
- xrt_result_t xret = u_pa_factory_create(&upaf);
|
|
- assert(xret == XRT_SUCCESS && upaf != NULL);
|
|
- (void)xret;
|
|
+ if (upaf == NULL) {
|
|
+ xrt_result_t xret = u_pa_factory_create(&upaf);
|
|
+ assert(xret == XRT_SUCCESS && upaf != NULL);
|
|
+ (void)xret;
|
|
+ }
|
|
|
|
return comp_multi_create_system_compositor(&c->base.base, upaf, sys_info, !c->deferred_surface, out_xsysc);
|
|
}
|
|
diff --git a/src/xrt/compositor/main/comp_main_interface.h b/src/xrt/compositor/main/comp_main_interface.h
|
|
index 0f0678358..f60568b43 100644
|
|
--- a/src/xrt/compositor/main/comp_main_interface.h
|
|
+++ b/src/xrt/compositor/main/comp_main_interface.h
|
|
@@ -15,6 +15,7 @@
|
|
#include "xrt/xrt_compositor.h"
|
|
|
|
struct comp_target_factory;
|
|
+struct u_pacing_app_factory;
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
@@ -31,11 +32,14 @@ extern "C" {
|
|
* @param xdev The head device
|
|
* @param ctf A compositor target factory to force the output device, must remain valid for the lifetime of the
|
|
* compositor. If NULL, factory is automatically selected
|
|
+ * @param upaf A pacing app factory to customize the application pacer, compositor takes ownership.
|
|
+ * If NULL, a default factory is used
|
|
* @param out_xsysc The output compositor
|
|
*/
|
|
xrt_result_t
|
|
comp_main_create_system_compositor(struct xrt_device *xdev,
|
|
const struct comp_target_factory *ctf,
|
|
+ struct u_pacing_app_factory *upaf,
|
|
struct xrt_system_compositor **out_xsysc);
|
|
|
|
|
|
diff --git a/src/xrt/targets/common/target_instance.c b/src/xrt/targets/common/target_instance.c
|
|
index 617561c37..e10ba8358 100644
|
|
--- a/src/xrt/targets/common/target_instance.c
|
|
+++ b/src/xrt/targets/common/target_instance.c
|
|
@@ -109,7 +109,7 @@ t_instance_create_system(struct xrt_instance *xinst,
|
|
|
|
#ifdef XRT_MODULE_COMPOSITOR_MAIN
|
|
if (xret == XRT_SUCCESS && xsysc == NULL) {
|
|
- xret = comp_main_create_system_compositor(head, NULL, &xsysc);
|
|
+ xret = comp_main_create_system_compositor(head, NULL, NULL, &xsysc);
|
|
}
|
|
#else
|
|
if (!use_null) {
|
|
--
|
|
2.49.0
|
|
|