Merge "Merge remote-tracking branch 'quic/display.lnx.3.0-rel' into LA.HB.1.3.9"
diff --git a/libgralloc/adreno_utils.h b/libgralloc/adreno_utils.h
index 31f9d52..8ea7f70 100644
--- a/libgralloc/adreno_utils.h
+++ b/libgralloc/adreno_utils.h
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2015, The Linux Foundation. All rights reserved.
+* Copyright (c) 2015 - 2016, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted
* provided that the following conditions are met:
@@ -26,6 +26,7 @@
typedef enum {
ADRENO_PIXELFORMAT_UNKNOWN = 0,
+ ADRENO_PIXELFORMAT_R10G10B10A2_UNORM = 24, // Vertex, Normalized GL_UNSIGNED_INT_10_10_10_2_OES
ADRENO_PIXELFORMAT_R8G8B8A8 = 28,
ADRENO_PIXELFORMAT_R8G8B8A8_SRGB = 29,
ADRENO_PIXELFORMAT_B5G6R5 = 85,
@@ -42,6 +43,10 @@
ADRENO_PIXELFORMAT_A1B5G5R5 = 519, // GL_RGB5_A1
ADRENO_PIXELFORMAT_R8G8B8X8_SRGB = 520, // GL_SRGB8
ADRENO_PIXELFORMAT_R8G8B8_SRGB = 521, // GL_SRGB8
+ ADRENO_PIXELFORMAT_A2B10G10R10_UNORM = 532,
+ // Vertex, Normalized GL_UNSIGNED_INT_10_10_10_2_OES
+ ADRENO_PIXELFORMAT_R10G10B10X2_UNORM = 537,
+ // Vertex, Normalized GL_UNSIGNED_INT_10_10_10_2_OES
ADRENO_PIXELFORMAT_R5G6B5 = 610, // RGBA version of B5G6R5
ADRENO_PIXELFORMAT_R5G5B5A1 = 611, // RGBA version of B5G5R5A1
ADRENO_PIXELFORMAT_R4G4B4A4 = 612, // RGBA version of B4G4R4A4
@@ -49,5 +54,5 @@
ADRENO_PIXELFORMAT_NV21 = 619,
ADRENO_PIXELFORMAT_Y8U8V8A8 = 620, // YUV 4:4:4 packed (1 plane)
ADRENO_PIXELFORMAT_Y8 = 625, // Single 8-bit luma only channel YUV format
-
+ ADRENO_PIXELFORMAT_TP10 = 648,
} ADRENOPIXELFORMAT;
diff --git a/libgralloc/alloc_controller.cpp b/libgralloc/alloc_controller.cpp
index 9eb786e..2eb1adc 100644
--- a/libgralloc/alloc_controller.cpp
+++ b/libgralloc/alloc_controller.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011-2015, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2011 - 2016, The Linux Foundation. All rights reserved.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -77,7 +77,7 @@
ANDROID_SINGLETON_STATIC_INSTANCE(AdrenoMemInfo);
-static void getUBwcWidthAndHeight(int, int, int, int&, int&);
+static void getYuvUBwcWidthHeight(int, int, int, int&, int&);
static unsigned int getUBwcSize(int, int, int, const int, const int);
//Common functions
@@ -189,7 +189,15 @@
case HAL_PIXEL_FORMAT_RGBA_4444:
case HAL_PIXEL_FORMAT_R_8:
case HAL_PIXEL_FORMAT_RG_88:
- case HAL_PIXEL_FORMAT_BGRX_8888: // Intentional fallthrough
+ case HAL_PIXEL_FORMAT_BGRX_8888:
+ case HAL_PIXEL_FORMAT_RGBA_1010102:
+ case HAL_PIXEL_FORMAT_ARGB_2101010:
+ case HAL_PIXEL_FORMAT_RGBX_1010102:
+ case HAL_PIXEL_FORMAT_XRGB_2101010:
+ case HAL_PIXEL_FORMAT_BGRA_1010102:
+ case HAL_PIXEL_FORMAT_ABGR_2101010:
+ case HAL_PIXEL_FORMAT_BGRX_1010102:
+ case HAL_PIXEL_FORMAT_XBGR_2101010: // Intentional fallthrough
is_rgb_format = true;
break;
default:
@@ -208,104 +216,100 @@
if (isUncompressedRgbFormat(format) == true) {
int tileEnabled = ubwc_enabled || isMacroTileEnabled(format, usage);
getGpuAlignedWidthHeight(width, height, format, tileEnabled, aligned_w, aligned_h);
- return;
- }
+ } else if (ubwc_enabled) {
+ getYuvUBwcWidthHeight(width, height, format, aligned_w, aligned_h);
+ } else {
+ aligned_w = width;
+ aligned_h = height;
+ int alignment = 32;
+ switch (format)
+ {
+ case HAL_PIXEL_FORMAT_YCrCb_420_SP:
+ case HAL_PIXEL_FORMAT_YCbCr_420_SP:
+ if (LINK_adreno_get_gpu_pixel_alignment) {
+ alignment = LINK_adreno_get_gpu_pixel_alignment();
+ }
+ aligned_w = ALIGN(width, alignment);
+ break;
+ case HAL_PIXEL_FORMAT_YCrCb_420_SP_ADRENO:
+ aligned_w = ALIGN(width, alignment);
+ break;
+ case HAL_PIXEL_FORMAT_RAW16:
+ aligned_w = ALIGN(width, 16);
+ break;
+ case HAL_PIXEL_FORMAT_RAW10:
+ aligned_w = ALIGN(width * 10 / 8, 8);
+ break;
+ case HAL_PIXEL_FORMAT_YCbCr_420_SP_TILED:
+ aligned_w = ALIGN(width, 128);
+ break;
+ case HAL_PIXEL_FORMAT_YV12:
+ case HAL_PIXEL_FORMAT_YCbCr_422_SP:
+ case HAL_PIXEL_FORMAT_YCrCb_422_SP:
+ case HAL_PIXEL_FORMAT_YCbCr_422_I:
+ case HAL_PIXEL_FORMAT_YCrCb_422_I:
+ aligned_w = ALIGN(width, 16);
+ break;
+ case HAL_PIXEL_FORMAT_YCbCr_420_SP_VENUS:
+ case HAL_PIXEL_FORMAT_NV12_ENCODEABLE:
+ aligned_w = VENUS_Y_STRIDE(COLOR_FMT_NV12, width);
+ aligned_h = VENUS_Y_SCANLINES(COLOR_FMT_NV12, height);
+ break;
+ case HAL_PIXEL_FORMAT_YCrCb_420_SP_VENUS:
+ aligned_w = VENUS_Y_STRIDE(COLOR_FMT_NV21, width);
+ aligned_h = VENUS_Y_SCANLINES(COLOR_FMT_NV21, height);
+ break;
+ case HAL_PIXEL_FORMAT_BLOB:
+ break;
+ case HAL_PIXEL_FORMAT_NV21_ZSL:
+ aligned_w = ALIGN(width, 64);
+ aligned_h = ALIGN(height, 64);
+ break;
+ case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_4x4_KHR:
+ case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:
+ case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_5x4_KHR:
+ case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:
+ case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_5x5_KHR:
+ case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:
+ case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_6x5_KHR:
+ case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:
+ case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_6x6_KHR:
+ case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:
+ case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_8x5_KHR:
+ case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:
+ case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_8x6_KHR:
+ case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:
+ case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_8x8_KHR:
+ case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:
+ case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_10x5_KHR:
+ case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:
+ case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_10x6_KHR:
+ case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:
+ case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_10x8_KHR:
+ case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:
+ case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_10x10_KHR:
+ case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:
+ case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_12x10_KHR:
+ case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:
+ case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_12x12_KHR:
+ case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:
+ if(LINK_adreno_compute_compressedfmt_aligned_width_and_height) {
+ int bytesPerPixel = 0;
+ int raster_mode = 0; //Adreno unknown raster mode.
+ int padding_threshold = 512; //Threshold for padding
+ //surfaces.
- if (ubwc_enabled) {
- getUBwcWidthAndHeight(width, height, format, aligned_w, aligned_h);
- return;
- }
-
- aligned_w = width;
- aligned_h = height;
- int alignment = 32;
- switch (format)
- {
- case HAL_PIXEL_FORMAT_YCrCb_420_SP:
- case HAL_PIXEL_FORMAT_YCbCr_420_SP:
- if (LINK_adreno_get_gpu_pixel_alignment) {
- alignment = LINK_adreno_get_gpu_pixel_alignment();
- }
- aligned_w = ALIGN(width, alignment);
- break;
- case HAL_PIXEL_FORMAT_YCrCb_420_SP_ADRENO:
- aligned_w = ALIGN(width, alignment);
- break;
- case HAL_PIXEL_FORMAT_RAW16:
- aligned_w = ALIGN(width, 16);
- break;
- case HAL_PIXEL_FORMAT_RAW10:
- aligned_w = ALIGN(width * 10 / 8, 8);
- break;
- case HAL_PIXEL_FORMAT_YCbCr_420_SP_TILED:
- aligned_w = ALIGN(width, 128);
- break;
- case HAL_PIXEL_FORMAT_YV12:
- case HAL_PIXEL_FORMAT_YCbCr_422_SP:
- case HAL_PIXEL_FORMAT_YCrCb_422_SP:
- case HAL_PIXEL_FORMAT_YCbCr_422_I:
- case HAL_PIXEL_FORMAT_YCrCb_422_I:
- aligned_w = ALIGN(width, 16);
- break;
- case HAL_PIXEL_FORMAT_YCbCr_420_SP_VENUS:
- case HAL_PIXEL_FORMAT_NV12_ENCODEABLE:
- aligned_w = VENUS_Y_STRIDE(COLOR_FMT_NV12, width);
- aligned_h = VENUS_Y_SCANLINES(COLOR_FMT_NV12, height);
- break;
- case HAL_PIXEL_FORMAT_YCrCb_420_SP_VENUS:
- aligned_w = VENUS_Y_STRIDE(COLOR_FMT_NV21, width);
- aligned_h = VENUS_Y_SCANLINES(COLOR_FMT_NV21, height);
- break;
- case HAL_PIXEL_FORMAT_BLOB:
- break;
- case HAL_PIXEL_FORMAT_NV21_ZSL:
- aligned_w = ALIGN(width, 64);
- aligned_h = ALIGN(height, 64);
- break;
- case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_4x4_KHR:
- case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:
- case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_5x4_KHR:
- case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:
- case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_5x5_KHR:
- case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:
- case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_6x5_KHR:
- case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:
- case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_6x6_KHR:
- case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:
- case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_8x5_KHR:
- case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:
- case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_8x6_KHR:
- case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:
- case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_8x8_KHR:
- case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:
- case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_10x5_KHR:
- case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:
- case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_10x6_KHR:
- case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:
- case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_10x8_KHR:
- case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:
- case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_10x10_KHR:
- case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:
- case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_12x10_KHR:
- case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:
- case HAL_PIXEL_FORMAT_COMPRESSED_RGBA_ASTC_12x12_KHR:
- case HAL_PIXEL_FORMAT_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:
- if(LINK_adreno_compute_compressedfmt_aligned_width_and_height) {
- int bytesPerPixel = 0;
- int raster_mode = 0; //Adreno unknown raster mode.
- int padding_threshold = 512; //Threshold for padding
- //surfaces.
-
- LINK_adreno_compute_compressedfmt_aligned_width_and_height(
- width, height, format, 0,raster_mode, padding_threshold,
- &aligned_w, &aligned_h, &bytesPerPixel);
- } else {
- ALOGW("%s: Warning!! Symbols" \
- " compute_compressedfmt_aligned_width_and_height" \
- " not found", __FUNCTION__);
- }
- break;
- default: break;
+ LINK_adreno_compute_compressedfmt_aligned_width_and_height(
+ width, height, format, 0,raster_mode, padding_threshold,
+ &aligned_w, &aligned_h, &bytesPerPixel);
+ } else {
+ ALOGW("%s: Warning!! Symbols" \
+ " compute_compressedfmt_aligned_width_and_height" \
+ " not found", __FUNCTION__);
+ }
+ break;
+ default: break;
+ }
}
}
@@ -391,6 +395,14 @@
case HAL_PIXEL_FORMAT_YCbCr_420_SP_VENUS:
case HAL_PIXEL_FORMAT_YCbCr_420_SP_VENUS_UBWC:
return ADRENO_PIXELFORMAT_NV12_EXT;
+ case HAL_PIXEL_FORMAT_YCbCr_420_TP10_UBWC:
+ return ADRENO_PIXELFORMAT_TP10;
+ case HAL_PIXEL_FORMAT_RGBA_1010102:
+ return ADRENO_PIXELFORMAT_R10G10B10A2_UNORM;
+ case HAL_PIXEL_FORMAT_RGBX_1010102:
+ return ADRENO_PIXELFORMAT_R10G10B10X2_UNORM;
+ case HAL_PIXEL_FORMAT_ABGR_2101010:
+ return ADRENO_PIXELFORMAT_A2B10G10R10_UNORM;
default:
ALOGE("%s: No map for format: 0x%x", __FUNCTION__, hal_format);
break;
@@ -550,6 +562,14 @@
case HAL_PIXEL_FORMAT_RGBA_8888:
case HAL_PIXEL_FORMAT_RGBX_8888:
case HAL_PIXEL_FORMAT_BGRA_8888:
+ case HAL_PIXEL_FORMAT_RGBA_1010102:
+ case HAL_PIXEL_FORMAT_ARGB_2101010:
+ case HAL_PIXEL_FORMAT_RGBX_1010102:
+ case HAL_PIXEL_FORMAT_XRGB_2101010:
+ case HAL_PIXEL_FORMAT_BGRA_1010102:
+ case HAL_PIXEL_FORMAT_ABGR_2101010:
+ case HAL_PIXEL_FORMAT_BGRX_1010102:
+ case HAL_PIXEL_FORMAT_XBGR_2101010:
size = alignedw * alignedh * 4;
break;
case HAL_PIXEL_FORMAT_RGB_888:
@@ -706,6 +726,54 @@
size = getSize(format, width, height, usage, alignedw, alignedh);
}
+void getYuvUbwcSPPlaneInfo(private_handle_t* hnd, int color_format,
+ struct android_ycbcr* ycbcr)
+{
+ // UBWC buffer has these 4 planes in the following sequence:
+ // Y_Meta_Plane, Y_Plane, UV_Meta_Plane, UV_Plane
+ unsigned int y_meta_stride, y_meta_height, y_meta_size;
+ unsigned int y_stride, y_height, y_size;
+ unsigned int c_meta_stride, c_meta_height, c_meta_size;
+ unsigned int alignment = 4096;
+ int width = hnd->width;
+ int height = hnd->height;
+
+ y_meta_stride = VENUS_Y_META_STRIDE(color_format, width);
+ y_meta_height = VENUS_Y_META_SCANLINES(color_format, height);
+ y_meta_size = ALIGN((y_meta_stride * y_meta_height), alignment);
+
+ y_stride = VENUS_Y_STRIDE(color_format, width);
+ y_height = VENUS_Y_SCANLINES(color_format, height);
+ y_size = ALIGN((y_stride * y_height), alignment);
+
+ c_meta_stride = VENUS_UV_META_STRIDE(color_format, width);
+ c_meta_height = VENUS_UV_META_SCANLINES(color_format, height);
+ c_meta_size = ALIGN((c_meta_stride * c_meta_height), alignment);
+
+ ycbcr->y = (void*)(hnd->base + y_meta_size);
+ ycbcr->cb = (void*)(hnd->base + y_meta_size + y_size + c_meta_size);
+ ycbcr->cr = (void*)(hnd->base + y_meta_size + y_size +
+ c_meta_size + 1);
+ ycbcr->ystride = y_stride;
+ ycbcr->cstride = VENUS_UV_STRIDE(color_format, width);
+}
+
+void getYuvSPPlaneInfo(private_handle_t* hnd, int bpp,
+ struct android_ycbcr* ycbcr)
+{
+ int width = hnd->width;
+ int height = hnd->height;
+ unsigned int ystride, cstride;
+
+ ystride = cstride = width * bpp;
+ ycbcr->y = (void*)hnd->base;
+ ycbcr->cb = (void*)(hnd->base + ystride * height);
+ ycbcr->cr = (void*)(hnd->base + ystride * height + 1);
+ ycbcr->ystride = ystride;
+ ycbcr->cstride = cstride;
+ ycbcr->chroma_step = 2 * bpp;
+}
+
int getYUVPlaneInfo(private_handle_t* hnd, struct android_ycbcr* ycbcr)
{
int err = 0;
@@ -714,7 +782,6 @@
int format = hnd->format;
unsigned int ystride, cstride;
- unsigned int alignment = 4096;
memset(ycbcr->reserved, 0, sizeof(ycbcr->reserved));
MetaData_t *metadata = (MetaData_t *)hnd->base_metadata;
@@ -744,43 +811,23 @@
case HAL_PIXEL_FORMAT_YCbCr_422_SP:
case HAL_PIXEL_FORMAT_YCbCr_420_SP_VENUS:
case HAL_PIXEL_FORMAT_NV12_ENCODEABLE: //Same as YCbCr_420_SP_VENUS
- ystride = cstride = width;
- ycbcr->y = (void*)hnd->base;
- ycbcr->cb = (void*)(hnd->base + ystride * height);
- ycbcr->cr = (void*)(hnd->base + ystride * height + 1);
- ycbcr->ystride = ystride;
- ycbcr->cstride = cstride;
- ycbcr->chroma_step = 2;
+ getYuvSPPlaneInfo(hnd, 1, ycbcr);
+ break;
+
+ case HAL_PIXEL_FORMAT_YCbCr_420_P010:
+ getYuvSPPlaneInfo(hnd, 2, ycbcr);
break;
case HAL_PIXEL_FORMAT_YCbCr_420_SP_VENUS_UBWC:
- // NV12_UBWC buffer has these 4 planes in the following sequence:
- // Y_Meta_Plane, Y_Plane, UV_Meta_Plane, UV_Plane
- unsigned int y_meta_stride, y_meta_height, y_meta_size;
- unsigned int y_stride, y_height, y_size;
- unsigned int c_meta_stride, c_meta_height, c_meta_size;
-
- y_meta_stride = VENUS_Y_META_STRIDE(COLOR_FMT_NV12_UBWC, width);
- y_meta_height = VENUS_Y_META_SCANLINES(COLOR_FMT_NV12_UBWC, height);
- y_meta_size = ALIGN((y_meta_stride * y_meta_height), alignment);
-
- y_stride = VENUS_Y_STRIDE(COLOR_FMT_NV12_UBWC, width);
- y_height = VENUS_Y_SCANLINES(COLOR_FMT_NV12_UBWC, height);
- y_size = ALIGN((y_stride * y_height), alignment);
-
- c_meta_stride = VENUS_UV_META_STRIDE(COLOR_FMT_NV12_UBWC, width);
- c_meta_height = VENUS_UV_META_SCANLINES(COLOR_FMT_NV12_UBWC, height);
- c_meta_size = ALIGN((c_meta_stride * c_meta_height), alignment);
-
- ycbcr->y = (void*)(hnd->base + y_meta_size);
- ycbcr->cb = (void*)(hnd->base + y_meta_size + y_size + c_meta_size);
- ycbcr->cr = (void*)(hnd->base + y_meta_size + y_size +
- c_meta_size + 1);
- ycbcr->ystride = y_stride;
- ycbcr->cstride = VENUS_UV_STRIDE(COLOR_FMT_NV12_UBWC, width);
+ getYuvUbwcSPPlaneInfo(hnd, COLOR_FMT_NV12_UBWC, ycbcr);
ycbcr->chroma_step = 2;
break;
+ case HAL_PIXEL_FORMAT_YCbCr_420_TP10_UBWC:
+ getYuvUbwcSPPlaneInfo(hnd, COLOR_FMT_NV12_BPP10_UBWC, ycbcr);
+ ycbcr->chroma_step = 3;
+ break;
+
case HAL_PIXEL_FORMAT_YCrCb_420_SP:
case HAL_PIXEL_FORMAT_YCrCb_422_SP:
case HAL_PIXEL_FORMAT_YCrCb_420_SP_ADRENO:
@@ -788,13 +835,8 @@
case HAL_PIXEL_FORMAT_NV21_ZSL:
case HAL_PIXEL_FORMAT_RAW16:
case HAL_PIXEL_FORMAT_RAW10:
- ystride = cstride = width;
- ycbcr->y = (void*)hnd->base;
- ycbcr->cr = (void*)(hnd->base + ystride * height);
- ycbcr->cb = (void*)(hnd->base + ystride * height + 1);
- ycbcr->ystride = ystride;
- ycbcr->cstride = cstride;
- ycbcr->chroma_step = 2;
+ getYuvSPPlaneInfo(hnd, 1, ycbcr);
+ std::swap(ycbcr->cb, ycbcr->cr);
break;
//Planar
@@ -882,6 +924,7 @@
switch(format)
{
case HAL_PIXEL_FORMAT_YCbCr_420_SP_VENUS_UBWC:
+ case HAL_PIXEL_FORMAT_YCbCr_420_TP10_UBWC:
return true;
default:
return false;
@@ -898,6 +941,8 @@
case HAL_PIXEL_FORMAT_RGBX_8888:
case HAL_PIXEL_FORMAT_NV12_ENCODEABLE:
case HAL_PIXEL_FORMAT_YCbCr_420_SP_VENUS:
+ case HAL_PIXEL_FORMAT_RGBA_1010102:
+ case HAL_PIXEL_FORMAT_RGBX_1010102:
return true;
default:
return false;
@@ -933,7 +978,7 @@
return false;
}
-static void getUBwcWidthAndHeight(int width, int height, int format,
+static void getYuvUBwcWidthHeight(int width, int height, int format,
int& aligned_w, int& aligned_h)
{
switch (format)
@@ -944,6 +989,10 @@
aligned_w = VENUS_Y_STRIDE(COLOR_FMT_NV12_UBWC, width);
aligned_h = VENUS_Y_SCANLINES(COLOR_FMT_NV12_UBWC, height);
break;
+ case HAL_PIXEL_FORMAT_YCbCr_420_TP10_UBWC:
+ aligned_w = VENUS_Y_STRIDE(COLOR_FMT_NV12_BPP10_UBWC, width);
+ aligned_h = VENUS_Y_SCANLINES(COLOR_FMT_NV12_BPP10_UBWC, height);
+ break;
default:
ALOGE("%s: Unsupported pixel format: 0x%x", __FUNCTION__, format);
aligned_w = 0;
@@ -952,7 +1001,7 @@
}
}
-static void getUBwcBlockSize(int bpp, int& block_width, int& block_height)
+static void getRgbUBwcBlockSize(int bpp, int& block_width, int& block_height)
{
block_width = 0;
block_height = 0;
@@ -978,13 +1027,13 @@
}
}
-static unsigned int getUBwcMetaBufferSize(int width, int height, int bpp)
+static unsigned int getRgbUBwcMetaBufferSize(int width, int height, int bpp)
{
unsigned int size = 0;
int meta_width, meta_height;
int block_width, block_height;
- getUBwcBlockSize(bpp, block_width, block_height);
+ getRgbUBwcBlockSize(bpp, block_width, block_height);
if (!block_width || !block_height) {
ALOGE("%s: Unsupported bpp: %d", __FUNCTION__, bpp);
@@ -1009,18 +1058,23 @@
switch (format) {
case HAL_PIXEL_FORMAT_BGR_565:
size = alignedw * alignedh * 2;
- size += getUBwcMetaBufferSize(width, height, 2);
+ size += getRgbUBwcMetaBufferSize(width, height, 2);
break;
case HAL_PIXEL_FORMAT_RGBA_8888:
case HAL_PIXEL_FORMAT_RGBX_8888:
+ case HAL_PIXEL_FORMAT_RGBA_1010102:
+ case HAL_PIXEL_FORMAT_RGBX_1010102:
size = alignedw * alignedh * 4;
- size += getUBwcMetaBufferSize(width, height, 4);
+ size += getRgbUBwcMetaBufferSize(width, height, 4);
break;
case HAL_PIXEL_FORMAT_NV12_ENCODEABLE:
case HAL_PIXEL_FORMAT_YCbCr_420_SP_VENUS:
case HAL_PIXEL_FORMAT_YCbCr_420_SP_VENUS_UBWC:
size = VENUS_BUFFER_SIZE(COLOR_FMT_NV12_UBWC, width, height);
break;
+ case HAL_PIXEL_FORMAT_YCbCr_420_TP10_UBWC:
+ size = VENUS_BUFFER_SIZE(COLOR_FMT_NV12_BPP10_UBWC, width, height);
+ break;
default:
ALOGE("%s: Unsupported pixel format: 0x%x", __FUNCTION__, format);
break;
@@ -1046,11 +1100,11 @@
unsigned int meta_size = 0;
switch (hnd->format) {
case HAL_PIXEL_FORMAT_BGR_565:
- meta_size = getUBwcMetaBufferSize(hnd->width, hnd->height, 2);
+ meta_size = getRgbUBwcMetaBufferSize(hnd->width, hnd->height, 2);
break;
case HAL_PIXEL_FORMAT_RGBA_8888:
case HAL_PIXEL_FORMAT_RGBX_8888:
- meta_size = getUBwcMetaBufferSize(hnd->width, hnd->height, 4);
+ meta_size = getRgbUBwcMetaBufferSize(hnd->width, hnd->height, 4);
break;
default:
ALOGE("%s:Unsupported RGB format: 0x%x", __FUNCTION__, hnd->format);
diff --git a/libgralloc/gr.h b/libgralloc/gr.h
index 1b8d9b4..bb1f6dd 100644
--- a/libgralloc/gr.h
+++ b/libgralloc/gr.h
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2008 The Android Open Source Project
- * Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2011 - 2016, The Linux Foundation. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -76,7 +76,7 @@
// To query if UBWC is enabled, based on format and usage flags
bool isUBwcEnabled(int format, int usage);
-// Function to check if the format is an uncompressed RGB format
+// Function to check if the format is an RGB format
bool isUncompressedRgbFormat(int format);
/*****************************************************************************/
diff --git a/libgralloc/gralloc_priv.h b/libgralloc/gralloc_priv.h
index 7a5fc84..613c066 100644
--- a/libgralloc/gralloc_priv.h
+++ b/libgralloc/gralloc_priv.h
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2008 The Android Open Source Project
- * Copyright (c) 2011-2015, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2011 - 2016, The Linux Foundation. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -109,6 +109,17 @@
#define HAL_PIXEL_FORMAT_NV21_ZSL 0x113
#define HAL_PIXEL_FORMAT_YCrCb_420_SP_VENUS 0x114
#define HAL_PIXEL_FORMAT_BGR_565 0x115
+#define HAL_PIXEL_FORMAT_RGBA_1010102 0x116
+#define HAL_PIXEL_FORMAT_ARGB_2101010 0x117
+#define HAL_PIXEL_FORMAT_RGBX_1010102 0x118
+#define HAL_PIXEL_FORMAT_XRGB_2101010 0x119
+#define HAL_PIXEL_FORMAT_BGRA_1010102 0x11A
+#define HAL_PIXEL_FORMAT_ABGR_2101010 0x11B
+#define HAL_PIXEL_FORMAT_BGRX_1010102 0x11C
+#define HAL_PIXEL_FORMAT_XBGR_2101010 0x11D
+#define HAL_PIXEL_FORMAT_YCbCr_420_P010 0x11F
+#define HAL_PIXEL_FORMAT_YCbCr_420_TP10_UBWC 0x120
+
#define HAL_PIXEL_FORMAT_INTERLACE 0x180
//v4l2_fourcc('Y', 'U', 'Y', 'L'). 24 bpp YUYV 4:2:2 10 bit per component
diff --git a/libgralloc/mapper.cpp b/libgralloc/mapper.cpp
index 421069f..142586b 100644
--- a/libgralloc/mapper.cpp
+++ b/libgralloc/mapper.cpp
@@ -467,18 +467,8 @@
} break;
case GRALLOC_MODULE_PERFORM_SET_IGC:
- {
- private_handle_t* hnd = va_arg(args, private_handle_t*);
- uint32_t igc = va_arg(args, uint32_t);
- if (!private_handle_t::validate(hnd)) {
- MetaData_t *metadata = (MetaData_t *)hnd->base_metadata;
- if (metadata) {
- metadata->igc = (IGC_t) igc;
- metadata->operation |= SET_IGC;
- res = 0;
- }
- }
- } break;
+ res = 0;
+ break;
case GRALLOC_MODULE_PERFORM_SET_SINGLE_BUFFER_MODE:
{
diff --git a/sdm/include/core/layer_buffer.h b/sdm/include/core/layer_buffer.h
index c437dab..47ebf92 100644
--- a/sdm/include/core/layer_buffer.h
+++ b/sdm/include/core/layer_buffer.h
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2014, The Linux Foundation. All rights reserved.
+* Copyright (c) 2014, 2016, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted
* provided that the following conditions are met:
@@ -58,6 +58,16 @@
kFormatRGBA8888Ubwc, //!< UBWC aligned RGBA8888 format
kFormatRGBX8888Ubwc, //!< UBWC aligned RGBX8888 format
kFormatBGR565Ubwc, //!< UBWC aligned BGR565 format
+ kFormatRGBA1010102, //!< 10-bits Red, Green, Blue, Alpha interleaved in RGBA order.
+ kFormatARGB2101010, //!< 10-bits Alpha, Red, Green, Blue interleaved in ARGB order.
+ kFormatRGBX1010102, //!< 10-bits Red, Green, Blue, Padding interleaved in RGBX order. No Alpha.
+ kFormatXRGB2101010, //!< 10-bits Padding, Red, Green, Blue interleaved in XRGB order. No Alpha.
+ kFormatBGRA1010102, //!< 10-bits Blue, Green, Red, Alpha interleaved in BGRA order.
+ kFormatABGR2101010, //!< 10-bits Alpha, Blue, Green, Red interleaved in ABGR order.
+ kFormatBGRX1010102, //!< 10-bits Blue, Green, Red, Padding interleaved in BGRX order. No Alpha.
+ kFormatXBGR2101010, //!< 10-bits Padding, Blue, Green, Red interleaved in XBGR order. No Alpha.
+ kFormatRGBA1010102Ubwc, //!< UBWC aligned RGBA1010102 format
+ kFormatRGBX1010102Ubwc, //!< UBWC aligned RGBX1010102 format
/* All YUV-Planar formats, Any new format will be added towards end of this group to maintain
backward compatibility.
@@ -111,6 +121,15 @@
//!< 2x2 subsampled interleaved UV-plane:
//!< v(0), u(0), v(2), u(2) ... v(n-1), u(n-1)
+ kFormatYCbCr420P010, //!< 16 bit Y-plane with 5 MSB bits set to 0:
+ //!< y(0), y(1), y(2) ... y(n)
+ //!< 2x2 subsampled interleaved 10 bit UV-plane with
+ //!< 5 MSB bits set to 0:
+ //!< u(0), v(0), u(2), v(2) ... u(n-1), v(n-1)
+ //!< aka P010.
+
+ kFormatYCbCr420TP10Ubwc, //!< UBWC aligned YCbCr420TP10 format.
+
/* All YUV-Packed formats, Any new format will be added towards end of this group to maintain
backward compatibility.
*/
@@ -185,6 +204,7 @@
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 size = 0; //!< Size of a single buffer (even if multiple clubbed together)
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/core/layer_stack.h b/sdm/include/core/layer_stack.h
index 34c68fe..746d831 100644
--- a/sdm/include/core/layer_stack.h
+++ b/sdm/include/core/layer_stack.h
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2014 - 2015, The Linux Foundation. All rights reserved.
+* Copyright (c) 2014 - 2016, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted
* provided that the following conditions are met:
@@ -117,11 +117,18 @@
@sa Layer
*/
struct LayerTransform {
- float rotation; //!< Left most pixel coordinate.
- bool flip_horizontal; //!< Mirror reversal of the layer across a horizontal axis.
- bool flip_vertical; //!< Mirror reversal of the layer across a vertical axis.
+ float rotation = 0.0f; //!< Left most pixel coordinate.
+ bool flip_horizontal = false; //!< Mirror reversal of the layer across a horizontal axis.
+ bool flip_vertical = false; //!< Mirror reversal of the layer across a vertical axis.
- LayerTransform() : rotation(0.0f), flip_horizontal(false), flip_vertical(false) { }
+ bool operator==(const LayerTransform& transform) const {
+ return (rotation == transform.rotation && flip_horizontal == transform.flip_horizontal &&
+ flip_vertical == transform.flip_vertical);
+ }
+
+ bool operator!=(const LayerTransform& transform) const {
+ return !operator==(transform);
+ }
};
/*! @brief This structure defines flags associated with a layer. The 1-bit flag can be set to ON(1)
@@ -214,7 +221,16 @@
float bottom = 0.0f; //!< Bottom-most pixel coordinate.
LayerRect() = default;
+
LayerRect(float l, float t, float r, float b) : left(l), top(t), right(r), bottom(b) { }
+
+ bool operator==(const LayerRect& rect) const {
+ return left == rect.left && right == rect.right && top == rect.top && bottom == rect.bottom;
+ }
+
+ bool operator!=(const LayerRect& rect) const {
+ return !operator==(rect);
+ }
};
/*! @brief This structure defines an array of display layer rectangles.
diff --git a/sdm/include/private/color_params.h b/sdm/include/private/color_params.h
index 4d03781..e7f779a 100644
--- a/sdm/include/private/color_params.h
+++ b/sdm/include/private/color_params.h
@@ -62,6 +62,7 @@
kGlobalColorFeaturePaV2,
kGlobalColorFeatureDither,
kGlobalColorFeatureGamut,
+ kGlobalColorFeaturePADither,
kMaxNumPPFeatures,
};
@@ -99,7 +100,8 @@
static const uint32_t kSDEGamutV17 = 9;
static const uint32_t kSDEPaV17 = 11;
static const uint32_t kSDEPccV17 = 13;
- static const uint32_t kSDELegacyPP = 15;
+ static const uint32_t kSDEPADitherV17 = 15;
+ static const uint32_t kSDELegacyPP = 17;
uint32_t version[kMaxNumPPFeatures];
PPFeatureVersion() { memset(version, 0, sizeof(version)); }
@@ -198,6 +200,28 @@
SDEDitherCfg *GetConfig() { return this; }
};
+struct SDEPADitherData {
+ uint32_t data_flags;
+ uint32_t matrix_size;
+ uint64_t matrix_data_addr;
+ uint32_t strength;
+ uint32_t offset_en;
+};
+
+class SDEPADitherWrapper : private SDEPADitherData {
+ public:
+ static SDEPADitherWrapper *Init(uint32_t arg __attribute__((__unused__)));
+ ~SDEPADitherWrapper() {
+ if (buffer_)
+ delete[] buffer_;
+ }
+ inline SDEPADitherData *GetConfig(void) { return this; }
+
+ private:
+ SDEPADitherWrapper() {}
+ uint32_t *buffer_ = NULL;
+};
+
struct SDEPaMemColorData {
uint32_t adjust_p0 = 0;
uint32_t adjust_p1 = 0;
diff --git a/sdm/include/private/extension_interface.h b/sdm/include/private/extension_interface.h
index ef143e8..4283b53 100644
--- a/sdm/include/private/extension_interface.h
+++ b/sdm/include/private/extension_interface.h
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2015, The Linux Foundation. All rights reserved.
+* Copyright (c) 2015 - 2016, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted
* provided that the following conditions are met:
@@ -58,7 +58,7 @@
virtual DisplayError DestroyPartialUpdate(PartialUpdateInterface *interface) = 0;
virtual DisplayError CreateStrategyExtn(DisplayType type, HWDisplayMode mode,
- StrategyInterface **interface) = 0;
+ HWS3DMode s3d_mode, StrategyInterface **interface) = 0;
virtual DisplayError DestroyStrategyExtn(StrategyInterface *interface) = 0;
virtual DisplayError CreateResourceExtn(const HWResourceInfo &hw_resource_info,
@@ -66,7 +66,8 @@
BufferSyncHandler *buffer_sync_handler) = 0;
virtual DisplayError DestroyResourceExtn(ResourceInterface *interface) = 0;
- virtual DisplayError CreateRotator(BufferAllocator *buffer_allocator,
+ virtual DisplayError CreateRotator(const HWRotatorInfo &hw_rot_info,
+ BufferAllocator *buffer_allocator,
BufferSyncHandler *buffer_sync_handler,
RotatorInterface **intf) = 0;
virtual DisplayError DestroyRotator(RotatorInterface *intf) = 0;
diff --git a/sdm/include/private/hw_info_types.h b/sdm/include/private/hw_info_types.h
index 4231cc4..5ecb75d 100644
--- a/sdm/include/private/hw_info_types.h
+++ b/sdm/include/private/hw_info_types.h
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2015 - 2016, The Linux Foundation. All rights reserved.
+* Copyright (c) 2015-2016, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted
* provided that the following conditions are met:
@@ -30,6 +30,7 @@
#include <core/core_interface.h>
#include <vector>
#include <map>
+#include <string>
namespace sdm {
const int kMaxSDELayers = 16; // Maximum number of layers that can be handled by hardware in a
@@ -97,6 +98,17 @@
struct HWPipeCaps {
PipeType type = kPipeTypeUnused;
uint32_t id = 0;
+ uint32_t max_rects = 1;
+};
+
+struct HWRotatorInfo {
+ enum { ROT_TYPE_MDSS, ROT_TYPE_V4L2 };
+ uint32_t type = ROT_TYPE_MDSS;
+ uint32_t num_rotator = 0;
+ bool has_downscale = false;
+ std::string device_path = "";
+
+ void Reset() { *this = HWRotatorInfo(); }
};
struct HWResourceInfo {
@@ -107,7 +119,6 @@
uint32_t num_rgb_pipe = 0;
uint32_t num_cursor_pipe = 0;
uint32_t num_blending_stages = 0;
- uint32_t num_rotator = 0;
uint32_t num_control = 0;
uint32_t num_mixer_to_disp = 0;
uint32_t smp_total = 0;
@@ -132,14 +143,15 @@
bool has_ubwc = false;
bool has_decimation = false;
bool has_macrotile = false;
- bool has_rotator_downscale = false;
bool has_non_scalar_rgb = false;
bool is_src_split = false;
bool perf_calc = false;
bool has_dyn_bw_support = false;
+ bool separate_rotator = false;
HWDynBwLimitInfo dyn_bw_info;
std::vector<HWPipeCaps> hw_pipes;
FormatsMap supported_formats_map;
+ HWRotatorInfo hw_rot_info;
void Reset() { *this = HWResourceInfo(); }
};
@@ -211,17 +223,30 @@
LayerRect dst_rect;
uint32_t buffer_count = 0;
bool secure = false;
- bool cache = false;
uint32_t frame_rate = 0;
+ LayerTransform transform;
+
+ bool operator==(const HWSessionConfig& config) const {
+ return (src_rect == config.src_rect &&
+ dst_rect == config.dst_rect &&
+ buffer_count == config.buffer_count &&
+ secure == config.secure &&
+ frame_rate == config.frame_rate &&
+ transform == config.transform);
+ }
+
+ bool operator!=(const HWSessionConfig& config) const {
+ return !operator==(config);
+ }
};
struct HWRotateInfo {
- int pipe_id = -1;
- int writeback_id = -1;
- LayerRect src_roi;
- LayerRect dst_roi;
+ int pipe_id = -1; // Not actual pipe id, but the relative DMA id
+ int writeback_id = -1; // Writeback block id, but this is the same as DMA id
+ LayerRect src_roi; // Source crop of each split
+ LayerRect dst_roi; // Destination crop of each split
bool valid = false;
- int rotate_id = -1;
+ int rotate_id = -1; // Actual rotator session id with driver
void Reset() { *this = HWRotateInfo(); }
};
@@ -229,12 +254,10 @@
struct HWRotatorSession {
HWRotateInfo hw_rotate_info[kMaxRotatePerLayer];
uint32_t hw_block_count = 0; // number of rotator hw blocks used by rotator session
- float downscale_ratio = 1.0f;
- LayerTransform transform;
+ int session_id = -1; // A handle with Session Manager
HWSessionConfig hw_session_config;
- LayerBuffer output_buffer;
- LayerBuffer input_buffer;
- int session_id = -1;
+ LayerBuffer input_buffer; // Input to rotator
+ LayerBuffer output_buffer; // Output of rotator, crop width and stride are same
float input_compression = 1.0f;
float output_compression = 1.0f;
bool is_buffer_cached = false;
diff --git a/sdm/include/utils/debug.h b/sdm/include/utils/debug.h
index 251e195..5ac2319 100644
--- a/sdm/include/utils/debug.h
+++ b/sdm/include/utils/debug.h
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2014 - 2015, The Linux Foundation. All rights reserved.
+* Copyright (c) 2014 - 2016, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -63,7 +63,7 @@
static inline DebugHandler* Get() { return debug_.debug_handler_; }
static int GetSimulationFlag();
static int GetHDMIResolution();
- static int GetIdleTimeoutMs();
+ static uint32_t GetIdleTimeoutMs();
static int GetBootAnimLayerCount();
static bool IsRotatorDownScaleDisabled();
static bool IsDecimationDisabled();
diff --git a/sdm/include/utils/formats.h b/sdm/include/utils/formats.h
new file mode 100644
index 0000000..57825dd
--- /dev/null
+++ b/sdm/include/utils/formats.h
@@ -0,0 +1,43 @@
+/*
+* Copyright (c) 2016, The Linux Foundation. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are
+* met:
+* * Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+* * Redistributions in binary form must reproduce the above
+* copyright notice, this list of conditions and the following
+* disclaimer in the documentation and/or other materials provided
+* with the distribution.
+* * Neither the name of The Linux Foundation nor the names of its
+* contributors may be used to endorse or promote products derived
+* from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef __FORMATS_H__
+#define __FORMATS_H__
+
+#include <core/layer_stack.h>
+
+namespace sdm {
+
+bool IsUBWCFormat(LayerBufferFormat format);
+bool Is10BitFormat(LayerBufferFormat format);
+
+} // namespace sdm
+
+#endif // __FORMATS_H__
+
diff --git a/sdm/libs/core/Android.mk b/sdm/libs/core/Android.mk
index 3ccb3ea..3cc57d2 100644
--- a/sdm/libs/core/Android.mk
+++ b/sdm/libs/core/Android.mk
@@ -7,7 +7,7 @@
$(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/include \
external/libcxx/include/
LOCAL_CFLAGS := -Wno-missing-field-initializers -Wno-unused-parameter \
- -Wall -Werror -std=c++11 -fcolor-diagnostics\
+ -Wall -Werror -Wconversion -std=c++11 -fcolor-diagnostics\
-DLOG_TAG=\"SDM\"
LOCAL_CLANG := true
LOCAL_HW_INTF_PATH := fb
diff --git a/sdm/libs/core/color_manager.cpp b/sdm/libs/core/color_manager.cpp
index 5dee062..7b8a1ca 100644
--- a/sdm/libs/core/color_manager.cpp
+++ b/sdm/libs/core/color_manager.cpp
@@ -1,4 +1,4 @@
-/* Copyright (c) 2015, The Linux Foundataion. All rights reserved.
+/* Copyright (c) 2015 - 2016, The Linux Foundataion. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -57,7 +57,7 @@
DisplayError PPFeaturesConfig::RetrieveNextFeature(PPFeatureInfo **feature) {
DisplayError ret = kErrorNone;
- int i(0);
+ uint32_t i(0);
for (i = next_idx_; i < kMaxNumPPFeatures; i++) {
if (feature_[i]) {
diff --git a/sdm/libs/core/comp_manager.cpp b/sdm/libs/core/comp_manager.cpp
index 41c5213..dc1e29e 100644
--- a/sdm/libs/core/comp_manager.cpp
+++ b/sdm/libs/core/comp_manager.cpp
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2014 - 2015, The Linux Foundation. All rights reserved.
+* Copyright (c) 2014 - 2016, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted
* provided that the following conditions are met:
@@ -81,7 +81,7 @@
}
Strategy *&strategy = display_comp_ctx->strategy;
- strategy = new Strategy(extension_intf_, type, hw_res_info_, hw_panel_info);
+ strategy = new Strategy(extension_intf_, type, hw_res_info_, hw_panel_info, attributes);
if (!strategy) {
DLOGE("Unable to create strategy");
delete display_comp_ctx;
@@ -140,6 +140,10 @@
CLEAR_BIT(registered_displays_, display_comp_ctx->display_type);
CLEAR_BIT(configured_displays_, display_comp_ctx->display_type);
+ if (display_comp_ctx->display_type == kHDMI) {
+ max_layers_ = kMaxSDELayers;
+ }
+
DLOGV_IF(kTagCompManager, "registered display bit mask 0x%x, configured display bit mask 0x%x, " \
"display type %d", registered_displays_, configured_displays_,
display_comp_ctx->display_type);
@@ -167,7 +171,7 @@
Strategy *&new_strategy = display_comp_ctx->strategy;
display_comp_ctx->strategy = new Strategy(extension_intf_, display_comp_ctx->display_type,
- hw_res_info_, hw_panel_info);
+ hw_res_info_, hw_panel_info, attributes);
if (!display_comp_ctx->strategy) {
DLOGE("Unable to create strategy.");
return kErrorMemory;
@@ -181,6 +185,16 @@
return error;
}
+ // For HDMI S3D mode, set max_layers_ to 0 so that primary display would fall back
+ // to GPU composition to release pipes for HDMI.
+ if (display_comp_ctx->display_type == kHDMI) {
+ if (hw_panel_info.s3d_mode != kS3DModeNone) {
+ max_layers_ = 0;
+ } else {
+ max_layers_ = kMaxSDELayers;
+ }
+ }
+
return error;
}
@@ -191,6 +205,7 @@
constraints->safe_mode = safe_mode_;
constraints->use_cursor = false;
+ constraints->max_layers = max_layers_;
// Limit 2 layer SDE Comp on HDMI/Virtual
if (display_comp_ctx->display_type != kPrimary) {
@@ -418,7 +433,7 @@
return supported;
}
- for (int32_t i = layer_stack->layer_count - 1; i >= 0; i--) {
+ for (int32_t i = INT32(layer_stack->layer_count - 1); i >= 0; i--) {
Layer &layer = layer_stack->layers[i];
if (layer.composition == kCompositionGPUTarget) {
gpu_index = i;
diff --git a/sdm/libs/core/comp_manager.h b/sdm/libs/core/comp_manager.h
index daef25e..7744070 100644
--- a/sdm/libs/core/comp_manager.h
+++ b/sdm/libs/core/comp_manager.h
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2014 - 2015, The Linux Foundation. All rights reserved.
+* Copyright (c) 2014 - 2016, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted
* provided that the following conditions are met:
@@ -92,6 +92,7 @@
// that uses optimal number of pipes for each display
HWResourceInfo hw_res_info_;
ExtensionInterface *extension_intf_ = NULL;
+ uint32_t max_layers_ = kMaxSDELayers;
};
} // namespace sdm
diff --git a/sdm/libs/core/core_impl.cpp b/sdm/libs/core/core_impl.cpp
index 85ad2ff..424be43 100644
--- a/sdm/libs/core/core_impl.cpp
+++ b/sdm/libs/core/core_impl.cpp
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2014 - 2015, The Linux Foundation. All rights reserved.
+* Copyright (c) 2014 - 2016, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted
* provided that the following conditions are met:
@@ -93,9 +93,9 @@
goto CleanupOnError;
}
- if (extension_intf_) {
- error = extension_intf_->CreateRotator(buffer_allocator_, buffer_sync_handler_,
- &rotator_intf_);
+ if (extension_intf_ && hw_resource_->hw_rot_info.num_rotator) {
+ error = extension_intf_->CreateRotator(hw_resource_->hw_rot_info, buffer_allocator_,
+ buffer_sync_handler_, &rotator_intf_);
if (error != kErrorNone) {
DLOGW("rotation is not supported");
}
@@ -129,7 +129,7 @@
DisplayError CoreImpl::Deinit() {
SCOPE_LOCK(locker_);
- if (extension_intf_) {
+ if (extension_intf_ && hw_resource_->hw_rot_info.num_rotator) {
extension_intf_->DestroyRotator(rotator_intf_);
}
diff --git a/sdm/libs/core/display_base.cpp b/sdm/libs/core/display_base.cpp
index f0b78b3..c2973e0 100644
--- a/sdm/libs/core/display_base.cpp
+++ b/sdm/libs/core/display_base.cpp
@@ -70,7 +70,7 @@
if (hw_info_intf_) {
HWResourceInfo hw_resource_info = HWResourceInfo();
hw_info_intf_->GetHWResourceInfo(&hw_resource_info);
- int max_mixer_stages = hw_resource_info.num_blending_stages;
+ auto max_mixer_stages = hw_resource_info.num_blending_stages;
int property_value = Debug::GetMaxPipesPerMixer(display_type_);
if (property_value >= 0) {
max_mixer_stages = MIN(UINT32(property_value), hw_resource_info.num_blending_stages);
@@ -142,8 +142,8 @@
return kErrorParameters;
}
- uint32_t gpu_target_layer_dst_xpixels = gpu_target_layer.dst_rect.right;
- uint32_t gpu_target_layer_dst_ypixels = gpu_target_layer.dst_rect.bottom;
+ auto gpu_target_layer_dst_xpixels = gpu_target_layer.dst_rect.right;
+ auto gpu_target_layer_dst_ypixels = gpu_target_layer.dst_rect.bottom;
HWDisplayAttributes display_attrib;
uint32_t active_index = 0;
@@ -162,7 +162,7 @@
DisplayError DisplayBase::Prepare(LayerStack *layer_stack) {
DisplayError error = kErrorNone;
bool disable_partial_update = false;
- uint32_t pending;
+ uint32_t pending = 0;
if (!layer_stack) {
return kErrorParameters;
@@ -179,7 +179,8 @@
return kErrorPermission;
}
- if (color_mgr_) {
+ // Request to disable partial update only if it is currently enabled.
+ if (color_mgr_ && partial_update_control_) {
disable_partial_update = color_mgr_->NeedsPartialUpdateDisable();
if (disable_partial_update) {
ControlPartialUpdate(false, &pending);
@@ -484,7 +485,7 @@
return kErrorNotSupported;
}
- *pending = false;
+ *pending = 0;
if (enable == partial_update_control_) {
DLOGI("Same state transition is requested.");
return kErrorNone;
@@ -496,7 +497,7 @@
if (!enable) {
// If the request is to turn off feature, new draw call is required to have
// the new setting into effect.
- *pending = true;
+ *pending = 1;
}
return kErrorNone;
@@ -712,6 +713,18 @@
case kFormatYCrCb422H2V1SemiPlanar: return "Y_CRCB_422_H2V2";
case kFormatYCbCr420SPVenusUbwc: return "Y_CBCR_420_VENUS_UBWC";
case kFormatYCbCr422H2V1Packed: return "YCBYCR_422_H2V1";
+ case kFormatRGBA1010102: return "RGBA_1010102";
+ case kFormatARGB2101010: return "ARGB_2101010";
+ case kFormatRGBX1010102: return "RGBX_1010102";
+ case kFormatXRGB2101010: return "XRGB_2101010";
+ case kFormatBGRA1010102: return "BGRA_1010102";
+ case kFormatABGR2101010: return "ABGR_2101010";
+ case kFormatBGRX1010102: return "BGRX_1010102";
+ case kFormatXBGR2101010: return "XBGR_2101010";
+ case kFormatRGBA1010102Ubwc: return "RGBA_1010102_UBWC";
+ case kFormatRGBX1010102Ubwc: return "RGBX_1010102_UBWC";
+ case kFormatYCbCr420P010: return "Y_CBCR_420_P010";
+ case kFormatYCbCr420TP10Ubwc: return "Y_CBCR_420_TP10_UBWC";
default: return "UNKNOWN";
}
}
diff --git a/sdm/libs/core/display_hdmi.cpp b/sdm/libs/core/display_hdmi.cpp
index 123e300..773016a 100644
--- a/sdm/libs/core/display_hdmi.cpp
+++ b/sdm/libs/core/display_hdmi.cpp
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2014 - 2015, The Linux Foundation. All rights reserved.
+* Copyright (c) 2014 - 2016, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted
* provided that the following conditions are met:
@@ -54,9 +54,10 @@
uint32_t active_mode_index;
char value[64] = "0";
- Debug::GetProperty("sdm.hdmi.s3d_enable", value);
- if (atoi(value) != 0) {
- active_mode_index = GetBestConfig(kS3DModeLR);
+ Debug::GetProperty("sdm.hdmi.s3d_mode", value);
+ HWS3DMode mode = (HWS3DMode)atoi(value);
+ if (mode > kS3DModeNone && mode < kS3DModeMax) {
+ active_mode_index = GetBestConfig(mode);
} else {
active_mode_index = GetBestConfig(kS3DModeNone);
}
@@ -203,7 +204,7 @@
return hw_intf_->OnMinHdcpEncryptionLevelChange(min_enc_level);
}
-int DisplayHDMI::GetBestConfig(HWS3DMode s3d_mode) {
+uint32_t DisplayHDMI::GetBestConfig(HWS3DMode s3d_mode) {
uint32_t best_index = 0, index;
uint32_t num_modes = 0;
HWDisplayAttributes best_attrib;
@@ -223,7 +224,7 @@
}
}
if (index < num_modes) {
- best_index = index;
+ best_index = UINT32(index);
for (size_t index = best_index + 1; index < num_modes; index ++) {
if (!IS_BIT_SET(attrib[index].s3d_config, s3d_mode))
continue;
@@ -231,13 +232,13 @@
// From the available configs, select the best
// Ex: 1920x1080@60Hz is better than 1920x1080@30 and 1920x1080@30 is better than 1280x720@60
if (attrib[index].y_pixels > attrib[best_index].y_pixels) {
- best_index = index;
+ best_index = UINT32(index);
} else if (attrib[index].y_pixels == attrib[best_index].y_pixels) {
if (attrib[index].x_pixels > attrib[best_index].x_pixels) {
- best_index = index;
+ best_index = UINT32(index);
} else if (attrib[index].x_pixels == attrib[best_index].x_pixels) {
if (attrib[index].vsync_period_ns < attrib[best_index].vsync_period_ns) {
- best_index = index;
+ best_index = UINT32(index);
}
}
}
@@ -249,9 +250,9 @@
delete[] attrib;
// Used for changing HDMI Resolution - override the best with user set config
- uint32_t user_config = Debug::GetHDMIResolution();
+ uint32_t user_config = UINT32(Debug::GetHDMIResolution());
if (user_config) {
- uint32_t config_index = -1;
+ uint32_t config_index = 0;
// For the config, get the corresponding index
DisplayError error = hw_intf_->GetConfigIndex(user_config, &config_index);
if (error == kErrorNone)
@@ -263,8 +264,8 @@
void DisplayHDMI::GetScanSupport() {
DisplayError error = kErrorNone;
- uint32_t video_format = -1;
- uint32_t max_cea_format = -1;
+ uint32_t video_format = 0;
+ uint32_t max_cea_format = 0;
HWScanInfo scan_info = HWScanInfo();
hw_intf_->GetHWScanInfo(&scan_info);
diff --git a/sdm/libs/core/display_hdmi.h b/sdm/libs/core/display_hdmi.h
index 3d2fcc6..ca33035 100644
--- a/sdm/libs/core/display_hdmi.h
+++ b/sdm/libs/core/display_hdmi.h
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2014 - 2015, The Linux Foundation. All rights reserved.
+* Copyright (c) 2014 - 2016, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted
* provided that the following conditions are met:
@@ -66,7 +66,7 @@
virtual DisplayError SetCursorPosition(int x, int y);
private:
- virtual int GetBestConfig(HWS3DMode s3d_mode);
+ virtual uint32_t GetBestConfig(HWS3DMode s3d_mode);
virtual void GetScanSupport();
virtual void SetS3DMode(LayerStack *layer_stack);
diff --git a/sdm/libs/core/fb/hw_color_manager.cpp b/sdm/libs/core/fb/hw_color_manager.cpp
index 872e7a9..27116a0 100644
--- a/sdm/libs/core/fb/hw_color_manager.cpp
+++ b/sdm/libs/core/fb/hw_color_manager.cpp
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2015, The Linux Foundation. All rights reserved.
+* Copyright (c) 2015-2016, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -52,6 +52,7 @@
[kGlobalColorFeaturePaV2] = &HWColorManager::SetPAV2,
[kGlobalColorFeatureDither] = &HWColorManager::SetDither,
[kGlobalColorFeatureGamut] = &HWColorManager::SetGamut,
+ [kGlobalColorFeaturePADither] = &HWColorManager::SetPADither,
};
DisplayError HWColorManager::SetPCC(const PPFeatureInfo &feature, msmfb_mdp_pp *kernel_params) {
@@ -149,4 +150,13 @@
return ret;
}
+DisplayError HWColorManager::SetPADither(const PPFeatureInfo &feature,
+ msmfb_mdp_pp *kernel_params) {
+ DisplayError ret = kErrorNone;
+
+ // TODO(user): Kernel IOCTL preparation
+
+ return ret;
+}
+
} // namespace sdm
diff --git a/sdm/libs/core/fb/hw_color_manager.h b/sdm/libs/core/fb/hw_color_manager.h
index ead71d2..c9eea5b 100644
--- a/sdm/libs/core/fb/hw_color_manager.h
+++ b/sdm/libs/core/fb/hw_color_manager.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2015, The Linux Foundataion. All rights reserved.
+/* Copyright (c) 2015-2016, The Linux Foundataion. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -46,6 +46,7 @@
static DisplayError SetPAV2(const PPFeatureInfo &feature, msmfb_mdp_pp *kernel_params);
static DisplayError SetDither(const PPFeatureInfo &feature, msmfb_mdp_pp *kernel_params);
static DisplayError SetGamut(const PPFeatureInfo &feature, msmfb_mdp_pp *kernel_params);
+ static DisplayError SetPADither(const PPFeatureInfo &feature, msmfb_mdp_pp *kernel_params);
static DisplayError (*SetFeature[kMaxNumPPFeatures])(const PPFeatureInfo &feature,
msmfb_mdp_pp *kernel_params);
diff --git a/sdm/libs/core/fb/hw_device.cpp b/sdm/libs/core/fb/hw_device.cpp
index a44582f..e4f8dae 100644
--- a/sdm/libs/core/fb/hw_device.cpp
+++ b/sdm/libs/core/fb/hw_device.cpp
@@ -274,7 +274,7 @@
// Fill WB index for virtual based on number of rotator WB blocks present in the HW.
// Eg: If 2 WB rotator blocks available, the WB index for virtual will be 2, as the
// indexing of WB blocks start from 0.
- mdp_out_layer_.writeback_ndx = hw_resource_.num_rotator;
+ mdp_out_layer_.writeback_ndx = hw_resource_.hw_rot_info.num_rotator;
mdp_out_layer_.buffer.width = output_buffer->width;
mdp_out_layer_.buffer.height = output_buffer->height;
if (output_buffer->flags.secure) {
@@ -292,7 +292,7 @@
}
mdp_commit.flags |= MDP_VALIDATE_LAYER;
- if (Sys::ioctl_(device_fd_, MSMFB_ATOMIC_COMMIT, &mdp_disp_commit_) < 0) {
+ if (Sys::ioctl_(device_fd_, INT(MSMFB_ATOMIC_COMMIT), &mdp_disp_commit_) < 0) {
if (errno == ESHUTDOWN) {
DLOGI_IF(kTagDriverConfig, "Driver is processing shutdown sequence");
return kErrorShutDown;
@@ -409,11 +409,11 @@
}
mdp_commit.release_fence = -1;
- mdp_commit.flags &= ~MDP_VALIDATE_LAYER;
+ mdp_commit.flags &= UINT32(~MDP_VALIDATE_LAYER);
if (synchronous_commit_) {
mdp_commit.flags |= MDP_COMMIT_WAIT_FOR_FINISH;
}
- if (Sys::ioctl_(device_fd_, MSMFB_ATOMIC_COMMIT, &mdp_disp_commit_) < 0) {
+ if (Sys::ioctl_(device_fd_, INT(MSMFB_ATOMIC_COMMIT), &mdp_disp_commit_) < 0) {
if (errno == ESHUTDOWN) {
DLOGI_IF(kTagDriverConfig, "Driver is processing shutdown sequence");
return kErrorShutDown;
@@ -477,8 +477,8 @@
mdp_commit.input_layer_cnt = 0;
mdp_commit.output_layer = NULL;
- mdp_commit.flags &= ~MDP_VALIDATE_LAYER;
- if (Sys::ioctl_(device_fd_, MSMFB_ATOMIC_COMMIT, &mdp_disp_commit_) < 0) {
+ mdp_commit.flags &= UINT32(~MDP_VALIDATE_LAYER);
+ if (Sys::ioctl_(device_fd_, INT(MSMFB_ATOMIC_COMMIT), &mdp_disp_commit_) < 0) {
if (errno == ESHUTDOWN) {
DLOGI_IF(kTagDriverConfig, "Driver is processing shutdown sequence");
return kErrorShutDown;
@@ -518,6 +518,18 @@
case kFormatRGBX8888Ubwc: *target = MDP_RGBX_8888_UBWC; break;
case kFormatBGR565Ubwc: *target = MDP_RGB_565_UBWC; break;
case kFormatYCbCr420SPVenusUbwc: *target = MDP_Y_CBCR_H2V2_UBWC; break;
+ case kFormatRGBA1010102: *target = MDP_RGBA_1010102; break;
+ case kFormatARGB2101010: *target = MDP_ARGB_2101010; break;
+ case kFormatRGBX1010102: *target = MDP_RGBX_1010102; break;
+ case kFormatXRGB2101010: *target = MDP_XRGB_2101010; break;
+ case kFormatBGRA1010102: *target = MDP_BGRA_1010102; break;
+ case kFormatABGR2101010: *target = MDP_ABGR_2101010; break;
+ case kFormatBGRX1010102: *target = MDP_BGRX_1010102; break;
+ case kFormatXBGR2101010: *target = MDP_XBGR_2101010; break;
+ case kFormatRGBA1010102Ubwc: *target = MDP_RGBA_1010102_UBWC; break;
+ case kFormatRGBX1010102Ubwc: *target = MDP_RGBX_1010102_UBWC; break;
+ case kFormatYCbCr420P010: *target = MDP_Y_CBCR_H2V2_P010; break;
+ case kFormatYCbCr420TP10Ubwc: *target = MDP_Y_CBCR_H2V2_TP10_UBWC; break;
default:
DLOGE("Unsupported format type %d", source);
return kErrorParameters;
@@ -543,6 +555,16 @@
case kFormatBGRX8888:
case kFormatRGBA8888Ubwc:
case kFormatRGBX8888Ubwc:
+ case kFormatRGBA1010102:
+ case kFormatARGB2101010:
+ case kFormatRGBX1010102:
+ case kFormatXRGB2101010:
+ case kFormatBGRA1010102:
+ case kFormatABGR2101010:
+ case kFormatBGRX1010102:
+ case kFormatXBGR2101010:
+ case kFormatRGBA1010102Ubwc:
+ case kFormatRGBX1010102Ubwc:
*target = width * 4;
break;
case kFormatRGB888:
@@ -561,6 +583,8 @@
case kFormatYCrCb420PlanarStride16:
case kFormatYCbCr420SemiPlanar:
case kFormatYCrCb420SemiPlanar:
+ case kFormatYCbCr420P010:
+ case kFormatYCbCr420TP10Ubwc:
*target = width;
break;
case kFormatYCbCr422H2V1Packed:
@@ -583,6 +607,7 @@
void HWDevice::SetBlending(const LayerBlending &source, mdss_mdp_blend_op *target) {
switch (source) {
case kBlendingPremultiplied: *target = BLEND_OP_PREMULTIPLIED; break;
+ case kBlendingOpaque: *target = BLEND_OP_OPAQUE; break;
case kBlendingCoverage: *target = BLEND_OP_COVERAGE; break;
default: *target = BLEND_OP_NOT_DEFINED; break;
}
@@ -754,9 +779,9 @@
} else if (!strncmp(tokens[0], "dyn_fps_en", strlen("dyn_fps_en"))) {
panel_info->dynamic_fps = atoi(tokens[1]);
} else if (!strncmp(tokens[0], "min_fps", strlen("min_fps"))) {
- panel_info->min_fps = atoi(tokens[1]);
+ panel_info->min_fps = UINT32(atoi(tokens[1]));
} else if (!strncmp(tokens[0], "max_fps", strlen("max_fps"))) {
- panel_info->max_fps = atoi(tokens[1]);
+ panel_info->max_fps = UINT32(atoi(tokens[1]));
} else if (!strncmp(tokens[0], "primary_panel", strlen("primary_panel"))) {
panel_info->is_primary_panel = atoi(tokens[1]);
} else if (!strncmp(tokens[0], "is_pluggable", strlen("is_pluggable"))) {
@@ -843,8 +868,8 @@
read = Sys::getline_(&line, &len, fileptr);
if (read > 0) {
if (!ParseLine(line, tokens, max_count, &token_count)) {
- panel_info->split_info.left_split = atoi(tokens[0]);
- panel_info->split_info.right_split = atoi(tokens[1]);
+ panel_info->split_info.left_split = UINT32(atoi(tokens[0]));
+ panel_info->split_info.right_split = UINT32(atoi(tokens[1]));
}
}
@@ -1022,15 +1047,15 @@
STRUCT_VAR(mdp_async_layer, async_layer);
async_layer.flags = MDP_LAYER_ASYNC;
async_layer.pipe_ndx = left_pipe->pipe_id;
- async_layer.src.x = left_pipe->src_roi.left;
- async_layer.src.y = left_pipe->src_roi.top;
- async_layer.dst.x = x;
- async_layer.dst.y = y;
+ async_layer.src.x = UINT32(left_pipe->src_roi.left);
+ async_layer.src.y = UINT32(left_pipe->src_roi.top);
+ async_layer.dst.x = UINT32(x);
+ async_layer.dst.y = UINT32(y);
STRUCT_VAR(mdp_position_update, pos_update);
pos_update.input_layer_cnt = 1;
pos_update.input_layers = &async_layer;
- if (Sys::ioctl_(device_fd_, MSMFB_ASYNC_POSITION_UPDATE, &pos_update) < 0) {
+ if (Sys::ioctl_(device_fd_, INT(MSMFB_ASYNC_POSITION_UPDATE), &pos_update) < 0) {
if (errno == ESHUTDOWN) {
DLOGI_IF(kTagDriverConfig, "Driver is processing shutdown sequence");
return kErrorShutDown;
@@ -1095,8 +1120,8 @@
DLOGW("Open failed = %s", file_node);
return -1;
}
- ssize_t len = Sys::pwrite_(fd, value, length, 0);
- if (length <= 0) {
+ ssize_t len = Sys::pwrite_(fd, value, static_cast<size_t>(length), 0);
+ if (len <= 0) {
DLOGE("Write failed for path %s with value %s", file_node, value);
}
Sys::close_(fd);
diff --git a/sdm/libs/core/fb/hw_hdmi.cpp b/sdm/libs/core/fb/hw_hdmi.cpp
index 2d91b9d..9f878f3 100644
--- a/sdm/libs/core/fb/hw_hdmi.cpp
+++ b/sdm/libs/core/fb/hw_hdmi.cpp
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2015, The Linux Foundation. All rights reserved.
+* Copyright (c) 2015 - 2016, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -213,7 +213,7 @@
char *tokens[edid_count_max] = { NULL };
ParseLine(ptr, tokens, edid_count_max, &hdmi_mode_count_);
for (uint32_t i = 0; i < hdmi_mode_count_; i++) {
- hdmi_modes_[i] = atoi(tokens[i]);
+ hdmi_modes_[i] = UINT32(atoi(tokens[i]));
}
}
@@ -450,9 +450,9 @@
return;
}
- hw_scan_info_.pt_scan_support = MapHWScanSupport(atoi(tokens[0]));
- hw_scan_info_.it_scan_support = MapHWScanSupport(atoi(tokens[1]));
- hw_scan_info_.cea_scan_support = MapHWScanSupport(atoi(tokens[2]));
+ hw_scan_info_.pt_scan_support = MapHWScanSupport(UINT32(atoi(tokens[0])));
+ hw_scan_info_.it_scan_support = MapHWScanSupport(UINT32(atoi(tokens[1])));
+ hw_scan_info_.cea_scan_support = MapHWScanSupport(UINT32(atoi(tokens[2])));
DLOGI("PT %d IT %d CEA %d", hw_scan_info_.pt_scan_support, hw_scan_info_.it_scan_support,
hw_scan_info_.cea_scan_support);
}
@@ -577,7 +577,8 @@
}
snprintf(sys_fs_path , sizeof(sys_fs_path), "%s%d/%s", fb_path_, hdmi_node_index, node);
- length = HWDevice::SysFsWrite(sys_fs_path, property_value, strlen(property_value));
+ length = HWDevice::SysFsWrite(sys_fs_path, property_value,
+ static_cast<ssize_t>(strlen(property_value)));
if (length <= 0) {
DLOGW("Failed to write %s = %s", node, property_value);
}
@@ -688,6 +689,7 @@
}
active_mdp_s3d_mode_ = s3d_mdp_mode;
+ hw_panel_info_.s3d_mode = s3d_mode;
Sys::close_(s3d_mode_node);
DLOGI_IF(kTagDriverConfig, "s3d mode %d", hw_panel_info_.s3d_mode);
diff --git a/sdm/libs/core/fb/hw_info.cpp b/sdm/libs/core/fb/hw_info.cpp
old mode 100644
new mode 100755
index 3c17005..7db0a47
--- a/sdm/libs/core/fb/hw_info.cpp
+++ b/sdm/libs/core/fb/hw_info.cpp
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2015 - 2016, The Linux Foundation. All rights reserved.
+* Copyright (c) 2015-2016, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted
* provided that the following conditions are met:
@@ -31,30 +31,39 @@
#include <utils/constants.h>
#include <utils/debug.h>
#include <utils/sys.h>
-#include <vector>
-#include <utility>
+
+#include <algorithm>
+#include <iostream>
+#include <fstream>
#include <map>
#include <memory>
+#include <string>
+#include <utility>
+#include <vector>
+
#include "hw_info.h"
#define __CLASS__ "HWInfo"
using std::vector;
using std::map;
+using std::string;
+using std::ifstream;
+using std::to_string;
namespace sdm {
// kDefaultFormatSupport contains the bit map of supported formats for each hw blocks.
// For eg: if Cursor supports MDP_RGBA_8888[bit-13] and MDP_RGB_565[bit-0], then cursor pipe array
// contains { 0x01[0-3], 0x00[4-7], 0x00[8-12], 0x01[13-16], 0x00[17-20], 0x00[21-24], 0x00[24-28] }
-const uint8_t HWInfo::kDefaultFormatSupport[kHWSubBlockMax][BITS_TO_BYTES(MDP_IMGTYPE_LIMIT)] = {
- { 0xFF, 0xF5, 0x1C, 0x1E, 0x20, 0xFF, 0x01 }, // kHWVIGPipe
- { 0x33, 0xE0, 0x00, 0x16, 0x00, 0xBF, 0x00 }, // kHWRGBPipe
- { 0x33, 0xE0, 0x00, 0x16, 0x00, 0xBF, 0x00 }, // kHWDMAPipe
- { 0x12, 0x60, 0x0C, 0x00, 0x00, 0x0F, 0x00 }, // kHWCursorPipe
- { 0xFF, 0xF5, 0x1C, 0x1E, 0x20, 0xFF, 0x01 }, // kHWRotatorInput
- { 0x3F, 0xF4, 0x10, 0x1E, 0x20, 0xFF, 0x01 }, // kHWRotatorOutput
- { 0x3F, 0xF4, 0x10, 0x1E, 0x20, 0xFF, 0x01 }, // kHWWBIntfOutput
+const uint8_t HWInfo::kDefaultFormatSupport[kHWSubBlockMax][BITS_TO_BYTES(MDP_IMGTYPE_LIMIT1)] = {
+ { 0xFF, 0xF5, 0x1C, 0x1E, 0x20, 0xFF, 0x01, 0x00, 0xFE, 0x1F }, // kHWVIGPipe
+ { 0x33, 0xE0, 0x00, 0x16, 0x00, 0xBF, 0x00, 0x00, 0xFE, 0x07 }, // kHWRGBPipe
+ { 0x33, 0xE0, 0x00, 0x16, 0x00, 0xBF, 0x00, 0x00, 0xFE, 0x07 }, // kHWDMAPipe
+ { 0x12, 0x60, 0x0C, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00 }, // kHWCursorPipe
+ { 0xFF, 0xF5, 0x1C, 0x1E, 0x20, 0xFF, 0x01, 0x00, 0xFE, 0x1F }, // kHWRotatorInput
+ { 0xFF, 0xF5, 0x1C, 0x1E, 0x20, 0xFF, 0x01, 0x00, 0xFE, 0x1F }, // kHWRotatorOutput
+ { 0x3F, 0xF4, 0x10, 0x1E, 0x20, 0xFF, 0x01, 0x00, 0xAA, 0x16 }, // kHWWBIntfOutput
};
int HWInfo::ParseString(char *input, char *tokens[], const uint32_t max_token, const char *delim,
@@ -111,7 +120,7 @@
HWDynBwLimitInfo* bw_info = &hw_resource->dyn_bw_info;
for (int index = 0; index < kBwModeMax; index++) {
- bw_info->total_bw_limit[index] = hw_resource->max_bandwidth_low;
+ bw_info->total_bw_limit[index] = UINT32(hw_resource->max_bandwidth_low);
bw_info->pipe_bw_limit[index] = hw_resource->max_pipe_bw;
}
@@ -244,6 +253,8 @@
hw_resource->perf_calc = true;
} else if (!strncmp(tokens[i], "dynamic_bw_limit", strlen("dynamic_bw_limit"))) {
hw_resource->has_dyn_bw_support = true;
+ } else if (!strncmp(tokens[i], "separate_rotator", strlen("separate_rotator"))) {
+ hw_resource->separate_rotator = true;
}
}
} else if (!strncmp(tokens[0], "pipe_count", strlen("pipe_count"))) {
@@ -252,6 +263,7 @@
read = Sys::getline_(&line, &len, fileptr);
if (!ParseString(line, tokens, max_count, ": =\n", &token_count)) {
HWPipeCaps pipe_caps;
+ pipe_caps.type = kPipeTypeUnused;
for (uint32_t j = 0; j < token_count; j += 2) {
if (!strncmp(tokens[j], "pipe_type", strlen("pipe_type"))) {
if (!strncmp(tokens[j+1], "vig", strlen("vig"))) {
@@ -269,6 +281,8 @@
}
} else if (!strncmp(tokens[j], "pipe_ndx", strlen("pipe_ndx"))) {
pipe_caps.id = UINT32(atoi(tokens[j+1]));
+ } else if (!strncmp(tokens[j], "rects", strlen("rects"))) {
+ pipe_caps.max_rects = UINT32(atoi(tokens[j+1]));
} else if (!strncmp(tokens[j], "fmts_supported", strlen("fmts_supported"))) {
char *tokens_fmt[max_count] = { NULL };
uint32_t token_fmt_count = 0;
@@ -310,32 +324,10 @@
hw_resource->macrotile_nv12_factor, hw_resource->macrotile_factor,
hw_resource->linear_factor, hw_resource->scale_factor, hw_resource->extra_fudge_factor);
- const char *rotator_caps_path = "/sys/devices/virtual/rotator/mdss_rotator/caps";
- snprintf(stringbuffer , kMaxStringLength, "%s", rotator_caps_path);
- fileptr = Sys::fopen_(stringbuffer, "r");
-
- if (!fileptr) {
- DLOGW("File '%s' not found", stringbuffer);
- free(stringbuffer);
- return kErrorNone;
+ if (hw_resource->separate_rotator || hw_resource->num_dma_pipe) {
+ GetHWRotatorInfo(hw_resource);
}
- while ((read = Sys::getline_(&line, &len, fileptr)) != -1) {
- if (!ParseString(line, tokens, max_count, ":, =\n", &token_count)) {
- if (!strncmp(tokens[0], "wb_count", strlen("wb_count"))) {
- hw_resource->num_rotator = UINT8(atoi(tokens[1]));
- } else if (!strncmp(tokens[0], "downscale", strlen("downscale"))) {
- hw_resource->has_rotator_downscale = UINT8(atoi(tokens[1]));
- }
- }
- }
-
- free(stringbuffer);
- Sys::fclose_(fileptr);
-
- DLOGI("ROTATOR = %d, Rotator Downscale = %d", hw_resource->num_rotator,
- hw_resource->has_rotator_downscale);
-
if (hw_resource->has_dyn_bw_support) {
DisplayError ret = GetDynamicBWLimits(hw_resource);
if (ret != kErrorNone) {
@@ -354,6 +346,82 @@
return kErrorNone;
}
+DisplayError HWInfo::GetHWRotatorInfo(HWResourceInfo *hw_resource) {
+ if (GetMDSSRotatorInfo(hw_resource) != kErrorNone)
+ return GetV4L2RotatorInfo(hw_resource);
+
+ return kErrorNone;
+}
+
+DisplayError HWInfo::GetMDSSRotatorInfo(HWResourceInfo *hw_resource) {
+ FILE *fileptr = NULL;
+ char *stringbuffer = reinterpret_cast<char *>(malloc(sizeof(char) * kMaxStringLength));
+ uint32_t token_count = 0;
+ const uint32_t max_count = 10;
+ char *tokens[max_count] = { NULL };
+ size_t len = kMaxStringLength;
+ ssize_t read = 0;
+
+ snprintf(stringbuffer, sizeof(char) * kMaxStringLength, "%s", kRotatorCapsPath);
+ fileptr = Sys::fopen_(stringbuffer, "r");
+
+ if (!fileptr) {
+ DLOGW("File '%s' not found", stringbuffer);
+ free(stringbuffer);
+ return kErrorNotSupported;
+ }
+
+ hw_resource->hw_rot_info.type = HWRotatorInfo::ROT_TYPE_MDSS;
+ while ((read = Sys::getline_(&stringbuffer, &len, fileptr)) != -1) {
+ if (!ParseString(stringbuffer, tokens, max_count, ":, =\n", &token_count)) {
+ if (!strncmp(tokens[0], "wb_count", strlen("wb_count"))) {
+ hw_resource->hw_rot_info.num_rotator = UINT8(atoi(tokens[1]));
+ hw_resource->hw_rot_info.device_path = "/dev/mdss_rotator";
+ } else if (!strncmp(tokens[0], "downscale", strlen("downscale"))) {
+ hw_resource->hw_rot_info.has_downscale = UINT8(atoi(tokens[1]));
+ }
+ }
+ }
+
+ Sys::fclose_(fileptr);
+ free(stringbuffer);
+
+ DLOGI("MDSS Rotator: Count = %d, Downscale = %d", hw_resource->hw_rot_info.num_rotator,
+ hw_resource->hw_rot_info.has_downscale);
+
+ return kErrorNone;
+}
+
+DisplayError HWInfo::GetV4L2RotatorInfo(HWResourceInfo *hw_resource) {
+ const uint32_t kMaxV4L2Nodes = 64;
+ size_t len = kMaxStringLength;
+ char *line = reinterpret_cast<char *>(malloc(sizeof(char) * len));
+ bool found = false;
+
+ for (uint32_t i = 0; (i < kMaxV4L2Nodes) && (false == found); i++) {
+ string path = "/sys/class/video4linux/video" + to_string(i) + "/name";
+ FILE *fileptr = Sys::fopen_(path.c_str(), "r");
+ if (fileptr) {
+ if ((Sys::getline_(&line, &len, fileptr) != -1) &&
+ (!strncmp(line, "sde_rotator", strlen("sde_rotator")))) {
+ hw_resource->hw_rot_info.device_path = string("/dev/video" + to_string(i));
+ hw_resource->hw_rot_info.num_rotator++;
+ hw_resource->hw_rot_info.type = HWRotatorInfo::ROT_TYPE_V4L2;
+ hw_resource->hw_rot_info.has_downscale = true;
+ // We support only 1 rotator
+ found = true;
+ }
+ Sys::fclose_(fileptr);
+ }
+ }
+
+ free(line);
+ DLOGI("V4L2 Rotator: Count = %d, Downscale = %d", hw_resource->hw_rot_info.num_rotator,
+ hw_resource->hw_rot_info.has_downscale);
+
+ return kErrorNone;
+}
+
LayerBufferFormat HWInfo::GetSDMFormat(int mdp_format) {
switch (mdp_format) {
case MDP_ARGB_8888: return kFormatARGB8888;
@@ -370,6 +438,7 @@
case MDP_BGR_565: return kFormatBGR565;
case MDP_RGBA_8888_UBWC: return kFormatRGBA8888Ubwc;
case MDP_RGBX_8888_UBWC: return kFormatRGBX8888Ubwc;
+ case MDP_RGB_565_UBWC: return kFormatBGR565Ubwc;
case MDP_Y_CB_CR_H2V2: return kFormatYCbCr420Planar;
case MDP_Y_CR_CB_H2V2: return kFormatYCrCb420Planar;
case MDP_Y_CR_CB_GH2V2: return kFormatYCrCb420PlanarStride16;
@@ -383,6 +452,18 @@
case MDP_Y_CBCR_H2V2_UBWC: return kFormatYCbCr420SPVenusUbwc;
case MDP_Y_CRCB_H2V2_VENUS: return kFormatYCrCb420SemiPlanarVenus;
case MDP_YCBYCR_H2V1: return kFormatYCbCr422H2V1Packed;
+ case MDP_RGBA_1010102: return kFormatRGBA1010102;
+ case MDP_ARGB_2101010: return kFormatARGB2101010;
+ case MDP_RGBX_1010102: return kFormatRGBX1010102;
+ case MDP_XRGB_2101010: return kFormatXRGB2101010;
+ case MDP_BGRA_1010102: return kFormatBGRA1010102;
+ case MDP_ABGR_2101010: return kFormatABGR2101010;
+ case MDP_BGRX_1010102: return kFormatBGRX1010102;
+ case MDP_XBGR_2101010: return kFormatXBGR2101010;
+ case MDP_RGBA_1010102_UBWC: return kFormatRGBA1010102Ubwc;
+ case MDP_RGBX_1010102_UBWC: return kFormatRGBX1010102Ubwc;
+ case MDP_Y_CBCR_H2V2_P010: return kFormatYCbCr420P010;
+ case MDP_Y_CBCR_H2V2_TP10_UBWC: return kFormatYCbCr420TP10Ubwc;
default: return kFormatInvalid;
}
}
@@ -391,14 +472,14 @@
hw_resource->supported_formats_map.clear();
for (int sub_blk_type = INT(kHWVIGPipe); sub_blk_type < INT(kHWSubBlockMax); sub_blk_type++) {
- PopulateSupportedFormatMap(kDefaultFormatSupport[sub_blk_type], MDP_IMGTYPE_LIMIT,
+ PopulateSupportedFormatMap(kDefaultFormatSupport[sub_blk_type], MDP_IMGTYPE_LIMIT1,
(HWSubBlockType)sub_blk_type, hw_resource);
}
}
void HWInfo::ParseFormats(char *tokens[], uint32_t token_count, HWSubBlockType sub_blk_type,
HWResourceInfo *hw_resource) {
- if (token_count > BITS_TO_BYTES(MDP_IMGTYPE_LIMIT)) {
+ if (token_count > BITS_TO_BYTES(MDP_IMGTYPE_LIMIT1)) {
return;
}
@@ -415,7 +496,7 @@
vector <LayerBufferFormat> supported_sdm_formats;
for (uint32_t mdp_format = 0; mdp_format < format_count; mdp_format++) {
if (IS_BIT_SET(format_supported[mdp_format >> 3], (mdp_format & 7))) {
- LayerBufferFormat sdm_format = GetSDMFormat(mdp_format);
+ LayerBufferFormat sdm_format = GetSDMFormat(INT(mdp_format));
if (sdm_format != kFormatInvalid) {
supported_sdm_formats.push_back(sdm_format);
}
diff --git a/sdm/libs/core/fb/hw_info.h b/sdm/libs/core/fb/hw_info.h
index b343f09..ba98f87 100644
--- a/sdm/libs/core/fb/hw_info.h
+++ b/sdm/libs/core/fb/hw_info.h
@@ -30,6 +30,10 @@
#include <linux/msm_mdp.h>
#include "hw_info_interface.h"
+#ifndef MDP_IMGTYPE_END
+#define MDP_IMGTYPE_LIMIT1 0x100
+#endif
+
namespace sdm {
class HWInfo: public HWInfoInterface {
@@ -37,6 +41,10 @@
virtual DisplayError GetHWResourceInfo(HWResourceInfo *hw_resource);
private:
+ virtual DisplayError GetHWRotatorInfo(HWResourceInfo *hw_resource);
+ virtual DisplayError GetMDSSRotatorInfo(HWResourceInfo *hw_resource);
+ virtual DisplayError GetV4L2RotatorInfo(HWResourceInfo *hw_resource);
+
// TODO(user): Read Mdss version from the driver
static const int kHWMdssVersion5 = 500; // MDSS_V5
static const int kMaxStringLength = 1024;
@@ -44,7 +52,8 @@
// However, we rely on reading the capabalities from fbO since this
// is guaranteed to be available.
static const int kHWCapabilitiesNode = 0;
- static const uint8_t kDefaultFormatSupport[kHWSubBlockMax][BITS_TO_BYTES(MDP_IMGTYPE_LIMIT)];
+ static const uint8_t kDefaultFormatSupport[kHWSubBlockMax][BITS_TO_BYTES(MDP_IMGTYPE_LIMIT1)];
+ static constexpr const char *kRotatorCapsPath = "/sys/devices/virtual/rotator/mdss_rotator/caps";
static int ParseString(char *input, char *tokens[], const uint32_t max_token, const char *delim,
uint32_t *count);
diff --git a/sdm/libs/core/fb/hw_primary.cpp b/sdm/libs/core/fb/hw_primary.cpp
index 93d1f42..e8ab7cf 100644
--- a/sdm/libs/core/fb/hw_primary.cpp
+++ b/sdm/libs/core/fb/hw_primary.cpp
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2015, The Linux Foundation. All rights reserved.
+* Copyright (c) 2015 - 2016, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -175,8 +175,8 @@
if (xpos == string::npos || ypos == string::npos) {
DLOGI("Resolution switch not supported");
} else {
- *curr_x_pixels = atoi(buffer + xpos + 1);
- *curr_y_pixels = atoi(buffer + ypos + 1);
+ *curr_x_pixels = static_cast<size_t>(atoi(buffer + xpos + 1));
+ *curr_y_pixels = static_cast<size_t>(atoi(buffer + ypos + 1));
DLOGI("Current Config: %u x %u", *curr_x_pixels, *curr_y_pixels);
ret = true;
}
@@ -218,14 +218,14 @@
continue;
}
- config.x_pixels = atoi(buffer + xpos + 1);
- config.y_pixels = atoi(buffer + ypos + 1);
+ config.x_pixels = UINT32(atoi(buffer + xpos + 1));
+ config.y_pixels = UINT32(atoi(buffer + ypos + 1));
DLOGI("Found mode %d x %d", config.x_pixels, config.y_pixels);
display_configs_.push_back(config);
display_config_strings_.push_back(string(buffer));
if (curr_x_pixels == config.x_pixels && curr_y_pixels == config.y_pixels) {
- active_config_index_ = display_configs_.size() - 1;
+ active_config_index_ = UINT32(display_configs_.size() - 1);
DLOGI("Active config index %u", active_config_index_);
}
}
@@ -253,7 +253,7 @@
}
DisplayError HWPrimary::GetNumDisplayAttributes(uint32_t *count) {
- *count = IsResolutionSwitchEnabled() ? display_configs_.size() : 1;
+ *count = IsResolutionSwitchEnabled() ? UINT32(display_configs_.size()) : 1;
return kErrorNone;
}
@@ -303,8 +303,8 @@
// If driver doesn't return width/height information, default to 160 dpi
if (INT(var_screeninfo.width) <= 0 || INT(var_screeninfo.height) <= 0) {
- var_screeninfo.width = INT(((FLOAT(var_screeninfo.xres) * 25.4f)/160.0f) + 0.5f);
- var_screeninfo.height = INT(((FLOAT(var_screeninfo.yres) * 25.4f)/160.0f) + 0.5f);
+ var_screeninfo.width = UINT32(((FLOAT(var_screeninfo.xres) * 25.4f)/160.0f) + 0.5f);
+ var_screeninfo.height = UINT32(((FLOAT(var_screeninfo.yres) * 25.4f)/160.0f) + 0.5f);
}
display_attributes_.x_pixels = var_screeninfo.xres;
@@ -438,19 +438,19 @@
LayerRect left_roi = hw_layers->info.left_partial_update;
LayerRect right_roi = hw_layers->info.right_partial_update;
- mdp_commit.left_roi.x = INT(left_roi.left);
- mdp_commit.left_roi.y = INT(left_roi.top);
- mdp_commit.left_roi.w = INT(left_roi.right - left_roi.left);
- mdp_commit.left_roi.h = INT(left_roi.bottom - left_roi.top);
+ mdp_commit.left_roi.x = UINT32(left_roi.left);
+ mdp_commit.left_roi.y = UINT32(left_roi.top);
+ mdp_commit.left_roi.w = UINT32(left_roi.right - left_roi.left);
+ mdp_commit.left_roi.h = UINT32(left_roi.bottom - left_roi.top);
// SDM treats ROI as one full coordinate system.
// In case source split is disabled, However, Driver assumes Mixer to operate in
// different co-ordinate system.
if (!hw_resource_.is_src_split) {
- mdp_commit.right_roi.x = INT(right_roi.left) - hw_panel_info_.split_info.left_split;
- mdp_commit.right_roi.y = INT(right_roi.top);
- mdp_commit.right_roi.w = INT(right_roi.right - right_roi.left);
- mdp_commit.right_roi.h = INT(right_roi.bottom - right_roi.top);
+ mdp_commit.right_roi.x = UINT32(right_roi.left) - hw_panel_info_.split_info.left_split;
+ mdp_commit.right_roi.y = UINT32(right_roi.top);
+ mdp_commit.right_roi.w = UINT32(right_roi.right - right_roi.left);
+ mdp_commit.right_roi.h = UINT32(right_roi.bottom - right_roi.top);
}
return HWDevice::Validate(hw_layers);
@@ -480,7 +480,7 @@
usleep(16666);
STRUCT_VAR(timeval, time_now);
gettimeofday(&time_now, NULL);
- uint64_t ts = uint64_t(time_now.tv_sec)*1000000000LL +uint64_t(time_now.tv_usec)*1000LL;
+ int64_t ts = int64_t(time_now.tv_sec)*1000000000LL +int64_t(time_now.tv_usec)*1000LL;
// Send Vsync event for primary display(0)
event_handler_->VSync(ts);
@@ -521,7 +521,7 @@
void HWPrimary::HandleVSync(char *data) {
int64_t timestamp = 0;
if (!strncmp(data, "VSYNC=", strlen("VSYNC="))) {
- timestamp = strtoull(data + strlen("VSYNC="), NULL, 0);
+ timestamp = strtoll(data + strlen("VSYNC="), NULL, 0);
}
event_handler_->VSync(timestamp);
}
@@ -537,7 +537,7 @@
void HWPrimary::HandleThermal(char *data) {
int64_t thermal_level = 0;
if (!strncmp(data, "thermal_level=", strlen("thermal_level="))) {
- thermal_level = strtoull(data + strlen("thermal_level="), NULL, 0);
+ thermal_level = strtoll(data + strlen("thermal_level="), NULL, 0);
}
DLOGI("Received thermal notification with thermal level = %d", thermal_level);
@@ -584,7 +584,7 @@
}
DisplayError HWPrimary::SetDisplayMode(const HWDisplayMode hw_display_mode) {
- uint32_t mode = -1;
+ uint32_t mode = kModeDefault;
switch (hw_display_mode) {
case kModeVideo:
@@ -599,7 +599,7 @@
return kErrorParameters;
}
- if (Sys::ioctl_(device_fd_, MSMFB_LPM_ENABLE, &mode) < 0) {
+ if (Sys::ioctl_(device_fd_, INT(MSMFB_LPM_ENABLE), &mode) < 0) {
IOCTL_LOGE(MSMFB_LPM_ENABLE, device_type_);
return kErrorHardware;
}
@@ -628,7 +628,7 @@
return kErrorUndefined;
}
- ssize_t ret = Sys::pwrite_(fd, buffer, bytes, 0);
+ ssize_t ret = Sys::pwrite_(fd, buffer, static_cast<size_t>(bytes), 0);
if (ret <= 0) {
DLOGV_IF(kTagDriverConfig, "Failed to write to node = %s, error = %s ", kBrightnessNode,
strerror(errno));
@@ -690,7 +690,7 @@
for (int i(0); i < kMaxNumPPFeatures; i++) {
version.pp_feature = feature_id_mapping[i];
- if (Sys::ioctl_(device_fd_, MSMFB_MDP_PP_GET_FEATURE_VERSION, &version) < 0) {
+ if (Sys::ioctl_(device_fd_, INT(MSMFB_MDP_PP_GET_FEATURE_VERSION), &version) < 0) {
IOCTL_LOGE(MSMFB_MDP_PP_GET_FEATURE_VERSION, device_type_);
return kErrorHardware;
}
@@ -716,7 +716,7 @@
if ((feature->feature_id_ < kMaxNumPPFeatures)) {
HWColorManager::SetFeature[feature->feature_id_](*feature, &kernel_params);
- if (Sys::ioctl_(device_fd_, MSMFB_MDP_PP, &kernel_params) < 0) {
+ if (Sys::ioctl_(device_fd_, INT(MSMFB_MDP_PP), &kernel_params) < 0) {
IOCTL_LOGE(MSMFB_MDP_PP, device_type_);
feature_list->Reset();
diff --git a/sdm/libs/core/resource_default.cpp b/sdm/libs/core/resource_default.cpp
index 46582b8..b2e928e 100644
--- a/sdm/libs/core/resource_default.cpp
+++ b/sdm/libs/core/resource_default.cpp
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2014 - 2015, The Linux Foundation. All rights reserved.
+* Copyright (c) 2014 - 2016, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted
* provided that the following conditions are met:
@@ -26,6 +26,7 @@
#include <utils/constants.h>
#include <utils/debug.h>
#include <utils/rect.h>
+#include <utils/formats.h>
#include <dlfcn.h>
#include "resource_default.h"
@@ -73,7 +74,7 @@
}
for (uint32_t i = 0; i < num_pipe_; i++) {
- src_pipes_[i].priority = i;
+ src_pipes_[i].priority = INT(i);
}
DLOGI("hw_rev=%x, DMA=%d RGB=%d VIG=%d", hw_res_info_.hw_revision, hw_res_info_.num_dma_pipe,
@@ -634,8 +635,11 @@
}
// 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))) {
+ if (!input_buffer->flags.secure &&
+ ((src.left - roundf(src.left) != 0.0f) ||
+ (src.top - roundf(src.top) != 0.0f) ||
+ (src.right - roundf(src.right) != 0.0f) ||
+ (src.bottom - roundf(src.bottom) != 0.0f))) {
DLOGV_IF(kTagResources, "Input ROI is not integral");
return kErrorNotSupported;
}
@@ -889,17 +893,4 @@
return kErrorNotSupported;
}
-bool ResourceDefault::IsUBWCFormat(LayerBufferFormat format) {
- switch (format) {
- case kFormatRGBA8888Ubwc:
- case kFormatRGBX8888Ubwc:
- case kFormatBGR565Ubwc:
- case kFormatYCbCr420SPVenusUbwc:
- return true;
- default:
- break;
- }
- return false;
-}
-
} // namespace sdm
diff --git a/sdm/libs/core/resource_default.h b/sdm/libs/core/resource_default.h
index 1dc51ad..cb633c0 100644
--- a/sdm/libs/core/resource_default.h
+++ b/sdm/libs/core/resource_default.h
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2014 - 2015, The Linux Foundation. All rights reserved.
+* Copyright (c) 2014 - 2016, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted
* provided that the following conditions are met:
@@ -118,7 +118,6 @@
DisplayError AlignPipeConfig(const Layer &layer, HWPipeInfo *left_pipe, HWPipeInfo *right_pipe);
void ResourceStateLog(void);
DisplayError CalculateDecimation(float downscale, uint8_t *decimation);
- bool IsUBWCFormat(LayerBufferFormat format);
Locker locker_;
HWResourceInfo hw_res_info_;
diff --git a/sdm/libs/core/strategy.cpp b/sdm/libs/core/strategy.cpp
index 582fda7..924047a 100644
--- a/sdm/libs/core/strategy.cpp
+++ b/sdm/libs/core/strategy.cpp
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2014 - 2015, The Linux Foundation. All rights reserved.
+* Copyright (c) 2014 - 2016, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted
* provided that the following conditions are met:
@@ -32,9 +32,10 @@
namespace sdm {
Strategy::Strategy(ExtensionInterface *extension_intf, DisplayType type,
- const HWResourceInfo &hw_resource_info, const HWPanelInfo &hw_panel_info)
+ const HWResourceInfo &hw_resource_info, const HWPanelInfo &hw_panel_info,
+ const HWDisplayAttributes &hw_display_attributes)
: extension_intf_(extension_intf), display_type_(type), hw_resource_info_(hw_resource_info),
- hw_panel_info_(hw_panel_info) {
+ hw_panel_info_(hw_panel_info), hw_display_attributes_(hw_display_attributes) {
}
DisplayError Strategy::Init() {
@@ -42,7 +43,7 @@
if (extension_intf_) {
error = extension_intf_->CreateStrategyExtn(display_type_, hw_panel_info_.mode,
- &strategy_intf_);
+ hw_panel_info_.s3d_mode, &strategy_intf_);
if (error != kErrorNone) {
DLOGE("Failed to create strategy");
return error;
@@ -163,24 +164,21 @@
return;
}
- LayerStack *layer_stack = hw_layers_info_->stack;
- LayerRect &dst_rect = layer_stack->layers[fb_layer_index_].dst_rect;
- // The destination co-ordinates of the FB layer map to the panel and may be different than source
- float fb_x_res = dst_rect.right - dst_rect.left;
- float fb_y_res = dst_rect.bottom - dst_rect.top;
+ float disp_x_res = hw_display_attributes_.x_pixels;
+ float disp_y_res = hw_display_attributes_.y_pixels;
if (!hw_resource_info_.is_src_split &&
- ((fb_x_res > hw_resource_info_.max_mixer_width) ||
+ ((disp_x_res > hw_resource_info_.max_mixer_width) ||
((display_type_ == kPrimary) && hw_panel_info_.split_info.right_split))) {
split_display = true;
}
if (split_display) {
float left_split = FLOAT(hw_panel_info_.split_info.left_split);
- hw_layers_info_->left_partial_update = (LayerRect) {0.0f, 0.0f, left_split, fb_y_res};
- hw_layers_info_->right_partial_update = (LayerRect) {left_split, 0.0f, fb_x_res, fb_y_res};
+ hw_layers_info_->left_partial_update = (LayerRect) {0.0f, 0.0f, left_split, disp_y_res};
+ hw_layers_info_->right_partial_update = (LayerRect) {left_split, 0.0f, disp_x_res, disp_y_res};
} else {
- hw_layers_info_->left_partial_update = (LayerRect) {0.0f, 0.0f, fb_x_res, fb_y_res};
+ hw_layers_info_->left_partial_update = (LayerRect) {0.0f, 0.0f, disp_x_res, disp_y_res};
hw_layers_info_->right_partial_update = (LayerRect) {0.0f, 0.0f, 0.0f, 0.0f};
}
}
diff --git a/sdm/libs/core/strategy.h b/sdm/libs/core/strategy.h
index e59068e..71f45d8 100644
--- a/sdm/libs/core/strategy.h
+++ b/sdm/libs/core/strategy.h
@@ -33,7 +33,8 @@
class Strategy {
public:
Strategy(ExtensionInterface *extension_intf, DisplayType type,
- const HWResourceInfo &hw_resource_info, const HWPanelInfo &hw_panel_info);
+ const HWResourceInfo &hw_resource_info, const HWPanelInfo &hw_panel_info,
+ const HWDisplayAttributes &hw_display_attributes);
DisplayError Init();
DisplayError Deinit();
@@ -53,6 +54,7 @@
HWResourceInfo hw_resource_info_;
HWPanelInfo hw_panel_info_;
HWLayersInfo *hw_layers_info_ = NULL;
+ HWDisplayAttributes hw_display_attributes_;
uint32_t fb_layer_index_ = 0;
bool extn_start_success_ = false;
bool tried_default_ = false;
diff --git a/sdm/libs/hwc/Android.mk b/sdm/libs/hwc/Android.mk
index 911e7ae..13502f2 100644
--- a/sdm/libs/hwc/Android.mk
+++ b/sdm/libs/hwc/Android.mk
@@ -5,15 +5,15 @@
LOCAL_MODULE_RELATIVE_PATH := hw
LOCAL_MODULE_TAGS := optional
LOCAL_C_INCLUDES := hardware/qcom/display/sdm/include/ \
- hardware/qcom/display/libgralloc/ \
hardware/qcom/display/libqservice/ \
hardware/qcom/display/libqdutils/ \
hardware/qcom/display/libcopybit/ \
external/libcxx/include/
LOCAL_CFLAGS := -Wno-missing-field-initializers -Wno-unused-parameter \
- -Wall -Werror -std=c++11 -fcolor-diagnostics\
+ -Wall -Werror -Wconversion -std=c++11 -fcolor-diagnostics\
-DLOG_TAG=\"SDM\" -DDEBUG_CALC_FPS
+LOCAL_CFLAGS += -isystem hardware/qcom/display/libgralloc
LOCAL_CLANG := true
# TODO: Move this to the common makefile
diff --git a/sdm/libs/hwc/blit_engine_c2d.cpp b/sdm/libs/hwc/blit_engine_c2d.cpp
old mode 100755
new mode 100644
index 898c5e5..e855524
--- a/sdm/libs/hwc/blit_engine_c2d.cpp
+++ b/sdm/libs/hwc/blit_engine_c2d.cpp
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012-2015, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -55,12 +55,19 @@
#include <utils/constants.h>
#include <utils/rect.h>
+#include <utils/formats.h>
#include "blit_engine_c2d.h"
#include "hwc_debugger.h"
#define __CLASS__ "BlitEngineC2D"
+// TODO(user): Remove pragma after fixing sign conversion errors
+#if defined(__clang__)
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wsign-conversion"
+#endif
+
namespace sdm {
@@ -259,6 +266,12 @@
if (!blit_supported_) {
return -1;
}
+
+ // No 10 bit support for C2D
+ if (Is10BitFormat(layer.input_buffer->format)) {
+ return -1;
+ }
+
if (layer.composition == kCompositionGPUTarget) {
// Need FBT size for allocating buffers
gpu_target_index = i;
@@ -526,7 +539,7 @@
blit_engine_c2d_->set_parameter(blit_engine_c2d_, COPYBIT_FRAMEBUFFER_HEIGHT,
target_buffer->height);
int transform = 0;
- if (layer->transform.rotation) transform |= COPYBIT_TRANSFORM_ROT_90;
+ if (layer->transform.rotation != 0.0f) transform |= COPYBIT_TRANSFORM_ROT_90;
if (layer->transform.flip_horizontal) transform |= COPYBIT_TRANSFORM_FLIP_H;
if (layer->transform.flip_vertical) transform |= COPYBIT_TRANSFORM_FLIP_V;
blit_engine_c2d_->set_parameter(blit_engine_c2d_, COPYBIT_TRANSFORM, transform);
@@ -552,18 +565,6 @@
return err;
}
-bool BlitEngineC2d::IsUBWCFormat(LayerBufferFormat format) {
- switch (format) {
- case kFormatRGBA8888Ubwc:
- case kFormatRGBX8888Ubwc:
- case kFormatBGR565Ubwc:
- case kFormatYCbCr420SPVenusUbwc:
- return true;
- default:
- return false;
- }
-}
-
void BlitEngineC2d::DumpBlitTargetBuffer(int fd) {
if (!dump_frame_count_) {
return;
@@ -593,4 +594,7 @@
}
} // namespace sdm
+#if defined(__clang__)
+#pragma clang diagnostic pop
+#endif
diff --git a/sdm/libs/hwc/blit_engine_c2d.h b/sdm/libs/hwc/blit_engine_c2d.h
index 5400611..69b7299 100644
--- a/sdm/libs/hwc/blit_engine_c2d.h
+++ b/sdm/libs/hwc/blit_engine_c2d.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012-2015, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2012 - 2016, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -103,15 +103,14 @@
int DrawRectUsingCopybit(hwc_layer_1_t *hwc_layer, Layer *layer, LayerRect blit_rect,
LayerRect blit_dest_Rect);
void SetReleaseFence(int fence_fd);
- bool IsUBWCFormat(LayerBufferFormat format);
void DumpBlitTargetBuffer(int fd);
- copybit_device_t *blit_engine_c2d_;
+ copybit_device_t *blit_engine_c2d_ = NULL;
private_handle_t *blit_target_buffer_[kNumBlitTargetBuffers];
- uint32_t current_blit_target_index_;
+ uint32_t current_blit_target_index_ = 0;
int release_fence_fd_[kNumBlitTargetBuffers];
- uint32_t num_blit_target_;
- int blit_target_start_index_;
+ uint32_t num_blit_target_ = 0;
+ int blit_target_start_index_ = 0;
bool blit_active_ = false;
uint32_t dump_frame_count_ = 0;
uint32_t dump_frame_index_ = 0;
diff --git a/sdm/libs/hwc/hwc_buffer_allocator.cpp b/sdm/libs/hwc/hwc_buffer_allocator.cpp
index 10c719b..0092402 100644
--- a/sdm/libs/hwc/hwc_buffer_allocator.cpp
+++ b/sdm/libs/hwc/hwc_buffer_allocator.cpp
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2015, The Linux Foundation. All rights reserved.
+* Copyright (c) 2015 - 2016, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -69,7 +69,7 @@
alloc_flags |= INT(GRALLOC_USAGE_PROTECTED);
data.align = SECURE_ALIGN;
} else {
- data.align = getpagesize();
+ data.align = UINT32(getpagesize());
}
if (buffer_config.cache == false) {
@@ -103,7 +103,7 @@
}
alloc_buffer_info->fd = data.fd;
- alloc_buffer_info->stride = aligned_width;
+ alloc_buffer_info->stride = UINT32(aligned_width);
alloc_buffer_info->size = buffer_size;
meta_buffer_info->base_addr = data.base;
@@ -151,7 +151,7 @@
}
uint32_t HWCBufferAllocator::GetBufferSize(BufferInfo *buffer_info) {
- uint32_t align = getpagesize();
+ uint32_t align = UINT32(getpagesize());
const BufferConfig &buffer_config = buffer_info->buffer_config;
@@ -204,6 +204,16 @@
case kFormatYCbCr420SPVenusUbwc: *target = HAL_PIXEL_FORMAT_YCbCr_420_SP_VENUS_UBWC; break;
case kFormatRGBA5551: *target = HAL_PIXEL_FORMAT_RGBA_5551; break;
case kFormatRGBA4444: *target = HAL_PIXEL_FORMAT_RGBA_4444; break;
+ case kFormatRGBA1010102: *target = HAL_PIXEL_FORMAT_RGBA_1010102; break;
+ case kFormatARGB2101010: *target = HAL_PIXEL_FORMAT_ARGB_2101010; break;
+ case kFormatRGBX1010102: *target = HAL_PIXEL_FORMAT_RGBX_1010102; break;
+ case kFormatXRGB2101010: *target = HAL_PIXEL_FORMAT_XRGB_2101010; break;
+ case kFormatBGRA1010102: *target = HAL_PIXEL_FORMAT_BGRA_1010102; break;
+ case kFormatABGR2101010: *target = HAL_PIXEL_FORMAT_ABGR_2101010; break;
+ case kFormatBGRX1010102: *target = HAL_PIXEL_FORMAT_BGRX_1010102; break;
+ case kFormatXBGR2101010: *target = HAL_PIXEL_FORMAT_XBGR_2101010; break;
+ case kFormatYCbCr420P010: *target = HAL_PIXEL_FORMAT_YCbCr_420_P010; break;
+ case kFormatYCbCr420TP10Ubwc: *target = HAL_PIXEL_FORMAT_YCbCr_420_TP10_UBWC; break;
case kFormatRGBA8888Ubwc:
*target = HAL_PIXEL_FORMAT_RGBA_8888;
*flags |= GRALLOC_USAGE_PRIVATE_ALLOC_UBWC;
@@ -216,6 +226,14 @@
*target = HAL_PIXEL_FORMAT_BGR_565;
*flags |= GRALLOC_USAGE_PRIVATE_ALLOC_UBWC;
break;
+ case kFormatRGBA1010102Ubwc:
+ *target = HAL_PIXEL_FORMAT_RGBA_1010102;
+ *flags |= GRALLOC_USAGE_PRIVATE_ALLOC_UBWC;
+ break;
+ case kFormatRGBX1010102Ubwc:
+ *target = HAL_PIXEL_FORMAT_RGBX_1010102;
+ *flags |= GRALLOC_USAGE_PRIVATE_ALLOC_UBWC;
+ break;
default:
DLOGE("Unsupported format = 0x%x", format);
return -EINVAL;
diff --git a/sdm/libs/hwc/hwc_color_manager.cpp b/sdm/libs/hwc/hwc_color_manager.cpp
index 5abe94a..15270d5 100644
--- a/sdm/libs/hwc/hwc_color_manager.cpp
+++ b/sdm/libs/hwc/hwc_color_manager.cpp
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2015, The Linux Foundation. All rights reserved.
+* Copyright (c) 2015 - 2016, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -64,8 +64,8 @@
uint32_t id(0);
uint32_t size(0);
- id = in.readInt32();
- size = in.readInt32();
+ id = UINT32(in.readInt32());
+ size = UINT32(in.readInt32());
if (size > 0 && size == in.dataAvail()) {
const void *data = in.readInplace(size);
const uint8_t *temp = reinterpret_cast<const uint8_t *>(data);
@@ -83,7 +83,7 @@
void HWCColorManager::MarshallStructIntoParcel(const PPDisplayAPIPayload &data,
android::Parcel *out_parcel) {
- out_parcel->writeInt32(data.size);
+ out_parcel->writeInt32(INT32(data.size));
if (data.payload)
out_parcel->write(data.payload, data.size);
}
@@ -259,7 +259,8 @@
// 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, INT32(primary_width),
+ INT32(primary_height));
if (!buf || !handle) {
DLOGE("Failed to allocate memory.");
@@ -284,17 +285,18 @@
hwc_layer_1_t &layer = solid_fill_layers_->hwLayers[0];
hwc_rect_t solid_fill_rect = {
- INT(solid_fill_params_.rect.x), INT(solid_fill_params_.rect.y),
- INT(solid_fill_params_.rect.x + solid_fill_params_.rect.width),
- INT(solid_fill_params_.rect.y + solid_fill_params_.rect.height),
+ INT(solid_fill_params_.rect.x),
+ INT(solid_fill_params_.rect.y),
+ solid_fill_params_.rect.x + INT(solid_fill_params_.rect.width),
+ solid_fill_params_.rect.y + INT(solid_fill_params_.rect.height),
};
layer.compositionType = HWC_FRAMEBUFFER;
layer.blending = HWC_BLENDING_PREMULT;
layer.sourceCropf.left = solid_fill_params_.rect.x;
layer.sourceCropf.top = solid_fill_params_.rect.y;
- layer.sourceCropf.right = solid_fill_params_.rect.x + solid_fill_params_.rect.width;
- layer.sourceCropf.bottom = solid_fill_params_.rect.y + solid_fill_params_.rect.height;
+ layer.sourceCropf.right = UINT32(solid_fill_params_.rect.x) + solid_fill_params_.rect.width;
+ layer.sourceCropf.bottom = UINT32(solid_fill_params_.rect.y) + solid_fill_params_.rect.height;
layer.acquireFenceFd = -1;
layer.releaseFenceFd = -1;
layer.flags = 0;
@@ -371,7 +373,7 @@
}
// retrieve system GPU idle timeout value for later to recover.
- mode_mgr->entry_timeout_ = HWCDebugHandler::GetIdleTimeoutMs();
+ mode_mgr->entry_timeout_ = UINT32(HWCDebugHandler::GetIdleTimeoutMs());
// acquire the binder handle to Android system PowerManager for later use.
android::sp<android::IBinder> binder =
diff --git a/sdm/libs/hwc/hwc_debugger.cpp b/sdm/libs/hwc/hwc_debugger.cpp
index 6c58ba5..7c8bbfd 100644
--- a/sdm/libs/hwc/hwc_debugger.cpp
+++ b/sdm/libs/hwc/hwc_debugger.cpp
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2014 - 2015, The Linux Foundation. All rights reserved.
+* Copyright (c) 2014 - 2016, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -35,12 +35,12 @@
namespace sdm {
HWCDebugHandler HWCDebugHandler::debug_handler_;
-uint32_t HWCDebugHandler::debug_flags_ = 0x1;
-uint32_t HWCDebugHandler::verbose_level_ = 0x0;
+int32_t HWCDebugHandler::debug_flags_ = 0x1;
+int32_t HWCDebugHandler::verbose_level_ = 0x0;
void HWCDebugHandler::DebugAll(bool enable, int verbose_level) {
if (enable) {
- debug_flags_ = 0xFFFFFFFF;
+ debug_flags_ = 0x7FFFFFFF;
verbose_level_ = verbose_level;
} else {
debug_flags_ = 0x1; // kTagNone should always be printed.
diff --git a/sdm/libs/hwc/hwc_debugger.h b/sdm/libs/hwc/hwc_debugger.h
index e4e1ea3..68f95d9 100644
--- a/sdm/libs/hwc/hwc_debugger.h
+++ b/sdm/libs/hwc/hwc_debugger.h
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2014 - 2015, The Linux Foundation. All rights reserved.
+* Copyright (c) 2014 - 2016, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -65,8 +65,8 @@
private:
static HWCDebugHandler debug_handler_;
- static uint32_t debug_flags_;
- static uint32_t verbose_level_;
+ static int32_t debug_flags_;
+ static int32_t verbose_level_;
};
} // namespace sdm
diff --git a/sdm/libs/hwc/hwc_display.cpp b/sdm/libs/hwc/hwc_display.cpp
index 1224cb9..71df14b 100644
--- a/sdm/libs/hwc/hwc_display.cpp
+++ b/sdm/libs/hwc/hwc_display.cpp
@@ -51,6 +51,18 @@
namespace sdm {
+static void AssignLayerRegionsAddress(LayerRectArray *region, uint32_t rect_count,
+ uint8_t **base_address) {
+ if (rect_count) {
+ region->rect = reinterpret_cast<LayerRect *>(*base_address);
+ for (uint32_t i = 0; i < rect_count; i++) {
+ region->rect[i] = LayerRect();
+ }
+ *base_address += rect_count * sizeof(LayerRect);
+ }
+ region->count = rect_count;
+}
+
static void ApplyDeInterlaceAdjustment(Layer *layer) {
// De-interlacing adjustment
if (layer->input_buffer->flags.interlace) {
@@ -120,7 +132,10 @@
return -EINVAL;
}
- DeallocateLayerStack();
+ if (layer_stack_memory_.raw) {
+ delete[] layer_stack_memory_.raw;
+ layer_stack_memory_.raw = NULL;
+ }
delete framebuffer_config_;
@@ -226,13 +241,13 @@
for (int i = 0; attributes[i] != HWC_DISPLAY_NO_ATTRIBUTE; i++) {
switch (attributes[i]) {
case HWC_DISPLAY_VSYNC_PERIOD:
- values[i] = variable_config.vsync_period_ns;
+ values[i] = INT32(variable_config.vsync_period_ns);
break;
case HWC_DISPLAY_WIDTH:
- values[i] = variable_config.x_pixels;
+ values[i] = INT32(variable_config.x_pixels);
break;
case HWC_DISPLAY_HEIGHT:
- values[i] = variable_config.y_pixels;
+ values[i] = INT32(variable_config.y_pixels);
break;
case HWC_DISPLAY_DPI_X:
values[i] = INT32(variable_config.x_dpi * 1000.0f);
@@ -295,8 +310,6 @@
return -EINVAL;
}
- DeallocateLayerStack();
-
size_t num_hw_layers = content_list->numHwLayers;
uint32_t blit_target_count = 0;
@@ -304,78 +317,84 @@
blit_target_count = kMaxBlitTargetLayers;
}
- layer_stack_.layer_count = UINT32(num_hw_layers + blit_target_count);
- layer_stack_.layers = new Layer[layer_stack_.layer_count];
- if (!layer_stack_.layers) {
- return -ENOMEM;
- }
+ // Allocate memory for
+ // a) total number of layers
+ // b) buffer handle for each layer
+ // c) number of visible rectangles in each layer
+ // d) number of dirty rectangles in each layer
+ // e) number of blit rectangles in each layer
+ size_t required_size = (num_hw_layers + blit_target_count) *
+ (sizeof(Layer) + sizeof(LayerBuffer));
- for (size_t i = 0; i < layer_stack_.layer_count; i++) {
+ for (size_t i = 0; i < num_hw_layers + blit_target_count; i++) {
uint32_t num_visible_rects = 0;
uint32_t num_dirty_rects = 0;
- hwc_layer_1_t &hwc_layer = content_list->hwLayers[i];
- Layer &layer = layer_stack_.layers[i];
+ if (i < num_hw_layers) {
+ hwc_layer_1_t &hwc_layer = content_list->hwLayers[i];
+ num_visible_rects = UINT32(hwc_layer.visibleRegionScreen.numRects);
+ num_dirty_rects = UINT32(hwc_layer.surfaceDamage.numRects);
+ }
- layer.input_buffer = new LayerBuffer;
- if (!layer.input_buffer) {
+ // visible rectangles + dirty rectangles + blit rectangle
+ size_t num_rects = num_visible_rects + num_dirty_rects + blit_target_count;
+ required_size += num_rects * sizeof(LayerRect);
+ }
+
+ // Layer array may be large enough to hold current number of layers.
+ // If not, re-allocate it now.
+ if (layer_stack_memory_.size < required_size) {
+ if (layer_stack_memory_.raw) {
+ delete[] layer_stack_memory_.raw;
+ layer_stack_memory_.size = 0;
+ }
+
+ // Allocate in multiple of kSizeSteps.
+ required_size = ROUND_UP(required_size, layer_stack_memory_.kSizeSteps);
+ layer_stack_memory_.raw = new uint8_t[required_size];
+ if (!layer_stack_memory_.raw) {
return -ENOMEM;
}
+ layer_stack_memory_.size = required_size;
+ }
+
+ // Assign memory addresses now.
+ uint8_t *current_address = layer_stack_memory_.raw;
+
+ // Layer array address
+ layer_stack_ = LayerStack();
+ layer_stack_.layers = reinterpret_cast<Layer *>(current_address);
+ layer_stack_.layer_count = UINT32(num_hw_layers + blit_target_count);
+ current_address += (num_hw_layers + blit_target_count) * sizeof(Layer);
+
+ for (size_t i = 0; i < num_hw_layers + blit_target_count; i++) {
+ uint32_t num_visible_rects = 0;
+ uint32_t num_dirty_rects = 0;
+
if (i < num_hw_layers) {
- num_visible_rects = hwc_layer.visibleRegionScreen.numRects;
- num_dirty_rects = hwc_layer.surfaceDamage.numRects;
+ hwc_layer_1_t &hwc_layer = content_list->hwLayers[i];
+ num_visible_rects = UINT32(hwc_layer.visibleRegionScreen.numRects);
+ num_dirty_rects = UINT32(hwc_layer.surfaceDamage.numRects);
}
- if (num_visible_rects) {
- layer.visible_regions.rect = new LayerRect[num_visible_rects];
- if (!layer.visible_regions.rect) {
- return -ENOMEM;
- }
- layer.visible_regions.count = num_visible_rects;
- }
+ Layer &layer = layer_stack_.layers[i];
+ layer = Layer();
- if (num_dirty_rects) {
- layer.dirty_regions.rect = new LayerRect[num_dirty_rects];
- if (!layer.dirty_regions.rect) {
- return -ENOMEM;
- }
- layer.dirty_regions.count = num_dirty_rects;
- }
+ // Layer buffer handle address
+ layer.input_buffer = reinterpret_cast<LayerBuffer *>(current_address);
+ *layer.input_buffer = LayerBuffer();
+ current_address += sizeof(LayerBuffer);
- if (blit_target_count) {
- layer.blit_regions.rect = new LayerRect[blit_target_count];
- if (!layer.blit_regions.rect) {
- return -ENOMEM;
- }
- layer.blit_regions.count = blit_target_count;
- }
+ // Visible/Dirty/Blit rectangle address
+ AssignLayerRegionsAddress(&layer.visible_regions, num_visible_rects, ¤t_address);
+ AssignLayerRegionsAddress(&layer.dirty_regions, num_dirty_rects, ¤t_address);
+ AssignLayerRegionsAddress(&layer.blit_regions, blit_target_count, ¤t_address);
}
return 0;
}
-void HWCDisplay::DeallocateLayerStack() {
- if (!layer_stack_.layers) {
- return;
- }
-
- for (size_t i = 0; i < layer_stack_.layer_count; i++) {
- Layer &layer = layer_stack_.layers[i];
-
- delete layer.input_buffer;
- delete[] layer.visible_regions.rect;
- delete[] layer.dirty_regions.rect;
- delete[] layer.blit_regions.rect;
- }
-
- delete[] layer_stack_.layers;
-
- // Reset layer stack to default values always. This will ensure that calling
- // Allocate or Deallocate method twice does not result in unexpected behavior.
- layer_stack_ = LayerStack();
-}
-
int HWCDisplay::PrepareLayerParams(hwc_layer_1_t *hwc_layer, Layer *layer) {
const private_handle_t *pvt_handle = static_cast<const private_handle_t *>(hwc_layer->handle);
@@ -383,8 +402,8 @@
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;
+ layer_buffer->width = UINT32(pvt_handle->width);
+ layer_buffer->height = UINT32(pvt_handle->height);
if (SetMetaData(pvt_handle, layer) != kErrorNone) {
return -EINVAL;
@@ -433,8 +452,8 @@
AdrenoMemInfo::getInstance().getAlignedWidthAndHeight(INT(x_pixels), INT(y_pixels), format,
usage, aligned_width, aligned_height);
- layer_buffer->width = aligned_width;
- layer_buffer->height = aligned_height;
+ layer_buffer->width = UINT32(aligned_width);
+ layer_buffer->height = UINT32(aligned_height);
layer_buffer->format = GetSDMFormat(format, flags);
}
}
@@ -449,7 +468,8 @@
if (pvt_handle) {
layer_buffer->planes[0].fd = pvt_handle->fd;
layer_buffer->planes[0].offset = pvt_handle->offset;
- layer_buffer->planes[0].stride = pvt_handle->width;
+ layer_buffer->planes[0].stride = UINT32(pvt_handle->width);
+ layer_buffer->size = pvt_handle->size;
}
// if swapinterval property is set to 0 then close and reset the acquireFd
@@ -465,11 +485,6 @@
return 0;
}
- if (!content_list || !content_list->numHwLayers) {
- DLOGW("Invalid content list");
- return -EINVAL;
- }
-
size_t num_hw_layers = content_list->numHwLayers;
use_blit_comp_ = false;
@@ -541,8 +556,8 @@
// For solid fill, only dest rect need to be specified.
if (layer.flags.solid_fill) {
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->width = UINT32(layer.dst_rect.right - layer.dst_rect.left);
+ input_buffer->height = UINT32(layer.dst_rect.bottom - layer.dst_rect.top);
layer.src_rect.left = 0;
layer.src_rect.top = 0;
layer.src_rect.right = input_buffer->width;
@@ -554,7 +569,7 @@
layer.flags.updating = true;
if (num_hw_layers <= kMaxLayerCount) {
- layer.flags.updating = IsLayerUpdating(content_list, i);
+ layer.flags.updating = IsLayerUpdating(content_list, INT32(i));
}
#ifdef QTI_BSP
if (hwc_layer.flags & HWC_SCREENSHOT_ANIMATOR_LAYER) {
@@ -819,7 +834,7 @@
return true;
}
- if ((layer.composition == kCompositionGPU) && IsLayerUpdating(content_list, i)) {
+ if ((layer.composition == kCompositionGPU) && IsLayerUpdating(content_list, INT32(i))) {
return true;
}
}
@@ -937,12 +952,15 @@
LayerBufferFormat format = kFormatInvalid;
if (flags & private_handle_t::PRIV_FLAGS_UBWC_ALIGNED) {
switch (source) {
- case HAL_PIXEL_FORMAT_RGBA_8888: format = kFormatRGBA8888Ubwc; break;
- case HAL_PIXEL_FORMAT_RGBX_8888: format = kFormatRGBX8888Ubwc; break;
- case HAL_PIXEL_FORMAT_BGR_565: format = kFormatBGR565Ubwc; break;
+ case HAL_PIXEL_FORMAT_RGBA_8888: format = kFormatRGBA8888Ubwc; break;
+ case HAL_PIXEL_FORMAT_RGBX_8888: format = kFormatRGBX8888Ubwc; break;
+ case HAL_PIXEL_FORMAT_BGR_565: format = kFormatBGR565Ubwc; break;
case HAL_PIXEL_FORMAT_YCbCr_420_SP_VENUS:
case HAL_PIXEL_FORMAT_YCbCr_420_SP_VENUS_UBWC:
- case HAL_PIXEL_FORMAT_NV12_ENCODEABLE: format = kFormatYCbCr420SPVenusUbwc; break;
+ case HAL_PIXEL_FORMAT_NV12_ENCODEABLE: format = kFormatYCbCr420SPVenusUbwc; break;
+ case HAL_PIXEL_FORMAT_RGBA_1010102: format = kFormatRGBA1010102Ubwc; break;
+ case HAL_PIXEL_FORMAT_RGBX_1010102: format = kFormatRGBX1010102Ubwc; break;
+ case HAL_PIXEL_FORMAT_YCbCr_420_TP10_UBWC: format = kFormatYCbCr420TP10Ubwc; break;
default:
DLOGE("Unsupported format type for UBWC %d", source);
return kFormatInvalid;
@@ -969,6 +987,16 @@
case HAL_PIXEL_FORMAT_YCbCr_420_SP: format = kFormatYCbCr420SemiPlanar; break;
case HAL_PIXEL_FORMAT_YCbCr_422_SP: format = kFormatYCbCr422H2V1SemiPlanar; break;
case HAL_PIXEL_FORMAT_YCbCr_422_I: format = kFormatYCbCr422H2V1Packed; break;
+ case HAL_PIXEL_FORMAT_RGBA_1010102: format = kFormatRGBA1010102; break;
+ case HAL_PIXEL_FORMAT_ARGB_2101010: format = kFormatARGB2101010; break;
+ case HAL_PIXEL_FORMAT_RGBX_1010102: format = kFormatRGBX1010102; break;
+ case HAL_PIXEL_FORMAT_XRGB_2101010: format = kFormatXRGB2101010; break;
+ case HAL_PIXEL_FORMAT_BGRA_1010102: format = kFormatBGRA1010102; break;
+ case HAL_PIXEL_FORMAT_ABGR_2101010: format = kFormatABGR2101010; break;
+ case HAL_PIXEL_FORMAT_BGRX_1010102: format = kFormatBGRX1010102; break;
+ case HAL_PIXEL_FORMAT_XBGR_2101010: format = kFormatXBGR2101010; break;
+ case HAL_PIXEL_FORMAT_YCbCr_420_P010: format = kFormatYCbCr420P010; break;
+ case HAL_PIXEL_FORMAT_YCbCr_420_TP10_UBWC: format = kFormatYCbCr420TP10Ubwc; break;
default:
DLOGW("Unsupported format type = %d", source);
return kFormatInvalid;
@@ -1079,6 +1107,26 @@
return "YCrCb_420_SP_VENUS";
case HAL_PIXEL_FORMAT_YCbCr_420_SP_VENUS_UBWC:
return "YCbCr_420_SP_VENUS_UBWC";
+ case HAL_PIXEL_FORMAT_RGBA_1010102:
+ return "RGBA_1010102";
+ case HAL_PIXEL_FORMAT_ARGB_2101010:
+ return "ARGB_2101010";
+ case HAL_PIXEL_FORMAT_RGBX_1010102:
+ return "RGBX_1010102";
+ case HAL_PIXEL_FORMAT_XRGB_2101010:
+ return "XRGB_2101010";
+ case HAL_PIXEL_FORMAT_BGRA_1010102:
+ return "BGRA_1010102";
+ case HAL_PIXEL_FORMAT_ABGR_2101010:
+ return "ABGR_2101010";
+ case HAL_PIXEL_FORMAT_BGRX_1010102:
+ return "BGRX_1010102";
+ case HAL_PIXEL_FORMAT_XBGR_2101010:
+ return "XBGR_2101010";
+ case HAL_PIXEL_FORMAT_YCbCr_420_P010:
+ return "YCbCr_420_P010";
+ case HAL_PIXEL_FORMAT_YCbCr_420_TP10_UBWC:
+ return "YCbCr_420_TP10_UBWC";
default:
return "Unknown pixel format";
}
@@ -1339,15 +1387,15 @@
}
if (meta_data->operation & LINEAR_FORMAT) {
- layer_buffer->format = GetSDMFormat(meta_data->linearFormat, 0);
+ layer_buffer->format = GetSDMFormat(INT32(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;
+ layer_buffer->width = UINT32(actual_width);
+ layer_buffer->height = UINT32(actual_height);
}
if (meta_data->operation & SET_SINGLE_BUFFER_MODE) {
@@ -1359,7 +1407,7 @@
if (meta_data->operation & S3D_FORMAT) {
std::map<int, LayerBufferS3DFormat>::iterator it =
- s3d_format_hwc_to_sdm_.find(meta_data->s3dFormat);
+ s3d_format_hwc_to_sdm_.find(INT32(meta_data->s3dFormat));
if (it != s3d_format_hwc_to_sdm_.end()) {
layer->input_buffer->s3d_format = it->second;
} else {
@@ -1435,7 +1483,7 @@
}
int HWCDisplay::SetActiveDisplayConfig(int config) {
- return display_intf_->SetActiveConfig(config) == kErrorNone ? 0 : -1;
+ return display_intf_->SetActiveConfig(UINT32(config)) == kErrorNone ? 0 : -1;
}
int HWCDisplay::GetActiveDisplayConfig(uint32_t *config) {
@@ -1447,7 +1495,7 @@
}
int HWCDisplay::GetDisplayAttributesForConfig(int config, DisplayConfigVariableInfo *attributes) {
- return display_intf_->GetConfig(config, attributes) == kErrorNone ? 0 : -1;
+ return display_intf_->GetConfig(UINT32(config), attributes) == kErrorNone ? 0 : -1;
}
bool HWCDisplay::SingleLayerUpdating(uint32_t app_layer_count) {
diff --git a/sdm/libs/hwc/hwc_display.h b/sdm/libs/hwc/hwc_display.h
index a82744b..21c87ab 100644
--- a/sdm/libs/hwc/hwc_display.h
+++ b/sdm/libs/hwc/hwc_display.h
@@ -93,6 +93,15 @@
// Maximum number of layers supported by display manager.
static const uint32_t kMaxLayerCount = 32;
+ // Structure to track memory allocation for layer stack (layers, rectangles) object.
+ struct LayerStackMemory {
+ static const size_t kSizeSteps = 4096; // Default memory allocation.
+ uint8_t *raw; // Pointer to byte array.
+ size_t size; // Current number of allocated bytes.
+
+ LayerStackMemory() : raw(NULL), size(0) { }
+ };
+
struct LayerCache {
buffer_handle_t handle;
uint8_t plane_alpha;
@@ -118,7 +127,6 @@
virtual DisplayError Refresh();
virtual int AllocateLayerStack(hwc_display_contents_1_t *content_list);
- virtual void DeallocateLayerStack();
virtual int PrePrepareLayerStack(hwc_display_contents_1_t *content_list);
virtual int PrepareLayerStack(hwc_display_contents_1_t *content_list);
virtual int CommitLayerStack(hwc_display_contents_1_t *content_list);
@@ -156,6 +164,7 @@
int id_;
bool needs_blit_;
DisplayInterface *display_intf_ = NULL;
+ LayerStackMemory layer_stack_memory_;
LayerStack layer_stack_;
LayerStackCache layer_stack_cache_;
bool flush_on_error_ = false;
diff --git a/sdm/libs/hwc/hwc_display_external.cpp b/sdm/libs/hwc/hwc_display_external.cpp
index 74a79bb..86b36d8 100644
--- a/sdm/libs/hwc/hwc_display_external.cpp
+++ b/sdm/libs/hwc/hwc_display_external.cpp
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2014 - 2015, The Linux Foundation. All rights reserved.
+* Copyright (c) 2014 - 2016, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -155,16 +155,20 @@
return;
}
- uint32_t new_panel_width = panel_width * (1.0f - width_ratio);
- uint32_t new_panel_height = panel_height * (1.0f - height_ratio);
+ uint32_t new_panel_width = panel_width * UINT32(1.0f - width_ratio);
+ uint32_t new_panel_height = panel_height * UINT32(1.0f - height_ratio);
int x_offset = INT((FLOAT(panel_width) * width_ratio) / 2.0f);
int y_offset = INT((FLOAT(panel_height) * height_ratio) / 2.0f);
- display_frame->left = ((display_frame->left * new_panel_width) / panel_width) + x_offset;
- display_frame->top = ((display_frame->top * new_panel_height) / panel_height) + y_offset;
- display_frame->right = ((display_frame->right * new_panel_width) / panel_width) + x_offset;
- display_frame->bottom = ((display_frame->bottom * new_panel_height) / panel_height) + y_offset;
+ display_frame->left = (display_frame->left * INT32(new_panel_width) / INT32(panel_width))
+ + x_offset;
+ display_frame->top = (display_frame->top * INT32(new_panel_height) / INT32(panel_height)) +
+ y_offset;
+ display_frame->right = ((display_frame->right * INT32(new_panel_width)) / INT32(panel_width)) +
+ x_offset;
+ display_frame->bottom = ((display_frame->bottom * INT32(new_panel_height)) / INT32(panel_height))
+ + y_offset;
}
void HWCDisplayExternal::SetSecureDisplay(bool secure_display_active) {
diff --git a/sdm/libs/hwc/hwc_display_primary.cpp b/sdm/libs/hwc/hwc_display_primary.cpp
index efef736..0403361 100644
--- a/sdm/libs/hwc/hwc_display_primary.cpp
+++ b/sdm/libs/hwc/hwc_display_primary.cpp
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2014 - 2015, The Linux Foundation. All rights reserved.
+* Copyright (c) 2014 - 2016, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -56,8 +56,8 @@
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;
+ primary_width = UINT32(width);
+ primary_height = UINT32(height);
}
status = hwc_display_primary->SetFrameBufferResolution(primary_width, primary_height);
@@ -105,10 +105,29 @@
if (numBootUpLayers == 0) {
numBootUpLayers = 2;
}
-
- if (list->numHwLayers > numBootUpLayers) {
+ /* All other checks namely "init.svc.bootanim" or
+ * HWC_GEOMETRY_CHANGED fail in correctly identifying the
+ * exact bootup transition to homescreen
+ */
+ char cryptoState[PROPERTY_VALUE_MAX];
+ char voldDecryptState[PROPERTY_VALUE_MAX];
+ bool isEncrypted = false;
+ bool main_class_services_started = false;
+ if (property_get("ro.crypto.state", cryptoState, "unencrypted")) {
+ DLOGI("%s: cryptostate= %s", __FUNCTION__, cryptoState);
+ if (!strcmp(cryptoState, "encrypted")) {
+ isEncrypted = true;
+ if (property_get("vold.decrypt", voldDecryptState, "") &&
+ !strcmp(voldDecryptState, "trigger_restart_framework"))
+ main_class_services_started = true;
+ DLOGI("%s: vold= %s", __FUNCTION__, voldDecryptState);
+ }
+ }
+ if ((!isEncrypted ||(isEncrypted && main_class_services_started)) &&
+ (list->numHwLayers > numBootUpLayers)) {
boot_animation_completed_ = true;
- // one-shot action check if bootanimation completed then apply default display mode.
+ // Applying default mode after bootanimation is finished And
+ // If Data is Encrypted, it is ready for access.
if (display_intf_)
display_intf_->ApplyDefaultDisplayMode();
}
@@ -136,7 +155,7 @@
return status;
}
- bool one_updating_layer = SingleLayerUpdating(content_list->numHwLayers - 1);
+ bool one_updating_layer = SingleLayerUpdating(UINT32(content_list->numHwLayers - 1));
ToggleCPUHint(one_updating_layer);
uint32_t refresh_rate = GetOptimalRefreshRate(one_updating_layer);
@@ -200,23 +219,23 @@
int HWCDisplayPrimary::Perform(uint32_t operation, ...) {
va_list args;
va_start(args, operation);
- int val = va_arg(args, uint32_t);
+ int val = va_arg(args, int32_t);
va_end(args);
switch (operation) {
case SET_METADATA_DYN_REFRESH_RATE:
SetMetaDataRefreshRateFlag(val);
break;
case SET_BINDER_DYN_REFRESH_RATE:
- ForceRefreshRate(val);
+ ForceRefreshRate(UINT32(val));
break;
case SET_DISPLAY_MODE:
- SetDisplayMode(val);
+ SetDisplayMode(UINT32(val));
break;
case SET_QDCM_SOLID_FILL_INFO:
- SetQDCMSolidFillInfo(true, val);
+ SetQDCMSolidFillInfo(true, UINT32(val));
break;
case UNSET_QDCM_SOLID_FILL_INFO:
- SetQDCMSolidFillInfo(false, val);
+ SetQDCMSolidFillInfo(false, UINT32(val));
break;
default:
DLOGW("Invalid operation %d", operation);
diff --git a/sdm/libs/hwc/hwc_display_virtual.cpp b/sdm/libs/hwc/hwc_display_virtual.cpp
index f216f89..b405d91 100644
--- a/sdm/libs/hwc/hwc_display_virtual.cpp
+++ b/sdm/libs/hwc/hwc_display_virtual.cpp
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2014 - 2015, The Linux Foundation. All rights reserved.
+* Copyright (c) 2014 - 2016, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -78,7 +78,7 @@
int fb_width = fb_layer.displayFrame.right - fb_layer.displayFrame.left;
int fb_height = fb_layer.displayFrame.bottom - fb_layer.displayFrame.top;
- status = hwc_display_virtual->SetFrameBufferResolution(fb_width, fb_height);
+ status = hwc_display_virtual->SetFrameBufferResolution(UINT32(fb_width), UINT32(fb_height));
if (status) {
Destroy(hwc_display_virtual);
@@ -222,11 +222,11 @@
int fbt_height = frame.bottom - frame.top;
const MetaData_t *meta_data = reinterpret_cast<MetaData_t *>(output_handle->base_metadata);
if (meta_data && meta_data->operation & UPDATE_BUFFER_GEOMETRY) {
- variable_info.x_pixels = meta_data->bufferDim.sliceWidth;
- variable_info.y_pixels = meta_data->bufferDim.sliceHeight;
+ variable_info.x_pixels = UINT32(meta_data->bufferDim.sliceWidth);
+ variable_info.y_pixels = UINT32(meta_data->bufferDim.sliceHeight);
} else {
- variable_info.x_pixels = fbt_width;
- variable_info.y_pixels = fbt_height;
+ variable_info.x_pixels = UINT32(fbt_width);
+ variable_info.y_pixels = UINT32(fbt_height);
}
// TODO(user): Need to get the framerate of primary display and update it.
variable_info.fps = 60;
@@ -272,8 +272,8 @@
AdrenoMemInfo::getInstance().getAlignedWidthAndHeight(output_handle, output_buffer_width,
output_buffer_height);
- output_buffer_->width = output_buffer_width;
- output_buffer_->height = output_buffer_height;
+ output_buffer_->width = UINT32(output_buffer_width);
+ output_buffer_->height = UINT32(output_buffer_height);
output_buffer_->flags.secure = 0;
output_buffer_->flags.video = 0;
@@ -285,7 +285,7 @@
// ToDo: Need to extend for non-RGB formats
output_buffer_->planes[0].fd = output_handle->fd;
output_buffer_->planes[0].offset = output_handle->offset;
- output_buffer_->planes[0].stride = output_handle->width;
+ output_buffer_->planes[0].stride = UINT32(output_handle->width);
}
layer_stack_.output_buffer = output_buffer_;
diff --git a/sdm/libs/hwc/hwc_session.cpp b/sdm/libs/hwc/hwc_session.cpp
index c84fab1..b8891bd 100644
--- a/sdm/libs/hwc/hwc_session.cpp
+++ b/sdm/libs/hwc/hwc_session.cpp
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2014 - 2015, The Linux Foundation. All rights reserved.
+* Copyright (c) 2014 - 2016, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -297,7 +297,13 @@
}
if (hwc_session->hwc_display_[dpy]) {
- hwc_session->hwc_display_[dpy]->Prepare(content_list);
+ if (!content_list) {
+ DLOGI("Display[%d] connected. content_list is null", dpy);
+ } else if (!content_list->numHwLayers) {
+ DLOGE("Display[%d] connected. numHwLayers is zero", dpy);
+ } else {
+ hwc_session->hwc_display_[dpy]->Prepare(content_list);
+ }
}
}
}
@@ -475,7 +481,7 @@
return;
}
- DumpInterface::GetDump(buffer, length);
+ DumpInterface::GetDump(buffer, UINT32(length));
}
int HWCSession::GetDisplayConfigs(hwc_composer_device_1 *device, int disp, uint32_t *configs,
@@ -859,7 +865,7 @@
uint32_t config = 0;
error = hwc_display_[dpy]->GetActiveDisplayConfig(&config);
if (error == 0) {
- output_parcel->writeInt32(config);
+ output_parcel->writeInt32(INT(config));
}
}
@@ -879,7 +885,7 @@
if (hwc_display_[dpy]) {
error = hwc_display_[dpy]->GetDisplayConfigCount(&count);
if (error == 0) {
- output_parcel->writeInt32(count);
+ output_parcel->writeInt32(INT(count));
}
}
@@ -901,9 +907,9 @@
if (hwc_display_[dpy]) {
error = hwc_display_[dpy]->GetDisplayAttributesForConfig(config, &attributes);
if (error == 0) {
- output_parcel->writeInt32(attributes.vsync_period_ns);
- output_parcel->writeInt32(attributes.x_pixels);
- output_parcel->writeInt32(attributes.y_pixels);
+ output_parcel->writeInt32(INT(attributes.vsync_period_ns));
+ output_parcel->writeInt32(INT(attributes.x_pixels));
+ output_parcel->writeInt32(INT(attributes.y_pixels));
output_parcel->writeFloat(attributes.x_dpi);
output_parcel->writeFloat(attributes.y_dpi);
output_parcel->writeInt32(0); // Panel type, unsupported.
@@ -1274,7 +1280,7 @@
}
DLOGI("Restoring power mode on primary");
- uint32_t mode = hwc_display_[HWC_DISPLAY_PRIMARY]->GetLastPowerMode();
+ int32_t mode = INT(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);
@@ -1336,7 +1342,7 @@
// trigger screen refresh to ensure sufficient resources are available to process new
// new display connection.
hwc_procs_->invalidate(hwc_procs_);
- int32_t vsync_period = GetVsyncPeriod(HWC_DISPLAY_PRIMARY);
+ uint32_t vsync_period = UINT32(GetVsyncPeriod(HWC_DISPLAY_PRIMARY));
usleep(vsync_period * 2 / 1000);
}
// notify client
diff --git a/sdm/libs/utils/Android.mk b/sdm/libs/utils/Android.mk
index dd3a0d1..8125b49 100644
--- a/sdm/libs/utils/Android.mk
+++ b/sdm/libs/utils/Android.mk
@@ -5,11 +5,13 @@
LOCAL_MODULE_TAGS := optional
LOCAL_C_INCLUDES := hardware/qcom/display/sdm/include/
LOCAL_CFLAGS := -Wno-missing-field-initializers \
- -Wall -Werror -std=c++11 -fcolor-diagnostics\
+ -Wall -Werror -Wconversion \
+ -std=c++11 -fcolor-diagnostics\
-DLOG_TAG=\"SDM\"
LOCAL_CLANG := true
LOCAL_SRC_FILES := debug.cpp \
rect.cpp \
- sys.cpp
+ sys.cpp \
+ formats.cpp
include $(BUILD_SHARED_LIBRARY)
diff --git a/sdm/libs/utils/debug.cpp b/sdm/libs/utils/debug.cpp
index d0d21ee..7082421 100644
--- a/sdm/libs/utils/debug.cpp
+++ b/sdm/libs/utils/debug.cpp
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2014 - 2015, The Linux Foundation. All rights reserved.
+* Copyright (c) 2014 - 2016, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -52,11 +52,11 @@
return value;
}
-int Debug::GetIdleTimeoutMs() {
+uint32_t Debug::GetIdleTimeoutMs() {
int value = IDLE_TIMEOUT_DEFAULT_MS;
debug_.debug_handler_->GetProperty("sdm.idle_time", &value);
- return value;
+ return UINT32(value);
}
int Debug::GetBootAnimLayerCount() {
diff --git a/sdm/libs/utils/formats.cpp b/sdm/libs/utils/formats.cpp
new file mode 100644
index 0000000..512f9ee
--- /dev/null
+++ b/sdm/libs/utils/formats.cpp
@@ -0,0 +1,72 @@
+/*
+* Copyright (c) 2016, The Linux Foundation. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are
+* met:
+* * Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+* * Redistributions in binary form must reproduce the above
+* copyright notice, this list of conditions and the following
+* disclaimer in the documentation and/or other materials provided
+* with the distribution.
+* * Neither the name of The Linux Foundation nor the names of its
+* contributors may be used to endorse or promote products derived
+* from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include <utils/formats.h>
+
+#define __CLASS__ "FormatsUtils"
+
+namespace sdm {
+
+bool IsUBWCFormat(LayerBufferFormat format) {
+ switch (format) {
+ case kFormatRGBA8888Ubwc:
+ case kFormatRGBX8888Ubwc:
+ case kFormatBGR565Ubwc:
+ case kFormatYCbCr420SPVenusUbwc:
+ case kFormatRGBA1010102Ubwc:
+ case kFormatRGBX1010102Ubwc:
+ case kFormatYCbCr420TP10Ubwc:
+ return true;
+ default:
+ return false;
+ }
+}
+
+bool Is10BitFormat(LayerBufferFormat format) {
+ switch (format) {
+ case kFormatRGBA1010102:
+ case kFormatARGB2101010:
+ case kFormatRGBX1010102:
+ case kFormatXRGB2101010:
+ case kFormatBGRA1010102:
+ case kFormatABGR2101010:
+ case kFormatBGRX1010102:
+ case kFormatXBGR2101010:
+ case kFormatRGBA1010102Ubwc:
+ case kFormatRGBX1010102Ubwc:
+ case kFormatYCbCr420P010:
+ case kFormatYCbCr420TP10Ubwc:
+ return true;
+ default:
+ return false;
+ }
+}
+
+} // namespace sdm
+