libqcomui: Select texture target based on pixel format

Do not choose GL_EXTERNAL_TEXTURE_OES for all formats, instead,
select between GL_EXTERNAL_TEXTURE_OES, and GL_TEXTURE_2D based
on the pixel format.

This change is done to reduce composition times.

Change-Id: I17edd78cdfa051f88ed6bd4e585c7a9b0705aa3a
CRs-fixed: 328074
This commit is contained in:
Neti Ravi Kumar 2012-02-14 18:46:03 +05:30 committed by Andrew Sutherland
parent 23f2ec2103
commit 08e0b71c29
2 changed files with 47 additions and 0 deletions

View File

@ -37,6 +37,10 @@
#include <cutils/properties.h>
#include <EGL/eglext.h>
#include <EGL/egl.h>
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
using gralloc::IMemAlloc;
using gralloc::IonController;
using gralloc::alloc_data;
@ -144,6 +148,33 @@ bool isGPUSupportedFormat(int format) {
return true;
}
/* decide the texture target dynamically, based on the pixel format*/
int decideTextureTarget(int pixel_format)
{
// Default the return value to GL_TEXTURE_EXTERAL_OES
int retVal = GL_TEXTURE_EXTERNAL_OES;
// Change texture target to TEXTURE_2D for RGB formats
switch (pixel_format) {
case HAL_PIXEL_FORMAT_RGBA_8888:
case HAL_PIXEL_FORMAT_RGBX_8888:
case HAL_PIXEL_FORMAT_RGB_888:
case HAL_PIXEL_FORMAT_RGB_565:
case HAL_PIXEL_FORMAT_BGRA_8888:
case HAL_PIXEL_FORMAT_RGBA_5551:
case HAL_PIXEL_FORMAT_RGBA_4444:
retVal = GL_TEXTURE_2D;
break;
default:
retVal = GL_TEXTURE_EXTERNAL_OES;
break;
}
return retVal;
}
/*
* Checks if the format is natively supported by the GPU.
* For now, we use this function to check only if CHECK_FOR_EXTERNAL_FORMAT

View File

@ -134,6 +134,22 @@ bool isGPUSupportedFormat(int format);
*/
bool isGPUSupportedFormatInHW(int format);
/*
* Adreno is not optimized for GL_TEXTURE_EXTERNAL_OES
* texure target. DO NOT choose TEXTURE_EXTERNAL_OES
* target for RGB formats.
*
* Based on the pixel format, decide the texture target.
*
* @param : pixel format to check
*
* @return : GL_TEXTURE_2D for RGB formats, and
* GL_TEXTURE_EXTERNAL_OES for YUV formats.
*
*/
int decideTextureTarget (const int pixel_format);
/*
* Gets the number of arguments required for this operation.
*