summaryrefslogtreecommitdiff
path: root/libc2dcolorconvert
diff options
context:
space:
mode:
authorKarthikeyan Periasamy <kperiasa@codeaurora.org>2017-10-13 17:22:08 -0700
committerKarthikeyan Periasamy <kperiasa@codeaurora.org>2017-10-23 17:17:50 -0700
commit683d319f32c9e41e8d91a30227d5e5b82e692766 (patch)
tree3237ead0fe0f3850807388111866d63ae47f6fe8 /libc2dcolorconvert
parent74569c8caf71a3260569703b37c51c79fcd2923c (diff)
downloadmedia-683d319f32c9e41e8d91a30227d5e5b82e692766.tar.gz
C2DCC: Fix wrong function pointer
C2DCC pointer pointed to compute_aligned_width_and_height which is for older GPUs. For newer GPUs, this function returns 0. For our newer GPUs, we should use compute_fmt_aligned_width_and_height. CRs-Fixed: 2126754 Change-Id: I67f0806636a68c381ab3d07f3ea512fce0978385
Diffstat (limited to 'libc2dcolorconvert')
-rw-r--r--libc2dcolorconvert/C2DColorConverter.cpp20
-rw-r--r--libc2dcolorconvert/C2DColorConverter.h13
2 files changed, 23 insertions, 10 deletions
diff --git a/libc2dcolorconvert/C2DColorConverter.cpp b/libc2dcolorconvert/C2DColorConverter.cpp
index 99954994..258af91c 100644
--- a/libc2dcolorconvert/C2DColorConverter.cpp
+++ b/libc2dcolorconvert/C2DColorConverter.cpp
@@ -90,8 +90,8 @@ C2DColorConverter::C2DColorConverter()
return;
}
- mAdrenoComputeAlignedWidthAndHeight = (LINK_AdrenoComputeAlignedWidthAndHeight)dlsym(mAdrenoUtilsHandle, "compute_aligned_width_and_height");
- if (!mAdrenoComputeAlignedWidthAndHeight) {
+ mAdrenoComputeFmtAlignedWidthAndHeight = (LINK_adreno_compute_fmt_aligned_width_and_height)dlsym(mAdrenoUtilsHandle, "compute_fmt_aligned_width_and_height");
+ if (!mAdrenoComputeFmtAlignedWidthAndHeight) {
ALOGE("%s: dlsym compute_aligned_width_and_height ERROR. C2D is disabled.", __FUNCTION__);
enabled = false;
return;
@@ -566,15 +566,23 @@ size_t C2DColorConverter::calcSize(ColorConvertFormat format, size_t width, size
switch (format) {
case RGB565:
bpp = 2;
- mAdrenoComputeAlignedWidthAndHeight(width, height, bpp, tile_mode, raster_mode, padding_threshold,
- &alignedw, &alignedh);
+ mAdrenoComputeFmtAlignedWidthAndHeight(width, height,
+ 0, ADRENO_PIXELFORMAT_B5G6R5,
+ 1, tile_mode, raster_mode,
+ padding_threshold,
+ &alignedw, &alignedh);
+ ALOGV("%s: alignedw %d alignedh %d", __FUNCTION__,alignedw, alignedh);
size = alignedw * alignedh * bpp;
size = ALIGN(size, ALIGN4K);
break;
case RGBA8888:
bpp = 4;
- mAdrenoComputeAlignedWidthAndHeight(width, height, bpp, tile_mode, raster_mode, padding_threshold,
- &alignedw, &alignedh);
+ mAdrenoComputeFmtAlignedWidthAndHeight(width, height,
+ 0, ADRENO_PIXELFORMAT_R8G8B8A8 ,
+ 1, tile_mode, raster_mode,
+ padding_threshold,
+ &alignedw, &alignedh);
+ ALOGV("%s: alignedw %d alignedh %d", __FUNCTION__,alignedw, alignedh);
if (mSrcStride)
size = mSrcStride * alignedh * bpp;
else
diff --git a/libc2dcolorconvert/C2DColorConverter.h b/libc2dcolorconvert/C2DColorConverter.h
index e2b9467e..228bd351 100644
--- a/libc2dcolorconvert/C2DColorConverter.h
+++ b/libc2dcolorconvert/C2DColorConverter.h
@@ -55,6 +55,9 @@
#define ALIGN32 32
#define ALIGN16 16
+#define ADRENO_PIXELFORMAT_R8G8B8A8 28
+#define ADRENO_PIXELFORMAT_B5G6R5 85
+
typedef C2D_STATUS (*LINK_c2dCreateSurface)( uint32 *surface_id,
uint32 surface_bits,
C2D_SURFACE_TYPE surface_type,
@@ -87,9 +90,11 @@ typedef C2D_STATUS (*LINK_c2dMapAddr)( int mem_fd, void * hostptr, uint32 len, u
typedef C2D_STATUS (*LINK_c2dUnMapAddr)(void * gpuaddr);
-typedef void (*LINK_AdrenoComputeAlignedWidthAndHeight) (int width, int height, int bpp, int tile_mode, int raster_mode,
- int padding_threshold, int *aligned_width, int * aligned_height);
-
+typedef void (*LINK_adreno_compute_fmt_aligned_width_and_height)(int width, int height, int plane_id,
+ int format, int num_samples,
+ int tile_mode, int raster_mode,
+ int padding_threshold, int *aligned_w,
+ int *aligned_h);
/*TODO: THIS NEEDS TO ENABLED FOR JB PLUS*/
enum ColorConvertFormat {
RGB565 = 1,
@@ -144,7 +149,7 @@ class C2DColorConverter{
LINK_c2dUnMapAddr mC2DUnMapAddr;
void *mAdrenoUtilsHandle;
- LINK_AdrenoComputeAlignedWidthAndHeight mAdrenoComputeAlignedWidthAndHeight;
+ LINK_adreno_compute_fmt_aligned_width_and_height mAdrenoComputeFmtAlignedWidthAndHeight;
uint32_t mSrcSurface, mDstSurface;
void * mSrcSurfaceDef;