<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 - Invalid signal timestamps with EGL_SYNC_NATIVE_FENCE_ANDROID on android"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=101656">101656</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Invalid signal timestamps with EGL_SYNC_NATIVE_FENCE_ANDROID on 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>x86-64 (AMD64)
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </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: I'm using EGL_SYNC_NATIVE_FENCE_ANDROID to create a fence fd in
producer consumer situation. I'm doing this for every buffer, I see that I'm
getting a valid fd every time, I pass that to consumer and on consumer side I
call getSingalTime() on this. This uses SYNC_IOC_FILE_INFO ioctl though libsync
to get time 64 bit timestamp of when fence was signaled. The observation is
sometimes I'm getting lower timestamp for newer fences! 

e.g. fd1 is with Buffer1 later created fd2 is with buffer2, getSignalTime of
fd2 is lower than fd1, glFulsh is called before both fds were obtained (force
signal).

Expectation - timestamps of newer fds should be higher than older fds always.

Some Code

Producer side

EGLDisplay dpy = eglGetCurrentDisplay(); 
EGLSyncKHR sync = eglCreateSyncKHR(dpy,
                    EGL_SYNC_NATIVE_FENCE_ANDROID, NULL);
            if (sync == EGL_NO_SYNC_KHR) {
                return UNKNOWN_ERROR;
            }
    glFlush();
    fenceFd = eglDupNativeFenceFDANDROID(dpy, sync);

   eglDestroySyncKHR(dpy, sync);
   if (fenceFd == EGL_NO_NATIVE_FENCE_FD_ANDROID) {
                return UNKNOWN_ERROR;
            }

Consumer side

if (item->mFence->isValid()) {
    status_t err = item->mFence->waitForever("acquireBufferLocked");
    if (err != NO_ERROR) {
            return err;
    }
 }

Is EGL_SYNC_NATIVE_FENCE_ANDROID tested in multiple create, dup, destroy
sequence?</pre>
        </div>
      </p>


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

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