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

Commit f507ac2c authored by Steve Kondik's avatar Steve Kondik Committed by Gerrit Code Review
Browse files

Merge "opengl/libs/EGL: Bring back eglRenderBufferANDROID extention" into ics

parents 40d3e503 78c1d400
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -229,6 +229,20 @@ struct ANativeWindowBuffer;
#define EGL_NATIVE_BUFFER_ANDROID               0x3140  /* eglCreateImageKHR target */
#endif

#ifdef QCOM_HARDWARE
#ifndef EGL_EGLEXT_PROTOTYPES
#define EGL_EGLEXT_PROTOTYPES 1
#endif

#ifndef EGL_ANDROID_get_render_buffer
#define EGL_ANDROID_get_render_buffer 1
#ifdef EGL_EGLEXT_PROTOTYPES
EGLAPI EGLClientBuffer EGLAPIENTRY eglGetRenderBufferANDROID(EGLDisplay dpy, EGLSurface draw);
#endif
typedef EGLClientBuffer (EGLAPIENTRYP PFNEGLGETRENDERBUFFERANDROIDPROC) (EGLDisplay dpy, EGLSurface draw);
#endif
#endif // QCOM_HARDWARE

#ifndef EGL_ANDROID_recordable
#define EGL_ANDROID_recordable 1
#define EGL_RECORDABLE_ANDROID                  0x3142  /* EGLConfig attribute */
+3 −0
Original line number Diff line number Diff line
@@ -47,6 +47,9 @@ endif
ifeq ($(TARGET_HAVE_TEGRA_ERRATA_657451),true)
    LOCAL_CFLAGS += -DHAVE_TEGRA_ERRATA_657451
endif
ifeq ($(BOARD_USES_QCOM_HARDWARE),true)
    LOCAL_CFLAGS += -DQCOM_HARDWARE
endif
LOCAL_C_INCLUDES += bionic/libc/private

LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/egl
+42 −0
Original line number Diff line number Diff line
@@ -165,6 +165,9 @@ struct egl_surface_t
    virtual     EGLint      getSwapBehavior() const;
    virtual     EGLBoolean  swapBuffers();
    virtual     EGLBoolean  setSwapRectangle(EGLint l, EGLint t, EGLint w, EGLint h);
#ifdef QCOM_HARDWARE
    virtual     EGLClientBuffer getRenderBuffer() const;
