Merge "sdm: make flush on when composer stop."
diff --git a/composer/gl_color_convert.cpp b/composer/gl_color_convert.cpp
index 03f7377..f398059 100644
--- a/composer/gl_color_convert.cpp
+++ b/composer/gl_color_convert.cpp
@@ -35,7 +35,7 @@
namespace sdm {
GLColorConvert* GLColorConvert::GetInstance(GLRenderTarget target, bool secure) {
- GLColorConvertImpl* color_convert = new GLColorConvertImpl(target, secure);
+ GLColorConvertImpl* color_convert = new GLColorConvertImpl(target, secure);
if (color_convert == nullptr) {
DLOGE("Failed to create color convert instance for %d target %d secure", target, secure);
return nullptr;
diff --git a/composer/gl_common.cpp b/composer/gl_common.cpp
index c350d47..aa3bc45 100644
--- a/composer/gl_common.cpp
+++ b/composer/gl_common.cpp
@@ -147,12 +147,16 @@
return fd;
}
-void GLCommon::DestroyContext(const GLContext* ctx) {
+void GLCommon::DestroyContext(GLContext* ctx) {
DTRACE_SCOPED();
+
+ // Clear egl image buffers.
+ image_wrapper_.Deinit();
+
+ EGL(DeleteProgram(ctx->program_id));
EGL(eglMakeCurrent(ctx->egl_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT));
EGL(eglDestroySurface(ctx->egl_display, ctx->egl_surface));
EGL(eglDestroyContext(ctx->egl_display, ctx->egl_context));
- EGL(DeleteProgram(ctx->program_id));
EGL(eglTerminate(ctx->egl_display));
}
diff --git a/composer/gl_common.h b/composer/gl_common.h
index 79af479..c77988b 100644
--- a/composer/gl_common.h
+++ b/composer/gl_common.h
@@ -60,7 +60,7 @@
virtual void SetProgram(uint32_t id);
virtual void SetDestinationBuffer(const private_handle_t *dst_hnd, const GLRect &dst_rect);
virtual void SetSourceBuffer(const private_handle_t *src_hnd);
- virtual void DestroyContext(const GLContext *ctx);
+ virtual void DestroyContext(GLContext *ctx);
virtual void DeleteProgram(uint32_t id);
virtual int WaitOnInputFence(int in_fence_fd);
virtual int CreateOutputFence();
diff --git a/composer/hwc_layers.cpp b/composer/hwc_layers.cpp
index 101c3f0..eb0687e 100644
--- a/composer/hwc_layers.cpp
+++ b/composer/hwc_layers.cpp
@@ -963,11 +963,6 @@
}
void HWCLayer::ValidateAndSetCSC(const private_handle_t *handle) {
- if (per_frame_hdr_metadata_) {
- // Since client has set PerFrameMetadata, dataspace will be valid
- // so we can skip reading from ColorMetaData.
- return;
- }
LayerBuffer *layer_buffer = &layer_->input_buffer;
bool use_color_metadata = true;
ColorMetaData csc = {};
@@ -997,7 +992,9 @@
use_color_metadata = true;
}
- if (use_color_metadata) {
+ // Since client has set PerFrameMetadata, dataspace will be valid
+ // so we can skip reading from ColorMetaData.
+ if (use_color_metadata && !per_frame_hdr_metadata_) {
ColorMetaData new_metadata = {};
if (sdm::SetCSC(handle, &new_metadata) == kErrorNone) {
// If dataspace is KNOWN, overwrite the gralloc metadata CSC using the previously derived CSC
diff --git a/config/display-product.mk b/config/display-product.mk
index 97654d5..1ba5f53 100644
--- a/config/display-product.mk
+++ b/config/display-product.mk
@@ -49,6 +49,12 @@
#QDCM calibration xml file for td4330 panel
PRODUCT_COPY_FILES += hardware/qcom/display/config/qdcm_calib_data_bengal_default.xml:$(TARGET_COPY_OUT_VENDOR)/etc/qdcm_calib_data_td4330_v2_cmd_mode_dsi_truly_panel.xml
PRODUCT_COPY_FILES += hardware/qcom/display/config/qdcm_calib_data_bengal_default.xml:$(TARGET_COPY_OUT_VENDOR)/etc/qdcm_calib_data_td4330_v2_video_mode_dsi_truly_panel.xml
+#QDCM calibration xml file for Sharp fhd panel
+PRODUCT_COPY_FILES += hardware/qcom/display/config/qdcm_calib_data_default.xml:$(TARGET_COPY_OUT_VENDOR)/etc/qdcm_calib_data_Sharp_fhd_cmd_mode_qsync_dsi_panel.xml
+PRODUCT_COPY_FILES += hardware/qcom/display/config/qdcm_calib_data_default.xml:$(TARGET_COPY_OUT_VENDOR)/etc/qdcm_calib_data_Sharp_fhd_video_mode_qsync_dsi_panel.xml
+#QDCM calibration xml file for Sharp 2k panel
+PRODUCT_COPY_FILES += hardware/qcom/display/config/qdcm_calib_data_default.xml:$(TARGET_COPY_OUT_VENDOR)/etc/qdcm_calib_data_Sharp_2k_cmd_mode_qsync_dsi_panel.xml
+PRODUCT_COPY_FILES += hardware/qcom/display/config/qdcm_calib_data_default.xml:$(TARGET_COPY_OUT_VENDOR)/etc/qdcm_calib_data_Sharp_2k_video_mode_qsync_dsi_panel.xml
PRODUCT_PROPERTY_OVERRIDES += \
persist.demo.hdmirotationlock=false \
diff --git a/gpu_tonemapper/EGLImageWrapper.cpp b/gpu_tonemapper/EGLImageWrapper.cpp
index 19bf093..b3730f0 100644
--- a/gpu_tonemapper/EGLImageWrapper.cpp
+++ b/gpu_tonemapper/EGLImageWrapper.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016-2018, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2016-2019, The Linux Foundation. All rights reserved.
* Not a Contribution.
*
* Copyright 2015 The Android Open Source Project
@@ -122,6 +122,13 @@
EGLImageWrapper::~EGLImageWrapper()
//-----------------------------------------------------------------------------
{
+ Deinit();
+}
+
+//-----------------------------------------------------------------------------
+void EGLImageWrapper::Deinit()
+//-----------------------------------------------------------------------------
+{
if (eglImageBufferCache != 0) {
if (callback != 0) {
callback->mapClearPending = true;
diff --git a/gpu_tonemapper/EGLImageWrapper.h b/gpu_tonemapper/EGLImageWrapper.h
index ce1b344..dfcbca9 100644
--- a/gpu_tonemapper/EGLImageWrapper.h
+++ b/gpu_tonemapper/EGLImageWrapper.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016-2018, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2016-2019, The Linux Foundation. All rights reserved.
* Not a Contribution.
*
* Copyright 2015 The Android Open Source Project
@@ -57,6 +57,7 @@
EGLImageWrapper();
~EGLImageWrapper();
EGLImageBuffer* wrap(const void *pvt_handle);
+ void Deinit();
};
#endif // __TONEMAPPER_EGLIMAGEWRAPPER_H__
diff --git a/gralloc/QtiMapperExtensions.cpp b/gralloc/QtiMapperExtensions.cpp
index cace7ba..33cd23d 100644
--- a/gralloc/QtiMapperExtensions.cpp
+++ b/gralloc/QtiMapperExtensions.cpp
@@ -344,7 +344,7 @@
getFormatLayout_cb hidl_cb) {
ALOGD_IF(DEBUG, "%s: Input parameters - wxh: %dx%d usage: 0x%" PRIu64 " format: %d", __FUNCTION__,
width, height, usage, format);
- auto err = Error::BAD_BUFFER;
+ auto err = Error::NONE;
hidl_vec<PlaneLayout> plane_info;
unsigned int alignedw = 0, alignedh = 0;
int plane_count = 0;
@@ -353,34 +353,41 @@
BufferInfo info(width, height, custom_format, usage);
gralloc::GetAlignedWidthAndHeight(info, &alignedw, &alignedh);
size = gralloc::GetSize(info, alignedw, alignedh);
+ gralloc::PlaneLayoutInfo plane_layout[8] = {};
ALOGD_IF(DEBUG, "%s: Aligned width and height - wxh: %ux%u custom_format = %d", __FUNCTION__,
alignedw, alignedh, custom_format);
if (gralloc::IsYuvFormat(custom_format)) {
- gralloc::PlaneLayoutInfo yuv_plane_info[8] = {};
gralloc::GetYUVPlaneInfo(info, custom_format, alignedw, alignedh, flags, &plane_count,
- yuv_plane_info);
- ALOGD_IF(DEBUG, "%s: Number of plane - %d, custom_format - %d", __FUNCTION__, plane_count,
- custom_format);
- plane_info.resize(plane_count);
- for (int i = 0; i < plane_count; i++) {
- plane_info[i].component = yuv_plane_info[i].component;
- plane_info[i].h_subsampling = yuv_plane_info[i].h_subsampling;
- plane_info[i].v_subsampling = yuv_plane_info[i].v_subsampling;
- plane_info[i].offset = yuv_plane_info[i].offset;
- plane_info[i].pixel_increment = yuv_plane_info[i].step;
- plane_info[i].stride = yuv_plane_info[i].stride;
- plane_info[i].stride_bytes = yuv_plane_info[i].stride_bytes;
- plane_info[i].scanlines = yuv_plane_info[i].scanlines;
- plane_info[i].size = yuv_plane_info[i].size;
- ALOGD_IF(DEBUG, "%s: plane info: component - %d", __FUNCTION__, plane_info[i].component);
- ALOGD_IF(DEBUG, "h_subsampling - %u, v_subsampling - %u, offset - %u, pixel_increment - %d",
- plane_info[i].h_subsampling, plane_info[i].v_subsampling, plane_info[i].offset,
- plane_info[i].pixel_increment);
- ALOGD_IF(DEBUG, "stride_pixel - %d, stride_bytes - %d, scanlines - %d, size - %u",
- plane_info[i].stride, plane_info[i].stride_bytes, plane_info[i].scanlines,
- plane_info[i].size);
- }
- err = Error::NONE;
+ plane_layout);
+ } else if (gralloc::IsUncompressedRGBFormat(custom_format) ||
+ gralloc::IsCompressedRGBFormat(custom_format)) {
+ gralloc::GetRGBPlaneInfo(info, custom_format, alignedw, alignedh, flags, &plane_count,
+ plane_layout);
+ } else {
+ err = Error::BAD_BUFFER;
+ hidl_cb(err, size, plane_info);
+ return Void();
+ }
+ ALOGD_IF(DEBUG, "%s: Number of plane - %d, custom_format - %d", __FUNCTION__, plane_count,
+ custom_format);
+ plane_info.resize(plane_count);
+ for (int i = 0; i < plane_count; i++) {
+ plane_info[i].component = plane_layout[i].component;
+ plane_info[i].h_subsampling = plane_layout[i].h_subsampling;
+ plane_info[i].v_subsampling = plane_layout[i].v_subsampling;
+ plane_info[i].offset = plane_layout[i].offset;
+ plane_info[i].pixel_increment = plane_layout[i].step;
+ plane_info[i].stride = plane_layout[i].stride;
+ plane_info[i].stride_bytes = plane_layout[i].stride_bytes;
+ plane_info[i].scanlines = plane_layout[i].scanlines;
+ plane_info[i].size = plane_layout[i].size;
+ ALOGD_IF(DEBUG, "%s: plane info: component - %d", __FUNCTION__, plane_info[i].component);
+ ALOGD_IF(DEBUG, "h_subsampling - %u, v_subsampling - %u, offset - %u, pixel_increment - %d",
+ plane_info[i].h_subsampling, plane_info[i].v_subsampling, plane_info[i].offset,
+ plane_info[i].pixel_increment);
+ ALOGD_IF(DEBUG, "stride_pixel - %d, stride_bytes - %d, scanlines - %d, size - %u",
+ plane_info[i].stride, plane_info[i].stride_bytes, plane_info[i].scanlines,
+ plane_info[i].size);
}
hidl_cb(err, size, plane_info);
return Void();
diff --git a/gralloc/gr_utils.cpp b/gralloc/gr_utils.cpp
index 49dcfb4..16e41b1 100644
--- a/gralloc/gr_utils.cpp
+++ b/gralloc/gr_utils.cpp
@@ -853,6 +853,28 @@
return size;
}
+unsigned int GetRgbMetaSize(int format, uint32_t width, uint32_t height, uint64_t usage) {
+ unsigned int meta_size = 0;
+ if (!IsUBwcEnabled(format, usage)) {
+ return meta_size;
+ }
+ uint32_t bpp = GetBppForUncompressedRGB(format);
+ switch (format) {
+ case HAL_PIXEL_FORMAT_BGR_565:
+ case HAL_PIXEL_FORMAT_RGBA_8888:
+ case HAL_PIXEL_FORMAT_RGBX_8888:
+ case HAL_PIXEL_FORMAT_RGBA_1010102:
+ case HAL_PIXEL_FORMAT_RGBX_1010102:
+ case HAL_PIXEL_FORMAT_RGBA_FP16:
+ meta_size = GetRgbUBwcMetaBufferSize(width, height, bpp);
+ break;
+ default:
+ ALOGE("%s:Unsupported RGB format: 0x%x", __FUNCTION__, format);
+ break;
+ }
+ return meta_size;
+}
+
int GetRgbDataAddress(private_handle_t *hnd, void **rgb_data) {
int err = 0;
@@ -866,23 +888,8 @@
*rgb_data = reinterpret_cast<void *>(hnd->base);
return err;
}
+ unsigned int meta_size = GetRgbMetaSize(hnd->format, hnd->width, hnd->height, hnd->usage);
- unsigned int meta_size = 0;
- uint32_t bpp = GetBppForUncompressedRGB(hnd->format);
- switch (hnd->format) {
- case HAL_PIXEL_FORMAT_BGR_565:
- case HAL_PIXEL_FORMAT_RGBA_8888:
- case HAL_PIXEL_FORMAT_RGBX_8888:
- case HAL_PIXEL_FORMAT_RGBA_1010102:
- case HAL_PIXEL_FORMAT_RGBX_1010102:
- case HAL_PIXEL_FORMAT_RGBA_FP16:
- meta_size = GetRgbUBwcMetaBufferSize(hnd->width, hnd->height, bpp);
- break;
- default:
- ALOGE("%s:Unsupported RGB format: 0x%x", __FUNCTION__, hnd->format);
- err = -EINVAL;
- break;
- }
*rgb_data = reinterpret_cast<void *>(hnd->base + meta_size);
return err;
@@ -1652,4 +1659,40 @@
}
}
+bool HasAlphaComponent(int32_t format) {
+ switch (format) {
+ case HAL_PIXEL_FORMAT_RGBA_8888:
+ case HAL_PIXEL_FORMAT_BGRA_8888:
+ case HAL_PIXEL_FORMAT_RGBA_5551:
+ case HAL_PIXEL_FORMAT_RGBA_4444:
+ case HAL_PIXEL_FORMAT_RGBA_1010102:
+ case HAL_PIXEL_FORMAT_ARGB_2101010:
+ case HAL_PIXEL_FORMAT_BGRA_1010102:
+ case HAL_PIXEL_FORMAT_ABGR_2101010:
+ case HAL_PIXEL_FORMAT_RGBA_FP16:
+ return true;
+ default:
+ return false;
+ }
+}
+
+void GetRGBPlaneInfo(const BufferInfo &info, int32_t format, int32_t width, int32_t height,
+ int32_t /* flags */, int *plane_count, PlaneLayoutInfo *plane_info) {
+ uint64_t usage = info.usage;
+ *plane_count = 1;
+ plane_info->component =
+ (PlaneComponent)(PLANE_COMPONENT_R | PLANE_COMPONENT_G | PLANE_COMPONENT_B);
+ if (HasAlphaComponent(format)) {
+ plane_info->component = (PlaneComponent)(plane_info->component | PLANE_COMPONENT_A);
+ }
+ plane_info->size = GetSize(info, width, height);
+ plane_info->step = GetBpp(format);
+ plane_info->offset = GetRgbMetaSize(format, width, height, usage);
+ plane_info->h_subsampling = 0;
+ plane_info->v_subsampling = 0;
+ plane_info->stride = width;
+ plane_info->stride_bytes = width * plane_info->step;
+ plane_info->scanlines = height;
+}
+
} // namespace gralloc
diff --git a/gralloc/gr_utils.h b/gralloc/gr_utils.h
index bc5a670..6dbe889 100644
--- a/gralloc/gr_utils.h
+++ b/gralloc/gr_utils.h
@@ -145,6 +145,9 @@
int GetYUVPlaneInfo(const private_handle_t *hnd, struct android_ycbcr ycbcr[2]);
int GetYUVPlaneInfo(const BufferInfo &info, int32_t format, int32_t width, int32_t height,
int32_t flags, int *plane_count, PlaneLayoutInfo plane_info[8]);
+void GetRGBPlaneInfo(const BufferInfo &info, int32_t format, int32_t width, int32_t height,
+ int32_t flags, int *plane_count, PlaneLayoutInfo *plane_info);
+unsigned int GetRgbMetaSize(int format, uint32_t width, uint32_t height, uint64_t usage);
void GetYuvSubSamplingFactor(int32_t format, int *h_subsampling, int *v_subsampling);
void CopyPlaneLayoutInfotoAndroidYcbcr(uint64_t base, int plane_count, PlaneLayoutInfo *plane_info,
struct android_ycbcr *ycbcr);
@@ -180,6 +183,7 @@
int GetCustomFormatFlags(int format, uint64_t usage, int *custom_format, uint64_t *priv_flags);
int GetBufferType(int inputFormat);
bool IsGPUFlagSupported(uint64_t usage);
+bool HasAlphaComponent(int32_t format);
} // namespace gralloc
#endif // __GR_UTILS_H__
diff --git a/libdrmutils/drm_interface.h b/libdrmutils/drm_interface.h
index e41c8ab..41543d0 100644
--- a/libdrmutils/drm_interface.h
+++ b/libdrmutils/drm_interface.h
@@ -525,6 +525,8 @@
uint32_t rotation_limit_index = 0;
uint32_t line_width_constraints_count = 0;
std::vector< std::pair <uint32_t, uint32_t> > line_width_limits;
+ uint32_t num_mnocports;
+ uint32_t mnoc_bus_width;
};
enum struct DRMPlaneType {
diff --git a/sde-drm/drm_crtc.cpp b/sde-drm/drm_crtc.cpp
index ef1e692..f8890d1 100644
--- a/sde-drm/drm_crtc.cpp
+++ b/sde-drm/drm_crtc.cpp
@@ -349,6 +349,8 @@
string solidfill_stages = "dim_layer_v1_max_layers=";
string has_hdr = "has_hdr=";
string min_prefill_lines = "min_prefill_lines=";
+ string num_mnocports = "num_mnoc_ports=";
+ string mnoc_bus_width = "axi_bus_width=";
crtc_info_.max_solidfill_stages = 0; // default _
string dest_scaler_count = "dest_scaler_count=";
@@ -439,6 +441,10 @@
crtc_info_.min_prefill_lines = std::stoi(string(line, min_prefill_lines.length()));
} else if (line.find(sec_ui_blendstage) != string::npos) {
crtc_info_.secure_disp_blend_stage = std::stoi(string(line, (sec_ui_blendstage).length()));
+ } else if (line.find(num_mnocports) != string::npos) {
+ crtc_info_.num_mnocports = std::stoi(string(line, num_mnocports.length()));
+ } else if (line.find(mnoc_bus_width) != string::npos) {
+ crtc_info_.mnoc_bus_width = std::stoi(string(line, mnoc_bus_width.length()));
} else if (line.find(linewidth_constraints) != string::npos) {
crtc_info_.line_width_constraints_count =
std::stoi(string(line, (linewidth_constraints).length()));
diff --git a/sdm/include/private/hw_info_types.h b/sdm/include/private/hw_info_types.h
index d9abd6c..8997cc6 100644
--- a/sdm/include/private/hw_info_types.h
+++ b/sdm/include/private/hw_info_types.h
@@ -342,6 +342,8 @@
uint32_t line_width_constraints_count = 0;
vector< pair <uint32_t, uint32_t> > line_width_limits;
vector< pair <uint32_t, uint32_t> > line_width_constraints;
+ uint32_t num_mnocports = 2;
+ uint32_t mnoc_bus_width = 32;
};
struct HWSplitInfo {
diff --git a/sdm/libs/core/drm/hw_info_drm.cpp b/sdm/libs/core/drm/hw_info_drm.cpp
index eaa065c..44fddcb 100644
--- a/sdm/libs/core/drm/hw_info_drm.cpp
+++ b/sdm/libs/core/drm/hw_info_drm.cpp
@@ -336,6 +336,9 @@
width_constraints.push_back(std::make_pair(kPipeScalingLimit, info.scaling_limit_index));
width_constraints.push_back(std::make_pair(kPipeRotationLimit, info.rotation_limit_index));
}
+ // In case driver doesn't report bus width default to 256 bit bus.
+ hw_resource->num_mnocports = info.num_mnocports ? info.num_mnocports : 2;
+ hw_resource->mnoc_bus_width = info.mnoc_bus_width ? info.mnoc_bus_width : 32;
}
void HWInfoDRM::GetHWPlanesInfo(HWResourceInfo *hw_resource) {