st/dri: fix android fence regression
authorMarek Olšák <marek.olsak@amd.com>
Thu, 9 Nov 2017 19:12:07 +0000 (20:12 +0100)
committerMarek Olšák <marek.olsak@amd.com>
Fri, 10 Nov 2017 16:17:13 +0000 (17:17 +0100)
Fixes piglit - egl_khr_fence_sync/android_native tests.
Broken by 884a0b2a9e55d4c1ca39475b50d9af598d7d7280.

Introduce state-tracker flush flags, analogous to the pipe ones. Use
the former when with stapi->flush().

Fixes: 884a0b2a9e5 ("st/dri: use stapi flush instead of pipe flush
when creating fences")
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
src/gallium/include/state_tracker/st_api.h
src/gallium/state_trackers/dri/dri_helpers.c
src/mesa/state_tracker/st_manager.c

index 11a9878cf64a1582964c65fd076d388859b0d253..6cdaefc902f72bc5bc4c727e35fd42eaf3525bc7 100644 (file)
@@ -147,6 +147,8 @@ enum st_attachment_type {
 #define ST_FLUSH_FRONT                    (1 << 0)
 #define ST_FLUSH_END_OF_FRAME             (1 << 1)
 #define ST_FLUSH_WAIT                     (1 << 2)
+#define ST_FLUSH_DEFERRED                 (1 << 3)
+#define ST_FLUSH_FENCE_FD                 (1 << 4)
 
 /**
  * Value to st_manager->get_param function.
index a9213eca19a26a75c392c47ef6c53397e844412d..4a61455b1f9d4acc38d238de162a086f828ecbb3 100644 (file)
@@ -116,7 +116,7 @@ dri2_create_fence_fd(__DRIcontext *_ctx, int fd)
 
    if (fd == -1) {
       /* exporting driver created fence, flush: */
-      stapi->flush(stapi, PIPE_FLUSH_DEFERRED | PIPE_FLUSH_FENCE_FD,
+      stapi->flush(stapi, ST_FLUSH_DEFERRED | ST_FLUSH_FENCE_FD,
                    &fence->pipe_fence);
    } else {
       /* importing a foreign fence fd: */
index aedbc13f7d7608474e6b556b565b61aa467f291b..43d5dfdced201986c7f04034a2ade8d3303209c9 100644 (file)
@@ -632,9 +632,12 @@ st_context_flush(struct st_context_iface *stctxi, unsigned flags,
    struct st_context *st = (struct st_context *) stctxi;
    unsigned pipe_flags = 0;
 
-   if (flags & ST_FLUSH_END_OF_FRAME) {
+   if (flags & ST_FLUSH_END_OF_FRAME)
       pipe_flags |= PIPE_FLUSH_END_OF_FRAME;
-   }
+   if (flags & ST_FLUSH_DEFERRED)
+      pipe_flags |= PIPE_FLUSH_DEFERRED;
+   if (flags & ST_FLUSH_FENCE_FD)
+      pipe_flags |= PIPE_FLUSH_FENCE_FD;
 
    FLUSH_VERTICES(st->ctx, 0);
    FLUSH_CURRENT(st->ctx, 0);