diff options
-rw-r--r-- | config/sdm845.mk | 10 | ||||
-rw-r--r-- | gralloc/gr_buf_mgr.cpp | 1 | ||||
-rw-r--r-- | gralloc/gr_utils.cpp | 7 | ||||
-rw-r--r-- | sdm/libs/core/drm/hw_device_drm.cpp | 9 | ||||
-rw-r--r-- | sdm/libs/core/drm/hw_device_drm.h | 1 | ||||
-rw-r--r-- | sdm/libs/hwc2/hwc_display.cpp | 34 | ||||
-rw-r--r-- | sdm/libs/hwc2/hwc_tonemapper.cpp | 1 |
7 files changed, 37 insertions, 26 deletions
diff --git a/config/sdm845.mk b/config/sdm845.mk index 2a7ac5b6..4284ecf1 100644 --- a/config/sdm845.mk +++ b/config/sdm845.mk @@ -35,9 +35,11 @@ PRODUCT_PROPERTY_OVERRIDES += \ persist.demo.hdmirotationlock=false \ ro.vendor.display.cabl=2 \ debug.sf.latch_unsignaled=1 \ - # This matrix should be in column major order, per SurfaceFlinger requirement - # 1.16868 -0.16868 0.00000 - # -0.03155 1.03155 0.00000 - # -0.01473 -0.05899 1.07372 + +# This matrix should be in column major order, per SurfaceFlinger requirement +# 1.16868 -0.16868 0.00000 +# -0.03155 1.03155 0.00000 +# -0.01473 -0.05899 1.07372 +PRODUCT_PROPERTY_OVERRIDES += \ vendor.display.dataspace_saturation_matrix=1.16868,-0.03155,-0.01473,-0.16868,1.03155,-0.05899,0.00000,0.00000,1.07372 diff --git a/gralloc/gr_buf_mgr.cpp b/gralloc/gr_buf_mgr.cpp index 0b6567da..e7c7f0f4 100644 --- a/gralloc/gr_buf_mgr.cpp +++ b/gralloc/gr_buf_mgr.cpp @@ -321,6 +321,7 @@ Error BufferManager::AllocateBuffer(const BufferDescriptor &descriptor, buffer_h int buffer_type = GetBufferType(format); BufferInfo info = GetBufferInfo(descriptor); info.format = format; + info.layer_count = layer_count; bool use_adreno_for_size = false; GraphicsMetadata graphics_metadata = {}; diff --git a/gralloc/gr_utils.cpp b/gralloc/gr_utils.cpp index 8d113a96..3525403e 100644 --- a/gralloc/gr_utils.cpp +++ b/gralloc/gr_utils.cpp @@ -967,9 +967,12 @@ void GetGpuResourceSizeAndDimensions(const BufferInfo &info, unsigned int *size, } // Call adreno api for populating metadata blob + // Layer count is for 2D/Cubemap arrays and depth is used for 3D slice + // Using depth to pass layer_count here int ret = adreno_mem_info->AdrenoInitMemoryLayout(graphics_metadata->data, info.width, - info.height, 1, info.format, 1, - is_ubwc_enabled, adreno_usage, 1); + info.height, info.layer_count, /* depth */ + info.format, 1, is_ubwc_enabled, + adreno_usage, 1); if (ret != 0) { ALOGE("%s Graphics metadata init failed", __FUNCTION__); *size = 0; diff --git a/sdm/libs/core/drm/hw_device_drm.cpp b/sdm/libs/core/drm/hw_device_drm.cpp index 1f5de169..aee7cae3 100644 --- a/sdm/libs/core/drm/hw_device_drm.cpp +++ b/sdm/libs/core/drm/hw_device_drm.cpp @@ -731,6 +731,7 @@ DisplayError HWDeviceDRM::SetDisplayAttributes(uint32_t index) { current_mode_index_ = index; PopulateHWPanelInfo(); UpdateMixerAttributes(); + update_mode_ = true; DLOGI("Display attributes[%d]: WxH: %dx%d, DPI: %fx%f, FPS: %d, LM_SPLIT: %d, V_BACK_PORCH: %d," \ " V_FRONT_PORCH: %d, V_PULSE_WIDTH: %d, V_TOTAL: %d, H_TOTAL: %d, CLK: %dKHZ, TOPOLOGY: %d", @@ -764,6 +765,7 @@ DisplayError HWDeviceDRM::PowerOn(int *release_fence) { return kErrorNone; } + update_mode_ = true; drm_atomic_intf_->Perform(DRMOps::CRTC_SET_ACTIVE, token_.crtc_id, 1); drm_atomic_intf_->Perform(DRMOps::CONNECTOR_SET_POWER_MODE, token_.conn_id, DRMPowerMode::ON); int ret = drm_atomic_intf_->Commit(true /* synchronous */, true /* retain_planes */); @@ -1002,7 +1004,11 @@ void HWDeviceDRM::SetupAtomic(HWLayers *hw_layers, bool validate) { drm_atomic_intf_->Perform(DRMOps::CONNECTOR_SET_POWER_MODE, token_.conn_id, DRMPowerMode::ON); } - drm_atomic_intf_->Perform(DRMOps::CRTC_SET_MODE, token_.crtc_id, ¤t_mode); + // Set CRTC mode, only if display config changes + if (vrefresh_ || first_cycle_ || update_mode_) { + drm_atomic_intf_->Perform(DRMOps::CRTC_SET_MODE, token_.crtc_id, ¤t_mode); + } + drm_atomic_intf_->Perform(DRMOps::CRTC_SET_ACTIVE, token_.crtc_id, 1); if (!validate && (hw_layer_info.set_idle_time_ms >= 0)) { @@ -1181,6 +1187,7 @@ DisplayError HWDeviceDRM::AtomicCommit(HWLayers *hw_layers) { } first_cycle_ = false; + update_mode_ = false; return kErrorNone; } diff --git a/sdm/libs/core/drm/hw_device_drm.h b/sdm/libs/core/drm/hw_device_drm.h index d8138f3f..9caa0955 100644 --- a/sdm/libs/core/drm/hw_device_drm.h +++ b/sdm/libs/core/drm/hw_device_drm.h @@ -191,6 +191,7 @@ class HWDeviceDRM : public HWInterface { bool resolution_switch_enabled_ = false; uint32_t vrefresh_ = 0; bool autorefresh_ = false; + bool update_mode_ = false; }; } // namespace sdm diff --git a/sdm/libs/hwc2/hwc_display.cpp b/sdm/libs/hwc2/hwc_display.cpp index 66a0d79a..8a337a09 100644 --- a/sdm/libs/hwc2/hwc_display.cpp +++ b/sdm/libs/hwc2/hwc_display.cpp @@ -111,6 +111,10 @@ HWC2::Error HWCColorMode::SetColorModeWithRenderIntent(ColorMode mode, RenderInt return HWC2::Error::Unsupported; } + if (current_color_mode_ == mode && current_render_intent_ == intent) { + return HWC2::Error::None; + } + auto mode_string = color_mode_map_[mode][intent]; DisplayError error = display_intf_->SetColorMode(mode_string); if (error != kErrorNone) { @@ -452,8 +456,6 @@ void HWCDisplay::BuildLayerStack() { uint32_t color_mode_count = 0; display_intf_->GetColorModeCount(&color_mode_count); - bool extended_range = false; - // Add one layer for fb target // TODO(user): Add blit target layers for (auto hwc_layer : layer_set_) { @@ -468,15 +470,13 @@ void HWCDisplay::BuildLayerStack() { layer->flags.solid_fill = true; } - // When the color mode is native, blend space is assumed to be sRGB and all layers - // are assumed to be handled regardless of color space - if (!hwc_layer->ValidateAndSetCSC() && current_color_mode_ != ColorMode::NATIVE) { + if (!hwc_layer->ValidateAndSetCSC()) { layer->flags.skip = true; } auto range = hwc_layer->GetLayerDataspace() & HAL_DATASPACE_RANGE_MASK; if (range == HAL_DATASPACE_RANGE_EXTENDED) { - extended_range = true; + layer->flags.skip = true; } // set default composition as GPU for SDM @@ -583,18 +583,14 @@ void HWCDisplay::BuildLayerStack() { layer_stack_.layers.push_back(layer); } - // When the color mode is native, blend space is assumed to be sRGB and all layers - // are assumed to be handled regardless of color space - if (current_color_mode_ != ColorMode::NATIVE) { - for (auto hwc_layer : layer_set_) { - auto layer = hwc_layer->GetSDMLayer(); - if (layer->input_buffer.color_metadata.colorPrimaries != working_primaries_ && - !hwc_layer->SupportLocalConversion(working_primaries_)) { - layer->flags.skip = true; - } - if (layer->flags.skip) { - layer_stack_.flags.skip_present = true; - } + for (auto hwc_layer : layer_set_) { + auto layer = hwc_layer->GetSDMLayer(); + if (layer->input_buffer.color_metadata.colorPrimaries != working_primaries_ && + !hwc_layer->SupportLocalConversion(working_primaries_)) { + layer->flags.skip = true; + } + if (layer->flags.skip) { + layer_stack_.flags.skip_present = true; } } @@ -607,7 +603,7 @@ void HWCDisplay::BuildLayerStack() { // fall back frame composition to GPU when client target is 10bit // TODO(user): clarify the behaviour from Client(SF) and SDM Extn - // when handling 10bit FBT, as it would affect blending - if (Is10BitFormat(sdm_client_target->input_buffer.format) || extended_range) { + if (Is10BitFormat(sdm_client_target->input_buffer.format)) { // Must fall back to client composition MarkLayersForClientComposition(); } diff --git a/sdm/libs/hwc2/hwc_tonemapper.cpp b/sdm/libs/hwc2/hwc_tonemapper.cpp index 22896f94..d417258f 100644 --- a/sdm/libs/hwc2/hwc_tonemapper.cpp +++ b/sdm/libs/hwc2/hwc_tonemapper.cpp @@ -138,6 +138,7 @@ void ToneMapSession::UpdateBuffer(int acquire_fence, LayerBuffer *buffer) { buffer->acquire_fence_fd = acquire_fence; buffer->size = buffer_info_[current_buffer_index_].alloc_buffer_info.size; buffer->planes[0].fd = buffer_info_[current_buffer_index_].alloc_buffer_info.fd; + buffer->handle_id = buffer_info_[current_buffer_index_].alloc_buffer_info.id; } void ToneMapSession::SetReleaseFence(int fd) { |