<html>
    <head>
      <base href="https://bugs.freedesktop.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Explicit sync support for android"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=101655">101655</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Explicit sync support for android
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>Mesa
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>17.1
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Other
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>other
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>medium
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>EGL
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>mesa-dev@lists.freedesktop.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>yogesh.marathe@intel.com
          </td>
        </tr>

        <tr>
          <th>QA Contact</th>
          <td>mesa-dev@lists.freedesktop.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Description: The explicit sync was introduced in android to have sync fds
passed between user space processes and let user insert waits for buffer
transcations as appropriate. In android, if there is a producer-consumer
scenario in framework and if mesa is being used underneath this explicit sync
wouldn't work because the fence_fd is being forced to -1 before enqueue. The
comments above this assignment clearly state why its doing so, although it
seems old and assumes that consumer will never want use that fd to get a signal
timestamp using libsync apis or wait on that fd. Acquire fence on consumer side
remains always invalid due to this.

File: platform_android.c

Function: droid_window_enqueue_buffer()
...
    int fence_fd = -1;
   dri2_surf->window->queueBuffer(dri2_surf->window, dri2_surf->buffer,
                                  fence_fd);
...


Test case: flatland - provided though aosp under
framworks/native/cmds/flatland is an app that tests explicit functionality on
android. 

Symptoms and Cause: flatland hangs because it tries to do getSignalTime() for
this acquire fence_fd on consumer side and uses that to calculate time elapsed
for doing one frame of particular resolution.

Expectations: 
1. Flatland should work as standalone test case with mesa.
2. To support explicit sync, it should forward a valid fence for a buffer being
enqueued (it can also be a signaled one if buffer is immediately available for
consumption).


I tried, if a sync fence can be created before buffer is enqueued but didnt
find a way because all sync functions seem to be static in nature and exposed
only though egl apis. I don't know if there is any other way to call those
functions (e.g. dri2_create_sync etc.) from platform_android.c directly.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are the assignee for the bug.</li>
          <li>You are the QA Contact for the bug.</li>
      </ul>
    </body>
</html>