summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/etnaviv/etnaviv_screen.c
diff options
context:
space:
mode:
authorPhilipp Zabel <[email protected]>2017-04-12 12:31:01 +0200
committerChristian Gmeiner <[email protected]>2017-04-15 01:47:18 +0200
commit36f21017237ab536db74c84e0f778d3a58271c75 (patch)
tree399a8b2a5831dc764be6a80f4eafb76db62a8d78 /src/gallium/drivers/etnaviv/etnaviv_screen.c
parent96dfc014fd33a4f38e31fa1d4c9c4ea52d85a0b8 (diff)
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 <[email protected]> Reviewed-By: Wladimir J. van der Laan <[email protected]> Reviewed-by: Christian Gmeiner <[email protected]>
Diffstat (limited to 'src/gallium/drivers/etnaviv/etnaviv_screen.c')
-rw-r--r--src/gallium/drivers/etnaviv/etnaviv_screen.c12
1 files changed, 11 insertions, 1 deletions
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 */