mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-01-28 17:38:27 +00:00
st/oxr: Frame end uses the most recently released image
This commit is contained in:
parent
f6b8cb25b8
commit
b6f2013bc5
|
@ -127,7 +127,7 @@ static void
|
||||||
client_gl_compositor_end_frame(struct xrt_compositor *xc,
|
client_gl_compositor_end_frame(struct xrt_compositor *xc,
|
||||||
enum xrt_blend_mode blend_mode,
|
enum xrt_blend_mode blend_mode,
|
||||||
struct xrt_swapchain **xscs,
|
struct xrt_swapchain **xscs,
|
||||||
uint32_t *acquired_index,
|
uint32_t *image_index,
|
||||||
uint32_t num_swapchains)
|
uint32_t num_swapchains)
|
||||||
{
|
{
|
||||||
struct client_gl_compositor *c = client_gl_compositor(xc);
|
struct client_gl_compositor *c = client_gl_compositor(xc);
|
||||||
|
@ -145,7 +145,7 @@ client_gl_compositor_end_frame(struct xrt_compositor *xc,
|
||||||
|
|
||||||
// Pipe down call into fd compositor.
|
// Pipe down call into fd compositor.
|
||||||
c->xcfd->base.end_frame(&c->xcfd->base, blend_mode, internal,
|
c->xcfd->base.end_frame(&c->xcfd->base, blend_mode, internal,
|
||||||
acquired_index, num_swapchains);
|
image_index, num_swapchains);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int64_t
|
static int64_t
|
||||||
|
|
|
@ -147,7 +147,7 @@ static void
|
||||||
client_vk_compositor_end_frame(struct xrt_compositor *xc,
|
client_vk_compositor_end_frame(struct xrt_compositor *xc,
|
||||||
enum xrt_blend_mode blend_mode,
|
enum xrt_blend_mode blend_mode,
|
||||||
struct xrt_swapchain **xscs,
|
struct xrt_swapchain **xscs,
|
||||||
uint32_t *acquired_index,
|
uint32_t *image_index,
|
||||||
uint32_t num_swapchains)
|
uint32_t num_swapchains)
|
||||||
{
|
{
|
||||||
struct client_vk_compositor *c = client_vk_compositor(xc);
|
struct client_vk_compositor *c = client_vk_compositor(xc);
|
||||||
|
@ -165,7 +165,7 @@ client_vk_compositor_end_frame(struct xrt_compositor *xc,
|
||||||
|
|
||||||
// Pipe down call into fd compositor.
|
// Pipe down call into fd compositor.
|
||||||
c->xcfd->base.end_frame(&c->xcfd->base, blend_mode, internal,
|
c->xcfd->base.end_frame(&c->xcfd->base, blend_mode, internal,
|
||||||
acquired_index, num_swapchains);
|
image_index, num_swapchains);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct xrt_swapchain *
|
static struct xrt_swapchain *
|
||||||
|
|
|
@ -109,7 +109,7 @@ static void
|
||||||
compositor_end_frame(struct xrt_compositor *xc,
|
compositor_end_frame(struct xrt_compositor *xc,
|
||||||
enum xrt_blend_mode blend_mode,
|
enum xrt_blend_mode blend_mode,
|
||||||
struct xrt_swapchain **xscs,
|
struct xrt_swapchain **xscs,
|
||||||
uint32_t *acquired_index,
|
uint32_t *image_index,
|
||||||
uint32_t num_swapchains)
|
uint32_t num_swapchains)
|
||||||
{
|
{
|
||||||
struct comp_compositor *c = comp_compositor(xc);
|
struct comp_compositor *c = comp_compositor(xc);
|
||||||
|
@ -120,8 +120,8 @@ compositor_end_frame(struct xrt_compositor *xc,
|
||||||
|
|
||||||
// Stereo!
|
// Stereo!
|
||||||
if (num_swapchains == 2) {
|
if (num_swapchains == 2) {
|
||||||
left = &comp_swapchain(xscs[0])->images[acquired_index[0]];
|
left = &comp_swapchain(xscs[0])->images[image_index[0]];
|
||||||
right = &comp_swapchain(xscs[1])->images[acquired_index[1]];
|
right = &comp_swapchain(xscs[1])->images[image_index[1]];
|
||||||
comp_renderer_frame(c->r, left, right);
|
comp_renderer_frame(c->r, left, right);
|
||||||
} else {
|
} else {
|
||||||
COMP_ERROR(c, "non-stereo rendering not supported");
|
COMP_ERROR(c, "non-stereo rendering not supported");
|
||||||
|
|
|
@ -185,7 +185,7 @@ struct xrt_compositor
|
||||||
void (*end_frame)(struct xrt_compositor *xc,
|
void (*end_frame)(struct xrt_compositor *xc,
|
||||||
enum xrt_blend_mode blend_mode,
|
enum xrt_blend_mode blend_mode,
|
||||||
struct xrt_swapchain **xscs,
|
struct xrt_swapchain **xscs,
|
||||||
uint32_t *acquired_index,
|
uint32_t *image_index,
|
||||||
uint32_t num_swapchains);
|
uint32_t num_swapchains);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|
|
@ -679,6 +679,7 @@ struct oxr_swapchain
|
||||||
|
|
||||||
//! Actual state tracked! :D
|
//! Actual state tracked! :D
|
||||||
int acquired_index;
|
int acquired_index;
|
||||||
|
int released_index;
|
||||||
|
|
||||||
XrResult (*destroy)(struct oxr_logger *, struct oxr_swapchain *);
|
XrResult (*destroy)(struct oxr_logger *, struct oxr_swapchain *);
|
||||||
|
|
||||||
|
|
|
@ -463,7 +463,7 @@ oxr_session_frame_end(struct oxr_logger *log,
|
||||||
*/
|
*/
|
||||||
|
|
||||||
struct xrt_swapchain *chains[2];
|
struct xrt_swapchain *chains[2];
|
||||||
uint32_t acquired_index[2];
|
uint32_t image_index[2];
|
||||||
uint32_t num_chains = ARRAY_SIZE(chains);
|
uint32_t num_chains = ARRAY_SIZE(chains);
|
||||||
|
|
||||||
for (uint32_t i = 0; i < num_chains; i++) {
|
for (uint32_t i = 0; i < num_chains; i++) {
|
||||||
|
@ -471,10 +471,10 @@ oxr_session_frame_end(struct oxr_logger *log,
|
||||||
struct oxr_swapchain *sc =
|
struct oxr_swapchain *sc =
|
||||||
(struct oxr_swapchain *)proj->views[i].subImage.swapchain;
|
(struct oxr_swapchain *)proj->views[i].subImage.swapchain;
|
||||||
chains[i] = sc->swapchain;
|
chains[i] = sc->swapchain;
|
||||||
acquired_index[i] = proj->views[i].subImage.imageArrayIndex;
|
image_index[i] = sc->released_index;
|
||||||
}
|
}
|
||||||
|
|
||||||
xc->end_frame(xc, blend_mode, chains, acquired_index, num_chains);
|
xc->end_frame(xc, blend_mode, chains, image_index, num_chains);
|
||||||
|
|
||||||
sess->frame_started = false;
|
sess->frame_started = false;
|
||||||
|
|
||||||
|
|
|
@ -78,6 +78,7 @@ oxr_swapchain_release_image(struct oxr_logger *log,
|
||||||
return oxr_error(log, XR_ERROR_RUNTIME_FAILURE,
|
return oxr_error(log, XR_ERROR_RUNTIME_FAILURE,
|
||||||
" call to xsc->release_image failed");
|
" call to xsc->release_image failed");
|
||||||
}
|
}
|
||||||
|
sc->released_index = sc->acquired_index;
|
||||||
sc->acquired_index = -1;
|
sc->acquired_index = -1;
|
||||||
|
|
||||||
return XR_SUCCESS;
|
return XR_SUCCESS;
|
||||||
|
@ -119,6 +120,7 @@ oxr_create_swapchain(struct oxr_logger *log,
|
||||||
sc->wait_image = oxr_swapchain_wait_image;
|
sc->wait_image = oxr_swapchain_wait_image;
|
||||||
sc->release_image = oxr_swapchain_release_image;
|
sc->release_image = oxr_swapchain_release_image;
|
||||||
sc->acquired_index = -1;
|
sc->acquired_index = -1;
|
||||||
|
sc->released_index = -1;
|
||||||
|
|
||||||
*out_swapchain = sc;
|
*out_swapchain = sc;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue