Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fc496c06 authored by Ricardo Cerqueira's avatar Ricardo Cerqueira
Browse files

graphics: Add directives for compatibility with older EGL blobs

- Define MISSING_EGL_EXTERNAL_IMAGE for EGL libraries without
  GL_OES_GLES_image_external
- Define MISSING_GRALLOC_BUFFERS for gralloc HALS without the
  0x800 (USAGE_HW_COMPOSER) usage
- Define MISSING_EGL_PIXEL_FORMAT_YV12 for libraries who don't
  recognize the Android YV12 colorspace
- Define FORCE_EGL_CONFIG=<value> for blobs which mis-identify the
  usable EGL configuration (pick the value from a CM7 log)

A typical GB library set will need
COMMON_GLOBAL_CFLAGS += -DMISSING_EGL_EXTERNAL_IMAGE -DMISSING_EGL_PIXEL_FORMAT_YV12 -DMISSING_GRALLOC_BUFFERS

Change-Id: I85ae813c604d3d2fc41a291c9cb13d1ecd35368f
parent 4330d579
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -99,6 +99,14 @@ status_t GraphicBufferAllocator::alloc(uint32_t w, uint32_t h, PixelFormat forma
    // we have a h/w allocator and h/w buffer is requested
    status_t err; 

#ifdef MISSING_EGL_PIXEL_FORMAT_YV12
    if (format == HAL_PIXEL_FORMAT_YV12) {
	format = HAL_PIXEL_FORMAT_RGBX_8888;
    }
    if (usage & GRALLOC_USAGE_EXTERNAL_DISP) {
	usage ^= GRALLOC_USAGE_EXTERNAL_DISP;
    }
#endif
    err = mAllocDev->alloc(mAllocDev, w, h, format, usage, handle, stride);

    LOGW_IF(err, "alloc(%u, %u, %d, %08x, ...) failed %d (%s)",
+13 −0
Original line number Diff line number Diff line
@@ -70,10 +70,23 @@ status_t GraphicBufferMapper::lock(buffer_handle_t handle,
        int usage, const Rect& bounds, void** vaddr)
{
    status_t err;
#ifdef MISSING_GRALLOC_BUFFERS
    int tries=5;
#endif

    err = mAllocMod->lock(mAllocMod, handle, usage,
            bounds.left, bounds.top, bounds.width(), bounds.height(),
            vaddr);
#ifdef MISSING_GRALLOC_BUFFERS
    while (err && tries) {
	usleep(1000);
        err = mAllocMod->unlock(mAllocMod, handle);
        err = mAllocMod->lock(mAllocMod, handle, usage,
            bounds.left, bounds.top, bounds.width(), bounds.height(),
            vaddr);
	tries--;
    }
#endif

    LOGW_IF(err, "lock(...) failed %d (%s)", err, strerror(-err));
    return err;
+2 −0
Original line number Diff line number Diff line
@@ -62,6 +62,7 @@ SoftwareRenderer::SoftwareRenderer(
    size_t bufWidth, bufHeight;

    switch (mColorFormat) {
#ifndef MISSING_EGL_PIXEL_FORMAT_YV12
        case OMX_COLOR_FormatYUV420Planar:
        case OMX_TI_COLOR_FormatYUV420PackedSemiPlanar:
        {
@@ -70,6 +71,7 @@ SoftwareRenderer::SoftwareRenderer(
            bufHeight = (mCropHeight + 1) & ~1;
            break;
        }
#endif

        default:
            halFormat = HAL_PIXEL_FORMAT_RGB_565;
+4 −0
Original line number Diff line number Diff line
@@ -213,7 +213,11 @@ typedef void* GLeglImageOES;

/* GL_OES_EGL_image_external */
#ifndef GL_OES_EGL_image_external
#ifdef MISSING_EGL_EXTERNAL_IMAGE
#define GL_TEXTURE_EXTERNAL_OES                                 0x0DE1
#else
#define GL_TEXTURE_EXTERNAL_OES                                 0x8D65
#endif
#define GL_SAMPLER_EXTERNAL_OES                                 0x8D66
#define GL_TEXTURE_BINDING_EXTERNAL_OES                         0x8D67
#define GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES                     0x8D68
+4 −0
Original line number Diff line number Diff line
@@ -148,7 +148,11 @@ typedef void* GLeglImageOES;

/* GL_OES_EGL_image_external */
#ifndef GL_OES_EGL_image_external
#ifdef MISSING_EGL_EXTERNAL_IMAGE
#define GL_TEXTURE_EXTERNAL_OES                                 0x0DE1
#else
#define GL_TEXTURE_EXTERNAL_OES                                 0x8D65
#endif
#define GL_SAMPLER_EXTERNAL_OES                                 0x8D66
#define GL_TEXTURE_BINDING_EXTERNAL_OES                         0x8D67
#define GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES                     0x8D68
Loading