c/main: Make sure to close sync handles on layer_commit

This commit is contained in:
Jakob Bornecrantz 2020-12-18 15:04:28 +00:00
parent c191c9a466
commit 32c9cb1bf3

View file

@ -60,6 +60,11 @@
#include <stdlib.h>
#include <string.h>
#ifdef XRT_GRAPHICS_SYNC_HANDLE_IS_FD
#include <unistd.h>
#endif
#define WINDOW_TITLE "Monado"
static double
@ -465,10 +470,19 @@ compositor_layer_commit(struct xrt_compositor *xc,
{
struct comp_compositor *c = comp_compositor(xc);
assert(!xrt_graphics_sync_handle_is_valid(sync_handle));
COMP_SPEW(c, "LAYER_COMMIT at %8.3fms", ts_ms());
#ifdef XRT_GRAPHICS_SYNC_HANDLE_IS_FD
// Need to consume this handle.
if (xrt_graphics_sync_handle_is_valid(sync_handle)) {
close(sync_handle);
sync_handle = XRT_GRAPHICS_SYNC_HANDLE_INVALID;
}
#else
#error "Not yet implemented for this platform"
#endif
// Always zero for now.
uint32_t slot_id = 0;
uint32_t num_layers = c->slots[slot_id].num_layers;