Merge "hwc2: Fix ubwc flags for fb target"

This commit is contained in:
Linux Build Service Account
2017-08-04 17:37:30 -07:00
committed by Gerrit - the friendly Code Review server
4 changed files with 9 additions and 11 deletions

View File

@@ -49,13 +49,6 @@ BufferManager::BufferManager() : next_id_(0) {
map_fb_mem_ = true;
}
// Enable UBWC for framebuffer
if ((property_get("debug.gralloc.enable_fb_ubwc", property, NULL) > 0) &&
(!strncmp(property, "1", PROPERTY_VALUE_MAX) ||
(!strncasecmp(property, "true", PROPERTY_VALUE_MAX)))) {
ubwc_for_fb_ = true;
}
handles_map_.clear();
allocator_ = new Allocator();
allocator_->Init();

View File

@@ -118,7 +118,6 @@ class BufferManager {
std::shared_ptr<Buffer> GetBufferFromHandleLocked(const private_handle_t *hnd);
bool map_fb_mem_ = false;
bool ubwc_for_fb_ = false;
Allocator *allocator_ = NULL;
std::mutex buffer_lock_;
std::mutex descriptor_lock_;

View File

@@ -153,6 +153,9 @@ void HWCBufferAllocator::GetAlignedWidthAndHeight(int width, int height, int for
if (alloc_type & GRALLOC_USAGE_HW_FB) {
consumer_usage = GRALLOC1_CONSUMER_USAGE_CLIENT_TARGET;
}
if (alloc_type & GRALLOC_USAGE_PRIVATE_ALLOC_UBWC) {
producer_usage = GRALLOC_USAGE_PRIVATE_ALLOC_UBWC;
}
Perform_(gralloc_device_, GRALLOC_MODULE_PERFORM_GET_ATTRIBUTES, width, height, format,
producer_usage, consumer_usage, aligned_width, aligned_height, &tile_enabled);

View File

@@ -1483,10 +1483,13 @@ int HWCDisplay::SetFrameBufferResolution(uint32_t x_pixels, uint32_t y_pixels) {
int aligned_height;
uint32_t usage = GRALLOC_USAGE_HW_FB;
int format = HAL_PIXEL_FORMAT_RGBA_8888;
int ubwc_enabled = 0;
int ubwc_disabled = 0;
int flags = 0;
HWCDebugHandler::Get()->GetProperty("debug.gralloc.enable_fb_ubwc", &ubwc_enabled);
if (ubwc_enabled == 1) {
// By default UBWC is enabled and below property is global enable/disable for all
// buffers allocated through gralloc , including framebuffer targets.
HWCDebugHandler::Get()->GetProperty("debug.gralloc.gfx_ubwc_disable", &ubwc_disabled);
if (!ubwc_disabled) {
usage |= GRALLOC_USAGE_PRIVATE_ALLOC_UBWC;
flags |= private_handle_t::PRIV_FLAGS_UBWC_ALIGNED;
}