gralloc1: Use implementation defined format at allocate
Make sure allocate always uses implementation defined format for
all cases
Change-Id: Ifea89fb8d300364c49ce39eaf68be868b0a21278
diff --git a/libgralloc1/gr_buf_mgr.cpp b/libgralloc1/gr_buf_mgr.cpp
index 584737d..b79dffa 100644
--- a/libgralloc1/gr_buf_mgr.cpp
+++ b/libgralloc1/gr_buf_mgr.cpp
@@ -453,17 +453,15 @@
if (!handle)
return -EINVAL;
- int format = descriptor.GetFormat();
gralloc1_producer_usage_t prod_usage = descriptor.GetProducerUsage();
gralloc1_consumer_usage_t cons_usage = descriptor.GetConsumerUsage();
+ int format = allocator_->GetImplDefinedFormat(prod_usage, cons_usage, descriptor.GetFormat());
uint32_t layer_count = descriptor.GetLayerCount();
- // Get implementation defined format
- int gralloc_format = allocator_->GetImplDefinedFormat(prod_usage, cons_usage, format);
-
unsigned int size;
unsigned int alignedw, alignedh;
- int buffer_type = GetBufferType(gralloc_format);
+
+ int buffer_type = GetBufferType(format);
BufferInfo info = GetBufferInfo(descriptor);
GetBufferSizeAndDimensions(info, &size, &alignedw, &alignedh);
size = (bufferSize >= size) ? bufferSize : size;