Merge "sdm: Check FBT layer handle during prepare"
diff --git a/libhwcomposer/hwc_mdpcomp.cpp b/libhwcomposer/hwc_mdpcomp.cpp
index 3e3638c..43a7a1a 100644
--- a/libhwcomposer/hwc_mdpcomp.cpp
+++ b/libhwcomposer/hwc_mdpcomp.cpp
@@ -555,6 +555,13 @@
if(!isEnabled()) {
ALOGD_IF(isDebug(),"%s: MDP Comp. not enabled.", __FUNCTION__);
ret = false;
+ } else if (ctx->isDMAStateChanging) {
+ // Bail out if a padding round has been invoked in order to switch DMA
+ // state to block mode. We need this to cater for the case when a layer
+ // requires rotation in the current frame.
+ ALOGD_IF(isDebug(), "%s: padding round invoked to switch DMA state",
+ __FUNCTION__);
+ ret = false;
} else if(ctx->mVideoTransFlag && isSecondaryConnected(ctx)) {
//1 Padding round to shift pipes across mixers
ALOGD_IF(isDebug(),"%s: MDP Comp. video transition padding round",
@@ -584,13 +591,6 @@
__FUNCTION__,mDpy);
ret = false;
}
- } else if (ctx->isDMAStateChanging) {
- // Bail out if a padding round has been invoked in order to switch DMA
- // state to block mode. We need this to cater for the case when a layer
- // requires rotation in the current frame.
- ALOGD_IF(isDebug(), "%s: padding round invoked to switch DMA state",
- __FUNCTION__);
- return false;
}
return ret;
diff --git a/sdm/include/core/core_interface.h b/sdm/include/core/core_interface.h
index e1b38fa..26f6e2f 100644
--- a/sdm/include/core/core_interface.h
+++ b/sdm/include/core/core_interface.h
@@ -76,43 +76,6 @@
*/
class DebugHandler;
-
-/*! @brief Event data associated with hotplug event.
-
- @sa CoreEventHandler::Hotplug
-*/
-struct CoreEventHotplug {
- bool connected; //!< True when device is connected.
-
- CoreEventHotplug() : connected(false) { }
-};
-
-/*! @brief Display core event handler implemented by the client.
-
- @details This class declares prototype for display core event handler methods which must be
- implemented by the client. Display core will use these methods to notify events to the client.
- Client must post heavy-weight event handling to a separate thread and unblock display core thread
- instantly.
-
- @sa CoreInterface::CreateCore
-*/
-class CoreEventHandler {
- public:
- /*! @brief Event handler for Hotplug event.
-
- @details Event generated when a display device is connected or disconnected. Applicable to
- detachable displays only.
-
- @param[in] \link CoreEventHotplug \endlink
-
- @return \link DisplayError \endlink
- */
- virtual DisplayError Hotplug(const CoreEventHotplug &hotplug) = 0;
-
- protected:
- virtual ~CoreEventHandler() { }
-};
-
/*! @brief Display core interface.
@details This class defines display core interfaces. It contains methods which client shall use
@@ -131,7 +94,6 @@
object of display core is created and handle to this object is returned via output parameter.
This interface shall be called only once.
- @param[in] event_handler \link CoreEventHandler \endlink
@param[in] debug_handler \link DebugHandler \endlink
@param[in] buffer_allocator \link BufferAllocator \endlink
@param[in] buffer_sync_handler \link BufferSyncHandler \endlink
@@ -142,8 +104,7 @@
@sa DestroyCore
*/
- static DisplayError CreateCore(CoreEventHandler *event_handler, DebugHandler *debug_handler,
- BufferAllocator *buffer_allocator,
+ static DisplayError CreateCore(DebugHandler *debug_handler, BufferAllocator *buffer_allocator,
BufferSyncHandler *buffer_sync_handler, CoreInterface **interface,
uint32_t version = SDM_VERSION_TAG);
diff --git a/sdm/include/core/display_interface.h b/sdm/include/core/display_interface.h
index b16e43c..68bd5b1 100644
--- a/sdm/include/core/display_interface.h
+++ b/sdm/include/core/display_interface.h
@@ -97,11 +97,9 @@
float y_dpi; //!< Dots per inch in Y-direction.
uint32_t fps; //!< Frame rate per second.
uint32_t vsync_period_ns; //!< VSync period in nanoseconds.
- uint32_t v_total; //!< Total height of panel (vActive + vFP + vBP + vPulseWidth).
- uint32_t h_total; //!< Total width of panel (hActive + hFP + hBP + hPulseWidth).
DisplayConfigVariableInfo() : x_pixels(0), y_pixels(0), x_dpi(0.0f), y_dpi(0.0f),
- fps(0), vsync_period_ns(0), v_total(0), h_total(0) { }
+ fps(0), vsync_period_ns(0) { }
};
/*! @brief Event data associated with VSync event.
diff --git a/sdm/include/private/hw_info_types.h b/sdm/include/private/hw_info_types.h
index 2d639a8..fdfc582 100644
--- a/sdm/include/private/hw_info_types.h
+++ b/sdm/include/private/hw_info_types.h
@@ -88,6 +88,11 @@
uint32_t max_pipe_bw;
uint32_t max_sde_clk;
float clk_fudge_factor;
+ uint32_t macrotile_nv12_factor;
+ uint32_t macrotile_factor;
+ uint32_t linear_factor;
+ uint32_t scale_factor;
+ uint32_t extra_fudge_factor;
bool has_bwc;
bool has_ubwc;
bool has_decimation;
@@ -101,9 +106,11 @@
num_cursor_pipe(0), num_blending_stages(0), num_rotator(0), num_control(0),
num_mixer_to_disp(0), smp_total(0), smp_size(0), num_smp_per_pipe(0), max_scale_up(1),
max_scale_down(1), max_bandwidth_low(0), max_bandwidth_high(0), max_mixer_width(2048),
- max_pipe_width(2048), max_pipe_bw(0), max_sde_clk(0), clk_fudge_factor(1.0f), has_bwc(false),
- has_ubwc(false), has_decimation(false), has_macrotile(false), has_rotator_downscale(false),
- has_non_scalar_rgb(false), is_src_split(false) { }
+ max_pipe_width(2048), max_pipe_bw(0), max_sde_clk(0), clk_fudge_factor(1.0f),
+ macrotile_nv12_factor(0), macrotile_factor(0), linear_factor(0), scale_factor(0),
+ extra_fudge_factor(0), has_bwc(false), has_ubwc(false), has_decimation(false),
+ has_macrotile(false), has_rotator_downscale(false), has_non_scalar_rgb(false),
+ is_src_split(false) { }
void Reset() { *this = HWResourceInfo(); }
};
@@ -198,15 +205,15 @@
};
struct HWRotateInfo {
- uint32_t pipe_id;
+ int pipe_id;
+ int writeback_id;
LayerRect src_roi;
LayerRect dst_roi;
- HWBlockType writeback_id;
bool valid;
int rotate_id;
HWRotateInfo()
- : pipe_id(0), writeback_id(kHWWriteback0), valid(false), rotate_id(-1) { }
+ : pipe_id(-1), writeback_id(-1), valid(false), rotate_id(-1) { }
void Reset() { *this = HWRotateInfo(); }
};
@@ -316,8 +323,13 @@
bool is_device_split;
uint32_t split_left;
bool always_src_split;
+ uint32_t v_front_porch; //!< Vertical front porch of panel
+ uint32_t v_back_porch; //!< Vertical back porch of panel
+ uint32_t v_pulse_width; //!< Vertical pulse width of panel
+ uint32_t h_total; //!< Total width of panel (hActive + hFP + hBP + hPulseWidth)
- HWDisplayAttributes() : is_device_split(false), split_left(0), always_src_split(false) { }
+ HWDisplayAttributes() : is_device_split(false), split_left(0), always_src_split(false),
+ v_front_porch(0), v_back_porch(0), v_pulse_width(0), h_total(0) { }
void Reset() { *this = HWDisplayAttributes(); }
@@ -327,7 +339,10 @@
(always_src_split != attributes.always_src_split) ||
(x_pixels != attributes.x_pixels) || (y_pixels != attributes.y_pixels) ||
(x_dpi != attributes.x_dpi) || (y_dpi != attributes.y_dpi) || (fps != attributes.fps) ||
- (vsync_period_ns != attributes.vsync_period_ns) || (v_total != attributes.v_total));
+ (vsync_period_ns != attributes.vsync_period_ns) ||
+ (v_front_porch != attributes.v_front_porch) ||
+ (v_back_porch != attributes.v_back_porch) ||
+ (v_pulse_width != attributes.v_pulse_width));
}
bool operator ==(const HWDisplayAttributes &attributes) {
diff --git a/sdm/include/utils/debug.h b/sdm/include/utils/debug.h
index 2a9cc72..5b08129 100644
--- a/sdm/include/utils/debug.h
+++ b/sdm/include/utils/debug.h
@@ -33,6 +33,7 @@
#include <stdint.h>
#include <core/sdm_types.h>
#include <core/debug_interface.h>
+#include <core/display_interface.h>
#define DLOG(tag, method, format, ...) Debug::Get()->method(tag, __CLASS__ "::%s: " format, \
__FUNCTION__, ##__VA_ARGS__)
@@ -65,7 +66,8 @@
static bool IsRotatorDownScaleDisabled();
static bool IsDecimationDisabled();
static bool IsPartialUpdateEnabled();
- static int GetMaxPipesPerMixer();
+ static int GetMaxPipesPerMixer(DisplayType display_type);
+ static bool IsVideoModeEnabled();
private:
Debug();
diff --git a/sdm/libs/core/core_impl.cpp b/sdm/libs/core/core_impl.cpp
index d253b2e..5cb1c95 100644
--- a/sdm/libs/core/core_impl.cpp
+++ b/sdm/libs/core/core_impl.cpp
@@ -37,12 +37,11 @@
namespace sdm {
-CoreImpl::CoreImpl(CoreEventHandler *event_handler, BufferAllocator *buffer_allocator,
+CoreImpl::CoreImpl(BufferAllocator *buffer_allocator,
BufferSyncHandler *buffer_sync_handler)
- : event_handler_(event_handler), buffer_allocator_(buffer_allocator),
- buffer_sync_handler_(buffer_sync_handler), hw_resource_(NULL), hw_info_intf_(NULL),
- rotator_intf_(NULL), extension_lib_(NULL), extension_intf_(NULL),
- create_extension_intf_(NULL), destroy_extension_intf_(NULL) {
+ : buffer_allocator_(buffer_allocator), buffer_sync_handler_(buffer_sync_handler),
+ hw_resource_(NULL), hw_info_intf_(NULL), rotator_intf_(NULL), extension_lib_(NULL),
+ extension_intf_(NULL), create_extension_intf_(NULL), destroy_extension_intf_(NULL) {
}
DisplayError CoreImpl::Init() {
diff --git a/sdm/libs/core/core_impl.h b/sdm/libs/core/core_impl.h
index bad241c..32fa078 100644
--- a/sdm/libs/core/core_impl.h
+++ b/sdm/libs/core/core_impl.h
@@ -44,8 +44,7 @@
// This class implements display core interface revision 1.0.
static const uint16_t kRevision = SET_REVISION(1, 0);
- CoreImpl(CoreEventHandler *event_handler, BufferAllocator *buffer_allocator,
- BufferSyncHandler *buffer_sync_handler);
+ CoreImpl(BufferAllocator *buffer_allocator, BufferSyncHandler *buffer_sync_handler);
virtual ~CoreImpl() { }
// This method returns the interface revision for the current display core object.
@@ -61,7 +60,6 @@
protected:
Locker locker_;
- CoreEventHandler *event_handler_;
BufferAllocator *buffer_allocator_;
BufferSyncHandler *buffer_sync_handler_;
HWResourceInfo *hw_resource_;
diff --git a/sdm/libs/core/core_interface.cpp b/sdm/libs/core/core_interface.cpp
index 34eceff..177e7bf 100644
--- a/sdm/libs/core/core_interface.cpp
+++ b/sdm/libs/core/core_interface.cpp
@@ -52,13 +52,13 @@
} g_core;
// TODO(user): Have a single structure handle carries all the interface pointers.
-DisplayError CoreInterface::CreateCore(CoreEventHandler *event_handler, DebugHandler *debug_handler,
+DisplayError CoreInterface::CreateCore(DebugHandler *debug_handler,
BufferAllocator *buffer_allocator,
BufferSyncHandler *buffer_sync_handler,
CoreInterface **interface, uint32_t client_version) {
SCOPE_LOCK(g_core.locker);
- if (!event_handler || !debug_handler || !buffer_allocator || !buffer_sync_handler || !interface) {
+ if (!debug_handler || !buffer_allocator || !buffer_sync_handler || !interface) {
return kErrorParameters;
}
@@ -81,7 +81,7 @@
// Create appropriate CoreImpl object based on client version.
if (GET_REVISION(client_version) == CoreImpl::kRevision) {
- core_impl = new CoreImpl(event_handler, buffer_allocator, buffer_sync_handler);
+ core_impl = new CoreImpl(buffer_allocator, buffer_sync_handler);
} else {
return kErrorNotSupported;
}
diff --git a/sdm/libs/core/display_base.cpp b/sdm/libs/core/display_base.cpp
index 73b26f5..fcc69bb 100644
--- a/sdm/libs/core/display_base.cpp
+++ b/sdm/libs/core/display_base.cpp
@@ -93,7 +93,7 @@
HWResourceInfo hw_resource_info = HWResourceInfo();
hw_info_intf_->GetHWResourceInfo(&hw_resource_info);
int max_mixer_stages = hw_resource_info.num_blending_stages;
- int property_value = Debug::GetMaxPipesPerMixer();
+ int property_value = Debug::GetMaxPipesPerMixer(display_type_);
if (property_value >= 0) {
max_mixer_stages = MIN(UINT32(property_value), hw_resource_info.num_blending_stages);
}
diff --git a/sdm/libs/core/display_primary.cpp b/sdm/libs/core/display_primary.cpp
index 4c4a1dd..1b0a552 100644
--- a/sdm/libs/core/display_primary.cpp
+++ b/sdm/libs/core/display_primary.cpp
@@ -65,6 +65,14 @@
hw_primary_intf_->SetIdleTimeoutMs(Debug::GetIdleTimeoutMs());
}
+ if (hw_panel_info_.mode == kModeCommand && Debug::IsVideoModeEnabled()) {
+ error = hw_primary_intf_->SetDisplayMode(kModeVideo);
+ if (error != kErrorNone) {
+ DLOGW("Retaining current display mode. Current = %d, Requested = %d", hw_panel_info_.mode,
+ kModeVideo);
+ }
+ }
+
return error;
}
@@ -198,7 +206,7 @@
HWDisplayMode hw_display_mode = kModeDefault;
if (state_ != kStateOn) {
- DLOGW("Invalid display state (%d). Panel must be on.", state_);
+ DLOGW("Invalid display state = %d. Panel must be on.", state_);
return kErrorNotSupported;
}
@@ -210,19 +218,19 @@
hw_display_mode = kModeCommand;
break;
default:
- DLOGW("Invalid panel mode parameters. Requested (%d)", mode);
+ DLOGW("Invalid panel mode parameters. Requested = %d", mode);
return kErrorParameters;
}
if (hw_display_mode == hw_panel_info_.mode) {
- DLOGW("Same display mode requested. Current (%d) Requested (%d)", hw_panel_info_.mode,
+ DLOGW("Same display mode requested. Current = %d, Requested = %d", hw_panel_info_.mode,
hw_display_mode);
return kErrorNone;
}
error = hw_primary_intf_->SetDisplayMode(hw_display_mode);
if (error != kErrorNone) {
- DLOGW("Retaining current display mode. Current (%d), Requested (%d)", hw_panel_info_.mode,
+ DLOGW("Retaining current display mode. Current = %d, Requested = %d", hw_panel_info_.mode,
hw_display_mode);
return error;
}
diff --git a/sdm/libs/core/fb/hw_device.cpp b/sdm/libs/core/fb/hw_device.cpp
index 54b00ff..31b3da9 100644
--- a/sdm/libs/core/fb/hw_device.cpp
+++ b/sdm/libs/core/fb/hw_device.cpp
@@ -445,8 +445,6 @@
if (hw_rotator_session->hw_block_count) {
input_buffer = &hw_rotator_session->output_buffer;
- close_(input_buffer->acquire_fence_fd);
- input_buffer->acquire_fence_fd = -1;
}
input_buffer->release_fence_fd = dup(mdp_commit.release_fence);
@@ -714,7 +712,7 @@
} else if (!strncmp(tokens[0], "min_fps", strlen("min_fps"))) {
panel_info->min_fps = atoi(tokens[1]);
} else if (!strncmp(tokens[0], "max_fps", strlen("max_fps"))) {
- panel_info->max_fps= atoi(tokens[1]);
+ panel_info->max_fps = atoi(tokens[1]);
} else if (!strncmp(tokens[0], "primary_panel", strlen("primary_panel"))) {
panel_info->is_primary_panel = atoi(tokens[1]);
}
diff --git a/sdm/libs/core/fb/hw_hdmi.cpp b/sdm/libs/core/fb/hw_hdmi.cpp
index 3abda13..3df8e38 100644
--- a/sdm/libs/core/fb/hw_hdmi.cpp
+++ b/sdm/libs/core/fb/hw_hdmi.cpp
@@ -223,8 +223,9 @@
}
display_attributes->x_pixels = timing_mode->active_h;
display_attributes->y_pixels = timing_mode->active_v;
- display_attributes->v_total = timing_mode->active_v + timing_mode->front_porch_v +
- timing_mode->back_porch_v + timing_mode->pulse_width_v;
+ display_attributes->v_front_porch = timing_mode->front_porch_v;
+ display_attributes->v_back_porch = timing_mode->back_porch_v;
+ display_attributes->v_pulse_width = timing_mode->pulse_width_v;
uint32_t h_blanking = timing_mode->front_porch_h + timing_mode->back_porch_h +
timing_mode->pulse_width_h;
display_attributes->h_total = timing_mode->active_h + h_blanking;
diff --git a/sdm/libs/core/fb/hw_info.cpp b/sdm/libs/core/fb/hw_info.cpp
index 2b8a49d..c3fb41d 100644
--- a/sdm/libs/core/fb/hw_info.cpp
+++ b/sdm/libs/core/fb/hw_info.cpp
@@ -132,6 +132,16 @@
hw_resource->max_sde_clk = atoi(tokens[1]);
} else if (!strncmp(tokens[0], "clk_fudge_factor", strlen("clk_fudge_factor"))) {
hw_resource->clk_fudge_factor = FLOAT(atoi(tokens[1])) / FLOAT(atoi(tokens[2]));
+ } else if (!strncmp(tokens[0], "fmt_mt_nv12_factor", strlen("fmt_mt_nv12_factor"))) {
+ hw_resource->macrotile_nv12_factor = atoi(tokens[1]);
+ } else if (!strncmp(tokens[0], "fmt_mt_factor", strlen("fmt_mt_factor"))) {
+ hw_resource->macrotile_factor = atoi(tokens[1]);
+ } else if (!strncmp(tokens[0], "fmt_linear_factor", strlen("fmt_linear_factor"))) {
+ hw_resource->linear_factor = atoi(tokens[1]);
+ } else if (!strncmp(tokens[0], "scale_factor", strlen("scale_factor"))) {
+ hw_resource->scale_factor = atoi(tokens[1]);
+ } else if (!strncmp(tokens[0], "xtra_ff_factor", strlen("xtra_ff_factor"))) {
+ hw_resource->extra_fudge_factor = atoi(tokens[1]);
} else if (!strncmp(tokens[0], "features", strlen("features"))) {
for (uint32_t i = 0; i < token_count; i++) {
if (!strncmp(tokens[i], "bwc", strlen("bwc"))) {
@@ -166,6 +176,9 @@
hw_resource->max_bandwidth_high);
DLOGI("MaxPipeBw = %"PRIu64" KBps, MaxSDEClock = %"PRIu64" Hz, ClockFudgeFactor = %f",
hw_resource->max_pipe_bw, hw_resource->max_sde_clk, hw_resource->clk_fudge_factor);
+ DLOGI("Prefill factors: Tiled_NV12 = %d, Tiled = %d, Linear = %d, Scale = %d, Fudge_factor = %d",
+ hw_resource->macrotile_nv12_factor, hw_resource->macrotile_factor,
+ hw_resource->linear_factor, hw_resource->scale_factor, hw_resource->extra_fudge_factor);
return kErrorNone;
}
diff --git a/sdm/libs/core/fb/hw_primary.cpp b/sdm/libs/core/fb/hw_primary.cpp
index 4d1dad1..284cb67 100644
--- a/sdm/libs/core/fb/hw_primary.cpp
+++ b/sdm/libs/core/fb/hw_primary.cpp
@@ -207,12 +207,12 @@
display_attributes_.x_pixels = var_screeninfo.xres;
display_attributes_.y_pixels = var_screeninfo.yres;
- display_attributes_.v_total = var_screeninfo.yres + var_screeninfo.lower_margin +
- var_screeninfo.upper_margin + var_screeninfo.vsync_len;
+ display_attributes_.v_front_porch = var_screeninfo.lower_margin;
+ display_attributes_.v_back_porch = var_screeninfo.upper_margin;
+ display_attributes_.v_pulse_width = var_screeninfo.vsync_len;
uint32_t h_blanking = var_screeninfo.right_margin + var_screeninfo.left_margin +
var_screeninfo.hsync_len;
- display_attributes_.h_total = var_screeninfo.xres + var_screeninfo.right_margin +
- var_screeninfo.left_margin + var_screeninfo.hsync_len;
+ display_attributes_.h_total = var_screeninfo.xres + h_blanking;
display_attributes_.x_dpi =
(FLOAT(var_screeninfo.xres) * 25.4f) / FLOAT(var_screeninfo.width);
display_attributes_.y_dpi =
diff --git a/sdm/libs/hwc/hwc_buffer_allocator.cpp b/sdm/libs/hwc/hwc_buffer_allocator.cpp
index 2d79f0d..d0fdc8c 100644
--- a/sdm/libs/hwc/hwc_buffer_allocator.cpp
+++ b/sdm/libs/hwc/hwc_buffer_allocator.cpp
@@ -115,36 +115,35 @@
int ret = 0;
AllocatedBufferInfo *alloc_buffer_info = &buffer_info->alloc_buffer_info;
- MetaBufferInfo *meta_buffer_info = static_cast<MetaBufferInfo *> (buffer_info->private_data);
- if (alloc_buffer_info->fd < 0) {
- DLOGE("Invalid parameters: fd %d", alloc_buffer_info->fd);
- return kErrorParameters;
+
+ // Deallocate the buffer, only if the buffer fd is valid.
+ if (alloc_buffer_info->fd > 0) {
+ MetaBufferInfo *meta_buffer_info = static_cast<MetaBufferInfo *> (buffer_info->private_data);
+ gralloc::IMemAlloc *memalloc = alloc_controller_->getAllocator(meta_buffer_info->alloc_type);
+ if (memalloc == NULL) {
+ DLOGE("Memalloc handle is NULL, alloc type %d", meta_buffer_info->alloc_type);
+ return kErrorResources;
+ }
+
+ ret = memalloc->free_buffer(meta_buffer_info->base_addr, alloc_buffer_info->size, 0,
+ alloc_buffer_info->fd);
+ if (ret != 0) {
+ DLOGE("Error freeing buffer base_addr %p size %d fd %d", meta_buffer_info->base_addr,
+ alloc_buffer_info->size, alloc_buffer_info->fd);
+ return kErrorMemory;
+ }
+
+ alloc_buffer_info->fd = -1;
+ alloc_buffer_info->stride = 0;
+ alloc_buffer_info->size = 0;
+
+ meta_buffer_info->base_addr = NULL;
+ meta_buffer_info->alloc_type = 0;
+
+ delete meta_buffer_info;
+ meta_buffer_info = NULL;
}
- gralloc::IMemAlloc *memalloc = alloc_controller_->getAllocator(meta_buffer_info->alloc_type);
- if (memalloc == NULL) {
- DLOGE("Memalloc handle is NULL, alloc type %d", meta_buffer_info->alloc_type);
- return kErrorResources;
- }
-
- ret = memalloc->free_buffer(meta_buffer_info->base_addr, alloc_buffer_info->size, 0,
- alloc_buffer_info->fd);
- if (ret != 0) {
- DLOGE("Error freeing buffer base_addr %p size %d fd %d", meta_buffer_info->base_addr,
- alloc_buffer_info->size, alloc_buffer_info->fd);
- return kErrorMemory;
- }
-
- alloc_buffer_info->fd = -1;
- alloc_buffer_info->stride = 0;
- alloc_buffer_info->size = 0;
-
- meta_buffer_info->base_addr = NULL;
- meta_buffer_info->alloc_type = 0;
-
- delete meta_buffer_info;
- meta_buffer_info = NULL;
-
return kErrorNone;
}
diff --git a/sdm/libs/hwc/hwc_display.cpp b/sdm/libs/hwc/hwc_display.cpp
index d764a5c..24bfcaa 100644
--- a/sdm/libs/hwc/hwc_display.cpp
+++ b/sdm/libs/hwc/hwc_display.cpp
@@ -46,7 +46,7 @@
HWCDisplay::HWCDisplay(CoreInterface *core_intf, hwc_procs_t const **hwc_procs, DisplayType type,
int id)
: core_intf_(core_intf), hwc_procs_(hwc_procs), type_(type), id_(id), display_intf_(NULL),
- flush_(false), output_buffer_(NULL), dump_frame_count_(0), dump_frame_index_(0),
+ flush_(false), dump_frame_count_(0), dump_frame_index_(0),
dump_input_layers_(false), swap_interval_zero_(false), framebuffer_config_(NULL),
display_paused_(false), use_metadata_refresh_rate_(false), metadata_refresh_rate_(0) {
}
@@ -59,9 +59,9 @@
return -EINVAL;
}
- char property[PROPERTY_VALUE_MAX];
- if (property_get("debug.egl.swapinterval", property, "1") > 0) {
- if (atoi(property) == 0) {
+ int property_swap_interval = 1;
+ if (HWCDebugHandler::Get()->GetProperty("debug.egl.swapinterval", &property_swap_interval)) {
+ if (property_swap_interval == 0) {
swap_interval_zero_ = true;
}
}
@@ -214,10 +214,6 @@
return index;
}
-int HWCDisplay::SetActiveConfig(hwc_display_contents_1_t *content_list) {
- return 0;
-}
-
int HWCDisplay::SetActiveConfig(int index) {
DisplayError error = kErrorNone;
diff --git a/sdm/libs/hwc/hwc_display.h b/sdm/libs/hwc/hwc_display.h
index ce38e5b..b20b00b 100644
--- a/sdm/libs/hwc/hwc_display.h
+++ b/sdm/libs/hwc/hwc_display.h
@@ -42,7 +42,6 @@
virtual int GetDisplayAttributes(uint32_t config, const uint32_t *attributes, int32_t *values);
virtual int GetActiveConfig();
virtual int SetActiveConfig(int index);
- virtual int SetActiveConfig(hwc_display_contents_1_t *content_list);
virtual void SetIdleTimeoutMs(uint32_t timeout_ms);
virtual void SetFrameDumpConfig(uint32_t count, uint32_t bit_mask_layer_type);
virtual DisplayError SetMaxMixerStages(uint32_t max_mixer_stages);
@@ -51,6 +50,8 @@
virtual void GetFrameBufferResolution(uint32_t *x_pixels, uint32_t *y_pixels);
virtual void GetPanelResolution(uint32_t *x_pixels, uint32_t *y_pixels);
virtual int SetDisplayStatus(uint32_t display_status);
+ virtual int Perform(uint32_t operation, ...);
+ virtual ~HWCDisplay() { }
protected:
enum DisplayStatus {
@@ -88,7 +89,6 @@
};
HWCDisplay(CoreInterface *core_intf, hwc_procs_t const **hwc_procs, DisplayType type, int id);
- virtual ~HWCDisplay() { }
// DisplayEventHandler methods
virtual DisplayError VSync(const DisplayEventVSync &vsync);
@@ -128,7 +128,6 @@
LayerStack layer_stack_;
LayerStackCache layer_stack_cache_;
bool flush_;
- LayerBuffer *output_buffer_;
uint32_t dump_frame_count_;
uint32_t dump_frame_index_;
bool dump_input_layers_;
@@ -147,6 +146,10 @@
void CommitLayerParams(hwc_layer_1_t *hwc_layer, Layer *layer);
};
+inline int HWCDisplay::Perform(uint32_t operation, ...) {
+ return 0;
+}
+
} // namespace sdm
#endif // __HWC_DISPLAY_H__
diff --git a/sdm/libs/hwc/hwc_display_external.cpp b/sdm/libs/hwc/hwc_display_external.cpp
index 52c64d1..c3a07e7 100644
--- a/sdm/libs/hwc/hwc_display_external.cpp
+++ b/sdm/libs/hwc/hwc_display_external.cpp
@@ -37,21 +37,63 @@
namespace sdm {
-HWCDisplayExternal::HWCDisplayExternal(CoreInterface *core_intf, hwc_procs_t const **hwc_procs)
- : HWCDisplay(core_intf, hwc_procs, kHDMI, HWC_DISPLAY_EXTERNAL) {
+static void AdjustSourceResolution(uint32_t dst_width, uint32_t dst_height, uint32_t *src_width,
+ uint32_t *src_height) {
+ *src_height = (dst_width * (*src_height)) / (*src_width);
+ *src_width = dst_width;
}
-int HWCDisplayExternal::Init() {
- int status = 0;
+int HWCDisplayExternal::Create(CoreInterface *core_intf, hwc_procs_t const **hwc_procs,
+ uint32_t primary_width, uint32_t primary_height,
+ HWCDisplay **hwc_display) {
+ uint32_t external_width = 0;
+ uint32_t external_height = 0;
+ char property[PROPERTY_VALUE_MAX];
- status = HWCDisplay::Init();
- if (status != 0) {
+ HWCDisplay *hwc_display_external = new HWCDisplayExternal(core_intf, hwc_procs);
+ int status = hwc_display_external->Init();
+ if (status) {
+ delete hwc_display_external;
return status;
}
+ hwc_display_external->GetPanelResolution(&external_width, &external_height);
+
+ int downscale_enabled = 0;
+ HWCDebugHandler::Get()->GetProperty("sdm.debug.sde_downscale_enabled", &downscale_enabled);
+ if (downscale_enabled == 1) {
+ uint32_t primary_area = primary_width * primary_height;
+ uint32_t external_area = external_width * external_height;
+
+ if (primary_area > external_area) {
+ if (primary_height > primary_width) {
+ Swap(primary_height, primary_width);
+ }
+ AdjustSourceResolution(primary_width, primary_height,
+ &external_width, &external_height);
+ }
+ }
+
+ status = hwc_display_external->SetFrameBufferResolution(external_width, external_height);
+ if (status) {
+ Destroy(hwc_display_external);
+ return status;
+ }
+
+ *hwc_display = hwc_display_external;
+
return status;
}
+void HWCDisplayExternal::Destroy(HWCDisplay *hwc_display) {
+ hwc_display->Deinit();
+ delete hwc_display;
+}
+
+HWCDisplayExternal::HWCDisplayExternal(CoreInterface *core_intf, hwc_procs_t const **hwc_procs)
+ : HWCDisplay(core_intf, hwc_procs, kHDMI, HWC_DISPLAY_EXTERNAL) {
+}
+
int HWCDisplayExternal::Prepare(hwc_display_contents_1_t *content_list) {
int status = 0;
@@ -109,11 +151,11 @@
}
// Read user defined width and height ratio
- char property[PROPERTY_VALUE_MAX];
- property_get("persist.sys.actionsafe.width", property, "0");
- float width_ratio = FLOAT(atoi(property)) / 100.0f;
- property_get("persist.sys.actionsafe.height", property, "0");
- float height_ratio = FLOAT(atoi(property)) / 100.0f;
+ int width = 0, height = 0;
+ HWCDebugHandler::Get()->GetProperty("sdm.external_action_safe_width", &width);
+ float width_ratio = FLOAT(width) / 100.0f;
+ HWCDebugHandler::Get()->GetProperty("sdm.external_action_safe_height", &height);
+ float height_ratio = FLOAT(height) / 100.0f;
if (width_ratio == 0.0f || height_ratio == 0.0f) {
return;
diff --git a/sdm/libs/hwc/hwc_display_external.h b/sdm/libs/hwc/hwc_display_external.h
index 6d3e229..a98ade3 100644
--- a/sdm/libs/hwc/hwc_display_external.h
+++ b/sdm/libs/hwc/hwc_display_external.h
@@ -31,13 +31,16 @@
class HWCDisplayExternal : public HWCDisplay {
public:
- explicit HWCDisplayExternal(CoreInterface *core_intf, hwc_procs_t const **hwc_procs);
- virtual int Init();
+ static int Create(CoreInterface *core_intf, hwc_procs_t const **hwc_procs, uint32_t primary_width,
+ uint32_t primary_height, HWCDisplay **hwc_display);
+ static void Destroy(HWCDisplay *hwc_display);
virtual int Prepare(hwc_display_contents_1_t *content_list);
virtual int Commit(hwc_display_contents_1_t *content_list);
virtual int GetDisplayConfigs(uint32_t *configs, size_t *num_configs);
+
private:
- virtual void ApplyScanAdjustment(hwc_rect_t *display_frame);
+ HWCDisplayExternal(CoreInterface *core_intf, hwc_procs_t const **hwc_procs);
+ void ApplyScanAdjustment(hwc_rect_t *display_frame);
};
} // namespace sdm
diff --git a/sdm/libs/hwc/hwc_display_primary.cpp b/sdm/libs/hwc/hwc_display_primary.cpp
index 53110ca..60505b0 100644
--- a/sdm/libs/hwc/hwc_display_primary.cpp
+++ b/sdm/libs/hwc/hwc_display_primary.cpp
@@ -27,7 +27,9 @@
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include <cutils/properties.h>
#include <utils/constants.h>
+#include <stdarg.h>
#include "hwc_display_primary.h"
#include "hwc_debugger.h"
@@ -36,6 +38,51 @@
namespace sdm {
+int HWCDisplayPrimary::Create(CoreInterface *core_intf, hwc_procs_t const **hwc_procs,
+ HWCDisplay **hwc_display) {
+ int status = 0;
+ uint32_t primary_width = 0;
+ uint32_t primary_height = 0;
+ char property[PROPERTY_VALUE_MAX];
+
+ HWCDisplay *hwc_display_primary = new HWCDisplayPrimary(core_intf, hwc_procs);
+ status = hwc_display_primary->Init();
+ if (status) {
+ delete hwc_display_primary;
+ return status;
+ }
+
+ status = hwc_display_primary->SetPowerMode(HWC_POWER_MODE_NORMAL);
+ if (status) {
+ Destroy(hwc_display_primary);
+ return status;
+ }
+
+ hwc_display_primary->GetPanelResolution(&primary_width, &primary_height);
+ int width = 0, height = 0;
+ HWCDebugHandler::Get()->GetProperty("sdm.fb_size_width", &width);
+ HWCDebugHandler::Get()->GetProperty("sdm.fb_size_height", &height);
+ if (width > 0 && height > 0) {
+ primary_width = width;
+ primary_height = height;
+ }
+
+ status = hwc_display_primary->SetFrameBufferResolution(primary_width, primary_height);
+ if (status) {
+ Destroy(hwc_display_primary);
+ return status;
+ }
+
+ *hwc_display = hwc_display_primary;
+
+ return status;
+}
+
+void HWCDisplayPrimary::Destroy(HWCDisplay *hwc_display) {
+ hwc_display->Deinit();
+ delete hwc_display;
+}
+
HWCDisplayPrimary::HWCDisplayPrimary(CoreInterface *core_intf, hwc_procs_t const **hwc_procs)
: HWCDisplay(core_intf, hwc_procs, kPrimary, HWC_DISPLAY_PRIMARY) {
}
@@ -76,16 +123,6 @@
return 0;
}
-DisplayError HWCDisplayPrimary::SetDisplayMode(uint32_t mode) {
- DisplayError error = kErrorNone;
-
- if (display_intf_) {
- error = display_intf_->SetDisplayMode(mode);
- }
-
- return error;
-}
-
int HWCDisplayPrimary::SetActiveConfig(uint32_t index) {
DisplayError error = kErrorNone;
@@ -106,6 +143,39 @@
return error;
}
+int HWCDisplayPrimary::Perform(uint32_t operation, ...) {
+ va_list args;
+ va_start(args, operation);
+ int val = va_arg(args, uint32_t);
+ va_end(args);
+ switch (operation) {
+ case SET_METADATA_DYN_REFRESH_RATE:
+ SetMetaDataRefreshRateFlag(val);
+ break;
+ case SET_BINDER_DYN_REFRESH_RATE:
+ SetRefreshRate(val);
+ break;
+ case SET_DISPLAY_MODE:
+ SetDisplayMode(val);
+ break;
+ default:
+ DLOGW("Invalid operation %d", operation);
+ return -EINVAL;
+ }
+
+ return 0;
+}
+
+DisplayError HWCDisplayPrimary::SetDisplayMode(uint32_t mode) {
+ DisplayError error = kErrorNone;
+
+ if (display_intf_) {
+ error = display_intf_->SetDisplayMode(mode);
+ }
+
+ return error;
+}
+
void HWCDisplayPrimary::SetMetaDataRefreshRateFlag(bool enable) {
use_metadata_refresh_rate_ = enable;
}
diff --git a/sdm/libs/hwc/hwc_display_primary.h b/sdm/libs/hwc/hwc_display_primary.h
index e862508..2b923a3 100644
--- a/sdm/libs/hwc/hwc_display_primary.h
+++ b/sdm/libs/hwc/hwc_display_primary.h
@@ -31,13 +31,25 @@
class HWCDisplayPrimary : public HWCDisplay {
public:
- explicit HWCDisplayPrimary(CoreInterface *core_intf, hwc_procs_t const **hwc_procs);
+ enum {
+ SET_METADATA_DYN_REFRESH_RATE,
+ SET_BINDER_DYN_REFRESH_RATE,
+ SET_DISPLAY_MODE,
+ };
+
+ static int Create(CoreInterface *core_intf, hwc_procs_t const **hwc_procs,
+ HWCDisplay **hwc_display);
+ static void Destroy(HWCDisplay *hwc_display);
virtual int Prepare(hwc_display_contents_1_t *content_list);
virtual int Commit(hwc_display_contents_1_t *content_list);
- virtual DisplayError SetDisplayMode(uint32_t mode);
virtual int SetActiveConfig(uint32_t index);
virtual int SetRefreshRate(uint32_t refresh_rate);
- virtual void SetMetaDataRefreshRateFlag(bool enable);
+ virtual int Perform(uint32_t operation, ...);
+
+ private:
+ HWCDisplayPrimary(CoreInterface *core_intf, hwc_procs_t const **hwc_procs);
+ void SetMetaDataRefreshRateFlag(bool enable);
+ virtual DisplayError SetDisplayMode(uint32_t mode);
};
} // namespace sdm
diff --git a/sdm/libs/hwc/hwc_display_virtual.cpp b/sdm/libs/hwc/hwc_display_virtual.cpp
index d36a171..319c0ee 100644
--- a/sdm/libs/hwc/hwc_display_virtual.cpp
+++ b/sdm/libs/hwc/hwc_display_virtual.cpp
@@ -29,6 +29,8 @@
#include <utils/constants.h>
#include <sync/sync.h>
+#include <stdarg.h>
+#include <gr.h>
#include "hwc_display_virtual.h"
#include "hwc_debugger.h"
@@ -37,9 +39,67 @@
namespace sdm {
+static int GetWidthFromMetaData(const private_handle_t *handle) {
+ MetaData_t *metadata = reinterpret_cast<MetaData_t *>(handle->base_metadata);
+ if (metadata && metadata->operation & UPDATE_BUFFER_GEOMETRY) {
+ return metadata->bufferDim.sliceWidth;
+ }
+
+ return handle->width;
+}
+
+static int GetHeightFromMetaData(const private_handle_t *handle) {
+ MetaData_t *metadata = reinterpret_cast<MetaData_t *>(handle->base_metadata);
+ if (metadata && metadata->operation & UPDATE_BUFFER_GEOMETRY) {
+ return metadata->bufferDim.sliceHeight;
+ }
+
+ return handle->height;
+}
+
+int HWCDisplayVirtual::Create(CoreInterface *core_intf, hwc_procs_t const **hwc_procs,
+ hwc_display_contents_1_t *content_list,
+ HWCDisplay **hwc_display) {
+ int status = 0;
+ HWCDisplay *hwc_display_virtual = new HWCDisplayVirtual(core_intf, hwc_procs);
+
+ status = hwc_display_virtual->Init();
+ if (status) {
+ delete hwc_display_virtual;
+ return status;
+ }
+
+ status = hwc_display_virtual->SetPowerMode(HWC_POWER_MODE_NORMAL);
+ if (status) {
+ Destroy(hwc_display_virtual);
+ return status;
+ }
+
+ const private_handle_t *output_handle =
+ static_cast<const private_handle_t *>(content_list->outbuf);
+ int virtual_width = 0;
+ int virtual_height = 0;
+ getBufferSizeAndDimensions(output_handle->width, output_handle->height, output_handle->format,
+ virtual_width, virtual_height);
+ status = hwc_display_virtual->SetFrameBufferResolution(virtual_width, virtual_height);
+ if (status) {
+ Destroy(hwc_display_virtual);
+ return status;
+ }
+
+ *hwc_display = hwc_display_virtual;
+
+ return status;
+}
+
+void HWCDisplayVirtual::Destroy(HWCDisplay *hwc_display) {
+ hwc_display->Deinit();
+ delete hwc_display;
+}
+
HWCDisplayVirtual::HWCDisplayVirtual(CoreInterface *core_intf, hwc_procs_t const **hwc_procs)
: HWCDisplay(core_intf, hwc_procs, kVirtual, HWC_DISPLAY_VIRTUAL),
- dump_output_layer_(false) {
+ dump_output_layer_(false), output_buffer_(NULL) {
}
int HWCDisplayVirtual::Init() {
@@ -70,6 +130,12 @@
int HWCDisplayVirtual::Prepare(hwc_display_contents_1_t *content_list) {
int status = 0;
+
+ status = SetOutputSliceFromMetadata(content_list);
+ if (status) {
+ return status;
+ }
+
if (display_paused_) {
MarkLayersForGPUBypass(content_list);
return status;
@@ -132,7 +198,7 @@
return 0;
}
-int HWCDisplayVirtual::SetActiveConfig(hwc_display_contents_1_t *content_list) {
+int HWCDisplayVirtual::SetOutputSliceFromMetadata(hwc_display_contents_1_t *content_list) {
const private_handle_t *output_handle =
static_cast<const private_handle_t *>(content_list->outbuf);
DisplayError error = kErrorNone;
@@ -144,8 +210,8 @@
return -EINVAL;
}
- int active_width = GetWidth(output_handle);
- int active_height = GetHeight(output_handle);
+ int active_width = GetWidthFromMetaData(output_handle);
+ int active_height = GetHeightFromMetaData(output_handle);
if ((active_width != INT(output_buffer_->width)) ||
(active_height!= INT(output_buffer_->height)) ||
@@ -186,8 +252,8 @@
return -EINVAL;
}
- output_buffer_->width = GetWidth(output_handle);
- output_buffer_->height = GetHeight(output_handle);
+ output_buffer_->width = GetWidthFromMetaData(output_handle);
+ output_buffer_->height = GetHeightFromMetaData(output_handle);
output_buffer_->flags.secure = 0;
output_buffer_->flags.video = 0;
@@ -256,23 +322,5 @@
DLOGI("output_layer_dump_enable %d", dump_output_layer_);
}
-int HWCDisplayVirtual::GetWidth(const private_handle_t* handle) {
- MetaData_t *metadata = reinterpret_cast<MetaData_t *>(handle->base_metadata);
- if (metadata && metadata->operation & UPDATE_BUFFER_GEOMETRY) {
- return metadata->bufferDim.sliceWidth;
- }
-
- return handle->width;
-}
-
-int HWCDisplayVirtual::GetHeight(const private_handle_t* handle) {
- MetaData_t *metadata = reinterpret_cast<MetaData_t *>(handle->base_metadata);
- if (metadata && metadata->operation & UPDATE_BUFFER_GEOMETRY) {
- return metadata->bufferDim.sliceHeight;
- }
-
- return handle->height;
-}
-
} // namespace sdm
diff --git a/sdm/libs/hwc/hwc_display_virtual.h b/sdm/libs/hwc/hwc_display_virtual.h
index 74285d7..e680f71 100644
--- a/sdm/libs/hwc/hwc_display_virtual.h
+++ b/sdm/libs/hwc/hwc_display_virtual.h
@@ -33,23 +33,30 @@
class HWCDisplayVirtual : public HWCDisplay {
public:
- explicit HWCDisplayVirtual(CoreInterface *core_intf, hwc_procs_t const **hwc_procs);
+ static int Create(CoreInterface *core_intf, hwc_procs_t const **hwc_procs,
+ hwc_display_contents_1_t *content_list, HWCDisplay **hwc_display);
+ static void Destroy(HWCDisplay *hwc_display);
+ static bool IsValidContentList(hwc_display_contents_1_t *content_list);
virtual int Init();
virtual int Deinit();
virtual int Prepare(hwc_display_contents_1_t *content_list);
virtual int Commit(hwc_display_contents_1_t *content_list);
- virtual int SetActiveConfig(hwc_display_contents_1_t *content_list);
virtual void SetFrameDumpConfig(uint32_t count, uint32_t bit_mask_layer_type);
private:
+ HWCDisplayVirtual(CoreInterface *core_intf, hwc_procs_t const **hwc_procs);
int SetOutputBuffer(hwc_display_contents_1_t *content_list);
void DumpOutputBuffer(hwc_display_contents_1_t *content_list);
- int GetWidth(const private_handle_t* handle);
- int GetHeight(const private_handle_t* handle);
+ int SetOutputSliceFromMetadata(hwc_display_contents_1_t *content_list);
bool dump_output_layer_;
+ LayerBuffer *output_buffer_;
};
+inline bool HWCDisplayVirtual::IsValidContentList(hwc_display_contents_1_t *content_list) {
+ return (content_list && content_list->numHwLayers > 0 && content_list->outbuf);
+}
+
} // namespace sdm
#endif // __HWC_DISPLAY_VIRTUAL_H__
diff --git a/sdm/libs/hwc/hwc_session.cpp b/sdm/libs/hwc/hwc_session.cpp
index 81db3a8..b0ff93d 100644
--- a/sdm/libs/hwc/hwc_session.cpp
+++ b/sdm/libs/hwc/hwc_session.cpp
@@ -45,6 +45,8 @@
#include "hwc_buffer_sync_handler.h"
#include "hwc_session.h"
#include "hwc_debugger.h"
+#include "hwc_display_primary.h"
+#include "hwc_display_virtual.h"
#define __CLASS__ "HWCSession"
@@ -73,8 +75,8 @@
bool HWCSession::reset_panel_ = false;
HWCSession::HWCSession(const hw_module_t *module) : core_intf_(NULL), hwc_procs_(NULL),
- display_primary_(NULL), display_external_(NULL), display_virtual_(NULL),
uevent_thread_exit_(false), uevent_thread_name_("HWC_UeventThread") {
+ memset(&hwc_display_, 0, sizeof(hwc_display_));
hwc_composer_device_1_t::common.tag = HARDWARE_DEVICE_TAG;
hwc_composer_device_1_t::common.version = HWC_DEVICE_API_VERSION_1_4;
hwc_composer_device_1_t::common.module = const_cast<hw_module_t*>(module);
@@ -120,7 +122,7 @@
return -ENOMEM;
}
- DisplayError error = CoreInterface::CreateCore(this, HWCDebugHandler::Get(), buffer_allocator_,
+ DisplayError error = CoreInterface::CreateCore(HWCDebugHandler::Get(), buffer_allocator_,
buffer_sync_handler_, &core_intf_);
if (error != kErrorNone) {
DLOGE("Display core initialization failed. Error = %d", error);
@@ -128,44 +130,27 @@
}
// Create and power on primary display
- display_primary_ = new HWCDisplayPrimary(core_intf_, &hwc_procs_);
- if (!display_primary_) {
- CoreInterface::DestroyCore();
- return -ENOMEM;
- }
-
- status = display_primary_->Init();
+ status = HWCDisplayPrimary::Create(core_intf_, &hwc_procs_,
+ &hwc_display_[HWC_DISPLAY_PRIMARY]);
if (status) {
CoreInterface::DestroyCore();
- delete display_primary_;
- return status;
- }
-
- status = display_primary_->SetPowerMode(HWC_POWER_MODE_NORMAL);
- if (status) {
- display_primary_->Deinit();
- delete display_primary_;
- CoreInterface::DestroyCore();
return status;
}
if (pthread_create(&uevent_thread_, NULL, &HWCUeventThread, this) < 0) {
DLOGE("Failed to start = %s, error = %s", uevent_thread_name_);
- display_primary_->Deinit();
- delete display_primary_;
+ HWCDisplayPrimary::Destroy(hwc_display_[HWC_DISPLAY_PRIMARY]);
+ hwc_display_[HWC_DISPLAY_PRIMARY] = 0;
CoreInterface::DestroyCore();
return -errno;
}
- SetFrameBufferResolution(HWC_DISPLAY_PRIMARY, NULL);
-
return 0;
}
int HWCSession::Deinit() {
- display_primary_->SetPowerMode(HWC_POWER_MODE_OFF);
- display_primary_->Deinit();
- delete display_primary_;
+ HWCDisplayPrimary::Destroy(hwc_display_[HWC_DISPLAY_PRIMARY]);
+ hwc_display_[HWC_DISPLAY_PRIMARY] = 0;
uevent_thread_exit_ = true;
pthread_join(uevent_thread_, NULL);
@@ -233,34 +218,17 @@
hwc_session->ResetPanel();
}
- for (ssize_t i = (num_displays-1); i >= 0; i--) {
- hwc_display_contents_1_t *content_list = displays[i];
+ for (ssize_t dpy = (num_displays - 1); dpy >= 0; dpy--) {
+ hwc_display_contents_1_t *content_list = displays[dpy];
+ if (dpy == HWC_DISPLAY_VIRTUAL) {
+ if (hwc_session->hwc_display_[HWC_DISPLAY_EXTERNAL]) {
+ continue;
+ }
+ hwc_session->HandleVirtualDisplayLifeCycle(content_list);
+ }
- switch (i) {
- case HWC_DISPLAY_PRIMARY:
- hwc_session->display_primary_->Prepare(content_list);
- break;
- case HWC_DISPLAY_EXTERNAL:
- if (hwc_session->display_external_) {
- hwc_session->display_external_->Prepare(content_list);
- }
- break;
- case HWC_DISPLAY_VIRTUAL:
- if (hwc_session->display_external_) {
- break;
- }
- if (hwc_session->ValidateContentList(content_list)) {
- hwc_session->CreateVirtualDisplay(content_list);
- } else {
- hwc_session->DestroyVirtualDisplay();
- }
-
- if (hwc_session->display_virtual_) {
- hwc_session->display_virtual_->Prepare(content_list);
- }
- break;
- default:
- break;
+ if (hwc_session->hwc_display_[dpy]) {
+ hwc_session->hwc_display_[dpy]->Prepare(content_list);
}
}
@@ -280,20 +248,10 @@
HWCSession *hwc_session = static_cast<HWCSession *>(device);
- for (size_t i = 0; i < num_displays; i++) {
- hwc_display_contents_1_t *content_list = displays[i];
-
- switch (i) {
- case HWC_DISPLAY_PRIMARY:
- hwc_session->display_primary_->Commit(content_list);
- break;
- case HWC_DISPLAY_EXTERNAL:
- if (hwc_session->display_external_) {
- hwc_session->display_external_->Commit(content_list);
- }
- break;
- case HWC_DISPLAY_VIRTUAL:
- if (hwc_session->display_external_) {
+ for (size_t dpy = 0; dpy < num_displays; dpy++) {
+ hwc_display_contents_1_t *content_list = displays[dpy];
+ if (dpy == HWC_DISPLAY_VIRTUAL) {
+ if (hwc_session->hwc_display_[HWC_DISPLAY_EXTERNAL]) {
if (content_list) {
for (size_t i = 0; i < content_list->numHwLayers; i++) {
if (content_list->hwLayers[i].acquireFenceFd >= 0) {
@@ -308,12 +266,10 @@
content_list->retireFenceFd = -1;
}
}
- if (hwc_session->display_virtual_) {
- hwc_session->display_virtual_->Commit(content_list);
- }
- break;
- default:
- break;
+ }
+
+ if (hwc_session->hwc_display_[dpy]) {
+ hwc_session->hwc_display_[dpy]->Commit(content_list);
}
}
@@ -330,20 +286,8 @@
HWCSession *hwc_session = static_cast<HWCSession *>(device);
int status = -EINVAL;
-
- switch (disp) {
- case HWC_DISPLAY_PRIMARY:
- status = hwc_session->display_primary_->EventControl(event, enable);
- break;
- case HWC_DISPLAY_EXTERNAL:
- if (hwc_session->display_external_) {
- status = hwc_session->display_external_->EventControl(event, enable);
- }
- break;
- case HWC_DISPLAY_VIRTUAL:
- break;
- default:
- status = -EINVAL;
+ if (hwc_session->hwc_display_[disp]) {
+ status = hwc_session->hwc_display_[disp]->EventControl(event, enable);
}
return status;
@@ -358,24 +302,13 @@
HWCSession *hwc_session = static_cast<HWCSession *>(device);
int status = -EINVAL;
-
- switch (disp) {
- case HWC_DISPLAY_PRIMARY:
- status = hwc_session->display_primary_->SetPowerMode(mode);
- // Set the power mode for virtual display while setting power mode for primary, as surfaceflinger
- // does not invoke SetPowerMode() for virtual display.
- case HWC_DISPLAY_VIRTUAL:
- if (hwc_session->display_virtual_) {
- status = hwc_session->display_virtual_->SetPowerMode(mode);
- }
- break;
- case HWC_DISPLAY_EXTERNAL:
- if (hwc_session->display_external_) {
- status = hwc_session->display_external_->SetPowerMode(mode);
- }
- break;
- default:
- status = -EINVAL;
+ if (hwc_session->hwc_display_[disp]) {
+ status = hwc_session->hwc_display_[disp]->SetPowerMode(mode);
+ }
+ if (disp == HWC_DISPLAY_PRIMARY && hwc_session->hwc_display_[HWC_DISPLAY_VIRTUAL]) {
+ // Set the power mode for virtual display while setting power mode for primary, as SF
+ // does not invoke SetPowerMode() for virtual display.
+ status = hwc_session->hwc_display_[HWC_DISPLAY_VIRTUAL]->SetPowerMode(mode);
}
return status;
@@ -420,23 +353,8 @@
HWCSession *hwc_session = static_cast<HWCSession *>(device);
int status = -EINVAL;
-
- switch (disp) {
- case HWC_DISPLAY_PRIMARY:
- status = hwc_session->display_primary_->GetDisplayConfigs(configs, num_configs);
- break;
- case HWC_DISPLAY_EXTERNAL:
- if (hwc_session->display_external_) {
- status = hwc_session->display_external_->GetDisplayConfigs(configs, num_configs);
- }
- break;
- case HWC_DISPLAY_VIRTUAL:
- if (hwc_session->display_virtual_) {
- status = hwc_session->display_virtual_->GetDisplayConfigs(configs, num_configs);
- }
- break;
- default:
- status = -EINVAL;
+ if (hwc_session->hwc_display_[disp]) {
+ status = hwc_session->hwc_display_[disp]->GetDisplayConfigs(configs, num_configs);
}
return status;
@@ -452,23 +370,8 @@
HWCSession *hwc_session = static_cast<HWCSession *>(device);
int status = -EINVAL;
-
- switch (disp) {
- case HWC_DISPLAY_PRIMARY:
- status = hwc_session->display_primary_->GetDisplayAttributes(config, attributes, values);
- break;
- case HWC_DISPLAY_EXTERNAL:
- if (hwc_session->display_external_) {
- status = hwc_session->display_external_->GetDisplayAttributes(config, attributes, values);
- }
- break;
- case HWC_DISPLAY_VIRTUAL:
- if (hwc_session->display_virtual_) {
- status = hwc_session->display_virtual_->GetDisplayAttributes(config, attributes, values);
- }
- break;
- default:
- status = -EINVAL;
+ if (hwc_session->hwc_display_[disp]) {
+ status = hwc_session->hwc_display_[disp]->GetDisplayAttributes(config, attributes, values);
}
return status;
@@ -483,23 +386,8 @@
HWCSession *hwc_session = static_cast<HWCSession *>(device);
int active_config = -1;
-
- switch (disp) {
- case HWC_DISPLAY_PRIMARY:
- active_config = hwc_session->display_primary_->GetActiveConfig();
- break;
- case HWC_DISPLAY_EXTERNAL:
- if (hwc_session->display_external_) {
- active_config = hwc_session->display_external_->GetActiveConfig();
- }
- break;
- case HWC_DISPLAY_VIRTUAL:
- if (hwc_session->display_virtual_) {
- active_config = hwc_session->display_virtual_->GetActiveConfig();
- }
- break;
- default:
- active_config = -1;
+ if (hwc_session->hwc_display_[disp]) {
+ active_config = hwc_session->hwc_display_[disp]->GetActiveConfig();
}
return active_config;
@@ -514,72 +402,26 @@
HWCSession *hwc_session = static_cast<HWCSession *>(device);
int status = -EINVAL;
-
- switch (disp) {
- case HWC_DISPLAY_PRIMARY:
- status = hwc_session->display_primary_->SetActiveConfig(index);
- break;
- case HWC_DISPLAY_EXTERNAL:
- if (hwc_session->display_external_) {
- // TODO(user): Uncomment it. HDMI does not support resolution change currently.
- status = 0; // hwc_session->display_external_->SetActiveConfig(index);
- }
- break;
- case HWC_DISPLAY_VIRTUAL:
- break;
- default:
- status = -EINVAL;
+ if (hwc_session->hwc_display_[disp]) {
+ status = hwc_session->hwc_display_[disp]->SetActiveConfig(index);
}
return status;
}
-bool HWCSession::ValidateContentList(hwc_display_contents_1_t *content_list) {
- return (content_list && content_list->numHwLayers > 0 && content_list->outbuf);
-}
-
-int HWCSession::CreateVirtualDisplay(hwc_display_contents_1_t *content_list) {
+int HWCSession::HandleVirtualDisplayLifeCycle(hwc_display_contents_1_t *content_list) {
int status = 0;
- if (!display_virtual_) {
- // Create virtual display device
- display_virtual_ = new HWCDisplayVirtual(core_intf_, &hwc_procs_);
- if (!display_virtual_) {
- // This is not catastrophic. Leave a warning message for now.
- DLOGW("Virtual Display creation failed");
- return -ENOMEM;
+ if (HWCDisplayVirtual::IsValidContentList(content_list)) {
+ if (!hwc_display_[HWC_DISPLAY_VIRTUAL]) {
+ // Create virtual display device
+ status = HWCDisplayVirtual::Create(core_intf_, &hwc_procs_, content_list,
+ &hwc_display_[HWC_DISPLAY_VIRTUAL]);
}
-
- status = display_virtual_->Init();
- if (status) {
- goto CleanupOnError;
- }
-
- status = display_virtual_->SetPowerMode(HWC_POWER_MODE_NORMAL);
- if (status) {
- goto CleanupOnError;
- }
- }
-
- if (display_virtual_) {
- SetFrameBufferResolution(HWC_DISPLAY_VIRTUAL, content_list);
- status = display_virtual_->SetActiveConfig(content_list);
- }
-
- return status;
-
-CleanupOnError:
- return DestroyVirtualDisplay();
-}
-
-int HWCSession::DestroyVirtualDisplay() {
- int status = 0;
-
- if (display_virtual_) {
- status = display_virtual_->Deinit();
- if (!status) {
- delete display_virtual_;
- display_virtual_ = NULL;
+ } else {
+ if (hwc_display_[HWC_DISPLAY_VIRTUAL]) {
+ HWCDisplayVirtual::Destroy(hwc_display_[HWC_DISPLAY_VIRTUAL]);
+ hwc_display_[HWC_DISPLAY_VIRTUAL] = 0;
// Signal the HotPlug thread to continue with the external display connection
locker_.Signal();
}
@@ -588,10 +430,6 @@
return status;
}
-DisplayError HWCSession::Hotplug(const CoreEventHotplug &hotplug) {
- return kErrorNone;
-}
-
android::status_t HWCSession::notifyCallback(uint32_t command, const android::Parcel *input_parcel,
android::Parcel */*output_parcel*/) {
SEQUENCE_WAIT_SCOPE_LOCK(locker_);
@@ -608,9 +446,9 @@
break;
case qService::IQService::SET_IDLE_TIMEOUT:
- if (display_primary_) {
+ if (hwc_display_[HWC_DISPLAY_PRIMARY]) {
uint32_t timeout = UINT32(input_parcel->readInt32());
- display_primary_->SetIdleTimeoutMs(timeout);
+ hwc_display_[HWC_DISPLAY_PRIMARY]->SetIdleTimeoutMs(timeout);
}
break;
@@ -647,62 +485,43 @@
android::status_t HWCSession::SetSecondaryDisplayStatus(const android::Parcel *input_parcel) {
uint32_t display_id = UINT32(input_parcel->readInt32());
uint32_t display_status = UINT32(input_parcel->readInt32());
- HWCDisplay *display = NULL;
DLOGI("Display %d Status %d", display_id, display_status);
- switch (display_id) {
- case HWC_DISPLAY_EXTERNAL:
- display = display_external_;
- break;
- case HWC_DISPLAY_VIRTUAL:
- display = display_virtual_;
- break;
- default:
+ if (display_id < HWC_DISPLAY_EXTERNAL || display_id > HWC_DISPLAY_VIRTUAL) {
DLOGW("Not supported for display %d", display_id);
return -EINVAL;
}
- return display->SetDisplayStatus(display_status);
+ return hwc_display_[display_id]->SetDisplayStatus(display_status);
}
android::status_t HWCSession::ConfigureRefreshRate(const android::Parcel *input_parcel) {
uint32_t operation = UINT32(input_parcel->readInt32());
-
switch (operation) {
- case qdutils::DISABLE_METADATA_DYN_REFRESH_RATE:
- display_primary_->SetMetaDataRefreshRateFlag(false);
- break;
-
- case qdutils::ENABLE_METADATA_DYN_REFRESH_RATE:
- display_primary_->SetMetaDataRefreshRateFlag(true);
- break;
-
- case qdutils::SET_BINDER_DYN_REFRESH_RATE:
- {
- uint32_t refresh_rate = UINT32(input_parcel->readInt32());
-
- display_primary_->SetRefreshRate(refresh_rate);
- break;
- }
-
- default:
- DLOGW("Invalid operation %d", operation);
- return -EINVAL;
+ case qdutils::DISABLE_METADATA_DYN_REFRESH_RATE:
+ return hwc_display_[HWC_DISPLAY_PRIMARY]->Perform(
+ HWCDisplayPrimary::SET_METADATA_DYN_REFRESH_RATE, false);
+ case qdutils::ENABLE_METADATA_DYN_REFRESH_RATE:
+ return hwc_display_[HWC_DISPLAY_PRIMARY]->Perform(
+ HWCDisplayPrimary::SET_METADATA_DYN_REFRESH_RATE, true);
+ case qdutils::SET_BINDER_DYN_REFRESH_RATE:
+ {
+ uint32_t refresh_rate = UINT32(input_parcel->readInt32());
+ return hwc_display_[HWC_DISPLAY_PRIMARY]->Perform(
+ HWCDisplayPrimary::SET_BINDER_DYN_REFRESH_RATE,
+ refresh_rate);
+ }
+ default:
+ DLOGW("Invalid operation %d", operation);
+ return -EINVAL;
}
return 0;
}
android::status_t HWCSession::SetDisplayMode(const android::Parcel *input_parcel) {
- DisplayError error = kErrorNone;
uint32_t mode = UINT32(input_parcel->readInt32());
-
- error = display_primary_->SetDisplayMode(mode);
- if (error != kErrorNone) {
- return -EINVAL;
- }
-
- return 0;
+ return hwc_display_[HWC_DISPLAY_PRIMARY]->Perform(HWCDisplayPrimary::SET_DISPLAY_MODE, mode);
}
android::status_t HWCSession::SetMaxMixerStages(const android::Parcel *input_parcel) {
@@ -711,8 +530,8 @@
uint32_t max_mixer_stages = UINT32(input_parcel->readInt32());
if (IS_BIT_SET(bit_mask_display_type, HWC_DISPLAY_PRIMARY)) {
- if (display_primary_) {
- error = display_primary_->SetMaxMixerStages(max_mixer_stages);
+ if (hwc_display_[HWC_DISPLAY_PRIMARY]) {
+ error = hwc_display_[HWC_DISPLAY_PRIMARY]->SetMaxMixerStages(max_mixer_stages);
if (error != kErrorNone) {
return -EINVAL;
}
@@ -720,8 +539,8 @@
}
if (IS_BIT_SET(bit_mask_display_type, HWC_DISPLAY_EXTERNAL)) {
- if (display_external_) {
- error = display_external_->SetMaxMixerStages(max_mixer_stages);
+ if (hwc_display_[HWC_DISPLAY_EXTERNAL]) {
+ error = hwc_display_[HWC_DISPLAY_EXTERNAL]->SetMaxMixerStages(max_mixer_stages);
if (error != kErrorNone) {
return -EINVAL;
}
@@ -729,8 +548,8 @@
}
if (IS_BIT_SET(bit_mask_display_type, HWC_DISPLAY_VIRTUAL)) {
- if (display_virtual_) {
- error = display_virtual_->SetMaxMixerStages(max_mixer_stages);
+ if (hwc_display_[HWC_DISPLAY_VIRTUAL]) {
+ error = hwc_display_[HWC_DISPLAY_VIRTUAL]->SetMaxMixerStages(max_mixer_stages);
if (error != kErrorNone) {
return -EINVAL;
}
@@ -746,20 +565,20 @@
uint32_t bit_mask_layer_type = UINT32(input_parcel->readInt32());
if (IS_BIT_SET(bit_mask_display_type, HWC_DISPLAY_PRIMARY)) {
- if (display_primary_) {
- display_primary_->SetFrameDumpConfig(frame_dump_count, bit_mask_layer_type);
+ if (hwc_display_[HWC_DISPLAY_PRIMARY]) {
+ hwc_display_[HWC_DISPLAY_PRIMARY]->SetFrameDumpConfig(frame_dump_count, bit_mask_layer_type);
}
}
if (IS_BIT_SET(bit_mask_display_type, HWC_DISPLAY_EXTERNAL)) {
- if (display_external_) {
- display_external_->SetFrameDumpConfig(frame_dump_count, bit_mask_layer_type);
+ if (hwc_display_[HWC_DISPLAY_EXTERNAL]) {
+ hwc_display_[HWC_DISPLAY_EXTERNAL]->SetFrameDumpConfig(frame_dump_count, bit_mask_layer_type);
}
}
if (IS_BIT_SET(bit_mask_display_type, HWC_DISPLAY_VIRTUAL)) {
- if (display_virtual_) {
- display_virtual_->SetFrameDumpConfig(frame_dump_count, bit_mask_layer_type);
+ if (hwc_display_[HWC_DISPLAY_VIRTUAL]) {
+ hwc_display_[HWC_DISPLAY_VIRTUAL]->SetFrameDumpConfig(frame_dump_count, bit_mask_layer_type);
}
}
}
@@ -865,19 +684,19 @@
int status = -EINVAL;
DLOGI("Powering off primary");
- status = display_primary_->SetPowerMode(HWC_POWER_MODE_OFF);
+ status = hwc_display_[HWC_DISPLAY_PRIMARY]->SetPowerMode(HWC_POWER_MODE_OFF);
if (status) {
DLOGE("power-off on primary failed with error = %d", status);
}
DLOGI("Restoring power mode on primary");
- uint32_t mode = display_primary_->GetLastPowerMode();
- status = display_primary_->SetPowerMode(mode);
+ uint32_t mode = hwc_display_[HWC_DISPLAY_PRIMARY]->GetLastPowerMode();
+ status = hwc_display_[HWC_DISPLAY_PRIMARY]->SetPowerMode(mode);
if (status) {
DLOGE("Setting power mode = %d on primary failed with error = %d", mode, status);
}
- status = display_primary_->EventControl(HWC_EVENT_VSYNC, 1);
+ status = hwc_display_[HWC_DISPLAY_PRIMARY]->EventControl(HWC_EVENT_VSYNC, 1);
if (status) {
DLOGE("enabling vsync failed for primary with error = %d", status);
}
@@ -893,7 +712,7 @@
if (connected) {
SEQUENCE_WAIT_SCOPE_LOCK(locker_);
- if (display_virtual_) {
+ if (hwc_display_[HWC_DISPLAY_VIRTUAL]) {
// Wait for the virtual display to tear down
int status = locker_.WaitFinite(kExternalConnectionTimeoutMs);
if (status != 0) {
@@ -901,32 +720,28 @@
return -1;
}
}
- if (display_external_) {
+ if (hwc_display_[HWC_DISPLAY_EXTERNAL]) {
DLOGE("HDMI already connected");
return -1;
}
+
+ uint32_t primary_width = 0;
+ uint32_t primary_height = 0;
+ hwc_display_[HWC_DISPLAY_PRIMARY]->GetFrameBufferResolution(&primary_width, &primary_height);
// Create hdmi display
- display_external_ = new HWCDisplayExternal(core_intf_, &hwc_procs_);
- if (!display_external_) {
- return -1;
- }
- int status = display_external_->Init();
+ int status = HWCDisplayExternal::Create(core_intf_, &hwc_procs_, primary_width,
+ primary_height, &hwc_display_[HWC_DISPLAY_EXTERNAL]);
if (status) {
- delete display_external_;
- display_external_ = NULL;
- return -1;
+ return status;
}
- SetFrameBufferResolution(HWC_DISPLAY_EXTERNAL, NULL);
} else {
SEQUENCE_WAIT_SCOPE_LOCK(locker_);
- if (!display_external_) {
+ if (!hwc_display_[HWC_DISPLAY_EXTERNAL]) {
DLOGE("HDMI not connected");
return -1;
}
- display_external_->SetPowerMode(HWC_POWER_MODE_OFF);
- display_external_->Deinit();
- delete display_external_;
- display_external_ = NULL;
+ HWCDisplayExternal::Destroy(hwc_display_[HWC_DISPLAY_EXTERNAL]);
+ hwc_display_[HWC_DISPLAY_EXTERNAL] = 0;
}
// notify client and trigger a screen refresh
@@ -936,72 +751,5 @@
return 0;
}
-void HWCSession::SetFrameBufferResolution(int disp, hwc_display_contents_1_t *content_list) {
- char property[PROPERTY_VALUE_MAX];
- uint32_t primary_width = 0;
- uint32_t primary_height = 0;
-
- switch (disp) {
- case HWC_DISPLAY_PRIMARY:
- {
- display_primary_->GetPanelResolution(&primary_width, &primary_height);
- if (property_get("debug.hwc.fbsize", property, NULL) > 0) {
- char *yptr = strcasestr(property, "x");
- primary_width = atoi(property);
- primary_height = atoi(yptr + 1);
- }
- display_primary_->SetFrameBufferResolution(primary_width, primary_height);
- break;
- }
-
- case HWC_DISPLAY_EXTERNAL:
- {
- uint32_t external_width = 0;
- uint32_t external_height = 0;
- display_external_->GetPanelResolution(&external_width, &external_height);
-
- if (property_get("sys.hwc.mdp_downscale_enabled", property, "false") &&
- !strcmp(property, "true")) {
- display_primary_->GetFrameBufferResolution(&primary_width, &primary_height);
- uint32_t primary_area = primary_width * primary_height;
- uint32_t external_area = external_width * external_height;
-
- if (primary_area > external_area) {
- if (primary_height > primary_width) {
- Swap(primary_height, primary_width);
- }
- AdjustSourceResolution(primary_width, primary_height,
- &external_width, &external_height);
- }
- }
- display_external_->SetFrameBufferResolution(external_width, external_height);
- break;
- }
-
- case HWC_DISPLAY_VIRTUAL:
- {
- if (ValidateContentList(content_list)) {
- const private_handle_t *output_handle =
- static_cast<const private_handle_t *>(content_list->outbuf);
- int virtual_width = 0;
- int virtual_height = 0;
- getBufferSizeAndDimensions(output_handle->width, output_handle->height, output_handle->format,
- virtual_width, virtual_height);
- display_virtual_->SetFrameBufferResolution(virtual_width, virtual_height);
- }
- break;
- }
-
- default:
- break;
- }
-}
-
-void HWCSession::AdjustSourceResolution(uint32_t dst_width, uint32_t dst_height,
- uint32_t *src_width, uint32_t *src_height) {
- *src_height = (dst_width * (*src_height)) / (*src_width);
- *src_width = dst_width;
-}
-
} // namespace sdm
diff --git a/sdm/libs/hwc/hwc_session.h b/sdm/libs/hwc/hwc_session.h
index 15b762c..5f844eb 100644
--- a/sdm/libs/hwc/hwc_session.h
+++ b/sdm/libs/hwc/hwc_session.h
@@ -36,7 +36,7 @@
namespace sdm {
-class HWCSession : hwc_composer_device_1_t, CoreEventHandler, public qClient::BnQClient {
+class HWCSession : hwc_composer_device_1_t, public qClient::BnQClient {
public:
struct HWCModuleMethods : public hw_module_methods_t {
HWCModuleMethods() {
@@ -76,12 +76,7 @@
int GetEventValue(const char *uevent_data, int length, const char *event_info);
int HotPlugHandler(bool connected);
void ResetPanel();
- bool ValidateContentList(hwc_display_contents_1_t *content_list);
- int CreateVirtualDisplay(hwc_display_contents_1_t *content_list);
- int DestroyVirtualDisplay();
-
- // CoreEventHandler methods
- virtual DisplayError Hotplug(const CoreEventHotplug &hotplug);
+ int HandleVirtualDisplayLifeCycle(hwc_display_contents_1_t *content_list);
// QClient methods
virtual android::status_t notifyCallback(uint32_t command, const android::Parcel *input_parcel,
@@ -91,17 +86,12 @@
android::status_t SetMaxMixerStages(const android::Parcel *input_parcel);
android::status_t SetDisplayMode(const android::Parcel *input_parcel);
android::status_t SetSecondaryDisplayStatus(const android::Parcel *input_parcel);
- void SetFrameBufferResolution(int disp, hwc_display_contents_1_t *content_list);
- void AdjustSourceResolution(uint32_t dst_width, uint32_t dst_height,
- uint32_t *src_width, uint32_t *src_height);
android::status_t ConfigureRefreshRate(const android::Parcel *input_parcel);
static Locker locker_;
CoreInterface *core_intf_;
hwc_procs_t const *hwc_procs_;
- HWCDisplayPrimary *display_primary_;
- HWCDisplayExternal *display_external_;
- HWCDisplayVirtual *display_virtual_;
+ HWCDisplay *hwc_display_[HWC_NUM_DISPLAY_TYPES];
pthread_t uevent_thread_;
bool uevent_thread_exit_;
static bool reset_panel_;
diff --git a/sdm/libs/utils/debug.cpp b/sdm/libs/utils/debug.cpp
index abcfac1..cd7533b 100644
--- a/sdm/libs/utils/debug.cpp
+++ b/sdm/libs/utils/debug.cpp
@@ -40,7 +40,7 @@
uint32_t Debug::GetSimulationFlag() {
int value = 0;
- debug_.debug_handler_->GetProperty("debug.hwc.simulate", &value);
+ debug_.debug_handler_->GetProperty("sdm.composition_simulation", &value);
return value;
}
@@ -54,14 +54,14 @@
uint32_t Debug::GetIdleTimeoutMs() {
int value = IDLE_TIMEOUT_DEFAULT_MS;
- debug_.debug_handler_->GetProperty("debug.mdpcomp.idletime", &value);
+ debug_.debug_handler_->GetProperty("sdm.idle_time", &value);
return value;
}
bool Debug::IsRotatorDownScaleDisabled() {
int value = 0;
- debug_.debug_handler_->GetProperty("sdm.disable_rotator_downscaling", &value);
+ debug_.debug_handler_->GetProperty("sdm.debug.rotator_downscale", &value);
return (value == 1);
}
@@ -75,17 +75,36 @@
bool Debug::IsPartialUpdateEnabled() {
int value = 0;
- debug_.debug_handler_->GetProperty("sdm.hwc.partial_update", &value);
+ debug_.debug_handler_->GetProperty("sdm.partial_update", &value);
return (value == 1);
}
-int Debug::GetMaxPipesPerMixer() {
+int Debug::GetMaxPipesPerMixer(DisplayType display_type) {
int value = -1;
- debug_.debug_handler_->GetProperty("persist.hwc.mdpcomp.maxpermixer", &value);
+ switch (display_type) {
+ case kPrimary:
+ debug_.debug_handler_->GetProperty("sdm.primary.mixer_stages", &value);
+ break;
+ case kHDMI:
+ debug_.debug_handler_->GetProperty("sdm.external.mixer_stages", &value);
+ break;
+ case kVirtual:
+ debug_.debug_handler_->GetProperty("sdm.virtual.mixer_stages", &value);
+ break;
+ default:
+ break;
+ }
return value;
}
+bool Debug::IsVideoModeEnabled() {
+ int value = 0;
+ debug_.debug_handler_->GetProperty("sdm.video_mode_panel", &value);
+
+ return (value == 1);
+}
+
} // namespace sdm