Merge "sde: Add support for RGBX_8888 UBWC format"
diff --git a/displayengine/include/core/layer_buffer.h b/displayengine/include/core/layer_buffer.h
index cf94e56..2ab6b29 100644
--- a/displayengine/include/core/layer_buffer.h
+++ b/displayengine/include/core/layer_buffer.h
@@ -140,8 +140,14 @@
//!< video/ui buffer
uint64_t macro_tile : 1; //!< This flag shall be set by client to indicate that the buffer format
//!< is macro tiled.
+ uint64_t interlace : 1; //!< This flag shall be set by the client to indicate that the buffer
+ //!< has interlaced content.
+ uint64_t secure_display : 1;
+ //!< This flag shall be set by the client to indicate that the secure
+ //!< display session is in progress. Secure display session cannot
+ //!< coexist with non-secure session.
- LayerBufferFlags() : secure(0), video(0), macro_tile(0) { }
+ LayerBufferFlags() : secure(0), video(0), macro_tile(0), interlace(0), secure_display(0) { }
};
/*! @brief This structure defines a layer buffer handle which contains raw buffer and its associated
diff --git a/displayengine/libs/core/fb/hw_device.cpp b/displayengine/libs/core/fb/hw_device.cpp
index f8af3e8..70d98de 100644
--- a/displayengine/libs/core/fb/hw_device.cpp
+++ b/displayengine/libs/core/fb/hw_device.cpp
@@ -214,6 +214,7 @@
HWPipeInfo *left_pipe = &hw_layers->config[i].left_pipe;
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);
mdp_input_layer mdp_layer;
for (uint32_t count = 0; count < 2; count++) {
@@ -246,18 +247,7 @@
SetRect(pipe_info->src_roi, &mdp_layer.src_rect);
SetRect(pipe_info->dst_roi, &mdp_layer.dst_rect);
-
- // Flips will be taken care by rotator, if layer requires 90 rotation. So Dont use MDP for
- // flip operation, if layer transform is 90.
- if (!layer.transform.rotation) {
- if (layer.transform.flip_vertical) {
- mdp_layer.flags |= MDP_LAYER_FLIP_UD;
- }
-
- if (layer.transform.flip_horizontal) {
- mdp_layer.flags |= MDP_LAYER_FLIP_LR;
- }
- }
+ SetMDPFlags(layer, is_rotator_used, &mdp_layer.flags);
mdp_scale_data* mdp_scale = GetScaleDataRef(mdp_layer_count);
#ifdef USES_SCALAR
@@ -601,6 +591,35 @@
target->h = UINT32(source.bottom) - target->y;
}
+void HWDevice::SetMDPFlags(const Layer &layer, const bool &is_rotator_used,
+ uint32_t *mdp_flags) {
+ LayerBuffer *input_buffer = layer.input_buffer;
+
+ // Flips will be taken care by rotator, if layer uses rotator for downscale/rotation. So ignore
+ // flip flags for MDP.
+ if (!is_rotator_used) {
+ if (layer.transform.flip_vertical) {
+ *mdp_flags |= MDP_LAYER_FLIP_UD;
+ }
+
+ if (layer.transform.flip_horizontal) {
+ *mdp_flags |= MDP_LAYER_FLIP_LR;
+ }
+ }
+
+ if (input_buffer->flags.interlace) {
+ *mdp_flags |= MDP_LAYER_DEINTERLACE;
+ }
+
+ if (input_buffer->flags.secure) {
+ *mdp_flags |= MDP_LAYER_SECURE_SESSION;
+ }
+
+ if (input_buffer->flags.secure_display) {
+ *mdp_flags |= MDP_SECURE_DISPLAY_OVERLAY_SESSION;
+ }
+}
+
void HWDevice::SyncMerge(const int &fd1, const int &fd2, int *target) {
if (fd1 >= 0 && fd2 >= 0) {
buffer_sync_handler_->SyncMerge(fd1, fd2, target);
diff --git a/displayengine/libs/core/fb/hw_device.h b/displayengine/libs/core/fb/hw_device.h
index 8dca6f9..917c884 100644
--- a/displayengine/libs/core/fb/hw_device.h
+++ b/displayengine/libs/core/fb/hw_device.h
@@ -78,6 +78,7 @@
uint32_t width, uint32_t *target);
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, uint32_t *mdp_flags);
void SyncMerge(const int &fd1, const int &fd2, int *target);
// Retrieves HW FrameBuffer Node Index
diff --git a/displayengine/libs/core/fb/hw_rotator.cpp b/displayengine/libs/core/fb/hw_rotator.cpp
index cc9bd1a..c698445 100644
--- a/displayengine/libs/core/fb/hw_rotator.cpp
+++ b/displayengine/libs/core/fb/hw_rotator.cpp
@@ -173,17 +173,7 @@
if (hw_rotate_info->valid) {
mdp_rotation_item *mdp_rot_item = &mdp_rot_request_.list[rot_count];
- if (rot90) {
- mdp_rot_item->flags |= MDP_ROTATION_90;
- }
-
- if (layer.transform.flip_horizontal) {
- mdp_rot_item->flags |= MDP_ROTATION_FLIP_LR;
- }
-
- if (layer.transform.flip_vertical) {
- mdp_rot_item->flags |= MDP_ROTATION_FLIP_UD;
- }
+ SetMDPFlags(layer, &mdp_rot_item->flags);
SetRect(hw_rotate_info->src_roi, &mdp_rot_item->src_rect);
SetRect(hw_rotate_info->dst_roi, &mdp_rot_item->dst_rect);
@@ -274,6 +264,27 @@
}
}
+ void HWRotator::SetMDPFlags(const Layer &layer, uint32_t *mdp_flags) {
+ LayerTransform transform = layer.transform;
+ bool rot90 = (transform.rotation == 90.0f);
+
+ if (rot90) {
+ *mdp_flags |= MDP_ROTATION_90;
+ }
+
+ if (transform.flip_horizontal) {
+ *mdp_flags |= MDP_ROTATION_FLIP_LR;
+ }
+
+ if (transform.flip_vertical) {
+ *mdp_flags |= MDP_ROTATION_FLIP_UD;
+ }
+
+ if (layer.input_buffer->flags.secure) {
+ *mdp_flags |= MDP_ROTATION_SECURE;
+ }
+}
+
DisplayError HWRotator::Validate(HWLayers *hw_layers) {
SetCtrlParams(hw_layers);
diff --git a/displayengine/libs/core/fb/hw_rotator.h b/displayengine/libs/core/fb/hw_rotator.h
index 3b4eebe..b78b657 100644
--- a/displayengine/libs/core/fb/hw_rotator.h
+++ b/displayengine/libs/core/fb/hw_rotator.h
@@ -53,6 +53,7 @@
void ResetParams();
void SetCtrlParams(HWLayers *hw_layers);
void SetBufferParams(HWLayers *hw_layers);
+ void SetMDPFlags(const Layer &layer, uint32_t *rot_flags);
struct mdp_rotation_request mdp_rot_request_;
struct mdp_rotation_item mdp_rot_layers_[kMaxSDELayers * 2]; // split panel (left + right)
diff --git a/displayengine/libs/core/res_config.cpp b/displayengine/libs/core/res_config.cpp
index 3cea3db..29a92cf 100644
--- a/displayengine/libs/core/res_config.cpp
+++ b/displayengine/libs/core/res_config.cpp
@@ -235,7 +235,7 @@
for (uint32_t i = 0; i < layer_info.count; i++) {
Layer& layer = layer_info.stack->layers[layer_info.index[i]];
float rot_scale = 1.0f;
- if (!IsValidDimension(layer.src_rect, layer.dst_rect)) {
+ if (!IsValidDimension(layer)) {
DLOGV_IF(kTagResources, "Input is invalid");
Log(kTagResources, "input layer src_rect", layer.src_rect);
Log(kTagResources, "input layer dst_rect", layer.dst_rect);
@@ -514,22 +514,25 @@
return false;
}
-bool ResManager::IsValidDimension(const LayerRect &src, const LayerRect &dst) {
- // Make sure source in integral
- if (src.left - roundf(src.left) ||
- src.top - roundf(src.top) ||
- src.right - roundf(src.right) ||
- src.bottom - roundf(src.bottom)) {
+bool ResManager::IsValidDimension(const Layer &layer) {
+ const LayerRect &src = layer.src_rect;
+ const LayerRect &dst = layer.dst_rect;
+ LayerBuffer *input_buffer = layer.input_buffer;
+
+ if (!IsValid(src) || !IsValid(dst)) {
+ Log(kTagResources, "input layer src_rect", src);
+ Log(kTagResources, "input layer dst_rect", dst);
+ return false;
+ }
+
+ // Make sure source in integral only if it is a non secure layer.
+ if (!input_buffer->flags.secure && (src.left - roundf(src.left) || src.top - roundf(src.top) ||
+ src.right - roundf(src.right) || src.bottom - roundf(src.bottom))) {
DLOGV_IF(kTagResources, "Input ROI is not integral");
return false;
}
- if (src.left > src.right || src.top > src.bottom || dst.left > dst.right ||
- dst.top > dst.bottom) {
- return false;
- } else {
- return true;
- }
+ return true;
}
DisplayError ResManager::SetDecimationFactor(HWPipeInfo *pipe) {
diff --git a/displayengine/libs/core/res_manager.h b/displayengine/libs/core/res_manager.h
index a127645..bd33fec 100644
--- a/displayengine/libs/core/res_manager.h
+++ b/displayengine/libs/core/res_manager.h
@@ -174,7 +174,7 @@
float *right_cut_ratio, float *bottom_cut_ratio);
bool CalculateCropRects(const LayerRect &scissor, const LayerTransform &transform,
LayerRect *crop, LayerRect *dst);
- bool IsValidDimension(const LayerRect &src, const LayerRect &dst);
+ bool IsValidDimension(const Layer &layer);
bool CheckBandwidth(DisplayResourceContext *display_ctx, HWLayers *hw_layers);
float GetPipeBw(DisplayResourceContext *display_ctx, HWPipeInfo *pipe, float bpp);
float GetClockForPipe(DisplayResourceContext *display_ctx, HWPipeInfo *pipe);
diff --git a/displayengine/libs/hwc/hwc_buffer_allocator.cpp b/displayengine/libs/hwc/hwc_buffer_allocator.cpp
index 22c4640..61d9913 100644
--- a/displayengine/libs/hwc/hwc_buffer_allocator.cpp
+++ b/displayengine/libs/hwc/hwc_buffer_allocator.cpp
@@ -85,7 +85,7 @@
uint32_t buffer_size = getBufferSizeAndDimensions(width, height, format, alloc_flags,
aligned_width, aligned_height);
- buffer_size = ROUND_UP((buffer_size * buffer_config.buffer_count), data.align);
+ buffer_size = ROUND_UP(buffer_size, data.align) * buffer_config.buffer_count;
data.base = 0;
data.fd = -1;
@@ -116,8 +116,9 @@
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) || (meta_buffer_info->base_addr == NULL)) {
- return kErrorNone;
+ if (alloc_buffer_info->fd < 0) {
+ DLOGE("Invalid parameters: fd %d", alloc_buffer_info->fd);
+ return kErrorParameters;
}
gralloc::IMemAlloc *memalloc = alloc_controller_->getAllocator(meta_buffer_info->alloc_type);
diff --git a/displayengine/libs/hwc/hwc_display.cpp b/displayengine/libs/hwc/hwc_display.cpp
index b48999e..8a73d3c 100644
--- a/displayengine/libs/hwc/hwc_display.cpp
+++ b/displayengine/libs/hwc/hwc_display.cpp
@@ -350,6 +350,14 @@
if (meta_data && meta_data->operation & UPDATE_REFRESH_RATE) {
layer.frame_rate = meta_data->refreshrate;
}
+
+ if (meta_data && meta_data->operation == PP_PARAM_INTERLACED && meta_data->interlaced) {
+ layer_buffer->flags.interlace = true;
+ }
+
+ if (pvt_handle->flags & private_handle_t::PRIV_FLAGS_SECURE_DISPLAY) {
+ layer_buffer->flags.secure_display = true;
+ }
}
SetRect(hwc_layer.displayFrame, &layer.dst_rect);
diff --git a/libgralloc/adreno_utils.h b/libgralloc/adreno_utils.h
index 78f49da..31f9d52 100644
--- a/libgralloc/adreno_utils.h
+++ b/libgralloc/adreno_utils.h
@@ -26,7 +26,7 @@
typedef enum {
ADRENO_PIXELFORMAT_UNKNOWN = 0,
- ADRENO_PIXELFORMAT_R8G8B8A8 = 27,
+ ADRENO_PIXELFORMAT_R8G8B8A8 = 28,
ADRENO_PIXELFORMAT_R8G8B8A8_SRGB = 29,
ADRENO_PIXELFORMAT_B5G6R5 = 85,
ADRENO_PIXELFORMAT_B5G5R5A1 = 86,
@@ -37,6 +37,7 @@
ADRENO_PIXELFORMAT_YUY2 = 107,
ADRENO_PIXELFORMAT_B4G4R4A4 = 115,
ADRENO_PIXELFORMAT_NV12_EXT = 506, // NV12 with non-std alignment and offsets
+ ADRENO_PIXELFORMAT_R8G8B8X8 = 507, // GL_RGB8 (Internal)
ADRENO_PIXELFORMAT_R8G8B8 = 508, // GL_RGB8
ADRENO_PIXELFORMAT_A1B5G5R5 = 519, // GL_RGB5_A1
ADRENO_PIXELFORMAT_R8G8B8X8_SRGB = 520, // GL_SRGB8
diff --git a/libgralloc/gpu.cpp b/libgralloc/gpu.cpp
index a6f7874..53363bb 100644
--- a/libgralloc/gpu.cpp
+++ b/libgralloc/gpu.cpp
@@ -155,8 +155,8 @@
flags |= private_handle_t::PRIV_FLAGS_TILE_RENDERED;
}
- if (AdrenoMemInfo::getInstance().isUBWCSupportedByGPU(format) &&
- isUBwcEnabled(format, usage)) {
+ if (isUBwcEnabled(format, usage) &&
+ AdrenoMemInfo::getInstance().isUBWCSupportedByGPU(format)) {
flags |= private_handle_t::PRIV_FLAGS_UBWC_ALIGNED;
}
diff --git a/libhwcomposer/hwc_copybit.cpp b/libhwcomposer/hwc_copybit.cpp
index 208fd3e..e223ff4 100644
--- a/libhwcomposer/hwc_copybit.cpp
+++ b/libhwcomposer/hwc_copybit.cpp
@@ -174,20 +174,11 @@
//dirty rect for same layer at least equal of number of
//framebuffers
- if ( updatingLayerCount <= 1 ) {
- hwc_rect_t dirtyRect;
- if (updatingLayerCount == 0) {
- dirtyRect.left = INVALID_DIMENSION;
- dirtyRect.top = INVALID_DIMENSION;
- dirtyRect.right = INVALID_DIMENSION;
- dirtyRect.bottom = INVALID_DIMENSION;
- changingLayerIndex = NO_UPDATING_LAYER;
- } else {
- dirtyRect = list->hwLayers[changingLayerIndex].displayFrame;
+ if ( updatingLayerCount == 1 ) {
+ hwc_rect_t dirtyRect = list->hwLayers[changingLayerIndex].displayFrame;
#ifdef QCOM_BSP
- dirtyRect = list->hwLayers[changingLayerIndex].dirtyRect;
+ dirtyRect = list->hwLayers[changingLayerIndex].dirtyRect;
#endif
- }
for (int k = ctx->listStats[dpy].numAppLayers-1; k >= 0 ; k--) {
//disable swap rect in case of scaling and video .
@@ -562,12 +553,6 @@
mDirtyLayerIndex = checkDirtyRect(ctx, list, dpy);
ALOGD_IF (DEBUG_COPYBIT, "%s:Dirty Layer Index: %d",
__FUNCTION__, mDirtyLayerIndex);
- // repetitive frame will have mDirtyLayerIndex as NO_UPDATING_LAYER
- if (mDirtyLayerIndex == NO_UPDATING_LAYER) {
- ALOGD_IF (DEBUG_COPYBIT, "%s: No Updating Layers", __FUNCTION__);
- return true;
- }
-
hwc_rect_t clearRegion = {0,0,0,0};
mDirtyRect = list->hwLayers[last].displayFrame;
diff --git a/libhwcomposer/hwc_copybit.h b/libhwcomposer/hwc_copybit.h
index 993c790..4223aa0 100644
--- a/libhwcomposer/hwc_copybit.h
+++ b/libhwcomposer/hwc_copybit.h
@@ -28,8 +28,6 @@
#define MAX_SCALE_FACTOR 16
#define MIN_SCALE_FACTOR 0.0625
#define MAX_LAYERS_FOR_ABC 2
-#define INVALID_DIMENSION -1
-#define NO_UPDATING_LAYER -2
namespace qhwc {
class CopyBit {