display : Avoid calling eglGetRenderBufferANDROID for each layer
Currently eglGetRenderBufferANDROID is being called for each layer which is not needed. This change calls this API once in set call, and passes the 'render buffer' to drawLayerUsingCopybit. Change-Id: I310163db02df13e8c03b51d73f291588fbf08160
This commit is contained in:
parent
7b060c9cab
commit
857f8a5f0b
@ -213,13 +213,15 @@ bool CopyBit::draw(hwc_context_t *ctx, hwc_layer_list_t *list, EGLDisplay dpy,
|
||||
EGLSurface sur){
|
||||
// draw layers marked for COPYBIT
|
||||
int retVal = true;
|
||||
EGLSurface eglSurface = LINK_eglGetCurrentSurface(EGL_DRAW);
|
||||
android_native_buffer_t *renderBuffer =
|
||||
(android_native_buffer_t *)LINK_eglGetRenderBufferANDROID(dpy, eglSurface);
|
||||
for (size_t i=0; i<list->numHwLayers; i++) {
|
||||
if (list->hwLayers[i].compositionType == HWC_USE_COPYBIT) {
|
||||
retVal = drawLayerUsingCopybit(ctx, &(list->hwLayers[i]),
|
||||
(EGLDisplay)dpy,
|
||||
(EGLSurface)sur,
|
||||
LINK_eglGetRenderBufferANDROID,
|
||||
LINK_eglGetCurrentSurface);
|
||||
renderBuffer);
|
||||
if(retVal<0) {
|
||||
ALOGE("%s : drawLayerUsingCopybit failed", __FUNCTION__);
|
||||
}
|
||||
@ -231,8 +233,7 @@ bool CopyBit::draw(hwc_context_t *ctx, hwc_layer_list_t *list, EGLDisplay dpy,
|
||||
int CopyBit::drawLayerUsingCopybit(hwc_context_t *dev, hwc_layer_t *layer,
|
||||
EGLDisplay dpy,
|
||||
EGLSurface surface,
|
||||
functype_eglGetRenderBufferANDROID& LINK_eglGetRenderBufferANDROID,
|
||||
functype_eglGetCurrentSurface LINK_eglGetCurrentSurface)
|
||||
android_native_buffer_t *renderBuffer)
|
||||
{
|
||||
hwc_context_t* ctx = (hwc_context_t*)(dev);
|
||||
if(!ctx) {
|
||||
@ -254,9 +255,6 @@ int CopyBit::drawLayerUsingCopybit(hwc_context_t *dev, hwc_layer_t *layer,
|
||||
return -1;
|
||||
}
|
||||
//render buffer
|
||||
EGLSurface eglSurface = LINK_eglGetCurrentSurface(EGL_DRAW);
|
||||
android_native_buffer_t *renderBuffer =
|
||||
(android_native_buffer_t *)LINK_eglGetRenderBufferANDROID(dpy, eglSurface);
|
||||
if (!renderBuffer) {
|
||||
ALOGE("%s: eglGetRenderBuffer returned NULL buffer", __FUNCTION__);
|
||||
genlock_unlock_buffer(hnd);
|
||||
|
@ -48,9 +48,8 @@ public:
|
||||
|
||||
static void updateEglHandles(void*);
|
||||
static int drawLayerUsingCopybit(hwc_context_t *dev, hwc_layer_t *layer,
|
||||
EGLDisplay dpy, EGLSurface surface,
|
||||
functype_eglGetRenderBufferANDROID& LINK_eglGetRenderBufferANDROID,
|
||||
functype_eglGetCurrentSurface LINK_eglGetCurrentSurface);
|
||||
EGLDisplay dpy, EGLSurface surface,
|
||||
android_native_buffer_t *renderBuffer);
|
||||
static bool canUseCopybitForYUV (hwc_context_t *ctx);
|
||||
static bool canUseCopybitForRGB (hwc_context_t *ctx,
|
||||
hwc_layer_list_t *list);
|
||||
|
Loading…
x
Reference in New Issue
Block a user