gralloc: Return aligned w,h for UPDATE_BUFFER_GEOMETRY
Return aligned width and height in case meta operation is
UPDATE_BUFFER_GEOMETRY.
CRs-Fixed: 880373
Change-Id: I3b263518d509f4de68c93692eace3cb0b2c69808
diff --git a/libgralloc/alloc_controller.cpp b/libgralloc/alloc_controller.cpp
index a7e00c5..0070fa1 100644
--- a/libgralloc/alloc_controller.cpp
+++ b/libgralloc/alloc_controller.cpp
@@ -149,6 +149,26 @@
return 0;
}
+void AdrenoMemInfo::getAlignedWidthAndHeight(const private_handle_t *hnd, int& aligned_w,
+ int& aligned_h) {
+ MetaData_t *metadata = (MetaData_t *)hnd->base_metadata;
+ if(metadata && metadata->operation & UPDATE_BUFFER_GEOMETRY) {
+ int w = metadata->bufferDim.sliceWidth;
+ int h = metadata->bufferDim.sliceHeight;
+ int f = hnd->format;
+ int usage = 0;
+
+ if (hnd->flags & private_handle_t::PRIV_FLAGS_UBWC_ALIGNED) {
+ usage = GRALLOC_USAGE_PRIVATE_ALLOC_UBWC;
+ }
+
+ getAlignedWidthAndHeight(w, h, f, usage, aligned_w, aligned_h);
+ } else {
+ aligned_w = hnd->width;
+ aligned_h = hnd->height;
+ }
+
+}
void AdrenoMemInfo::getAlignedWidthAndHeight(int width, int height, int format,
int usage, int& aligned_w, int& aligned_h)
@@ -158,8 +178,7 @@
// Currently surface padding is only computed for RGB* surfaces.
if (format <= HAL_PIXEL_FORMAT_BGRA_8888) {
int tileEnabled = ubwc_enabled || isMacroTileEnabled(format, usage);
- AdrenoMemInfo::getInstance().getGpuAlignedWidthHeight(width,
- height, format, tileEnabled, aligned_w, aligned_h);
+ getGpuAlignedWidthHeight(width, height, format, tileEnabled, aligned_w, aligned_h);
return;
}
@@ -649,6 +668,7 @@
int width = hnd->width;
int height = hnd->height;
int format = hnd->format;
+
unsigned int ystride, cstride;
unsigned int alignment = 4096;
@@ -662,8 +682,14 @@
// Check metadata if the geometry has been updated.
if(metadata && metadata->operation & UPDATE_BUFFER_GEOMETRY) {
+ int usage = 0;
+
+ if (hnd->flags & private_handle_t::PRIV_FLAGS_UBWC_ALIGNED) {
+ usage = GRALLOC_USAGE_PRIVATE_ALLOC_UBWC;
+ }
+
AdrenoMemInfo::getInstance().getAlignedWidthAndHeight(metadata->bufferDim.sliceWidth,
- metadata->bufferDim.sliceHeight, format, 0, width, height);
+ metadata->bufferDim.sliceHeight, format, usage, width, height);
}
// Get the chroma offsets from the handle width/height. We take advantage