summaryrefslogtreecommitdiffstats
path: root/libgralloc/alloc_controller.cpp
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@localhost>2016-09-01 18:42:58 -0600
committerLinux Build Service Account <lnxbuild@localhost>2016-09-01 18:42:58 -0600
commit57aaa5e09827b47df67e08ec165173327a7e6ed8 (patch)
tree9322ba200099a7920bc2d97647489582b9877e10 /libgralloc/alloc_controller.cpp
parent9cc01011e580a2a55ebabd39c62e042f3f9d5dde (diff)
parentbee9c1acdd3a6910d5f4e57d39c4fe4d0ea9909d (diff)
downloadhardware_qcom_display-57aaa5e09827b47df67e08ec165173327a7e6ed8.tar.gz
hardware_qcom_display-57aaa5e09827b47df67e08ec165173327a7e6ed8.tar.bz2
hardware_qcom_display-57aaa5e09827b47df67e08ec165173327a7e6ed8.zip
Promotion of display.lnx.2.0-00048.
CRs Change ID Subject -------------------------------------------------------------------------------------------------------------- 1040942 I28d757af4178f581e6a83dc06198106c85fc7262 hwc: Store real buffer resolution in private handle. 1040942 Ic4c03cc5779418959732332d26b8ecb59c2483b5 sdm: Add rect mapping and interface to store actual reso Change-Id: I96c075e51d992f1db521b2f8649913c152439798 CRs-Fixed: 1040942
Diffstat (limited to 'libgralloc/alloc_controller.cpp')
-rw-r--r--libgralloc/alloc_controller.cpp46
1 files changed, 36 insertions, 10 deletions
diff --git a/libgralloc/alloc_controller.cpp b/libgralloc/alloc_controller.cpp
index 39acf6624..4ca4e2d55 100644
--- a/libgralloc/alloc_controller.cpp
+++ b/libgralloc/alloc_controller.cpp
@@ -173,6 +173,17 @@ void AdrenoMemInfo::getAlignedWidthAndHeight(const private_handle_t *hnd, int& a
}
+void AdrenoMemInfo::getRealWidthAndHeight(const private_handle_t *hnd, int& real_w, int& real_h) {
+ MetaData_t *metadata = (MetaData_t *)hnd->base_metadata;
+ if(metadata && metadata->operation & UPDATE_BUFFER_GEOMETRY) {
+ real_w = metadata->bufferDim.sliceWidth;
+ real_h = metadata->bufferDim.sliceHeight;
+ } else {
+ real_w = hnd->real_width;
+ real_h = hnd->real_height;
+ }
+}
+
bool isUncompressedRgbFormat(int format)
{
bool is_rgb_format = false;
@@ -693,6 +704,16 @@ unsigned int getBufferSizeAndDimensions(int width, int height, int format,
return size;
}
+void getAlignedWidthAndHeight(int width, int height, int format,
+ int usage, int& alignedw, int &alignedh)
+{
+ AdrenoMemInfo::getInstance().getAlignedWidthAndHeight(width,
+ height,
+ format,
+ usage,
+ alignedw,
+ alignedh);
+}
void getBufferAttributes(int width, int height, int format, int usage,
int& alignedw, int &alignedh, int& tiled, unsigned int& size)
@@ -714,6 +735,8 @@ int getYUVPlaneInfo(private_handle_t* hnd, struct android_ycbcr* ycbcr)
int width = hnd->width;
int height = hnd->height;
int format = hnd->format;
+ int real_width = hnd->real_width;
+ int real_height = hnd->real_height;
unsigned int ystride, cstride;
unsigned int alignment = 4096;
@@ -734,8 +757,11 @@ int getYUVPlaneInfo(private_handle_t* hnd, struct android_ycbcr* ycbcr)
usage = GRALLOC_USAGE_PRIVATE_ALLOC_UBWC;
}
- AdrenoMemInfo::getInstance().getAlignedWidthAndHeight(metadata->bufferDim.sliceWidth,
- metadata->bufferDim.sliceHeight, format, usage, width, height);
+ real_width = metadata->bufferDim.sliceWidth;
+ real_height = metadata->bufferDim.sliceHeight;
+
+ AdrenoMemInfo::getInstance().getAlignedWidthAndHeight(real_width, real_height,
+ format, usage, width, height);
}
// Get the chroma offsets from the handle width/height. We take advantage
@@ -762,16 +788,16 @@ int getYUVPlaneInfo(private_handle_t* hnd, struct android_ycbcr* ycbcr)
unsigned int y_stride, y_height, y_size;
unsigned int c_meta_stride, c_meta_height, c_meta_size;
- y_meta_stride = VENUS_Y_META_STRIDE(COLOR_FMT_NV12_UBWC, width);
- y_meta_height = VENUS_Y_META_SCANLINES(COLOR_FMT_NV12_UBWC, height);
+ y_meta_stride = VENUS_Y_META_STRIDE(COLOR_FMT_NV12_UBWC, real_width);
+ y_meta_height = VENUS_Y_META_SCANLINES(COLOR_FMT_NV12_UBWC, real_height);
y_meta_size = ALIGN((y_meta_stride * y_meta_height), alignment);
- y_stride = VENUS_Y_STRIDE(COLOR_FMT_NV12_UBWC, width);
- y_height = VENUS_Y_SCANLINES(COLOR_FMT_NV12_UBWC, height);
+ y_stride = VENUS_Y_STRIDE(COLOR_FMT_NV12_UBWC, real_width);
+ y_height = VENUS_Y_SCANLINES(COLOR_FMT_NV12_UBWC, real_height);
y_size = ALIGN((y_stride * y_height), alignment);
- c_meta_stride = VENUS_UV_META_STRIDE(COLOR_FMT_NV12_UBWC, width);
- c_meta_height = VENUS_UV_META_SCANLINES(COLOR_FMT_NV12_UBWC, height);
+ c_meta_stride = VENUS_UV_META_STRIDE(COLOR_FMT_NV12_UBWC, real_width);
+ c_meta_height = VENUS_UV_META_SCANLINES(COLOR_FMT_NV12_UBWC, real_height);
c_meta_size = ALIGN((c_meta_stride * c_meta_height), alignment);
ycbcr->y = (void*)(hnd->base + y_meta_size);
@@ -779,7 +805,7 @@ int getYUVPlaneInfo(private_handle_t* hnd, struct android_ycbcr* ycbcr)
ycbcr->cr = (void*)(hnd->base + y_meta_size + y_size +
c_meta_size + 1);
ycbcr->ystride = y_stride;
- ycbcr->cstride = VENUS_UV_STRIDE(COLOR_FMT_NV12_UBWC, width);
+ ycbcr->cstride = VENUS_UV_STRIDE(COLOR_FMT_NV12_UBWC, real_width);
ycbcr->chroma_step = 2;
break;
@@ -856,7 +882,7 @@ int alloc_buffer(private_handle_t **pHnd, int w, int h, int format, int usage)
private_handle_t* hnd = new private_handle_t(data.fd, data.size,
data.allocType, 0, format,
- alignedw, alignedh);
+ alignedw, alignedh, w, h);
hnd->base = (uint64_t) data.base;
hnd->offset = data.offset;
hnd->gpuaddr = 0;