sdm: Support cursor without h/w cursor
Support cursor with any pipe type. Simplify design to factor in h/w cursor presence much later in draw cycle during resource allocation. Change-Id: If10866516d95cb3f8f33021a25ec6237b35ac32c CRs-fixed: 1114808
This commit is contained in:
committed by
Gerrit - the friendly Code Review server
parent
e9f55d7696
commit
a4af3debeb
@@ -85,8 +85,8 @@ enum LayerComposition {
|
||||
kCompositionSDE, //!< This layer will be composed by SDE. It must not be composed by
|
||||
//!< GPU or Blit.
|
||||
|
||||
kCompositionHWCursor, //!< This layer will be composed by SDE using HW Cursor. It must not be
|
||||
//!< composed by GPU or Blit.
|
||||
kCompositionCursor, // This cursor layer can receive async position updates irrespective of
|
||||
// dedicated h/w cursor usage. It must not be composed by GPU or Blit
|
||||
|
||||
kCompositionHybrid, //!< This layer will be drawn by a blit engine and SDE together.
|
||||
//!< Display device will split the layer, update the blit rectangle
|
||||
|
||||
@@ -485,10 +485,8 @@ struct HWLayersInfo {
|
||||
std::vector<LayerRect> left_frame_roi = {}; // Left ROI.
|
||||
std::vector<LayerRect> right_frame_roi = {}; // Right ROI.
|
||||
LayerRect partial_fb_roi = {}; // Damaged area in framebuffer.
|
||||
|
||||
bool roi_split = false; // Indicates separated left and right ROI
|
||||
|
||||
bool use_hw_cursor = false; // Indicates that HWCursor pipe needs to be used for cursor layer
|
||||
bool async_cursor_updates = false; // Cursor layer allowed to have async updates
|
||||
DestScaleInfoMap dest_scale_info_map = {};
|
||||
HWHDRLayerInfo hdr_layer_info = {};
|
||||
Handle pvt_data = NULL; // Private data used by sdm extension only.
|
||||
|
||||
@@ -35,8 +35,6 @@ namespace sdm {
|
||||
|
||||
struct PUConstraints {
|
||||
bool enable = true; //!< If this is set, PU will be enabled or it will be disabled
|
||||
bool enable_cursor_pu = false; //!< If this is set, PU will consider cursor layer in the layer
|
||||
//!< stack for cursor partial update
|
||||
};
|
||||
|
||||
class PartialUpdateInterface {
|
||||
|
||||
@@ -58,8 +58,6 @@ class ResourceInterface {
|
||||
virtual DisplayError ValidateScaling(const LayerRect &crop, const LayerRect &dst,
|
||||
bool rotate90, BufferLayout layout,
|
||||
bool use_rotator_downscale) = 0;
|
||||
virtual DisplayError ValidateCursorConfig(Handle display_ctx, const Layer *layer,
|
||||
bool is_top) = 0;
|
||||
virtual DisplayError ValidateCursorPosition(Handle display_ctx, HWLayers *hw_layers,
|
||||
int x, int y) = 0;
|
||||
virtual DisplayError SetMaxBandwidthMode(HWBwModes mode) = 0;
|
||||
|
||||
@@ -36,9 +36,6 @@ struct StrategyConstraints {
|
||||
//!< that requires minimum number of pipe for the current frame. i.e.,
|
||||
//!< video only composition, secure only composition or GPU composition
|
||||
|
||||
bool use_cursor = false; //!< If this is set, strategy manager will configure cursor layer in the
|
||||
//!< layer stack as hw cursor else it will be treated as a normal layer
|
||||
|
||||
uint32_t max_layers = kMaxSDELayers; //!< Maximum number of layers that shall be programmed
|
||||
//!< on hardware for the given layer stack.
|
||||
};
|
||||
|
||||
@@ -33,12 +33,6 @@
|
||||
|
||||
namespace sdm {
|
||||
|
||||
static bool NeedsScaledComposition(const DisplayConfigVariableInfo &fb_config,
|
||||
const HWMixerAttributes &mixer_attributes) {
|
||||
return ((fb_config.x_pixels != mixer_attributes.width) ||
|
||||
(fb_config.y_pixels != mixer_attributes.height));
|
||||
}
|
||||
|
||||
DisplayError CompManager::Init(const HWResourceInfo &hw_res_info,
|
||||
ExtensionInterface *extension_intf,
|
||||
BufferAllocator *buffer_allocator,
|
||||
@@ -135,7 +129,6 @@ DisplayError CompManager::RegisterDisplay(DisplayType type,
|
||||
max_sde_ext_layers_ = UINT32(Debug::GetExtMaxlayers());
|
||||
}
|
||||
|
||||
display_comp_ctx->scaled_composition = NeedsScaledComposition(fb_config, mixer_attributes);
|
||||
DLOGV_IF(kTagCompManager, "registered display bit mask 0x%x, configured display bit mask 0x%x, " \
|
||||
"display type %d", registered_displays_.to_ulong(), configured_displays_.to_ulong(),
|
||||
display_comp_ctx->display_type);
|
||||
@@ -214,8 +207,6 @@ DisplayError CompManager::ReconfigureDisplay(Handle comp_handle,
|
||||
}
|
||||
}
|
||||
|
||||
display_comp_ctx->scaled_composition = NeedsScaledComposition(fb_config, mixer_attributes);
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
@@ -225,7 +216,6 @@ void CompManager::PrepareStrategyConstraints(Handle comp_handle, HWLayers *hw_la
|
||||
StrategyConstraints *constraints = &display_comp_ctx->constraints;
|
||||
|
||||
constraints->safe_mode = safe_mode_;
|
||||
constraints->use_cursor = false;
|
||||
constraints->max_layers = max_layers_;
|
||||
|
||||
// Limit 2 layer SDE Comp if its not a Primary Display.
|
||||
@@ -242,9 +232,6 @@ void CompManager::PrepareStrategyConstraints(Handle comp_handle, HWLayers *hw_la
|
||||
constraints->safe_mode = true;
|
||||
}
|
||||
|
||||
// Set use_cursor constraint to Strategy
|
||||
constraints->use_cursor = display_comp_ctx->valid_cursor;
|
||||
|
||||
// TODO(user): App layer count will change for hybrid composition
|
||||
uint32_t app_layer_count = UINT32(hw_layers->info.stack->layers.size()) - 1;
|
||||
if (display_comp_ctx->idle_fallback || display_comp_ctx->thermal_fallback_) {
|
||||
@@ -262,11 +249,6 @@ void CompManager::PrePrepare(Handle display_ctx, HWLayers *hw_layers) {
|
||||
SCOPE_LOCK(locker_);
|
||||
DisplayCompositionContext *display_comp_ctx =
|
||||
reinterpret_cast<DisplayCompositionContext *>(display_ctx);
|
||||
display_comp_ctx->valid_cursor = SupportLayerAsCursor(display_comp_ctx, hw_layers);
|
||||
|
||||
// pu constraints
|
||||
display_comp_ctx->pu_constraints.enable_cursor_pu = display_comp_ctx->valid_cursor;
|
||||
|
||||
display_comp_ctx->strategy->Start(&hw_layers->info, &display_comp_ctx->max_strategies,
|
||||
display_comp_ctx->pu_constraints);
|
||||
display_comp_ctx->remaining_strategies = display_comp_ctx->max_strategies;
|
||||
@@ -486,39 +468,6 @@ DisplayError CompManager::ValidateCursorPosition(Handle display_ctx, HWLayers *h
|
||||
return resource_intf_->ValidateCursorPosition(display_resource_ctx, hw_layers, x, y);
|
||||
}
|
||||
|
||||
bool CompManager::SupportLayerAsCursor(Handle comp_handle, HWLayers *hw_layers) {
|
||||
DisplayCompositionContext *display_comp_ctx =
|
||||
reinterpret_cast<DisplayCompositionContext *>(comp_handle);
|
||||
Handle &display_resource_ctx = display_comp_ctx->display_resource_ctx;
|
||||
LayerStack *layer_stack = hw_layers->info.stack;
|
||||
bool supported = false;
|
||||
int32_t gpu_index = -1;
|
||||
|
||||
// HW Cursor cannot be used, if Display configuration needs scaled composition.
|
||||
if (display_comp_ctx->scaled_composition || !layer_stack->flags.cursor_present) {
|
||||
return supported;
|
||||
}
|
||||
|
||||
for (int32_t i = INT32(layer_stack->layers.size() - 1); i >= 0; i--) {
|
||||
Layer *layer = layer_stack->layers.at(UINT32(i));
|
||||
if (layer->composition == kCompositionGPUTarget) {
|
||||
gpu_index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (gpu_index <= 0) {
|
||||
return supported;
|
||||
}
|
||||
Layer *cursor_layer = layer_stack->layers.at(UINT32(gpu_index) - 1);
|
||||
if (cursor_layer->flags.cursor && !cursor_layer->flags.skip &&
|
||||
resource_intf_->ValidateCursorConfig(display_resource_ctx,
|
||||
cursor_layer, true) == kErrorNone) {
|
||||
supported = true;
|
||||
}
|
||||
|
||||
return supported;
|
||||
}
|
||||
|
||||
DisplayError CompManager::SetMaxBandwidthMode(HWBwModes mode) {
|
||||
if ((hw_res_info_.has_dyn_bw_support == false) || (mode >= kBwModeMax)) {
|
||||
return kErrorNotSupported;
|
||||
|
||||
@@ -67,7 +67,6 @@ class CompManager : public DumpImpl {
|
||||
void ControlPartialUpdate(Handle display_ctx, bool enable);
|
||||
DisplayError ValidateScaling(const LayerRect &crop, const LayerRect &dst, bool rotate90);
|
||||
DisplayError ValidateCursorPosition(Handle display_ctx, HWLayers *hw_layers, int x, int y);
|
||||
bool SupportLayerAsCursor(Handle display_ctx, HWLayers *hw_layers);
|
||||
bool SetDisplayState(Handle display_ctx, DisplayState state, DisplayType display_type);
|
||||
DisplayError SetMaxBandwidthMode(HWBwModes mode);
|
||||
DisplayError GetScaleLutConfig(HWScaleLutInfo *lut_info);
|
||||
@@ -97,9 +96,7 @@ class CompManager : public DumpImpl {
|
||||
// Using primary panel flag of hw panel to configure Constraints. We do not need other hw
|
||||
// panel parameters for now.
|
||||
bool is_primary_panel = false;
|
||||
bool valid_cursor = false;
|
||||
PUConstraints pu_constraints = {};
|
||||
bool scaled_composition = false;
|
||||
};
|
||||
|
||||
Locker locker_;
|
||||
|
||||
@@ -664,7 +664,7 @@ const char * DisplayBase::GetName(const LayerComposition &composition) {
|
||||
switch (composition) {
|
||||
case kCompositionGPU: return "GPU";
|
||||
case kCompositionSDE: return "SDE";
|
||||
case kCompositionHWCursor: return "CURSOR";
|
||||
case kCompositionCursor: return "CURSOR";
|
||||
case kCompositionHybrid: return "HYBRID";
|
||||
case kCompositionBlit: return "BLIT";
|
||||
case kCompositionGPUTarget: return "GPU_TARGET";
|
||||
|
||||
@@ -208,7 +208,6 @@ DisplayError HWDevice::Validate(HWLayers *hw_layers) {
|
||||
HWPipeInfo *right_pipe = &hw_layers->config[i].right_pipe;
|
||||
HWRotatorSession *hw_rotator_session = &hw_layers->config[i].hw_rotator_session;
|
||||
bool is_rotator_used = (hw_rotator_session->hw_block_count != 0);
|
||||
bool is_cursor_pipe_used = (hw_layer_info.use_hw_cursor & layer.flags.cursor);
|
||||
|
||||
for (uint32_t count = 0; count < 2; count++) {
|
||||
HWPipeInfo *pipe_info = (count == 0) ? left_pipe : right_pipe;
|
||||
@@ -247,7 +246,7 @@ DisplayError HWDevice::Validate(HWLayers *hw_layers) {
|
||||
#endif
|
||||
SetRect(pipe_info->src_roi, &mdp_layer.src_rect);
|
||||
SetRect(pipe_info->dst_roi, &mdp_layer.dst_rect);
|
||||
SetMDPFlags(&layer, is_rotator_used, is_cursor_pipe_used, &mdp_layer.flags);
|
||||
SetMDPFlags(&layer, is_rotator_used, hw_layer_info.async_cursor_updates, &mdp_layer.flags);
|
||||
SetCSC(layer.input_buffer.color_metadata, &mdp_layer.color_space);
|
||||
if (pipe_info->flags & kIGC) {
|
||||
SetIGC(&layer.input_buffer, mdp_layer_count);
|
||||
@@ -710,7 +709,7 @@ void HWDevice::SetRect(const LayerRect &source, mdp_rect *target) {
|
||||
}
|
||||
|
||||
void HWDevice::SetMDPFlags(const Layer *layer, const bool &is_rotator_used,
|
||||
bool is_cursor_pipe_used, uint32_t *mdp_flags) {
|
||||
bool async_cursor_updates, uint32_t *mdp_flags) {
|
||||
const LayerBuffer &input_buffer = layer->input_buffer;
|
||||
|
||||
// Flips will be taken care by rotator, if layer uses rotator for downscale/rotation. So ignore
|
||||
@@ -743,7 +742,7 @@ void HWDevice::SetMDPFlags(const Layer *layer, const bool &is_rotator_used,
|
||||
*mdp_flags |= MDP_LAYER_SOLID_FILL;
|
||||
}
|
||||
|
||||
if (hw_panel_info_.mode != kModeCommand && layer->flags.cursor && is_cursor_pipe_used) {
|
||||
if (layer->flags.cursor && async_cursor_updates) {
|
||||
// command mode panels does not support async position update
|
||||
*mdp_flags |= MDP_LAYER_ASYNC;
|
||||
}
|
||||
|
||||
@@ -116,7 +116,7 @@ class HWDevice : public HWInterface {
|
||||
void SetBlending(const LayerBlending &source, mdss_mdp_blend_op *target);
|
||||
void SetRect(const LayerRect &source, mdp_rect *target);
|
||||
void SetMDPFlags(const Layer *layer, const bool &is_rotator_used,
|
||||
bool is_cursor_pipe_used, uint32_t *mdp_flags);
|
||||
bool async_cursor_updates, uint32_t *mdp_flags);
|
||||
// Retrieves HW FrameBuffer Node Index
|
||||
int GetFBNodeIndex(HWDeviceType device_type);
|
||||
// Populates HWPanelInfo based on node index
|
||||
|
||||
@@ -923,11 +923,6 @@ DisplayError ResourceDefault::CalculateDecimation(float downscale, uint8_t *deci
|
||||
return kErrorNone;
|
||||
}
|
||||
|
||||
DisplayError ResourceDefault::ValidateCursorConfig(Handle display_ctx, const Layer *layer,
|
||||
bool is_top) {
|
||||
return kErrorNotSupported;
|
||||
}
|
||||
|
||||
DisplayError ResourceDefault::ValidateCursorPosition(Handle display_ctx, HWLayers *hw_layers,
|
||||
int x, int y) {
|
||||
return kErrorNotSupported;
|
||||
|
||||
@@ -953,7 +953,7 @@ void HWCDisplay::SetComposition(const LayerComposition &source, int32_t *target)
|
||||
case kCompositionGPUTarget: *target = HWC_FRAMEBUFFER_TARGET; break;
|
||||
case kCompositionGPU: *target = HWC_FRAMEBUFFER; break;
|
||||
case kCompositionGPUS3D: *target = HWC_FRAMEBUFFER; break;
|
||||
case kCompositionHWCursor: *target = HWC_CURSOR_OVERLAY; break;
|
||||
case kCompositionCursor: *target = HWC_CURSOR_OVERLAY; break;
|
||||
default: *target = HWC_OVERLAY; break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -690,7 +690,7 @@ void HWCLayer::SetComposition(const LayerComposition &sdm_composition) {
|
||||
case kCompositionGPU:
|
||||
hwc_composition = HWC2::Composition::Client;
|
||||
break;
|
||||
case kCompositionHWCursor:
|
||||
case kCompositionCursor:
|
||||
hwc_composition = HWC2::Composition::Cursor;
|
||||
break;
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user