#endif
protected:
    GGLSurface              depth;
};
@@ -208,6 +211,11 @@ EGLBoolean egl_surface_t::setSwapRectangle(
{
    return EGL_FALSE;
}
#ifdef QCOM_HARDWARE
EGLClientBuffer egl_surface_t::getRenderBuffer() const {
    return 0;
}
#endif

// ----------------------------------------------------------------------------

@@ -233,6 +241,9 @@ struct egl_window_surface_v2_t : public egl_surface_t
    virtual     EGLint      getRefreshRate() const;
    virtual     EGLint      getSwapBehavior() const;
    virtual     EGLBoolean  setSwapRectangle(EGLint l, EGLint t, EGLint w, EGLint h);
#ifdef QCOM_HARDWARE
    virtual     EGLClientBuffer  getRenderBuffer() const;
#endif
    
private:
    status_t lock(ANativeWindowBuffer* buf, int usage, void** vaddr);
@@ -571,6 +582,13 @@ EGLBoolean egl_window_surface_v2_t::setSwapRectangle(
    return EGL_TRUE;
}

#ifdef QCOM_HARDWARE
EGLClientBuffer egl_window_surface_v2_t::getRenderBuffer() const
{
    return buffer;
}
#endif

EGLBoolean egl_window_surface_v2_t::bindDrawSurface(ogles_context_t* gl)
{
    GGLSurface buffer;
@@ -800,6 +818,9 @@ static char const * const gExtensionsString =
        // "KHR_image_pixmap "
        "EGL_ANDROID_image_native_buffer "
        "EGL_ANDROID_swap_rectangle "
#ifdef QCOM_HARDWARE
        "EGL_ANDROID_get_render_buffer "
#endif
        ;

// ----------------------------------------------------------------------------
@@ -852,6 +873,10 @@ static const extention_map_t gExtentionMap[] = {
            (__eglMustCastToProperFunctionPointerType)&eglDestroyImageKHR }, 
    { "eglSetSwapRectangleANDROID", 
            (__eglMustCastToProperFunctionPointerType)&eglSetSwapRectangleANDROID }, 
#ifdef QCOM_HARDWARE
    { "eglGetRenderBufferANDROID",
            (__eglMustCastToProperFunctionPointerType)&eglGetRenderBufferANDROID },
#endif
};

/*
@@ -2077,3 +2102,20 @@ EGLBoolean eglSetSwapRectangleANDROID(EGLDisplay dpy, EGLSurface draw,

    return EGL_TRUE;
}

#ifdef QCOM_HARDWARE
EGLClientBuffer eglGetRenderBufferANDROID(EGLDisplay dpy, EGLSurface draw)
{
    if (egl_display_t::is_valid(dpy) == EGL_FALSE)
        return setError(EGL_BAD_DISPLAY, (EGLClientBuffer)0);

    egl_surface_t* d = static_cast<egl_surface_t*>(draw);
    if (!d->isValid())
        return setError(EGL_BAD_SURFACE, (EGLClientBuffer)0);
    if (d->dpy != dpy)
        return setError(EGL_BAD_DISPLAY, (EGLClientBuffer)0);

    // post the surface
    return d->getRenderBuffer();
}
#endif
+4 −0
Original line number Diff line number Diff line
@@ -58,6 +58,10 @@ ifneq ($(MAX_EGL_CACHE_SIZE),)
  LOCAL_CFLAGS += -DMAX_EGL_CACHE_SIZE=$(MAX_EGL_CACHE_SIZE)
endif

ifeq ($(BOARD_USES_QCOM_HARDWARE),true)
    LOCAL_CFLAGS += -DQCOM_HARDWARE
endif

include $(BUILD_SHARED_LIBRARY)
installed_libEGL := $(LOCAL_INSTALLED_MODULE)

+24 −0
Original line number Diff line number Diff line
@@ -69,6 +69,10 @@ static const extention_map_t sExtentionMap[] = {
            (__eglMustCastToProperFunctionPointerType)&eglGetSystemTimeFrequencyNV },
    { "eglGetSystemTimeNV",
            (__eglMustCastToProperFunctionPointerType)&eglGetSystemTimeNV },
#ifdef QCOM_HARDWARE
    { "eglGetRenderBufferANDROID",
            (__eglMustCastToProperFunctionPointerType)&eglGetRenderBufferANDROID },
#endif
};

// accesses protected by sExtensionMapMutex
@@ -1444,6 +1448,26 @@ EGLBoolean eglGetSyncAttribKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute

/* ANDROID extensions entry-point go here */

#ifdef QCOM_HARDWARE
EGLClientBuffer eglGetRenderBufferANDROID(EGLDisplay dpy, EGLSurface draw)
{
    clearError();

    egl_display_t const * const dp = validate_display(dpy);
    if (!dp) return EGL_FALSE;

    SurfaceRef _s(dp, draw);
    if (!_s.get()) return setError(EGL_BAD_SURFACE, (EGLClientBuffer*)0);

    egl_surface_t const * const s = get_surface(draw);
    if (s->cnx->egl.eglGetRenderBufferANDROID) {
        return s->cnx->egl.eglGetRenderBufferANDROID(
                dp->disp[s->impl].dpy, s->surface);
    }
    return setError(EGL_BAD_DISPLAY, (EGLClientBuffer*)0);
}
#endif

// ----------------------------------------------------------------------------
// NVIDIA extensions
// ----------------------------------------------------------------------------
Loading