summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorxinglong.zhu <xinglong.zhu@spreadtrum.com>2016-08-08 20:13:09 +0200
committerandroid-build-merger <android-build-merger@google.com>2016-08-08 20:13:09 +0200
commit397bf4ef9346f939fa29e50af59ed84c021a54ef (patch)
treea9ea46da8484e8b822db6f887c270da6f0afb77d
parentMerge "Further compress the text images with zopflipng" am: 61240f88ea am: 3e244dc301 am: 5a84cecd26 (diff)
parentMerge "Recovery mode UI flicker" am: 629bde8c6c am: a5734c2ad8 (diff)
downloadandroid_bootable_recovery-397bf4ef9346f939fa29e50af59ed84c021a54ef.tar
android_bootable_recovery-397bf4ef9346f939fa29e50af59ed84c021a54ef.tar.gz
android_bootable_recovery-397bf4ef9346f939fa29e50af59ed84c021a54ef.tar.bz2
android_bootable_recovery-397bf4ef9346f939fa29e50af59ed84c021a54ef.tar.lz
android_bootable_recovery-397bf4ef9346f939fa29e50af59ed84c021a54ef.tar.xz
android_bootable_recovery-397bf4ef9346f939fa29e50af59ed84c021a54ef.tar.zst
android_bootable_recovery-397bf4ef9346f939fa29e50af59ed84c021a54ef.zip
Diffstat (limited to '')
-rw-r--r--minui/Android.mk1
-rw-r--r--minui/graphics_adf.cpp24
2 files changed, 24 insertions, 1 deletions
diff --git a/minui/Android.mk b/minui/Android.mk
index 3057f452c..380ec2bfd 100644
--- a/minui/Android.mk
+++ b/minui/Android.mk
@@ -11,6 +11,7 @@ LOCAL_SRC_FILES := \
LOCAL_WHOLE_STATIC_LIBRARIES += libadf
LOCAL_WHOLE_STATIC_LIBRARIES += libdrm
+LOCAL_WHOLE_STATIC_LIBRARIES += libsync_recovery
LOCAL_STATIC_LIBRARIES += libpng
LOCAL_MODULE := libminui
diff --git a/minui/graphics_adf.cpp b/minui/graphics_adf.cpp
index a72e40b58..3c3541094 100644
--- a/minui/graphics_adf.cpp
+++ b/minui/graphics_adf.cpp
@@ -26,11 +26,13 @@
#include <sys/mman.h>
#include <adf/adf.h>
+#include <sync/sync.h>
#include "graphics.h"
struct adf_surface_pdata {
GRSurface base;
+ int fence_fd;
int fd;
__u32 offset;
__u32 pitch;
@@ -55,6 +57,7 @@ static void adf_blank(minui_backend *backend, bool blank);
static int adf_surface_init(adf_pdata *pdata, drm_mode_modeinfo *mode, adf_surface_pdata *surf) {
memset(surf, 0, sizeof(*surf));
+ surf->fence_fd = -1;
surf->fd = adf_interface_simple_buffer_alloc(pdata->intf_fd, mode->hdisplay,
mode->vdisplay, pdata->format, &surf->offset, &surf->pitch);
if (surf->fd < 0)
@@ -194,6 +197,23 @@ static GRSurface* adf_init(minui_backend *backend)
return ret;
}
+static void adf_sync(adf_surface_pdata *surf)
+{
+ unsigned int warningTimeout = 3000;
+
+ if (surf == NULL)
+ return;
+
+ if (surf->fence_fd >= 0){
+ int err = sync_wait(surf->fence_fd, warningTimeout);
+ if (err < 0)
+ perror("adf sync fence wait error\n");
+
+ close(surf->fence_fd);
+ surf->fence_fd = -1;
+ }
+}
+
static GRSurface* adf_flip(minui_backend *backend)
{
adf_pdata *pdata = (adf_pdata *)backend;
@@ -203,9 +223,10 @@ static GRSurface* adf_flip(minui_backend *backend)
surf->base.width, surf->base.height, pdata->format, surf->fd,
surf->offset, surf->pitch, -1);
if (fence_fd >= 0)
- close(fence_fd);
+ surf->fence_fd = fence_fd;
pdata->current_surface = (pdata->current_surface + 1) % pdata->n_surfaces;
+ adf_sync(&pdata->surfaces[pdata->current_surface]);
return &pdata->surfaces[pdata->current_surface].base;
}
@@ -219,6 +240,7 @@ static void adf_blank(minui_backend *backend, bool blank)
static void adf_surface_destroy(adf_surface_pdata *surf)
{
munmap(surf->base.data, surf->pitch * surf->base.height);
+ close(surf->fence_fd);
close(surf->fd);
}