Add an error handling to droid_swap_buffers() to handle the undefined
case of dri2_surf->buffer==null.
We found that when running CTS testAbandonRepeatingRequestSurface on
Chromebook, the test would fail. After digging, we found that the
Android framework relied on an undefined behavior to abort the camera
transmission. Therefore, we added an error handling to return
EGL_BAD_SURFACE to Android framework to force the camera transmission.

the testAbandonRepeatingRequestSurface test flow:
(https://android.googlesource.com/platform/cts/+/android-7.1.1_r23/
tests/camera/src/android/hardware/camera2/cts/RobustnessTest.java#921)

testAbandonRepeatingRequestSurface {
1. Create surface for the camera
2. Setup camera parameter, callback function and underlying surface
3. Setup repeating request to camera and start capture 60 frames
4. Poll 60 frames from Camera and put to surface
5. Release the surface texture <-- From now, Android framework will
   call droid_swap_buffers() with dri2_surf->buffer=null
6. Expect the camera's repeating request stop and get the last
   frame number <-- Time out here because Camera isn't aborted
7. Checking for the frame number
}

The problem is happened after step 5 releasing the underlying surface
texture. The step 6 expects that the camere is aborted and should
trigger onCaptureSequenceCompleted() callback. This solution adds an
error handling which will return EGL_BAD_SURFACE to android framework
to force camera tramission be aborted.

Signed-off-by: Zhuo-hao Lee <zhuo-hao....@intel.com>
---
 src/egl/drivers/dri2/platform_android.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/egl/drivers/dri2/platform_android.c 
b/src/egl/drivers/dri2/platform_android.c
index 6cbe119..00a96d9 100644
--- a/src/egl/drivers/dri2/platform_android.c
+++ b/src/egl/drivers/dri2/platform_android.c
@@ -633,6 +633,8 @@ droid_swap_buffers(_EGLDriver *drv, _EGLDisplay *disp, 
_EGLSurface *draw)
 
    if (dri2_surf->buffer)
       droid_window_enqueue_buffer(disp, dri2_surf);
+   else
+      return _eglError(EGL_BAD_SURFACE, "dri2_swap_buffers");
 
    dri2_dpy->flush->invalidate(dri2_surf->dri_drawable);
 
-- 
1.9.1

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to