Skip to content

Commit

Permalink
DisplayDevice: Backwards compatibility with old EGL
Browse files Browse the repository at this point in the history
From 4.1 to 4.2, the display subsystem was reworked to
use SurfaceTextureClient/BufferQueue instead of
FramebufferNativeWindow for the framebuffer itself.

Unfortunately, some legacy EGL libraries make assumptions
that any framebuffer device will be FramebufferNativeWindow.

These EGL libraries will fail when used in 4.2 as if the
framebuffer is not FramebufferNativeWindow, they will
try to dequeue more than one buffer at a time, which
will cause a hang of the graphics subsystem.

This allows use of FramebufferNativeWindow to keep
legacy EGL implementations happy.  Confirmed EGL
implementations that need this include but are
not limited to:

Set BOARD_EGL_NEEDS_LEGACY_FB to use

Tegra2/3 ICS EGL
Mali400 ICS EGL (Allwinner A10)
Mali400 Jellybean (4.1) EGL (Samsung Exynos4)

Original implementation by OndraOrg of XDA:
http://forum.xda-developers.com/showpost.php?p=34469675&postcount=19

Change-Id: I74005cf6753b3c9bfb4c1e32fb641f5167787917

Conflicts:
	services/surfaceflinger/DisplayDevice.cpp
  • Loading branch information
Entropy512 authored and xplodwild committed Nov 4, 2013
1 parent ec1d827 commit da68037
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
4 changes: 4 additions & 0 deletions services/surfaceflinger/Android.mk
Expand Up @@ -51,6 +51,10 @@ ifeq ($(TARGET_DISABLE_TRIPLE_BUFFERING),true)
LOCAL_CFLAGS += -DTARGET_DISABLE_TRIPLE_BUFFERING
endif

ifeq ($(BOARD_EGL_NEEDS_LEGACY_FB),true)
LOCAL_CFLAGS += -DBOARD_EGL_NEEDS_LEGACY_FB
endif

ifneq ($(NUM_FRAMEBUFFER_SURFACE_BUFFERS),)
LOCAL_CFLAGS += -DNUM_FRAMEBUFFER_SURFACE_BUFFERS=$(NUM_FRAMEBUFFER_SURFACE_BUFFERS)
endif
Expand Down
13 changes: 13 additions & 0 deletions services/surfaceflinger/DisplayDevice.cpp
Expand Up @@ -29,6 +29,14 @@

#include <gui/Surface.h>

#ifdef BOARD_EGL_NEEDS_LEGACY_FB
#include <ui/FramebufferNativeWindow.h>
#endif

#include <GLES/gl.h>
#include <EGL/egl.h>
#include <EGL/eglext.h>

#include <hardware/gralloc.h>

#include "DisplayHardware/DisplaySurface.h"
Expand Down Expand Up @@ -74,7 +82,12 @@ DisplayDevice::DisplayDevice(
mOrientation()
{
mNativeWindow = new Surface(producer, false);

#ifndef BOARD_EGL_NEEDS_LEGACY_FB
ANativeWindow* const window = mNativeWindow.get();
#else
ANativeWindow* const window = new FramebufferNativeWindow();
#endif

int format;
window->query(window, NATIVE_WINDOW_FORMAT, &format);
Expand Down

0 comments on commit da68037

Please sign in to comment.