mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2024-12-26 17:37:34 +00:00
c/client: Use the EGL compositor's display in swapchain
This commit is contained in:
parent
b7b469089c
commit
f9b5097134
2
doc/changes/compositor/mr.827.md
Normal file
2
doc/changes/compositor/mr.827.md
Normal file
|
@ -0,0 +1,2 @@
|
|||
client: Use the EGL compositor's display in swapchain, previously it tried to
|
||||
use the current one, which when running on a new thread would explode.
|
|
@ -88,6 +88,7 @@ endif()
|
|||
if(XRT_HAVE_EGL)
|
||||
list(APPEND CLIENT_SOURCE_FILES
|
||||
client/comp_egl_client.c
|
||||
client/comp_egl_client.h
|
||||
)
|
||||
endif()
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include "ogl/ogl_api.h"
|
||||
|
||||
#include "client/comp_gl_client.h"
|
||||
#include "client/comp_egl_client.h"
|
||||
#include "client/comp_gl_memobj_swapchain.h"
|
||||
#include "client/comp_gl_eglimage_swapchain.h"
|
||||
|
||||
|
@ -116,42 +117,12 @@ old_restore(struct old_helper *old, EGLDisplay current_dpy)
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
* EGL compositor subclass.
|
||||
*
|
||||
*/
|
||||
|
||||
/*!
|
||||
* EGL based compositor, carries the extra needed EGL information needed by the
|
||||
* client side code and can handle both GL Desktop or GLES contexts.
|
||||
*
|
||||
* @ingroup comp_client
|
||||
*/
|
||||
struct client_egl_compositor
|
||||
{
|
||||
struct client_gl_compositor base;
|
||||
|
||||
EGLDisplay dpy;
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
* Helper functions.
|
||||
*
|
||||
*/
|
||||
|
||||
/*!
|
||||
* Down-cast helper.
|
||||
* @protected @memberof client_egl_compositor
|
||||
*/
|
||||
static inline struct client_egl_compositor *
|
||||
client_egl_compositor(struct xrt_compositor *xc)
|
||||
{
|
||||
return (struct client_egl_compositor *)xc;
|
||||
}
|
||||
|
||||
XRT_MAYBE_UNUSED static bool
|
||||
has_extension(const char *extensions, const char *ext)
|
||||
{
|
||||
|
|
50
src/xrt/compositor/client/comp_egl_client.h
Normal file
50
src/xrt/compositor/client/comp_egl_client.h
Normal file
|
@ -0,0 +1,50 @@
|
|||
// Copyright 2019-2021, Collabora, Ltd.
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
/*!
|
||||
* @file
|
||||
* @brief Glue code to EGL client side glue code.
|
||||
* @author Jakob Bornecrantz <jakob@collabora.com>
|
||||
* @ingroup comp_client
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "xrt/xrt_compositor.h"
|
||||
|
||||
#include "ogl/egl_api.h"
|
||||
|
||||
#include "client/comp_gl_client.h"
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/*!
|
||||
* EGL based compositor, carries the extra needed EGL information needed by the
|
||||
* client side code and can handle both GL Desktop or GLES contexts.
|
||||
*
|
||||
* @ingroup comp_client
|
||||
*/
|
||||
struct client_egl_compositor
|
||||
{
|
||||
struct client_gl_compositor base;
|
||||
|
||||
EGLDisplay dpy;
|
||||
};
|
||||
|
||||
/*!
|
||||
* Down-cast helper.
|
||||
* @protected @memberof client_egl_compositor
|
||||
*/
|
||||
static inline struct client_egl_compositor *
|
||||
client_egl_compositor(struct xrt_compositor *xc)
|
||||
{
|
||||
return (struct client_egl_compositor *)xc;
|
||||
}
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
|
@ -27,6 +27,7 @@
|
|||
#include "ogl/ogl_helpers.h"
|
||||
|
||||
#include "client/comp_gl_client.h"
|
||||
#include "client/comp_egl_client.h"
|
||||
#include "client/comp_gl_eglimage_swapchain.h"
|
||||
|
||||
#include <inttypes.h>
|
||||
|
@ -164,6 +165,7 @@ client_gl_eglimage_swapchain_create(struct xrt_compositor *xc,
|
|||
struct xrt_swapchain_native *xscn,
|
||||
struct client_gl_swapchain **out_sc)
|
||||
{
|
||||
struct client_egl_compositor *ceglc = client_egl_compositor(xc);
|
||||
ll = debug_get_log_option_egl_swapchain_log();
|
||||
|
||||
if (xscn == NULL) {
|
||||
|
@ -197,7 +199,7 @@ client_gl_eglimage_swapchain_create(struct xrt_compositor *xc,
|
|||
sc->base.base.base.reference.count = 1;
|
||||
sc->base.base.base.num_images = native_xsc->num_images; // Fetch the number of images from the native swapchain.
|
||||
sc->base.xscn = xscn;
|
||||
sc->display = eglGetCurrentDisplay();
|
||||
sc->display = ceglc->dpy;
|
||||
|
||||
struct xrt_swapchain_gl *xscgl = &sc->base.base;
|
||||
|
||||
|
|
|
@ -102,6 +102,7 @@ endif
|
|||
if build_egl
|
||||
compositor_srcs += [
|
||||
'client/comp_egl_client.c',
|
||||
'client/comp_egl_client.h',
|
||||
]
|
||||
compositor_deps += [egl]
|
||||
endif
|
||||
|
|
Loading…
Reference in a new issue