am d6b94e50: (-s ours) am 5552deeb: hardware: samsung_slsi: libcamera2: fix metadata symbols: DO NOT MERGE
# Via Android Git Automerger (1) and Igor Murashkin (1)
* commit 'd6b94e50e937003c60bbdf832a0d16337de14b09':
hardware: samsung_slsi: libcamera2: fix metadata symbols: DO NOT MERGE
diff --git a/exynos_omx/openmax/exynos_omx/component/common/Exynos_OMX_Basecomponent.c b/exynos_omx/openmax/exynos_omx/component/common/Exynos_OMX_Basecomponent.c
index fac8d52..e0f19aa 100644
--- a/exynos_omx/openmax/exynos_omx/component/common/Exynos_OMX_Basecomponent.c
+++ b/exynos_omx/openmax/exynos_omx/component/common/Exynos_OMX_Basecomponent.c
@@ -191,6 +191,7 @@
if ((currentState == OMX_StateLoaded) && (destState == OMX_StateIdle)) {
ret = Exynos_OMX_Get_Resource(pOMXComponent);
if (ret != OMX_ErrorNone) {
+ Exynos_OSAL_SignalSet(pExynosComponent->abendStateEvent);
goto EXIT;
}
}
diff --git a/exynos_omx/openmax/exynos_omx/component/video/enc/Android.mk b/exynos_omx/openmax/exynos_omx/component/video/enc/Android.mk
index 7c1c436..0d3e767 100644
--- a/exynos_omx/openmax/exynos_omx/component/video/enc/Android.mk
+++ b/exynos_omx/openmax/exynos_omx/component/video/enc/Android.mk
@@ -9,6 +9,8 @@
LOCAL_ARM_MODE := arm
LOCAL_MODULE_TAGS := optional
+LOCAL_CFLAGS := -DUSE_CSC_GSCALER -DCSC_GSCALER_IDX=3
+
LOCAL_C_INCLUDES := $(EXYNOS_OMX_INC)/khronos \
$(EXYNOS_OMX_INC)/exynos \
$(EXYNOS_OMX_TOP)/osal \
diff --git a/exynos_omx/openmax/exynos_omx/component/video/enc/Exynos_OMX_Venc.c b/exynos_omx/openmax/exynos_omx/component/video/enc/Exynos_OMX_Venc.c
index b3b2eb9..ca2b6ce 100644
--- a/exynos_omx/openmax/exynos_omx/component/video/enc/Exynos_OMX_Venc.c
+++ b/exynos_omx/openmax/exynos_omx/component/video/enc/Exynos_OMX_Venc.c
@@ -104,6 +104,8 @@
pData->buffer.multiPlaneBuffer.dataBuffer[0] = pInputCodecBuffer->pVirAddr[0];
pData->buffer.multiPlaneBuffer.dataBuffer[1] = pInputCodecBuffer->pVirAddr[1];
+ pData->buffer.multiPlaneBuffer.fd[0] = pInputCodecBuffer->fd[0];
+ pData->buffer.multiPlaneBuffer.fd[1] = pInputCodecBuffer->fd[1];
pData->allocSize = pInputCodecBuffer->bufferSize[0] + pInputCodecBuffer->bufferSize[1];
pData->dataLen = pInputCodecBuffer->dataSize;
pData->usedDataLen = 0;
@@ -189,8 +191,10 @@
CSC_METHOD csc_method = CSC_METHOD_SW;
unsigned int cacheable = 1;
- unsigned char *pSrcBuf[3] = {NULL, };
- unsigned char *pDstBuf[3] = {NULL, };
+ void *pSrcBuf[3] = {NULL, };
+ void *pSrcFd[3] = {NULL, };
+ void *pDstBuf[3] = {NULL, };
+ void *pDstFd[3] = {NULL, };
CSC_ERRORCODE cscRet = CSC_ErrorNone;
@@ -202,13 +206,6 @@
pDstBuf[1] = srcInputData->buffer.multiPlaneBuffer.dataBuffer[1];
pDstBuf[2] = srcInputData->buffer.multiPlaneBuffer.dataBuffer[2];
- csc_get_method(pVideoEnc->csc_handle, &csc_method);
- if (csc_method == CSC_METHOD_HW) {
- pDstBuf[0] = srcInputData->buffer.multiPlaneBuffer.fd[0];
- pDstBuf[1] = srcInputData->buffer.multiPlaneBuffer.fd[1];
- pDstBuf[2] = srcInputData->buffer.multiPlaneBuffer.fd[2];
- }
-
#ifdef USE_METADATABUFFERTYPE
OMX_PTR ppBuf[MAX_BUFFER_PLANE];
@@ -221,28 +218,21 @@
Exynos_OSAL_GetInfoFromMetaData((OMX_BYTE)inputUseBuffer->bufferHeader->pBuffer, ppBuf);
if (eColorFormat == OMX_COLOR_FormatAndroidOpaque) {
ExynosVideoPlane planes[MAX_BUFFER_PLANE];
- OMX_U32 stride;
- int imageSize;
+ size_t i;
Exynos_OSAL_LockANBHandle((OMX_U32)ppBuf[0], nFrameWidth, nFrameHeight, OMX_COLOR_FormatAndroidOpaque, planes);
- imageSize = nFrameWidth * nFrameHeight * 3; /* RGB888 */
- if (csc_method == CSC_METHOD_HW)
- pSrcBuf[0] = (unsigned char *)planes[0].fd;
- else
- pSrcBuf[0] = planes[0].addr;
- pSrcBuf[1] = NULL;
- pSrcBuf[2] = NULL;
+#ifdef USE_CSC_GSCALER
+ csc_method = CSC_METHOD_HW;
+#endif
+ pSrcBuf[0] = planes[0].addr;
+ pSrcFd[0] = (void *)planes[0].fd;
+ for (i = 0; i < 3; i++)
+ pDstFd[i] = (void *)srcInputData->buffer.multiPlaneBuffer.fd[i];
}
} else
#endif
{
- if (csc_method == CSC_METHOD_HW) {
- pSrcBuf[0] = Exynos_OSAL_SharedMemory_VirtToION(pVideoEnc->hSharedMemory, checkInputStream);
- pSrcBuf[1] = NULL;
- pSrcBuf[2] = NULL;
- }
-
switch (eColorFormat) {
case OMX_COLOR_FormatYUV420Planar:
/* YUV420Planar converted to YUV420Semiplanar (interleaved UV plane) as per MFC spec.*/
@@ -261,6 +251,9 @@
}
}
+ csc_set_method(
+ pVideoEnc->csc_handle,
+ csc_method);
csc_set_src_format(
pVideoEnc->csc_handle, /* handle */
nFrameWidth, /* width */
@@ -281,12 +274,21 @@
nFrameHeight, /* crop_height */
csc_dst_color_format, /* color_format */
cacheable); /* cacheable */
- csc_set_src_buffer(
- pVideoEnc->csc_handle, /* handle */
- pSrcBuf); /* YUV Addr or FD */
- csc_set_dst_buffer(
- pVideoEnc->csc_handle, /* handle */
- pDstBuf); /* YUV Addr or FD */
+ if (csc_method == CSC_METHOD_SW) {
+ csc_set_src_buffer(
+ pVideoEnc->csc_handle, /* handle */
+ pSrcBuf);
+ csc_set_dst_buffer(
+ pVideoEnc->csc_handle, /* handle */
+ pDstBuf);
+ } else {
+ csc_set_src_buffer(
+ pVideoEnc->csc_handle, /* handle */
+ pSrcFd);
+ csc_set_dst_buffer(
+ pVideoEnc->csc_handle, /* handle */
+ pDstFd);
+ }
cscRet = csc_convert(pVideoEnc->csc_handle);
if (cscRet != CSC_ErrorNone)
ret = OMX_FALSE;
@@ -299,8 +301,6 @@
}
#endif
- ret = OMX_TRUE;
-
EXIT:
FunctionOut();
@@ -403,18 +403,24 @@
Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "exynos_checkInputFrame : OMX_TRUE");
if (((srcInputData->allocSize) - (srcInputData->dataLen)) >= copySize) {
- Exynos_CSC_InputData(pOMXComponent, srcInputData);
+ ret = Exynos_CSC_InputData(pOMXComponent, srcInputData);
+ if (ret) {
+ inputUseBuffer->dataLen -= copySize;
+ inputUseBuffer->remainDataLen -= copySize;
+ inputUseBuffer->usedDataLen += copySize;
- inputUseBuffer->dataLen -= copySize;
- inputUseBuffer->remainDataLen -= copySize;
- inputUseBuffer->usedDataLen += copySize;
+ srcInputData->dataLen += copySize;
+ srcInputData->remainDataLen += copySize;
- srcInputData->dataLen += copySize;
- srcInputData->remainDataLen += copySize;
-
- srcInputData->timeStamp = inputUseBuffer->timeStamp;
- srcInputData->nFlags = inputUseBuffer->nFlags;
- srcInputData->bufferHeader = inputUseBuffer->bufferHeader;
+ srcInputData->timeStamp = inputUseBuffer->timeStamp;
+ srcInputData->nFlags = inputUseBuffer->nFlags;
+ srcInputData->bufferHeader = inputUseBuffer->bufferHeader;
+ } else {
+ Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "Exynos_CSC_InputData() failure");
+ pExynosComponent->pCallbacks->EventHandler((OMX_HANDLETYPE)pOMXComponent,
+ pExynosComponent->callbackData, OMX_EventError,
+ OMX_ErrorUndefined, 0, NULL );
+ }
} else {
Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "input codec buffer is smaller than decoded input data size Out Length");
pExynosComponent->pCallbacks->EventHandler((OMX_HANDLETYPE)pOMXComponent,
@@ -589,9 +595,9 @@
pVideoEnc->pMFCEncInputBuffer[i]->fd[2] = -1;
pVideoEnc->pMFCEncInputBuffer[i]->bufferSize[2] = 0;
- Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "pVideoEnc->pMFCEncInputBuffer[%d]: 0x%x", i, pVideoEnc->pMFCEncInputBuffer[i]);
- Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "pVideoEnc->pMFCEncInputBuffer[%d]->pVirAddr[0]: 0x%x", i, pVideoEnc->pMFCEncInputBuffer[i]->pVirAddr[0]);
- Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "pVideoEnc->pMFCEncInputBuffer[%d]->pVirAddr[1]: 0x%x", i, pVideoEnc->pMFCEncInputBuffer[i]->pVirAddr[1]);
+ Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "pVideoEnc->pMFCEncInputBuffer[%d]: 0x%x", i, pVideoEnc->pMFCEncInputBuffer[i]);
+ Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "pVideoEnc->pMFCEncInputBuffer[%d]->pVirAddr[0]: 0x%x", i, pVideoEnc->pMFCEncInputBuffer[i]->pVirAddr[0]);
+ Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "pVideoEnc->pMFCEncInputBuffer[%d]->pVirAddr[1]: 0x%x", i, pVideoEnc->pMFCEncInputBuffer[i]->pVirAddr[1]);
Exynos_CodecBufferEnQueue(pExynosComponent, INPUT_PORT_INDEX, pVideoEnc->pMFCEncInputBuffer[i]);
}
@@ -1085,6 +1091,8 @@
EXYNOS_OMX_BASEPORT *pExynosPort = NULL;
EXYNOS_OMX_VIDEOENC_COMPONENT *pVideoEnc = NULL;
+ CSC_METHOD csc_method = CSC_METHOD_SW;
+
FunctionIn();
if (hComponent == NULL) {
@@ -1133,6 +1141,19 @@
pVideoEnc->quantization.nQpP = 5; // P frame quantization parameter
pVideoEnc->quantization.nQpB = 5; // B frame quantization parameter
+ pVideoEnc->csc_handle = csc_init(csc_method);
+ if (pVideoEnc->csc_handle == NULL) {
+ Exynos_OSAL_Free(pVideoEnc);
+ Exynos_OMX_BaseComponent_Destructor(pOMXComponent);
+ ret = OMX_ErrorInsufficientResources;
+ Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "OMX_ErrorInsufficientResources, Line:%d", __LINE__);
+ goto EXIT;
+ }
+ pVideoEnc->csc_set_format = OMX_FALSE;
+#if defined(USE_CSC_GSCALER)
+ csc_set_hw_property(pVideoEnc->csc_handle, CSC_HW_PROPERTY_FIXED_NODE, CSC_GSCALER_IDX);
+#endif
+
pExynosComponent->bMultiThreadProcess = OMX_TRUE;
/* Input port */
@@ -1229,6 +1250,11 @@
pVideoEnc = (EXYNOS_OMX_VIDEOENC_COMPONENT *)pExynosComponent->hComponentHandle;
+ if (pVideoEnc->csc_handle != NULL) {
+ csc_deinit(pVideoEnc->csc_handle);
+ pVideoEnc->csc_handle = NULL;
+ }
+
Exynos_OSAL_Free(pVideoEnc);
pExynosComponent->hComponentHandle = pVideoEnc = NULL;
diff --git a/exynos_omx/openmax/exynos_omx/component/video/enc/h264/Exynos_OMX_H264enc.c b/exynos_omx/openmax/exynos_omx/component/video/enc/h264/Exynos_OMX_H264enc.c
index d25503d..0806f03 100644
--- a/exynos_omx/openmax/exynos_omx/component/video/enc/h264/Exynos_OMX_H264enc.c
+++ b/exynos_omx/openmax/exynos_omx/component/video/enc/h264/Exynos_OMX_H264enc.c
@@ -1533,7 +1533,6 @@
ExynosVideoEncBufferOps *pInbufOps = NULL;
ExynosVideoEncBufferOps *pOutbufOps = NULL;
- CSC_METHOD csc_method = CSC_METHOD_SW;
int i = 0;
FunctionIn();
@@ -1596,9 +1595,9 @@
pVideoEnc->pMFCEncInputBuffer[i]->fd[2] = -1;
pVideoEnc->pMFCEncInputBuffer[i]->bufferSize[2] = 0;
- Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "pVideoEnc->pMFCEncInputBuffer[%d]: 0x%x", i, pVideoEnc->pMFCEncInputBuffer[i]);
- Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "pVideoEnc->pMFCEncInputBuffer[%d]->pVirAddr[0]: 0x%x", i, pVideoEnc->pMFCEncInputBuffer[i]->pVirAddr[0]);
- Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "pVideoEnc->pMFCEncInputBuffer[%d]->pVirAddr[1]: 0x%x", i, pVideoEnc->pMFCEncInputBuffer[i]->pVirAddr[1]);
+ Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "pVideoEnc->pMFCEncInputBuffer[%d]: 0x%x", i, pVideoEnc->pMFCEncInputBuffer[i]);
+ Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "pVideoEnc->pMFCEncInputBuffer[%d]->pVirAddr[0]: 0x%x", i, pVideoEnc->pMFCEncInputBuffer[i]->pVirAddr[0]);
+ Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "pVideoEnc->pMFCEncInputBuffer[%d]->pVirAddr[1]: 0x%x", i, pVideoEnc->pMFCEncInputBuffer[i]->pVirAddr[1]);
Exynos_CodecBufferEnQueue(pExynosComponent, INPUT_PORT_INDEX, pVideoEnc->pMFCEncInputBuffer[i]);
}
@@ -1632,16 +1631,6 @@
pExynosComponent->getAllDelayBuffer = OMX_FALSE;
-#if 0//defined(USE_CSC_GSCALER)
- csc_method = CSC_METHOD_HW; //in case of Use ION buffer.
-#endif
- pVideoEnc->csc_handle = csc_init(csc_method);
- if (pVideoEnc->csc_handle == NULL) {
- ret = OMX_ErrorInsufficientResources;
- goto EXIT;
- }
- pVideoEnc->csc_set_format = OMX_FALSE;
-
EXIT:
FunctionOut();
@@ -1667,11 +1656,6 @@
FunctionIn();
- if (pVideoEnc->csc_handle != NULL) {
- csc_deinit(pVideoEnc->csc_handle);
- pVideoEnc->csc_handle = NULL;
- }
-
Exynos_OSAL_SignalTerminate(pH264Enc->hDestinationStartEvent);
pH264Enc->hDestinationStartEvent = NULL;
pH264Enc->bDestinationStart = OMX_FALSE;
diff --git a/exynos_omx/openmax/exynos_omx/component/video/enc/mpeg4/Exynos_OMX_Mpeg4enc.c b/exynos_omx/openmax/exynos_omx/component/video/enc/mpeg4/Exynos_OMX_Mpeg4enc.c
index f58ee45..c6bafc4 100644
--- a/exynos_omx/openmax/exynos_omx/component/video/enc/mpeg4/Exynos_OMX_Mpeg4enc.c
+++ b/exynos_omx/openmax/exynos_omx/component/video/enc/mpeg4/Exynos_OMX_Mpeg4enc.c
@@ -1749,7 +1749,6 @@
ExynosVideoEncBufferOps *pInbufOps = NULL;
ExynosVideoEncBufferOps *pOutbufOps = NULL;
- CSC_METHOD csc_method = CSC_METHOD_SW;
int i = 0;
FunctionIn();
@@ -1812,9 +1811,9 @@
pVideoEnc->pMFCEncInputBuffer[i]->fd[2] = -1;
pVideoEnc->pMFCEncInputBuffer[i]->bufferSize[2] = 0;
- Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "pVideoEnc->pMFCEncInputBuffer[%d]: 0x%x", i, pVideoEnc->pMFCEncInputBuffer[i]);
- Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "pVideoEnc->pMFCEncInputBuffer[%d]->pVirAddr[0]: 0x%x", i, pVideoEnc->pMFCEncInputBuffer[i]->pVirAddr[0]);
- Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "pVideoEnc->pMFCEncInputBuffer[%d]->pVirAddr[1]: 0x%x", i, pVideoEnc->pMFCEncInputBuffer[i]->pVirAddr[1]);
+ Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "pVideoEnc->pMFCEncInputBuffer[%d]: 0x%x", i, pVideoEnc->pMFCEncInputBuffer[i]);
+ Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "pVideoEnc->pMFCEncInputBuffer[%d]->pVirAddr[0]: 0x%x", i, pVideoEnc->pMFCEncInputBuffer[i]->pVirAddr[0]);
+ Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "pVideoEnc->pMFCEncInputBuffer[%d]->pVirAddr[1]: 0x%x", i, pVideoEnc->pMFCEncInputBuffer[i]->pVirAddr[1]);
Exynos_CodecBufferEnQueue(pExynosComponent, INPUT_PORT_INDEX, pVideoEnc->pMFCEncInputBuffer[i]);
}
@@ -1848,16 +1847,6 @@
pExynosComponent->getAllDelayBuffer = OMX_FALSE;
-#if 0//defined(USE_CSC_GSCALER)
- csc_method = CSC_METHOD_HW; //in case of Use ION buffer.
-#endif
- pVideoEnc->csc_handle = csc_init(csc_method);
- if (pVideoEnc->csc_handle == NULL) {
- ret = OMX_ErrorInsufficientResources;
- goto EXIT;
- }
- pVideoEnc->csc_set_format = OMX_FALSE;
-
EXIT:
FunctionOut();
@@ -1883,11 +1872,6 @@
FunctionIn();
- if (pVideoEnc->csc_handle != NULL) {
- csc_deinit(pVideoEnc->csc_handle);
- pVideoEnc->csc_handle = NULL;
- }
-
Exynos_OSAL_SignalTerminate(pMpeg4Enc->hDestinationStartEvent);
pMpeg4Enc->hDestinationStartEvent = NULL;
pMpeg4Enc->bDestinationStart = OMX_FALSE;
diff --git a/exynos_omx/openmax/exynos_omx/osal/Exynos_OSAL_Android.cpp b/exynos_omx/openmax/exynos_omx/osal/Exynos_OSAL_Android.cpp
index 142580c..b4fa5f2 100644
--- a/exynos_omx/openmax/exynos_omx/osal/Exynos_OSAL_Android.cpp
+++ b/exynos_omx/openmax/exynos_omx/osal/Exynos_OSAL_Android.cpp
@@ -612,7 +612,7 @@
case HAL_PIXEL_FORMAT_YCbCr_420_SP_TILED:
omx_format = (OMX_COLOR_FORMATTYPE)OMX_SEC_COLOR_FormatNV12Tiled;
break;
- case HAL_PIXEL_FORMAT_ARGB888:
+ case HAL_PIXEL_FORMAT_CUSTOM_ARGB_8888:
omx_format = OMX_COLOR_Format32bitARGB8888;
break;
default:
@@ -643,7 +643,7 @@
hal_format = HAL_PIXEL_FORMAT_YCbCr_420_SP_TILED;
break;
case OMX_COLOR_Format32bitARGB8888:
- hal_format = HAL_PIXEL_FORMAT_ARGB888;
+ hal_format = HAL_PIXEL_FORMAT_CUSTOM_ARGB_8888;
break;
default:
hal_format = HAL_PIXEL_FORMAT_YCbCr_420_P;
diff --git a/gralloc/framebuffer.cpp b/gralloc/framebuffer.cpp
index c1d4ce9..ce409ce 100644
--- a/gralloc/framebuffer.cpp
+++ b/gralloc/framebuffer.cpp
@@ -105,6 +105,52 @@
return 0;
}
+static void get_screen_res(const char *fbname, int32_t *xres, int32_t *yres,
+ int32_t *refresh)
+{
+ char *path;
+ int fd;
+ char buf[128];
+ int ret;
+ unsigned int _x, _y, _r;
+
+ asprintf(&path, "/sys/class/graphics/%s/modes", fbname);
+ if (!path)
+ goto err_asprintf;
+ fd = open(path, O_RDONLY);
+ if (fd < 0)
+ goto err_open;
+ ret = read(fd, buf, sizeof(buf));
+ if (ret <= 0)
+ goto err_read;
+ buf[sizeof(buf)-1] = '\0';
+
+ ret = sscanf(buf, "U:%ux%up-%u", &_x, &_y, &_r);
+ if (ret != 3)
+ goto err_sscanf;
+
+ ALOGI("Using %ux%u %uHz resolution for '%s' from modes list\n",
+ _x, _y, _r, fbname);
+
+ *xres = (int32_t)_x;
+ *yres = (int32_t)_y;
+ *refresh = (int32_t)_r;
+
+ close(fd);
+ free(path);
+ return;
+
+err_sscanf:
+err_read:
+ close(fd);
+err_open:
+ free(path);
+err_asprintf:
+ *xres = 2560;
+ *yres = 1600;
+ *refresh = 60;
+}
+
int init_fb(struct private_module_t* module)
{
char const * const device_template[] = {
@@ -135,19 +181,13 @@
return -errno;
}
- int refreshRate = 1000000000000000LLU /
- (
- uint64_t( info.upper_margin + info.lower_margin + info.yres )
- * ( info.left_margin + info.right_margin + info.xres )
- * info.pixclock
- );
-
+ int32_t refreshRate;
+ get_screen_res("fb0", &module->xres, &module->yres, &refreshRate);
if (refreshRate == 0)
- refreshRate = 60*1000; /* 60 Hz */
+ refreshRate = 60; /* 60 Hz */
- float xdpi = (info.xres * 25.4f) / info.width;
- float ydpi = (info.yres * 25.4f) / info.height;
- float fps = refreshRate / 1000.0f;
+ float xdpi = (module->xres * 25.4f) / info.width;
+ float ydpi = (module->yres * 25.4f) / info.height;
ALOGI("using (id=%s)\n"
"xres = %d px\n"
@@ -155,15 +195,13 @@
"width = %d mm (%f dpi)\n"
"height = %d mm (%f dpi)\n"
"refresh rate = %.2f Hz\n",
- finfo.id, info.xres, info.yres, info.width, xdpi, info.height, ydpi,
- fps);
+ finfo.id, module->xres, module->yres, info.width, xdpi, info.height,
+ ydpi, (float)refreshRate);
- module->xres = 2560;
- module->yres = 1600;
- module->line_length = 2560;
+ module->line_length = module->xres * 4;
module->xdpi = xdpi;
module->ydpi = ydpi;
- module->fps = fps;
+ module->fps = (float)refreshRate;
return 0;
}
diff --git a/gralloc/gralloc.cpp b/gralloc/gralloc.cpp
index f3610f3..83a2407 100644
--- a/gralloc/gralloc.cpp
+++ b/gralloc/gralloc.cpp
@@ -44,10 +44,13 @@
#include "exynos_format.h"
#include "gr.h"
-#define ION_HEAP_EXYNOS_CONTIG_MASK (1 << 4)
+#define ION_HEAP_EXYNOS_CONTIG_MASK (1 << 4)
#define ION_EXYNOS_FIMD_VIDEO_MASK (1 << 28)
#define ION_EXYNOS_MFC_OUTPUT_MASK (1 << 26)
#define ION_EXYNOS_MFC_INPUT_MASK (1 << 25)
+#define ION_HEAP_SYSTEM_ID 0
+#define ION_HEAP_EXYNOS_CONTIG_ID 4
+#define ION_HEAP_CHUNK_ID 6
#define MB_1 (1024*1024)
@@ -121,9 +124,9 @@
unsigned int heap_mask;
if (usage & GRALLOC_USAGE_PROTECTED)
- heap_mask = ION_HEAP_EXYNOS_CONTIG_MASK;
+ heap_mask = (1 << ION_HEAP_EXYNOS_CONTIG_ID);
else
- heap_mask = ION_HEAP_SYSTEM_MASK;
+ heap_mask = (1 << ION_HEAP_SYSTEM_ID) | (1 << ION_HEAP_CHUNK_ID);
return heap_mask;
}
@@ -189,6 +192,7 @@
{
size_t size;
int err, fd;
+ unsigned int heap_mask = _select_heap(usage);
switch (format) {
case HAL_PIXEL_FORMAT_YV12:
@@ -204,8 +208,7 @@
return -EINVAL;
}
- err = ion_alloc_fd(ionfd, size, 0, 1 << ION_HEAP_TYPE_SYSTEM,
- ion_flags, &fd);
+ err = ion_alloc_fd(ionfd, size, 0, heap_mask, ion_flags, &fd);
if (err)
return err;
diff --git a/include/exynos_format.h b/include/exynos_format.h
index f4c0466..610c89d 100644
--- a/include/exynos_format.h
+++ b/include/exynos_format.h
@@ -30,7 +30,7 @@
HAL_PIXEL_FORMAT_YCbCr_420_SP = 0x105,
HAL_PIXEL_FORMAT_YCrCb_422_SP = 0x106,
HAL_PIXEL_FORMAT_YCbCr_420_SP_TILED = 0x107,
- HAL_PIXEL_FORMAT_ARGB888 = 0x108,
+ HAL_PIXEL_FORMAT_CUSTOM_ARGB_8888 = 0x108,
// support custom format for zero copy
HAL_PIXEL_FORMAT_CUSTOM_YCbCr_420_SP = 0x110,
HAL_PIXEL_FORMAT_CUSTOM_YCrCb_420_SP = 0x111,
diff --git a/include/ion.h b/include/ion.h
index 0c6045e..e790cb4 100644
--- a/include/ion.h
+++ b/include/ion.h
@@ -20,6 +20,7 @@
#include <unistd.h> /* size_t */
#define ION_FLAG_CACHED 1
+#define ION_FLAG_CACHED_NEEDS_SYNC 2
#define ION_HEAP_SYSTEM_MASK (1 << 0)
#define ION_HEAP_SYSTEM_CONTIG_MASK (1 << 1)
diff --git a/libcamera2/ExynosCameraHWInterface2.cpp b/libcamera2/ExynosCameraHWInterface2.cpp
index ea90d05..d6174bb 100644
--- a/libcamera2/ExynosCameraHWInterface2.cpp
+++ b/libcamera2/ExynosCameraHWInterface2.cpp
@@ -6046,7 +6046,7 @@
break;
}
if (1 << i & cacheFlag)
- flag = ION_FLAG_CACHED;
+ flag = ION_FLAG_CACHED | ION_FLAG_CACHED_NEEDS_SYNC;
else
flag = 0;
buf->fd.extFd[i] = ion_alloc(ionClient, \
diff --git a/libcsc/csc.c b/libcsc/csc.c
index 4f2aac6..385223c 100644
--- a/libcsc/csc.c
+++ b/libcsc/csc.c
@@ -265,7 +265,7 @@
case HAL_PIXEL_FORMAT_YCbCr_420_SP:
ret = conv_sw_src_yuv420sp(handle);
break;
- case HAL_PIXEL_FORMAT_ARGB888:
+ case HAL_PIXEL_FORMAT_CUSTOM_ARGB_8888:
ret = conv_sw_src_argb888(handle);
break;
default:
@@ -363,8 +363,7 @@
if (csc_handle->csc_method == CSC_METHOD_HW) {
if (csc_handle->csc_hw_handle == NULL) {
ALOGE("%s:: CSC_METHOD_HW can't open HW", __func__);
- free(csc_handle);
- csc_handle = NULL;
+ ret = CSC_Error;
}
}
@@ -476,7 +475,7 @@
CSC_HANDLE *csc_handle;
csc_handle = (CSC_HANDLE *)handle;
- if (csc_handle->csc_method == CSC_METHOD_HW) {
+ if (csc_handle->csc_hw_handle) {
switch (csc_handle->csc_hw_type) {
#ifdef ENABLE_FIMC
case CSC_HW_TYPE_FIMC:
@@ -518,6 +517,22 @@
return ret;
}
+CSC_ERRORCODE csc_set_method(
+ void *handle,
+ CSC_METHOD method)
+{
+ CSC_HANDLE *csc_handle;
+ CSC_ERRORCODE ret = CSC_ErrorNone;
+
+ if (handle == NULL)
+ return CSC_ErrorNotInit;
+
+ csc_handle = (CSC_HANDLE *)handle;
+ csc_handle->csc_method = method;
+
+ return ret;
+}
+
CSC_ERRORCODE csc_set_hw_property(
void *handle,
CSC_HW_PROPERTY_TYPE property,
@@ -711,11 +726,19 @@
return CSC_ErrorNotInit;
if ((csc_handle->csc_method == CSC_METHOD_HW) &&
- (csc_handle->csc_hw_handle == NULL))
- csc_init_hw(handle);
+ (csc_handle->csc_hw_handle == NULL)) {
+ ret = csc_init_hw(handle);
+ if (ret != CSC_ErrorNone)
+ return ret;
+ }
- csc_set_format(csc_handle);
- csc_set_buffer(csc_handle);
+ ret = csc_set_format(csc_handle);
+ if (ret != CSC_ErrorNone)
+ return ret;
+
+ ret = csc_set_buffer(csc_handle);
+ if (ret != CSC_ErrorNone)
+ return ret;
if (csc_handle->csc_method == CSC_METHOD_HW)
ret = conv_hw(csc_handle);
diff --git a/libcsc/csc.h b/libcsc/csc.h
index 5fc50a2..f454f96 100644
--- a/libcsc/csc.h
+++ b/libcsc/csc.h
@@ -117,6 +117,22 @@
CSC_METHOD *method);
/*
+ * set color space converter method
+ *
+ * @param handle
+ * CSC handle[in]
+ *
+ * @param method
+ * CSC method[in]
+ *
+ * @return
+ * error code
+ */
+CSC_ERRORCODE csc_set_method(
+ void *handle,
+ CSC_METHOD method);
+
+/*
* Set hw property
*
* @param handle
diff --git a/libcsc/csc_helper.c b/libcsc/csc_helper.c
index 9f13d62..c8f869f 100644
--- a/libcsc/csc_helper.c
+++ b/libcsc/csc_helper.c
@@ -45,7 +45,7 @@
case HAL_PIXEL_FORMAT_YCbCr_420_SP_TILED:
omx_format = OMX_SEC_COLOR_FormatNV12Tiled;
break;
- case HAL_PIXEL_FORMAT_ARGB888:
+ case HAL_PIXEL_FORMAT_CUSTOM_ARGB_8888:
omx_format = OMX_COLOR_Format32bitARGB8888;
break;
default:
@@ -76,7 +76,7 @@
hal_format = HAL_PIXEL_FORMAT_YCbCr_420_SP_TILED;
break;
case OMX_COLOR_Format32bitARGB8888:
- hal_format = HAL_PIXEL_FORMAT_ARGB888;
+ hal_format = HAL_PIXEL_FORMAT_CUSTOM_ARGB_8888;
break;
default:
hal_format = HAL_PIXEL_FORMAT_YCbCr_420_P;
diff --git a/libexynosutils/exynos5_format_v4l2.c b/libexynosutils/exynos5_format_v4l2.c
index 8b05717..824f133 100644
--- a/libexynosutils/exynos5_format_v4l2.c
+++ b/libexynosutils/exynos5_format_v4l2.c
@@ -52,6 +52,7 @@
switch (hal_pixel_format) {
case HAL_PIXEL_FORMAT_RGBA_8888:
case HAL_PIXEL_FORMAT_RGBX_8888:
+ case HAL_PIXEL_FORMAT_CUSTOM_ARGB_8888:
v4l2_pixel_format = V4L2_PIX_FMT_RGB32;
break;
@@ -281,6 +282,7 @@
case HAL_PIXEL_FORMAT_RGBA_8888:
case HAL_PIXEL_FORMAT_BGRA_8888:
case HAL_PIXEL_FORMAT_RGBX_8888:
+ case HAL_PIXEL_FORMAT_CUSTOM_ARGB_8888:
frame_size = GET_32BPP_FRAME_SIZE(width, height);
break;
diff --git a/libhwc/Android.mk b/libhwc/Android.mk
index 0463494..5ef9373 100644
--- a/libhwc/Android.mk
+++ b/libhwc/Android.mk
@@ -12,8 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-ifneq ($(filter manta full_manta,$(TARGET_DEVICE)),)
-
LOCAL_PATH:= $(call my-dir)
# HAL module implemenation, not prelinked and stored in
# hw/<COPYPIX_HARDWARE_MODULE_ID>.<ro.product.board>.so
@@ -31,8 +29,6 @@
LOCAL_SRC_FILES := hwc.cpp
-LOCAL_MODULE := hwcomposer.$(TARGET_BOARD_PLATFORM)
+LOCAL_MODULE := hwcomposer.exynos5
LOCAL_MODULE_TAGS := optional
include $(BUILD_SHARED_LIBRARY)
-
-endif
diff --git a/libhwc/hwc.cpp b/libhwc/hwc.cpp
index 1a3d4a5..20f3a1d 100644
--- a/libhwc/hwc.cpp
+++ b/libhwc/hwc.cpp
@@ -199,6 +199,22 @@
template<typename T> inline T max(T a, T b) { return (a > b) ? a : b; }
template<typename T> inline T min(T a, T b) { return (a < b) ? a : b; }
+static int dup_or_warn(int fence)
+{
+ int dup_fd = dup(fence);
+ if (dup_fd < 0)
+ ALOGW("fence dup failed: %s", strerror(errno));
+ return dup_fd;
+}
+
+static int merge_or_warn(const char *name, int f1, int f2)
+{
+ int merge_fd = sync_merge(name, f1, f2);
+ if (merge_fd < 0)
+ ALOGW("fence merge failed: %s", strerror(errno));
+ return merge_fd;
+}
+
template<typename T> void align_crop_and_center(T &w, T &h,
hwc_rect_t *crop, size_t alignment)
{
@@ -549,6 +565,10 @@
static int hdmi_enable(struct exynos5_hwc_composer_device_1_t *dev)
{
+ /* hdmi not supported */
+ if (dev->hdmi_mixer0 < 0)
+ return 0;
+
if (dev->hdmi_enabled)
return 0;
@@ -1509,9 +1529,7 @@
if (pdev->bufs.overlay_map[i] != -1) {
hwc_layer_1_t &layer =
contents->hwLayers[pdev->bufs.overlay_map[i]];
- int dup_fd = dup(fence);
- if (dup_fd < 0)
- ALOGW("release fence dup failed: %s", strerror(errno));
+ int dup_fd = dup_or_warn(fence);
if (pdev->bufs.gsc_map[i].mode == exynos5_gsc_map_t::GSC_M2M) {
int gsc_idx = pdev->bufs.gsc_map[i].idx;
exynos5_gsc_data_t &gsc = pdev->gsc[gsc_idx];
@@ -1522,7 +1540,7 @@
}
}
}
- close(fence);
+ contents->retireFenceFd = fence;
return err;
}
@@ -1578,6 +1596,14 @@
gsc.dst_buf_fence[gsc.current_buf] = releaseFenceFd;
gsc.current_buf = (gsc.current_buf + 1) % NUM_GSC_DST_BUFS;
+ if (contents->retireFenceFd < 0)
+ contents->retireFenceFd = dup_or_warn(releaseFenceFd);
+ else {
+ int merged = merge_or_warn("hdmi",
+ contents->retireFenceFd, layer.releaseFenceFd);
+ close(contents->retireFenceFd);
+ contents->retireFenceFd = merged;
+ }
}
if (layer.compositionType == HWC_FRAMEBUFFER_TARGET) {
@@ -1589,6 +1615,15 @@
hdmi_show_layer(pdev, pdev->hdmi_layers[1]);
hdmi_output(pdev, pdev->hdmi_layers[1], layer, h, layer.acquireFenceFd,
&layer.releaseFenceFd);
+
+ if (contents->retireFenceFd < 0)
+ contents->retireFenceFd = dup_or_warn(layer.releaseFenceFd);
+ else {
+ int merged = merge_or_warn("hdmi",
+ contents->retireFenceFd, layer.releaseFenceFd);
+ close(contents->retireFenceFd);
+ contents->retireFenceFd = merged;
+ }
} else {
hdmi_hide_layer(pdev, pdev->hdmi_layers[1]);
}
@@ -1980,6 +2015,52 @@
static int exynos5_close(hw_device_t* device);
+static void get_screen_res(const char *fbname, int32_t *xres, int32_t *yres,
+ int32_t *refresh)
+{
+ char *path;
+ int fd;
+ char buf[128];
+ int ret;
+ unsigned int _x, _y, _r;
+
+ asprintf(&path, "/sys/class/graphics/%s/modes", fbname);
+ if (!path)
+ goto err_asprintf;
+ fd = open(path, O_RDONLY);
+ if (fd < 0)
+ goto err_open;
+ ret = read(fd, buf, sizeof(buf));
+ if (ret <= 0)
+ goto err_read;
+ buf[sizeof(buf)-1] = '\0';
+
+ ret = sscanf(buf, "U:%ux%up-%u", &_x, &_y, &_r);
+ if (ret != 3)
+ goto err_sscanf;
+
+ ALOGI("Using %ux%u %uHz resolution for '%s' from modes list\n",
+ _x, _y, _r, fbname);
+
+ *xres = (int32_t)_x;
+ *yres = (int32_t)_y;
+ *refresh = (int32_t)_r;
+
+ close(fd);
+ free(path);
+ return;
+
+err_sscanf:
+err_read:
+ close(fd);
+err_open:
+ free(path);
+err_asprintf:
+ *xres = 2560;
+ *yres = 1600;
+ *refresh = 60;
+}
+
static int exynos5_open(const struct hw_module_t *module, const char *name,
struct hw_device_t **device)
{
@@ -2023,22 +2104,14 @@
goto err_ioctl;
}
- refreshRate = 1000000000000LLU /
- (
- uint64_t( info.upper_margin + info.lower_margin + info.yres )
- * ( info.left_margin + info.right_margin + info.xres )
- * info.pixclock
- );
-
+ get_screen_res("fb0", &dev->xres, &dev->yres, &refreshRate);
if (refreshRate == 0) {
ALOGW("invalid refresh rate, assuming 60 Hz");
refreshRate = 60;
}
- dev->xres = 2560;
- dev->yres = 1600;
- dev->xdpi = 1000 * (info.xres * 25.4f) / info.width;
- dev->ydpi = 1000 * (info.yres * 25.4f) / info.height;
+ dev->xdpi = 1000 * (dev->xres * 25.4f) / info.width;
+ dev->ydpi = 1000 * (dev->yres * 25.4f) / info.height;
dev->vsync_period = 1000000000 / refreshRate;
ALOGV("using\n"
@@ -2055,11 +2128,8 @@
dev->gsc[i].dst_buf_fence[j] = -1;
dev->hdmi_mixer0 = open("/dev/v4l-subdev7", O_RDWR);
- if (dev->hdmi_mixer0 < 0) {
+ if (dev->hdmi_mixer0 < 0)
ALOGE("failed to open hdmi mixer0 subdev");
- ret = dev->hdmi_mixer0;
- goto err_ioctl;
- }
dev->hdmi_layers[0].id = 0;
dev->hdmi_layers[0].fd = open("/dev/video16", O_RDWR);
@@ -2129,7 +2199,8 @@
err_vsync:
close(dev->vsync_fd);
err_mixer0:
- close(dev->hdmi_mixer0);
+ if (dev->hdmi_mixer0 >= 0)
+ close(dev->hdmi_mixer0);
err_hdmi1:
close(dev->hdmi_layers[0].fd);
err_hdmi0:
@@ -2153,7 +2224,8 @@
exynos5_cleanup_gsc_m2m(dev, i);
gralloc_close(dev->alloc_device);
close(dev->vsync_fd);
- close(dev->hdmi_mixer0);
+ if (dev->hdmi_mixer0 >= 0)
+ close(dev->hdmi_mixer0);
close(dev->hdmi_layers[0].fd);
close(dev->hdmi_layers[1].fd);
close(dev->fd);