#include "etnaviv_context.h"
#include "etnaviv_screen.h"
+#include "util/os_file.h"
#include "util/u_inlines.h"
#include "util/u_memory.h"
struct pipe_fence_handle {
struct pipe_reference reference;
- struct etna_context *ctx;
struct etna_screen *screen;
int fence_fd;
uint32_t timestamp;
*ptr = fence;
}
-static boolean
+static bool
etna_screen_fence_finish(struct pipe_screen *pscreen, struct pipe_context *ctx,
struct pipe_fence_handle *fence, uint64_t timeout)
{
void
etna_create_fence_fd(struct pipe_context *pctx,
- struct pipe_fence_handle **pfence, int fd)
+ struct pipe_fence_handle **pfence, int fd,
+ enum pipe_fd_type type)
{
- *pfence = etna_fence_create(pctx, dup(fd));
+ assert(type == PIPE_FD_TYPE_NATIVE_SYNC);
+ *pfence = etna_fence_create(pctx, os_dupfd_cloexec(fd));
}
void
{
struct etna_context *ctx = etna_context(pctx);
- sync_accumulate("etnaviv", &ctx->in_fence_fd, pfence->fence_fd);
+ if (pfence->fence_fd != -1)
+ sync_accumulate("etnaviv", &ctx->in_fence_fd, pfence->fence_fd);
}
static int
etna_screen_fence_get_fd(struct pipe_screen *pscreen,
struct pipe_fence_handle *pfence)
{
- return dup(pfence->fence_fd);
+ return os_dupfd_cloexec(pfence->fence_fd);
}
struct pipe_fence_handle *
pipe_reference_init(&fence->reference, 1);
- fence->ctx = ctx;
fence->screen = ctx->screen;
fence->timestamp = etna_cmd_stream_timestamp(ctx->stream);
fence->fence_fd = fence_fd;