sdm: fix null pointer dereference and vector initialization.
Change-Id: I25bb8daa6b49223a443a31d1ae17560ed6fca486 Signed-off-by: Pramodh Kumar Mukunda <pkmuku@codeaurora.org>
This commit is contained in:
committed by
Uday Kiran Pichika
parent
65788dca88
commit
927729d9ea
@@ -509,8 +509,10 @@ bool IsUBwcEnabled(int format, gralloc1_producer_usage_t prod_usage,
|
||||
// Query GPU for UBWC only if buffer is intended to be used by GPU.
|
||||
if ((cons_usage & GRALLOC1_CONSUMER_USAGE_GPU_TEXTURE) ||
|
||||
(prod_usage & GRALLOC1_PRODUCER_USAGE_GPU_RENDER_TARGET)) {
|
||||
if (AdrenoMemInfo::GetInstance()) {
|
||||
enable = AdrenoMemInfo::GetInstance()->IsUBWCSupportedByGPU(format);
|
||||
}
|
||||
}
|
||||
|
||||
// Allow UBWC, only if CPU usage flags are not set
|
||||
if (enable && !(CpuCanAccess(prod_usage, cons_usage))) {
|
||||
@@ -675,8 +677,10 @@ void GetAlignedWidthAndHeight(const BufferInfo &info, unsigned int *alignedw,
|
||||
int tile = ubwc_enabled;
|
||||
|
||||
if (IsUncompressedRGBFormat(format)) {
|
||||
if (AdrenoMemInfo::GetInstance()) {
|
||||
AdrenoMemInfo::GetInstance()->AlignUnCompressedRGB(width, height, format, tile, alignedw,
|
||||
alignedh);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -686,7 +690,9 @@ void GetAlignedWidthAndHeight(const BufferInfo &info, unsigned int *alignedw,
|
||||
}
|
||||
|
||||
if (IsCompressedRGBFormat(format)) {
|
||||
if (AdrenoMemInfo::GetInstance()) {
|
||||
AdrenoMemInfo::GetInstance()->AlignCompressedRGB(width, height, format, alignedw, alignedh);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -698,6 +704,9 @@ void GetAlignedWidthAndHeight(const BufferInfo &info, unsigned int *alignedw,
|
||||
switch (format) {
|
||||
case HAL_PIXEL_FORMAT_YCrCb_420_SP:
|
||||
case HAL_PIXEL_FORMAT_YCbCr_420_SP:
|
||||
if (AdrenoMemInfo::GetInstance() == nullptr) {
|
||||
return;
|
||||
}
|
||||
alignment = AdrenoMemInfo::GetInstance()->GetGpuPixelAlignment();
|
||||
aligned_w = ALIGN(width, alignment);
|
||||
break;
|
||||
|
||||
@@ -48,12 +48,14 @@ HWCBufferAllocator::HWCBufferAllocator() {
|
||||
} else {
|
||||
gralloc1_open(module_, &gralloc_device_);
|
||||
}
|
||||
if (gralloc_device_ != nullptr) {
|
||||
ReleaseBuffer_ = reinterpret_cast<GRALLOC1_PFN_RELEASE>(
|
||||
gralloc_device_->getFunction(gralloc_device_, GRALLOC1_FUNCTION_RELEASE));
|
||||
Perform_ = reinterpret_cast<GRALLOC1_PFN_PERFORM>(
|
||||
gralloc_device_->getFunction(gralloc_device_, GRALLOC1_FUNCTION_PERFORM));
|
||||
Lock_ = reinterpret_cast<GRALLOC1_PFN_LOCK>(
|
||||
gralloc_device_->getFunction(gralloc_device_, GRALLOC1_FUNCTION_LOCK));
|
||||
}
|
||||
}
|
||||
|
||||
HWCBufferAllocator::~HWCBufferAllocator() {
|
||||
|
||||
Reference in New Issue
Block a user