From 36f21017237ab536db74c84e0f778d3a58271c75 Mon Sep 17 00:00:00 2001 From: Philipp Zabel Date: Wed, 12 Apr 2017 12:31:01 +0200 Subject: etnaviv: native fence fd support This adds native fence fd support to etnaviv, similarly to commit 0b98e84e9ba0 ("freedreno: native fence fd"), enabled for kernel driver version 1.1 or later. Signed-off-by: Philipp Zabel Reviewed-By: Wladimir J. van der Laan Reviewed-by: Christian Gmeiner --- src/gallium/drivers/etnaviv/etnaviv_screen.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/gallium/drivers/etnaviv/etnaviv_screen.c') diff --git a/src/gallium/drivers/etnaviv/etnaviv_screen.c b/src/gallium/drivers/etnaviv/etnaviv_screen.c index f61b7f6de30..626f7c77898 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_screen.c +++ b/src/gallium/drivers/etnaviv/etnaviv_screen.c @@ -45,6 +45,9 @@ #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"}, @@ -137,6 +140,8 @@ etna_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param) 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: @@ -237,7 +242,6 @@ etna_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param) 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: @@ -736,6 +740,7 @@ etna_screen_create(struct etna_device *dev, struct etna_gpu *gpu, { struct etna_screen *screen = CALLOC_STRUCT(etna_screen); struct pipe_screen *pscreen; + drmVersionPtr version; uint64_t val; if (!screen) @@ -751,6 +756,11 @@ etna_screen_create(struct etna_device *dev, struct etna_gpu *gpu, 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 */ -- cgit v1.2.3