LIBDRM_NOUVEAU_REQUIRED=2.4.66
LIBDRM_FREEDRENO_REQUIRED=2.4.74
LIBDRM_VC4_REQUIRED=2.4.69
-LIBDRM_ETNAVIV_REQUIRED=2.4.74
+LIBDRM_ETNAVIV_REQUIRED=2.4.80
dnl Versions for external dependencies
DRI2PROTO_REQUIRED=2.8
slab_destroy_child(&ctx->transfer_pool);
+ if (ctx->in_fence_fd != -1)
+ close(ctx->in_fence_fd);
+
FREE(pctx);
}
enum pipe_flush_flags flags)
{
struct etna_context *ctx = etna_context(pctx);
+ int out_fence_fd = -1;
- etna_cmd_stream_flush(ctx->stream);
+ etna_cmd_stream_flush2(ctx->stream, ctx->in_fence_fd,
+ (flags & PIPE_FLUSH_FENCE_FD) ? &out_fence_fd :
+ NULL);
if (fence)
- *fence = etna_fence_create(pctx);
+ *fence = etna_fence_create(pctx, out_fence_fd);
}
static void
/* Set sensible defaults for state */
etna_cmd_stream_reset_notify(ctx->stream, ctx);
+ ctx->in_fence_fd = -1;
+
pctx->destroy = etna_context_destroy;
pctx->draw_vbo = etna_draw_vbo;
pctx->flush = etna_flush;
pctx->set_debug_callback = etna_set_debug_callback;
+ pctx->create_fence_fd = etna_create_fence_fd;
+ pctx->fence_server_sync = etna_fence_server_sync;
/* creation of compile states */
pctx->create_blend_state = etna_blend_state_create;
} stats;
struct pipe_debug_callback debug;
+ int in_fence_fd;
};
static inline struct etna_context *
* Rob Clark <robclark@freedesktop.org>
*/
+#include <libsync.h>
+
#include "etnaviv_fence.h"
#include "etnaviv_context.h"
#include "etnaviv_screen.h"
struct pipe_reference reference;
struct etna_context *ctx;
struct etna_screen *screen;
+ int fence_fd;
uint32_t timestamp;
};
+static void
+etna_fence_destroy(struct pipe_fence_handle *fence)
+{
+ if (fence->fence_fd != -1)
+ close(fence->fence_fd);
+ FREE(fence);
+}
+
static void
etna_screen_fence_reference(struct pipe_screen *pscreen,
struct pipe_fence_handle **ptr,
struct pipe_fence_handle *fence)
{
if (pipe_reference(&(*ptr)->reference, &fence->reference))
- FREE(*ptr);
+ etna_fence_destroy(*ptr);
*ptr = fence;
}
etna_screen_fence_finish(struct pipe_screen *pscreen, struct pipe_context *ctx,
struct pipe_fence_handle *fence, uint64_t timeout)
{
+ if (fence->fence_fd != -1) {
+ int ret = sync_wait(fence->fence_fd, timeout / 1000000);
+ return ret == 0;
+ }
+
if (etna_pipe_wait_ns(fence->screen->pipe, fence->timestamp, timeout))
return false;
return true;
}
+void
+etna_create_fence_fd(struct pipe_context *pctx,
+ struct pipe_fence_handle **pfence, int fd)
+{
+ *pfence = etna_fence_create(pctx, dup(fd));
+}
+
+void
+etna_fence_server_sync(struct pipe_context *pctx,
+ struct pipe_fence_handle *pfence)
+{
+ struct etna_context *ctx = etna_context(pctx);
+
+ 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);
+}
+
struct pipe_fence_handle *
-etna_fence_create(struct pipe_context *pctx)
+etna_fence_create(struct pipe_context *pctx, int fence_fd)
{
struct pipe_fence_handle *fence;
struct etna_context *ctx = etna_context(pctx);
fence->ctx = ctx;
fence->screen = ctx->screen;
fence->timestamp = etna_cmd_stream_timestamp(ctx->stream);
+ fence->fence_fd = fence_fd;
return fence;
}
{
pscreen->fence_reference = etna_screen_fence_reference;
pscreen->fence_finish = etna_screen_fence_finish;
+ pscreen->fence_get_fd = etna_screen_fence_get_fd;
}
#include "pipe/p_context.h"
+void
+etna_create_fence_fd(struct pipe_context *pctx,
+ struct pipe_fence_handle **pfence, int fd);
+
+void
+etna_fence_server_sync(struct pipe_context *pctx,
+ struct pipe_fence_handle *fence);
+
+int
+etna_fence_get_fd(struct pipe_screen *pscreen,
+ struct pipe_fence_handle *pfence);
+
struct pipe_fence_handle *
-etna_fence_create(struct pipe_context *pctx);
+etna_fence_create(struct pipe_context *pctx, int fence_fd);
void
etna_fence_screen_init(struct pipe_screen *pscreen);
#include "state_tracker/drm_driver.h"
+#define ETNA_DRM_VERSION(major, minor) ((major) << 16 | (minor))
+#define ETNA_DRM_VERSION_FENCE_FD ETNA_DRM_VERSION(1, 1)
+
static const struct debug_named_value debug_options[] = {
{"dbg_msgs", ETNA_DBG_MSGS, "Print debug messages"},
{"frame_msgs", ETNA_DBG_FRAME_MSGS, "Print frame messages"},
case PIPE_CAP_TGSI_TEXCOORD:
case PIPE_CAP_VERTEX_COLOR_UNCLAMPED:
return 1;
+ case PIPE_CAP_NATIVE_FENCE_FD:
+ return screen->drm_version >= ETNA_DRM_VERSION_FENCE_FD;
/* Memory */
case PIPE_CAP_CONSTANT_BUFFER_OFFSET_ALIGNMENT:
case PIPE_CAP_TGSI_ARRAY_COMPONENTS:
case PIPE_CAP_STREAM_OUTPUT_INTERLEAVE_BUFFERS:
case PIPE_CAP_TGSI_CAN_READ_OUTPUTS:
- case PIPE_CAP_NATIVE_FENCE_FD:
case PIPE_CAP_GLSL_OPTIMIZE_CONSERVATIVELY:
case PIPE_CAP_TGSI_FS_FBFETCH:
case PIPE_CAP_TGSI_MUL_ZERO_WINS:
{
struct etna_screen *screen = CALLOC_STRUCT(etna_screen);
struct pipe_screen *pscreen;
+ drmVersionPtr version;
uint64_t val;
if (!screen)
goto fail;
}
+ version = drmGetVersion(screen->ro->gpu_fd);
+ screen->drm_version = ETNA_DRM_VERSION(version->version_major,
+ version->version_minor);
+ drmFreeVersion(version);
+
etna_mesa_debug = debug_get_option_etna_mesa_debug();
/* Disable autodisable for correct rendering with TS */
uint32_t features[VIV_FEATURES_WORD_COUNT];
struct etna_specs specs;
+
+ uint32_t drm_version;
};
static inline struct etna_screen *