comp: Pass time state down into compositor

This commit is contained in:
Ryan Pavlik 2019-03-17 20:20:20 -07:00 committed by Jakob Bornecrantz
parent bf2eae1524
commit f6c97ec253
9 changed files with 27 additions and 9 deletions

View file

@ -16,13 +16,16 @@
extern "C" {
#endif
struct time_state;
/*!
* Create the compositor instance using the given device. Used by the client
* code and implemented by the main compositor code.
*/
struct xrt_compositor_fd*
comp_compositor_create(struct xrt_device* xdev, bool flip_y);
comp_compositor_create(struct xrt_device* xdev,
struct time_state* timekeeping,
bool flip_y);
#ifdef __cplusplus

View file

@ -464,7 +464,9 @@ compositor_init_renderer(struct comp_compositor *c)
}
struct xrt_compositor_fd *
comp_compositor_create(struct xrt_device *xdev, bool flip_y)
comp_compositor_create(struct xrt_device *xdev,
struct time_state *timekeeping,
bool flip_y)
{
struct comp_compositor *c = U_TYPED_CALLOC(struct comp_compositor);
@ -477,6 +479,7 @@ comp_compositor_create(struct xrt_device *xdev, bool flip_y)
c->base.base.end_frame = compositor_end_frame;
c->base.base.destroy = compositor_destroy;
c->xdev = xdev;
c->timekeeping = timekeeping;
COMP_DEBUG(c, "Doing init %p", (void *)c);

View file

@ -109,6 +109,9 @@ struct comp_compositor
//! The device we are displaying to.
struct xrt_device *xdev;
//! The timekeeping state object.
struct time_state *timekeeping;
//! The settings.
struct comp_settings settings;

View file

@ -45,6 +45,7 @@ xrt_gfx_vk_get_versions(struct xrt_api_requirements *ver)
struct xrt_compositor_vk *
xrt_gfx_vk_provider_create(struct xrt_device *xdev,
struct time_state *timekeeping,
VkInstance instance,
PFN_vkGetInstanceProcAddr get_instance_proc_addr,
VkPhysicalDevice physical_device,
@ -52,7 +53,8 @@ xrt_gfx_vk_provider_create(struct xrt_device *xdev,
uint32_t queue_family_index,
uint32_t queue_index)
{
struct xrt_compositor_fd *xcfd = comp_compositor_create(xdev, false);
struct xrt_compositor_fd *xcfd =
comp_compositor_create(xdev, timekeeping, false);
if (xcfd == NULL) {
return NULL;
}

View file

@ -18,13 +18,15 @@
struct xrt_compositor_gl *
xrt_gfx_provider_create_gl_xlib(struct xrt_device *xdev,
struct time_state *timekeeping,
Display *xDisplay,
uint32_t visualid,
GLXFBConfig glxFBConfig,
GLXDrawable glxDrawable,
GLXContext glxContext)
{
struct xrt_compositor_fd *xcfd = comp_compositor_create(xdev, true);
struct xrt_compositor_fd *xcfd =
comp_compositor_create(xdev, timekeeping, true);
if (xcfd == NULL) {
return NULL;
}

View file

@ -18,6 +18,8 @@
extern "C" {
#endif
struct time_state;
/*!
* @ingroup xrt_iface
@ -40,6 +42,7 @@ xrt_gfx_vk_get_versions(struct xrt_api_requirements *ver);
*/
struct xrt_compositor_vk *
xrt_gfx_vk_provider_create(struct xrt_device *xdev,
struct time_state *timekeeping,
VkInstance instance,
PFN_vkGetInstanceProcAddr getProc,
VkPhysicalDevice physicalDevice,

View file

@ -21,12 +21,14 @@ typedef void* Display;
typedef void* GLXFBConfig;
typedef void* GLXDrawable;
typedef void* GLXContext;
struct time_state;
/*!
* @ingroup xrt_iface
*/
struct xrt_compositor_gl*
xrt_gfx_provider_create_gl_xlib(struct xrt_device* xdev,
struct time_state* timekeeping,
Display* xDisplay,
uint32_t visualid,
GLXFBConfig glxFBConfig,

View file

@ -26,8 +26,8 @@ oxr_session_create_gl_xlib(struct oxr_logger *log,
struct oxr_session **out_session)
{
struct xrt_compositor_gl *xcgl = xrt_gfx_provider_create_gl_xlib(
sys->device, next->xDisplay, next->visualid, next->glxFBConfig,
next->glxDrawable, next->glxContext);
sys->device, sys->inst->timekeeping, next->xDisplay, next->visualid,
next->glxFBConfig, next->glxDrawable, next->glxContext);
if (xcgl == NULL) {
return oxr_error(log, XR_ERROR_INITIALIZATION_FAILED,

View file

@ -29,9 +29,9 @@ oxr_session_create_vk(struct oxr_logger *log,
struct oxr_session **out_session)
{
struct xrt_compositor_vk *xcvk = xrt_gfx_vk_provider_create(
sys->device, next->instance, vkGetInstanceProcAddr,
next->physicalDevice, next->device, next->queueFamilyIndex,
next->queueIndex);
sys->device, sys->inst->timekeeping, next->instance,
vkGetInstanceProcAddr, next->physicalDevice, next->device,
next->queueFamilyIndex, next->queueIndex);
if (xcvk == NULL) {
return oxr_error(log, XR_ERROR_INITIALIZATION_FAILED,