summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRamkumar Radhakrishnan <ramkumar@codeaurora.org>2016-08-22 13:56:44 -0700
committerGerrit - the friendly Code Review server <code-review@localhost>2016-09-01 16:34:28 -0700
commitbee9c1acdd3a6910d5f4e57d39c4fe4d0ea9909d (patch)
tree9322ba200099a7920bc2d97647489582b9877e10
parent5353ccce11eedce467ab622b6d06263defe6a64f (diff)
downloadhardware_qcom_display-bee9c1acdd3a6910d5f4e57d39c4fe4d0ea9909d.tar.gz
hardware_qcom_display-bee9c1acdd3a6910d5f4e57d39c4fe4d0ea9909d.tar.bz2
hardware_qcom_display-bee9c1acdd3a6910d5f4e57d39c4fe4d0ea9909d.zip
sdm: Add rect mapping and interface to store actual resolution
1. Add rectangle mapping function to map a rectangle from one coordinate system to another coordinate system. 2. Add actual_width and actual_height in layer buffer to store the actual buffer resolution without alignment. 3. Populate actual width and height information of SDM layer buffer from private handle Change-Id: Ic4c03cc5779418959732332d26b8ecb59c2483b5 CRs-Fixed: 1040942
-rw-r--r--sdm/include/core/layer_buffer.h6
-rw-r--r--sdm/include/utils/rect.h2
-rw-r--r--sdm/libs/hwc/hwc_color_manager.cpp3
-rw-r--r--sdm/libs/hwc/hwc_display.cpp25
-rw-r--r--sdm/libs/hwc/hwc_display_virtual.cpp17
-rw-r--r--sdm/libs/utils/rect.cpp20
6 files changed, 55 insertions, 18 deletions
diff --git a/sdm/include/core/layer_buffer.h b/sdm/include/core/layer_buffer.h
index c437dab29..5ee441e4d 100644
--- a/sdm/include/core/layer_buffer.h
+++ b/sdm/include/core/layer_buffer.h
@@ -183,8 +183,10 @@ struct LayerBufferFlags {
@sa LayerStack
*/
struct LayerBuffer {
- uint32_t width = 0; //!< Actual width of the Layer that this buffer is for.
- uint32_t height = 0; //!< Actual height of the Layer that this buffer is for.
+ uint32_t width = 0; //!< Aligned width of the Layer that this buffer is for.
+ uint32_t height = 0; //!< Aligned height of the Layer that this buffer is for.
+ uint32_t real_width = 0; //!< Real width of the Layer that this buffer is for.
+ uint32_t real_height = 0; //!< Real height of the Layer that this buffer is for.
LayerBufferFormat format = kFormatRGBA8888; //!< Format of the buffer content.
LayerBufferPlane planes[4]; //!< Array of planes that this buffer contains. RGB buffer formats
//!< have 1 plane whereas YUV buffer formats may have upto 4 planes.
diff --git a/sdm/include/utils/rect.h b/sdm/include/utils/rect.h
index c19864560..7153f2b47 100644
--- a/sdm/include/utils/rect.h
+++ b/sdm/include/utils/rect.h
@@ -49,6 +49,8 @@ namespace sdm {
bool flip_horizontal, LayerRect *out_rects);
void SplitTopBottom(const LayerRect &in_rect, uint32_t split_count, uint32_t align_y,
bool flip_horizontal, LayerRect *out_rects);
+ void MapRect(const LayerRect &src_domain, const LayerRect &dst_domain, const LayerRect &in_rect,
+ LayerRect *out_rect);
} // namespace sdm
#endif // __RECT_H__
diff --git a/sdm/libs/hwc/hwc_color_manager.cpp b/sdm/libs/hwc/hwc_color_manager.cpp
index 5abe94a42..844c2b873 100644
--- a/sdm/libs/hwc/hwc_color_manager.cpp
+++ b/sdm/libs/hwc/hwc_color_manager.cpp
@@ -259,7 +259,8 @@ int HWCColorManager::CreateSolidFillLayers(HWCDisplay *hwc_display) {
// handle for solid fill layer with fd = -1.
private_handle_t *handle =
new private_handle_t(-1, 0, private_handle_t::PRIV_FLAGS_FRAMEBUFFER, BUFFER_TYPE_UI,
- HAL_PIXEL_FORMAT_RGBA_8888, primary_width, primary_height);
+ HAL_PIXEL_FORMAT_RGBA_8888, primary_width, primary_height,
+ primary_width, primary_height);
if (!buf || !handle) {
DLOGE("Failed to allocate memory.");
diff --git a/sdm/libs/hwc/hwc_display.cpp b/sdm/libs/hwc/hwc_display.cpp
index c6151e640..270e8f393 100644
--- a/sdm/libs/hwc/hwc_display.cpp
+++ b/sdm/libs/hwc/hwc_display.cpp
@@ -414,8 +414,17 @@ int HWCDisplay::PrepareLayerParams(hwc_layer_1_t *hwc_layer, Layer *layer) {
if (pvt_handle) {
layer_buffer->format = GetSDMFormat(pvt_handle->format, pvt_handle->flags);
- layer_buffer->width = pvt_handle->width;
- layer_buffer->height = pvt_handle->height;
+ int aligned_width, aligned_height;
+ int real_width, real_height;
+
+ AdrenoMemInfo::getInstance().getAlignedWidthAndHeight(pvt_handle, aligned_width,
+ aligned_height);
+ AdrenoMemInfo::getInstance().getRealWidthAndHeight(pvt_handle, real_width, real_height);
+
+ layer_buffer->width = aligned_width;
+ layer_buffer->height = aligned_height;
+ layer_buffer->real_width = real_width;
+ layer_buffer->real_height = real_height;
if (SetMetaData(pvt_handle, layer) != kErrorNone) {
return -EINVAL;
@@ -466,6 +475,8 @@ int HWCDisplay::PrepareLayerParams(hwc_layer_1_t *hwc_layer, Layer *layer) {
usage, aligned_width, aligned_height);
layer_buffer->width = aligned_width;
layer_buffer->height = aligned_height;
+ layer_buffer->real_width = x_pixels;
+ layer_buffer->real_height = y_pixels;
layer_buffer->format = GetSDMFormat(format, flags);
}
}
@@ -569,6 +580,8 @@ int HWCDisplay::PrePrepareLayerStack(hwc_display_contents_1_t *content_list) {
LayerBuffer *input_buffer = layer.input_buffer;
input_buffer->width = layer.dst_rect.right - layer.dst_rect.left;
input_buffer->height = layer.dst_rect.bottom - layer.dst_rect.top;
+ input_buffer->real_width = input_buffer->width;
+ input_buffer->real_height = input_buffer->height;
layer.src_rect.left = 0;
layer.src_rect.top = 0;
layer.src_rect.right = input_buffer->width;
@@ -1362,14 +1375,6 @@ DisplayError HWCDisplay::SetMetaData(const private_handle_t *pvt_handle, Layer *
layer_buffer->format = GetSDMFormat(meta_data->linearFormat, 0);
}
- if (meta_data->operation & UPDATE_BUFFER_GEOMETRY) {
- int actual_width = pvt_handle->width;
- int actual_height = pvt_handle->height;
- AdrenoMemInfo::getInstance().getAlignedWidthAndHeight(pvt_handle, actual_width, actual_height);
- layer_buffer->width = actual_width;
- layer_buffer->height = actual_height;
- }
-
if (meta_data->operation & SET_SINGLE_BUFFER_MODE) {
layer->flags.single_buffer = meta_data->isSingleBufferMode;
// Graphics can set this operation on all types of layers including FB and set the actual value
diff --git a/sdm/libs/hwc/hwc_display_virtual.cpp b/sdm/libs/hwc/hwc_display_virtual.cpp
index 47d78f257..712f02421 100644
--- a/sdm/libs/hwc/hwc_display_virtual.cpp
+++ b/sdm/libs/hwc/hwc_display_virtual.cpp
@@ -269,12 +269,19 @@ int HWCDisplayVirtual::SetOutputBuffer(hwc_display_contents_1_t *content_list) {
return -EINVAL;
}
- int output_buffer_width, output_buffer_height;
- AdrenoMemInfo::getInstance().getAlignedWidthAndHeight(output_handle, output_buffer_width,
- output_buffer_height);
+ int aligned_width, aligned_height;
+ int real_width, real_height;
+
+ AdrenoMemInfo::getInstance().getAlignedWidthAndHeight(output_handle, aligned_width,
+ aligned_height);
+ AdrenoMemInfo::getInstance().getRealWidthAndHeight(output_handle, real_width, real_height);
+
+ output_buffer_->width = aligned_width;
+ output_buffer_->height = aligned_height;
+
+ output_buffer_->real_width = real_width;
+ output_buffer_->real_height = real_height;
- output_buffer_->width = output_buffer_width;
- output_buffer_->height = output_buffer_height;
output_buffer_->flags.secure = 0;
output_buffer_->flags.video = 0;
diff --git a/sdm/libs/utils/rect.cpp b/sdm/libs/utils/rect.cpp
index e756464e6..5392aaa4b 100644
--- a/sdm/libs/utils/rect.cpp
+++ b/sdm/libs/utils/rect.cpp
@@ -198,5 +198,25 @@ void SplitTopBottom(const LayerRect &in_rect, uint32_t split_count, uint32_t ali
}
}
+void MapRect(const LayerRect &src_domain, const LayerRect &dst_domain, const LayerRect &in_rect,
+ LayerRect *out_rect) {
+ if (!IsValid(src_domain) || !IsValid(dst_domain) || !IsValid(in_rect)) {
+ return;
+ }
+
+ float src_domain_width = src_domain.right - src_domain.left;
+ float src_domain_height = src_domain.bottom - src_domain.top;
+ float dst_domain_width = dst_domain.right - dst_domain.left;
+ float dst_domain_height = dst_domain.bottom - dst_domain.top;
+
+ float width_ratio = dst_domain_width / src_domain_width;
+ float height_ratio = dst_domain_height / src_domain_height;
+
+ out_rect->left = dst_domain.left + (width_ratio * in_rect.left);
+ out_rect->top = dst_domain.top + (height_ratio * in_rect.top);
+ out_rect->right = dst_domain.left + (width_ratio * in_rect.right);
+ out_rect->bottom = dst_domain.top + (height_ratio * in_rect.bottom);
+}
+
} // namespace sdm