libgralloc: Invoke adreno for ASTC format padding.
Invoke adreno util API to calculate padding bytes for ASTC formats. Change-Id: I96af0199a0029786fd2975a7c002d5414c797521
This commit is contained in:
committed by
Gerrit - the friendly Code Review server
parent
29ff05dd05
commit
2ba20513e4
@@ -47,7 +47,6 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define ASTC_BLOCK_SIZE 16
|
#define ASTC_BLOCK_SIZE 16
|
||||||
#define ASTC_IN_UNITS(n, unit_size) (((n) + (unit_size) -1) / (unit_size))
|
|
||||||
|
|
||||||
using namespace gralloc;
|
using namespace gralloc;
|
||||||
using namespace qdutils;
|
using namespace qdutils;
|
||||||
@@ -93,6 +92,7 @@ AdrenoMemInfo::AdrenoMemInfo()
|
|||||||
LINK_adreno_compute_aligned_width_and_height = NULL;
|
LINK_adreno_compute_aligned_width_and_height = NULL;
|
||||||
LINK_adreno_compute_padding = NULL;
|
LINK_adreno_compute_padding = NULL;
|
||||||
LINK_adreno_isMacroTilingSupportedByGpu = NULL;
|
LINK_adreno_isMacroTilingSupportedByGpu = NULL;
|
||||||
|
LINK_adreno_compute_compressedfmt_aligned_width_and_height = NULL;
|
||||||
|
|
||||||
libadreno_utils = ::dlopen("libadreno_utils.so", RTLD_NOW);
|
libadreno_utils = ::dlopen("libadreno_utils.so", RTLD_NOW);
|
||||||
if (libadreno_utils) {
|
if (libadreno_utils) {
|
||||||
@@ -102,6 +102,9 @@ AdrenoMemInfo::AdrenoMemInfo()
|
|||||||
::dlsym(libadreno_utils, "compute_surface_padding");
|
::dlsym(libadreno_utils, "compute_surface_padding");
|
||||||
*(void **)&LINK_adreno_isMacroTilingSupportedByGpu =
|
*(void **)&LINK_adreno_isMacroTilingSupportedByGpu =
|
||||||
::dlsym(libadreno_utils, "isMacroTilingSupportedByGpu");
|
::dlsym(libadreno_utils, "isMacroTilingSupportedByGpu");
|
||||||
|
*(void **)&LINK_adreno_compute_compressedfmt_aligned_width_and_height =
|
||||||
|
::dlsym(libadreno_utils,
|
||||||
|
"compute_compressedfmt_aligned_width_and_height");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -207,73 +210,47 @@ void AdrenoMemInfo::getAlignedWidthAndHeight(int width, int height, int format,
|
|||||||
break;
|
break;
|
||||||
case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_4x4_KHR:
|
case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_4x4_KHR:
|
||||||
case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:
|
case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:
|
||||||
aligned_w = ASTC_IN_UNITS(width, 4);
|
|
||||||
aligned_h = ASTC_IN_UNITS(height, 4);
|
|
||||||
break;
|
|
||||||
case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_5x4_KHR:
|
case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_5x4_KHR:
|
||||||
case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:
|
case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:
|
||||||
aligned_w = ASTC_IN_UNITS(width, 5);
|
|
||||||
aligned_h = ASTC_IN_UNITS(height, 4);
|
|
||||||
break;
|
|
||||||
case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_5x5_KHR:
|
case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_5x5_KHR:
|
||||||
case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:
|
case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:
|
||||||
aligned_w = ASTC_IN_UNITS(width, 5);
|
|
||||||
aligned_h = ASTC_IN_UNITS(height, 5);
|
|
||||||
break;
|
|
||||||
case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_6x5_KHR:
|
case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_6x5_KHR:
|
||||||
case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:
|
case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:
|
||||||
aligned_w = ASTC_IN_UNITS(width, 6);
|
|
||||||
aligned_h = ASTC_IN_UNITS(height, 5);
|
|
||||||
break;
|
|
||||||
case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_6x6_KHR:
|
case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_6x6_KHR:
|
||||||
case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:
|
case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:
|
||||||
aligned_w = ASTC_IN_UNITS(width, 6);
|
|
||||||
aligned_h = ASTC_IN_UNITS(height, 6);
|
|
||||||
break;
|
|
||||||
case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_8x5_KHR:
|
case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_8x5_KHR:
|
||||||
case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:
|
case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:
|
||||||
aligned_w = ASTC_IN_UNITS(width, 8);
|
|
||||||
aligned_h = ASTC_IN_UNITS(height, 5);
|
|
||||||
break;
|
|
||||||
case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_8x6_KHR:
|
case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_8x6_KHR:
|
||||||
case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:
|
case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:
|
||||||
aligned_w = ASTC_IN_UNITS(width, 8);
|
|
||||||
aligned_h = ASTC_IN_UNITS(height, 6);
|
|
||||||
break;
|
|
||||||
case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_8x8_KHR:
|
case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_8x8_KHR:
|
||||||
case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:
|
case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:
|
||||||
aligned_w = ASTC_IN_UNITS(width, 8);
|
|
||||||
aligned_h = ASTC_IN_UNITS(height, 8);
|
|
||||||
break;
|
|
||||||
case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_10x5_KHR:
|
case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_10x5_KHR:
|
||||||
case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:
|
case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:
|
||||||
aligned_w = ASTC_IN_UNITS(width, 10);
|
|
||||||
aligned_h = ASTC_IN_UNITS(height, 5);
|
|
||||||
break;
|
|
||||||
case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_10x6_KHR:
|
case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_10x6_KHR:
|
||||||
case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:
|
case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:
|
||||||
aligned_w = ASTC_IN_UNITS(width, 10);
|
|
||||||
aligned_h = ASTC_IN_UNITS(height, 6);
|
|
||||||
break;
|
|
||||||
case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_10x8_KHR:
|
case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_10x8_KHR:
|
||||||
case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:
|
case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:
|
||||||
aligned_w = ASTC_IN_UNITS(width, 10);
|
|
||||||
aligned_h = ASTC_IN_UNITS(height, 8);
|
|
||||||
break;
|
|
||||||
case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_10x10_KHR:
|
case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_10x10_KHR:
|
||||||
case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:
|
case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:
|
||||||
aligned_w = ASTC_IN_UNITS(width, 10);
|
|
||||||
aligned_h = ASTC_IN_UNITS(height, 10);
|
|
||||||
break;
|
|
||||||
case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_12x10_KHR:
|
case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_12x10_KHR:
|
||||||
case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:
|
case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:
|
||||||
aligned_w = ASTC_IN_UNITS(width, 12);
|
|
||||||
aligned_h = ASTC_IN_UNITS(height, 10);
|
|
||||||
break;
|
|
||||||
case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_12x12_KHR:
|
case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_12x12_KHR:
|
||||||
case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:
|
case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:
|
||||||
aligned_w = ASTC_IN_UNITS(width, 12);
|
if(LINK_adreno_compute_compressedfmt_aligned_width_and_height) {
|
||||||
aligned_h = ASTC_IN_UNITS(height, 12);
|
int bytesPerPixel = 0;
|
||||||
|
int raster_mode = 0; //Adreno unknown raster mode.
|
||||||
|
int padding_threshold = 512; //Threshold for padding
|
||||||
|
//surfaces.
|
||||||
|
|
||||||
|
LINK_adreno_compute_compressedfmt_aligned_width_and_height(
|
||||||
|
width, height, format, 0,raster_mode, padding_threshold,
|
||||||
|
&aligned_w, &aligned_h, &bytesPerPixel);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
ALOGW("%s: Warning!! Symbols" \
|
||||||
|
" compute_compressedfmt_aligned_width_and_height" \
|
||||||
|
" not found", __FUNCTION__);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -120,12 +120,12 @@ class AdrenoMemInfo : public android::Singleton <AdrenoMemInfo>
|
|||||||
// Pointer to the padding library.
|
// Pointer to the padding library.
|
||||||
void *libadreno_utils;
|
void *libadreno_utils;
|
||||||
|
|
||||||
// link to the surface padding library.
|
// link(s)to adreno surface padding library.
|
||||||
int (*LINK_adreno_compute_padding) (int width, int bpp,
|
int (*LINK_adreno_compute_padding) (int width, int bpp,
|
||||||
int surface_tile_height,
|
int surface_tile_height,
|
||||||
int screen_tile_height,
|
int screen_tile_height,
|
||||||
int padding_threshold);
|
int padding_threshold);
|
||||||
// link to the surface padding library.
|
|
||||||
void (*LINK_adreno_compute_aligned_width_and_height) (int width,
|
void (*LINK_adreno_compute_aligned_width_and_height) (int width,
|
||||||
int height,
|
int height,
|
||||||
int bpp,
|
int bpp,
|
||||||
@@ -134,8 +134,18 @@ class AdrenoMemInfo : public android::Singleton <AdrenoMemInfo>
|
|||||||
int padding_threshold,
|
int padding_threshold,
|
||||||
int *aligned_w,
|
int *aligned_w,
|
||||||
int *aligned_h);
|
int *aligned_h);
|
||||||
// link to the surface padding library.
|
|
||||||
int (*LINK_adreno_isMacroTilingSupportedByGpu) (void);
|
int (*LINK_adreno_isMacroTilingSupportedByGpu) (void);
|
||||||
|
|
||||||
|
void(*LINK_adreno_compute_compressedfmt_aligned_width_and_height)(
|
||||||
|
int width,
|
||||||
|
int height,
|
||||||
|
int format,
|
||||||
|
int tile_mode,
|
||||||
|
int raster_mode,
|
||||||
|
int padding_threshold,
|
||||||
|
int *aligned_w,
|
||||||
|
int *aligned_h,
|
||||||
|
int *bpp);
|
||||||
};
|
};
|
||||||
#endif /* GR_H_ */
|
#endif /* GR_H_ */
|
||||||
|
|||||||
Reference in New Issue
Block a user