libqcomui: add function to find if GPU supports a format in hardware

This is a helper function that will return false if the given format is
supported by adreno drivers but not supported in GPU HW. For these
formats, adreno will use software color conversion routines to convert
them to acceptable format by the GPU HW. This may be required if we
want to avoid creating texture for certain formats when not absolutely
necessary. Could be defaulted to return true depending on a compile
time flag.

Change-Id: Idb2200b5ed13bb8c184288d44340ed1aefeaa8df
This commit is contained in:
Harshad Bhutada 2012-02-03 20:19:50 +05:30 committed by Andrew Sutherland
parent 5b5bd2418b
commit 23f2ec2103
3 changed files with 44 additions and 0 deletions

View File

@ -4,6 +4,10 @@ include $(CLEAR_VARS)
LOCAL_SRC_FILES := \
qcom_ui.cpp
ifeq ($(call is-board-platform,msm7x27a),true)
LOCAL_CFLAGS += -DCHECK_FOR_EXTERNAL_FORMAT
endif
LOCAL_SHARED_LIBRARIES := \
libutils \
libcutils \

View File

@ -144,6 +144,35 @@ bool isGPUSupportedFormat(int format) {
return true;
}
/*
* Checks if the format is natively supported by the GPU.
* For now, we use this function to check only if CHECK_FOR_EXTERNAL_FORMAT
* is set.
*
* @param: format to check
*
* @return true if the format is supported by the GPU.
*/
bool isGPUSupportedFormatInHW(int format) {
// For 7x27A bypass creating EGL image for formats not natively supported
// in GPU.
// This is done to save CPU utilization by SurfaceFlinger thread
#ifdef CHECK_FOR_EXTERNAL_FORMAT
if (format == HAL_PIXEL_FORMAT_YV12){
return false;
} else if (format == HAL_PIXEL_FORMAT_YCrCb_420_SP) {
return false;
} else if (format == HAL_PIXEL_FORMAT_YCbCr_420_SP) {
return false;
} else if (format == HAL_PIXEL_FORMAT_NV12_ENCODEABLE) {
return false;
}
#endif
return true;
}
/*
* Function to check if the allocated buffer is of the correct size.
* Reallocate the buffer with the correct size, if the size doesn't

View File

@ -123,6 +123,17 @@ int checkBuffer(native_handle_t *buffer_handle, int size, int usage);
*/
bool isGPUSupportedFormat(int format);
/*
* Checks if the format is natively supported by the GPU.
* For now, we use this function to check only if CHECK_FOR_EXTERNAL_FORMAT
* is set.
*
* @param: format to check
*
* @return true if the format is supported by the GPU.
*/
bool isGPUSupportedFormatInHW(int format);
/*
* Gets the number of arguments required for this operation.
*