exynos hal: jellybean compat

tirimbino
Daniel Hillenbrand 13 years ago
parent 29deaa07a9
commit 0fdadcaf08
  1. 36
      exynos/multimedia/codecs/audio/exynos4/srp/alp/src/srp_api.c
  2. 8
      exynos/multimedia/codecs/audio/exynos4/srp/libsa_jni/SACtrl.c
  3. 58
      exynos/multimedia/codecs/audio/exynos4/srp/ulp/src/srp_api.c
  4. 52
      exynos/multimedia/codecs/audio/exynos4/srp/ulp/src/srp_api_ctrl.c
  5. 36
      exynos/multimedia/codecs/audio/exynos5/srp/alp/src/srp_api.c
  6. 6
      exynos/multimedia/codecs/video/exynos4/mfc/Android.mk
  7. 118
      exynos/multimedia/codecs/video/exynos4/mfc/dec/src/SsbSipMfcDecAPI.c
  8. 118
      exynos/multimedia/codecs/video/exynos4/mfc/enc/src/SsbSipMfcEncAPI.c
  9. 168
      exynos/multimedia/codecs/video/exynos4/mfc_v4l2/dec/src/SsbSipMfcDecAPI.c
  10. 126
      exynos/multimedia/codecs/video/exynos4/mfc_v4l2/enc/src/SsbSipMfcEncAPI.c
  11. 200
      exynos/multimedia/codecs/video/exynos5/mfc_v4l2/dec/src/SsbSipMfcDecAPI.c
  12. 140
      exynos/multimedia/codecs/video/exynos5/mfc_v4l2/enc/src/SsbSipMfcEncAPI.c
  13. 4
      exynos/multimedia/libstagefrighthw/Android.mk
  14. 4
      exynos/multimedia/libstagefrighthw/SEC_OMX_Plugin.cpp
  15. 2
      exynos/multimedia/libstagefrighthw/SEC_OMX_Plugin.h
  16. 1
      exynos/multimedia/openmax/osal/Android.mk
  17. 6
      exynos/multimedia/openmax/osal/SEC_OSAL_Android.cpp
  18. 2
      exynos/multimedia/utils/csc/exynos4/csc_fimc.cpp
  19. 24
      exynos/multimedia/utils/csc/exynos5/csc_fimc.cpp
  20. 6
      exynos4/hal/include/sec_utils.h
  21. 6
      exynos4/hal/include/sec_utils_v4l2.h
  22. 728
      exynos4/hal/libcamera/SecCamera.cpp
  23. 506
      exynos4/hal/libcamera/SecCameraHWInterface.cpp
  24. 280
      exynos4/hal/libfimc/SecFimc.cpp
  25. 4
      exynos4/hal/libfimg3x/FimgApi.h
  26. 4
      exynos4/hal/libfimg3x/FimgC210.cpp
  27. 82
      exynos4/hal/libfimg4x/FimgApi.cpp
  28. 8
      exynos4/hal/libfimg4x/FimgApi.h
  29. 4
      exynos4/hal/libfimg4x/FimgExynos4.cpp
  30. 4
      exynos4/hal/libgralloc_ump/Android.mk
  31. 28
      exynos4/hal/libgralloc_ump/alloc_device.cpp
  32. 24
      exynos4/hal/libgralloc_ump/framebuffer_device.cpp
  33. 42
      exynos4/hal/libgralloc_ump/gralloc_module.cpp
  34. 2
      exynos4/hal/libhdmi/SecHdmi/Android.mk
  35. 338
      exynos4/hal/libhdmi/SecHdmi/SecHdmi.cpp
  36. 4
      exynos4/hal/libhdmi/SecHdmi/SecHdmiCommon.h
  37. 358
      exynos4/hal/libhdmi/SecHdmi/SecHdmiV4L2Utils.cpp
  38. 4
      exynos4/hal/libhdmi/SecHdmi/SecHdmiV4L2Utils.h
  39. 20
      exynos4/hal/libhdmi/SecHdmi/fimd_api.c
  40. 8
      exynos4/hal/libhdmi/libhdmiservice/MessageQueue.cpp
  41. 20
      exynos4/hal/libhdmi/libhdmiservice/SecHdmiClient.cpp
  42. 58
      exynos4/hal/libhdmi/libhdmiservice/SecTVOutService.cpp
  43. 10
      exynos4/hal/libhdmi/libhdmiservice/SecTVOutService.h
  44. 34
      exynos4/hal/libhdmi/libsForhdmi/libcec/libcec.c
  45. 20
      exynos4/hal/libhdmi/libsForhdmi/libddc/libddc.c
  46. 8
      exynos4/hal/libhdmi/libsForhdmi/libedid/libedid.c
  47. 8
      exynos4/hal/libhwcomposer/SecHWC.cpp
  48. 2
      exynos4/hal/libhwcomposer/SecHWCUtils.h
  49. 1
      exynos4/hal/libhwconverter/Android.mk
  50. 14
      exynos4/hal/libhwconverter/HardwareConverter.cpp
  51. 68
      exynos4/hal/libhwjpeg/jpeg_hal_unit.c
  52. 36
      exynos4/hal/libs5pjpeg/jpeg_api.c
  53. 2
      exynos4/hal/libswconverter/Android.mk
  54. 6
      exynos5/hal/include/sec_utils.h
  55. 6
      exynos5/hal/include/sec_utils_v4l2.h
  56. 698
      exynos5/hal/libcamera/SecCamera.cpp
  57. 6
      exynos5/hal/libcamera/SecCamera.h
  58. 462
      exynos5/hal/libcamera/SecCameraHWInterface.cpp
  59. 50
      exynos5/hal/libcamera/mediactl.cpp
  60. 82
      exynos5/hal/libfimg4x/FimgApi.cpp
  61. 4
      exynos5/hal/libfimg4x/FimgApi.h
  62. 4
      exynos5/hal/libfimg4x/FimgExynos5.cpp
  63. 4
      exynos5/hal/libgralloc_ump/Android.mk
  64. 32
      exynos5/hal/libgralloc_ump/alloc_device.cpp
  65. 32
      exynos5/hal/libgralloc_ump/framebuffer_device.cpp
  66. 34
      exynos5/hal/libgralloc_ump/gralloc_module.cpp
  67. 278
      exynos5/hal/libhdmi/SecHdmi/SecGscaler.cpp
  68. 402
      exynos5/hal/libhdmi/SecHdmi/SecHdmi.cpp
  69. 252
      exynos5/hal/libhdmi/SecHdmi/SecHdmiV4L2Utils.cpp
  70. 4
      exynos5/hal/libhdmi/SecHdmi/SecHdmiV4L2Utils.h
  71. 20
      exynos5/hal/libhdmi/SecHdmi/fimd_api.c
  72. 8
      exynos5/hal/libhdmi/libhdmiservice/MessageQueue.cpp
  73. 18
      exynos5/hal/libhdmi/libhdmiservice/SecHdmiClient.cpp
  74. 52
      exynos5/hal/libhdmi/libhdmiservice/SecTVOutService.cpp
  75. 10
      exynos5/hal/libhdmi/libhdmiservice/SecTVOutService.h
  76. 34
      exynos5/hal/libhdmi/libsForhdmi/libcec/libcec.c
  77. 20
      exynos5/hal/libhdmi/libsForhdmi/libddc/libddc.c
  78. 8
      exynos5/hal/libhdmi/libsForhdmi/libedid/libedid.c
  79. 66
      exynos5/hal/libhwcomposer/SecHWC.cpp
  80. 2
      exynos5/hal/libhwcomposer/SecHWCUtils.cpp
  81. 34
      exynos5/hal/libhwjpeg/SecJpegDecoderHal.cpp
  82. 62
      exynos5/hal/libhwjpeg/SecJpegEncoder.cpp

@ -12,8 +12,8 @@
#include "srp_api.h"
#define LOG_NDEBUG 1
#define LOG_TAG "libsrpapi"
#define ALOG_NDEBUG 1
#define ALOG_TAG "libsrpapi"
#include <utils/Log.h>
static struct srp_buf_info ibuf_info;
@ -35,7 +35,7 @@ int SRP_Create(int block_mode)
return SRP_ERROR_OPEN_FAIL;
}
LOGE("%s: Device is already opened", __func__);
ALOGE("%s: Device is already opened", __func__);
return SRP_ERROR_ALREADY_OPEN;
}
@ -52,20 +52,20 @@ int SRP_Init()
/* mmap for OBUF */
ret = ioctl(srp_dev, SRP_GET_MMAP_SIZE, &mmapped_size);
if (ret < 0) {
LOGE("%s: SRP_GET_MMAP_SIZE is failed", __func__);
ALOGE("%s: SRP_GET_MMAP_SIZE is failed", __func__);
return SRP_ERROR_OBUF_MMAP;
}
obuf_info.mmapped_addr = mmap(0, mmapped_size,
PROT_READ | PROT_WRITE, MAP_SHARED, srp_dev, 0);
if (!obuf_info.mmapped_addr) {
LOGE("%s: mmap is failed", __func__);
ALOGE("%s: mmap is failed", __func__);
return SRP_ERROR_OBUF_MMAP;
}
obuf_info.mmapped_size = mmapped_size;
ret = SRP_RETURN_OK;
} else {
LOGE("%s: Device is not ready", __func__);
ALOGE("%s: Device is not ready", __func__);
ret = SRP_ERROR_NOT_READY; /* device is not created */
}
@ -78,12 +78,12 @@ int SRP_Decode(void *buff, int size_byte)
if (srp_dev != -1) {
if (size_byte > 0) {
LOGV("%s: Send data to RP (%d bytes)", __func__, size_byte);
ALOGV("%s: Send data to RP (%d bytes)", __func__, size_byte);
ret = write(srp_dev, buff, size_byte); /* Write Buffer to RP Driver */
if (ret < 0) {
if (ret != SRP_ERROR_IBUF_OVERFLOW)
LOGE("SRP_Decode returned error code: %d", ret);
ALOGE("SRP_Decode returned error code: %d", ret);
}
return ret; /* Write Success */
} else {
@ -91,7 +91,7 @@ int SRP_Decode(void *buff, int size_byte)
}
}
LOGE("%s: Device is not ready", __func__);
ALOGE("%s: Device is not ready", __func__);
return SRP_ERROR_NOT_READY;
}
@ -135,7 +135,7 @@ int SRP_Get_PCM(void **addr, unsigned int *size)
ret = read(srp_dev, &pcm_info, 0);
if (ret == -1) {
*size = 0;
LOGE("%s: PCM read fail", __func__);
ALOGE("%s: PCM read fail", __func__);
return SRP_ERROR_OBUF_READ;
}
@ -155,11 +155,11 @@ int SRP_Get_Dec_Info(struct srp_dec_info *dec_info)
if (srp_dev != -1) {
ret = ioctl(srp_dev, SRP_GET_DEC_INFO, dec_info);
if (ret < 0) {
LOGE("%s: Failed to get dec info", __func__);
ALOGE("%s: Failed to get dec info", __func__);
return SRP_ERROR_GETINFO_FAIL;
}
LOGV("numChannels(%d), samplingRate(%d)", dec_info->channels, dec_info->sample_rate);
ALOGV("numChannels(%d), samplingRate(%d)", dec_info->channels, dec_info->sample_rate);
ret = SRP_RETURN_OK;
} else {
@ -176,7 +176,7 @@ int SRP_Get_Ibuf_Info(void **addr, unsigned int *size, unsigned int *num)
if (srp_dev != -1) {
ret = ioctl(srp_dev, SRP_GET_IBUF_INFO, &ibuf_info);
if (ret == -1) {
LOGE("%s: Failed to get Ibuf info", __func__);
ALOGE("%s: Failed to get Ibuf info", __func__);
return SRP_ERROR_IBUF_INFO;
}
@ -185,7 +185,7 @@ int SRP_Get_Ibuf_Info(void **addr, unsigned int *size, unsigned int *num)
*num = ibuf_info.num;
if (*num == 0) {
LOGE("%s: IBUF num is 0", __func__);
ALOGE("%s: IBUF num is 0", __func__);
return SRP_ERROR_INVALID_SETTING;
}
@ -205,7 +205,7 @@ int SRP_Get_Obuf_Info(void **addr, unsigned int *size, unsigned int *num)
if (obuf_info.addr == NULL) {
ret = ioctl(srp_dev, SRP_GET_OBUF_INFO, &obuf_info);
if (ret < 0) {
LOGE("%s: SRP_GET_OBUF_INFO is failed", __func__);
ALOGE("%s: SRP_GET_OBUF_INFO is failed", __func__);
return SRP_ERROR_OBUF_INFO;
}
}
@ -215,7 +215,7 @@ int SRP_Get_Obuf_Info(void **addr, unsigned int *size, unsigned int *num)
*num = obuf_info.num;
if (*num == 0) {
LOGE("%s: OBUF num is 0", __func__);
ALOGE("%s: OBUF num is 0", __func__);
return SRP_ERROR_INVALID_SETTING;
}
@ -256,10 +256,10 @@ int SRP_Terminate(void)
int SRP_IsOpen(void)
{
if (srp_dev == -1) {
LOGV("%s: Device is not opened", __func__);
ALOGV("%s: Device is not opened", __func__);
return 0;
}
LOGV("%s: Device is opened", __func__);
ALOGV("%s: Device is opened", __func__);
return 1;
}

@ -7,7 +7,7 @@
#include "srp_api_ctrl.h"
#define LOG_TAG "libsa_jni"
#define ALOG_TAG "libsa_jni"
#include <cutils/log.h>
void Java_com_android_music_SetSACtrlJNI_set(JNIEnv * env, jobject obj, int effect_num)
@ -15,17 +15,17 @@ void Java_com_android_music_SetSACtrlJNI_set(JNIEnv * env, jobject obj, int effe
unsigned long effect_enable = effect_num ? 1 : 0;
unsigned int ret;
LOGD("Sound effect[%d]", effect_num);
ALOGD("Sound effect[%d]", effect_num);
ret = SRP_Ctrl_Enable_Effect(effect_enable);
if (ret < 0) {
LOGE("%s: Couldn't enabled effect\n", __func__);
ALOGE("%s: Couldn't enabled effect\n", __func__);
return;
}
SRP_Ctrl_Set_Effect_Def(effect_num << 5);
if (ret < 0) {
LOGE("%s: Couldn't defined effect\n", __func__);
ALOGE("%s: Couldn't defined effect\n", __func__);
return;
}

@ -12,14 +12,14 @@
#include "srp_api.h"
#define LOG_TAG "libsrpapi"
#define ALOG_TAG "libsrpapi"
#include <cutils/log.h>
/* Disable LOGD message */
#ifdef LOGD
#undef LOGD
/* Disable ALOGD message */
#ifdef ALOGD
#undef ALOGD
#endif
#define LOGD(...)
#define ALOGD(...)
//#define _USE_WBUF_ /* Buffering before writing srp-rp device */
//#define _DUMP_TO_FILE_
@ -48,11 +48,11 @@ static int WriteBuff_Init(void)
wbuf_size = srp_ibuf_size * WBUF_LEN_MUL;
wbuf_pos = 0;
wbuf = (unsigned char *)malloc(wbuf_size);
LOGD("%s: WriteBuffer %dbytes allocated", __func__, wbuf_size);
ALOGD("%s: WriteBuffer %dbytes allocated", __func__, wbuf_size);
return 0;
}
LOGE("%s: WriteBuffer already allocated", __func__);
ALOGE("%s: WriteBuffer already allocated", __func__);
return -1;
}
@ -64,7 +64,7 @@ static int WriteBuff_Deinit(void)
return 0;
}
LOGE("%s: WriteBuffer is not ready", __func__);
ALOGE("%s: WriteBuffer is not ready", __func__);
return -1;
}
@ -76,7 +76,7 @@ static int WriteBuff_Write(unsigned char *buff, int size_byte)
memcpy(&wbuf[wbuf_pos], buff, size_byte);
wbuf_pos += size_byte;
} else {
LOGE("%s: WriteBuffer is filled [%d], ignoring write [%d]", __func__, wbuf_pos, size_byte);
ALOGE("%s: WriteBuffer is filled [%d], ignoring write [%d]", __func__, wbuf_pos, size_byte);
return -1; /* Insufficient buffer */
}
@ -109,7 +109,7 @@ int SRP_Create(int block_mode)
return srp_dev;
}
LOGE("%s: Device is not ready", __func__);
ALOGE("%s: Device is not ready", __func__);
return -1; /* device alreay opened */
}
@ -134,11 +134,11 @@ int SRP_Init(unsigned int ibuf_size)
}
}
LOGD("%s: Dump MP3 to %s", __func__, outname);
ALOGD("%s: Dump MP3 to %s", __func__, outname);
if (fp_dump = fopen(outname, "wb"))
LOGD("%s: Success to open %s", __func__, outname);
ALOGD("%s: Success to open %s", __func__, outname);
else
LOGD("%s: Fail to open %s", __func__, outname);
ALOGD("%s: Fail to open %s", __func__, outname);
#endif
#ifdef _USE_WBUF_
@ -149,7 +149,7 @@ int SRP_Init(unsigned int ibuf_size)
#endif
}
LOGE("%s: Device is not ready", __func__);
ALOGE("%s: Device is not ready", __func__);
return -1; /* device is not created */
}
@ -163,17 +163,17 @@ int SRP_Decode(void *buff, int size_byte)
if (srp_dev != -1) {
/* Check wbuf before writing buff */
while (wbuf_pos >= srp_ibuf_size) { /* Write_Buffer filled? (IBUF Size)*/
LOGD("%s: Write Buffer is full, Send data to RP", __func__);
ALOGD("%s: Write Buffer is full, Send data to RP", __func__);
ret = write(srp_dev, wbuf, srp_ibuf_size); /* Write Buffer to RP Driver */
if (ret == -1) { /* Fail? */
ioctl(srp_dev, SRP_ERROR_STATE, &val);
if (!val) { /* Write error? */
LOGE("%s: IBUF write fail", __func__);
ALOGE("%s: IBUF write fail", __func__);
return -1;
} else { /* Write OK, but RP decode error? */
err_code = val;
LOGE("%s: RP decode error [0x%05X]", __func__, err_code);
ALOGE("%s: RP decode error [0x%05X]", __func__, err_code);
}
}
#ifdef _DUMP_TO_FILE_
@ -187,11 +187,11 @@ int SRP_Decode(void *buff, int size_byte)
if (ret == -1)
return -1; /* Buffering error */
LOGD("%s: Write Buffer remain [%d]", __func__, wbuf_pos);
ALOGD("%s: Write Buffer remain [%d]", __func__, wbuf_pos);
return err_code; /* Write Success */
}
LOGE("%s: Device is not ready", __func__);
ALOGE("%s: Device is not ready", __func__);
return -1; /* device is not created */
}
@ -212,10 +212,10 @@ int SRP_Send_EOS(void)
if (ret == -1) { /* Fail? */
ret = ioctl(srp_dev, SRP_ERROR_STATE, &val);
if (!val) { /* Write error? */
LOGE("%s: IBUF write fail", __func__);
ALOGE("%s: IBUF write fail", __func__);
return -1;
} else { /* RP decoe error? */
LOGE("%s: RP decode error [0x%05X]", __func__, val);
ALOGE("%s: RP decode error [0x%05X]", __func__, val);
return -1;
}
} else { /* Success? */
@ -244,17 +244,17 @@ int SRP_Decode(void *buff, int size_byte)
int err_code = 0;
if (srp_dev != -1) {
LOGD("%s: Send data to RP (%d bytes)", __func__, size_byte);
ALOGD("%s: Send data to RP (%d bytes)", __func__, size_byte);
ret = write(srp_dev, buff, size_byte); /* Write Buffer to RP Driver */
if (ret == -1) { /* Fail? */
ioctl(srp_dev, SRP_ERROR_STATE, &val);
if (!val) { /* Write error? */
LOGE("%s: IBUF write fail", __func__);
ALOGE("%s: IBUF write fail", __func__);
return -1;
} else { /* Write OK, but RP decode error? */
err_code = val;
LOGE("%s: RP decode error [0x%05X]", __func__, err_code);
ALOGE("%s: RP decode error [0x%05X]", __func__, err_code);
}
}
#ifdef _DUMP_TO_FILE_
@ -265,7 +265,7 @@ int SRP_Decode(void *buff, int size_byte)
return err_code; /* Write Success */
}
LOGE("%s: Device is not ready", __func__);
ALOGE("%s: Device is not ready", __func__);
return -1; /* device is not created */
}
@ -348,7 +348,7 @@ int SRP_Deinit(void)
return ioctl(srp_dev, SRP_DEINIT); /* Deinialize */
}
LOGE("%s: Device is not ready", __func__);
ALOGE("%s: Device is not ready", __func__);
return -1; /* device is not created */
}
@ -365,17 +365,17 @@ int SRP_Terminate(void)
}
}
LOGE("%s: Device is not ready", __func__);
ALOGE("%s: Device is not ready", __func__);
return -1; /* device is not created or close error*/
}
int SRP_IsOpen(void)
{
if (srp_dev == -1) {
LOGD("%s: Device is not opened", __func__);
ALOGD("%s: Device is not opened", __func__);
return 0;
}
LOGD("%s: Device is opened", __func__);
ALOGD("%s: Device is opened", __func__);
return 1;
}

@ -13,14 +13,14 @@
#include "srp_api_ctrl.h"
#include "srp_ioctl.h"
#define LOG_TAG "libsrpapi"
#define ALOG_TAG "libsrpapi"
#include <cutils/log.h>
/* Disable LOGD message */
#ifdef LOGD
#undef LOGD
/* Disable ALOGD message */
#ifdef ALOGD
#undef ALOGD
#endif
#define LOGD(...)
#define ALOGD(...)
static int srp_ctrl = -1;
static int srp_ctrl_cnt = 0;
@ -42,11 +42,11 @@ static int SRP_Ctrl_Open(void)
if (srp_ctrl_cnt == 0) {
srp_ctrl = open(SRP_CTRL_DEV_NAME, O_RDWR | O_NDELAY);
if (srp_ctrl < 0) {
LOGE("%s: Failed open device file %d", __func__, srp_ctrl);
ALOGE("%s: Failed open device file %d", __func__, srp_ctrl);
return -1;
}
srp_ctrl_cnt++;
LOGV("%s: Device is opened[%d]: cnt %d", __func__, srp_ctrl, srp_ctrl_cnt);
ALOGV("%s: Device is opened[%d]: cnt %d", __func__, srp_ctrl, srp_ctrl_cnt);
}
return srp_ctrl;
@ -59,11 +59,11 @@ static int SRP_Ctrl_Close(void)
if (srp_ctrl_cnt == 1) {
ret = close(srp_ctrl);
if (ret < 0) {
LOGE("%s: Failed closen device file %d", __func__, srp_ctrl);
ALOGE("%s: Failed closen device file %d", __func__, srp_ctrl);
return -1;
}
srp_ctrl_cnt--;
LOGV("%s: Device is closed[%d]: cnt %d", __func__, srp_ctrl, srp_ctrl_cnt);
ALOGV("%s: Device is closed[%d]: cnt %d", __func__, srp_ctrl, srp_ctrl_cnt);
srp_ctrl = -1;
}
@ -86,13 +86,13 @@ static int SRP_Check_AltFirmware(void)
ioctl(srp_ctrl, SRP_CTRL_ALTFW_STATE, &alt_fw_loaded);
if (!alt_fw_loaded) { /* Not loaded yet? */
LOGE("Try to download alternate RP firmware");
ALOGE("Try to download alternate RP firmware");
temp_buff = (unsigned long *)malloc(256*1024); /* temp buffer */
for (alt_fw_set = 0; alt_fw_set < 6; alt_fw_set++) {
sprintf(alt_fw_name, "%s_text.bin", srp_alt_fw_name_pre[alt_fw_set]);
if (fp = fopen(alt_fw_name, "rb")) {
LOGE("RP Alt-Firmware Loading: %s", alt_fw_name);
ALOGE("RP Alt-Firmware Loading: %s", alt_fw_name);
fread(temp_buff, 64*1024, 1, fp);
close(fp);
alt_fw_text_ok = 1;
@ -102,7 +102,7 @@ static int SRP_Check_AltFirmware(void)
sprintf(alt_fw_name, "%s_data.bin", srp_alt_fw_name_pre[alt_fw_set]);
if (fp = fopen(alt_fw_name, "rb")) {
LOGE("RP Alt-Firmware Loading: %s", alt_fw_name);
ALOGE("RP Alt-Firmware Loading: %s", alt_fw_name);
fread(&temp_buff[64*1024/4], 96*1024, 1, fp);
close(fp);
alt_fw_data_ok = 1;
@ -131,7 +131,7 @@ int SRP_Ctrl_Set_Effect(int effect)
ret = SRP_Ctrl_Open();
if (ret < 0) {
LOGE("%s: SRP_Ctrl_Open error", __func__);
ALOGE("%s: SRP_Ctrl_Open error", __func__);
return -1;
}
@ -149,7 +149,7 @@ int SRP_Ctrl_Enable_Effect(int on)
ret = SRP_Ctrl_Open();
if (ret < 0) {
LOGE("%s: SRP_Ctrl_Open error", __func__);
ALOGE("%s: SRP_Ctrl_Open error", __func__);
return -1;
}
@ -166,7 +166,7 @@ int SRP_Ctrl_Set_Effect_Def(unsigned long effect_def)
ret = SRP_Ctrl_Open();
if (ret < 0) {
LOGE("%s: SRP_Ctrl_Open error", __func__);
ALOGE("%s: SRP_Ctrl_Open error", __func__);
return -1;
}
@ -183,7 +183,7 @@ int SRP_Ctrl_Set_Effect_EQ_User(unsigned long eq_user)
ret = SRP_Ctrl_Open();
if (ret < 0) {
LOGE("%s: SRP_Ctrl_Open error", __func__);
ALOGE("%s: SRP_Ctrl_Open error", __func__);
return -1;
}
@ -200,13 +200,13 @@ int SRP_Ctrl_Set_Pcm_Dump(int on)
ret = SRP_Ctrl_Open();
if (ret < 0) {
LOGE("%s: SRP_Ctrl_Open error", __func__);
ALOGE("%s: SRP_Ctrl_Open error", __func__);
return -1;
}
ioctl(srp_ctrl, SRP_CTRL_PCM_DUMP_OP, on);
LOGV("dump_op: %d", on);
ALOGV("dump_op: %d", on);
SRP_Ctrl_Close();
@ -220,13 +220,13 @@ int SRP_Ctrl_Get_Pcm_Dump_State(void)
ret = SRP_Ctrl_Open();
if (ret < 0) {
LOGE("%s: SRP_Ctrl_Open error", __func__);
ALOGE("%s: SRP_Ctrl_Open error", __func__);
return -1;
}
ioctl(srp_ctrl, SRP_CTRL_IS_PCM_DUMP, &srp_dump_stat);
LOGV("srp_dump_stat: %d", srp_dump_stat);
ALOGV("srp_dump_stat: %d", srp_dump_stat);
SRP_Ctrl_Close();
@ -240,7 +240,7 @@ int SRP_Ctrl_Set_Gain(float value)
ret = SRP_Ctrl_Open();
if (ret < 0) {
LOGE("%s: SRP_Ctrl_Open error", __func__);
ALOGE("%s: SRP_Ctrl_Open error", __func__);
return -1;
}
@ -259,13 +259,13 @@ int SRP_Ctrl_Get_Running_Stat(void)
ret = SRP_Ctrl_Open();
if (ret < 0) {
LOGE("%s: SRP_Ctrl_Open error", __func__);
ALOGE("%s: SRP_Ctrl_Open error", __func__);
return -1;
}
ioctl(srp_ctrl, SRP_CTRL_IS_RUNNING, &srp_running_stat);
LOGV("srp_running_stat: %d", srp_running_stat);
ALOGV("srp_running_stat: %d", srp_running_stat);
SRP_Ctrl_Close();
@ -279,13 +279,13 @@ int SRP_Ctrl_Get_Open_Stat(void)
ret = SRP_Ctrl_Open();
if (ret < 0) {
LOGE("%s: SRP_Ctrl_Open error", __func__);
ALOGE("%s: SRP_Ctrl_Open error", __func__);
return -1;
}
ioctl(srp_ctrl, SRP_CTRL_IS_OPENED, &srp_open_stat);
LOGV("srp_open_stat: %d", srp_open_stat);
ALOGV("srp_open_stat: %d", srp_open_stat);
SRP_Ctrl_Close();
@ -301,7 +301,7 @@ short *SRP_Ctrl_Get_Pcm(void)
ret = SRP_Ctrl_Open();
if (ret < 0) {
LOGE("%s: SRP_Ctrl_Open error", __func__);
ALOGE("%s: SRP_Ctrl_Open error", __func__);
return NULL;
}

@ -12,8 +12,8 @@
#include "srp_api.h"
#define LOG_NDEBUG 1
#define LOG_TAG "libsrpapi"
#define ALOG_NDEBUG 1
#define ALOG_TAG "libsrpapi"
#include <utils/Log.h>
static struct srp_buf_info ibuf_info;
@ -35,7 +35,7 @@ int SRP_Create(int block_mode)
return SRP_ERROR_OPEN_FAIL;
}
LOGE("%s: Device is already opened", __func__);
ALOGE("%s: Device is already opened", __func__);
return SRP_ERROR_ALREADY_OPEN;
}
@ -52,20 +52,20 @@ int SRP_Init()
/* mmap for OBUF */
ret = ioctl(srp_dev, SRP_GET_MMAP_SIZE, &mmapped_size);
if (ret < 0) {
LOGE("%s: SRP_GET_MMAP_SIZE is failed", __func__);
ALOGE("%s: SRP_GET_MMAP_SIZE is failed", __func__);
return SRP_ERROR_OBUF_MMAP;
}
obuf_info.mmapped_addr = mmap(0, mmapped_size,
PROT_READ | PROT_WRITE, MAP_SHARED, srp_dev, 0);
if (!obuf_info.mmapped_addr) {
LOGE("%s: mmap is failed", __func__);
ALOGE("%s: mmap is failed", __func__);
return SRP_ERROR_OBUF_MMAP;
}
obuf_info.mmapped_size = mmapped_size;
ret = SRP_RETURN_OK;
} else {
LOGE("%s: Device is not ready", __func__);
ALOGE("%s: Device is not ready", __func__);
ret = SRP_ERROR_NOT_READY; /* device is not created */
}
@ -78,12 +78,12 @@ int SRP_Decode(void *buff, int size_byte)
if (srp_dev != -1) {
if (size_byte > 0) {
LOGV("%s: Send data to RP (%d bytes)", __func__, size_byte);
ALOGV("%s: Send data to RP (%d bytes)", __func__, size_byte);
ret = write(srp_dev, buff, size_byte); /* Write Buffer to RP Driver */
if (ret < 0) {
if (ret != SRP_ERROR_IBUF_OVERFLOW)
LOGE("SRP_Decode returned error code: %d", ret);
ALOGE("SRP_Decode returned error code: %d", ret);
}
return ret; /* Write Success */
} else {
@ -91,7 +91,7 @@ int SRP_Decode(void *buff, int size_byte)
}
}
LOGE("%s: Device is not ready", __func__);
ALOGE("%s: Device is not ready", __func__);
return SRP_ERROR_NOT_READY;
}
@ -135,7 +135,7 @@ int SRP_Get_PCM(void **addr, unsigned int *size)
ret = read(srp_dev, &pcm_info, 0);
if (ret == -1) {
*size = 0;
LOGE("%s: PCM read fail", __func__);
ALOGE("%s: PCM read fail", __func__);
return SRP_ERROR_OBUF_READ;
}
@ -155,11 +155,11 @@ int SRP_Get_Dec_Info(struct srp_dec_info *dec_info)
if (srp_dev != -1) {
ret = ioctl(srp_dev, SRP_GET_DEC_INFO, dec_info);
if (ret < 0) {
LOGE("%s: Failed to get dec info", __func__);
ALOGE("%s: Failed to get dec info", __func__);
return SRP_ERROR_GETINFO_FAIL;
}
LOGV("numChannels(%d), samplingRate(%d)", dec_info->channels, dec_info->sample_rate);
ALOGV("numChannels(%d), samplingRate(%d)", dec_info->channels, dec_info->sample_rate);
ret = SRP_RETURN_OK;
} else {
@ -176,7 +176,7 @@ int SRP_Get_Ibuf_Info(void **addr, unsigned int *size, unsigned int *num)
if (srp_dev != -1) {
ret = ioctl(srp_dev, SRP_GET_IBUF_INFO, &ibuf_info);
if (ret == -1) {
LOGE("%s: Failed to get Ibuf info", __func__);
ALOGE("%s: Failed to get Ibuf info", __func__);
return SRP_ERROR_IBUF_INFO;
}
@ -185,7 +185,7 @@ int SRP_Get_Ibuf_Info(void **addr, unsigned int *size, unsigned int *num)
*num = ibuf_info.num;
if (*num == 0) {
LOGE("%s: IBUF num is 0", __func__);
ALOGE("%s: IBUF num is 0", __func__);
return SRP_ERROR_INVALID_SETTING;
}
@ -205,7 +205,7 @@ int SRP_Get_Obuf_Info(void **addr, unsigned int *size, unsigned int *num)
if (obuf_info.addr == NULL) {
ret = ioctl(srp_dev, SRP_GET_OBUF_INFO, &obuf_info);
if (ret < 0) {
LOGE("%s: SRP_GET_OBUF_INFO is failed", __func__);
ALOGE("%s: SRP_GET_OBUF_INFO is failed", __func__);
return SRP_ERROR_OBUF_INFO;
}
}
@ -215,7 +215,7 @@ int SRP_Get_Obuf_Info(void **addr, unsigned int *size, unsigned int *num)
*num = obuf_info.num;
if (*num == 0) {
LOGE("%s: OBUF num is 0", __func__);
ALOGE("%s: OBUF num is 0", __func__);
return SRP_ERROR_INVALID_SETTING;
}
@ -256,10 +256,10 @@ int SRP_Terminate(void)
int SRP_IsOpen(void)
{
if (srp_dev == -1) {
LOGV("%s: Device is not opened", __func__);
ALOGV("%s: Device is not opened", __func__);
return 0;
}
LOGV("%s: Device is opened", __func__);
ALOGV("%s: Device is opened", __func__);
return 1;
}

@ -23,7 +23,7 @@ LOCAL_PRELINK_MODULE := false
ifeq ($(BOARD_USES_MFC_FPS),true)
LOCAL_CFLAGS := -DCONFIG_MFC_FPS
#LOCAL_CFLAGS += -DCONFIG_MFC_PERF_LOG
#LOCAL_CFLAGS += -DCONFIG_MFC_PERF_ALOG
endif
ifeq ($(BOARD_USE_S3D_SUPPORT), true)
@ -61,7 +61,7 @@ LOCAL_PRELINK_MODULE := false
ifeq ($(BOARD_USES_MFC_FPS),true)
LOCAL_CFLAGS := -DCONFIG_MFC_FPS
#LOCAL_CFLAGS += -DCONFIG_MFC_PERF_LOG
#LOCAL_CFLAGS += -DCONFIG_MFC_PERF_ALOG
endif
ifeq ($(BOARD_USE_S3D_SUPPORT), true)
@ -99,7 +99,7 @@ LOCAL_PRELINK_MODULE := false
ifeq ($(BOARD_USES_MFC_FPS),true)
LOCAL_CFLAGS := -DCONFIG_MFC_FPS
#LOCAL_CFLAGS += -DCONFIG_MFC_PERF_LOG
#LOCAL_CFLAGS += -DCONFIG_MFC_PERF_ALOG
endif
ifeq ($(BOARD_USE_S3D_SUPPORT), true)

@ -34,9 +34,9 @@
#include "SsbSipMfcApi.h"
#include <utils/Log.h>
/*#define LOG_NDEBUG 0*/
#undef LOG_TAG
#define LOG_TAG "MFC_DEC_APP"
/*#define ALOG_NDEBUG 0*/
#undef ALOG_TAG
#define ALOG_TAG "MFC_DEC_APP"
#ifdef CONFIG_MFC_FPS
#include <sys/time.h>
@ -76,21 +76,21 @@ static int isPBPacked(_MFCLIB *pCtx, int Frameleng)
while (1) {
while (startCode != USR_DATA_START_CODE) {
if ((startCode == VOP_START_CODE) || (leng_idx == Frameleng)) {
LOGI("isPBPacked] VOP START Found !!.....return");
LOGW("isPBPacked] Non Packed PB");
ALOGI("isPBPacked] VOP START Found !!.....return");
ALOGW("isPBPacked] Non Packed PB");
return 0;
}
getAByte(strmBuffer, &startCode);
LOGV(">> StartCode = 0x%08x <<\n", startCode);
ALOGV(">> StartCode = 0x%08x <<\n", startCode);
strmBuffer++;
leng_idx++;
}
LOGI("isPBPacked] User Data Found !!");
ALOGI("isPBPacked] User Data Found !!");
do {
if (*strmBuffer == 'p') {
/*LOGI(">> peter strmBuffer = 0x%08x <<\n", *strmBuffer);*/
LOGW("isPBPacked] Packed PB\n");
/*ALOGI(">> peter strmBuffer = 0x%08x <<\n", *strmBuffer);*/
ALOGW("isPBPacked] Packed PB\n");
return 1;
}
getAByte(strmBuffer, &startCode);
@ -101,7 +101,7 @@ static int isPBPacked(_MFCLIB *pCtx, int Frameleng)
break;
}
LOGW("isPBPacked] Non Packed PB");
ALOGW("isPBPacked] Non Packed PB");
return 0;
}
@ -119,7 +119,7 @@ void *SsbSipMfcDecOpen(void)
int mapped_size;
struct mfc_common_args CommonArg;
LOGI("[%s] MFC Library Ver %d.%02d\n",__func__, MFC_LIB_VER_MAJOR, MFC_LIB_VER_MINOR);
ALOGI("[%s] MFC Library Ver %d.%02d\n",__func__, MFC_LIB_VER_MAJOR, MFC_LIB_VER_MINOR);
#ifdef CONFIG_MFC_FPS
framecount = 0;
over30ms = 0;
@ -128,27 +128,27 @@ void *SsbSipMfcDecOpen(void)
#endif
pCTX = (_MFCLIB *)malloc(sizeof(_MFCLIB));
if (pCTX == NULL) {
LOGE("SsbSipMfcDecOpen] malloc failed.\n");
ALOGE("SsbSipMfcDecOpen] malloc failed.\n");
return NULL;
}
memset(pCTX, 0, sizeof(_MFCLIB));
if (access(mfc_dev_name, F_OK) != 0) {
LOGE("SsbSipMfcDecOpen] MFC device node not exists");
ALOGE("SsbSipMfcDecOpen] MFC device node not exists");
free(pCTX);
return NULL;
}
hMFCOpen = open(mfc_dev_name, O_RDWR | O_NDELAY);
if (hMFCOpen < 0) {
LOGE("SsbSipMfcDecOpen] MFC Open failure");
ALOGE("SsbSipMfcDecOpen] MFC Open failure");
free(pCTX);
return NULL;
}
mapped_size = ioctl(hMFCOpen, IOCTL_MFC_GET_MMAP_SIZE, &CommonArg);
if ((mapped_size < 0) || (CommonArg.ret_code != MFC_OK)) {
LOGE("SsbSipMfcDecOpen] IOCTL_MFC_GET_MMAP_SIZE failed");
ALOGE("SsbSipMfcDecOpen] IOCTL_MFC_GET_MMAP_SIZE failed");
free(pCTX);
close(hMFCOpen);
return NULL;
@ -156,7 +156,7 @@ void *SsbSipMfcDecOpen(void)
mapped_addr = (unsigned int)mmap(0, mapped_size, PROT_READ | PROT_WRITE, MAP_SHARED, hMFCOpen, 0);
if (!mapped_addr) {
LOGE("SsbSipMfcDecOpen] FIMV5.x driver address mapping failed");
ALOGE("SsbSipMfcDecOpen] FIMV5.x driver address mapping failed");
free(pCTX);
close(hMFCOpen);
return NULL;
@ -180,24 +180,24 @@ void *SsbSipMfcDecOpenExt(void *value)
int err;
struct mfc_common_args CommonArg;
LOGI("[%s] MFC Library Ver %d.%02d\n",__func__, MFC_LIB_VER_MAJOR, MFC_LIB_VER_MINOR);
ALOGI("[%s] MFC Library Ver %d.%02d\n",__func__, MFC_LIB_VER_MAJOR, MFC_LIB_VER_MINOR);
pCTX = (_MFCLIB *)malloc(sizeof(_MFCLIB));
if (pCTX == NULL) {
LOGE("SsbSipMfcDecOpenExt] malloc failed.\n");
ALOGE("SsbSipMfcDecOpenExt] malloc failed.\n");
return NULL;
}
memset(pCTX, 0, sizeof(_MFCLIB));
if (access(mfc_dev_name, F_OK) != 0) {
LOGE("SsbSipMfcDecOpen] MFC device node not exists");
ALOGE("SsbSipMfcDecOpen] MFC device node not exists");
free(pCTX);
return NULL;
}
hMFCOpen = open(mfc_dev_name, O_RDWR | O_NDELAY);
if (hMFCOpen < 0) {
LOGE("SsbSipMfcDecOpenExt] MFC Open failure");
ALOGE("SsbSipMfcDecOpenExt] MFC Open failure");
free(pCTX);
return NULL;
}
@ -206,7 +206,7 @@ void *SsbSipMfcDecOpenExt(void *value)
err = ioctl(hMFCOpen, IOCTL_MFC_SET_BUF_CACHE, &CommonArg);
if ((err < 0) || (CommonArg.ret_code != MFC_OK)) {
LOGE("SsbSipMfcDecOpenExt] IOCTL_MFC_SET_BUF_CACHE failed");
ALOGE("SsbSipMfcDecOpenExt] IOCTL_MFC_SET_BUF_CACHE failed");
free(pCTX);
close(hMFCOpen);
return NULL;
@ -214,7 +214,7 @@ void *SsbSipMfcDecOpenExt(void *value)
mapped_size = ioctl(hMFCOpen, IOCTL_MFC_GET_MMAP_SIZE, &CommonArg);
if ((mapped_size < 0) || (CommonArg.ret_code != MFC_OK)) {
LOGE("SsbSipMfcDecOpenExt] IOCTL_MFC_GET_MMAP_SIZE failed");
ALOGE("SsbSipMfcDecOpenExt] IOCTL_MFC_GET_MMAP_SIZE failed");
free(pCTX);
close(hMFCOpen);
return NULL;
@ -222,7 +222,7 @@ void *SsbSipMfcDecOpenExt(void *value)
mapped_addr = (unsigned int)mmap(0, mapped_size, PROT_READ | PROT_WRITE, MAP_SHARED, hMFCOpen, 0);
if (!mapped_addr) {
LOGE("SsbSipMfcDecOpenExt] FIMV5.x driver address mapping failed");
ALOGE("SsbSipMfcDecOpenExt] FIMV5.x driver address mapping failed");
free(pCTX);
close(hMFCOpen);
return NULL;
@ -245,7 +245,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecInit (void *openHandle, SSBSIP_MFC_CODEC_TYPE
_MFCLIB *pCTX;
if (openHandle == NULL) {
LOGE("SsbSipMfcDecInit] openHandle is NULL");
ALOGE("SsbSipMfcDecInit] openHandle is NULL");
return MFC_RET_INVALID_PARAM;
}
@ -264,7 +264,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecInit (void *openHandle, SSBSIP_MFC_CODEC_TYPE
(codec_type != XVID_DEC) &&
(codec_type != VC1RCV_DEC) &&
(codec_type != VC1_DEC)) {
LOGE("SsbSipMfcDecInit] Undefined codec type");
ALOGE("SsbSipMfcDecInit] Undefined codec type");
return MFC_RET_INVALID_PARAM;
}
pCTX->codecType = codec_type;
@ -300,7 +300,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecInit (void *openHandle, SSBSIP_MFC_CODEC_TYPE
r = ioctl(pCTX->hMFC, IOCTL_MFC_DEC_INIT, &DecArg);
if (DecArg.ret_code != MFC_OK) {
LOGE("SsbSipMfcDecInit] IOCTL_MFC_DEC_INIT failed");
ALOGE("SsbSipMfcDecInit] IOCTL_MFC_DEC_INIT failed");
return MFC_RET_DEC_INIT_FAIL;
}
@ -341,12 +341,12 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecExe(void *openHandle, int lengthBufFill)
long int diffTime, avgTime;
#endif
if (openHandle == NULL) {
LOGE("SsbSipMfcDecExe] openHandle is NULL\n");
ALOGE("SsbSipMfcDecExe] openHandle is NULL\n");
return MFC_RET_INVALID_PARAM;
}
if ((lengthBufFill < 0) || (lengthBufFill > MAX_DECODER_INPUT_BUFFER_SIZE)) {
LOGE("SsbSipMfcDecExe] lengthBufFill is invalid. (lengthBufFill=%d)", lengthBufFill);
ALOGE("SsbSipMfcDecExe] lengthBufFill is invalid. (lengthBufFill=%d)", lengthBufFill);
return MFC_RET_INVALID_PARAM;
}
@ -366,12 +366,12 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecExe(void *openHandle, int lengthBufFill)
#ifdef CONFIG_MFC_FPS
gettimeofday(&mDec1, NULL);
#ifdef CONFIG_MFC_PERF_LOG
#ifdef CONFIG_MFC_PERF_ALOG
if (framecount != 0) {
if (mDec2.tv_sec == mDec1.tv_sec)
LOGI("SsbSipMfcDecExe] Interval between IOCTL_MFC_DEC_EXE's (end to start) = %8d", (mDec1.tv_usec - mDec2.tv_usec));
ALOGI("SsbSipMfcDecExe] Interval between IOCTL_MFC_DEC_EXE's (end to start) = %8d", (mDec1.tv_usec - mDec2.tv_usec));
else
LOGI("SsbSipMfcDecExe] Interval between IOCTL_MFC_DEC_EXE's (end to start) = %8d", (1000000 + (mDec1.tv_usec - mDec2.tv_usec)));
ALOGI("SsbSipMfcDecExe] Interval between IOCTL_MFC_DEC_EXE's (end to start) = %8d", (1000000 + (mDec1.tv_usec - mDec2.tv_usec)));
}
#endif
#endif
@ -379,7 +379,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecExe(void *openHandle, int lengthBufFill)
ret = ioctl(pCTX->hMFC, IOCTL_MFC_DEC_EXE, &DecArg);
if (DecArg.ret_code != MFC_OK) {
LOGE("SsbSipMfcDecExe] IOCTL_MFC_DEC_EXE failed(ret : %d)", DecArg.ret_code);
ALOGE("SsbSipMfcDecExe] IOCTL_MFC_DEC_EXE failed(ret : %d)", DecArg.ret_code);
return MFC_RET_DEC_EXE_ERR;
}
@ -390,14 +390,14 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecExe(void *openHandle, int lengthBufFill)
if (mDec1.tv_sec == mDec2.tv_sec) {
if (mDec2.tv_usec - mDec1.tv_usec > 30000)
over30ms++;
#ifdef CONFIG_MFC_PERF_LOG
LOGI("SsbSipMfcDecExe] Time consumed for IOCTL_MFC_DEC_EXE = %8d", ((mDec2.tv_usec - mDec1.tv_usec)));
#ifdef CONFIG_MFC_PERF_ALOG
ALOGI("SsbSipMfcDecExe] Time consumed for IOCTL_MFC_DEC_EXE = %8d", ((mDec2.tv_usec - mDec1.tv_usec)));
#endif
} else {
if (1000000 + mDec2.tv_usec - mDec1.tv_usec > 30000)
over30ms++;
#ifdef CONFIG_MFC_PERF_LOG
LOGI("SsbSipMfcDecExe] Time consumed for IOCTL_MFC_DEC_EXE = %8d", (1000000 + (mDec2.tv_usec - mDec1.tv_usec)));
#ifdef CONFIG_MFC_PERF_ALOG
ALOGI("SsbSipMfcDecExe] Time consumed for IOCTL_MFC_DEC_EXE = %8d", (1000000 + (mDec2.tv_usec - mDec1.tv_usec)));
#endif
}
@ -411,7 +411,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecExe(void *openHandle, int lengthBufFill)
/* FIXME: dynamic resolution change */
if (DecArg.args.dec_exe.out_display_status == 4) {
LOGI("SsbSipMfcDecExe] Resolution is chagned");
ALOGI("SsbSipMfcDecExe] Resolution is chagned");
/*
pCTX->virFrmBuf.chroma = DecArg.args.dec_exe.out_u_addr.chroma;
pCTX->virFrmBuf.luma = DecArg.args.dec_exe.out_u_addr.luma;
@ -466,14 +466,14 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecClose(void *openHandle)
struct mfc_common_args free_arg;
#ifdef CONFIG_MFC_FPS
LOGI(">>> Statistics in MFC API:");
LOGI(">>> Total number of IOCTL_MFC_DEC_EXE = %d", framecount);
LOGI(">>> Number of IOCTL_MFC_DEC_EXE taking more than 30ms = %d", over30ms);
LOGI(">>> Avg IOCTL_MFC_DEC_EXE time = %dsec %.2fmsec", (int)mAvg.tv_sec, (float)(mAvg.tv_usec / 1000.0));
ALOGI(">>> Statistics in MFC API:");
ALOGI(">>> Total number of IOCTL_MFC_DEC_EXE = %d", framecount);
ALOGI(">>> Number of IOCTL_MFC_DEC_EXE taking more than 30ms = %d", over30ms);
ALOGI(">>> Avg IOCTL_MFC_DEC_EXE time = %dsec %.2fmsec", (int)mAvg.tv_sec, (float)(mAvg.tv_usec / 1000.0));
#endif
if (openHandle == NULL) {
LOGE("SsbSipMfcDecClose] openHandle is NULL");
ALOGE("SsbSipMfcDecClose] openHandle is NULL");
return MFC_RET_INVALID_PARAM;
}
@ -511,12 +511,12 @@ void *SsbSipMfcDecGetInBuf(void *openHandle, void **phyInBuf, int inputBufferSi
struct mfc_common_args user_addr_arg, phys_addr_arg;
if (inputBufferSize < 0) {
LOGE("SsbSipMfcDecGetInBuf] inputBufferSize = %d is invalid", inputBufferSize);
ALOGE("SsbSipMfcDecGetInBuf] inputBufferSize = %d is invalid", inputBufferSize);
return NULL;
}
if (openHandle == NULL) {
LOGE("SsbSipMfcDecGetInBuf] openHandle is NULL\n");
ALOGE("SsbSipMfcDecGetInBuf] openHandle is NULL\n");
return NULL;
}
@ -528,14 +528,14 @@ void *SsbSipMfcDecGetInBuf(void *openHandle, void **phyInBuf, int inputBufferSi
user_addr_arg.args.mem_alloc.mapped_addr = pCTX->mapped_addr;
ret_code = ioctl(pCTX->hMFC, IOCTL_MFC_GET_IN_BUF, &user_addr_arg);
if (ret_code < 0) {
LOGE("SsbSipMfcDecGetInBuf] IOCTL_MFC_GET_IN_BUF failed");
ALOGE("SsbSipMfcDecGetInBuf] IOCTL_MFC_GET_IN_BUF failed");
return NULL;
}
phys_addr_arg.args.real_addr.key = user_addr_arg.args.mem_alloc.offset;
ret_code = ioctl(pCTX->hMFC, IOCTL_MFC_GET_REAL_ADDR, &phys_addr_arg);
if (ret_code < 0) {
LOGE("SsbSipMfcDecGetInBuf] IOCTL_MFC_GET_PHYS_ADDR failed");
ALOGE("SsbSipMfcDecGetInBuf] IOCTL_MFC_GET_PHYS_ADDR failed");
return NULL;
}
@ -558,7 +558,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecSetInBuf(void *openHandle, void *phyInBuf, voi
_MFCLIB *pCTX;
if (openHandle == NULL) {
LOGE("SsbSipMfcDecSetInBuf] openHandle is NULL");
ALOGE("SsbSipMfcDecSetInBuf] openHandle is NULL");
return MFC_RET_INVALID_PARAM;
}
@ -575,7 +575,7 @@ SSBSIP_MFC_DEC_OUTBUF_STATUS SsbSipMfcDecGetOutBuf(void *openHandle, SSBSIP_MFC_
_MFCLIB *pCTX;
if (openHandle == NULL) {
LOGE("SsbSipMfcDecGetOutBuf] openHandle is NULL");
ALOGE("SsbSipMfcDecGetOutBuf] openHandle is NULL");
return MFC_GETOUTBUF_DISPLAY_END;
}
@ -626,12 +626,12 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecSetConfig(void *openHandle, SSBSIP_MFC_DEC_CON
struct mfc_dec_fimv1_info *fimv1_res;
if (openHandle == NULL) {
LOGE("SsbSipMfcDecSetConfig] openHandle is NULL");
ALOGE("SsbSipMfcDecSetConfig] openHandle is NULL");
return MFC_RET_INVALID_PARAM;
}
if (value == NULL) {
LOGE("SsbSipMfcDecSetConfig] value is NULL");
ALOGE("SsbSipMfcDecSetConfig] value is NULL");
return MFC_RET_INVALID_PARAM;
}
@ -669,8 +669,8 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecSetConfig(void *openHandle, SSBSIP_MFC_DEC_CON
case MFC_DEC_SETCONF_FIMV1_WIDTH_HEIGHT:
fimv1_res = (struct mfc_dec_fimv1_info *)value;
LOGI("fimv1->width = %d\n", fimv1_res->width);
LOGI("fimv1->height = %d\n", fimv1_res->height);
ALOGI("fimv1->width = %d\n", fimv1_res->width);
ALOGI("fimv1->height = %d\n", fimv1_res->height);
#ifdef S3D_SUPPORT
DecArg.args.config.args.basic.values[0] = (int)(fimv1_res->width);
DecArg.args.config.args.basic.values[1] = (int)(fimv1_res->height);
@ -696,7 +696,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecSetConfig(void *openHandle, SSBSIP_MFC_DEC_CON
ret_code = ioctl(pCTX->hMFC, IOCTL_MFC_SET_CONFIG, &DecArg);
if (DecArg.ret_code != MFC_OK) {
LOGE("SsbSipMfcDecSetConfig] IOCTL_MFC_SET_CONFIG failed(ret : %d, conf_type: 0x%08x)", DecArg.ret_code, conf_type);
ALOGE("SsbSipMfcDecSetConfig] IOCTL_MFC_SET_CONFIG failed(ret : %d, conf_type: 0x%08x)", DecArg.ret_code, conf_type);
return MFC_RET_DEC_SET_CONF_FAIL;
}
@ -722,12 +722,12 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecGetConfig(void *openHandle, SSBSIP_MFC_DEC_CON
#endif
if (openHandle == NULL) {
LOGE("SsbSipMfcDecGetConfig] openHandle is NULL");
ALOGE("SsbSipMfcDecGetConfig] openHandle is NULL");
return MFC_RET_INVALID_PARAM;
}
if (value == NULL) {
LOGE("SsbSipMfcDecGetConfig] value is NULL");
ALOGE("SsbSipMfcDecGetConfig] value is NULL");
return MFC_RET_INVALID_PARAM;
}
@ -740,7 +740,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecGetConfig(void *openHandle, SSBSIP_MFC_DEC_CON
phys_addr_arg.args.get_phys_addr.u_addr = buf_addr->u_addr;
r = ioctl(pCTX->hMFC, IOCTL_MFC_GET_PHYS_ADDR, &phys_addr_arg);
if (r < 0) {
LOGE("SsbSipMfcDecGetConfig] IOCTL_MFC_GET_PHYS_ADDR failed");
ALOGE("SsbSipMfcDecGetConfig] IOCTL_MFC_GET_PHYS_ADDR failed");
return MFC_API_FAIL;
}
buf_addr->p_addr = phys_addr_arg.args.get_phys_addr.p_addr;
@ -771,7 +771,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecGetConfig(void *openHandle, SSBSIP_MFC_DEC_CON
ret_code = ioctl(pCTX->hMFC, IOCTL_MFC_GET_CONFIG, &DecArg);
if (DecArg.ret_code != MFC_OK) {
LOGE("SsbSipMfcDecGetConfig] IOCTL_MFC_GET_CONFIG failed(ret : %d, conf_type: 0x%08x)", DecArg.ret_code, conf_type);
ALOGE("SsbSipMfcDecGetConfig] IOCTL_MFC_GET_CONFIG failed(ret : %d, conf_type: 0x%08x)", DecArg.ret_code, conf_type);
return MFC_RET_DEC_GET_CONF_FAIL;
}
@ -793,7 +793,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecGetConfig(void *openHandle, SSBSIP_MFC_DEC_CON
ret_code = ioctl(pCTX->hMFC, IOCTL_MFC_GET_CONFIG, &DecArg);
if (DecArg.ret_code != MFC_OK) {
LOGE("SsbSipMfcDecGetConfig] IOCTL_MFC_GET_CONFIG failed(ret : %d, conf_type: 0x%08x)", DecArg.ret_code, conf_type);
ALOGE("SsbSipMfcDecGetConfig] IOCTL_MFC_GET_CONFIG failed(ret : %d, conf_type: 0x%08x)", DecArg.ret_code, conf_type);
return MFC_RET_DEC_GET_CONF_FAIL;
}
crc_data->luma0 = DecArg.args.get_config.out_config_value[0];
@ -801,7 +801,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecGetConfig(void *openHandle, SSBSIP_MFC_DEC_CON
#endif
break;
default:
LOGE("SsbSipMfcDecGetConfig] No such conf_type is supported");
ALOGE("SsbSipMfcDecGetConfig] No such conf_type is supported");
return MFC_RET_DEC_GET_CONF_FAIL;
}

@ -30,9 +30,9 @@
#include "SsbSipMfcApi.h"
#include <utils/Log.h>
/* #define LOG_NDEBUG 0 */
#undef LOG_TAG
#define LOG_TAG "MFC_ENC_APP"
/* #define ALOG_NDEBUG 0 */
#undef ALOG_TAG
#define ALOG_TAG "MFC_ENC_APP"
#define _MFCLIB_MAGIC_NUMBER 0x92241001
@ -51,31 +51,31 @@ void *SsbSipMfcEncOpen(void)
int mapped_size;
struct mfc_common_args CommonArg;
LOGI("[%s] MFC Library Ver %d.%02d",__func__, MFC_LIB_VER_MAJOR, MFC_LIB_VER_MINOR);
ALOGI("[%s] MFC Library Ver %d.%02d",__func__, MFC_LIB_VER_MAJOR, MFC_LIB_VER_MINOR);
#if 0
if ((codecType != MPEG4_ENC) &&
(codecType != H264_ENC) &&
(codecType != H263_ENC)) {
LOGE("SsbSipMfcEncOpen] Undefined codec type");
ALOGE("SsbSipMfcEncOpen] Undefined codec type");
return NULL;
}
#endif
if (access(mfc_dev_name, F_OK) != 0) {
LOGE("SsbSipMfcEncOpen] MFC device node not exists");
ALOGE("SsbSipMfcEncOpen] MFC device node not exists");
return NULL;
}
hMFCOpen = open(mfc_dev_name, O_RDWR | O_NDELAY);
if (hMFCOpen < 0) {
LOGE("SsbSipMfcEncOpen] MFC Open failure");
ALOGE("SsbSipMfcEncOpen] MFC Open failure");
return NULL;
}
pCTX = (_MFCLIB *)malloc(sizeof(_MFCLIB));
if (pCTX == NULL) {
LOGE("SsbSipMfcEncOpen] malloc failed.");
ALOGE("SsbSipMfcEncOpen] malloc failed.");
close(hMFCOpen);
return NULL;
}
@ -83,7 +83,7 @@ void *SsbSipMfcEncOpen(void)
mapped_size = ioctl(hMFCOpen, IOCTL_MFC_GET_MMAP_SIZE, &CommonArg);
if ((mapped_size < 0) || (CommonArg.ret_code != MFC_OK)) {
LOGE("SsbSipMfcEncOpen] IOCTL_MFC_GET_MMAP_SIZE failed");
ALOGE("SsbSipMfcEncOpen] IOCTL_MFC_GET_MMAP_SIZE failed");
free(pCTX);
close(hMFCOpen);
return NULL;
@ -91,7 +91,7 @@ void *SsbSipMfcEncOpen(void)
mapped_addr = (unsigned int)mmap(0, mapped_size, PROT_READ | PROT_WRITE, MAP_SHARED, hMFCOpen, 0);
if (!mapped_addr) {
LOGE("SsbSipMfcEncOpen] FIMV5.x driver address mapping failed");
ALOGE("SsbSipMfcEncOpen] FIMV5.x driver address mapping failed");
free(pCTX);
close(hMFCOpen);
return NULL;
@ -116,31 +116,31 @@ void *SsbSipMfcEncOpenExt(void *value)
int err;
struct mfc_common_args CommonArg;
LOGI("[%s] MFC Library Ver %d.%02d",__func__, MFC_LIB_VER_MAJOR, MFC_LIB_VER_MINOR);
ALOGI("[%s] MFC Library Ver %d.%02d",__func__, MFC_LIB_VER_MAJOR, MFC_LIB_VER_MINOR);
#if 0
if ((codecType != MPEG4_ENC) &&
(codecType != H264_ENC) &&
(codecType != H263_ENC)) {
LOGE("SsbSipMfcEncOpen] Undefined codec type");
ALOGE("SsbSipMfcEncOpen] Undefined codec type");
return NULL;
}
#endif
if (access(mfc_dev_name, F_OK) != 0) {
LOGE("SsbSipMfcEncOpenExt] MFC device node not exists");
ALOGE("SsbSipMfcEncOpenExt] MFC device node not exists");
return NULL;
}
hMFCOpen = open(mfc_dev_name, O_RDWR | O_NDELAY);
if (hMFCOpen < 0) {
LOGE("SsbSipMfcEncOpenExt] MFC Open failure");
ALOGE("SsbSipMfcEncOpenExt] MFC Open failure");
return NULL;
}
pCTX = (_MFCLIB *)malloc(sizeof(_MFCLIB));
if (pCTX == NULL) {
LOGE("SsbSipMfcEncOpenExt] malloc failed.");
ALOGE("SsbSipMfcEncOpenExt] malloc failed.");
close(hMFCOpen);
return NULL;
}
@ -150,7 +150,7 @@ void *SsbSipMfcEncOpenExt(void *value)
err = ioctl(hMFCOpen, IOCTL_MFC_SET_BUF_CACHE, &CommonArg);
if ((err < 0) || (CommonArg.ret_code != MFC_OK)) {
LOGE("SsbSipMfcEncOpenExt] IOCTL_MFC_SET_BUF_CACHE failed");
ALOGE("SsbSipMfcEncOpenExt] IOCTL_MFC_SET_BUF_CACHE failed");
free(pCTX);
close(hMFCOpen);
return NULL;
@ -158,7 +158,7 @@ void *SsbSipMfcEncOpenExt(void *value)
mapped_size = ioctl(hMFCOpen, IOCTL_MFC_GET_MMAP_SIZE, &CommonArg);
if ((mapped_size < 0) || (CommonArg.ret_code != MFC_OK)) {
LOGE("SsbSipMfcEncOpenExt] IOCTL_MFC_GET_MMAP_SIZE failed");
ALOGE("SsbSipMfcEncOpenExt] IOCTL_MFC_GET_MMAP_SIZE failed");
free(pCTX);
close(hMFCOpen);
return NULL;
@ -166,7 +166,7 @@ void *SsbSipMfcEncOpenExt(void *value)
mapped_addr = (unsigned int)mmap(0, mapped_size, PROT_READ | PROT_WRITE, MAP_SHARED, hMFCOpen, 0);
if (!mapped_addr) {
LOGE("SsbSipMfcEncOpenExt] FIMV5.x driver address mapping failed");
ALOGE("SsbSipMfcEncOpenExt] FIMV5.x driver address mapping failed");
free(pCTX);
close(hMFCOpen);
return NULL;
@ -208,17 +208,17 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncInit(void *openHandle, void *param)
if (h264_arg->codecType == H264_ENC) {
pCTX->codecType = H264_ENC;
} else {
LOGE("SsbSipMfcEncInit] Undefined codec type");
ALOGE("SsbSipMfcEncInit] Undefined codec type");
return MFC_RET_INVALID_PARAM;
}
}
}
LOGI("SsbSipMfcEncInit] Encode Init start");
ALOGI("SsbSipMfcEncInit] Encode Init start");
switch (pCTX->codecType) {
case MPEG4_ENC:
LOGI("SsbSipMfcEncInit] MPEG4 Encode");
ALOGI("SsbSipMfcEncInit] MPEG4 Encode");
mpeg4_arg = (SSBSIP_MFC_ENC_MPEG4_PARAM *)param;
pCTX->width = mpeg4_arg->SourceWidth;
@ -226,7 +226,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncInit(void *openHandle, void *param)
break;
case H263_ENC:
LOGI("SsbSipMfcEncInit] H263 Encode");
ALOGI("SsbSipMfcEncInit] H263 Encode");
h263_arg = (SSBSIP_MFC_ENC_H263_PARAM *)param;
pCTX->width = h263_arg->SourceWidth;
@ -234,7 +234,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncInit(void *openHandle, void *param)
break;
case H264_ENC:
LOGI("SsbSipMfcEncInit] H264 Encode");
ALOGI("SsbSipMfcEncInit] H264 Encode");
h264_arg = (SSBSIP_MFC_ENC_H264_PARAM *)param;
pCTX->width = h264_arg->SourceWidth;
@ -263,7 +263,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncInit(void *openHandle, void *param)
/* rate control*/
EncArg.args.enc_init.cmn.in_rc_fr_en = mpeg4_arg->EnableFRMRateControl;
if ((mpeg4_arg->QSCodeMin > 31) || (mpeg4_arg->QSCodeMax > 31)) {
LOGE("SsbSipMfcEncInit] No such Min/Max QP is supported");
ALOGE("SsbSipMfcEncInit] No such Min/Max QP is supported");
return MFC_RET_INVALID_PARAM;
}
EncArg.args.enc_init.cmn.in_rc_qbound_min = mpeg4_arg->QSCodeMin;
@ -273,7 +273,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncInit(void *openHandle, void *param)
/* pad control */
EncArg.args.enc_init.cmn.in_pad_ctrl_on = mpeg4_arg->PadControlOn;
if ((mpeg4_arg->LumaPadVal > 255) || (mpeg4_arg->CbPadVal > 255) || (mpeg4_arg->CrPadVal > 255)) {
LOGE("SsbSipMfcEncInit] No such Pad value is supported");
ALOGE("SsbSipMfcEncInit] No such Pad value is supported");
return MFC_RET_INVALID_PARAM;
}
EncArg.args.enc_init.cmn.in_y_pad_val = mpeg4_arg->LumaPadVal;
@ -285,7 +285,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncInit(void *openHandle, void *param)
EncArg.args.enc_init.cmn.in_rc_bitrate = mpeg4_arg->Bitrate;
if ((mpeg4_arg->FrameQp > 31) || (mpeg4_arg->FrameQp_P > 31)) {
LOGE("SsbSipMfcEncInit] No such FrameQp is supported");
ALOGE("SsbSipMfcEncInit] No such FrameQp is supported");
return MFC_RET_INVALID_PARAM;
}
EncArg.args.enc_init.cmn.in_vop_quant = mpeg4_arg->FrameQp;
@ -296,13 +296,13 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncInit(void *openHandle, void *param)
EncArg.args.enc_init.codec.mpeg4.in_level = mpeg4_arg->LevelIDC;
if (mpeg4_arg->FrameQp_B > 31) {
LOGE("SsbSipMfcEncInit] No such FrameQp is supported");
ALOGE("SsbSipMfcEncInit] No such FrameQp is supported");
return MFC_RET_INVALID_PARAM;
}
EncArg.args.enc_init.codec.mpeg4.in_vop_quant_b = mpeg4_arg->FrameQp_B;
if (mpeg4_arg->NumberBFrames > 2) {
LOGE("SsbSipMfcEncInit] No such BframeNum is supported");
ALOGE("SsbSipMfcEncInit] No such BframeNum is supported");
return MFC_RET_INVALID_PARAM;
}
EncArg.args.enc_init.codec.mpeg4.in_bframenum = mpeg4_arg->NumberBFrames;
@ -331,7 +331,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncInit(void *openHandle, void *param)
/* rate control*/
EncArg.args.enc_init.cmn.in_rc_fr_en = h263_arg->EnableFRMRateControl;
if ((h263_arg->QSCodeMin > 31) || (h263_arg->QSCodeMax > 31)) {
LOGE("SsbSipMfcEncInit] No such Min/Max QP is supported");
ALOGE("SsbSipMfcEncInit] No such Min/Max QP is supported");
return MFC_RET_INVALID_PARAM;
}
EncArg.args.enc_init.cmn.in_rc_qbound_min = h263_arg->QSCodeMin;
@ -341,7 +341,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncInit(void *openHandle, void *param)
/* pad control */
EncArg.args.enc_init.cmn.in_pad_ctrl_on = h263_arg->PadControlOn;
if ((h263_arg->LumaPadVal > 255) || (h263_arg->CbPadVal > 255) || (h263_arg->CrPadVal > 255)) {
LOGE("SsbSipMfcEncInit] No such Pad value is supported");
ALOGE("SsbSipMfcEncInit] No such Pad value is supported");
return MFC_RET_INVALID_PARAM;
}
EncArg.args.enc_init.cmn.in_y_pad_val = h263_arg->LumaPadVal;
@ -353,7 +353,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncInit(void *openHandle, void *param)
EncArg.args.enc_init.cmn.in_rc_bitrate = h263_arg->Bitrate;
if ((h263_arg->FrameQp > 31) || (h263_arg->FrameQp_P > 31)) {
LOGE("SsbSipMfcEncInit] No such FrameQp is supported");
ALOGE("SsbSipMfcEncInit] No such FrameQp is supported");
return MFC_RET_INVALID_PARAM;
}
EncArg.args.enc_init.cmn.in_vop_quant = h263_arg->FrameQp;
@ -377,7 +377,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncInit(void *openHandle, void *param)
(h264_arg->SliceMode == 2)||(h264_arg->SliceMode == 4)) {
EncArg.args.enc_init.cmn.in_ms_mode = h264_arg->SliceMode;
} else {
LOGE("SsbSipMfcEncInit] No such slice mode is supported");
ALOGE("SsbSipMfcEncInit] No such slice mode is supported");
return MFC_RET_INVALID_PARAM;
}
EncArg.args.enc_init.cmn.in_ms_arg = h264_arg->SliceArgument;
@ -386,7 +386,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncInit(void *openHandle, void *param)
/* pad control */
EncArg.args.enc_init.cmn.in_pad_ctrl_on = h264_arg->PadControlOn;
if ((h264_arg->LumaPadVal > 255) || (h264_arg->CbPadVal > 255) || (h264_arg->CrPadVal > 255)) {
LOGE("SsbSipMfcEncInit] No such Pad value is supported");
ALOGE("SsbSipMfcEncInit] No such Pad value is supported");
return MFC_RET_INVALID_PARAM;
}
EncArg.args.enc_init.cmn.in_y_pad_val = h264_arg->LumaPadVal;
@ -400,14 +400,14 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncInit(void *openHandle, void *param)
EncArg.args.enc_init.cmn.in_rc_fr_en = h264_arg->EnableFRMRateControl;
EncArg.args.enc_init.cmn.in_rc_bitrate = h264_arg->Bitrate;
if ((h264_arg->FrameQp > 51) || (h264_arg->FrameQp_P > 51)) {
LOGE("SsbSipMfcEncInit] No such FrameQp is supported");
ALOGE("SsbSipMfcEncInit] No such FrameQp is supported");
return MFC_RET_INVALID_PARAM;
}
EncArg.args.enc_init.cmn.in_vop_quant = h264_arg->FrameQp;
EncArg.args.enc_init.cmn.in_vop_quant_p = h264_arg->FrameQp_P;
if ((h264_arg->QSCodeMin > 51) || (h264_arg->QSCodeMax > 51)) {
LOGE("SsbSipMfcEncInit] No such Min/Max QP is supported");
ALOGE("SsbSipMfcEncInit] No such Min/Max QP is supported");
return MFC_RET_INVALID_PARAM;
}
EncArg.args.enc_init.cmn.in_rc_qbound_min = h264_arg->QSCodeMin;
@ -420,13 +420,13 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncInit(void *openHandle, void *param)
EncArg.args.enc_init.codec.h264.in_level = h264_arg->LevelIDC;
if (h264_arg->FrameQp_B > 51) {
LOGE("SsbSipMfcEncInit] No such FrameQp is supported");
ALOGE("SsbSipMfcEncInit] No such FrameQp is supported");
return MFC_RET_INVALID_PARAM;
}
EncArg.args.enc_init.codec.h264.in_vop_quant_b = h264_arg->FrameQp_B;
if (h264_arg->NumberBFrames > 2) {
LOGE("SsbSipMfcEncInit] No such BframeNum is supported");
ALOGE("SsbSipMfcEncInit] No such BframeNum is supported");
return MFC_RET_INVALID_PARAM;
}
EncArg.args.enc_init.codec.h264.in_bframenum = h264_arg->NumberBFrames;
@ -434,7 +434,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncInit(void *openHandle, void *param)
EncArg.args.enc_init.codec.h264.in_interlace_mode = h264_arg->PictureInterlace;
if ((h264_arg->NumberRefForPframes > 2)||(h264_arg->NumberReferenceFrames >2)) {
LOGE("SsbSipMfcEncInit] No such ref Num is supported");
ALOGE("SsbSipMfcEncInit] No such ref Num is supported");
return MFC_RET_INVALID_PARAM;
}
EncArg.args.enc_init.codec.h264.in_reference_num = h264_arg->NumberReferenceFrames;
@ -450,7 +450,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncInit(void *openHandle, void *param)
EncArg.args.enc_init.codec.h264.in_deblock_dis = h264_arg->LoopFilterDisable;
if ((abs(h264_arg->LoopFilterAlphaC0Offset) > 6) || (abs(h264_arg->LoopFilterBetaOffset) > 6)) {
LOGE("SsbSipMfcEncInit] No such AlphaC0Offset or BetaOffset is supported");
ALOGE("SsbSipMfcEncInit] No such AlphaC0Offset or BetaOffset is supported");
return MFC_RET_INVALID_PARAM;
}
EncArg.args.enc_init.codec.h264.in_deblock_alpha_c0 = h264_arg->LoopFilterAlphaC0Offset;
@ -466,7 +466,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncInit(void *openHandle, void *param)
break;
default:
LOGE("SsbSipMfcEncInit] No such codec type is supported");
ALOGE("SsbSipMfcEncInit] No such codec type is supported");
return MFC_RET_INVALID_PARAM;
}
@ -474,7 +474,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncInit(void *openHandle, void *param)
ret_code = ioctl(pCTX->hMFC, IOCTL_MFC_ENC_INIT, &EncArg);
if (EncArg.ret_code != MFC_OK) {
LOGE("SsbSipMfcEncInit] IOCTL_MFC_ENC_INIT failed");
ALOGE("SsbSipMfcEncInit] IOCTL_MFC_ENC_INIT failed");
return MFC_RET_ENC_INIT_FAIL;
}
@ -498,7 +498,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncExe(void *openHandle)
struct mfc_common_args EncArg;
if (openHandle == NULL) {
LOGE("SsbSipMfcEncExe] openHandle is NULL");
ALOGE("SsbSipMfcEncExe] openHandle is NULL");
return MFC_RET_INVALID_PARAM;
}
@ -524,7 +524,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncExe(void *openHandle)
ret_code = ioctl(pCTX->hMFC, IOCTL_MFC_ENC_EXE, &EncArg);
if (EncArg.ret_code != MFC_OK) {
LOGE("SsbSipMfcEncExe] IOCTL_MFC_ENC_EXE failed(ret : %d)", EncArg.ret_code);
ALOGE("SsbSipMfcEncExe] IOCTL_MFC_ENC_EXE failed(ret : %d)", EncArg.ret_code);
return MFC_RET_ENC_EXE_ERR;
}
@ -535,7 +535,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncExe(void *openHandle)
pCTX->outframetagtop = EncArg.args.enc_exe.out_frametag_top;
pCTX->outframetagbottom = EncArg.args.enc_exe.out_frametag_bottom;
LOGV("SsbSipMfcEncExe] Encode success ==================");
ALOGV("SsbSipMfcEncExe] Encode success ==================");
return MFC_RET_OK;
}
@ -547,7 +547,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncClose(void *openHandle)
struct mfc_common_args free_arg;
if (openHandle == NULL) {
LOGE("SsbSipMfcEncClose] openHandle is NULL");
ALOGE("SsbSipMfcEncClose] openHandle is NULL");
return MFC_RET_INVALID_PARAM;
}
@ -586,7 +586,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncGetInBuf(void *openHandle, SSBSIP_MFC_ENC_INPU
int aligned_y_size, aligned_c_size;
if (openHandle == NULL) {
LOGE("SsbSipMfcEncGetInBuf] openHandle is NULL");
ALOGE("SsbSipMfcEncGetInBuf] openHandle is NULL");
return MFC_RET_INVALID_PARAM;
}
@ -606,7 +606,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncGetInBuf(void *openHandle, SSBSIP_MFC_ENC_INPU
user_addr_arg.args.mem_alloc.mapped_addr = pCTX->mapped_addr;
ret_code = ioctl(pCTX->hMFC, IOCTL_MFC_GET_IN_BUF, &user_addr_arg);
if (ret_code < 0) {
LOGE("SsbSipMfcEncGetInBuf] IOCTL_MFC_GET_IN_BUF failed");
ALOGE("SsbSipMfcEncGetInBuf] IOCTL_MFC_GET_IN_BUF failed");
return MFC_RET_ENC_GET_INBUF_FAIL;
}
@ -616,7 +616,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncGetInBuf(void *openHandle, SSBSIP_MFC_ENC_INPU
real_addr_arg.args.real_addr.key = user_addr_arg.args.mem_alloc.offset;
ret_code = ioctl(pCTX->hMFC, IOCTL_MFC_GET_REAL_ADDR, &real_addr_arg);
if (ret_code < 0) {
LOGE("SsbSipMfcEncGetInBuf] IOCTL_MFC_GET_REAL_ADDR failed");
ALOGE("SsbSipMfcEncGetInBuf] IOCTL_MFC_GET_REAL_ADDR failed");
return MFC_RET_ENC_GET_INBUF_FAIL;
}
pCTX->phyFrmBuf.luma = real_addr_arg.args.real_addr.addr;
@ -643,11 +643,11 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncSetInBuf(void *openHandle, SSBSIP_MFC_ENC_INPU
int aligned_y_size, aligned_c_size;
if (openHandle == NULL) {
LOGE("SsbSipMfcEncSetInBuf] openHandle is NULL");
ALOGE("SsbSipMfcEncSetInBuf] openHandle is NULL");
return MFC_RET_INVALID_PARAM;
}
LOGV("SsbSipMfcEncSetInBuf] input_info->YPhyAddr & input_info->CPhyAddr should be 64KB aligned");
ALOGV("SsbSipMfcEncSetInBuf] input_info->YPhyAddr & input_info->CPhyAddr should be 64KB aligned");
pCTX = (_MFCLIB *) openHandle;
@ -673,7 +673,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncGetOutBuf(void *openHandle, SSBSIP_MFC_ENC_OUT
_MFCLIB *pCTX;
if (openHandle == NULL) {
LOGE("SsbSipMfcEncGetOutBuf] openHandle is NULL");
ALOGE("SsbSipMfcEncGetOutBuf] openHandle is NULL");
return MFC_RET_INVALID_PARAM;
}
@ -705,7 +705,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncSetOutBuf(void *openHandle, void *phyOutbuf, v
_MFCLIB *pCTX;
if (openHandle == NULL) {
LOGE("SsbSipMfcEncSetOutBuf] openHandle is NULL");
ALOGE("SsbSipMfcEncSetOutBuf] openHandle is NULL");
return MFC_RET_INVALID_PARAM;
}
@ -731,12 +731,12 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncSetConfig(void *openHandle, SSBSIP_MFC_ENC_CON
#endif
if (openHandle == NULL) {
LOGE("SsbSipMfcEncSetConfig] openHandle is NULL");
ALOGE("SsbSipMfcEncSetConfig] openHandle is NULL");
return MFC_RET_INVALID_PARAM;
}
if (value == NULL) {
LOGE("SsbSipMfcEncSetConfig] value is NULL");
ALOGE("SsbSipMfcEncSetConfig] value is NULL");
return MFC_RET_INVALID_PARAM;
}
@ -787,7 +787,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncSetConfig(void *openHandle, SSBSIP_MFC_ENC_CON
EncArg.args.config.args.basic.values[1] = 0;
break;
default:
LOGE("SsbSipMfcEncSetConfig] not supported type");
ALOGE("SsbSipMfcEncSetConfig] not supported type");
return MFC_RET_ENC_SET_CONF_FAIL;
}
#else
@ -816,7 +816,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncSetConfig(void *openHandle, SSBSIP_MFC_ENC_CON
ret_code = ioctl(pCTX->hMFC, IOCTL_MFC_SET_CONFIG, &EncArg);
if (EncArg.ret_code != MFC_OK) {
LOGE("SsbSipMfcEncSetConfig] IOCTL_MFC_SET_CONFIG failed(ret : %d)", EncArg.ret_code);
ALOGE("SsbSipMfcEncSetConfig] IOCTL_MFC_SET_CONFIG failed(ret : %d)", EncArg.ret_code);
return MFC_RET_ENC_SET_CONF_FAIL;
}
@ -834,11 +834,11 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncGetConfig(void *openHandle, SSBSIP_MFC_ENC_CON
pCTX = (_MFCLIB *)openHandle;
if (openHandle == NULL) {
LOGE("SsbSipMfcEncGetConfig] openHandle is NULL");
ALOGE("SsbSipMfcEncGetConfig] openHandle is NULL");
return MFC_RET_INVALID_PARAM;
}
if (value == NULL) {
LOGE("SsbSipMfcEncGetConfig] value is NULL");
ALOGE("SsbSipMfcEncGetConfig] value is NULL");
return MFC_RET_INVALID_PARAM;
}
@ -853,7 +853,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncGetConfig(void *openHandle, SSBSIP_MFC_ENC_CON
break;
#endif
default:
LOGE("SsbSipMfcEncGetConfig] No such conf_type is supported.");
ALOGE("SsbSipMfcEncGetConfig] No such conf_type is supported.");
return MFC_RET_INVALID_PARAM;
}

@ -36,8 +36,8 @@
#include "mfc_interface.h"
#include "SsbSipMfcApi.h"
/* #define LOG_NDEBUG 0 */
#define LOG_TAG "MFC_DEC_APP"
/* #define ALOG_NDEBUG 0 */
#define ALOG_TAG "MFC_DEC_APP"
#include <utils/Log.h>
#ifdef CONFIG_MFC_FPS
@ -83,20 +83,20 @@ static int isPBPacked(_MFCLIB *pCtx, int Frameleng)
while (1) {
while (startCode != USR_DATA_START_CODE) {
if ((startCode == VOP_START_CODE) || (leng_idx == Frameleng)) {
LOGI("[%s] VOP START Found !!.....return",__func__);
LOGW("[%s] Non Packed PB",__func__);
ALOGI("[%s] VOP START Found !!.....return",__func__);
ALOGW("[%s] Non Packed PB",__func__);
return 0;
}
getAByte(strmBuffer, &startCode);
LOGV(">> StartCode = 0x%08x <<\n", startCode);
ALOGV(">> StartCode = 0x%08x <<\n", startCode);
strmBuffer++;
leng_idx++;
}
LOGI("[%s] User Data Found !!",__func__);
ALOGI("[%s] User Data Found !!",__func__);
do {
if (*strmBuffer == 'p') {
LOGW("[%s] Packed PB",__func__);
ALOGW("[%s] Packed PB",__func__);
return 1;
}
getAByte(strmBuffer, &startCode);
@ -107,7 +107,7 @@ static int isPBPacked(_MFCLIB *pCtx, int Frameleng)
break;
}
LOGW("[%s] Non Packed PB",__func__);
ALOGW("[%s] Non Packed PB",__func__);
return 0;
}
@ -143,7 +143,7 @@ void *SsbSipMfcDecOpen(void)
struct v4l2_buffer buf;
struct v4l2_plane planes[MFC_DEC_NUM_PLANES];
LOGI("[%s] MFC Library Ver %d.%02d",__func__, MFC_LIB_VER_MAJOR, MFC_LIB_VER_MINOR);
ALOGI("[%s] MFC Library Ver %d.%02d",__func__, MFC_LIB_VER_MAJOR, MFC_LIB_VER_MINOR);
#ifdef CONFIG_MFC_FPS
framecount = 0;
over30ms = 0;
@ -151,23 +151,23 @@ void *SsbSipMfcDecOpen(void)
#endif
pCTX = (_MFCLIB *)malloc(sizeof(_MFCLIB));
if (pCTX == NULL) {
LOGE("[%s] malloc failed.",__func__);
ALOGE("[%s] malloc failed.",__func__);
return NULL;
}
memset(pCTX, 0, sizeof(_MFCLIB));
getMFCName(mfc_dev_name, 64);
LOGI("[%s] dev name is %s",__func__,mfc_dev_name);
ALOGI("[%s] dev name is %s",__func__,mfc_dev_name);
if (access(mfc_dev_name, F_OK) != 0) {
LOGE("[%s] MFC device node not exists",__func__);
ALOGE("[%s] MFC device node not exists",__func__);
goto error_case1;
}
hMFCOpen = open(mfc_dev_name, O_RDWR|O_NONBLOCK, 0);
if (hMFCOpen < 0) {
LOGE("[%s] Failed to open MFC device",__func__);
ALOGE("[%s] Failed to open MFC device",__func__);
goto error_case1;
}
@ -176,22 +176,22 @@ void *SsbSipMfcDecOpen(void)
memset(&cap, 0, sizeof(cap));
ret = ioctl(pCTX->hMFC, VIDIOC_QUERYCAP, &cap);
if (ret != 0) {
LOGE("[%s] VIDIOC_QUERYCAP failed",__func__);
ALOGE("[%s] VIDIOC_QUERYCAP failed",__func__);
goto error_case2;
}
if (!(cap.capabilities & V4L2_CAP_VIDEO_CAPTURE)) {
LOGE("[%s] Device does not support capture",__func__);
ALOGE("[%s] Device does not support capture",__func__);
goto error_case2;
}
if (!(cap.capabilities & V4L2_CAP_VIDEO_OUTPUT)) {
LOGE("[%s] Device does not support output",__func__);
ALOGE("[%s] Device does not support output",__func__);
goto error_case2;
}
if (!(cap.capabilities & V4L2_CAP_STREAMING)) {
LOGE("[%s] Device does not support streaming",__func__);
ALOGE("[%s] Device does not support streaming",__func__);
goto error_case2;
}
@ -203,7 +203,7 @@ void *SsbSipMfcDecOpen(void)
ret = ioctl(pCTX->hMFC, VIDIOC_S_FMT, &fmt);
if (ret != 0) {
LOGE("[%s] S_FMT failed",__func__);
ALOGE("[%s] S_FMT failed",__func__);
goto error_case2;
}
@ -216,7 +216,7 @@ void *SsbSipMfcDecOpen(void)
ret = ioctl(pCTX->hMFC, VIDIOC_REQBUFS, &reqbuf);
if (ret != 0) {
LOGE("[%s] VIDIOC_REQBUFS failed",__func__);
ALOGE("[%s] VIDIOC_REQBUFS failed",__func__);
goto error_case2;
}
@ -232,14 +232,14 @@ void *SsbSipMfcDecOpen(void)
ret = ioctl(pCTX->hMFC, VIDIOC_QUERYBUF, &buf);
if (ret != 0) {
LOGE("[%s] VIDIOC_QUERYBUF failed",__func__);
ALOGE("[%s] VIDIOC_QUERYBUF failed",__func__);
goto error_case3;
}
pCTX->v4l2_dec.mfc_src_bufs[i] = mmap(NULL, buf.m.planes[0].length,
PROT_READ | PROT_WRITE, MAP_SHARED, pCTX->hMFC, buf.m.planes[0].m.mem_offset);
if (pCTX->v4l2_dec.mfc_src_bufs[i] == MAP_FAILED) {
LOGE("[%s] mmap failed (%d)",__func__,i);
ALOGE("[%s] mmap failed (%d)",__func__,i);
goto error_case3;
}
}
@ -284,10 +284,10 @@ void *SsbSipMfcDecOpenExt(void *value)
if (NO_CACHE == (*(SSBIP_MFC_BUFFER_TYPE *)value)) {
pCTX->cacheablebuffer = NO_CACHE;
LOGI("[%s] non cacheable buffer",__func__);
ALOGI("[%s] non cacheable buffer",__func__);
} else {
pCTX->cacheablebuffer = CACHE;
LOGI("[%s] cacheable buffer",__func__);
ALOGI("[%s] cacheable buffer",__func__);
}
return (void *)pCTX;
@ -300,14 +300,14 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecClose(void *openHandle)
enum v4l2_buf_type type;
#ifdef CONFIG_MFC_FPS
LOGI(">>> MFC");
ALOGI(">>> MFC");
gettimeofday(&mTS2, NULL);
LOGI(">>> time=%d", mTS2.tv_sec-mTS1.tv_sec);
LOGI(">>> framecount=%d", framecount);
LOGI(">>> 30ms over=%d", over30ms);
ALOGI(">>> time=%d", mTS2.tv_sec-mTS1.tv_sec);
ALOGI(">>> framecount=%d", framecount);
ALOGI(">>> 30ms over=%d", over30ms);
#endif
if (openHandle == NULL) {
LOGE("[%s] openHandle is NULL",__func__);
ALOGE("[%s] openHandle is NULL",__func__);
return MFC_RET_INVALID_PARAM;
}
@ -317,7 +317,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecClose(void *openHandle)
type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
ret = ioctl(pCTX->hMFC, VIDIOC_STREAMOFF, &type);
if (ret != 0) {
LOGE("[%s] VIDIOC_STREAMOFF failed (destination buffers)",__func__);
ALOGE("[%s] VIDIOC_STREAMOFF failed (destination buffers)",__func__);
return MFC_RET_CLOSE_FAIL;
}
pCTX->inter_buff_status &= ~(MFC_USE_DST_STREAMON);
@ -327,7 +327,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecClose(void *openHandle)
type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
ret = ioctl(pCTX->hMFC, VIDIOC_STREAMOFF, &type);
if (ret != 0) {
LOGE("[%s] VIDIOC_STREAMOFF failed (source buffers)",__func__);
ALOGE("[%s] VIDIOC_STREAMOFF failed (source buffers)",__func__);
return MFC_RET_CLOSE_FAIL;
}
pCTX->inter_buff_status &= ~(MFC_USE_SRC_STREAMON);
@ -371,7 +371,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecInit(void *openHandle, SSBSIP_MFC_CODEC_TYPE c
enum v4l2_buf_type type;
if (openHandle == NULL) {
LOGE("[%s] openHandle is NULL",__func__);
ALOGE("[%s] openHandle is NULL",__func__);
return MFC_RET_INVALID_PARAM;
}
@ -423,7 +423,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecInit(void *openHandle, SSBSIP_MFC_CODEC_TYPE c
fmt.fmt.pix_mp.pixelformat = V4L2_PIX_FMT_VC1_RCV;
break;
default:
LOGE("[%s] Does NOT support the standard (%d)",__func__,pCTX->codecType);
ALOGE("[%s] Does NOT support the standard (%d)",__func__,pCTX->codecType);
ret = MFC_RET_INVALID_PARAM;
goto error_case1;
}
@ -433,7 +433,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecInit(void *openHandle, SSBSIP_MFC_CODEC_TYPE c
ret = ioctl(pCTX->hMFC, VIDIOC_S_FMT, &fmt);
if (ret != 0) {
LOGE("[%s] S_FMT failed",__func__);
ALOGE("[%s] S_FMT failed",__func__);
ret = MFC_RET_DEC_INIT_FAIL;
goto error_case1;
}
@ -449,7 +449,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecInit(void *openHandle, SSBSIP_MFC_CODEC_TYPE c
ret = ioctl(pCTX->hMFC, VIDIOC_QBUF, &qbuf);
if (ret != 0) {
LOGE("[%s] VIDIOC_QBUF failed, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE",__func__);
ALOGE("[%s] VIDIOC_QBUF failed, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE",__func__);
ret = MFC_RET_DEC_INIT_FAIL;
goto error_case1;
}
@ -460,7 +460,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecInit(void *openHandle, SSBSIP_MFC_CODEC_TYPE c
// on OUTPUT queue
ret = ioctl(pCTX->hMFC, VIDIOC_STREAMON, &type);
if (ret != 0) {
LOGE("[%s] VIDIOC_STREAMON failed",__func__);
ALOGE("[%s] VIDIOC_STREAMON failed",__func__);
ret = MFC_RET_DEC_INIT_FAIL;
goto error_case1;
}
@ -471,7 +471,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecInit(void *openHandle, SSBSIP_MFC_CODEC_TYPE c
ret = ioctl(pCTX->hMFC, VIDIOC_G_FMT, &fmt);
if (ret != 0) {
LOGE("[%s] VIDIOC_G_FMT failed",__func__);
ALOGE("[%s] VIDIOC_G_FMT failed",__func__);
ret = MFC_RET_DEC_INIT_FAIL;
goto error_case1;
}
@ -489,7 +489,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecInit(void *openHandle, SSBSIP_MFC_CODEC_TYPE c
ret = ioctl(pCTX->hMFC, VIDIOC_G_CROP, &crop);
if (ret != 0) {
LOGE("[%s] VIDIOC_G_CROP failed",__func__);
ALOGE("[%s] VIDIOC_G_CROP failed",__func__);
ret = MFC_RET_DEC_INIT_FAIL;
goto error_case1;
}
@ -506,7 +506,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecInit(void *openHandle, SSBSIP_MFC_CODEC_TYPE c
ret = ioctl(pCTX->hMFC, VIDIOC_G_CTRL, &ctrl);
if (ret != 0) {
LOGE("[%s] VIDIOC_G_CTRL failed",__func__);
ALOGE("[%s] VIDIOC_G_CTRL failed",__func__);
ret = MFC_RET_DEC_INIT_FAIL;
goto error_case1;
}
@ -522,7 +522,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecInit(void *openHandle, SSBSIP_MFC_CODEC_TYPE c
ret = ioctl(pCTX->hMFC, VIDIOC_S_CTRL, &ctrl);
if (ret != 0) {
LOGE("[%s] VIDIOC_S_CTRL failed, V4L2_CID_CACHEABLE",__func__);
ALOGE("[%s] VIDIOC_S_CTRL failed, V4L2_CID_CACHEABLE",__func__);
ret = MFC_RET_DEC_INIT_FAIL;
goto error_case1;
}
@ -534,7 +534,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecInit(void *openHandle, SSBSIP_MFC_CODEC_TYPE c
ret = ioctl(pCTX->hMFC, VIDIOC_REQBUFS, &reqbuf);
if (ret != 0) {
LOGE("[%s] VIDIOC_REQBUFS failed (destination buffers)",__func__);
ALOGE("[%s] VIDIOC_REQBUFS failed (destination buffers)",__func__);
ret = MFC_RET_DEC_INIT_FAIL;
goto error_case1;
}
@ -551,7 +551,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecInit(void *openHandle, SSBSIP_MFC_CODEC_TYPE c
ret = ioctl(pCTX->hMFC, VIDIOC_QUERYBUF, &qbuf);
if (ret != 0) {
LOGE("[%s] VIDIOC_QUERYBUF failed (destination buffers)",__func__);
ALOGE("[%s] VIDIOC_QUERYBUF failed (destination buffers)",__func__);
ret = MFC_RET_DEC_INIT_FAIL;
goto error_case1;
}
@ -566,7 +566,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecInit(void *openHandle, SSBSIP_MFC_CODEC_TYPE c
PROT_READ | PROT_WRITE, MAP_SHARED, pCTX->hMFC, qbuf.m.planes[0].m.mem_offset);
if (pCTX->v4l2_dec.mfc_dst_bufs[i][0] == MAP_FAILED) {
LOGE("[%s] mmap failed (destination buffers (Y))",__func__);
ALOGE("[%s] mmap failed (destination buffers (Y))",__func__);
ret = MFC_RET_DEC_INIT_FAIL;
goto error_case2;
}
@ -574,14 +574,14 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecInit(void *openHandle, SSBSIP_MFC_CODEC_TYPE c
pCTX->v4l2_dec.mfc_dst_bufs[i][1] = mmap(NULL, qbuf.m.planes[1].length,
PROT_READ | PROT_WRITE, MAP_SHARED, pCTX->hMFC, qbuf.m.planes[1].m.mem_offset);
if (pCTX->v4l2_dec.mfc_dst_bufs[i][1] == MAP_FAILED) {
LOGE("[%s] mmap failed (destination buffers (UV))",__func__);
ALOGE("[%s] mmap failed (destination buffers (UV))",__func__);
ret = MFC_RET_DEC_INIT_FAIL;
goto error_case2;
}
ret = ioctl(pCTX->hMFC, VIDIOC_QBUF, &qbuf);
if (ret != 0) {
LOGE("[%s] VIDIOC_QBUF failed, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE",__func__);
ALOGE("[%s] VIDIOC_QBUF failed, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE",__func__);
ret = MFC_RET_DEC_INIT_FAIL;
goto error_case2;
}
@ -591,7 +591,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecInit(void *openHandle, SSBSIP_MFC_CODEC_TYPE c
type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
ret = ioctl(pCTX->hMFC, VIDIOC_STREAMON, &type);
if (ret != 0) {
LOGE("[%s] VIDIOC_STREAMON failed (destination buffers)",__func__);
ALOGE("[%s] VIDIOC_STREAMON failed (destination buffers)",__func__);
ret = MFC_RET_DEC_INIT_FAIL;
goto error_case1;
}
@ -603,7 +603,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecInit(void *openHandle, SSBSIP_MFC_CODEC_TYPE c
ret = ioctl(pCTX->hMFC, VIDIOC_DQBUF, &qbuf);
if(ret != 0) {
LOGE("[%s] VIDIOC_DQBUF failed, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE",__func__);
ALOGE("[%s] VIDIOC_DQBUF failed, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE",__func__);
ret = MFC_RET_DEC_INIT_FAIL;
goto error_case1;
}
@ -634,12 +634,12 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecExe(void *openHandle, int lengthBufFill)
framecount++;
#endif
if (openHandle == NULL) {
LOGE("[%s] openHandle is NULL",__func__);
ALOGE("[%s] openHandle is NULL",__func__);
return MFC_RET_INVALID_PARAM;
}
if ((lengthBufFill < 0) || (lengthBufFill > MAX_DECODER_INPUT_BUFFER_SIZE)) {
LOGE("[%s] lengthBufFill is invalid. (lengthBufFill=%d)",__func__, lengthBufFill);
ALOGE("[%s] lengthBufFill is invalid. (lengthBufFill=%d)",__func__, lengthBufFill);
return MFC_RET_INVALID_PARAM;
}
@ -665,7 +665,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecExe(void *openHandle, int lengthBufFill)
ret = ioctl(pCTX->hMFC, VIDIOC_QBUF, &qbuf);
if (ret != 0) {
LOGE("[%s] VIDIOC_QBUF failed, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE",__func__);
ALOGE("[%s] VIDIOC_QBUF failed, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE",__func__);
return MFC_RET_DEC_EXE_ERR;
}
@ -687,10 +687,10 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecExe(void *openHandle, int lengthBufFill)
break;
}
} else if (poll_events.revents & POLLERR) { /* POLLERR */
LOGE("[%s] POLLERR\n",__func__);
ALOGE("[%s] POLLERR\n",__func__);
return MFC_RET_DEC_EXE_ERR;
} else {
LOGE("[%s] poll() returns 0x%x\n",__func__, poll_events.revents);
ALOGE("[%s] poll() returns 0x%x\n",__func__, poll_events.revents);
return MFC_RET_DEC_EXE_ERR;
}
} else if (0 > poll_state) {
@ -737,7 +737,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecExe(void *openHandle, int lengthBufFill)
ret = ioctl(pCTX->hMFC, VIDIOC_QBUF, &qbuf);
if (ret != 0) {
LOGE("[%s] VIDIOC_QBUF failed, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE",__func__);
ALOGE("[%s] VIDIOC_QBUF failed, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE",__func__);
return MFC_RET_DEC_EXE_ERR;
}
@ -824,12 +824,12 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecExeNb(void *openHandle, int lengthBufFill)
framecount++;
#endif
if (openHandle == NULL) {
LOGE("[%s] openHandle is NULL",__func__);
ALOGE("[%s] openHandle is NULL",__func__);
return MFC_RET_INVALID_PARAM;
}
if ((lengthBufFill < 0) || (lengthBufFill > MAX_DECODER_INPUT_BUFFER_SIZE)) {
LOGE("[%s] lengthBufFill is invalid. (lengthBufFill=%d)",__func__, lengthBufFill);
ALOGE("[%s] lengthBufFill is invalid. (lengthBufFill=%d)",__func__, lengthBufFill);
return MFC_RET_INVALID_PARAM;
}
@ -847,7 +847,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecExeNb(void *openHandle, int lengthBufFill)
ret = ioctl(pCTX->hMFC, VIDIOC_QBUF, &qbuf);
if (ret != 0) {
LOGE("[%s] VIDIOC_QBUF failed, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE",__func__);
ALOGE("[%s] VIDIOC_QBUF failed, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE",__func__);
return MFC_RET_DEC_EXE_ERR;
}
} else if(pCTX->v4l2_dec.bBeingFinalized == 0) {
@ -862,7 +862,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecExeNb(void *openHandle, int lengthBufFill)
ret = ioctl(pCTX->hMFC, VIDIOC_QBUF, &qbuf);
if (ret != 0) {
LOGE("[%s] VIDIOC_QBUF failed, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE",__func__);
ALOGE("[%s] VIDIOC_QBUF failed, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE",__func__);
return MFC_RET_DEC_EXE_ERR;
}
}
@ -910,10 +910,10 @@ SSBSIP_MFC_DEC_OUTBUF_STATUS SsbSipMfcDecWaitForOutBuf(void *openHandle, SSBSIP_
break;
}
} else if (poll_events.revents & POLLERR) { /* POLLERR */
LOGE("[%s] POLLERR\n",__func__);
ALOGE("[%s] POLLERR\n",__func__);
return MFC_GETOUTBUF_STATUS_NULL;
} else {
LOGE("[%s] poll() returns 0x%x\n",__func__, poll_events.revents);
ALOGE("[%s] poll() returns 0x%x\n",__func__, poll_events.revents);
return MFC_GETOUTBUF_STATUS_NULL;
}
} else if (0 > poll_state) {
@ -1023,12 +1023,12 @@ void *SsbSipMfcDecGetInBuf(void *openHandle, void **phyInBuf, int inputBufferSi
int i;
if (openHandle == NULL) {
LOGE("[%s] openHandle is NULL",__func__);
ALOGE("[%s] openHandle is NULL",__func__);
return NULL;
}
if ((inputBufferSize < 0) || (inputBufferSize > MAX_DECODER_INPUT_BUFFER_SIZE)) {
LOGE("[%s] inputBufferSize = %d is invalid",__func__, inputBufferSize);
ALOGE("[%s] inputBufferSize = %d is invalid",__func__, inputBufferSize);
return NULL;
}
@ -1039,7 +1039,7 @@ void *SsbSipMfcDecGetInBuf(void *openHandle, void **phyInBuf, int inputBufferSi
break;
if (i == MFC_DEC_NUM_SRC_BUFS) {
LOGV("[%s] No buffer is available.",__func__);
ALOGV("[%s] No buffer is available.",__func__);
return NULL;
} else {
pCTX->virStrmBuf = (unsigned int)pCTX->v4l2_dec.mfc_src_bufs[i];
@ -1056,9 +1056,9 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecSetInBuf(void *openHandle, void *phyInBuf, voi
_MFCLIB *pCTX;
int i;
LOGV("[%s] Enter",__func__);
ALOGV("[%s] Enter",__func__);
if (openHandle == NULL) {
LOGE("[%s] openHandle is NULL",__func__);
ALOGE("[%s] openHandle is NULL",__func__);
return MFC_RET_INVALID_PARAM;
}
@ -1069,14 +1069,14 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecSetInBuf(void *openHandle, void *phyInBuf, voi
break;
if (i == MFC_DEC_NUM_SRC_BUFS) {
LOGE("[%s] Can not use the buffer",__func__);
ALOGE("[%s] Can not use the buffer",__func__);
return MFC_RET_INVALID_PARAM;
} else {
pCTX->virStrmBuf = (unsigned int)virInBuf;
pCTX->v4l2_dec.beingUsedIndex = i;
pCTX->v4l2_dec.mfc_src_buf_flags[i] = BUF_ENQUEUED;
}
LOGV("[%s] Exit idx %d",__func__,pCTX->v4l2_dec.beingUsedIndex);
ALOGV("[%s] Exit idx %d",__func__,pCTX->v4l2_dec.beingUsedIndex);
return MFC_RET_OK;
}
@ -1086,7 +1086,7 @@ SSBSIP_MFC_DEC_OUTBUF_STATUS SsbSipMfcDecGetOutBuf(void *openHandle, SSBSIP_MFC_
_MFCLIB *pCTX;
if (openHandle == NULL) {
LOGE("[%s] openHandle is NULL",__func__);
ALOGE("[%s] openHandle is NULL",__func__);
return MFC_GETOUTBUF_DISPLAY_END;
}
@ -1118,13 +1118,13 @@ SSBSIP_MFC_DEC_OUTBUF_STATUS SsbSipMfcDecGetOutBuf(void *openHandle, SSBSIP_MFC_
#ifdef SSB_UMP
ret = ump_secure_id_get_from_vaddr(pCTX->decOutInfo.YVirAddr, &output_info->y_cookie);
if (ret) {
LOGV("[%s] fail to get secure id(%d) from vaddr(%x)\n",__func__, \
ALOGV("[%s] fail to get secure id(%d) from vaddr(%x)\n",__func__, \
output_info->y_cookie, pCTX->decOutInfo.YVirAddr);
}
ret = ump_secure_id_get_from_vaddr(pCTX->decOutInfo.CVirAddr, &output_info->c_cookie);
if (ret) {
LOGV("[%s] fail to get secure id(%d) from vaddr(%x)\n",__func__, \
ALOGV("[%s] fail to get secure id(%d) from vaddr(%x)\n",__func__, \
output_info->c_cookie, pCTX->decOutInfo.CVirAddr);
}
break;
@ -1153,12 +1153,12 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecSetConfig(void *openHandle, SSBSIP_MFC_DEC_CON
enum v4l2_buf_type type;
if (openHandle == NULL) {
LOGE("[%s] openHandle is NULL",__func__);
ALOGE("[%s] openHandle is NULL",__func__);
return MFC_RET_INVALID_PARAM;
}
if ((value == NULL) && (MFC_DEC_SETCONF_IS_LAST_FRAME !=conf_type)) {
LOGE("[%s] value is NULL",__func__);
ALOGE("[%s] value is NULL",__func__);
return MFC_RET_INVALID_PARAM;
}
@ -1172,8 +1172,8 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecSetConfig(void *openHandle, SSBSIP_MFC_DEC_CON
case MFC_DEC_SETCONF_FIMV1_WIDTH_HEIGHT: /* be set before calling SsbSipMfcDecInit */
fimv1_res = (struct mfc_dec_fimv1_info *)value;
LOGI("fimv1->width = %d\n", fimv1_res->width);
LOGI("fimv1->height = %d\n", fimv1_res->height);
ALOGI("fimv1->width = %d\n", fimv1_res->width);
ALOGI("fimv1->height = %d\n", fimv1_res->height);
pCTX->fimv1_res.width = (int)(fimv1_res->width);
pCTX->fimv1_res.height = (int)(fimv1_res->height);
return MFC_RET_OK;
@ -1190,7 +1190,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecSetConfig(void *openHandle, SSBSIP_MFC_DEC_CON
type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
ret = ioctl(pCTX->hMFC, VIDIOC_STREAMOFF, &type);
if (ret != 0) {
LOGE("[%s] VIDIOC_STREAMOFF failed (destination buffers)",__func__);
ALOGE("[%s] VIDIOC_STREAMOFF failed (destination buffers)",__func__);
return MFC_RET_DEC_SET_CONF_FAIL;
}
pCTX->inter_buff_status &= ~(MFC_USE_DST_STREAMON);
@ -1206,7 +1206,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecSetConfig(void *openHandle, SSBSIP_MFC_DEC_CON
ret = ioctl(pCTX->hMFC, VIDIOC_QBUF, &qbuf);
if (ret != 0) {
LOGE("[%s] VIDIOC_QBUF failed, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE",__func__);
ALOGE("[%s] VIDIOC_QBUF failed, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE",__func__);
return MFC_RET_DEC_SET_CONF_FAIL;
}
}
@ -1214,7 +1214,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecSetConfig(void *openHandle, SSBSIP_MFC_DEC_CON
type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
ret = ioctl(pCTX->hMFC, VIDIOC_STREAMON, &type);
if (ret != 0) {
LOGE("[%s] VIDIOC_STREAMON failed (destination buffers)",__func__);
ALOGE("[%s] VIDIOC_STREAMON failed (destination buffers)",__func__);
return MFC_RET_DEC_SET_CONF_FAIL;
}
pCTX->inter_buff_status |= MFC_USE_DST_STREAMON;
@ -1253,13 +1253,13 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecSetConfig(void *openHandle, SSBSIP_MFC_DEC_CON
break;
default:
LOGE("[%s] conf_type(%d) is NOT supported",__func__, conf_type);
ALOGE("[%s] conf_type(%d) is NOT supported",__func__, conf_type);
return MFC_RET_INVALID_PARAM;
}
ret = ioctl(pCTX->hMFC, VIDIOC_S_CTRL, &ctrl);
if (ret != 0) {
LOGE("[%s] VIDIOC_S_CTRL failed (conf_type = %d)",__func__, conf_type);
ALOGE("[%s] VIDIOC_S_CTRL failed (conf_type = %d)",__func__, conf_type);
return MFC_RET_DEC_SET_CONF_FAIL;
}
@ -1277,12 +1277,12 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecGetConfig(void *openHandle, SSBSIP_MFC_DEC_CON
struct v4l2_control ctrl;
if (openHandle == NULL) {
LOGE("[%s] openHandle is NULL",__func__);
ALOGE("[%s] openHandle is NULL",__func__);
return MFC_RET_INVALID_PARAM;
}
if (value == NULL) {
LOGE("[%s] value is NULL",__func__);
ALOGE("[%s] value is NULL",__func__);
return MFC_RET_INVALID_PARAM;
}
@ -1305,7 +1305,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecGetConfig(void *openHandle, SSBSIP_MFC_DEC_CON
ret = ioctl(pCTX->hMFC, VIDIOC_G_CTRL, &ctrl);
if (ret != 0) {
LOGE("[%s] VIDIOC_G_CTRL failed, V4L2_CID_CODEC_CRC_DATA_LUMA",__func__);
ALOGE("[%s] VIDIOC_G_CTRL failed, V4L2_CID_CODEC_CRC_DATA_LUMA",__func__);
return MFC_RET_DEC_GET_CONF_FAIL;
}
crc_data->luma0 = ctrl.value;
@ -1315,13 +1315,13 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecGetConfig(void *openHandle, SSBSIP_MFC_DEC_CON
ret = ioctl(pCTX->hMFC, VIDIOC_G_CTRL, &ctrl);
if (ret != 0) {
LOGE("[%s] VIDIOC_G_CTRL failed, V4L2_CID_CODEC_CRC_DATA_CHROMA",__func__);
ALOGE("[%s] VIDIOC_G_CTRL failed, V4L2_CID_CODEC_CRC_DATA_CHROMA",__func__);
return MFC_RET_DEC_GET_CONF_FAIL;
}
crc_data->chroma0 = ctrl.value;
LOGI("[%s] crc_data->luma0=%d",__func__,ctrl.value);
LOGI("[%s] crc_data->chroma0=%d",__func__,ctrl.value);
ALOGI("[%s] crc_data->luma0=%d",__func__,ctrl.value);
ALOGI("[%s] crc_data->chroma0=%d",__func__,ctrl.value);
break;
case MFC_DEC_GETCONF_FRAME_TAG:
@ -1344,7 +1344,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecGetConfig(void *openHandle, SSBSIP_MFC_DEC_CON
break;
default:
LOGE("[%s] conf_type(%d) is NOT supported",__func__, conf_type);
ALOGE("[%s] conf_type(%d) is NOT supported",__func__, conf_type);
return MFC_RET_INVALID_PARAM;
}

@ -31,8 +31,8 @@
#include "mfc_interface.h"
#include "SsbSipMfcApi.h"
/* #define LOG_NDEBUG 0 */
#define LOG_TAG "MFC_ENC_APP"
/* #define ALOG_NDEBUG 0 */
#define ALOG_TAG "MFC_ENC_APP"
#include <utils/Log.h>
#define POLL_ENC_WAIT_TIMEOUT 25
@ -71,22 +71,22 @@ void *SsbSipMfcEncOpen(void)
struct v4l2_capability cap;
getMFCName(mfc_dev_name, 64);
LOGI("[%s] dev name is %s\n",__func__,mfc_dev_name);
ALOGI("[%s] dev name is %s\n",__func__,mfc_dev_name);
if (access(mfc_dev_name, F_OK) != 0) {
LOGE("[%s] MFC device node not exists",__func__);
ALOGE("[%s] MFC device node not exists",__func__);
return NULL;
}
hMFCOpen = open(mfc_dev_name, O_RDWR | O_NONBLOCK, 0);
if (hMFCOpen < 0) {
LOGE("[%s] Failed to open MFC device",__func__);
ALOGE("[%s] Failed to open MFC device",__func__);
return NULL;
}
pCTX = (_MFCLIB *)malloc(sizeof(_MFCLIB));
if (pCTX == NULL) {
LOGE("[%s] malloc failed.",__func__);
ALOGE("[%s] malloc failed.",__func__);
return NULL;
}
memset(pCTX, 0, sizeof(_MFCLIB));
@ -96,28 +96,28 @@ void *SsbSipMfcEncOpen(void)
memset(&cap, 0, sizeof(cap));
ret = ioctl(pCTX->hMFC, VIDIOC_QUERYCAP, &cap);
if (ret != 0) {
LOGE("[%s] VIDIOC_QUERYCAP failed",__func__);
ALOGE("[%s] VIDIOC_QUERYCAP failed",__func__);
close(pCTX->hMFC);
free(pCTX);
return NULL;
}
if (!(cap.capabilities & V4L2_CAP_VIDEO_CAPTURE)) {
LOGE("[%s] Device does not support capture",__func__);
ALOGE("[%s] Device does not support capture",__func__);
close(pCTX->hMFC);
free(pCTX);
return NULL;
}
if (!(cap.capabilities & V4L2_CAP_VIDEO_OUTPUT)) {
LOGE("[%s] Device does not support output",__func__);
ALOGE("[%s] Device does not support output",__func__);
close(pCTX->hMFC);
free(pCTX);
return NULL;
}
if (!(cap.capabilities & V4L2_CAP_STREAMING)) {
LOGE("[%s] Device does not support streaming",__func__);
ALOGE("[%s] Device does not support streaming",__func__);
close(pCTX->hMFC);
free(pCTX);
return NULL;
@ -144,13 +144,13 @@ void *SsbSipMfcEncOpenExt(void *value)
pCTX->cacheablebuffer = NO_CACHE;
/* physical address is used for Input source */
pCTX->v4l2_enc.bInputPhyVir = 1;
LOGI("[%s] non cacheable buffer",__func__);
ALOGI("[%s] non cacheable buffer",__func__);
}
else {
pCTX->cacheablebuffer = CACHE;
/* vitual address is used for Input source */
pCTX->v4l2_enc.bInputPhyVir = 0;
LOGI("[%s] cacheable buffer",__func__);
ALOGI("[%s] cacheable buffer",__func__);
}
return (void *)pCTX;
@ -162,7 +162,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncClose(void *openHandle)
int i;
if (openHandle == NULL) {
LOGE("[%s] openHandle is NULL",__func__);
ALOGE("[%s] openHandle is NULL",__func__);
return MFC_RET_INVALID_PARAM;
}
@ -240,7 +240,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncInit(void *openHandle, void *param)
pCTX->height = h264_arg->SourceHeight;
pCTX->framemap = h264_arg->FrameMap;
} else {
LOGE("[%s] Undefined codec type \n",__func__);
ALOGE("[%s] Undefined codec type \n",__func__);
ret = MFC_RET_INVALID_PARAM;
goto error_case1;
}
@ -526,7 +526,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncInit(void *openHandle, void *param)
break;
default:
LOGE("[%s] Undefined codec type",__func__);
ALOGE("[%s] Undefined codec type",__func__);
ret = MFC_RET_INVALID_PARAM;
goto error_case1;
}
@ -545,7 +545,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncInit(void *openHandle, void *param)
ret = ioctl(pCTX->hMFC, VIDIOC_S_EXT_CTRLS, &ext_ctrls);
if (ret != 0) {
LOGE("[%s] Failed to set extended controls",__func__);
ALOGE("[%s] Failed to set extended controls",__func__);
ret = MFC_RET_ENC_INIT_FAIL;
goto error_case1;
}
@ -575,7 +575,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncInit(void *openHandle, void *param)
ret = ioctl(pCTX->hMFC, VIDIOC_S_FMT, &fmt);
if (ret != 0) {
LOGE("[%s] S_FMT failed on MFC output stream",__func__);
ALOGE("[%s] S_FMT failed on MFC output stream",__func__);
ret = MFC_RET_ENC_INIT_FAIL;
goto error_case1;
}
@ -594,7 +594,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncInit(void *openHandle, void *param)
fmt.fmt.pix_mp.pixelformat = V4L2_PIX_FMT_H263;
break;
default:
LOGE("[%s] Codec has not been recognised",__func__);
ALOGE("[%s] Codec has not been recognised",__func__);
return MFC_RET_ENC_INIT_FAIL;
}
@ -603,7 +603,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncInit(void *openHandle, void *param)
ret = ioctl(pCTX->hMFC, VIDIOC_S_FMT, &fmt);
if (ret != 0) {
LOGE("[%s] S_FMT failed on MFC output stream",__func__);
ALOGE("[%s] S_FMT failed on MFC output stream",__func__);
ret = MFC_RET_ENC_INIT_FAIL;
goto error_case1;
}
@ -617,7 +617,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncInit(void *openHandle, void *param)
ret = ioctl(pCTX->hMFC, VIDIOC_S_CTRL, &ctrl);
if (ret != 0) {
LOGE("[%s] VIDIOC_S_CTRL failed, V4L2_CID_CACHEABLE",__func__);
ALOGE("[%s] VIDIOC_S_CTRL failed, V4L2_CID_CACHEABLE",__func__);
ret = MFC_RET_ENC_INIT_FAIL;
goto error_case1;
}
@ -633,7 +633,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncInit(void *openHandle, void *param)
ret = ioctl(pCTX->hMFC, VIDIOC_REQBUFS, &reqbuf);
if (ret != 0) {
LOGE("[%s] Reqbufs src ioctl failed",__func__);
ALOGE("[%s] Reqbufs src ioctl failed",__func__);
ret = MFC_RET_ENC_INIT_FAIL;
goto error_case1;
}
@ -651,7 +651,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncInit(void *openHandle, void *param)
ret = ioctl(pCTX->hMFC, VIDIOC_QUERYBUF, &buf);
if (ret != 0) {
LOGE("[%s] Querybuf src ioctl failed",__func__);
ALOGE("[%s] Querybuf src ioctl failed",__func__);
ret = MFC_RET_ENC_INIT_FAIL;
goto error_case2;
}
@ -666,7 +666,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncInit(void *openHandle, void *param)
mmap(NULL, buf.m.planes[0].length, PROT_READ | PROT_WRITE,
MAP_SHARED, pCTX->hMFC, buf.m.planes[0].m.mem_offset);
if (pCTX->v4l2_enc.mfc_src_bufs[i][0] == MAP_FAILED) {
LOGE("[%s] Mmap on src buffer (0) failed",__func__);
ALOGE("[%s] Mmap on src buffer (0) failed",__func__);
ret = MFC_RET_ENC_INIT_FAIL;
goto error_case2;
}
@ -676,13 +676,13 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncInit(void *openHandle, void *param)
MAP_SHARED, pCTX->hMFC, buf.m.planes[1].m.mem_offset);
if (pCTX->v4l2_enc.mfc_src_bufs[i][1] == MAP_FAILED) {
munmap(pCTX->v4l2_enc.mfc_src_bufs[i][0], pCTX->v4l2_enc.mfc_src_bufs_len[0]);
LOGE("[%s] Mmap on src buffer (1) failed",__func__);
ALOGE("[%s] Mmap on src buffer (1) failed",__func__);
ret = MFC_RET_ENC_INIT_FAIL;
goto error_case2;
}
}
} else
LOGV("[%s] Camera Phys src buf %d",__func__,reqbuf.count);
ALOGV("[%s] Camera Phys src buf %d",__func__,reqbuf.count);
for (i = 0; i<pCTX->v4l2_enc.mfc_num_src_bufs; i++)
pCTX->v4l2_enc.mfc_src_buf_flags[i] = BUF_DEQUEUED;
@ -701,7 +701,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncInit(void *openHandle, void *param)
ret = ioctl(pCTX->hMFC, VIDIOC_REQBUFS, &reqbuf);
if (ret != 0) {
LOGE("[%s] Reqbufs dst ioctl failed",__func__);
ALOGE("[%s] Reqbufs dst ioctl failed",__func__);
ret = MFC_RET_ENC_INIT_FAIL;
goto error_case2;
}
@ -718,7 +718,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncInit(void *openHandle, void *param)
ret = ioctl(pCTX->hMFC, VIDIOC_QUERYBUF, &buf);
if (ret != 0) {
LOGE("[%s] Querybuf dst ioctl failed",__func__);
ALOGE("[%s] Querybuf dst ioctl failed",__func__);
ret = MFC_RET_ENC_INIT_FAIL;
goto error_case3;
}
@ -728,14 +728,14 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncInit(void *openHandle, void *param)
mmap(NULL, buf.m.planes[0].length, PROT_READ | PROT_WRITE,
MAP_SHARED, pCTX->hMFC, buf.m.planes[0].m.mem_offset);
if (pCTX->v4l2_enc.mfc_dst_bufs[i] == MAP_FAILED) {
LOGE("[%s] Mmap on dst buffer failed",__func__);
ALOGE("[%s] Mmap on dst buffer failed",__func__);
ret = MFC_RET_ENC_INIT_FAIL;
goto error_case3;
}
ret = ioctl(pCTX->hMFC, VIDIOC_QBUF, &buf);
if (ret != 0) {
LOGE("[%s] VIDIOC_QBUF failed, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE",__func__);
ALOGE("[%s] VIDIOC_QBUF failed, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE",__func__);
ret = MFC_RET_ENC_INIT_FAIL;
goto error_case3;
}
@ -748,7 +748,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncInit(void *openHandle, void *param)
ret = ioctl(pCTX->hMFC, VIDIOC_STREAMON, &type);
if (ret != 0) {
LOGE("[%s] V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, VIDIOC_STREAMON failed",__func__);
ALOGE("[%s] V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, VIDIOC_STREAMON failed",__func__);
ret = MFC_RET_ENC_INIT_FAIL;
goto error_case3;
}
@ -773,11 +773,11 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncInit(void *openHandle, void *param)
if (ret == 0)
break;
} else if(poll_events.revents & POLLERR) { /*POLLERR */
LOGE("[%s] POLLERR\n",__func__);
ALOGE("[%s] POLLERR\n",__func__);
ret = MFC_RET_ENC_INIT_FAIL;
goto error_case3;
} else {
LOGE("[%s] poll() returns 0x%x\n",__func__, poll_events.revents);
ALOGE("[%s] poll() returns 0x%x\n",__func__, poll_events.revents);
ret = MFC_RET_ENC_INIT_FAIL;
goto error_case3;
}
@ -801,11 +801,11 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncInit(void *openHandle, void *param)
ret = ioctl(pCTX->hMFC, VIDIOC_QBUF, &buf);
if (ret != 0) {
LOGE("[%s] VIDIOC_QBUF failed, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE",__func__);
ALOGE("[%s] VIDIOC_QBUF failed, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE",__func__);
ret = MFC_RET_ENC_INIT_FAIL;
goto error_case3;
}
LOGV("[%s] Strm out idx %d",__func__,index);
ALOGV("[%s] Strm out idx %d",__func__,index);
return MFC_RET_OK;
error_case3:
@ -830,7 +830,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncGetInBuf(void *openHandle, SSBSIP_MFC_ENC_INPU
int i;
if (openHandle == NULL) {
LOGE("[%s] openHandle is NULL\n",__func__);
ALOGE("[%s] openHandle is NULL\n",__func__);
return MFC_RET_INVALID_PARAM;
}
@ -857,7 +857,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncGetInBuf(void *openHandle, SSBSIP_MFC_ENC_INPU
break;
if (i == pCTX->v4l2_enc.mfc_num_src_bufs) {
LOGV("[%s] No buffer is available.",__func__);
ALOGV("[%s] No buffer is available.",__func__);
return MFC_RET_ENC_GET_INBUF_FAIL;
} else {
/* FIXME check this for correct physical address */
@ -871,7 +871,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncGetInBuf(void *openHandle, SSBSIP_MFC_ENC_INPU
pCTX->v4l2_enc.mfc_src_buf_flags[i] = BUF_ENQUEUED;
}
}
LOGV("[%s] Input Buffer idx %d",__func__,i);
ALOGV("[%s] Input Buffer idx %d",__func__,i);
return MFC_RET_OK;
}
@ -884,7 +884,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncSetInBuf(void *openHandle, SSBSIP_MFC_ENC_INPU
int ret,i;
if (openHandle == NULL) {
LOGE("[%s] openHandle is NULL\n",__func__);
ALOGE("[%s] openHandle is NULL\n",__func__);
return MFC_RET_INVALID_PARAM;
}
@ -906,14 +906,14 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncSetInBuf(void *openHandle, SSBSIP_MFC_ENC_INPU
MFC dqbuf() */
pCTX->v4l2_enc.beingUsedIndex++;
pCTX->v4l2_enc.beingUsedIndex %= MFC_ENC_NUM_SRC_BUFS;
LOGV("[%s] Phy Input Buffer idx Queued %d",__func__,pCTX->v4l2_enc.beingUsedIndex);
ALOGV("[%s] Phy Input Buffer idx Queued %d",__func__,pCTX->v4l2_enc.beingUsedIndex);
} else {
for (i = 0; i < pCTX->v4l2_enc.mfc_num_src_bufs; i++)
if (pCTX->v4l2_enc.mfc_src_bufs[i][0] == input_info->YVirAddr)
break;
if (i == pCTX->v4l2_enc.mfc_num_src_bufs) {
LOGE("[%s] Can not use the buffer",__func__);
ALOGE("[%s] Can not use the buffer",__func__);
return MFC_RET_INVALID_PARAM;
} else {
pCTX->v4l2_enc.beingUsedIndex = i;
@ -923,7 +923,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncSetInBuf(void *openHandle, SSBSIP_MFC_ENC_INPU
qbuf.index = pCTX->v4l2_enc.beingUsedIndex;
planes[0].bytesused = pCTX->width * pCTX->height;
planes[1].bytesused = (pCTX->width * pCTX->height) >> 1;
LOGV("[%s] Input Buffer idx Queued %d",__func__,pCTX->v4l2_enc.beingUsedIndex);
ALOGV("[%s] Input Buffer idx Queued %d",__func__,pCTX->v4l2_enc.beingUsedIndex);
}
qbuf.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
@ -932,7 +932,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncSetInBuf(void *openHandle, SSBSIP_MFC_ENC_INPU
ret = ioctl(pCTX->hMFC, VIDIOC_QBUF, &qbuf);
if (ret != 0) {
LOGE("[%s] VIDIOC_QBUF failed, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE",__func__);
ALOGE("[%s] VIDIOC_QBUF failed, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE",__func__);
return MFC_RET_ENC_SET_INBUF_FAIL;
}
@ -944,7 +944,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncGetOutBuf(void *openHandle, SSBSIP_MFC_ENC_OUT
_MFCLIB *pCTX;
if (openHandle == NULL) {
LOGE("[%s] openHandle is NULL\n",__func__);
ALOGE("[%s] openHandle is NULL\n",__func__);
return MFC_RET_INVALID_PARAM;
}
@ -970,7 +970,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncGetOutBuf(void *openHandle, SSBSIP_MFC_ENC_OUT
SSBSIP_MFC_ERROR_CODE SsbSipMfcEncSetOutBuf(void *openHandle, void *phyOutbuf, void *virOutbuf, int outputBufferSize)
{
if (openHandle == NULL) {
LOGE("[%s] openHandle is NULL\n",__func__);
ALOGE("[%s] openHandle is NULL\n",__func__);
return MFC_RET_INVALID_PARAM;
}
@ -993,9 +993,9 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncExe(void *openHandle)
struct pollfd poll_events;
int poll_state;
LOGV("[%s] Enter \n",__func__);
ALOGV("[%s] Enter \n",__func__);
if (openHandle == NULL) {
LOGE("[%s] openHandle is NULL\n",__func__);
ALOGE("[%s] openHandle is NULL\n",__func__);
return MFC_RET_INVALID_PARAM;
}
@ -1006,7 +1006,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncExe(void *openHandle)
ret = ioctl(pCTX->hMFC, VIDIOC_S_CTRL, &ctrl);
if (ret != 0) {
LOGE("[%s] VIDIOC_S_CTRL failed, V4L2_CID_CODEC_FRAME_TAG",__func__);
ALOGE("[%s] VIDIOC_S_CTRL failed, V4L2_CID_CODEC_FRAME_TAG",__func__);
return MFC_RET_ENC_EXE_ERR;
}
@ -1014,7 +1014,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncExe(void *openHandle)
type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
ret = ioctl(pCTX->hMFC, VIDIOC_STREAMON, &type);
if (ret != 0) {
LOGE("[%s] VIDIOC_STREAMON failed, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE",__func__);
ALOGE("[%s] VIDIOC_STREAMON failed, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE",__func__);
return MFC_RET_ENC_EXE_ERR;
}
@ -1041,14 +1041,14 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncExe(void *openHandle)
if (ret == 0)
break;
} else if (poll_events.revents & POLLERR) { /* POLLERR */
LOGE("[%s] POLLERR\n",__func__);
ALOGE("[%s] POLLERR\n",__func__);
return MFC_RET_ENC_EXE_ERR;
} else {
LOGE("[%s] poll() returns 0x%x\n",__func__, poll_events.revents);
ALOGE("[%s] poll() returns 0x%x\n",__func__, poll_events.revents);
return MFC_RET_ENC_EXE_ERR;
}
} else if (0 > poll_state) {
LOGE("[%s] poll() Encoder POLL Timeout 0x%x\n",__func__, poll_events.revents);
ALOGE("[%s] poll() Encoder POLL Timeout 0x%x\n",__func__, poll_events.revents);
return MFC_RET_ENC_EXE_ERR;
}
loopcnt++;
@ -1057,7 +1057,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncExe(void *openHandle)
if (pCTX->v4l2_enc.bRunning != 0) {
pCTX->encodedframeType = (qbuf.flags & 0x18) >> 3; /* encoded frame type */
LOGV("[%s] encoded frame type = %d\n",__func__, pCTX->encodedframeType);
ALOGV("[%s] encoded frame type = %d\n",__func__, pCTX->encodedframeType);
switch (pCTX->encodedframeType) {
case 1:
pCTX->encodedframeType = MFC_FRAME_TYPE_I_FRAME;
@ -1069,7 +1069,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncExe(void *openHandle)
pCTX->encodedframeType = MFC_FRAME_TYPE_B_FRAME;
break;
default:
LOGE("[%s] VIDIOC_DQBUF failed, encoded frame type is wrong",__func__);
ALOGE("[%s] VIDIOC_DQBUF failed, encoded frame type is wrong",__func__);
}
}
@ -1084,7 +1084,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncExe(void *openHandle)
ret = ioctl(pCTX->hMFC, VIDIOC_G_CTRL, &ctrl);
if (ret != 0) {
LOGE("[%s] VIDIOC_G_CTRL failed, V4L2_CID_CODEC_FRAME_TAG",__func__);
ALOGE("[%s] VIDIOC_G_CTRL failed, V4L2_CID_CODEC_FRAME_TAG",__func__);
return MFC_RET_ENC_EXE_ERR;
}
@ -1099,7 +1099,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncExe(void *openHandle)
ret = ioctl(pCTX->hMFC, VIDIOC_QBUF, &qbuf);
if (ret != 0) {
LOGE("[%s] VIDIOC_QBUF failed, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE",__func__);
ALOGE("[%s] VIDIOC_QBUF failed, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE",__func__);
return MFC_RET_ENC_EXE_ERR;
}
@ -1114,7 +1114,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncExe(void *openHandle)
ret = ioctl(pCTX->hMFC, VIDIOC_DQBUF, &qbuf);
if (ret != 0) {
LOGE("[%s] VIDIOC_DQBUF failed, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE",__func__);
ALOGE("[%s] VIDIOC_DQBUF failed, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE",__func__);
return MFC_RET_ENC_EXE_ERR;
}
}
@ -1122,7 +1122,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncExe(void *openHandle)
/* Update context stream buffer address */
pCTX->virStrmBuf = pCTX->v4l2_enc.mfc_dst_bufs[dequeued_index];
LOGV("[%s] Strm out idx %d",__func__,dequeued_index);
ALOGV("[%s] Strm out idx %d",__func__,dequeued_index);
return MFC_RET_OK;
}
@ -1132,12 +1132,12 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncSetConfig(void *openHandle, SSBSIP_MFC_ENC_CON
_MFCLIB *pCTX;
if (openHandle == NULL) {
LOGE("[%s] openHandle is NULL\n",__func__);
ALOGE("[%s] openHandle is NULL\n",__func__);
return MFC_RET_INVALID_PARAM;
}
if (value == NULL) {
LOGE("[%s] value is NULL\n",__func__);
ALOGE("[%s] value is NULL\n",__func__);
return MFC_RET_INVALID_PARAM;
}
@ -1168,7 +1168,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncSetConfig(void *openHandle, SSBSIP_MFC_ENC_CON
case MFC_ENC_SETCONF_I_PERIOD:
#endif
default:
LOGE("[%s] conf_type(%d) is NOT supported\n",__func__, conf_type);
ALOGE("[%s] conf_type(%d) is NOT supported\n",__func__, conf_type);
return MFC_RET_INVALID_PARAM;
}
@ -1182,12 +1182,12 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncGetConfig(void *openHandle, SSBSIP_MFC_ENC_CON
pCTX = (_MFCLIB *) openHandle;
if (openHandle == NULL) {
LOGE("[%s] openHandle is NULL\n",__func__);
ALOGE("[%s] openHandle is NULL\n",__func__);
return MFC_RET_INVALID_PARAM;
}
if (value == NULL) {
LOGE("[%s] value is NULL\n",__func__);
ALOGE("[%s] value is NULL\n",__func__);
return MFC_RET_INVALID_PARAM;
}
@ -1197,7 +1197,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncGetConfig(void *openHandle, SSBSIP_MFC_ENC_CON
break;
default:
LOGE("[%s] conf_type(%d) is NOT supported\n",__func__, conf_type);
ALOGE("[%s] conf_type(%d) is NOT supported\n",__func__, conf_type);
return MFC_RET_INVALID_PARAM;
}

@ -39,8 +39,8 @@
#include "ion.h"
#endif
/* #define LOG_NDEBUG 0 */
#define LOG_TAG "MFC_DEC_APP"
/* #define ALOG_NDEBUG 0 */
#define ALOG_TAG "MFC_DEC_APP"
#include <utils/Log.h>
#ifdef CONFIG_MFC_FPS
@ -85,22 +85,22 @@ int v4l2_mfc_querycap(int fd)
ret = ioctl(fd, VIDIOC_QUERYCAP, &cap);
if (ret != 0) {
LOGE("[%s] VIDIOC_QUERYCAP failed", __func__);
ALOGE("[%s] VIDIOC_QUERYCAP failed", __func__);
return ret;
}
if (!(cap.capabilities & V4L2_CAP_VIDEO_CAPTURE)) {
LOGE("[%s] Device does not support capture", __func__);
ALOGE("[%s] Device does not support capture", __func__);
return -1;
}
if (!(cap.capabilities & V4L2_CAP_VIDEO_OUTPUT)) {
LOGE("[%s] Device does not support output", __func__);
ALOGE("[%s] Device does not support output", __func__);
return -1;
}
if (!(cap.capabilities & V4L2_CAP_STREAMING)) {
LOGE("[%s] Device does not support streaming", __func__);
ALOGE("[%s] Device does not support streaming", __func__);
return -1;
}
@ -158,7 +158,7 @@ int v4l2_mfc_s_fmt(int fd, enum v4l2_buf_type type,
fmt.fmt.pix_mp.pixelformat = V4L2_PIX_FMT_VP8;
break;
default:
LOGE("[%s] Does NOT support the codec type (%d)", __func__, pixelformat);
ALOGE("[%s] Does NOT support the codec type (%d)", __func__, pixelformat);
return -1;
}
fmt.fmt.pix_mp.plane_fmt[0].sizeimage = sizeimage;
@ -174,11 +174,11 @@ int v4l2_mfc_s_fmt(int fd, enum v4l2_buf_type type,
fmt.fmt.pix_mp.pixelformat = V4L2_PIX_FMT_NV21M;
break;
default:
LOGE("[%s] Does NOT support the pixel format (%d)", __func__, pixelformat);
ALOGE("[%s] Does NOT support the pixel format (%d)", __func__, pixelformat);
return -1;
}
} else {
LOGE("[%s] Wrong buffer type", __func__);
ALOGE("[%s] Wrong buffer type", __func__);
return -1;
}
@ -377,20 +377,20 @@ static int isPBPacked(_MFCLIB *pCtx, int Frameleng)
while (1) {
while (startCode != USR_DATA_START_CODE) {
if ((startCode == VOP_START_CODE) || (leng_idx == Frameleng)) {
LOGI("[%s] VOP START Found !!.....return",__func__);
LOGW("[%s] Non Packed PB",__func__);
ALOGI("[%s] VOP START Found !!.....return",__func__);
ALOGW("[%s] Non Packed PB",__func__);
return 0;
}
getAByte(strmBuffer, &startCode);
LOGV(">> StartCode = 0x%08x <<\n", startCode);
ALOGV(">> StartCode = 0x%08x <<\n", startCode);
strmBuffer++;
leng_idx++;
}
LOGI("[%s] User Data Found !!",__func__);
ALOGI("[%s] User Data Found !!",__func__);
do {
if (*strmBuffer == 'p') {
LOGW("[%s] Packed PB",__func__);
ALOGW("[%s] Packed PB",__func__);
return 1;
}
getAByte(strmBuffer, &startCode);
@ -401,7 +401,7 @@ static int isPBPacked(_MFCLIB *pCtx, int Frameleng)
break;
}
LOGW("[%s] Non Packed PB",__func__);
ALOGW("[%s] Non Packed PB",__func__);
return 0;
}
@ -434,7 +434,7 @@ void *SsbSipMfcDecOpen(void)
struct v4l2_buffer buf;
struct v4l2_plane planes[MFC_DEC_NUM_PLANES];
LOGI("[%s] MFC Library Ver %d.%02d",__func__, MFC_LIB_VER_MAJOR, MFC_LIB_VER_MINOR);
ALOGI("[%s] MFC Library Ver %d.%02d",__func__, MFC_LIB_VER_MAJOR, MFC_LIB_VER_MINOR);
#ifdef CONFIG_MFC_FPS
framecount = 0;
@ -444,23 +444,23 @@ void *SsbSipMfcDecOpen(void)
pCTX = (_MFCLIB *)malloc(sizeof(_MFCLIB));
if (pCTX == NULL) {
LOGE("[%s] malloc failed.",__func__);
ALOGE("[%s] malloc failed.",__func__);
return NULL;
}
memset(pCTX, 0, sizeof(_MFCLIB));
getMFCName(mfc_dev_name, 64);
LOGI("[%s] dev name is %s",__func__,mfc_dev_name);
ALOGI("[%s] dev name is %s",__func__,mfc_dev_name);
if (access(mfc_dev_name, F_OK) != 0) {
LOGE("[%s] MFC device node not exists",__func__);
ALOGE("[%s] MFC device node not exists",__func__);
goto error_case1;
}
hMFCOpen = open(mfc_dev_name, O_RDWR|O_NONBLOCK, 0);
if (hMFCOpen < 0) {
LOGE("[%s] Failed to open MFC device",__func__);
ALOGE("[%s] Failed to open MFC device",__func__);
goto error_case1;
}
@ -468,7 +468,7 @@ void *SsbSipMfcDecOpen(void)
ret = v4l2_mfc_querycap(pCTX->hMFC);
if (ret != 0) {
LOGE("[%s] QUERYCAP failed", __func__);
ALOGE("[%s] QUERYCAP failed", __func__);
goto error_case2;
}
@ -476,7 +476,7 @@ void *SsbSipMfcDecOpen(void)
ret = v4l2_mfc_s_fmt(pCTX->hMFC, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE,
H264_DEC, MAX_DECODER_INPUT_BUFFER_SIZE, 0, 0);
if (ret != 0) {
LOGE("[%s] S_FMT failed",__func__);
ALOGE("[%s] S_FMT failed",__func__);
goto error_case2;
}
@ -486,7 +486,7 @@ void *SsbSipMfcDecOpen(void)
ret = v4l2_mfc_reqbufs(pCTX->hMFC, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE,
V4L2_MEMORY_MMAP, &req_count);
if (ret != 0) {
LOGE("[%s] VIDIOC_REQBUFS failed",__func__);
ALOGE("[%s] VIDIOC_REQBUFS failed",__func__);
goto error_case2;
}
@ -496,14 +496,14 @@ void *SsbSipMfcDecOpen(void)
ret = v4l2_mfc_querybuf(pCTX->hMFC, &buf, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE,
V4L2_MEMORY_MMAP, i, planes);
if (ret != 0) {
LOGE("[%s] VIDIOC_QUERYBUF failed",__func__);
ALOGE("[%s] VIDIOC_QUERYBUF failed",__func__);
goto error_case3;
}
pCTX->v4l2_dec.mfc_src_bufs[i] = mmap(NULL, buf.m.planes[0].length,
PROT_READ | PROT_WRITE, MAP_SHARED, pCTX->hMFC, buf.m.planes[0].m.mem_offset);
if (pCTX->v4l2_dec.mfc_src_bufs[i] == MAP_FAILED) {
LOGE("[%s] mmap failed (%d)",__func__,i);
ALOGE("[%s] mmap failed (%d)",__func__,i);
goto error_case3;
}
}
@ -546,10 +546,10 @@ void *SsbSipMfcDecOpenExt(void *value)
if (NO_CACHE == (*(SSBIP_MFC_BUFFER_TYPE *)value)) {
pCTX->cacheablebuffer = NO_CACHE;
LOGI("[%s] non cacheable buffer",__func__);
ALOGI("[%s] non cacheable buffer",__func__);
} else {
pCTX->cacheablebuffer = CACHE;
LOGI("[%s] cacheable buffer",__func__);
ALOGI("[%s] cacheable buffer",__func__);
}
return (void *)pCTX;
@ -561,15 +561,15 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecClose(void *openHandle)
_MFCLIB *pCTX;
#ifdef CONFIG_MFC_FPS
LOGI(">>> MFC");
ALOGI(">>> MFC");
gettimeofday(&mTS2, NULL);
LOGI(">>> time=%d", mTS2.tv_sec-mTS1.tv_sec);
LOGI(">>> framecount=%d", framecount);
LOGI(">>> 30ms over=%d", over30ms);
ALOGI(">>> time=%d", mTS2.tv_sec-mTS1.tv_sec);
ALOGI(">>> framecount=%d", framecount);
ALOGI(">>> 30ms over=%d", over30ms);
#endif
if (openHandle == NULL) {
LOGE("[%s] openHandle is NULL",__func__);
ALOGE("[%s] openHandle is NULL",__func__);
return MFC_RET_INVALID_PARAM;
}
@ -578,7 +578,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecClose(void *openHandle)
if (pCTX->inter_buff_status & MFC_USE_DST_STREAMON) {
ret = v4l2_mfc_streamoff(pCTX->hMFC, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE);
if (ret != 0) {
LOGE("[%s] VIDIOC_STREAMOFF failed (destination buffers)",__func__);
ALOGE("[%s] VIDIOC_STREAMOFF failed (destination buffers)",__func__);
return MFC_RET_CLOSE_FAIL;
}
pCTX->inter_buff_status &= ~(MFC_USE_DST_STREAMON);
@ -587,7 +587,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecClose(void *openHandle)
if (pCTX->inter_buff_status & MFC_USE_SRC_STREAMON) {
ret = v4l2_mfc_streamoff(pCTX->hMFC, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE);
if (ret != 0) {
LOGE("[%s] VIDIOC_STREAMOFF failed (source buffers)",__func__);
ALOGE("[%s] VIDIOC_STREAMOFF failed (source buffers)",__func__);
return MFC_RET_CLOSE_FAIL;
}
pCTX->inter_buff_status &= ~(MFC_USE_SRC_STREAMON);
@ -631,7 +631,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecInit(void *openHandle, SSBSIP_MFC_CODEC_TYPE c
int poll_state, poll_revents;
if (openHandle == NULL) {
LOGE("[%s] openHandle is NULL",__func__);
ALOGE("[%s] openHandle is NULL",__func__);
return MFC_RET_INVALID_PARAM;
}
@ -654,7 +654,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecInit(void *openHandle, SSBSIP_MFC_CODEC_TYPE c
ret = v4l2_mfc_s_fmt(pCTX->hMFC, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, pCTX->codecType,
MAX_DECODER_INPUT_BUFFER_SIZE, width, height);
if (ret != 0) {
LOGE("[%s] S_FMT failed", __func__);
ALOGE("[%s] S_FMT failed", __func__);
ret = MFC_RET_DEC_INIT_FAIL;
goto error_case1;
}
@ -663,7 +663,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecInit(void *openHandle, SSBSIP_MFC_CODEC_TYPE c
ret = v4l2_mfc_s_fmt(pCTX->hMFC, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, NV12MT_FMT,
0, width, height);
if (ret != 0) {
LOGE("[%s] S_FMT failed",__func__);
ALOGE("[%s] S_FMT failed",__func__);
ret = MFC_RET_DEC_INIT_FAIL;
goto error_case1;
}
@ -672,7 +672,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecInit(void *openHandle, SSBSIP_MFC_CODEC_TYPE c
if (packedPB) {
ret = v4l2_mfc_s_ctrl(pCTX->hMFC, V4L2_CID_CODEC_PACKED_PB, 1);
if (ret != 0) {
LOGE("[%s] VIDIOC_S_CTRL failed of PACKED_PB\n", __func__);
ALOGE("[%s] VIDIOC_S_CTRL failed of PACKED_PB\n", __func__);
return MFC_RET_DEC_SET_CONF_FAIL;
}
}
@ -680,7 +680,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecInit(void *openHandle, SSBSIP_MFC_CODEC_TYPE c
ret = v4l2_mfc_qbuf(pCTX->hMFC, &buf, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE,
V4L2_MEMORY_MMAP, pCTX->v4l2_dec.beingUsedIndex, planes, Frameleng);
if (ret != 0) {
LOGE("[%s] VIDIOC_QBUF failed, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE",__func__);
ALOGE("[%s] VIDIOC_QBUF failed, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE",__func__);
ret = MFC_RET_DEC_INIT_FAIL;
goto error_case1;
}
@ -689,7 +689,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecInit(void *openHandle, SSBSIP_MFC_CODEC_TYPE c
on OUTPUT queue */
ret = v4l2_mfc_streamon(pCTX->hMFC, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE);
if (ret != 0) {
LOGE("[%s] VIDIOC_STREAMON failed",__func__);
ALOGE("[%s] VIDIOC_STREAMON failed",__func__);
ret = MFC_RET_DEC_INIT_FAIL;
goto error_case1;
}
@ -707,7 +707,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecInit(void *openHandle, SSBSIP_MFC_CODEC_TYPE c
ret = v4l2_mfc_s_ctrl(pCTX->hMFC, V4L2_CID_CACHEABLE, ctrl_value);
if (ret != 0) {
LOGE("[%s] VIDIOC_S_CTRL failed, V4L2_CID_CACHEABLE", __func__);
ALOGE("[%s] VIDIOC_S_CTRL failed, V4L2_CID_CACHEABLE", __func__);
ret = MFC_RET_DEC_INIT_FAIL;
goto error_case1;
}
@ -715,7 +715,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecInit(void *openHandle, SSBSIP_MFC_CODEC_TYPE c
#ifdef USE_ION
pCTX->ion_fd = ion_client_create();
if (pCTX->ion_fd < 3) {
LOGE("[%s] Failed to get ion_fd : %d", __func__, pCTX->ion_fd);
ALOGE("[%s] Failed to get ion_fd : %d", __func__, pCTX->ion_fd);
ret = MFC_RET_DEC_INIT_FAIL;
goto error_case1;
}
@ -727,7 +727,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecInit(void *openHandle, SSBSIP_MFC_CODEC_TYPE c
ret = v4l2_mfc_streamon(pCTX->hMFC, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE);
if (ret != 0) {
LOGE("[%s] VIDIOC_STREAMON failed (destination buffers)", __func__);
ALOGE("[%s] VIDIOC_STREAMON failed (destination buffers)", __func__);
ret = MFC_RET_DEC_INIT_FAIL;
goto error_case1;
}
@ -741,10 +741,10 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecInit(void *openHandle, SSBSIP_MFC_CODEC_TYPE c
if (ret == 0)
break;
} else if (poll_revents & POLLERR) {
LOGE("[%s] POLLERR\n", __func__);
ALOGE("[%s] POLLERR\n", __func__);
return MFC_GETOUTBUF_STATUS_NULL;
} else {
LOGE("[%s] poll() returns 0x%x\n", __func__, poll_revents);
ALOGE("[%s] poll() returns 0x%x\n", __func__, poll_revents);
return MFC_GETOUTBUF_STATUS_NULL;
}
} else if (poll_state < 0) {
@ -772,7 +772,7 @@ int read_header_data(void *openHandle)
ret = v4l2_mfc_g_fmt(pCTX->hMFC, &fmt, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE);
if (ret != 0) {
LOGE("[%s] VIDIOC_G_FMT failed",__func__);
ALOGE("[%s] VIDIOC_G_FMT failed",__func__);
ret = MFC_RET_DEC_INIT_FAIL;
goto error_case;
}
@ -787,7 +787,7 @@ int read_header_data(void *openHandle)
ret = v4l2_mfc_g_crop(pCTX->hMFC, &crop, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE);
if (ret != 0) {
LOGE("[%s] VIDIOC_G_CROP failed",__func__);
ALOGE("[%s] VIDIOC_G_CROP failed",__func__);
ret = MFC_RET_DEC_INIT_FAIL;
goto error_case;
}
@ -801,14 +801,14 @@ int read_header_data(void *openHandle)
ret = v4l2_mfc_g_ctrl(pCTX->hMFC, V4L2_CID_CODEC_REQ_NUM_BUFS, &ctrl_value);
if (ret != 0) {
LOGE("[%s] VIDIOC_G_CTRL failed",__func__);
ALOGE("[%s] VIDIOC_G_CTRL failed",__func__);
ret = MFC_RET_DEC_INIT_FAIL;
goto error_case;
}
pCTX->v4l2_dec.mfc_num_dst_bufs = ctrl_value + pCTX->dec_numextradpb;
LOGV("[%s] Num of allocated buffers: %d\n",__func__, pCTX->v4l2_dec.mfc_num_dst_bufs);
ALOGV("[%s] Num of allocated buffers: %d\n",__func__, pCTX->v4l2_dec.mfc_num_dst_bufs);
return 0;
@ -829,7 +829,7 @@ int init_mfc_output_stream(void *openHandle)
ret = v4l2_mfc_reqbufs(pCTX->hMFC, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE,
V4L2_MEMORY_MMAP, (int *)&pCTX->v4l2_dec.mfc_num_dst_bufs);
if (ret != 0) {
LOGE("[%s] VIDIOC_REQBUFS failed (destination buffers)",__func__);
ALOGE("[%s] VIDIOC_REQBUFS failed (destination buffers)",__func__);
ret = MFC_RET_DEC_INIT_FAIL;
goto error_case1;
}
@ -838,7 +838,7 @@ int init_mfc_output_stream(void *openHandle)
ret = v4l2_mfc_querybuf(pCTX->hMFC, &buf, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE,
V4L2_MEMORY_MMAP, i, planes);
if (ret != 0) {
LOGE("[%s] VIDIOC_QUERYBUF failed (destination buffers)",__func__);
ALOGE("[%s] VIDIOC_QUERYBUF failed (destination buffers)",__func__);
ret = MFC_RET_DEC_INIT_FAIL;
goto error_case1;
}
@ -864,7 +864,7 @@ int init_mfc_output_stream(void *openHandle)
pCTX->v4l2_dec.mfc_dst_bufs[i][0] = mmap(NULL, buf.m.planes[0].length,
PROT_READ | PROT_WRITE, MAP_SHARED, pCTX->hMFC, buf.m.planes[0].m.mem_offset);
if (pCTX->v4l2_dec.mfc_dst_bufs[i][0] == MAP_FAILED) {
LOGE("[%s] mmap failed (destination buffers (Y))",__func__);
ALOGE("[%s] mmap failed (destination buffers (Y))",__func__);
ret = MFC_RET_DEC_INIT_FAIL;
goto error_case2;
}
@ -872,7 +872,7 @@ int init_mfc_output_stream(void *openHandle)
pCTX->v4l2_dec.mfc_dst_bufs[i][1] = mmap(NULL, buf.m.planes[1].length,
PROT_READ | PROT_WRITE, MAP_SHARED, pCTX->hMFC, buf.m.planes[1].m.mem_offset);
if (pCTX->v4l2_dec.mfc_dst_bufs[i][1] == MAP_FAILED) {
LOGE("[%s] mmap failed (destination buffers (UV))",__func__);
ALOGE("[%s] mmap failed (destination buffers (UV))",__func__);
ret = MFC_RET_DEC_INIT_FAIL;
goto error_case2;
}
@ -881,7 +881,7 @@ int init_mfc_output_stream(void *openHandle)
ret = v4l2_mfc_qbuf(pCTX->hMFC, &buf, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE,
V4L2_MEMORY_MMAP, i, planes, 0);
if (ret != 0) {
LOGE("[%s] VIDIOC_QBUF failed, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE",__func__);
ALOGE("[%s] VIDIOC_QBUF failed, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE",__func__);
ret = MFC_RET_DEC_INIT_FAIL;
goto error_case2;
}
@ -954,12 +954,12 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecExe(void *openHandle, int lengthBufFill)
framecount++;
#endif
if (openHandle == NULL) {
LOGE("[%s] openHandle is NULL",__func__);
ALOGE("[%s] openHandle is NULL",__func__);
return MFC_RET_INVALID_PARAM;
}
if ((lengthBufFill < 0) || (lengthBufFill > MAX_DECODER_INPUT_BUFFER_SIZE)) {
LOGE("[%s] lengthBufFill is invalid. (lengthBufFill=%d)",__func__, lengthBufFill);
ALOGE("[%s] lengthBufFill is invalid. (lengthBufFill=%d)",__func__, lengthBufFill);
return MFC_RET_INVALID_PARAM;
}
@ -973,7 +973,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecExe(void *openHandle, int lengthBufFill)
ret = v4l2_mfc_qbuf(pCTX->hMFC, &buf, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE,
V4L2_MEMORY_MMAP, pCTX->v4l2_dec.beingUsedIndex, planes, lengthBufFill);
if (ret != 0) {
LOGE("[%s] VIDIOC_QBUF failed, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE",__func__);
ALOGE("[%s] VIDIOC_QBUF failed, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE",__func__);
return MFC_RET_DEC_EXE_ERR;
}
@ -996,10 +996,10 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecExe(void *openHandle, int lengthBufFill)
break;
}
} else if (poll_revents & POLLERR) {
LOGE("[%s] POLLERR\n",__func__);
ALOGE("[%s] POLLERR\n",__func__);
return MFC_RET_DEC_EXE_ERR;
} else {
LOGE("[%s] poll() returns 0x%x\n", __func__, poll_revents);
ALOGE("[%s] poll() returns 0x%x\n", __func__, poll_revents);
return MFC_RET_DEC_EXE_ERR;
}
} else if (poll_state < 0) {
@ -1019,7 +1019,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecExe(void *openHandle, int lengthBufFill)
} else {
ret = v4l2_mfc_g_ctrl(pCTX->hMFC, V4L2_CID_CODEC_DISPLAY_STATUS, &ctrl_value);
if (ret != 0) {
LOGE("[%s] VIDIOC_G_CTRL failed", __func__);
ALOGE("[%s] VIDIOC_G_CTRL failed", __func__);
return MFC_RET_DEC_GET_CONF_FAIL;
}
@ -1060,7 +1060,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecExe(void *openHandle, int lengthBufFill)
ret = v4l2_mfc_qbuf(pCTX->hMFC, &buf, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE,
V4L2_MEMORY_MMAP, pCTX->v4l2_dec.beingUsedIndex, planes, 0);
if (ret != 0) {
LOGE("[%s] VIDIOC_QBUF failed, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE",__func__);
ALOGE("[%s] VIDIOC_QBUF failed, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE",__func__);
return MFC_RET_DEC_EXE_ERR;
}
@ -1072,7 +1072,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecExe(void *openHandle, int lengthBufFill)
usleep(1000);
loop_count++;
if (loop_count >= 1000) {
LOGE("[%s] Error in do-while loop",__func__);
ALOGE("[%s] Error in do-while loop",__func__);
break;
}
} while (ret != 0);
@ -1092,7 +1092,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecExe(void *openHandle, int lengthBufFill)
usleep(1000);
loop_count++;
if (loop_count >= 1000) {
LOGE("[%s] Error in do-while loop",__func__);
ALOGE("[%s] Error in do-while loop",__func__);
break;
}
} while (ret != 0);
@ -1151,12 +1151,12 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecExeNb(void *openHandle, int lengthBufFill)
framecount++;
#endif
if (openHandle == NULL) {
LOGE("[%s] openHandle is NULL",__func__);
ALOGE("[%s] openHandle is NULL",__func__);
return MFC_RET_INVALID_PARAM;
}
if ((lengthBufFill < 0) || (lengthBufFill > MAX_DECODER_INPUT_BUFFER_SIZE)) {
LOGE("[%s] lengthBufFill is invalid. (lengthBufFill=%d)",__func__, lengthBufFill);
ALOGE("[%s] lengthBufFill is invalid. (lengthBufFill=%d)",__func__, lengthBufFill);
return MFC_RET_INVALID_PARAM;
}
@ -1167,7 +1167,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecExeNb(void *openHandle, int lengthBufFill)
ret = v4l2_mfc_qbuf(pCTX->hMFC, &buf, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE,
V4L2_MEMORY_MMAP, pCTX->v4l2_dec.beingUsedIndex, planes, lengthBufFill);
if (ret != 0) {
LOGE("[%s] VIDIOC_QBUF failed, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE",__func__);
ALOGE("[%s] VIDIOC_QBUF failed, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE",__func__);
return MFC_RET_DEC_EXE_ERR;
}
} else if (pCTX->v4l2_dec.bBeingFinalized == 0) {
@ -1175,7 +1175,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecExeNb(void *openHandle, int lengthBufFill)
ret = v4l2_mfc_qbuf(pCTX->hMFC, &buf, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE,
V4L2_MEMORY_MMAP, pCTX->v4l2_dec.beingUsedIndex, planes, 0);
if (ret != 0) {
LOGE("[%s] VIDIOC_QBUF failed, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE",__func__);
ALOGE("[%s] VIDIOC_QBUF failed, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE",__func__);
return MFC_RET_DEC_EXE_ERR;
}
}
@ -1198,15 +1198,15 @@ int isBreak_loop(void *openHandle)
ret = v4l2_mfc_g_ctrl(pCTX->hMFC, V4L2_CID_CODEC_CHECK_STATE, &ctrl_value);
if (ret != 0) {
LOGE("[%s] VIDIOC_G_CTRL failed", __func__);
ALOGE("[%s] VIDIOC_G_CTRL failed", __func__);
return 0;
}
if (ctrl_value == MFCSTATE_DEC_RES_DETECT) {
LOGV("[%s] Resolution Change detect",__func__);
ALOGV("[%s] Resolution Change detect",__func__);
return 1;
} else if (ctrl_value == MFCSTATE_DEC_TERMINATING) {
LOGV("[%s] Decoding Finish!!!",__func__);
ALOGV("[%s] Decoding Finish!!!",__func__);
return 1;
}
@ -1243,10 +1243,10 @@ SSBSIP_MFC_DEC_OUTBUF_STATUS SsbSipMfcDecWaitForOutBuf(void *openHandle, SSBSIP_
break;
}
} else if (poll_revents & POLLERR) {
LOGE("[%s] POLLERR\n",__func__);
ALOGE("[%s] POLLERR\n",__func__);
return MFC_GETOUTBUF_STATUS_NULL;
} else {
LOGE("[%s] poll() returns 0x%x\n", __func__, poll_revents);
ALOGE("[%s] poll() returns 0x%x\n", __func__, poll_revents);
return MFC_GETOUTBUF_STATUS_NULL;
}
} else if (poll_state < 0) {
@ -1266,7 +1266,7 @@ SSBSIP_MFC_DEC_OUTBUF_STATUS SsbSipMfcDecWaitForOutBuf(void *openHandle, SSBSIP_
} else {
ret = v4l2_mfc_g_ctrl(pCTX->hMFC, V4L2_CID_CODEC_DISPLAY_STATUS, &ctrl_value);
if (ret != 0) {
LOGE("[%s] VIDIOC_G_CTRL failed", __func__);
ALOGE("[%s] VIDIOC_G_CTRL failed", __func__);
return MFC_RET_DEC_GET_CONF_FAIL;
}
@ -1310,7 +1310,7 @@ SSBSIP_MFC_DEC_OUTBUF_STATUS SsbSipMfcDecWaitForOutBuf(void *openHandle, SSBSIP_
usleep(1000);
loop_count++;
if (loop_count >= 1000) {
LOGE("[%s] Error in do-while loop",__func__);
ALOGE("[%s] Error in do-while loop",__func__);
break;
}
} while (ret != 0);
@ -1330,7 +1330,7 @@ SSBSIP_MFC_DEC_OUTBUF_STATUS SsbSipMfcDecWaitForOutBuf(void *openHandle, SSBSIP_
usleep(1000);
loop_count++;
if (loop_count >= 1000) {
LOGE("[%s] Error in do-while loop",__func__);
ALOGE("[%s] Error in do-while loop",__func__);
break;
}
} while (ret != 0);
@ -1379,12 +1379,12 @@ void *SsbSipMfcDecGetInBuf(void *openHandle, void **phyInBuf, int inputBufferSi
int i;
if (openHandle == NULL) {
LOGE("[%s] openHandle is NULL",__func__);
ALOGE("[%s] openHandle is NULL",__func__);
return NULL;
}
if ((inputBufferSize < 0) || (inputBufferSize > MAX_DECODER_INPUT_BUFFER_SIZE)) {
LOGE("[%s] inputBufferSize = %d is invalid",__func__, inputBufferSize);
ALOGE("[%s] inputBufferSize = %d is invalid",__func__, inputBufferSize);
return NULL;
}
@ -1395,7 +1395,7 @@ void *SsbSipMfcDecGetInBuf(void *openHandle, void **phyInBuf, int inputBufferSi
break;
if (i == MFC_DEC_NUM_SRC_BUFS) {
LOGV("[%s] No buffer is available.",__func__);
ALOGV("[%s] No buffer is available.",__func__);
return NULL;
} else {
pCTX->virStrmBuf = (unsigned int)pCTX->v4l2_dec.mfc_src_bufs[i];
@ -1413,9 +1413,9 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecSetInBuf(void *openHandle, void *phyInBuf, voi
_MFCLIB *pCTX;
int i;
LOGV("[%s] Enter",__func__);
ALOGV("[%s] Enter",__func__);
if (openHandle == NULL) {
LOGE("[%s] openHandle is NULL",__func__);
ALOGE("[%s] openHandle is NULL",__func__);
return MFC_RET_INVALID_PARAM;
}
@ -1427,14 +1427,14 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecSetInBuf(void *openHandle, void *phyInBuf, voi
}
if (i == MFC_DEC_NUM_SRC_BUFS) {
LOGE("[%s] Can not use the buffer",__func__);
ALOGE("[%s] Can not use the buffer",__func__);
return MFC_RET_INVALID_PARAM;
} else {
pCTX->virStrmBuf = (unsigned int)virInBuf;
pCTX->v4l2_dec.beingUsedIndex = i;
pCTX->v4l2_dec.mfc_src_buf_flags[i] = BUF_ENQUEUED;
}
LOGV("[%s] Exit idx %d",__func__,pCTX->v4l2_dec.beingUsedIndex);
ALOGV("[%s] Exit idx %d",__func__,pCTX->v4l2_dec.beingUsedIndex);
return MFC_RET_OK;
}
@ -1443,7 +1443,7 @@ SSBSIP_MFC_DEC_OUTBUF_STATUS SsbSipMfcDecGetOutBuf(void *openHandle, SSBSIP_MFC_
_MFCLIB *pCTX;
if (openHandle == NULL) {
LOGE("[%s] openHandle is NULL",__func__);
ALOGE("[%s] openHandle is NULL",__func__);
return MFC_GETOUTBUF_DISPLAY_END;
}
@ -1495,12 +1495,12 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecSetConfig(void *openHandle, SSBSIP_MFC_DEC_CON
int id, ctrl_value;
if (openHandle == NULL) {
LOGE("[%s] openHandle is NULL",__func__);
ALOGE("[%s] openHandle is NULL",__func__);
return MFC_RET_INVALID_PARAM;
}
if ((value == NULL) && (MFC_DEC_SETCONF_IS_LAST_FRAME !=conf_type)) {
LOGE("[%s] value is NULL",__func__);
ALOGE("[%s] value is NULL",__func__);
return MFC_RET_INVALID_PARAM;
}
@ -1514,8 +1514,8 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecSetConfig(void *openHandle, SSBSIP_MFC_DEC_CON
case MFC_DEC_SETCONF_FIMV1_WIDTH_HEIGHT: /* be set before calling SsbSipMfcDecInit */
fimv1_res = (struct mfc_dec_fimv1_info *)value;
LOGI("fimv1->width = %d\n", fimv1_res->width);
LOGI("fimv1->height = %d\n", fimv1_res->height);
ALOGI("fimv1->width = %d\n", fimv1_res->width);
ALOGI("fimv1->height = %d\n", fimv1_res->height);
pCTX->fimv1_res.width = (int)(fimv1_res->width);
pCTX->fimv1_res.height = (int)(fimv1_res->height);
return MFC_RET_OK;
@ -1531,7 +1531,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecSetConfig(void *openHandle, SSBSIP_MFC_DEC_CON
case MFC_DEC_SETCONF_DPB_FLUSH:
ret = v4l2_mfc_streamoff(pCTX->hMFC, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE);
if (ret != 0) {
LOGE("[%s] VIDIOC_STREAMOFF failed (destination buffers)",__func__);
ALOGE("[%s] VIDIOC_STREAMOFF failed (destination buffers)",__func__);
return MFC_RET_DEC_SET_CONF_FAIL;
}
pCTX->inter_buff_status &= ~(MFC_USE_DST_STREAMON);
@ -1540,14 +1540,14 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecSetConfig(void *openHandle, SSBSIP_MFC_DEC_CON
ret = v4l2_mfc_qbuf(pCTX->hMFC, &buf, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE,
V4L2_MEMORY_MMAP, i, planes, 0);
if (ret != 0) {
LOGE("[%s] VIDIOC_QBUF failed, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE",__func__);
ALOGE("[%s] VIDIOC_QBUF failed, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE",__func__);
return MFC_RET_DEC_SET_CONF_FAIL;
}
}
ret = v4l2_mfc_streamon(pCTX->hMFC, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE);
if (ret != 0) {
LOGE("[%s] VIDIOC_STREAMON failed (destination buffers)",__func__);
ALOGE("[%s] VIDIOC_STREAMON failed (destination buffers)",__func__);
return MFC_RET_DEC_SET_CONF_FAIL;
}
pCTX->inter_buff_status |= MFC_USE_DST_STREAMON;
@ -1585,13 +1585,13 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecSetConfig(void *openHandle, SSBSIP_MFC_DEC_CON
break;
default:
LOGE("[%s] conf_type(%d) is NOT supported",__func__, conf_type);
ALOGE("[%s] conf_type(%d) is NOT supported",__func__, conf_type);
return MFC_RET_INVALID_PARAM;
}
ret = v4l2_mfc_s_ctrl(pCTX->hMFC, id, ctrl_value);
if (ret != 0) {
LOGE("[%s] VIDIOC_S_CTRL failed (conf_type = %d)",__func__, conf_type);
ALOGE("[%s] VIDIOC_S_CTRL failed (conf_type = %d)",__func__, conf_type);
return MFC_RET_DEC_SET_CONF_FAIL;
}
@ -1608,12 +1608,12 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecGetConfig(void *openHandle, SSBSIP_MFC_DEC_CON
SSBSIP_MFC_CROP_INFORMATION *crop_information;
if (openHandle == NULL) {
LOGE("[%s] openHandle is NULL",__func__);
ALOGE("[%s] openHandle is NULL",__func__);
return MFC_RET_INVALID_PARAM;
}
if (value == NULL) {
LOGE("[%s] value is NULL",__func__);
ALOGE("[%s] value is NULL",__func__);
return MFC_RET_INVALID_PARAM;
}
@ -1631,7 +1631,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecGetConfig(void *openHandle, SSBSIP_MFC_DEC_CON
case MFC_DEC_GETCONF_FRAME_TAG:
ret = v4l2_mfc_g_ctrl(pCTX->hMFC, V4L2_CID_CODEC_FRAME_TAG, (int*)value);
if (ret != 0)
LOGE("[%s] VIDIOC_G_CTRL failed, V4L2_CID_CODEC_FRAME_TAG", __func__);
ALOGE("[%s] VIDIOC_G_CTRL failed, V4L2_CID_CODEC_FRAME_TAG", __func__);
break;
case MFC_DEC_GETCONF_CRC_DATA:
@ -1639,17 +1639,17 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecGetConfig(void *openHandle, SSBSIP_MFC_DEC_CON
ret = v4l2_mfc_g_ctrl(pCTX->hMFC, V4L2_CID_CODEC_CRC_DATA_LUMA, &crc_data->luma0);
if (ret != 0) {
LOGE("[%s] VIDIOC_G_CTRL failed, V4L2_CID_CODEC_CRC_DATA_LUMA",__func__);
ALOGE("[%s] VIDIOC_G_CTRL failed, V4L2_CID_CODEC_CRC_DATA_LUMA",__func__);
return MFC_RET_DEC_GET_CONF_FAIL;
}
ret = v4l2_mfc_g_ctrl(pCTX->hMFC, V4L2_CID_CODEC_CRC_DATA_CHROMA, &crc_data->chroma0);
if (ret != 0) {
LOGE("[%s] VIDIOC_G_CTRL failed, V4L2_CID_CODEC_CRC_DATA_CHROMA",__func__);
ALOGE("[%s] VIDIOC_G_CTRL failed, V4L2_CID_CODEC_CRC_DATA_CHROMA",__func__);
return MFC_RET_DEC_GET_CONF_FAIL;
}
LOGI("[%s] crc_data->luma0=0x%x\n", __func__, crc_data->luma0);
LOGI("[%s] crc_data->chroma0=0x%x\n", __func__, crc_data->chroma0);
ALOGI("[%s] crc_data->luma0=0x%x\n", __func__, crc_data->luma0);
ALOGI("[%s] crc_data->chroma0=0x%x\n", __func__, crc_data->chroma0);
break;
case MFC_DEC_GETCONF_CROP_INFO:
@ -1661,7 +1661,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcDecGetConfig(void *openHandle, SSBSIP_MFC_DEC_CON
break;
default:
LOGE("[%s] conf_type(%d) is NOT supported",__func__, conf_type);
ALOGE("[%s] conf_type(%d) is NOT supported",__func__, conf_type);
return MFC_RET_INVALID_PARAM;
}

@ -31,8 +31,8 @@
#include "mfc_interface.h"
#include "SsbSipMfcApi.h"
/* #define LOG_NDEBUG 0 */
#define LOG_TAG "MFC_ENC_APP"
/* #define ALOG_NDEBUG 0 */
#define ALOG_TAG "MFC_ENC_APP"
#include <utils/Log.h>
#define POLL_ENC_WAIT_TIMEOUT 25
@ -70,24 +70,24 @@ void *SsbSipMfcEncOpen(void)
int ret;
struct v4l2_capability cap;
LOGI("[%s] MFC Library Ver %d.%02d",__func__, MFC_LIB_VER_MAJOR, MFC_LIB_VER_MINOR);
ALOGI("[%s] MFC Library Ver %d.%02d",__func__, MFC_LIB_VER_MAJOR, MFC_LIB_VER_MINOR);
getMFCName(mfc_dev_name, 64);
LOGI("[%s] dev name is %s\n",__func__,mfc_dev_name);
ALOGI("[%s] dev name is %s\n",__func__,mfc_dev_name);
if (access(mfc_dev_name, F_OK) != 0) {
LOGE("[%s] MFC device node not exists",__func__);
ALOGE("[%s] MFC device node not exists",__func__);
return NULL;
}
hMFCOpen = open(mfc_dev_name, O_RDWR | O_NONBLOCK, 0);
if (hMFCOpen < 0) {
LOGE("[%s] Failed to open MFC device",__func__);
ALOGE("[%s] Failed to open MFC device",__func__);
return NULL;
}
pCTX = (_MFCLIB *)malloc(sizeof(_MFCLIB));
if (pCTX == NULL) {
LOGE("[%s] malloc failed.",__func__);
ALOGE("[%s] malloc failed.",__func__);
return NULL;
}
memset(pCTX, 0, sizeof(_MFCLIB));
@ -97,28 +97,28 @@ void *SsbSipMfcEncOpen(void)
memset(&cap, 0, sizeof(cap));
ret = ioctl(pCTX->hMFC, VIDIOC_QUERYCAP, &cap);
if (ret != 0) {
LOGE("[%s] VIDIOC_QUERYCAP failed",__func__);
ALOGE("[%s] VIDIOC_QUERYCAP failed",__func__);
close(pCTX->hMFC);
free(pCTX);
return NULL;
}
if (!(cap.capabilities & V4L2_CAP_VIDEO_CAPTURE)) {
LOGE("[%s] Device does not support capture",__func__);
ALOGE("[%s] Device does not support capture",__func__);
close(pCTX->hMFC);
free(pCTX);
return NULL;
}
if (!(cap.capabilities & V4L2_CAP_VIDEO_OUTPUT)) {
LOGE("[%s] Device does not support output",__func__);
ALOGE("[%s] Device does not support output",__func__);
close(pCTX->hMFC);
free(pCTX);
return NULL;
}
if (!(cap.capabilities & V4L2_CAP_STREAMING)) {
LOGE("[%s] Device does not support streaming",__func__);
ALOGE("[%s] Device does not support streaming",__func__);
close(pCTX->hMFC);
free(pCTX);
return NULL;
@ -145,13 +145,13 @@ void *SsbSipMfcEncOpenExt(void *value)
pCTX->cacheablebuffer = NO_CACHE;
/* physical address is used for Input source */
pCTX->v4l2_enc.bInputPhyVir = 1;
LOGI("[%s] non cacheable buffer",__func__);
ALOGI("[%s] non cacheable buffer",__func__);
}
else {
pCTX->cacheablebuffer = CACHE;
/* vitual address is used for Input source */
pCTX->v4l2_enc.bInputPhyVir = 0;
LOGI("[%s] cacheable buffer",__func__);
ALOGI("[%s] cacheable buffer",__func__);
}
return (void *)pCTX;
@ -165,7 +165,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncClose(void *openHandle)
enum v4l2_buf_type type;
if (openHandle == NULL) {
LOGE("[%s] openHandle is NULL",__func__);
ALOGE("[%s] openHandle is NULL",__func__);
return MFC_RET_INVALID_PARAM;
}
@ -175,7 +175,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncClose(void *openHandle)
type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
ret = ioctl(pCTX->hMFC, VIDIOC_STREAMOFF, &type);
if (ret != 0) {
LOGE("[%s] VIDIOC_STREAMOFF failed (destination buffers)",__func__);
ALOGE("[%s] VIDIOC_STREAMOFF failed (destination buffers)",__func__);
return MFC_RET_CLOSE_FAIL;
}
pCTX->inter_buff_status &= ~(MFC_USE_DST_STREAMON);
@ -185,7 +185,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncClose(void *openHandle)
type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
ret = ioctl(pCTX->hMFC, VIDIOC_STREAMOFF, &type);
if (ret != 0) {
LOGE("[%s] VIDIOC_STREAMOFF failed (source buffers)",__func__);
ALOGE("[%s] VIDIOC_STREAMOFF failed (source buffers)",__func__);
return MFC_RET_CLOSE_FAIL;
}
pCTX->inter_buff_status &= ~(MFC_USE_SRC_STREAMON);
@ -263,7 +263,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncInit(void *openHandle, void *param)
pCTX->height = h264_arg->SourceHeight;
pCTX->framemap = h264_arg->FrameMap;
} else {
LOGE("[%s] Undefined codec type \n",__func__);
ALOGE("[%s] Undefined codec type \n",__func__);
ret = MFC_RET_INVALID_PARAM;
goto error_case1;
}
@ -574,7 +574,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncInit(void *openHandle, void *param)
break;
default:
LOGE("[%s] Undefined codec type",__func__);
ALOGE("[%s] Undefined codec type",__func__);
ret = MFC_RET_INVALID_PARAM;
goto error_case1;
}
@ -593,7 +593,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncInit(void *openHandle, void *param)
ret = ioctl(pCTX->hMFC, VIDIOC_S_EXT_CTRLS, &ext_ctrls);
if (ret != 0) {
LOGE("[%s] Failed to set extended controls",__func__);
ALOGE("[%s] Failed to set extended controls",__func__);
ret = MFC_RET_ENC_INIT_FAIL;
goto error_case1;
}
@ -630,7 +630,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncInit(void *openHandle, void *param)
#endif
ret = ioctl(pCTX->hMFC, VIDIOC_S_FMT, &fmt);
if (ret != 0) {
LOGE("[%s] S_FMT failed on MFC output stream",__func__);
ALOGE("[%s] S_FMT failed on MFC output stream",__func__);
ret = MFC_RET_ENC_INIT_FAIL;
goto error_case1;
}
@ -649,7 +649,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncInit(void *openHandle, void *param)
fmt.fmt.pix_mp.pixelformat = V4L2_PIX_FMT_H263;
break;
default:
LOGE("[%s] Codec has not been recognised",__func__);
ALOGE("[%s] Codec has not been recognised",__func__);
return MFC_RET_ENC_INIT_FAIL;
}
@ -658,7 +658,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncInit(void *openHandle, void *param)
ret = ioctl(pCTX->hMFC, VIDIOC_S_FMT, &fmt);
if (ret != 0) {
LOGE("[%s] S_FMT failed on MFC output stream",__func__);
ALOGE("[%s] S_FMT failed on MFC output stream",__func__);
ret = MFC_RET_ENC_INIT_FAIL;
goto error_case1;
}
@ -672,7 +672,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncInit(void *openHandle, void *param)
ret = ioctl(pCTX->hMFC, VIDIOC_S_CTRL, &ctrl);
if (ret != 0) {
LOGE("[%s] VIDIOC_S_CTRL failed, V4L2_CID_CACHEABLE",__func__);
ALOGE("[%s] VIDIOC_S_CTRL failed, V4L2_CID_CACHEABLE",__func__);
ret = MFC_RET_ENC_INIT_FAIL;
goto error_case1;
}
@ -688,7 +688,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncInit(void *openHandle, void *param)
ret = ioctl(pCTX->hMFC, VIDIOC_REQBUFS, &reqbuf);
if (ret != 0) {
LOGE("[%s] Reqbufs src ioctl failed",__func__);
ALOGE("[%s] Reqbufs src ioctl failed",__func__);
ret = MFC_RET_ENC_INIT_FAIL;
goto error_case1;
}
@ -706,7 +706,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncInit(void *openHandle, void *param)
ret = ioctl(pCTX->hMFC, VIDIOC_QUERYBUF, &buf);
if (ret != 0) {
LOGE("[%s] Querybuf src ioctl failed",__func__);
ALOGE("[%s] Querybuf src ioctl failed",__func__);
ret = MFC_RET_ENC_INIT_FAIL;
goto error_case2;
}
@ -721,7 +721,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncInit(void *openHandle, void *param)
mmap(NULL, buf.m.planes[0].length, PROT_READ | PROT_WRITE,
MAP_SHARED, pCTX->hMFC, buf.m.planes[0].m.mem_offset);
if (pCTX->v4l2_enc.mfc_src_bufs[i][0] == MAP_FAILED) {
LOGE("[%s] Mmap on src buffer (0) failed",__func__);
ALOGE("[%s] Mmap on src buffer (0) failed",__func__);
ret = MFC_RET_ENC_INIT_FAIL;
goto error_case2;
}
@ -731,13 +731,13 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncInit(void *openHandle, void *param)
MAP_SHARED, pCTX->hMFC, buf.m.planes[1].m.mem_offset);
if (pCTX->v4l2_enc.mfc_src_bufs[i][1] == MAP_FAILED) {
munmap(pCTX->v4l2_enc.mfc_src_bufs[i][0], pCTX->v4l2_enc.mfc_src_bufs_len[0]);
LOGE("[%s] Mmap on src buffer (1) failed",__func__);
ALOGE("[%s] Mmap on src buffer (1) failed",__func__);
ret = MFC_RET_ENC_INIT_FAIL;
goto error_case2;
}
}
} else
LOGV("[%s] Camera Phys src buf %d",__func__,reqbuf.count);
ALOGV("[%s] Camera Phys src buf %d",__func__,reqbuf.count);
for (i = 0; i < pCTX->v4l2_enc.mfc_num_src_bufs; i++)
pCTX->v4l2_enc.mfc_src_buf_flags[i] = BUF_DEQUEUED;
@ -756,7 +756,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncInit(void *openHandle, void *param)
ret = ioctl(pCTX->hMFC, VIDIOC_REQBUFS, &reqbuf);
if (ret != 0) {
LOGE("[%s] Reqbufs dst ioctl failed",__func__);
ALOGE("[%s] Reqbufs dst ioctl failed",__func__);
ret = MFC_RET_ENC_INIT_FAIL;
goto error_case2;
}
@ -773,7 +773,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncInit(void *openHandle, void *param)
ret = ioctl(pCTX->hMFC, VIDIOC_QUERYBUF, &buf);
if (ret != 0) {
LOGE("[%s] Querybuf dst ioctl failed",__func__);
ALOGE("[%s] Querybuf dst ioctl failed",__func__);
ret = MFC_RET_ENC_INIT_FAIL;
goto error_case3;
}
@ -783,14 +783,14 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncInit(void *openHandle, void *param)
mmap(NULL, buf.m.planes[0].length, PROT_READ | PROT_WRITE,
MAP_SHARED, pCTX->hMFC, buf.m.planes[0].m.mem_offset);
if (pCTX->v4l2_enc.mfc_dst_bufs[i] == MAP_FAILED) {
LOGE("[%s] Mmap on dst buffer failed",__func__);
ALOGE("[%s] Mmap on dst buffer failed",__func__);
ret = MFC_RET_ENC_INIT_FAIL;
goto error_case3;
}
ret = ioctl(pCTX->hMFC, VIDIOC_QBUF, &buf);
if (ret != 0) {
LOGE("[%s] VIDIOC_QBUF failed, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE",__func__);
ALOGE("[%s] VIDIOC_QBUF failed, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE",__func__);
ret = MFC_RET_ENC_INIT_FAIL;
goto error_case3;
}
@ -803,7 +803,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncInit(void *openHandle, void *param)
ret = ioctl(pCTX->hMFC, VIDIOC_STREAMON, &type);
if (ret != 0) {
LOGE("[%s] V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, VIDIOC_STREAMON failed",__func__);
ALOGE("[%s] V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, VIDIOC_STREAMON failed",__func__);
ret = MFC_RET_ENC_INIT_FAIL;
goto error_case3;
}
@ -830,11 +830,11 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncInit(void *openHandle, void *param)
if (ret == 0)
break;
} else if (poll_events.revents & POLLERR) { /*POLLERR */
LOGE("[%s] POLLERR\n",__func__);
ALOGE("[%s] POLLERR\n",__func__);
ret = MFC_RET_ENC_INIT_FAIL;
goto error_case3;
} else {
LOGE("[%s] poll() returns 0x%x\n",__func__, poll_events.revents);
ALOGE("[%s] poll() returns 0x%x\n",__func__, poll_events.revents);
ret = MFC_RET_ENC_INIT_FAIL;
goto error_case3;
}
@ -858,11 +858,11 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncInit(void *openHandle, void *param)
ret = ioctl(pCTX->hMFC, VIDIOC_QBUF, &buf);
if (ret != 0) {
LOGE("[%s] VIDIOC_QBUF failed, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE",__func__);
ALOGE("[%s] VIDIOC_QBUF failed, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE",__func__);
ret = MFC_RET_ENC_INIT_FAIL;
goto error_case3;
}
LOGV("[%s] Strm out idx %d",__func__,index);
ALOGV("[%s] Strm out idx %d",__func__,index);
return MFC_RET_OK;
error_case3:
@ -887,7 +887,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncGetInBuf(void *openHandle, SSBSIP_MFC_ENC_INPU
int i;
if (openHandle == NULL) {
LOGE("[%s] openHandle is NULL\n",__func__);
ALOGE("[%s] openHandle is NULL\n",__func__);
return MFC_RET_INVALID_PARAM;
}
@ -916,7 +916,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncGetInBuf(void *openHandle, SSBSIP_MFC_ENC_INPU
break;
if (i == pCTX->v4l2_enc.mfc_num_src_bufs) {
LOGV("[%s] No buffer is available.",__func__);
ALOGV("[%s] No buffer is available.",__func__);
return MFC_RET_ENC_GET_INBUF_FAIL;
} else {
input_info->YPhyAddr = (void*)pCTX->v4l2_enc.mfc_src_phys[i][0];
@ -929,7 +929,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncGetInBuf(void *openHandle, SSBSIP_MFC_ENC_INPU
pCTX->v4l2_enc.mfc_src_buf_flags[i] = BUF_ENQUEUED;
}
}
LOGV("[%s] Input Buffer idx %d",__func__,i);
ALOGV("[%s] Input Buffer idx %d",__func__,i);
return MFC_RET_OK;
}
@ -942,7 +942,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncSetInBuf(void *openHandle, SSBSIP_MFC_ENC_INPU
int ret,i;
if (openHandle == NULL) {
LOGE("[%s] openHandle is NULL\n",__func__);
ALOGE("[%s] openHandle is NULL\n",__func__);
return MFC_RET_INVALID_PARAM;
}
@ -964,14 +964,14 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncSetInBuf(void *openHandle, SSBSIP_MFC_ENC_INPU
MFC dqbuf() */
pCTX->v4l2_enc.beingUsedIndex++;
pCTX->v4l2_enc.beingUsedIndex %= MFC_ENC_NUM_SRC_BUFS;
LOGV("[%s] Phy Input Buffer idx Queued %d",__func__,pCTX->v4l2_enc.beingUsedIndex);
ALOGV("[%s] Phy Input Buffer idx Queued %d",__func__,pCTX->v4l2_enc.beingUsedIndex);
} else {
for (i = 0; i < pCTX->v4l2_enc.mfc_num_src_bufs; i++)
if (pCTX->v4l2_enc.mfc_src_bufs[i][0] == input_info->YVirAddr)
break;
if (i == pCTX->v4l2_enc.mfc_num_src_bufs) {
LOGE("[%s] Can not use the buffer",__func__);
ALOGE("[%s] Can not use the buffer",__func__);
return MFC_RET_INVALID_PARAM;
} else {
pCTX->v4l2_enc.beingUsedIndex = i;
@ -981,7 +981,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncSetInBuf(void *openHandle, SSBSIP_MFC_ENC_INPU
qbuf.index = pCTX->v4l2_enc.beingUsedIndex;
planes[0].bytesused = pCTX->width * pCTX->height;
planes[1].bytesused = (pCTX->width * pCTX->height) >> 1;
LOGV("[%s] Input Buffer idx Queued %d",__func__,pCTX->v4l2_enc.beingUsedIndex);
ALOGV("[%s] Input Buffer idx Queued %d",__func__,pCTX->v4l2_enc.beingUsedIndex);
}
qbuf.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
@ -990,7 +990,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncSetInBuf(void *openHandle, SSBSIP_MFC_ENC_INPU
ret = ioctl(pCTX->hMFC, VIDIOC_QBUF, &qbuf);
if (ret != 0) {
LOGE("[%s] VIDIOC_QBUF failed, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE",__func__);
ALOGE("[%s] VIDIOC_QBUF failed, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE",__func__);
return MFC_RET_ENC_SET_INBUF_FAIL;
}
@ -1005,7 +1005,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncGetOutBuf(void *openHandle, SSBSIP_MFC_ENC_OUT
int ret;
if (openHandle == NULL) {
LOGE("[%s] openHandle is NULL\n",__func__);
ALOGE("[%s] openHandle is NULL\n",__func__);
return MFC_RET_INVALID_PARAM;
}
@ -1022,14 +1022,14 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncGetOutBuf(void *openHandle, SSBSIP_MFC_ENC_OUT
ctrl.value = 0;
ret = ioctl(pCTX->hMFC, VIDIOC_G_CTRL, &ctrl);
if (ret != 0)
LOGE("[%s] Error to do g_ctrl",__func__);
ALOGE("[%s] Error to do g_ctrl",__func__);
encoded_y_addr = (unsigned int)ctrl.value;
ctrl.id = V4L2_CID_CODEC_ENCODED_CHROMA_ADDR;
ctrl.value = 0;
ret = ioctl(pCTX->hMFC, VIDIOC_G_CTRL, &ctrl);
if (ret != 0)
LOGE("[%s] Error to do g_ctrl",__func__);
ALOGE("[%s] Error to do g_ctrl",__func__);
encoded_c_addr = (unsigned int)ctrl.value;
output_info->headerSize = pCTX->encodedHeaderSize;
@ -1045,7 +1045,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncGetOutBuf(void *openHandle, SSBSIP_MFC_ENC_OUT
SSBSIP_MFC_ERROR_CODE SsbSipMfcEncSetOutBuf(void *openHandle, void *phyOutbuf, void *virOutbuf, int outputBufferSize)
{
if (openHandle == NULL) {
LOGE("[%s] openHandle is NULL\n",__func__);
ALOGE("[%s] openHandle is NULL\n",__func__);
return MFC_RET_INVALID_PARAM;
}
@ -1068,9 +1068,9 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncExe(void *openHandle)
struct pollfd poll_events;
int poll_state;
LOGV("[%s] Enter \n",__func__);
ALOGV("[%s] Enter \n",__func__);
if (openHandle == NULL) {
LOGE("[%s] openHandle is NULL\n",__func__);
ALOGE("[%s] openHandle is NULL\n",__func__);
return MFC_RET_INVALID_PARAM;
}
@ -1081,7 +1081,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncExe(void *openHandle)
ret = ioctl(pCTX->hMFC, VIDIOC_S_CTRL, &ctrl);
if (ret != 0) {
LOGE("[%s] VIDIOC_S_CTRL failed, V4L2_CID_CODEC_FRAME_TAG",__func__);
ALOGE("[%s] VIDIOC_S_CTRL failed, V4L2_CID_CODEC_FRAME_TAG",__func__);
return MFC_RET_ENC_EXE_ERR;
}
@ -1089,7 +1089,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncExe(void *openHandle)
type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
ret = ioctl(pCTX->hMFC, VIDIOC_STREAMON, &type);
if (ret != 0) {
LOGE("[%s] VIDIOC_STREAMON failed, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE",__func__);
ALOGE("[%s] VIDIOC_STREAMON failed, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE",__func__);
return MFC_RET_ENC_EXE_ERR;
}
@ -1118,20 +1118,20 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncExe(void *openHandle)
if (ret == 0)
break;
} else if (poll_events.revents & POLLERR) { /* POLLERR */
LOGE("[%s] POLLERR\n",__func__);
ALOGE("[%s] POLLERR\n",__func__);
return MFC_RET_ENC_EXE_ERR;
} else {
LOGE("[%s] poll() returns 0x%x\n",__func__, poll_events.revents);
ALOGE("[%s] poll() returns 0x%x\n",__func__, poll_events.revents);
return MFC_RET_ENC_EXE_ERR;
}
} else if (0 > poll_state) {
LOGE("[%s] poll() Encoder POLL Timeout 0x%x\n",__func__, poll_events.revents);
ALOGE("[%s] poll() Encoder POLL Timeout 0x%x\n",__func__, poll_events.revents);
return MFC_RET_ENC_EXE_ERR;
} else { /* in the case of B frame encoding */
ctrl.id = V4L2_CID_CODEC_CHECK_STATE;
ctrl.value = 0;
ret = ioctl(pCTX->hMFC, VIDIOC_G_CTRL, &ctrl);
LOGV("[%s] ctx state = %d\n",__func__, ctrl.value);
ALOGV("[%s] ctx state = %d\n",__func__, ctrl.value);
if (ctrl.value == MFCSTATE_ENC_NO_OUTPUT)
return MFC_RET_OK;
}
@ -1140,7 +1140,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncExe(void *openHandle)
if (pCTX->v4l2_enc.bRunning != 0) {
pCTX->encodedframeType = (qbuf.flags & 0x38) >> 3; /* encoded frame type */
LOGV("[%s] encoded frame type = %d\n", __func__, pCTX->encodedframeType);
ALOGV("[%s] encoded frame type = %d\n", __func__, pCTX->encodedframeType);
switch (pCTX->encodedframeType) {
case 1:
@ -1153,7 +1153,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncExe(void *openHandle)
pCTX->encodedframeType = MFC_FRAME_TYPE_B_FRAME;
break;
default:
LOGE("[%s] VIDIOC_DQBUF failed, encoded frame type is wrong",__func__);
ALOGE("[%s] VIDIOC_DQBUF failed, encoded frame type is wrong",__func__);
}
}
@ -1168,7 +1168,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncExe(void *openHandle)
ret = ioctl(pCTX->hMFC, VIDIOC_G_CTRL, &ctrl);
if (ret != 0) {
LOGE("[%s] VIDIOC_G_CTRL failed, V4L2_CID_CODEC_FRAME_TAG",__func__);
ALOGE("[%s] VIDIOC_G_CTRL failed, V4L2_CID_CODEC_FRAME_TAG",__func__);
return MFC_RET_ENC_EXE_ERR;
}
@ -1183,7 +1183,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncExe(void *openHandle)
ret = ioctl(pCTX->hMFC, VIDIOC_QBUF, &qbuf);
if (ret != 0) {
LOGE("[%s] VIDIOC_QBUF failed, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE",__func__);
ALOGE("[%s] VIDIOC_QBUF failed, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE",__func__);
return MFC_RET_ENC_EXE_ERR;
}
@ -1198,7 +1198,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncExe(void *openHandle)
ret = ioctl(pCTX->hMFC, VIDIOC_DQBUF, &qbuf);
if (ret != 0) {
LOGE("[%s] VIDIOC_DQBUF failed, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE",__func__);
ALOGE("[%s] VIDIOC_DQBUF failed, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE",__func__);
return MFC_RET_ENC_EXE_ERR;
}
}
@ -1206,7 +1206,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncExe(void *openHandle)
/* Update context stream buffer address */
pCTX->virStrmBuf = pCTX->v4l2_enc.mfc_dst_bufs[dequeued_index];
LOGV("[%s] Strm out idx %d",__func__,dequeued_index);
ALOGV("[%s] Strm out idx %d",__func__,dequeued_index);
return MFC_RET_OK;
}
@ -1219,12 +1219,12 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncSetConfig(void *openHandle, SSBSIP_MFC_ENC_CON
int ret;
if (openHandle == NULL) {
LOGE("[%s] openHandle is NULL\n",__func__);
ALOGE("[%s] openHandle is NULL\n",__func__);
return MFC_RET_INVALID_PARAM;
}
if (value == NULL) {
LOGE("[%s] value is NULL\n",__func__);
ALOGE("[%s] value is NULL\n",__func__);
return MFC_RET_INVALID_PARAM;
}
@ -1274,13 +1274,13 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncSetConfig(void *openHandle, SSBSIP_MFC_ENC_CON
return MFC_RET_OK;
default:
LOGE("[%s] conf_type(%d) is NOT supported\n",__func__, conf_type);
ALOGE("[%s] conf_type(%d) is NOT supported\n",__func__, conf_type);
return MFC_RET_INVALID_PARAM;
}
ret = ioctl(pCTX->hMFC, VIDIOC_S_CTRL, &ctrl);
if (ret != 0) {
LOGE("[%s] VIDIOC_S_CTRL failed (conf_type = %d)",__func__, conf_type);
ALOGE("[%s] VIDIOC_S_CTRL failed (conf_type = %d)",__func__, conf_type);
return MFC_RET_ENC_SET_CONF_FAIL;
}
@ -1294,12 +1294,12 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncGetConfig(void *openHandle, SSBSIP_MFC_ENC_CON
pCTX = (_MFCLIB *) openHandle;
if (openHandle == NULL) {
LOGE("[%s] openHandle is NULL\n",__func__);
ALOGE("[%s] openHandle is NULL\n",__func__);
return MFC_RET_INVALID_PARAM;
}
if (value == NULL) {
LOGE("[%s] value is NULL\n",__func__);
ALOGE("[%s] value is NULL\n",__func__);
return MFC_RET_INVALID_PARAM;
}
@ -1309,7 +1309,7 @@ SSBSIP_MFC_ERROR_CODE SsbSipMfcEncGetConfig(void *openHandle, SSBSIP_MFC_ENC_CON
break;
default:
LOGE("[%s] conf_type(%d) is NOT supported\n",__func__, conf_type);
ALOGE("[%s] conf_type(%d) is NOT supported\n",__func__, conf_type);
return MFC_RET_INVALID_PARAM;
}

@ -7,7 +7,7 @@ LOCAL_SRC_FILES := \
LOCAL_CFLAGS += $(PV_CFLAGS_MINUS_VISIBILITY)
LOCAL_C_INCLUDES:= \
$(TOP)/frameworks/base/include/media/stagefright/openmax \
$(TOP)/frameworks/native/include/media/openmax \
LOCAL_SHARED_LIBRARIES := \
libbinder \
@ -15,7 +15,7 @@ LOCAL_SHARED_LIBRARIES := \
libcutils \
libui \
libdl \
libsurfaceflinger_client
libstagefright_foundation
LOCAL_MODULE := libstagefrighthw

@ -18,8 +18,8 @@
#include <dlfcn.h>
#include <media/stagefright/HardwareAPI.h>
#include <media/stagefright/MediaDebug.h>
#include <media/hardware/HardwareAPI.h>
#include <media/stagefright/foundation/ADebug.h>
namespace android {

@ -18,7 +18,7 @@
#define SEC_OMX_PLUGIN
#include <media/stagefright/OMXPluginBase.h>
#include <media/hardware/OMXPluginBase.h>
namespace android {

@ -31,7 +31,6 @@ LOCAL_SHARED_LIBRARIES := libcutils libutils \
libui \
libhardware \
libandroid_runtime \
libsurfaceflinger_client \
libbinder \
libmedia

@ -29,13 +29,13 @@
#include <stdio.h>
#include <stdlib.h>
#include <ui/android_native_buffer.h>
#include <ui/GraphicBuffer.h>
#include <ui/GraphicBufferMapper.h>
#include <ui/Rect.h>
#include <media/stagefright/HardwareAPI.h>
#include <media/hardware/HardwareAPI.h>
#include <hardware/hardware.h>
#include <media/stagefright/MetadataBufferType.h>
#include <media/hardware/MetadataBufferType.h>
#include "SEC_OSAL_Semaphore.h"
#include "SEC_OMX_Baseport.h"

@ -52,7 +52,7 @@ void *csc_fimc_open()
if (hw_converter->bHWconvert_flag == 0) {
delete hw_converter;
hw_converter = NULL;
LOGE("%s LINE = %d HardwareConverter failed", __func__, __LINE__);
ALOGE("%s LINE = %d HardwareConverter failed", __func__, __LINE__);
}
return (void *)hw_converter;

@ -67,21 +67,21 @@ void *csc_fimc_open()
hdl = dlopen("libfimc.so", RTLD_NOW);
if (hdl == NULL) {
LOGE("%s:: load libfimc.so failed", __func__);
ALOGE("%s:: load libfimc.so failed", __func__);
return NULL;
}
create_instance = (SecFimc *(*)())dlsym(hdl, "create_instance");
handle_fimc = (SecFimc *)create_instance();
if (handle_fimc == NULL) {
LOGE("%s:: create handle_fimc failed", __func__);
ALOGE("%s:: create handle_fimc failed", __func__);
return NULL;
}
if (!handle_fimc->create(SecFimc::DEV_1, SecFimc::MODE_MULTI_BUF, 1)) {
destroy_instance = (void (*)(void *))dlsym(hdl, "destroy_instance");
destroy_instance(handle_fimc);
LOGE("%s:: create() failed", __func__);
ALOGE("%s:: create() failed", __func__);
return NULL;
}
return (void *)handle_fimc;
@ -103,13 +103,13 @@ CSC_FIMC_ERROR_CODE csc_fimc_close(void *handle)
void* hdl = NULL;
if (!handle_fimc->destroy()) {
LOGE("%s:: destroy() failed", __func__);
ALOGE("%s:: destroy() failed", __func__);
return CSC_FIMC_RET_FAIL;
}
hdl = dlopen("libfimc.so", RTLD_NOW);
if (hdl == NULL) {
LOGE("%s:: load libfimc.so failed", __func__);
ALOGE("%s:: load libfimc.so failed", __func__);
return CSC_FIMC_RET_FAIL;
}
@ -172,7 +172,7 @@ CSC_FIMC_ERROR_CODE csc_fimc_convert_nv12t(
if (!handle_fimc->setSrcParams(width, height, src_crop_x, src_crop_y,
&src_crop_width, &src_crop_height,
HAL_PIXEL_FORMAT_CUSTOM_YCbCr_420_SP_TILED)) {
LOGE("%s:: setSrcParms() failed", __func__);
ALOGE("%s:: setSrcParms() failed", __func__);
return CSC_FIMC_RET_FAIL;
}
@ -180,19 +180,19 @@ CSC_FIMC_ERROR_CODE csc_fimc_convert_nv12t(
(unsigned int)src_addr[1],
(unsigned int)src_addr[1],
HAL_PIXEL_FORMAT_CUSTOM_YCbCr_420_SP_TILED)) {
LOGE("%s:: setSrcPhyAddr() failed", __func__);
ALOGE("%s:: setSrcPhyAddr() failed", __func__);
return CSC_FIMC_RET_FAIL;
}
if (!handle_fimc->setRotVal(rotate_value)) {
LOGE("%s:: setRotVal() failed", __func__);
ALOGE("%s:: setRotVal() failed", __func__);
return CSC_FIMC_RET_FAIL;
}
if (!handle_fimc->setDstParams(width, height, dst_crop_x, dst_crop_y,
&dst_crop_width, &dst_crop_height,
HarPixelformat)) {
LOGE("%s:: setDstParams() failed", __func__);
ALOGE("%s:: setDstParams() failed", __func__);
return CSC_FIMC_RET_FAIL;
}
@ -201,7 +201,7 @@ CSC_FIMC_ERROR_CODE csc_fimc_convert_nv12t(
if (!handle_fimc->setDstAddr((unsigned int)(dst_addr[0]),
(unsigned int)(dst_addr[1]),
(unsigned int)(dst_addr[1]))) {
LOGE("%s:: setDstPhyAddr() failed", __func__);
ALOGE("%s:: setDstPhyAddr() failed", __func__);
return CSC_FIMC_RET_FAIL;
}
break;
@ -210,14 +210,14 @@ CSC_FIMC_ERROR_CODE csc_fimc_convert_nv12t(
if (!handle_fimc->setDstAddr((unsigned int)(dst_addr[0]),
(unsigned int)(dst_addr[1]),
(unsigned int)(dst_addr[2]))) {
LOGE("%s:: setDstPhyAddr() failed", __func__);
ALOGE("%s:: setDstPhyAddr() failed", __func__);
return CSC_FIMC_RET_FAIL;
}
break;
}
if (!handle_fimc->draw(0, 0)) {
LOGE("%s:: handleOneShot() failed", __func__);
ALOGE("%s:: handleOneShot() failed", __func__);
return CSC_FIMC_RET_FAIL;
}

@ -130,7 +130,7 @@ inline int HAL_PIXEL_FORMAT_2_V4L2_PIX(int HAL_PIXEL_FORMAT)
break;
default:
LOGE("%s::unmatched HAL_PIXEL_FORMAT color_space(0x%x)\n",
ALOGE("%s::unmatched HAL_PIXEL_FORMAT color_space(0x%x)\n",
__func__, HAL_PIXEL_FORMAT);
break;
}
@ -212,7 +212,7 @@ inline int V4L2_PIX_2_HAL_PIXEL_FORMAT(int V4L2_PIX)
break;
default:
LOGE("%s::unmatched V4L2_PIX color_space(%d)\n",
ALOGE("%s::unmatched V4L2_PIX color_space(%d)\n",
__func__, V4L2_PIX);
break;
}
@ -287,7 +287,7 @@ inline unsigned int FRAME_SIZE(int HAL_PIXEL_FORMAT, int w, int h)
break;
default:
LOGD("%s::no matching source colorformat(0x%x), w(%d), h(%d) fail\n",
ALOGD("%s::no matching source colorformat(0x%x), w(%d), h(%d) fail\n",
__func__, HAL_PIXEL_FORMAT, w, h);
break;
}

@ -152,7 +152,7 @@ inline int HAL_PIXEL_FORMAT_2_V4L2_PIX(int HAL_PIXEL_FORMAT)
break;
default:
LOGE("%s::unmatched HAL_PIXEL_FORMAT color_space(0x%x)\n",
ALOGE("%s::unmatched HAL_PIXEL_FORMAT color_space(0x%x)\n",
__func__, HAL_PIXEL_FORMAT);
break;
}
@ -240,7 +240,7 @@ inline int V4L2_PIX_2_HAL_PIXEL_FORMAT(int V4L2_PIX)
break;
default:
LOGE("%s::unmatched V4L2_PIX color_space(%d)\n",
ALOGE("%s::unmatched V4L2_PIX color_space(%d)\n",
__func__, V4L2_PIX);
break;
}
@ -316,7 +316,7 @@ inline unsigned int FRAME_SIZE(int HAL_PIXEL_FORMAT, int w, int h)
break;
default:
LOGD("%s::no matching source colorformat(0x%x), w(%d), h(%d) fail\n",
ALOGD("%s::no matching source colorformat(0x%x), w(%d), h(%d) fail\n",
__func__, HAL_PIXEL_FORMAT, w, h);
break;
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -29,7 +29,7 @@
* Adjust V4L2 architecture \n
*/
#define LOG_TAG "libfimc"
#define ALOG_TAG "libfimc"
#include <cutils/log.h>
#include "SecFimc.h"
@ -86,67 +86,67 @@ struct yuv_fmt_list yuv_list[] = {
#ifdef BOARD_USE_V4L2
void dump_pixfmt_mp(struct v4l2_pix_format_mplane *pix_mp)
{
LOGI("w: %d", pix_mp->width);
LOGI("h: %d", pix_mp->height);
LOGI("color: %x", pix_mp->colorspace);
ALOGI("w: %d", pix_mp->width);
ALOGI("h: %d", pix_mp->height);
ALOGI("color: %x", pix_mp->colorspace);
switch (pix_mp->pixelformat) {
case V4L2_PIX_FMT_YUYV:
LOGI ("YUYV");
ALOGI ("YUYV");
break;
case V4L2_PIX_FMT_UYVY:
LOGI ("UYVY");
ALOGI ("UYVY");
break;
case V4L2_PIX_FMT_RGB565:
LOGI ("RGB565");
ALOGI ("RGB565");
break;
case V4L2_PIX_FMT_RGB565X:
LOGI ("RGB565X");
ALOGI ("RGB565X");
break;
default:
LOGI("not supported");
ALOGI("not supported");
}
}
#endif
void dump_pixfmt(struct v4l2_pix_format *pix)
{
LOGI("w: %d", pix->width);
LOGI("h: %d", pix->height);
LOGI("color: %x", pix->colorspace);
ALOGI("w: %d", pix->width);
ALOGI("h: %d", pix->height);
ALOGI("color: %x", pix->colorspace);
switch (pix->pixelformat) {
case V4L2_PIX_FMT_YUYV:
LOGI ("YUYV");
ALOGI ("YUYV");
break;
case V4L2_PIX_FMT_UYVY:
LOGI ("UYVY");
ALOGI ("UYVY");
break;
case V4L2_PIX_FMT_RGB565:
LOGI ("RGB565");
ALOGI ("RGB565");
break;
case V4L2_PIX_FMT_RGB565X:
LOGI ("RGB565X");
ALOGI ("RGB565X");
break;
default:
LOGI("not supported");
ALOGI("not supported");
}
}
void dump_crop(struct v4l2_crop *crop)
{
LOGI("crop l: %d", crop->c.left);
LOGI("crop t: %d", crop->c.top);
LOGI("crop w: %d", crop->c.width);
LOGI("crop h: %d", crop->c.height);
ALOGI("crop l: %d", crop->c.left);
ALOGI("crop t: %d", crop->c.top);
ALOGI("crop w: %d", crop->c.width);
ALOGI("crop h: %d", crop->c.height);
}
void dump_window(struct v4l2_window *win)
{
LOGI("window l: %d", win->w.left);
LOGI("window t: %d", win->w.top);
LOGI("window w: %d", win->w.width);
LOGI("window h: %d", win->w.height);
ALOGI("window l: %d", win->w.left);
ALOGI("window t: %d", win->w.top);
ALOGI("window w: %d", win->w.width);
ALOGI("window h: %d", win->w.height);
}
void v4l2_overlay_dump_state(int fd)
@ -158,7 +158,7 @@ void v4l2_overlay_dump_state(int fd)
if (ioctl(fd, VIDIOC_G_FMT, &format) < 0)
return;
LOGI("dumping driver state:");
ALOGI("dumping driver state:");
#ifdef BOARD_USE_V4L2
dump_pixfmt_mp(&format.fmt.pix_mp);
#else
@ -169,14 +169,14 @@ void v4l2_overlay_dump_state(int fd)
if (ioctl(fd, VIDIOC_G_CROP, &crop) < 0)
return;
LOGI("input window(crop):");
ALOGI("input window(crop):");
dump_crop(&crop);
crop.type = V4L2_BUF_TYPE_CAPTURE;
if (ioctl(fd, VIDIOC_G_CROP, &crop) < 0)
return;
LOGI("output crop:");
ALOGI("output crop:");
dump_crop(&crop);
}
@ -193,7 +193,7 @@ int fimc_v4l2_query_buf(int fd, SecBuffer *secBuf, enum v4l2_buf_type type, enum
#endif
if (MAX_DST_BUFFERS <= buf_index || MAX_PLANES <= num_plane) {
LOGE("%s::exceed MAX! : buf_index=%d, num_plane=%d", __func__, buf_index, num_plane);
ALOGE("%s::exceed MAX! : buf_index=%d, num_plane=%d", __func__, buf_index, num_plane);
return -1;
}
@ -206,7 +206,7 @@ int fimc_v4l2_query_buf(int fd, SecBuffer *secBuf, enum v4l2_buf_type type, enum
#endif
if (ioctl(fd, VIDIOC_QUERYBUF, &buf) < 0) {
LOGE("%s::VIDIOC_QUERYBUF failed, plane_cnt=%d", __func__, buf.length);
ALOGE("%s::VIDIOC_QUERYBUF failed, plane_cnt=%d", __func__, buf.length);
return -1;
}
@ -217,11 +217,11 @@ int fimc_v4l2_query_buf(int fd, SecBuffer *secBuf, enum v4l2_buf_type type, enum
if ((secBuf->virt.extP[i] = (char *)mmap(0, buf.m.planes[i].length,
PROT_READ | PROT_WRITE, MAP_SHARED, fd, buf.m.planes[i].m.mem_offset)) < 0) {
LOGE("%s::mmap failed", __func__);
LOGE("%s::Offset = 0x%x", __func__, buf.m.planes[i].m.mem_offset);
LOGE("%s::Legnth = %d" , __func__, buf.m.planes[i].length);
LOGE("%s::vaddr[%d][%d] = 0x%x", __func__, buf_index, i, (unsigned int)secBuf->virt.extP[i]);
LOGE("%s::paddr[%d][%d] = 0x%x", __func__, buf_index, i, (unsigned int)secBuf->phys.extP[i]);
ALOGE("%s::mmap failed", __func__);
ALOGE("%s::Offset = 0x%x", __func__, buf.m.planes[i].m.mem_offset);
ALOGE("%s::Legnth = %d" , __func__, buf.m.planes[i].length);
ALOGE("%s::vaddr[%d][%d] = 0x%x", __func__, buf_index, i, (unsigned int)secBuf->virt.extP[i]);
ALOGE("%s::paddr[%d][%d] = 0x%x", __func__, buf_index, i, (unsigned int)secBuf->phys.extP[i]);
return -1;
}
}
@ -230,10 +230,10 @@ int fimc_v4l2_query_buf(int fd, SecBuffer *secBuf, enum v4l2_buf_type type, enum
if ((secBuf->virt.p = (char *)mmap(0, buf.length,
PROT_READ | PROT_WRITE, MAP_SHARED, fd, buf.m.offset)) < 0) {
LOGE("%s::mmap failed", __func__);
ALOGE("%s::mmap failed", __func__);
return -1;
}
LOGI("%s::buffers[%d] vaddr = 0x%x", __func__, buf_index, (unsigned int)secBuf->virt.p);
ALOGI("%s::buffers[%d] vaddr = 0x%x", __func__, buf_index, (unsigned int)secBuf->virt.p);
#endif
return 0;
@ -248,16 +248,16 @@ int fimc_v4l2_req_buf(int fd, unsigned int num_bufs, enum v4l2_buf_type type, en
reqbuf.count = num_bufs;
if (ioctl(fd, VIDIOC_REQBUFS, &reqbuf) < 0) {
LOGE("%s::VIDIOC_REQBUFS failed", __func__);
ALOGE("%s::VIDIOC_REQBUFS failed", __func__);
return -1;
}
#ifdef DEBUG_LIB_FIMC
LOGI("%d buffers allocated %d requested", reqbuf.count, 4);
ALOGI("%d buffers allocated %d requested", reqbuf.count, 4);
#endif
if (reqbuf.count < num_bufs) {
LOGE("%s::VIDIOC_REQBUFS failed ((reqbuf.count(%d) < num_bufs(%d))",
ALOGE("%s::VIDIOC_REQBUFS failed ((reqbuf.count(%d) < num_bufs(%d))",
__func__, reqbuf.count, num_bufs);
return -1;
}
@ -272,7 +272,7 @@ int fimc_v4l2_s_ctrl(int fd, int id, int value)
vc.value = value;
if (ioctl(fd, VIDIOC_S_CTRL, &vc) < 0) {
LOGE("%s::VIDIOC_S_CTRL (id=%d,value=%d) failed", __func__, id, value);
ALOGE("%s::VIDIOC_S_CTRL (id=%d,value=%d) failed", __func__, id, value);
return -1;
}
@ -289,7 +289,7 @@ int fimc_v4l2_set_fmt(int fd, enum v4l2_buf_type type, enum v4l2_field field, s5
fmt.type = type;
if (ioctl(fd, VIDIOC_G_FMT, &fmt) < 0) {
LOGE("%s::VIDIOC_G_FMT failed", __func__);
ALOGE("%s::VIDIOC_G_FMT failed", __func__);
return -1;
}
@ -313,7 +313,7 @@ int fimc_v4l2_set_fmt(int fd, enum v4l2_buf_type type, enum v4l2_field field, s5
#endif
case V4L2_BUF_TYPE_VIDEO_OVERLAY:
if (ioctl(fd, VIDIOC_G_FBUF, &fbuf) < 0) {
LOGE("%s::VIDIOC_G_FBUF failed", __func__);
ALOGE("%s::VIDIOC_G_FBUF failed", __func__);
return -1;
}
@ -323,7 +323,7 @@ int fimc_v4l2_set_fmt(int fd, enum v4l2_buf_type type, enum v4l2_field field, s5
fbuf.fmt.pixelformat = img_info->color_space;
if (ioctl(fd, VIDIOC_S_FBUF, &fbuf) < 0) {
LOGE("%s::VIDIOC_S_FBUF (w=%d, h=%d, color=%d) failed",
ALOGE("%s::VIDIOC_S_FBUF (w=%d, h=%d, color=%d) failed",
__func__,
img_info->full_width,
img_info->full_height,
@ -339,7 +339,7 @@ int fimc_v4l2_set_fmt(int fd, enum v4l2_buf_type type, enum v4l2_field field, s5
vc.value = (unsigned int)&fimc_dst_buf.base[0];
if (ioctl(fd, VIDIOC_S_CTRL, &vc) < 0) {
LOGE("%s::VIDIOC_S_CTRL (id=%d,value=%d) failed", __func__, vc.id, vc.value);
ALOGE("%s::VIDIOC_S_CTRL (id=%d,value=%d) failed", __func__, vc.id, vc.value);
return -1;
}
@ -349,13 +349,13 @@ int fimc_v4l2_set_fmt(int fd, enum v4l2_buf_type type, enum v4l2_field field, s5
fmt.fmt.win.w.height = img_info->height;
break;
default:
LOGE("invalid buffer type");
ALOGE("invalid buffer type");
return -1;
break;
}
if (ioctl(fd, VIDIOC_S_FMT, &fmt) < 0) {
LOGE("%s::VIDIOC_S_FMT failed", __func__);
ALOGE("%s::VIDIOC_S_FMT failed", __func__);
return -1;
}
@ -367,7 +367,7 @@ int fimc_v4l2_set_fmt(int fd, enum v4l2_buf_type type, enum v4l2_field field, s5
crop.c.height = img_info->height;
if (ioctl(fd, VIDIOC_S_CROP, &crop) < 0) {
LOGE("%s::VIDIOC_S_CROP (x=%d, y=%d, w=%d, h=%d) failed",
ALOGE("%s::VIDIOC_S_CROP (x=%d, y=%d, w=%d, h=%d) failed",
__func__,
img_info->start_x,
img_info->start_y,
@ -383,7 +383,7 @@ int fimc_v4l2_set_fmt(int fd, enum v4l2_buf_type type, enum v4l2_field field, s5
int fimc_v4l2_stream_on(int fd, enum v4l2_buf_type type)
{
if (ioctl(fd, VIDIOC_STREAMON, &type) < 0) {
LOGE("%s::VIDIOC_STREAMON failed", __func__);
ALOGE("%s::VIDIOC_STREAMON failed", __func__);
return -1;
}
@ -425,7 +425,7 @@ int fimc_v4l2_queue(int fd, SecBuffer *secBuf, enum v4l2_buf_type type, enum v4l
#endif
if (ioctl(fd, VIDIOC_QBUF, &buf) < 0) {
LOGE("%s::VIDIOC_QBUF failed", __func__);
ALOGE("%s::VIDIOC_QBUF failed", __func__);
return -1;
}
@ -450,7 +450,7 @@ int fimc_v4l2_dequeue(int fd, enum v4l2_buf_type type, enum v4l2_memory memory,
buf.m.planes = planes;
#endif
if (ioctl(fd, VIDIOC_DQBUF, &buf) < 0) {
LOGE("%s::VIDIOC_DQBUF failed", __func__);
ALOGE("%s::VIDIOC_DQBUF failed", __func__);
return -1;
}
*index = buf.index;
@ -461,7 +461,7 @@ int fimc_v4l2_dequeue(int fd, enum v4l2_buf_type type, enum v4l2_memory memory,
int fimc_v4l2_stream_off(int fd, enum v4l2_buf_type type)
{
if (ioctl(fd, VIDIOC_STREAMOFF, &type) < 0) {
LOGE("%s::VIDIOC_STREAMOFF failed", __func__);
ALOGE("%s::VIDIOC_STREAMOFF failed", __func__);
return -1;
}
@ -477,7 +477,7 @@ int fimc_v4l2_clr_buf(int fd, enum v4l2_buf_type type, enum v4l2_memory memory)
req.memory = memory;
if (ioctl(fd, VIDIOC_REQBUFS, &req) < 0) {
LOGE("%s::VIDIOC_REQBUFS", __func__);
ALOGE("%s::VIDIOC_REQBUFS", __func__);
return -1;
}
@ -543,16 +543,16 @@ SecFimc::SecFimc()
SecFimc::~SecFimc()
{
if (mFlagCreate == true) {
LOGE("%s::this is not Destroyed fail", __func__);
ALOGE("%s::this is not Destroyed fail", __func__);
if (destroy() == false)
LOGE("%s::destroy failed", __func__);
ALOGE("%s::destroy failed", __func__);
}
}
bool SecFimc::create(enum DEV dev, enum MODE mode, int numOfBuf)
{
if (mFlagCreate == true) {
LOGE("%s::Already Created fail", __func__);
ALOGE("%s::Already Created fail", __func__);
return false;
}
@ -575,7 +575,7 @@ bool SecFimc::create(enum DEV dev, enum MODE mode, int numOfBuf)
mFimcMode = FIMC_OVLY_DMA_AUTO;
break;
default:
LOGE("%s::Invalid mode(%d) fail", __func__, mode);
ALOGE("%s::Invalid mode(%d) fail", __func__, mode);
mFimcMode = FIMC_OVLY_NOT_FIXED;
goto err;
break;
@ -601,7 +601,7 @@ bool SecFimc::create(enum DEV dev, enum MODE mode, int numOfBuf)
mRealDev = 5;
break;
default:
LOGE("%s::invalid mDev(%d)", __func__, mDev);
ALOGE("%s::invalid mDev(%d)", __func__, mDev);
goto err;
break;
}
@ -611,48 +611,48 @@ bool SecFimc::create(enum DEV dev, enum MODE mode, int numOfBuf)
mFd = open(node, O_RDWR);
if (mFd < 0) {
LOGE("%s::open(%s) failed", __func__, node);
ALOGE("%s::open(%s) failed", __func__, node);
mFd = 0;
goto err;
}
/* check capability */
if (ioctl(mFd, VIDIOC_QUERYCAP, &mFimcCap) < 0) {
LOGE("%s::VIDIOC_QUERYCAP failed", __func__);
ALOGE("%s::VIDIOC_QUERYCAP failed", __func__);
goto err;
}
if (!(mFimcCap.capabilities & V4L2_CAP_STREAMING)) {
LOGE("%s::%s has no streaming support", __func__, node);
ALOGE("%s::%s has no streaming support", __func__, node);
goto err;
}
#ifdef BOARD_USE_V4L2
if (!(mFimcCap.capabilities & V4L2_CAP_VIDEO_OUTPUT_MPLANE)) {
LOGE("%s::%s is no video output mplane", __func__, node);
ALOGE("%s::%s is no video output mplane", __func__, node);
goto err;
}
if (!(mFimcCap.capabilities & V4L2_CAP_VIDEO_CAPTURE_MPLANE)) {
LOGE("%s::%s is no video capture mplane", __func__, node);
ALOGE("%s::%s is no video capture mplane", __func__, node);
goto err;
}
#else
if (!(mFimcCap.capabilities & V4L2_CAP_VIDEO_OUTPUT)) {
LOGE("%s::%s is no video output", __func__, node);
ALOGE("%s::%s is no video output", __func__, node);
goto err;
}
fmt.type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
if (ioctl(mFd, VIDIOC_G_FMT, &fmt) < 0) {
LOGE("%s::VIDIOC_G_FMT failed", __func__);
ALOGE("%s::VIDIOC_G_FMT failed", __func__);
goto err;
}
vc.id = V4L2_CID_RESERVED_MEM_BASE_ADDR;
vc.value = 0;
if (ioctl(mFd, VIDIOC_G_CTRL, &vc) < 0) {
LOGE("%s::VIDIOC_G_CTRL - V4L2_CID_RESERVED_MEM_BAES_ADDR", __func__);
ALOGE("%s::VIDIOC_G_CTRL - V4L2_CID_RESERVED_MEM_BAES_ADDR", __func__);
goto err;
}
@ -663,7 +663,7 @@ bool SecFimc::create(enum DEV dev, enum MODE mode, int numOfBuf)
vc.id = V4L2_CID_FIMC_VERSION;
vc.value = 0;
if (ioctl(mFd, VIDIOC_G_CTRL, &vc) < 0) {
LOGE("%s::VIDIOC_G_CTRL - V4L2_CID_FIMC_VERSION failed, FIMC version is set with default", __func__);
ALOGE("%s::VIDIOC_G_CTRL - V4L2_CID_FIMC_VERSION failed, FIMC version is set with default", __func__);
vc.value = 0x43;
}
@ -672,7 +672,7 @@ bool SecFimc::create(enum DEV dev, enum MODE mode, int numOfBuf)
vc.id = V4L2_CID_OVLY_MODE;
vc.value = mFimcMode;
if (ioctl(mFd, VIDIOC_S_CTRL, &vc) < 0) {
LOGE("%s::VIDIOC_S_CTRL - V4L2_CID_OVLY_MODE failed", __func__);
ALOGE("%s::VIDIOC_S_CTRL - V4L2_CID_OVLY_MODE failed", __func__);
goto err;
}
#endif
@ -694,18 +694,18 @@ bool SecFimc::destroy()
s5p_fimc_params_t *params = &(mS5pFimc.params);
if (mFlagCreate == false) {
LOGE("%s::Already Destroyed fail", __func__);
ALOGE("%s::Already Destroyed fail", __func__);
return false;
}
if (mFlagStreamOn == true) {
if (fimc_v4l2_stream_off(mFd, V4L2_BUF_TYPE_SRC) < 0) {
LOGE("%s::fimc_v4l2_stream_off() failed", __func__);
ALOGE("%s::fimc_v4l2_stream_off() failed", __func__);
return false;
}
#ifdef BOARD_USE_V4L2
if (fimc_v4l2_stream_off(mFd, V4L2_BUF_TYPE_DST) < 0) {
LOGE("%s::fimc_v4l2_stream_off() failed", __func__);
ALOGE("%s::fimc_v4l2_stream_off() failed", __func__);
return false;
}
#endif
@ -713,13 +713,13 @@ bool SecFimc::destroy()
}
if (fimc_v4l2_clr_buf(mFd, V4L2_BUF_TYPE_SRC, V4L2_MEMORY_TYPE_SRC) < 0) {
LOGE("%s::fimc_v4l2_clr_buf()[src] failed", __func__);
ALOGE("%s::fimc_v4l2_clr_buf()[src] failed", __func__);
return false;
}
#ifdef BOARD_USE_V4L2
if (fimc_v4l2_clr_buf(mFd, V4L2_BUF_TYPE_DST, V4L2_MEMORY_TYPE_DST) < 0) {
LOGE("%s::fimc_v4l2_clr_buf()[dst] failed", __func__);
ALOGE("%s::fimc_v4l2_clr_buf()[dst] failed", __func__);
return false;
}
#endif
@ -750,7 +750,7 @@ int SecFimc::getFd(void)
SecBuffer * SecFimc::getMemAddr(int index)
{
if (mFlagCreate == false) {
LOGE("%s::Not yet created", __func__);
ALOGE("%s::Not yet created", __func__);
return false;
}
@ -760,7 +760,7 @@ SecBuffer * SecFimc::getMemAddr(int index)
int SecFimc::getHWVersion(void)
{
if (mFlagCreate == false) {
LOGE("%s::Not yet created", __func__);
ALOGE("%s::Not yet created", __func__);
return false;
}
@ -774,17 +774,17 @@ bool SecFimc::setSrcParams(unsigned int width, unsigned int height,
bool forceChange)
{
#ifdef DEBUG_LIB_FIMC
LOGD("%s", __func__);
ALOGD("%s", __func__);
#endif
if (mFlagCreate == false) {
LOGE("%s::Not yet created", __func__);
ALOGE("%s::Not yet created", __func__);
return false;
}
int v4l2ColorFormat = HAL_PIXEL_FORMAT_2_V4L2_PIX(colorFormat);
if (v4l2ColorFormat < 0) {
LOGE("%s::not supported color format", __func__);
ALOGE("%s::not supported color format", __func__);
return false;
}
@ -803,11 +803,11 @@ bool SecFimc::setSrcParams(unsigned int width, unsigned int height,
if (fimcWidth != *cropWidth || fimcHeight != *cropHeight) {
if (forceChange == true) {
#ifdef DEBUG_LIB_FIMC
LOGD("size is changed from [w = %d, h= %d] to [w = %d, h = %d]",
ALOGD("size is changed from [w = %d, h= %d] to [w = %d, h = %d]",
*cropWidth, *cropHeight, fimcWidth, fimcHeight);
#endif
} else {
LOGE("%s::invalid source params", __func__);
ALOGE("%s::invalid source params", __func__);
return false;
}
}
@ -832,18 +832,18 @@ bool SecFimc::setSrcParams(unsigned int width, unsigned int height,
if (mFlagSetSrcParam == true) {
if (fimc_v4l2_clr_buf(mFd, V4L2_BUF_TYPE_SRC, V4L2_MEMORY_TYPE_SRC) < 0) {
LOGE("%s::fimc_v4l2_clr_buf_src() failed", __func__);
ALOGE("%s::fimc_v4l2_clr_buf_src() failed", __func__);
return false;
}
}
if (fimc_v4l2_set_fmt(mFd, V4L2_BUF_TYPE_SRC, V4L2_FIELD_NONE, &(params->src), 0) < 0) {
LOGE("%s::fimc_v4l2_set_fmt()[src] failed", __func__);
ALOGE("%s::fimc_v4l2_set_fmt()[src] failed", __func__);
return false;
}
if (fimc_v4l2_req_buf(mFd, 1, V4L2_BUF_TYPE_SRC, V4L2_MEMORY_TYPE_SRC) < 0) {
LOGE("%s::fimc_v4l2_req_buf()[src] failed", __func__);
ALOGE("%s::fimc_v4l2_req_buf()[src] failed", __func__);
return false;
}
@ -865,7 +865,7 @@ bool SecFimc::getSrcParams(unsigned int *width, unsigned int *height,
fmt.type = V4L2_BUF_TYPE_SRC;
if (ioctl(mFd, VIDIOC_G_FMT, &fmt) < 0) {
LOGE("%s::VIDIOC_G_FMT(fmt.type : %d) failed", __func__, fmt.type);
ALOGE("%s::VIDIOC_G_FMT(fmt.type : %d) failed", __func__, fmt.type);
return false;
}
@ -886,14 +886,14 @@ bool SecFimc::getSrcParams(unsigned int *width, unsigned int *height,
break;
#endif
default:
LOGE("%s::Invalid buffer type", __func__);
ALOGE("%s::Invalid buffer type", __func__);
return false;
break;
}
crop.type = V4L2_BUF_TYPE_SRC;
if (ioctl(mFd, VIDIOC_G_CROP, &crop) < 0) {
LOGE("%s::VIDIOC_G_CROP failed", __func__);
ALOGE("%s::VIDIOC_G_CROP failed", __func__);
return false;
}
@ -911,11 +911,11 @@ bool SecFimc::setSrcAddr(unsigned int physYAddr,
int colorFormat)
{
#ifdef DEBUG_LIB_FIMC
LOGD("%s", __func__);
ALOGD("%s", __func__);
#endif
if (mFlagCreate == false) {
LOGE("%s::Not yet created", __func__);
ALOGE("%s::Not yet created", __func__);
return false;
}
@ -962,17 +962,17 @@ bool SecFimc::setDstParams(unsigned int width, unsigned int height,
bool forceChange)
{
#ifdef DEBUG_LIB_FIMC
LOGD("%s", __func__);
ALOGD("%s", __func__);
#endif
if (mFlagCreate == false) {
LOGE("%s::Not yet created", __func__);
ALOGE("%s::Not yet created", __func__);
return false;
}
int v4l2ColorFormat = HAL_PIXEL_FORMAT_2_V4L2_PIX(colorFormat);
if (v4l2ColorFormat < 0) {
LOGE("%s::not supported color format", __func__);
ALOGE("%s::not supported color format", __func__);
return false;
}
@ -992,11 +992,11 @@ bool SecFimc::setDstParams(unsigned int width, unsigned int height,
if (fimcWidth != *cropWidth || fimcHeight != *cropHeight) {
if (forceChange == true) {
#ifdef DEBUG_LIB_FIMC
LOGD("size is changed from [w = %d, h= %d] to [w = %d, h = %d]",
ALOGD("size is changed from [w = %d, h= %d] to [w = %d, h = %d]",
*cropWidth, *cropHeight, fimcWidth, fimcHeight);
#endif
} else {
LOGE("%s::Invalid destination params", __func__);
ALOGE("%s::Invalid destination params", __func__);
return false;
}
}
@ -1040,32 +1040,32 @@ bool SecFimc::setDstParams(unsigned int width, unsigned int height,
#ifdef BOARD_USE_V4L2
if (mFlagSetDstParam == true) {
if (fimc_v4l2_clr_buf(mFd, V4L2_BUF_TYPE_DST, V4L2_MEMORY_TYPE_DST) < 0) {
LOGE("%s::fimc_v4l2_clr_buf_dst() failed", __func__);
ALOGE("%s::fimc_v4l2_clr_buf_dst() failed", __func__);
return false;
}
}
#endif
if (fimc_v4l2_s_ctrl(mFd, V4L2_ROTATE, mRotVal) < 0) {
LOGE("%s::fimc_v4l2_s_ctrl(V4L2_ROTATE)", __func__);
ALOGE("%s::fimc_v4l2_s_ctrl(V4L2_ROTATE)", __func__);
return false;
}
if (fimc_v4l2_set_fmt(mFd, V4L2_BUF_TYPE_DST, V4L2_FIELD_ANY, &(params->dst), (unsigned int)mS5pFimc.out_buf.phys_addr) < 0) {
LOGE("%s::fimc_v4l2_set_fmt()[dst] failed", __func__);
ALOGE("%s::fimc_v4l2_set_fmt()[dst] failed", __func__);
return false;
}
#ifdef BOARD_USE_V4L2
if (fimc_v4l2_req_buf(mFd, mNumOfBuf, V4L2_BUF_TYPE_DST, V4L2_MEMORY_TYPE_DST) < 0) {
LOGE("%s::fimc_v4l2_req_buf()[dst] failed", __func__);
ALOGE("%s::fimc_v4l2_req_buf()[dst] failed", __func__);
return false;
}
for (int i = 0; i < mNumOfBuf; i++) {
if (fimc_v4l2_query_buf(mFd, &(mDstBuffer[i]),
V4L2_BUF_TYPE_DST, V4L2_MEMORY_TYPE_DST, i, dst_planes) < 0) {
LOGE("%s::fimc_v4l2_query_buf() failed", __func__);
ALOGE("%s::fimc_v4l2_query_buf() failed", __func__);
}
}
#endif
@ -1088,7 +1088,7 @@ bool SecFimc::getDstParams(unsigned int *width, unsigned int *height,
fmt.type = V4L2_BUF_TYPE_DST;
if (ioctl(mFd, VIDIOC_G_FMT, &fmt) < 0) {
LOGE("%s::VIDIOC_G_FMT(fmt.type : %d) failed", __func__, fmt.type);
ALOGE("%s::VIDIOC_G_FMT(fmt.type : %d) failed", __func__, fmt.type);
return false;
}
switch (fmt.type) {
@ -1113,7 +1113,7 @@ bool SecFimc::getDstParams(unsigned int *width, unsigned int *height,
*cropHeight = fmt.fmt.win.w.height;
if (ioctl(mFd, VIDIOC_G_FBUF, &fbuf) < 0) {
LOGE("%s::VIDIOC_G_FBUF failed", __func__);
ALOGE("%s::VIDIOC_G_FBUF failed", __func__);
return false;
}
@ -1122,7 +1122,7 @@ bool SecFimc::getDstParams(unsigned int *width, unsigned int *height,
*colorFormat = fbuf.fmt.pixelformat;
break;
default:
LOGE("%s::Invalid buffer type", __func__);
ALOGE("%s::Invalid buffer type", __func__);
return false;
break;
}
@ -1131,7 +1131,7 @@ bool SecFimc::getDstParams(unsigned int *width, unsigned int *height,
crop.type = V4L2_BUF_TYPE_DST;
if (ioctl(mFd, VIDIOC_G_CROP, &crop) < 0) {
LOGE("%s::VIDIOC_G_CROP(crop.type : %d) failed", __func__, crop.type);
ALOGE("%s::VIDIOC_G_CROP(crop.type : %d) failed", __func__, crop.type);
return false;
}
@ -1147,13 +1147,13 @@ bool SecFimc::getDstParams(unsigned int *width, unsigned int *height,
bool SecFimc::setDstAddr(unsigned int physYAddr, unsigned int physCbAddr, unsigned int physCrAddr, int buf_index)
{
#ifdef DEBUG_LIB_FIMC
LOGD("%s", __func__);
ALOGD("%s", __func__);
#endif
s5p_fimc_params_t *params = &(mS5pFimc.params);
if (mFlagCreate == false) {
LOGE("%s::Not yet created", __func__);
ALOGE("%s::Not yet created", __func__);
return false;
}
@ -1176,12 +1176,12 @@ bool SecFimc::setDstAddr(unsigned int physYAddr, unsigned int physCbAddr, unsign
mS5pFimc.use_ext_out_mem = 1;
if (fimc_v4l2_s_ctrl(mFd, V4L2_ROTATE, mRotVal) < 0) {
LOGE("%s::fimc_v4l2_s_ctrl(V4L2_ROTATE)", __func__);
ALOGE("%s::fimc_v4l2_s_ctrl(V4L2_ROTATE)", __func__);
return false;
}
if (fimc_v4l2_set_fmt(mFd, V4L2_BUF_TYPE_DST, V4L2_FIELD_ANY, &(params->dst), (unsigned int)mS5pFimc.out_buf.phys_addr) < 0) {
LOGE("%s::fimc_v4l2_set_fmt()[dst] failed", __func__);
ALOGE("%s::fimc_v4l2_set_fmt()[dst] failed", __func__);
return false;
}
#endif
@ -1194,12 +1194,12 @@ bool SecFimc::setRotVal(unsigned int rotVal)
struct v4l2_control vc;
if (mFlagCreate == false) {
LOGE("%s::Not yet created", __func__);
ALOGE("%s::Not yet created", __func__);
return false;
}
if (fimc_v4l2_s_ctrl(mFd, V4L2_ROTATE, rotVal) < 0) {
LOGE("%s::fimc_v4l2_s_ctrl(V4L2_ROTATE) failed", __func__);
ALOGE("%s::fimc_v4l2_s_ctrl(V4L2_ROTATE) failed", __func__);
return false;
}
@ -1213,12 +1213,12 @@ bool SecFimc::setGlobalAlpha(bool enable, int alpha)
struct v4l2_format fmt;
if (mFlagCreate == false) {
LOGE("%s::Not yet created", __func__);
ALOGE("%s::Not yet created", __func__);
return false;
}
if (mFlagStreamOn == true) {
LOGE("%s::mFlagStreamOn == true", __func__);
ALOGE("%s::mFlagStreamOn == true", __func__);
return false;
}
@ -1228,7 +1228,7 @@ bool SecFimc::setGlobalAlpha(bool enable, int alpha)
memset(&fbuf, 0, sizeof(fbuf));
if (ioctl(mFd, VIDIOC_G_FBUF, &fbuf) < 0) {
LOGE("%s::VIDIOC_G_FBUF failed", __func__);
ALOGE("%s::VIDIOC_G_FBUF failed", __func__);
return false;
}
@ -1238,7 +1238,7 @@ bool SecFimc::setGlobalAlpha(bool enable, int alpha)
fbuf.flags &= ~V4L2_FBUF_FLAG_GLOBAL_ALPHA;
if (ioctl(mFd, VIDIOC_S_FBUF, &fbuf) < 0) {
LOGE("%s::VIDIOC_S_FBUF failed", __func__);
ALOGE("%s::VIDIOC_S_FBUF failed", __func__);
return false;
}
@ -1247,13 +1247,13 @@ bool SecFimc::setGlobalAlpha(bool enable, int alpha)
fmt.type = V4L2_BUF_TYPE_VIDEO_OVERLAY;
if (ioctl(mFd, VIDIOC_G_FMT, &fmt) < 0) {
LOGE("%s::VIDIOC_G_FMT failed", __func__);
ALOGE("%s::VIDIOC_G_FMT failed", __func__);
return false;
}
fmt.fmt.win.global_alpha = alpha & 0xFF;
if (ioctl(mFd, VIDIOC_S_FMT, &fmt) < 0) {
LOGE("%s::VIDIOC_S_FMT failed", __func__);
ALOGE("%s::VIDIOC_S_FMT failed", __func__);
return false;
}
}
@ -1268,12 +1268,12 @@ bool SecFimc::setGlobalAlpha(bool enable, int alpha)
bool SecFimc::setLocalAlpha(bool enable)
{
if (mFlagCreate == false) {
LOGE("%s::Not yet created", __func__);
ALOGE("%s::Not yet created", __func__);
return false;
}
if (mFlagStreamOn == true) {
LOGE("%s::mFlagStreamOn == true", __func__);
ALOGE("%s::mFlagStreamOn == true", __func__);
return false;
}
@ -1289,12 +1289,12 @@ bool SecFimc::setColorKey(bool enable, int colorKey)
struct v4l2_format fmt;
if (mFlagCreate == false) {
LOGE("%s::Not yet created", __func__);
ALOGE("%s::Not yet created", __func__);
return false;
}
if (mFlagStreamOn == true) {
LOGE("%s::mFlagStreamOn == true", __func__);
ALOGE("%s::mFlagStreamOn == true", __func__);
return false;
}
@ -1304,7 +1304,7 @@ bool SecFimc::setColorKey(bool enable, int colorKey)
memset(&fbuf, 0, sizeof(fbuf));
if (ioctl(mFd, VIDIOC_G_FBUF, &fbuf) < 0) {
LOGE("%s::VIDIOC_G_FBUF failed", __func__);
ALOGE("%s::VIDIOC_G_FBUF failed", __func__);
return false;
}
@ -1314,7 +1314,7 @@ bool SecFimc::setColorKey(bool enable, int colorKey)
fbuf.flags &= ~V4L2_FBUF_FLAG_CHROMAKEY;
if (ioctl(mFd, VIDIOC_S_FBUF, &fbuf) < 0) {
LOGE("%s::VIDIOC_S_FBUF failed", __func__);
ALOGE("%s::VIDIOC_S_FBUF failed", __func__);
return false;
}
@ -1323,14 +1323,14 @@ bool SecFimc::setColorKey(bool enable, int colorKey)
fmt.type = V4L2_BUF_TYPE_VIDEO_OVERLAY;
if (ioctl(mFd, VIDIOC_G_FMT, &fmt) < 0) {
LOGE("%s::VIDIOC_G_FMT failed", __func__);
ALOGE("%s::VIDIOC_G_FMT failed", __func__);
return false;
}
fmt.fmt.win.chromakey = colorKey & 0xFFFFFF;
if (ioctl(mFd, VIDIOC_S_FMT, &fmt) < 0)
LOGE("%s::VIDIOC_S_FMT failed", __func__);
ALOGE("%s::VIDIOC_S_FMT failed", __func__);
}
mFlagColorKey = enable;
mColorKey = colorKey;
@ -1340,21 +1340,21 @@ bool SecFimc::setColorKey(bool enable, int colorKey)
bool SecFimc::draw(int src_index, int dst_index)
{
#ifdef DEBUG_LIB_FIMC
LOGD("%s", __func__);
ALOGD("%s", __func__);
#endif
if (mFlagCreate == false) {
LOGE("%s::Not yet created", __func__);
ALOGE("%s::Not yet created", __func__);
return false;
}
if (mFlagSetSrcParam == false) {
LOGE("%s::mFlagSetSrcParam == false fail", __func__);
ALOGE("%s::mFlagSetSrcParam == false fail", __func__);
return false;
}
if (mFlagSetDstParam == false) {
LOGE("%s::mFlagSetDstParam == false fail", __func__);
ALOGE("%s::mFlagSetDstParam == false fail", __func__);
return false;
}
@ -1368,45 +1368,45 @@ bool SecFimc::draw(int src_index, int dst_index)
#ifdef BOARD_USE_V4L2
if (mFlagStreamOn == false) {
if (m_streamOn() == false) {
LOGE("%s::m_streamOn failed", __func__);
ALOGE("%s::m_streamOn failed", __func__);
return false;
}
mFlagStreamOn = true;
}
if (fimc_v4l2_dequeue(mFd, V4L2_BUF_TYPE_DST, V4L2_MEMORY_TYPE_DST, &dst_index, dst_planes) < 0) {
LOGE("%s::fimc_v4l2_dequeue[dst](mNumOfBuf : %d) failed", __func__, mNumOfBuf);
ALOGE("%s::fimc_v4l2_dequeue[dst](mNumOfBuf : %d) failed", __func__, mNumOfBuf);
return false;
}
if (fimc_v4l2_dequeue(mFd, V4L2_BUF_TYPE_SRC, V4L2_MEMORY_TYPE_SRC, &src_index, src_planes) < 0) {
LOGE("%s::fimc_v4l2_dequeue[src](mNumOfBuf : %d) failed", __func__, mNumOfBuf);
ALOGE("%s::fimc_v4l2_dequeue[src](mNumOfBuf : %d) failed", __func__, mNumOfBuf);
return false;
}
if (fimc_v4l2_queue(mFd, &(mSrcBuffer), V4L2_BUF_TYPE_SRC, V4L2_MEMORY_TYPE_SRC, src_index, src_planes) < 0) {
LOGE("%s::fimc_v4l2_queue[src](index : %d) (mNumOfBuf : %d) failed", __func__, 0, mNumOfBuf);
ALOGE("%s::fimc_v4l2_queue[src](index : %d) (mNumOfBuf : %d) failed", __func__, 0, mNumOfBuf);
return false;
}
if (fimc_v4l2_queue(mFd, &(mDstBuffer[dst_index]), V4L2_BUF_TYPE_DST, V4L2_MEMORY_TYPE_DST, dst_index, dst_planes) < 0) {
LOGE("%s::fimc_v4l2_queue[dst](index : %d) (mNumOfBuf : %d) failed", __func__, dst_index, mNumOfBuf);
ALOGE("%s::fimc_v4l2_queue[dst](index : %d) (mNumOfBuf : %d) failed", __func__, dst_index, mNumOfBuf);
return false;
}
#else
if (fimc_v4l2_stream_on(mFd, V4L2_BUF_TYPE_SRC) < 0) {
LOGE("%s::fimc_v4l2_stream_on() failed", __func__);
ALOGE("%s::fimc_v4l2_stream_on() failed", __func__);
goto err;
}
flagStreamOn = true;
if (fimc_v4l2_queue(mFd, &(mSrcBuffer), V4L2_BUF_TYPE_SRC, V4L2_MEMORY_TYPE_SRC, src_index, src_planes) < 0) {
LOGE("%s::fimc_v4l2_queue(index : %d) (mNumOfBuf : %d) failed", __func__, 0, mNumOfBuf);
ALOGE("%s::fimc_v4l2_queue(index : %d) (mNumOfBuf : %d) failed", __func__, 0, mNumOfBuf);
goto err;
}
if (fimc_v4l2_dequeue(mFd, V4L2_BUF_TYPE_SRC, V4L2_MEMORY_TYPE_SRC, &src_index, src_planes) < 0) {
LOGE("%s::fimc_v4l2_dequeue (mNumOfBuf : %d) failed", __func__, mNumOfBuf);
ALOGE("%s::fimc_v4l2_dequeue (mNumOfBuf : %d) failed", __func__, mNumOfBuf);
goto err;
}
#endif
@ -1415,7 +1415,7 @@ err :
#ifndef BOARD_USE_V4L2
if (flagStreamOn == true) {
if (fimc_v4l2_stream_off(mFd, V4L2_BUF_TYPE_SRC) < 0) {
LOGE("%s::fimc_v4l2_stream_off() failed", __func__);
ALOGE("%s::fimc_v4l2_stream_off() failed", __func__);
return false;
}
}
@ -1427,7 +1427,7 @@ err :
bool SecFimc::m_streamOn()
{
#ifdef DEBUG_LIB_FIMC
LOGD("%s", __func__);
ALOGD("%s", __func__);
#endif
#ifdef BOARD_USE_V4L2
@ -1454,26 +1454,26 @@ bool SecFimc::m_streamOn()
}
if (fimc_v4l2_queue(mFd, &(mSrcBuffer), V4L2_BUF_TYPE_SRC, V4L2_MEMORY_TYPE_SRC, 0, src_planes) < 0) {
LOGE("%s::fimc_v4l2_queue(index : %d) (mSrcBufNum : %d) failed", __func__, 0, 1);
ALOGE("%s::fimc_v4l2_queue(index : %d) (mSrcBufNum : %d) failed", __func__, 0, 1);
return false;
}
for (int i = 0; i < mNumOfBuf; i++) {
if (fimc_v4l2_queue(mFd, &(mDstBuffer[i]),
V4L2_BUF_TYPE_DST, V4L2_MEMORY_TYPE_DST, i, dst_planes) < 0) {
LOGE("%s::fimc_v4l2_queue(index : %d) (mDstBufNum : %d) failed", __func__, i, mNumOfBuf);
ALOGE("%s::fimc_v4l2_queue(index : %d) (mDstBufNum : %d) failed", __func__, i, mNumOfBuf);
return false;
}
}
#endif
if (fimc_v4l2_stream_on(mFd, V4L2_BUF_TYPE_SRC) < 0) {
LOGE("%s::fimc_v4l2_stream_on() failed", __func__);
ALOGE("%s::fimc_v4l2_stream_on() failed", __func__);
return false;
}
#ifdef BOARD_USE_V4L2
if (fimc_v4l2_stream_on(mFd, V4L2_BUF_TYPE_DST) < 0) {
LOGE("%s::fimc_v4l2_stream_on() failed", __func__);
ALOGE("%s::fimc_v4l2_stream_on() failed", __func__);
return false;
}
#endif

@ -30,8 +30,8 @@
#if defined(REAL_DEBUG)
#ifdef ANDROID_LOG
#define PRINT LOGE
#define PRINTD LOGD
#define PRINT ALOGE
#define PRINTD ALOGD
#else
#define PRINT printf
#define PRINTD printf

@ -20,8 +20,8 @@
///////////////////////////////////////////////////
// include
///////////////////////////////////////////////////
#define LOG_NDEBUG 0
#define LOG_TAG "FimgC210"
#define ALOG_NDEBUG 0
#define ALOG_TAG "FimgC210"
#include <utils/Log.h>
#include "FimgC210.h"

@ -17,8 +17,8 @@
**
*/
#define LOG_NDEBUG 0
#define LOG_TAG "SKIA"
#define ALOG_NDEBUG 0
#define ALOG_TAG "SKIA"
#include <utils/Log.h>
#include "FimgApi.h"
@ -270,14 +270,14 @@ extern "C" int SyncFimgApi(void)
void printDataBlit(char *title, struct fimg2d_blit *cmd)
{
LOGI("%s\n", title);
ALOGI("%s\n", title);
LOGI(" sequence_no. = %u\n", cmd->seq_no);
LOGI(" blit_op = %d(%s)\n", cmd->op, optbl[cmd->op].str);
LOGI(" fill_color = %X\n", cmd->solid_color);
LOGI(" global_alpha = %u\n", (unsigned int)cmd->g_alpha);
LOGI(" PREMULT = %s\n", cmd->premult == PREMULTIPLIED ? "PREMULTIPLIED" : "NON-PREMULTIPLIED");
LOGI(" do_dither = %s\n", cmd->dither == true ? "dither" : "no-dither");
ALOGI(" sequence_no. = %u\n", cmd->seq_no);
ALOGI(" blit_op = %d(%s)\n", cmd->op, optbl[cmd->op].str);
ALOGI(" fill_color = %X\n", cmd->solid_color);
ALOGI(" global_alpha = %u\n", (unsigned int)cmd->g_alpha);
ALOGI(" PREMULT = %s\n", cmd->premult == PREMULTIPLIED ? "PREMULTIPLIED" : "NON-PREMULTIPLIED");
ALOGI(" do_dither = %s\n", cmd->dither == true ? "dither" : "no-dither");
printDataBlitRotate(cmd->rotate);
@ -297,80 +297,80 @@ void printDataBlit(char *title, struct fimg2d_blit *cmd)
void printDataBlitImage(char *title, struct fimg2d_image *image)
{
if (NULL != image) {
LOGI(" Image_%s\n", title);
LOGI(" addr = %X\n", image->addr.start);
LOGI(" size = %u\n", image->addr.size);
LOGI(" (width, height) = (%d, %d)\n", image->width, image->height);
LOGI(" format = %d\n", image->fmt);
ALOGI(" Image_%s\n", title);
ALOGI(" addr = %X\n", image->addr.start);
ALOGI(" size = %u\n", image->addr.size);
ALOGI(" (width, height) = (%d, %d)\n", image->width, image->height);
ALOGI(" format = %d\n", image->fmt);
} else
LOGI(" Image_%s : NULL\n", title);
ALOGI(" Image_%s : NULL\n", title);
}
void printDataBlitRect(char *title, struct fimg2d_rect *rect)
{
if (NULL != rect) {
LOGI(" RECT_%s\n", title);
LOGI(" (x1, y1) = (%d, %d)\n", rect->x1, rect->y1);
LOGI(" (x2, y2) = (%d, %d)\n", rect->x2, rect->y2);
LOGI(" (width, height) = (%d, %d)\n", rect->x2 - rect->x1, rect->y2 - rect->y1);
ALOGI(" RECT_%s\n", title);
ALOGI(" (x1, y1) = (%d, %d)\n", rect->x1, rect->y1);
ALOGI(" (x2, y2) = (%d, %d)\n", rect->x2, rect->y2);
ALOGI(" (width, height) = (%d, %d)\n", rect->x2 - rect->x1, rect->y2 - rect->y1);
} else
LOGI(" RECT_%s : NULL\n", title);
ALOGI(" RECT_%s : NULL\n", title);
}
void printDataBlitRotate(enum rotation rotate)
{
LOGI(" ROTATE : %d\n", rotate);
ALOGI(" ROTATE : %d\n", rotate);
}
void printDataBlitClip(struct fimg2d_clip *clip)
{
if (NULL != clip) {
LOGI(" CLIP\n");
LOGI(" clip %s\n", clip->enable == true ? "enabled" : "disabled");
LOGI(" (x1, y1) = (%d, %d)\n", clip->x1, clip->y1);
LOGI(" (x2, y2) = (%d, %d)\n", clip->x2, clip->y2);
LOGI(" (width, hight) = (%d, %d)\n", clip->x2 - clip->x1, clip->y2 - clip->y1);
ALOGI(" CLIP\n");
ALOGI(" clip %s\n", clip->enable == true ? "enabled" : "disabled");
ALOGI(" (x1, y1) = (%d, %d)\n", clip->x1, clip->y1);
ALOGI(" (x2, y2) = (%d, %d)\n", clip->x2, clip->y2);
ALOGI(" (width, hight) = (%d, %d)\n", clip->x2 - clip->x1, clip->y2 - clip->y1);
} else
LOGI(" CLIP : NULL\n");
ALOGI(" CLIP : NULL\n");
}
void printDataBlitScale(struct fimg2d_scale *scaling)
{
if (NULL != scaling) {
LOGI(" SCALING\n");
LOGI(" scale_mode : %s\n", scaling->mode == 0 ?
ALOGI(" SCALING\n");
ALOGI(" scale_mode : %s\n", scaling->mode == 0 ?
"NO_SCALING" :
(scaling->mode == 1 ? "SCALING_NEAREST" : "SCALING_BILINEAR"));
LOGI(" scaling_factor_unit : %s\n", scaling->factor == 0 ? "PERCENT" : "PIXEL");
ALOGI(" scaling_factor_unit : %s\n", scaling->factor == 0 ? "PERCENT" : "PIXEL");
if (scaling->factor == 0)
LOGI(" scaling_factor : (scale_w, scale_y) = (%d, %d)\n", scaling->scale_w, scaling->scale_h);
ALOGI(" scaling_factor : (scale_w, scale_y) = (%d, %d)\n", scaling->scale_w, scaling->scale_h);
else {
LOGI(" src : (src_w, src_h) = (%d, %d)\n", scaling->src_w, scaling->src_h);
LOGI(" dst : (dst_w, dst_h) = (%d, %d)\n", scaling->dst_w, scaling->dst_h);
LOGI(" scaling_factor : (scale_w, scale_y) = (%3.2f, %3.2f)\n", (double)scaling->dst_w / scaling->src_w, (double)scaling->dst_h / scaling->src_h);
ALOGI(" src : (src_w, src_h) = (%d, %d)\n", scaling->src_w, scaling->src_h);
ALOGI(" dst : (dst_w, dst_h) = (%d, %d)\n", scaling->dst_w, scaling->dst_h);
ALOGI(" scaling_factor : (scale_w, scale_y) = (%3.2f, %3.2f)\n", (double)scaling->dst_w / scaling->src_w, (double)scaling->dst_h / scaling->src_h);
}
} else
LOGI(" SCALING : NULL(NO SCALE MODE)\n");
ALOGI(" SCALING : NULL(NO SCALE MODE)\n");
}
void printDataMatrix(int matrixType)
{
LOGI(" MATRIX\n");
ALOGI(" MATRIX\n");
if (matrixType & SkMatrix::kIdentity_Mask)
LOGI(" Matrix_type : Identity_Mask\n");
ALOGI(" Matrix_type : Identity_Mask\n");
if (matrixType & SkMatrix::kTranslate_Mask)
LOGI(" Matrix_type : Translate_Mask(the matrix has translation)\n");
ALOGI(" Matrix_type : Translate_Mask(the matrix has translation)\n");
if (matrixType & SkMatrix::kScale_Mask)
LOGI(" Matrix_type : Scale_Mask(the matrix has X or Y scale)\n");
ALOGI(" Matrix_type : Scale_Mask(the matrix has X or Y scale)\n");
if (matrixType & SkMatrix::kAffine_Mask)
LOGI(" Matrix_type : Affine_Mask(the matrix skews or rotates)\n");
ALOGI(" Matrix_type : Affine_Mask(the matrix skews or rotates)\n");
if (matrixType & SkMatrix::kPerspective_Mask)
LOGI(" Matrix_type : Perspective_Mask(the matrix is in perspective)\n");
ALOGI(" Matrix_type : Perspective_Mask(the matrix is in perspective)\n");
}

@ -26,12 +26,12 @@
#include "sec_g2d_4x.h"
#define REAL_DEBUG
#define ANDROID_LOG
#define ANDROID_ALOG
#if defined(REAL_DEBUG)
#ifdef ANDROID_LOG
#define PRINT LOGE
#define PRINTD LOGD
#ifdef ANDROID_ALOG
#define PRINT ALOGE
#define PRINTD ALOGD
#else
#define PRINT printf
#define PRINTD printf

@ -17,8 +17,8 @@
**
*/
#define LOG_NDEBUG 0
#define LOG_TAG "FimgExynos4"
#define ALOG_NDEBUG 0
#define ALOG_TAG "FimgExynos4"
#include <utils/Log.h>
#include "FimgExynos4.h"

@ -26,7 +26,7 @@ LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_PRELINK_MODULE := false
LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw
LOCAL_SHARED_LIBRARIES := liblog libcutils libUMP libGLESv1_CM libion
LOCAL_SHARED_LIBRARIES := liblog libcutils libUMP libGLESv1_CM libsamsungion
# Include the UMP header files
LOCAL_C_INCLUDES += $(LOCAL_PATH)/../include
@ -39,7 +39,7 @@ LOCAL_SRC_FILES := \
LOCAL_MODULE_TAGS := eng
#LOCAL_MODULE := gralloc.default
LOCAL_MODULE := gralloc.$(TARGET_DEVICE)
LOCAL_CFLAGS:= -DLOG_TAG=\"gralloc\" -DGRALLOC_32_BITS -DSTANDARD_LINUX_SCREEN
LOCAL_CFLAGS:= -DALOG_TAG=\"gralloc\" -DGRALLOC_32_BITS -DSTANDARD_LINUX_SCREEN
#LOCAL_CFLAGS+= -DMALI_VSYNC_EVENT_REPORT_ENABLE
LOCAL_CFLAGS += -DSAMSUNG_EXYNOS

@ -117,7 +117,7 @@ static int gralloc_alloc_buffer(alloc_device_t* dev, size_t size, int usage,
gfd = open(node, O_RDWR);
if (gfd < 0) {
LOGE("%s:: %s Post processor open error\n", __func__, node);
ALOGE("%s:: %s Post processor open error\n", __func__, node);
return false;
}
}
@ -126,7 +126,7 @@ static int gralloc_alloc_buffer(alloc_device_t* dev, size_t size, int usage,
vc.value = 0;
ret = ioctl(gfd, VIDIOC_G_CTRL, &vc);
if (ret < 0) {
LOGE("Error in video VIDIOC_G_CTRL - V4L2_CID_RESERVED_MEM_BAES_ADDR (%d)\n", ret);
ALOGE("Error in video VIDIOC_G_CTRL - V4L2_CID_RESERVED_MEM_BAES_ADDR (%d)\n", ret);
return false;
}
paddr = (unsigned int)vc.value;
@ -160,7 +160,7 @@ static int gralloc_alloc_buffer(alloc_device_t* dev, size_t size, int usage,
if (usage & GRALLOC_USAGE_HW_ION) {
if (!ion_dev_open) {
LOGE("ERROR, failed to open ion");
ALOGE("ERROR, failed to open ion");
return -1;
}
@ -169,14 +169,14 @@ static int gralloc_alloc_buffer(alloc_device_t* dev, size_t size, int usage,
ion_fd = ion_alloc(m->ion_client, size, 0, ion_flags);
if (ion_fd < 0) {
LOGE("Failed to ion_alloc");
ALOGE("Failed to ion_alloc");
return -1;
}
cpu_ptr = ion_map(ion_fd, size, 0);
if (NULL == cpu_ptr) {
LOGE("Failed to ion_map");
ALOGE("Failed to ion_map");
ion_free(ion_fd);
return -1;
}
@ -186,7 +186,7 @@ static int gralloc_alloc_buffer(alloc_device_t* dev, size_t size, int usage,
if (UMP_INVALID_MEMORY_HANDLE != ump_mem_handle) {
priv_alloc_flag = private_handle_t::PRIV_FLAGS_USES_ION;
} else {
LOGE("gralloc_alloc_buffer() failed to import ION memory");
ALOGE("gralloc_alloc_buffer() failed to import ION memory");
ion_unmap(cpu_ptr, size);
ion_free(ion_fd);
return -1;
@ -233,20 +233,20 @@ static int gralloc_alloc_buffer(alloc_device_t* dev, size_t size, int usage,
hnd->voffset = ((EXYNOS4_ALIGN((hnd->width >> 1), 16) * EXYNOS4_ALIGN((hnd->height >> 1), 16)));
return 0;
} else {
LOGE("gralloc_alloc_buffer() failed to allocate handle");
ALOGE("gralloc_alloc_buffer() failed to allocate handle");
}
} else {
LOGE("gralloc_alloc_buffer() failed to retrieve valid secure id");
ALOGE("gralloc_alloc_buffer() failed to retrieve valid secure id");
}
ump_mapped_pointer_release(ump_mem_handle);
} else {
LOGE("gralloc_alloc_buffer() failed to map UMP memory");
ALOGE("gralloc_alloc_buffer() failed to map UMP memory");
}
ump_reference_release(ump_mem_handle);
} else {
LOGE("gralloc_alloc_buffer() failed to allcoate UMP memory");
ALOGE("gralloc_alloc_buffer() failed to allcoate UMP memory");
}
}
return -1;
@ -275,7 +275,7 @@ static int gralloc_alloc_framebuffer_locked(alloc_device_t* dev, size_t size, in
* screen when post is called.
*/
int newUsage = (usage & ~GRALLOC_USAGE_HW_FB) | GRALLOC_USAGE_HW_2D;
LOGE("fallback to single buffering");
ALOGE("fallback to single buffering");
return gralloc_alloc_buffer(dev, bufferSize, newUsage, pHandle, w, h, format, bpp, 0, 0);
}
@ -427,14 +427,14 @@ static int alloc_device_free(alloc_device_t* dev, buffer_handle_t handle)
} else if (hnd->flags & private_handle_t::PRIV_FLAGS_USES_UMP) {
#ifdef USE_PARTIAL_FLUSH
if (!release_rect((int)hnd->ump_id))
LOGE("secure id: 0x%x, release error",(int)hnd->ump_id);
ALOGE("secure id: 0x%x, release error",(int)hnd->ump_id);
#endif
ump_mapped_pointer_release((ump_handle)hnd->ump_mem_handle);
ump_reference_release((ump_handle)hnd->ump_mem_handle);
} else if (hnd->flags & private_handle_t::PRIV_FLAGS_USES_ION) {
#ifdef USE_PARTIAL_FLUSH
if (!release_rect((int)hnd->ump_id))
LOGE("secure id: 0x%x, release error",(int)hnd->ump_id);
ALOGE("secure id: 0x%x, release error",(int)hnd->ump_id);
#endif
ump_mapped_pointer_release((ump_handle)hnd->ump_mem_handle);
ump_reference_release((ump_handle)hnd->ump_mem_handle);
@ -476,7 +476,7 @@ int alloc_device_open(hw_module_t const* module, const char* name, hw_device_t**
if (0 > m->ion_client)
ion_dev_open = false;
if (UMP_OK != ump_res) {
LOGE("UMP open failed ump_res %d", ump_res);
ALOGE("UMP open failed ump_res %d", ump_res);
delete dev;
return -1;
}

@ -93,7 +93,7 @@ static int fb_post(struct framebuffer_device_t* dev, buffer_handle_t buffer)
#define FBIO_WAITFORVSYNC _IOW('F', 0x20, __u32)
#define S3CFB_SET_VSYNC_INT _IOW('F', 206, unsigned int)
if (ioctl(m->framebuffer->fd, FBIOPAN_DISPLAY, &m->info) == -1) {
LOGE("FBIOPAN_DISPLAY failed");
ALOGE("FBIOPAN_DISPLAY failed");
m->base.unlock(&m->base, buffer);
return 0;
}
@ -102,7 +102,7 @@ static int fb_post(struct framebuffer_device_t* dev, buffer_handle_t buffer)
/* enable VSYNC */
interrupt = 1;
if (ioctl(m->framebuffer->fd, S3CFB_SET_VSYNC_INT, &interrupt) < 0) {
LOGE("S3CFB_SET_VSYNC_INT enable failed");
ALOGE("S3CFB_SET_VSYNC_INT enable failed");
return 0;
}
/* wait for VSYNC */
@ -113,7 +113,7 @@ static int fb_post(struct framebuffer_device_t* dev, buffer_handle_t buffer)
int crtc;
crtc = 0;
if (ioctl(m->framebuffer->fd, FBIO_WAITFORVSYNC, &crtc) < 0) {
LOGE("FBIO_WAITFORVSYNC failed");
ALOGE("FBIO_WAITFORVSYNC failed");
#ifdef MALI_VSYNC_EVENT_REPORT_ENABLE
gralloc_mali_vsync_report(MALI_VSYNC_EVENT_END_WAIT);
#endif
@ -125,7 +125,7 @@ static int fb_post(struct framebuffer_device_t* dev, buffer_handle_t buffer)
// disable VSYNC
interrupt = 0;
if (ioctl(m->framebuffer->fd, S3CFB_SET_VSYNC_INT, &interrupt) < 0) {
LOGE("S3CFB_SET_VSYNC_INT disable failed");
ALOGE("S3CFB_SET_VSYNC_INT disable failed");
return 0;
}
#else
@ -134,7 +134,7 @@ static int fb_post(struct framebuffer_device_t* dev, buffer_handle_t buffer)
gralloc_mali_vsync_report(MALI_VSYNC_EVENT_BEGIN_WAIT);
#endif
if (ioctl(m->framebuffer->fd, FBIOPUT_VSCREENINFO, &m->info) == -1) {
LOGE("FBIOPUT_VSCREENINFO failed");
ALOGE("FBIOPUT_VSCREENINFO failed");
#ifdef MALI_VSYNC_EVENT_REPORT_ENABLE
gralloc_mali_vsync_report(MALI_VSYNC_EVENT_END_WAIT);
#endif
@ -246,14 +246,14 @@ int init_frame_buffer_locked(struct private_module_t* module)
if (ioctl(fd, FBIOPUT_VSCREENINFO, &info) == -1) {
info.yres_virtual = info.yres;
flags &= ~PAGE_FLIP;
LOGW("FBIOPUT_VSCREENINFO failed, page flipping not supported");
ALOGW("FBIOPUT_VSCREENINFO failed, page flipping not supported");
}
if (info.yres_virtual < info.yres * 2) {
// we need at least 2 for page-flipping
info.yres_virtual = info.yres;
flags &= ~PAGE_FLIP;
LOGW("page flipping not supported (yres_virtual=%d, requested=%d)",
ALOGW("page flipping not supported (yres_virtual=%d, requested=%d)",
info.yres_virtual, info.yres * 2);
}
@ -280,7 +280,7 @@ int init_frame_buffer_locked(struct private_module_t* module)
float ydpi = (info.yres * 25.4f) / info.height;
float fps = refreshRate / 1000.0f;
LOGI("using (fd=%d)\n"
ALOGI("using (fd=%d)\n"
"id = %s\n"
"xres = %d px\n"
"yres = %d px\n"
@ -301,7 +301,7 @@ int init_frame_buffer_locked(struct private_module_t* module)
info.green.offset, info.green.length,
info.blue.offset, info.blue.length);
LOGI("width = %d mm (%f dpi)\n"
ALOGI("width = %d mm (%f dpi)\n"
"height = %d mm (%f dpi)\n"
"refresh rate = %.2f Hz\n",
info.width, xdpi,
@ -330,7 +330,7 @@ int init_frame_buffer_locked(struct private_module_t* module)
size_t fbSize = round_up_to_page_size(finfo.line_length * info.yres_virtual);
void* vaddr = mmap(0, fbSize, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
if (vaddr == MAP_FAILED) {
LOGE("Error mapping the framebuffer (%s)", strerror(errno));
ALOGE("Error mapping the framebuffer (%s)", strerror(errno));
return -errno;
}
@ -355,13 +355,13 @@ int enableScreen(struct framebuffer_device_t* dev, int enable)
if (enable == 1) {
if (ioctl(m->framebuffer->fd, FBIOBLANK, FB_BLANK_UNBLANK) < 0) {
LOGE("%s: FBIOBLANK failed : (%d:%s)",
ALOGE("%s: FBIOBLANK failed : (%d:%s)",
__func__, m->framebuffer->fd, strerror(errno));
return -EINVAL;
}
} else if (enable == 0) {
if (ioctl(m->framebuffer->fd, FBIOBLANK, FB_BLANK_POWERDOWN) < 0) {
LOGE("%s: FBIOBLANK failed : (%d:%s)",
ALOGE("%s: FBIOBLANK failed : (%d:%s)",
__func__, m->framebuffer->fd, strerror(errno));
return -EINVAL;
}

@ -123,7 +123,7 @@ static int gralloc_map(gralloc_module_t const* module,
void *mappedAddress = mmap(0, size,
PROT_READ|PROT_WRITE, MAP_SHARED, gMemfd, (hnd->paddr - hnd->offset));
if (mappedAddress == MAP_FAILED) {
LOGE("Could not mmap %s fd(%d)", strerror(errno),hnd->fd);
ALOGE("Could not mmap %s fd(%d)", strerror(errno),hnd->fd);
return -errno;
}
hnd->base = intptr_t(mappedAddress) + hnd->offset;
@ -133,7 +133,7 @@ static int gralloc_map(gralloc_module_t const* module,
void *mappedAddress = ion_map(hnd->fd, size, 0);
if (mappedAddress == MAP_FAILED) {
LOGE("Could not ion_map %s fd(%d)", strerror(errno), hnd->fd);
ALOGE("Could not ion_map %s fd(%d)", strerror(errno), hnd->fd);
return -errno;
}
@ -146,7 +146,7 @@ static int gralloc_map(gralloc_module_t const* module,
void *mappedAddress = mmap(0, size,
PROT_READ|PROT_WRITE, MAP_SHARED, hnd->fd, 0);
if (mappedAddress == MAP_FAILED) {
LOGE("Could not mmap %s fd(%d)", strerror(errno),hnd->fd);
ALOGE("Could not mmap %s fd(%d)", strerror(errno),hnd->fd);
return -errno;
}
hnd->base = intptr_t(mappedAddress) + hnd->offset;
@ -165,12 +165,12 @@ static int gralloc_unmap(gralloc_module_t const* module,
void* base = (void*)(intptr_t(hnd->base) - hnd->offset);
size_t size = FIMC1_RESERVED_SIZE * 1024;
if (munmap(base, size) < 0)
LOGE("Could not unmap %s", strerror(errno));
ALOGE("Could not unmap %s", strerror(errno));
} else if (hnd->flags & private_handle_t::PRIV_FLAGS_USES_ION) {
void* base = (void*)hnd->base;
size_t size = hnd->size;
if (ion_unmap(base, size) < 0)
LOGE("Could not ion_unmap %s", strerror(errno));
ALOGE("Could not ion_unmap %s", strerror(errno));
ion_client_destroy(hnd->ion_client);
} else {
void* base = (void*)hnd->base;
@ -180,7 +180,7 @@ static int gralloc_unmap(gralloc_module_t const* module,
size += hnd->offset;
#endif
if (munmap(base, size) < 0)
LOGE("Could not unmap %s", strerror(errno));
ALOGE("Could not unmap %s", strerror(errno));
}
}
hnd->base = 0;
@ -205,7 +205,7 @@ static int gralloc_register_buffer(gralloc_module_t const* module, buffer_handle
int retval = -EINVAL;
void *vaddr;
if (private_handle_t::validate(handle) < 0) {
LOGE("Registering invalid buffer, returning error");
ALOGE("Registering invalid buffer, returning error");
return -EINVAL;
}
@ -235,7 +235,7 @@ static int gralloc_register_buffer(gralloc_module_t const* module, buffer_handle
ump_result res = ump_open(); /* TODO: Fix a ump_close() somewhere??? */
if (res != UMP_OK) {
pthread_mutex_unlock(&s_map_lock);
LOGE("Failed to open UMP library");
ALOGE("Failed to open UMP library");
return retval;
}
s_ump_is_open = 1;
@ -253,12 +253,12 @@ static int gralloc_register_buffer(gralloc_module_t const* module, buffer_handle
pthread_mutex_unlock(&s_map_lock);
return 0;
} else {
LOGE("Failed to map UMP handle");
ALOGE("Failed to map UMP handle");
}
ump_reference_release((ump_handle)hnd->ump_mem_handle);
} else {
LOGE("Failed to create UMP handle");
ALOGE("Failed to create UMP handle");
}
} else if (hnd->flags & private_handle_t::PRIV_FLAGS_USES_PMEM) {
pthread_mutex_unlock(&s_map_lock);
@ -269,7 +269,7 @@ static int gralloc_register_buffer(gralloc_module_t const* module, buffer_handle
if (gMemfd == 0) {
gMemfd = open(PFX_NODE_MEM, O_RDWR);
if (gMemfd < 0) {
LOGE("%s:: %s exynos-mem open error\n", __func__, PFX_NODE_MEM);
ALOGE("%s:: %s exynos-mem open error\n", __func__, PFX_NODE_MEM);
return false;
}
}
@ -289,14 +289,14 @@ static int gralloc_register_buffer(gralloc_module_t const* module, buffer_handle
pthread_mutex_unlock(&s_map_lock);
return 0;
} else {
LOGE("Failed to map UMP handle");
ALOGE("Failed to map UMP handle");
}
ump_reference_release((ump_handle)hnd->ump_mem_handle);
} else {
LOGE("Failed to create UMP handle");
ALOGE("Failed to create UMP handle");
}
} else {
LOGE("registering non-UMP buffer not supported");
ALOGE("registering non-UMP buffer not supported");
}
pthread_mutex_unlock(&s_map_lock);
@ -306,7 +306,7 @@ static int gralloc_register_buffer(gralloc_module_t const* module, buffer_handle
static int gralloc_unregister_buffer(gralloc_module_t const* module, buffer_handle_t handle)
{
if (private_handle_t::validate(handle) < 0) {
LOGE("unregistering invalid buffer, returning error");
ALOGE("unregistering invalid buffer, returning error");
return -EINVAL;
}
@ -315,9 +315,9 @@ static int gralloc_unregister_buffer(gralloc_module_t const* module, buffer_hand
#ifdef USE_PARTIAL_FLUSH
if (hnd->flags & private_handle_t::PRIV_FLAGS_USES_UMP)
if (!release_rect((int)hnd->ump_id))
LOGE("secureID: 0x%x, release error", (int)hnd->ump_id);
ALOGE("secureID: 0x%x, release error", (int)hnd->ump_id);
#endif
LOGE_IF(hnd->lockState & private_handle_t::LOCK_STATE_READ_MASK,
ALOGE_IF(hnd->lockState & private_handle_t::LOCK_STATE_READ_MASK,
"[unregister] handle %p still locked (state=%08x)", hnd, hnd->lockState);
/* never unmap buffers that were created in this process */
@ -347,7 +347,7 @@ static int gralloc_unregister_buffer(gralloc_module_t const* module, buffer_hand
hnd->lockState = 0;
hnd->writeOwner = 0;
} else {
LOGE("unregistering non-UMP buffer not supported");
ALOGE("unregistering non-UMP buffer not supported");
}
pthread_mutex_unlock(&s_map_lock);
@ -361,7 +361,7 @@ static int gralloc_lock(gralloc_module_t const* module, buffer_handle_t handle,
{
int err = 0;
if (private_handle_t::validate(handle) < 0) {
LOGE("Locking invalid buffer, returning error");
ALOGE("Locking invalid buffer, returning error");
return -EINVAL;
}
@ -394,7 +394,7 @@ static int gralloc_lock(gralloc_module_t const* module, buffer_handle_t handle,
static int gralloc_unlock(gralloc_module_t const* module, buffer_handle_t handle)
{
if (private_handle_t::validate(handle) < 0) {
LOGE("Unlocking invalid buffer, returning error");
ALOGE("Unlocking invalid buffer, returning error");
return -EINVAL;
}
@ -423,7 +423,7 @@ static int gralloc_unlock(gralloc_module_t const* module, buffer_handle_t handle
ret = ioctl(gMemfd, EXYNOS_MEM_PADDR_CACHE_FLUSH, &mem);
if (ret < 0) {
LOGE("Error in exynos-mem : EXYNOS_MEM_PADDR_CACHE_FLUSH (%d)\n", ret);
ALOGE("Error in exynos-mem : EXYNOS_MEM_PADDR_CACHE_FLUSH (%d)\n", ret);
return false;
}
}

@ -79,7 +79,7 @@ endif
ifeq ($(BOARD_USE_V4L2_ION),true)
LOCAL_CFLAGS += -DBOARD_USE_V4L2_ION
LOCAL_SHARED_LIBRARIES += libion
LOCAL_SHARED_LIBRARIES += libsamsungion
endif
LOCAL_MODULE := libhdmi

File diff suppressed because it is too large Load Diff

@ -18,8 +18,8 @@
**
*/
//#define LOG_NDEBUG 0
//#define LOG_TAG "libhdmi"
//#define ALOG_NDEBUG 0
//#define ALOG_TAG "libhdmi"
#include <cutils/log.h>
#include "videodev2.h"

File diff suppressed because it is too large Load Diff

@ -17,8 +17,8 @@
#ifndef __HDMI_HAL_V4L2_UTILS_H__
#define __HDMI_HAL_V4L2_UTILS_H__
//#define LOG_NDEBUG 0
//#define LOG_TAG "libhdmi"
//#define ALOG_NDEBUG 0
//#define ALOG_TAG "libhdmi"
#if defined(BOARD_USE_V4L2)
#include "SecBuffer.h"
#endif

@ -41,7 +41,7 @@ int fb_open(int win)
fp = open(node, O_RDWR);
if (fp < 0)
LOGE("%s: fb[%d] open failed", __func__, win);
ALOGE("%s: fb[%d] open failed", __func__, win);
return fp;
}
@ -51,7 +51,7 @@ int fb_close(int fp)
if (fp)
close(fp);
else
LOGE("%s: fb is not allocated %d", __func__, fp);
ALOGE("%s: fb is not allocated %d", __func__, fp);
return 0;
}
@ -62,7 +62,7 @@ int get_fscreeninfo(int fp, struct fb_fix_screeninfo *fix)
ret = ioctl(fp, FBIOGET_FSCREENINFO, fix);
if (ret)
LOGE("%s: FBIOGET_FSCREENINFO failed", __func__);
ALOGE("%s: FBIOGET_FSCREENINFO failed", __func__);
return ret;
}
@ -73,7 +73,7 @@ int get_vscreeninfo(int fp, struct fb_var_screeninfo *var)
ret = ioctl(fp, FBIOGET_VSCREENINFO, var);
if (ret)
LOGE("%s:: FBIOGET_VSCREENINFO failed", __func__);
ALOGE("%s:: FBIOGET_VSCREENINFO failed", __func__);
return ret;
}
@ -84,7 +84,7 @@ int put_vscreeninfo(int fp, struct fb_var_screeninfo *var)
ret = ioctl(fp, FBIOPUT_VSCREENINFO, var);
if (ret)
LOGE("%s:: FBIOPUT_VSCREENINFO failed", __func__);
ALOGE("%s:: FBIOPUT_VSCREENINFO failed", __func__);
return ret;
}
@ -102,7 +102,7 @@ char *fb_mmap(__u32 size, int fp)
buffer = (char *)mmap(0, size, PROT_READ | PROT_WRITE,
MAP_SHARED, fp, 0);
if (!buffer) {
LOGE("%s:: mmap failed", __func__);
ALOGE("%s:: mmap failed", __func__);
return NULL;
}
@ -115,7 +115,7 @@ int fb_ioctl(int fp, __u32 cmd, void *arg)
ret = ioctl(fp, cmd, arg);
if (ret < 0)
LOGE("%s:: ioctl (%d) failed", __func__, cmd);
ALOGE("%s:: ioctl (%d) failed", __func__, cmd);
return ret;
}
@ -126,7 +126,7 @@ int fb_on(int fp)
ret = ioctl(fp, FBIOBLANK, FB_BLANK_UNBLANK);
if (ret)
LOGE("%s:: FBIOBLANK failed", __func__);
ALOGE("%s:: FBIOBLANK failed", __func__);
return ret;
}
@ -137,7 +137,7 @@ int fb_off(int fp)
ret = ioctl(fp, FBIOBLANK, FB_BLANK_POWERDOWN);
if (ret)
LOGE("%s:: FBIOBLANK failed", __func__);
ALOGE("%s:: FBIOBLANK failed", __func__);
return ret;
}
@ -152,7 +152,7 @@ int fb_off_all()
return -1;
if (ioctl(fp, FBIOBLANK, FB_BLANK_POWERDOWN) < 0)
LOGE("%s:: FBIOBLANK failed", __func__);
ALOGE("%s:: FBIOBLANK failed", __func__);
fb_off(fp);
fb_close(fp);

@ -111,7 +111,7 @@ sp<MessageBase> MessageQueue::waitMessage(nsecs_t timeout)
}
if (nextEventTime >= 0) {
//LOGD("nextEventTime = %lld ms", nextEventTime);
//ALOGD("nextEventTime = %lld ms", nextEventTime);
if (nextEventTime > 0) {
// we're about to wait, flush the binder command buffer
IPCThreadState::self()->flushCommands();
@ -121,7 +121,7 @@ sp<MessageBase> MessageQueue::waitMessage(nsecs_t timeout)
}
}
} else {
//LOGD("going to wait");
//ALOGD("going to wait");
// we're about to wait, flush the binder command buffer
IPCThreadState::self()->flushCommands();
mCondition.wait(mLock);
@ -165,7 +165,7 @@ status_t MessageQueue::queueMessage(
message->when = systemTime() + relTime;
mMessages.insert(message);
//LOGD("MessageQueue::queueMessage time = %lld ms", message->when);
//ALOGD("MessageQueue::queueMessage time = %lld ms", message->when);
//dumpLocked(message);
mCondition.signal();
@ -185,7 +185,7 @@ void MessageQueue::dumpLocked(const sp<MessageBase>& message)
int c = 0;
while (cur != end) {
const char tick = (*cur == message) ? '>' : ' ';
LOGD("%c %d: msg{.what=%08x, when=%lld}",
ALOGD("%c %d: msg{.what=%08x, when=%lld}",
tick, c, (*cur)->what, (*cur)->when);
++cur;
c++;

@ -22,7 +22,7 @@
** @date 2011-07-06
*/
#define LOG_TAG "libhdmiclient"
#define ALOG_TAG "libhdmiclient"
#include "SecHdmiClient.h"
@ -48,7 +48,7 @@ SecHdmiClient * SecHdmiClient::getInstance(void)
void SecHdmiClient::setHdmiCableStatus(int status)
{
//LOGD("%s HDMI status: %d\n", __func__, status);
//ALOGD("%s HDMI status: %d\n", __func__, status);
if (g_SecTVOutService != 0)
g_SecTVOutService->setHdmiCableStatus(status);
@ -56,7 +56,7 @@ void SecHdmiClient::setHdmiCableStatus(int status)
void SecHdmiClient::setHdmiMode(int mode)
{
//LOGD("%s HDMI Mode: %d\n", __func__, mode);
//ALOGD("%s HDMI Mode: %d\n", __func__, mode);
if (g_SecTVOutService != 0)
g_SecTVOutService->setHdmiMode(mode);
@ -64,7 +64,7 @@ void SecHdmiClient::setHdmiMode(int mode)
void SecHdmiClient::setHdmiResolution(int resolution)
{
//LOGD("%s HDMI Resolution: %d\n", __func__, resolution);
//ALOGD("%s HDMI Resolution: %d\n", __func__, resolution);
if (g_SecTVOutService != 0)
g_SecTVOutService->setHdmiResolution(resolution);
@ -72,7 +72,7 @@ void SecHdmiClient::setHdmiResolution(int resolution)
void SecHdmiClient::setHdmiHdcp(int enHdcp)
{
//LOGD("%s HDMI HDCP: %d\n", __func__, enHdcp);
//ALOGD("%s HDMI HDCP: %d\n", __func__, enHdcp);
if (g_SecTVOutService != 0)
g_SecTVOutService->setHdmiHdcp(enHdcp);
@ -80,7 +80,7 @@ void SecHdmiClient::setHdmiHdcp(int enHdcp)
void SecHdmiClient::setHdmiRotate(int rotVal, uint32_t hwcLayer)
{
//LOGD("%s HDMI ROTATE: %d\n", __func__, rotVal);
//ALOGD("%s HDMI ROTATE: %d\n", __func__, rotVal);
if (g_SecTVOutService != 0)
g_SecTVOutService->setHdmiRotate(rotVal, hwcLayer);
@ -88,7 +88,7 @@ void SecHdmiClient::setHdmiRotate(int rotVal, uint32_t hwcLayer)
void SecHdmiClient::setHdmiHwcLayer(uint32_t hwcLayer)
{
//LOGD("%s HDMI HWCLAYER: %d\n", __func__, hwcLayer);
//ALOGD("%s HDMI HWCLAYER: %d\n", __func__, hwcLayer);
if (g_SecTVOutService != 0)
g_SecTVOutService->setHdmiHwcLayer(hwcLayer);
@ -96,7 +96,7 @@ void SecHdmiClient::setHdmiHwcLayer(uint32_t hwcLayer)
void SecHdmiClient::setHdmiEnable(uint32_t enable)
{
//LOGD("%s HDMI ENABLE: %d\n", __func__, enable);
//ALOGD("%s HDMI ENABLE: %d\n", __func__, enable);
if (g_SecTVOutService != 0)
mEnable = enable;
@ -128,7 +128,7 @@ sp<ISecTVOut> SecHdmiClient::m_getSecTVOutService(void)
for(getSvcTimes = 0; getSvcTimes < GETSERVICETIMEOUT; getSvcTimes++) {
binder = sm->getService(String16("SecTVOutService"));
if (binder == 0) {
LOGW("SecTVOutService not published, waiting...");
ALOGW("SecTVOutService not published, waiting...");
usleep(500000); // 0.5 s
} else {
break;
@ -139,7 +139,7 @@ sp<ISecTVOut> SecHdmiClient::m_getSecTVOutService(void)
sc = interface_cast<ISecTVOut>(binder);
g_SecTVOutService = sc;
} else {
LOGW("Failed to get SecTVOutService... SecHdmiClient will get it later..");
ALOGW("Failed to get SecTVOutService... SecHdmiClient will get it later..");
}
}
return g_SecTVOutService;

@ -22,7 +22,7 @@
** @date 2011-07-06
*/
#define LOG_TAG "SecTVOutService"
#define ALOG_TAG "SecTVOutService"
#include <binder/IServiceManager.h>
#include <utils/RefBase.h>
@ -61,15 +61,15 @@ namespace android {
int SecTVOutService::instantiate()
{
LOGD("SecTVOutService instantiate");
ALOGD("SecTVOutService instantiate");
int r = defaultServiceManager()->addService(String16( "SecTVOutService"), new SecTVOutService ());
LOGD("SecTVOutService r=%d", r);
ALOGD("SecTVOutService r=%d", r);
return r;
}
SecTVOutService::SecTVOutService () {
LOGV("SecTVOutService created");
ALOGV("SecTVOutService created");
mHdmiCableInserted = false;
#ifdef SUPPORT_G2D_UI_MODE
mUILayerMode = SecHdmi::HDMI_LAYER_GRAPHIC_1;
@ -81,7 +81,7 @@ namespace android {
setLCDsize();
if (mSecHdmi.create(mLCD_width, mLCD_height) == false)
LOGE("%s::mSecHdmi.create() fail", __func__);
ALOGE("%s::mSecHdmi.create() fail", __func__);
else
setHdmiStatus(1);
@ -118,7 +118,7 @@ namespace android {
}
SecTVOutService::~SecTVOutService () {
LOGV ("SecTVOutService destroyed");
ALOGV ("SecTVOutService destroyed");
if (mHdmiFlushThread != NULL) {
mHdmiFlushThread->requestExit();
@ -178,7 +178,7 @@ namespace android {
} break;
default :
LOGE ( "onTransact::default");
ALOGE ( "onTransact::default");
return BBinder::onTransact (code, data, reply, flags);
}
@ -188,7 +188,7 @@ namespace android {
void SecTVOutService::setHdmiStatus(uint32_t status)
{
LOGD("%s HDMI cable status = %d", __func__, status);
ALOGD("%s HDMI cable status = %d", __func__, status);
{
Mutex::Autolock _l(mLock);
@ -199,12 +199,12 @@ namespace android {
if (hdmiCableInserted == true) {
if (mSecHdmi.connect() == false) {
LOGE("%s::mSecHdmi.connect() fail", __func__);
ALOGE("%s::mSecHdmi.connect() fail", __func__);
hdmiCableInserted = false;
}
} else {
if (mSecHdmi.disconnect() == false)
LOGE("%s::mSecHdmi.disconnect() fail", __func__);
ALOGE("%s::mSecHdmi.disconnect() fail", __func__);
}
mHdmiCableInserted = hdmiCableInserted;
@ -216,51 +216,51 @@ namespace android {
void SecTVOutService::setHdmiMode(uint32_t mode)
{
LOGD("%s TV mode = %d", __func__, mode);
ALOGD("%s TV mode = %d", __func__, mode);
Mutex::Autolock _l(mLock);
if ((hdmiCableInserted() == true) && (mSecHdmi.setHdmiOutputMode(mode)) == false) {
LOGE("%s::mSecHdmi.setHdmiOutputMode() fail", __func__);
ALOGE("%s::mSecHdmi.setHdmiOutputMode() fail", __func__);
return;
}
}
void SecTVOutService::setHdmiResolution(uint32_t resolution)
{
//LOGD("%s TV resolution = %d", __func__, resolution);
//ALOGD("%s TV resolution = %d", __func__, resolution);
Mutex::Autolock _l(mLock);
if ((hdmiCableInserted() == true) && (mSecHdmi.setHdmiResolution(resolution)) == false) {
LOGE("%s::mSecHdmi.setHdmiResolution() fail", __func__);
ALOGE("%s::mSecHdmi.setHdmiResolution() fail", __func__);
return;
}
}
void SecTVOutService::setHdmiHdcp(uint32_t hdcp_en)
{
LOGD("%s TV HDCP = %d", __func__, hdcp_en);
ALOGD("%s TV HDCP = %d", __func__, hdcp_en);
Mutex::Autolock _l(mLock);
if ((hdmiCableInserted() == true) && (mSecHdmi.setHdcpMode(hdcp_en)) == false) {
LOGE("%s::mSecHdmi.setHdcpMode() fail", __func__);
ALOGE("%s::mSecHdmi.setHdcpMode() fail", __func__);
return;
}
}
void SecTVOutService::setHdmiRotate(uint32_t rotVal, uint32_t hwcLayer)
{
//LOGD("%s TV ROTATE = %d", __func__, rotVal);
//ALOGD("%s TV ROTATE = %d", __func__, rotVal);
Mutex::Autolock _l(mLock);
if ((hdmiCableInserted() == true) && (mSecHdmi.setUIRotation(rotVal, hwcLayer)) == false) {
LOGE("%s::mSecHdmi.setUIRotation() fail", __func__);
ALOGE("%s::mSecHdmi.setUIRotation() fail", __func__);
return;
}
}
void SecTVOutService::setHdmiHwcLayer(uint32_t hwcLayer)
{
//LOGD("%s TV HWCLAYER = %d", __func__, hwcLayer);
//ALOGD("%s TV HWCLAYER = %d", __func__, hwcLayer);
Mutex::Autolock _l(mLock);
mHwcLayer = hwcLayer;
@ -301,15 +301,15 @@ namespace android {
#ifdef SUPPORT_G2D_UI_MODE
if (mHwcLayer == 0) {
if (mSecHdmi.clear(SecHdmi::HDMI_LAYER_VIDEO) == false)
LOGE("%s::mSecHdmi.clear(%d) fail", __func__, SecHdmi::HDMI_LAYER_VIDEO);
ALOGE("%s::mSecHdmi.clear(%d) fail", __func__, SecHdmi::HDMI_LAYER_VIDEO);
if (mSecHdmi.clear(SecHdmi::HDMI_LAYER_GRAPHIC_0) == false)
LOGE("%s::mSecHdmi.clear(%d) fail", __func__, SecHdmi::HDMI_LAYER_GRAPHIC_0);
ALOGE("%s::mSecHdmi.clear(%d) fail", __func__, SecHdmi::HDMI_LAYER_GRAPHIC_0);
}
#endif
if (mUILayerMode != hdmiLayer) {
if (mSecHdmi.clear(mUILayerMode) == false)
LOGE("%s::mSecHdmi.clear(%d) fail", __func__, mUILayerMode);
ALOGE("%s::mSecHdmi.clear(%d) fail", __func__, mUILayerMode);
}
mUILayerMode = hdmiLayer;
@ -324,10 +324,10 @@ namespace android {
#endif
if (mSecHdmi.flush(w, h, colorFormat, pPhyYAddr, pPhyCbAddr, pPhyCrAddr, dstX, dstY,
mUILayerMode, mHwcLayer) == false)
LOGE("%s::mSecHdmi.flush() on HDMI_MODE_UI fail", __func__);
ALOGE("%s::mSecHdmi.flush() on HDMI_MODE_UI fail", __func__);
#ifdef CHECK_UI_TIME
end = systemTime();
LOGD("[UI] mSecHdmi.flush[end-start] = %ld ms", long(ns2ms(end)) - long(ns2ms(start)));
ALOGD("[UI] mSecHdmi.flush[end-start] = %ld ms", long(ns2ms(end)) - long(ns2ms(start)));
#endif
}
#else
@ -345,9 +345,9 @@ namespace android {
#if !defined(BOARD_USES_HDMI_SUBTITLES)
#ifdef SUPPORT_G2D_UI_MODE
if (mSecHdmi.clear(SecHdmi::HDMI_LAYER_GRAPHIC_0) == false)
LOGE("%s::mSecHdmi.clear(%d) fail", __func__, SecHdmi::HDMI_LAYER_GRAPHIC_0);
ALOGE("%s::mSecHdmi.clear(%d) fail", __func__, SecHdmi::HDMI_LAYER_GRAPHIC_0);
if (mSecHdmi.clear(SecHdmi::HDMI_LAYER_GRAPHIC_1) == false)
LOGE("%s::mSecHdmi.clear(%d) fail", __func__, SecHdmi::HDMI_LAYER_GRAPHIC_1);
ALOGE("%s::mSecHdmi.clear(%d) fail", __func__, SecHdmi::HDMI_LAYER_GRAPHIC_1);
#endif
#endif
@ -357,10 +357,10 @@ namespace android {
#endif
if (mSecHdmi.flush(w, h, colorFormat, pPhyYAddr, pPhyCbAddr, pPhyCrAddr, dstX, dstY,
SecHdmi::HDMI_LAYER_VIDEO, mHwcLayer) == false)
LOGE("%s::mSecHdmi.flush() on HDMI_MODE_VIDEO fail", __func__);
ALOGE("%s::mSecHdmi.flush() on HDMI_MODE_VIDEO fail", __func__);
#ifdef CHECK_VIDEO_TIME
end = systemTime();
LOGD("[Video] mSecHdmi.flush[end-start] = %ld ms", long(ns2ms(end)) - long(ns2ms(start)));
ALOGD("[Video] mSecHdmi.flush[end-start] = %ld ms", long(ns2ms(end)) - long(ns2ms(start)));
#endif
#else
msg = new SecHdmiEventMsg(&mSecHdmi, w, h, colorFormat, pPhyYAddr, pPhyCbAddr, pPhyCrAddr,
@ -372,7 +372,7 @@ namespace android {
break;
default:
LOGE("unmatched HDMI_MODE : %d", hdmiMode);
ALOGE("unmatched HDMI_MODE : %d", hdmiMode);
break;
}

@ -139,12 +139,12 @@ namespace android {
#endif
if (pSecHdmi->flush(mSrcWidth, mSrcHeight, mSrcColorFormat, mSrcYAddr, mSrcCbAddr, mSrcCrAddr,
mDstX, mDstY, mHdmiLayer, mHwcLayer) == false) {
LOGE("%s::pSecHdmi->flush() fail on HDMI_MODE_UI", __func__);
ALOGE("%s::pSecHdmi->flush() fail on HDMI_MODE_UI", __func__);
ret = false;
}
#ifdef CHECK_UI_TIME
end = systemTime();
LOGD("[UI] pSecHdmi->flush[end-start] = %ld ms", long(ns2ms(end)) - long(ns2ms(start)));
ALOGD("[UI] pSecHdmi->flush[end-start] = %ld ms", long(ns2ms(end)) - long(ns2ms(start)));
#endif
break;
case HDMI_MODE_VIDEO:
@ -153,16 +153,16 @@ namespace android {
#endif
if (pSecHdmi->flush(mSrcWidth, mSrcHeight, mSrcColorFormat, mSrcYAddr, mSrcCbAddr, mSrcCrAddr,
mDstX, mDstY, mHdmiLayer, mHwcLayer) == false) {
LOGE("%s::pSecHdmi->flush() fail on HDMI_MODE_VIDEO", __func__);
ALOGE("%s::pSecHdmi->flush() fail on HDMI_MODE_VIDEO", __func__);
ret = false;
}
#ifdef CHECK_VIDEO_TIME
end = systemTime();
LOGD("[VIDEO] pSecHdmi->flush[end-start] = %ld ms", long(ns2ms(end)) - long(ns2ms(start)));
ALOGD("[VIDEO] pSecHdmi->flush[end-start] = %ld ms", long(ns2ms(end)) - long(ns2ms(start)));
#endif
break;
default:
LOGE("Undefined HDMI_MODE");
ALOGE("Undefined HDMI_MODE");
ret = false;
break;
}

@ -74,7 +74,7 @@ int CECOpen()
CECClose();
if ((fd = open(CEC_DEVICE_NAME, O_RDWR)) < 0) {
LOGE("Can't open %s!\n", CEC_DEVICE_NAME);
ALOGE("Can't open %s!\n", CEC_DEVICE_NAME);
res = 0;
}
@ -92,7 +92,7 @@ int CECClose()
if (fd != -1) {
if (close(fd) != 0) {
LOGE("close() failed!\n");
ALOGE("close() failed!\n");
res = 0;
}
fd = -1;
@ -115,12 +115,12 @@ int CECAllocLogicalAddress(int paddr, enum CECDeviceType devtype)
int i = 0;
if (fd == -1) {
LOGE("open device first!\n");
ALOGE("open device first!\n");
return 0;
}
if (CECSetLogicalAddr(laddr) < 0) {
LOGE("CECSetLogicalAddr() failed!\n");
ALOGE("CECSetLogicalAddr() failed!\n");
return 0;
}
@ -141,12 +141,12 @@ int CECAllocLogicalAddress(int paddr, enum CECDeviceType devtype)
}
if (laddr == CEC_LADDR_UNREGISTERED) {
LOGE("All LA addresses in use!!!\n");
ALOGE("All LA addresses in use!!!\n");
return CEC_LADDR_UNREGISTERED;
}
if (CECSetLogicalAddr(laddr) < 0) {
LOGE("CECSetLogicalAddr() failed!\n");
ALOGE("CECSetLogicalAddr() failed!\n");
return 0;
}
@ -159,7 +159,7 @@ int CECAllocLogicalAddress(int paddr, enum CECDeviceType devtype)
buffer[4] = devtype;
if (CECSendMessage(buffer, 5) != 5) {
LOGE("CECSendMessage() failed!\n");
ALOGE("CECSendMessage() failed!\n");
return 0;
}
@ -177,17 +177,17 @@ int CECAllocLogicalAddress(int paddr, enum CECDeviceType devtype)
int CECSendMessage(unsigned char *buffer, int size)
{
if (fd == -1) {
LOGE("open device first!\n");
ALOGE("open device first!\n");
return 0;
}
if (size > CEC_MAX_FRAME_SIZE) {
LOGE("size should not exceed %d\n", CEC_MAX_FRAME_SIZE);
ALOGE("size should not exceed %d\n", CEC_MAX_FRAME_SIZE);
return 0;
}
#if CEC_DEBUG
LOGI("CECSendMessage() : ");
ALOGI("CECSendMessage() : ");
CECPrintFrame(buffer, size);
#endif
@ -211,7 +211,7 @@ int CECReceiveMessage(unsigned char *buffer, int size, long timeout)
int retval;
if (fd == -1) {
LOGE("open device first!\n");
ALOGE("open device first!\n");
return 0;
}
@ -228,7 +228,7 @@ int CECReceiveMessage(unsigned char *buffer, int size, long timeout)
} else if (retval) {
bytes = read(fd, buffer, size);
#if CEC_DEBUG
LOGI("CECReceiveMessage() : size(%d)", bytes);
ALOGI("CECReceiveMessage() : size(%d)", bytes);
if(bytes > 0)
CECPrintFrame(buffer, bytes);
#endif
@ -245,7 +245,7 @@ int CECReceiveMessage(unsigned char *buffer, int size, long timeout)
int CECSetLogicalAddr(unsigned int laddr)
{
if (ioctl(fd, CEC_IOC_SETLADDR, &laddr)) {
LOGE("ioctl(CEC_IOC_SETLA) failed!\n");
ALOGE("ioctl(CEC_IOC_SETLA) failed!\n");
return 0;
}
@ -260,12 +260,12 @@ void CECPrintFrame(unsigned char *buffer, unsigned int size)
{
if (size > 0) {
int i;
LOGI("fsize: %d ", size);
LOGI("frame: ");
ALOGI("fsize: %d ", size);
ALOGI("frame: ");
for (i = 0; i < size; i++)
LOGI("0x%02x ", buffer[i]);
ALOGI("0x%02x ", buffer[i]);
LOGI("\n");
ALOGI("\n");
}
}
#endif

@ -83,7 +83,7 @@ int DDCOpen()
// open
if ((ddc_fd = open(DEV_NAME,O_RDWR)) < 0) {
LOGE("%s: Cannot open I2C_DDC : %s",__func__, DEV_NAME);
ALOGE("%s: Cannot open I2C_DDC : %s",__func__, DEV_NAME);
ret = 0;
}
@ -102,7 +102,7 @@ int DDCClose()
// check if fd is available
if (ref_cnt == 0) {
#if DDC_DEBUG
LOGE("%s: I2C_DDC is not available!!!!", __func__);
ALOGE("%s: I2C_DDC is not available!!!!", __func__);
#endif
return 1;
}
@ -115,7 +115,7 @@ int DDCClose()
if (close(ddc_fd) < 0) {
#if DDC_DEBUG
LOGE("%s: Cannot close I2C_DDC : %s",__func__,DEV_NAME);
ALOGE("%s: Cannot close I2C_DDC : %s",__func__,DEV_NAME);
#endif
ret = 0;
}
@ -143,7 +143,7 @@ int DDCRead(unsigned char addr, unsigned char offset,
if (!DDCFileAvailable()) {
#if DDC_DEBUG
LOGE("%s: I2C_DDC is not available!!!!", __func__);
ALOGE("%s: I2C_DDC is not available!!!!", __func__);
#endif
return 0;
}
@ -193,7 +193,7 @@ int EDDCRead(unsigned char segpointer, unsigned char segment, unsigned char addr
if (!DDCFileAvailable()) {
#if DDC_DEBUG
LOGE("%s: I2C_DDC is not available!!!!", __func__);
ALOGE("%s: I2C_DDC is not available!!!!", __func__);
#endif
return 0;
}
@ -227,7 +227,7 @@ int EDDCRead(unsigned char segpointer, unsigned char segment, unsigned char addr
// eddc read
if (ioctl(ddc_fd, I2C_RDWR, &msgset) < 0) {
#if DDC_DEBUG
LOGE("%s: ioctl(I2C_RDWR) failed!!!", __func__);
ALOGE("%s: ioctl(I2C_RDWR) failed!!!", __func__);
#endif
ret = 0;
}
@ -251,7 +251,7 @@ int DDCWrite(unsigned char addr, unsigned char offset, unsigned int size, unsign
// allocate temporary buffer
temp = (unsigned char*) malloc((size+1)*sizeof(unsigned char));
if (!temp) {
LOGE("%s: not enough resources at %s", __FUNCTION__);
ALOGE("%s: not enough resources at %s", __FUNCTION__);
goto exit;
}
@ -259,18 +259,18 @@ int DDCWrite(unsigned char addr, unsigned char offset, unsigned int size, unsign
memcpy(temp+1,buffer,size);
if (!DDCFileAvailable()) {
LOGE("%s: I2C_DDC is not available!!!!", __func__);
ALOGE("%s: I2C_DDC is not available!!!!", __func__);
goto exit;
}
if (ioctl(ddc_fd, I2C_SLAVE, addr>>1) < 0) {
LOGE("%s: cannot set slave address 0x%02x", __func__,addr);
ALOGE("%s: cannot set slave address 0x%02x", __func__,addr);
goto exit;
}
// write temp buffer
if ((bytes = write(ddc_fd,temp,size+1)) != (size+1)) {
LOGE("%s: fail to write %d bytes, only write %d bytes",__func__, size, bytes);
ALOGE("%s: fail to write %d bytes, only write %d bytes",__func__, size, bytes);
goto exit;
}

@ -27,7 +27,7 @@
//#define EDID_DEBUG 1
#ifdef EDID_DEBUG
#define DPRINTF(args...) LOGI(args)
#define DPRINTF(args...) ALOGI(args)
#else
#define DPRINTF(args...)
#endif
@ -219,11 +219,11 @@ static int ReadEDIDBlock(const unsigned int blockNum, unsigned char* const outBu
#ifdef EDID_DEBUG
offset = 0;
do {
LOGI("0x%02X", outBuffer[offset++]);
ALOGI("0x%02X", outBuffer[offset++]);
if (offset % 16)
LOGI(" ");
ALOGI(" ");
else
LOGI("\n");
ALOGI("\n");
} while (SIZEOFEDIDBLOCK > offset);
#endif // EDID_DEBUG
return 1;

@ -75,7 +75,7 @@ hwc_module_t HAL_MODULE_INFO_SYM = {
/*****************************************************************************/
static void dump_layer(hwc_layer_t const* l) {
LOGD("\ttype=%d, flags=%08x, handle=%p, tr=%02x, blend=%04x, "
ALOGD("\ttype=%d, flags=%08x, handle=%p, tr=%02x, blend=%04x, "
"{%d,%d,%d,%d}, {%d,%d,%d,%d}",
l->compositionType, l->flags, l->handle, l->transform, l->blending,
l->sourceCrop.left,
@ -486,7 +486,7 @@ static int hwc_prepare(hwc_composer_device_t *dev, hwc_layer_list_t* list)
} else {
ret = assign_overlay_window(ctx, cur, overlay_win_cnt, i);
if (ret != 0) {
LOGE("assign_overlay_window fail, change to frambuffer");
ALOGE("assign_overlay_window fail, change to frambuffer");
cur->compositionType = HWC_FRAMEBUFFER;
ctx->num_of_fb_layer++;
continue;
@ -603,7 +603,7 @@ static int hwc_set(hwc_composer_device_t *dev,
* double buffered (2 or more) this buffer is already rendered.
* It is the redundant src buffer for FIMC rendering.
*/
LOGD("SKIP FIMC rendering for Layer%d", win->layer_index);
ALOGD("SKIP FIMC rendering for Layer%d", win->layer_index);
#if defined(BOARD_USES_HDMI)
skip_hdmi_rendering = 1;
#endif
@ -776,7 +776,7 @@ g2d_error:
android::SecHdmiClient::HDMI_MODE_VIDEO,
ctx->num_of_hwc_layer);
} else {
LOGE("%s: Unsupported format = %d", __func__, src_img.format);
ALOGE("%s: Unsupported format = %d", __func__, src_img.format);
}
}
#endif

@ -55,7 +55,7 @@
#include "s3c_mem.h"
#include "sec_format.h"
//#define HWC_DEBUG
#define HWC_DEBUG
#if defined(BOARD_USES_FIMGAPI)
#include "sec_g2d.h"
//#define SUB_TITLES_HWC

@ -30,6 +30,7 @@ LOCAL_C_INCLUDES := \
LOCAL_MODULE_TAGS := eng
LOCAL_MODULE := libhwconverter
include $(BUILD_SHARED_LIBRARY)
endif

@ -68,7 +68,7 @@ bool HardwareConverter::convert(
if (!handle_fimc->setSrcParams(width, height, src_crop_x, src_crop_y,
&src_crop_width, &src_crop_height,
src_har_format)) {
LOGE("%s:: setSrcParms() failed", __func__);
ALOGE("%s:: setSrcParms() failed", __func__);
return false;
}
@ -76,19 +76,19 @@ bool HardwareConverter::convert(
(unsigned int)src_addr_array[1],
(unsigned int)src_addr_array[1],
src_har_format)) {
LOGE("%s:: setSrcPhyAddr() failed", __func__);
ALOGE("%s:: setSrcPhyAddr() failed", __func__);
return false;
}
if (!handle_fimc->setRotVal(rotate_value)) {
LOGE("%s:: setRotVal() failed", __func__);
ALOGE("%s:: setRotVal() failed", __func__);
return false;
}
if (!handle_fimc->setDstParams(width, height, dst_crop_x, dst_crop_y,
&dst_crop_width, &dst_crop_height,
dst_har_format)) {
LOGE("%s:: setDstParams() failed", __func__);
ALOGE("%s:: setDstParams() failed", __func__);
return false;
}
@ -97,7 +97,7 @@ bool HardwareConverter::convert(
if (!handle_fimc->setDstAddr((unsigned int)(dst_addr_array[0]),
(unsigned int)(dst_addr_array[1]),
(unsigned int)(dst_addr_array[1]))) {
LOGE("%s:: setDstPhyAddr() failed", __func__);
ALOGE("%s:: setDstPhyAddr() failed", __func__);
return false;
}
break;
@ -106,14 +106,14 @@ bool HardwareConverter::convert(
if (!handle_fimc->setDstAddr((unsigned int)(dst_addr_array[0]),
(unsigned int)(dst_addr_array[1]),
(unsigned int)(dst_addr_array[2]))) {
LOGE("%s:: setDstPhyAddr() failed", __func__);
ALOGE("%s:: setDstPhyAddr() failed", __func__);
return false;
}
break;
}
if (!handle_fimc->draw(0, 0)) {
LOGE("%s:: handleOneShot() failed", __func__);
ALOGE("%s:: handleOneShot() failed", __func__);
return false;
}

@ -14,7 +14,7 @@
* limitations under the License.
*/
#define LOG_TAG "libhwjpeg"
#define ALOG_TAG "libhwjpeg"
#include <stdio.h>
#include <stdlib.h>
@ -63,13 +63,13 @@ static int jpeg_v4l2_querycap(int fd)
ret = ioctl(fd, VIDIOC_QUERYCAP, &cap);
if (!(cap.capabilities & V4L2_CAP_STREAMING))
LOGE("[%s]: does not support streaming", __func__);
ALOGE("[%s]: does not support streaming", __func__);
if (!(cap.capabilities & V4L2_CAP_VIDEO_OUTPUT))
LOGE("[%s]: does not support output", __func__);
ALOGE("[%s]: does not support output", __func__);
if (!(cap.capabilities & V4L2_CAP_VIDEO_CAPTURE))
LOGE("[%s]: does not support capture", __func__);
ALOGE("[%s]: does not support capture", __func__);
return ret;
}
@ -122,7 +122,7 @@ static int jpeg_v4l2_s_fmt(int fd, enum v4l2_buf_type type, struct jpeg_config *
}
break;
default:
LOGE("[%s]: invalid v4l2 buf type", __func__);
ALOGE("[%s]: invalid v4l2 buf type", __func__);
return -1;
}
@ -161,7 +161,7 @@ static int jpeg_v4l2_g_fmt(int fd, enum v4l2_buf_type type, struct jpeg_config *
config->pix.dec_fmt.out_fmt = fmt.fmt.pix_mp.pixelformat;
break;
default:
LOGE("[%s]: invalid v4l2 buf type", __func__);
ALOGE("[%s]: invalid v4l2 buf type", __func__);
return -1;
}
@ -174,13 +174,13 @@ int jpeghal_getconfig(int fd, struct jpeg_config *config)
ret = jpeg_v4l2_g_fmt(fd, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, config);
if (ret < 0) {
LOGE("[%s]: input G_FMT failed", __func__);
ALOGE("[%s]: input G_FMT failed", __func__);
return -1;
}
ret = jpeg_v4l2_g_fmt(fd, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, config);
if (ret < 0)
LOGE("[%s]: output G_FMT failed", __func__);
ALOGE("[%s]: output G_FMT failed", __func__);
return ret;
}
@ -219,7 +219,7 @@ static int jpeg_v4l2_querybuf(int fd, struct jpeg_buf *buf)
ret = ioctl(fd, VIDIOC_QUERYBUF, &v4l2_buf);
if (ret < 0) {
LOGE("[%s:%d]: VIDIOC_QUERYBUF failed", __func__, ret);
ALOGE("[%s:%d]: VIDIOC_QUERYBUF failed", __func__, ret);
return ret;
}
@ -229,9 +229,9 @@ static int jpeg_v4l2_querybuf(int fd, struct jpeg_buf *buf)
PROT_READ | PROT_WRITE, MAP_SHARED, fd,
v4l2_buf.m.planes[i].m.mem_offset);
//LOGI("[%s]: buf.start[%d] = %p, length = %d", __func__, 0, buf->start[0], buf->length[0]);
//ALOGI("[%s]: buf.start[%d] = %p, length = %d", __func__, 0, buf->start[0], buf->length[0]);
if (buf->start[0] == MAP_FAILED) {
LOGE("[%s]: mmap failed", __func__);
ALOGE("[%s]: mmap failed", __func__);
return -1;
}
}
@ -264,7 +264,7 @@ static int jpeg_v4l2_qbuf(int fd, struct jpeg_buf *buf)
ret = ioctl(fd, VIDIOC_QBUF, &v4l2_buf);
if (ret < 0) {
LOGE("[%s:%d] QBUF failed", __func__, ret);
ALOGE("[%s:%d] QBUF failed", __func__, ret);
return -1;
}
@ -283,7 +283,7 @@ static int jpeg_v4l2_dqbuf(int fd, enum v4l2_buf_type type, enum v4l2_memory mem
ret = ioctl(fd, VIDIOC_DQBUF, &buf);
if (ret < 0) {
LOGE("[%s:%d] DQBUF failed", __func__, ret);
ALOGE("[%s:%d] DQBUF failed", __func__, ret);
return -1;
}
@ -296,7 +296,7 @@ static int jpeg_v4l2_streamon(int fd, enum v4l2_buf_type type)
ret = ioctl(fd, VIDIOC_STREAMON, &type);
if (ret < 0) {
LOGE("[%s:%d] STREAMON failed", __func__, ret);
ALOGE("[%s:%d] STREAMON failed", __func__, ret);
return -1;
}
@ -309,7 +309,7 @@ static int jpeg_v4l2_streamoff(int fd, enum v4l2_buf_type type)
ret = ioctl(fd, VIDIOC_STREAMOFF, &type);
if (ret < 0) {
LOGE("[%s:%d] STREAMOFF failed", __func__, ret);
ALOGE("[%s:%d] STREAMOFF failed", __func__, ret);
return -1;
}
@ -324,13 +324,13 @@ int jpeghal_dec_init()
fd = open(JPEG_DEC_NODE, O_RDWR, 0);
if (fd < 0) {
LOGE("[%s]: JPEG dec open failed", __func__);
ALOGE("[%s]: JPEG dec open failed", __func__);
return -1;
}
ret = jpeg_v4l2_querycap(fd);
if (ret < 0) {
LOGE("[%s]: QUERYCAP failed", __func__);
ALOGE("[%s]: QUERYCAP failed", __func__);
return -1;
}
@ -344,13 +344,13 @@ int jpeghal_enc_init()
fd = open(JPEG_ENC_NODE, O_RDWR, 0);
if (fd < 0) {
LOGE("[%s]: JPEG enc open failed", __func__);
ALOGE("[%s]: JPEG enc open failed", __func__);
return -1;
}
ret = jpeg_v4l2_querycap(fd);
if (ret < 0) {
LOGE("[%s]: QUERYCAP failed", __func__);
ALOGE("[%s]: QUERYCAP failed", __func__);
return -1;
}
@ -365,13 +365,13 @@ int jpeghal_dec_setconfig(int fd, struct jpeg_config *config)
ret = jpeg_v4l2_s_fmt(fd, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, config);
if (ret < 0) {
LOGE("[%s]: decoder input S_FMT failed", __func__);
ALOGE("[%s]: decoder input S_FMT failed", __func__);
return -1;
}
ret = jpeg_v4l2_s_fmt(fd, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, config);
if (ret < 0) {
LOGE("[%s]: decoder output S_FMT failed", __func__);
ALOGE("[%s]: decoder output S_FMT failed", __func__);
return -1;
}
@ -393,7 +393,7 @@ int jpeghal_enc_setconfig(int fd, struct jpeg_config *config)
ret = jpeg_v4l2_s_jpegcomp(fd, config->enc_qual);
if (ret < 0) {
LOGE("[%s]: S_JPEGCOMP failed", __func__);
ALOGE("[%s]: S_JPEGCOMP failed", __func__);
return -1;
}
@ -401,13 +401,13 @@ int jpeghal_enc_setconfig(int fd, struct jpeg_config *config)
ret = jpeg_v4l2_s_fmt(fd, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, config);
if (ret < 0) {
LOGE("[%s]: encoder input S_FMT failed", __func__);
ALOGE("[%s]: encoder input S_FMT failed", __func__);
return -1;
}
ret = jpeg_v4l2_s_fmt(fd, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, config);
if (ret < 0) {
LOGE("[%s]: encoder output S_FMT failed", __func__);
ALOGE("[%s]: encoder output S_FMT failed", __func__);
return -1;
}
@ -431,14 +431,14 @@ int jpeghal_set_inbuf(int fd, struct jpeg_buf *buf)
ret = jpeg_v4l2_reqbufs(fd, 1, buf);
if (ret < 0) {
LOGE("[%s:%d]: Input REQBUFS failed", __func__, ret);
ALOGE("[%s:%d]: Input REQBUFS failed", __func__, ret);
return -1;
}
if (buf->memory == V4L2_MEMORY_MMAP) {
ret = jpeg_v4l2_querybuf(fd, buf);
if (ret < 0) {
LOGE("[%s:%d]: Input QUERYBUF failed", __func__, ret);
ALOGE("[%s:%d]: Input QUERYBUF failed", __func__, ret);
return -1;
}
}
@ -454,14 +454,14 @@ int jpeghal_set_outbuf(int fd, struct jpeg_buf *buf)
ret = jpeg_v4l2_reqbufs(fd, 1, buf);
if (ret < 0) {
LOGE("[%s:%d]: Output REQBUFS failed", __func__, ret);
ALOGE("[%s:%d]: Output REQBUFS failed", __func__, ret);
return -1;
}
if (buf->memory == V4L2_MEMORY_MMAP) {
ret = jpeg_v4l2_querybuf(fd, buf);
if (ret < 0) {
LOGE("[%s:%d]: Output QUERYBUF failed", __func__, ret);
ALOGE("[%s:%d]: Output QUERYBUF failed", __func__, ret);
return -1;
}
}
@ -475,13 +475,13 @@ static int jpeg_exe(int fd, struct jpeg_buf *in_buf, struct jpeg_buf *out_buf)
ret = jpeg_v4l2_qbuf(fd, in_buf);
if (ret < 0) {
LOGE("[%s:%d]: Input QBUF failed", __func__, ret);
ALOGE("[%s:%d]: Input QBUF failed", __func__, ret);
return -1;
}
ret = jpeg_v4l2_qbuf(fd, out_buf);
if (ret < 0) {
LOGE("[%s:%d]: Output QBUF failed", __func__, ret);
ALOGE("[%s:%d]: Output QBUF failed", __func__, ret);
return -1;
}
@ -500,7 +500,7 @@ int jpeghal_dec_exe(int fd, struct jpeg_buf *in_buf, struct jpeg_buf *out_buf)
ret = jpeg_exe(fd, in_buf, out_buf);
if (ret < 0)
LOGE("[%s]: JPEG decoding is failed", __func__);
ALOGE("[%s]: JPEG decoding is failed", __func__);
return ret;
}
@ -511,7 +511,7 @@ int jpeghal_enc_exe(int fd, struct jpeg_buf *in_buf, struct jpeg_buf *out_buf)
ret = jpeg_exe(fd, in_buf, out_buf);
if (ret < 0)
LOGE("[%s]: JPEG Encoding is failed", __func__);
ALOGE("[%s]: JPEG Encoding is failed", __func__);
return ret;
}
@ -548,7 +548,7 @@ int jpeghal_s_ctrl(int fd, int cid, int value)
ret = ioctl(fd, VIDIOC_S_CTRL, &vc);
if (ret != 0) {
LOGE("[%s] ioctl : cid(%d), value(%d)\n", __func__, cid, value);
ALOGE("[%s] ioctl : cid(%d), value(%d)\n", __func__, cid, value);
return -1;
}
@ -564,7 +564,7 @@ int jpeghal_g_ctrl(int fd, int id)
ret = ioctl(fd, VIDIOC_G_CTRL, &ctrl);
if (ret < 0) {
LOGE("[%s] ioctl : cid(%d)\n", __func__, ctrl.id);
ALOGE("[%s] ioctl : cid(%d)\n", __func__, ctrl.id);
return -1;
}

@ -16,8 +16,8 @@
** limitations under the License.
*/
//#define LOG_NDEBUG 0
#define LOG_TAG "Jpeg-api"
//#define ALOG_NDEBUG 0
#define ALOG_TAG "Jpeg-api"
#include <utils/Log.h>
#include <stdio.h>
@ -66,11 +66,11 @@ static unsigned int get_yuv_size(enum jpeg_frame_format out_format,
break;
default:
LOGV("get_yuv_size return fmt(%d)\n", out_format);
ALOGV("get_yuv_size return fmt(%d)\n", out_format);
return(0);
}
LOGV("get_yuv_size width(%d) height(%d)\n", width, height);
ALOGV("get_yuv_size width(%d) height(%d)\n", width, height);
switch (out_format) {
case YUV_422 :
@ -114,13 +114,13 @@ int api_jpeg_decode_init()
jpeg_ctx->jpeg_fd = open(JPEG_DRIVER_NAME, O_RDWR);
if (jpeg_ctx->jpeg_fd < 0) {
LOGE("JPEG driver open failed\n");
ALOGE("JPEG driver open failed\n");
return -1;
}
#ifdef S5P_VMEM
mem_fp = s5p_vmem_open();
LOGV("s5p_vmem_open\n");
ALOGV("s5p_vmem_open\n");
#else
jpeg_ctx->args.mmapped_addr = (char *) mmap(0,
JPEG_TOTAL_BUF_SIZE,
@ -129,10 +129,10 @@ int api_jpeg_decode_init()
jpeg_ctx->jpeg_fd, 0);
if (jpeg_ctx->args.mmapped_addr == NULL) {
LOGE("JPEG mmap failed\n");
ALOGE("JPEG mmap failed\n");
return -1;
}
LOGV("api_jpeg_decode_init jpeg_ctx->args.mmapped_addr 0x%08x\n",
ALOGV("api_jpeg_decode_init jpeg_ctx->args.mmapped_addr 0x%08x\n",
jpeg_ctx->args.mmapped_addr);
#endif /* S5P_VMEM */
@ -145,13 +145,13 @@ int api_jpeg_encode_init()
jpeg_ctx->jpeg_fd = open(JPEG_DRIVER_NAME, O_RDWR);
if (jpeg_ctx->jpeg_fd < 0) {
LOGE("JPEG driver open failed %d\n", jpeg_ctx->jpeg_fd);
ALOGE("JPEG driver open failed %d\n", jpeg_ctx->jpeg_fd);
return -1;
}
#ifdef S5P_VMEM
mem_fp = s5p_vmem_open();
LOGI("s5p_vmem_open\n");
ALOGI("s5p_vmem_open\n");
#else
jpeg_ctx->args.mmapped_addr = (char *) mmap(0,
@ -161,10 +161,10 @@ int api_jpeg_encode_init()
jpeg_ctx->jpeg_fd, 0);
if (jpeg_ctx->args.mmapped_addr == NULL) {
LOGE("JPEG mmap failed\n");
ALOGE("JPEG mmap failed\n");
return -1;
}
LOGV("api_jpeg_encode_init jpeg_ctx->args.mmapped_addr 0x%08x\n",
ALOGV("api_jpeg_encode_init jpeg_ctx->args.mmapped_addr 0x%08x\n",
jpeg_ctx->args.mmapped_addr);
#endif /* S5P_VMEM */
return jpeg_ctx->jpeg_fd;
@ -214,7 +214,7 @@ int api_jpeg_encode_deinit(int dev_fd)
void *api_jpeg_get_decode_in_buf(int dev_fd, unsigned int size)
{
if (size < 0 || size > MAX_JPEG_RES) {
LOGE("Invalid decode input buffer size\r\n");
ALOGE("Invalid decode input buffer size\r\n");
return NULL;
}
#ifdef S5P_VMEM
@ -246,7 +246,7 @@ void *api_jpeg_get_encode_in_buf(int dev_fd, unsigned int size)
jpeg_ctx->args.mmapped_addr);
#endif
LOGV("api_jpeg_get_encode_in_buf: 0x%x\n",
ALOGV("api_jpeg_get_encode_in_buf: 0x%x\n",
jpeg_ctx->args.in_buf);
return (void *)(jpeg_ctx->args.in_buf);
@ -266,7 +266,7 @@ void *api_jpeg_get_decode_out_buf(int dev_fd)
jpeg_ctx->args.mmapped_addr);
#endif /* S5P_VMEM */
/*
LOGV("api_jpeg_get_decode_out_buf: 0x%x\n",
ALOGV("api_jpeg_get_decode_out_buf: 0x%x\n",
jpeg_ctx->args.out_buf);
*/
return (void *)(jpeg_ctx->args.out_buf);
@ -286,7 +286,7 @@ void *api_jpeg_get_encode_out_buf(int dev_fd)
jpeg_ctx->args.mmapped_addr);
#endif /* S5P_VMEM */
LOGV("api_jpeg_get_encode_out_buf: 0x%x\n",
ALOGV("api_jpeg_get_encode_out_buf: 0x%x\n",
jpeg_ctx->args.out_buf);
return (void *)(jpeg_ctx->args.out_buf);
@ -312,7 +312,7 @@ enum jpeg_ret_type api_jpeg_decode_exe(int dev_fd,
arg = &(jpeg_ctx->args);
ioctl(jpeg_ctx->jpeg_fd, IOCTL_JPEG_DEC_EXE, arg->dec_param);
LOGV("api_jpeg_decode_exe dec_param->out_fmt :%d \
ALOGV("api_jpeg_decode_exe dec_param->out_fmt :%d \
dec_param->width : %d dec_param->height : %d\n",
arg->dec_param->out_fmt,
arg->dec_param->width,
@ -335,7 +335,7 @@ enum jpeg_ret_type api_jpeg_encode_exe(int dev_fd,
// check MCU validation width & height & sampling mode
if (check_input_size(jpeg_ctx->args.enc_param->width,
jpeg_ctx->args.enc_param->height) < 0) {
LOGV("width/height doesn't match with MCU\r\n");
ALOGV("width/height doesn't match with MCU\r\n");
return JPEG_FAIL;
}

@ -26,8 +26,6 @@ LOCAL_MODULE := libswconverter
LOCAL_PRELINK_MODULE := false
LOCAL_CFLAGS :=
LOCAL_ARM_MODE := arm
LOCAL_STATIC_LIBRARIES :=

@ -134,7 +134,7 @@ inline int HAL_PIXEL_FORMAT_2_V4L2_PIX(int HAL_PIXEL_FORMAT)
break;
default:
LOGE("%s::unmatched HAL_PIXEL_FORMAT color_space(0x%x)\n",
ALOGE("%s::unmatched HAL_PIXEL_FORMAT color_space(0x%x)\n",
__func__, HAL_PIXEL_FORMAT);
break;
}
@ -216,7 +216,7 @@ inline int V4L2_PIX_2_HAL_PIXEL_FORMAT(int V4L2_PIX)
break;
default:
LOGE("%s::unmatched V4L2_PIX color_space(%d)\n",
ALOGE("%s::unmatched V4L2_PIX color_space(%d)\n",
__func__, V4L2_PIX);
break;
}
@ -295,7 +295,7 @@ inline unsigned int FRAME_SIZE(int HAL_PIXEL_FORMAT, int w, int h)
break;
default:
LOGD("%s::no matching source colorformat(0x%x), w(%d), h(%d) fail\n",
ALOGD("%s::no matching source colorformat(0x%x), w(%d), h(%d) fail\n",
__func__, HAL_PIXEL_FORMAT, w, h);
break;
}

@ -151,7 +151,7 @@ inline int HAL_PIXEL_FORMAT_2_V4L2_PIX(int HAL_PIXEL_FORMAT)
break;
default:
LOGE("%s::unmatched HAL_PIXEL_FORMAT color_space(0x%x)\n",
ALOGE("%s::unmatched HAL_PIXEL_FORMAT color_space(0x%x)\n",
__func__, HAL_PIXEL_FORMAT);
break;
}
@ -239,7 +239,7 @@ inline int V4L2_PIX_2_HAL_PIXEL_FORMAT(int V4L2_PIX)
break;
default:
LOGE("%s::unmatched V4L2_PIX color_space(%d)\n",
ALOGE("%s::unmatched V4L2_PIX color_space(%d)\n",
__func__, V4L2_PIX);
break;
}
@ -319,7 +319,7 @@ inline unsigned int FRAME_SIZE(int HAL_PIXEL_FORMAT, int w, int h)
break;
default:
LOGD("%s::no matching source colorformat(0x%x), w(%d), h(%d) fail\n",
ALOGD("%s::no matching source colorformat(0x%x), w(%d), h(%d) fail\n",
__func__, HAL_PIXEL_FORMAT, w, h);
break;
}

File diff suppressed because it is too large Load Diff

@ -59,9 +59,9 @@ namespace android {
//#define ENABLE_ESD_PREVIEW_CHECK
#if defined(LOG_NDEBUG) && (LOG_NDEBUG == 0)
#define LOG_CAMERA LOGD
#define LOG_CAMERA_PREVIEW LOGD
#if defined(ALOG_NDEBUG) && (ALOG_NDEBUG == 0)
#define LOG_CAMERA ALOGD
#define LOG_CAMERA_PREVIEW ALOGD
#define LOG_TIME_DEFINE(n) \
struct timeval time_start_##n, time_stop_##n; unsigned long log_time_##n = 0;

File diff suppressed because it is too large Load Diff

@ -20,8 +20,8 @@
*/
//#include "config.h"
#define LOG_NDEBUG 0
#define LOG_TAG "Mediactl"
#define ALOG_NDEBUG 0
#define ALOG_TAG "Mediactl"
#include <utils/Log.h>
#include <sys/ioctl.h>
@ -129,7 +129,7 @@ int media_setup_link(struct media_device *media,
}
if (i == source->entity->num_links) {
LOGE("%s: Link not found", __func__);
ALOGE("%s: Link not found", __func__);
return -ENOENT;
}
@ -147,7 +147,7 @@ int media_setup_link(struct media_device *media,
ret = ioctl(media->fd, MEDIA_IOC_SETUP_LINK, &ulink);
if (ret == -1) {
LOGE("%s: Unable to setup link (%s)",
ALOGE("%s: Unable to setup link (%s)",
__func__, strerror(errno));
return -errno;
}
@ -205,7 +205,7 @@ static struct media_link *media_entity_add_link(struct media_entity *entity)
static int media_enum_links(struct media_device *media)
{
LOGV("%s: start", __func__);
ALOGV("%s: start", __func__);
__u32 id;
int ret = 0;
@ -219,7 +219,7 @@ static int media_enum_links(struct media_device *media)
links.links = (struct media_link_desc*)malloc(entity->info.links * sizeof(struct media_link_desc));
if (ioctl(media->fd, MEDIA_IOC_ENUM_LINKS, &links) < 0) {
LOGE(
ALOGE(
"%s: Unable to enumerate pads and links (%s).",
__func__, strerror(errno));
free(links.pads);
@ -243,7 +243,7 @@ static int media_enum_links(struct media_device *media)
source = media_get_entity_by_id(media, link->source.entity);
sink = media_get_entity_by_id(media, link->sink.entity);
if (source == NULL || sink == NULL) {
LOGE(
ALOGE(
"WARNING entity %u link %u from %u/%u to %u/%u is invalid!",
id, i, link->source.entity,
link->source.index,
@ -302,7 +302,7 @@ static int media_get_devname_udev(struct udev *udev,
return -EINVAL;
devnum = makedev(entity->info.v4l.major, entity->info.v4l.minor);
LOGE("looking up device: %u:%u",
ALOGE("looking up device: %u:%u",
major(devnum), minor(devnum));
device = udev_device_new_from_devnum(udev, 'c', devnum);
if (device) {
@ -371,14 +371,14 @@ int get_media_fd(struct media_device *media)
char *ptr;
char media_buf[6];
LOGV("%s(%s)", __func__, MEDIA_DEV);
ALOGV("%s(%s)", __func__, MEDIA_DEV);
media->fd = open(MEDIA_DEV, O_RDWR, 0);
if( media->fd < 0) {
LOGE("Open sysfs media device failed, media->fd : 0x%p", media->fd);
ALOGE("Open sysfs media device failed, media->fd : 0x%p", media->fd);
return -1;
}
LOGV("media->fd : %p", media->fd);
ALOGV("media->fd : %p", media->fd);
return media->fd;
@ -431,7 +431,7 @@ static int media_enum_entities(struct media_device *media)
/* Fall back to get the device name via sysfs */
media_get_devname_sysfs(entity);
if (ret < 0)
LOGE("media_get_devname failed");
ALOGE("media_get_devname failed");
}
return ret;
@ -467,40 +467,40 @@ struct media_device *media_open_debug(
media = (struct media_device*)calloc(1, sizeof(struct media_device));
if (media == NULL) {
LOGE("%s: media : %p", __func__, media);
ALOGE("%s: media : %p", __func__, media);
return NULL;
}
media_debug_set_handler(media, debug_handler, debug_priv);
LOGV("Opening media device %s", name);
LOGV("%s: media : %p", __func__, media);
ALOGV("Opening media device %s", name);
ALOGV("%s: media : %p", __func__, media);
media->fd = get_media_fd(media);
if (media->fd < 0) {
media_close(media);
LOGE("%s: failed get_media_fd %s",
ALOGE("%s: failed get_media_fd %s",
__func__, name);
return NULL;
}
LOGV("%s: media->fd : %p", __func__, media->fd);
ALOGV("%s: media->fd : %p", __func__, media->fd);
ret = media_enum_entities(media);
if (ret < 0) {
LOGE(
ALOGE(
"%s: Unable to enumerate entities for device %s (%s)",
__func__, name, strerror(-ret));
media_close(media);
return NULL;
}
LOGV("Found %u entities", media->entities_count);
LOGV("Enumerating pads and links");
ALOGV("Found %u entities", media->entities_count);
ALOGV("Enumerating pads and links");
ret = media_enum_links(media);
if (ret < 0) {
LOGE(
ALOGE(
"%s: Unable to enumerate pads and linksfor device %s",
__func__, name);
media_close(media);
@ -621,28 +621,28 @@ int media_parse_setup_link(struct media_device *media,
link = media_parse_link(media, p, &end);
if (link == NULL) {
LOGE(
ALOGE(
"%s: Unable to parse link", __func__);
return -EINVAL;
}
p = end;
if (*p++ != '[') {
LOGE("Unable to parse link flags");
ALOGE("Unable to parse link flags");
return -EINVAL;
}
flags = strtoul(p, &end, 10);
for (p = end; isspace(*p); p++);
if (*p++ != ']') {
LOGE("Unable to parse link flags");
ALOGE("Unable to parse link flags");
return -EINVAL;
}
for (; isspace(*p); p++);
*endp = (char *)p;
LOGV(
ALOGV(
"Setting up link %u:%u -> %u:%u [%u]",
link->source->entity->info.id, link->source->index,
link->sink->entity->info.id, link->sink->index,

@ -17,8 +17,8 @@
**
*/
#define LOG_NDEBUG 0
#define LOG_TAG "SKIA"
#define ALOG_NDEBUG 0
#define ALOG_TAG "SKIA"
#include <utils/Log.h>
#include "FimgApi.h"
@ -270,14 +270,14 @@ extern "C" int SyncFimgApi(void)
void printDataBlit(char *title, struct fimg2d_blit *cmd)
{
LOGI("%s\n", title);
ALOGI("%s\n", title);
LOGI(" sequence_no. = %u\n", cmd->seq_no);
LOGI(" blit_op = %d(%s)\n", cmd->op, optbl[cmd->op].str);
LOGI(" fill_color = %X\n", cmd->solid_color);
LOGI(" global_alpha = %u\n", (unsigned int)cmd->g_alpha);
LOGI(" PREMULT = %s\n", cmd->premult == PREMULTIPLIED ? "PREMULTIPLIED" : "NON-PREMULTIPLIED");
LOGI(" do_dither = %s\n", cmd->dither == true ? "dither" : "no-dither");
ALOGI(" sequence_no. = %u\n", cmd->seq_no);
ALOGI(" blit_op = %d(%s)\n", cmd->op, optbl[cmd->op].str);
ALOGI(" fill_color = %X\n", cmd->solid_color);
ALOGI(" global_alpha = %u\n", (unsigned int)cmd->g_alpha);
ALOGI(" PREMULT = %s\n", cmd->premult == PREMULTIPLIED ? "PREMULTIPLIED" : "NON-PREMULTIPLIED");
ALOGI(" do_dither = %s\n", cmd->dither == true ? "dither" : "no-dither");
printDataBlitRotate(cmd->rotate);
@ -297,80 +297,80 @@ void printDataBlit(char *title, struct fimg2d_blit *cmd)
void printDataBlitImage(char *title, struct fimg2d_image *image)
{
if (NULL != image) {
LOGI(" Image_%s\n", title);
LOGI(" addr = %X\n", image->addr.start);
LOGI(" size = %u\n", image->addr.size);
LOGI(" (width, height) = (%d, %d)\n", image->width, image->height);
LOGI(" format = %d\n", image->fmt);
ALOGI(" Image_%s\n", title);
ALOGI(" addr = %X\n", image->addr.start);
ALOGI(" size = %u\n", image->addr.size);
ALOGI(" (width, height) = (%d, %d)\n", image->width, image->height);
ALOGI(" format = %d\n", image->fmt);
} else
LOGI(" Image_%s : NULL\n", title);
ALOGI(" Image_%s : NULL\n", title);
}
void printDataBlitRect(char *title, struct fimg2d_rect *rect)
{
if (NULL != rect) {
LOGI(" RECT_%s\n", title);
LOGI(" (x1, y1) = (%d, %d)\n", rect->x1, rect->y1);
LOGI(" (x2, y2) = (%d, %d)\n", rect->x2, rect->y2);
LOGI(" (width, height) = (%d, %d)\n", rect->x2 - rect->x1, rect->y2 - rect->y1);
ALOGI(" RECT_%s\n", title);
ALOGI(" (x1, y1) = (%d, %d)\n", rect->x1, rect->y1);
ALOGI(" (x2, y2) = (%d, %d)\n", rect->x2, rect->y2);
ALOGI(" (width, height) = (%d, %d)\n", rect->x2 - rect->x1, rect->y2 - rect->y1);
} else
LOGI(" RECT_%s : NULL\n", title);
ALOGI(" RECT_%s : NULL\n", title);
}
void printDataBlitRotate(enum rotation rotate)
{
LOGI(" ROTATE : %d\n", rotate);
ALOGI(" ROTATE : %d\n", rotate);
}
void printDataBlitClip(struct fimg2d_clip *clip)
{
if (NULL != clip) {
LOGI(" CLIP\n");
LOGI(" clip %s\n", clip->enable == true ? "enabled" : "disabled");
LOGI(" (x1, y1) = (%d, %d)\n", clip->x1, clip->y1);
LOGI(" (x2, y2) = (%d, %d)\n", clip->x2, clip->y2);
LOGI(" (width, hight) = (%d, %d)\n", clip->x2 - clip->x1, clip->y2 - clip->y1);
ALOGI(" CLIP\n");
ALOGI(" clip %s\n", clip->enable == true ? "enabled" : "disabled");
ALOGI(" (x1, y1) = (%d, %d)\n", clip->x1, clip->y1);
ALOGI(" (x2, y2) = (%d, %d)\n", clip->x2, clip->y2);
ALOGI(" (width, hight) = (%d, %d)\n", clip->x2 - clip->x1, clip->y2 - clip->y1);
} else
LOGI(" CLIP : NULL\n");
ALOGI(" CLIP : NULL\n");
}
void printDataBlitScale(struct fimg2d_scale *scaling)
{
if (NULL != scaling) {
LOGI(" SCALING\n");
LOGI(" scale_mode : %s\n", scaling->mode == 0 ?
ALOGI(" SCALING\n");
ALOGI(" scale_mode : %s\n", scaling->mode == 0 ?
"NO_SCALING" :
(scaling->mode == 1 ? "SCALING_NEAREST" : "SCALING_BILINEAR"));
LOGI(" scaling_factor_unit : %s\n", scaling->factor == 0 ? "PERCENT" : "PIXEL");
ALOGI(" scaling_factor_unit : %s\n", scaling->factor == 0 ? "PERCENT" : "PIXEL");
if (scaling->factor == 0)
LOGI(" scaling_factor : (scale_w, scale_y) = (%d, %d)\n", scaling->scale_w, scaling->scale_h);
ALOGI(" scaling_factor : (scale_w, scale_y) = (%d, %d)\n", scaling->scale_w, scaling->scale_h);
else {
LOGI(" src : (src_w, src_h) = (%d, %d)\n", scaling->src_w, scaling->src_h);
LOGI(" dst : (dst_w, dst_h) = (%d, %d)\n", scaling->dst_w, scaling->dst_h);
LOGI(" scaling_factor : (scale_w, scale_y) = (%3.2f, %3.2f)\n", (double)scaling->dst_w / scaling->src_w, (double)scaling->dst_h / scaling->src_h);
ALOGI(" src : (src_w, src_h) = (%d, %d)\n", scaling->src_w, scaling->src_h);
ALOGI(" dst : (dst_w, dst_h) = (%d, %d)\n", scaling->dst_w, scaling->dst_h);
ALOGI(" scaling_factor : (scale_w, scale_y) = (%3.2f, %3.2f)\n", (double)scaling->dst_w / scaling->src_w, (double)scaling->dst_h / scaling->src_h);
}
} else
LOGI(" SCALING : NULL(NO SCALE MODE)\n");
ALOGI(" SCALING : NULL(NO SCALE MODE)\n");
}
void printDataMatrix(int matrixType)
{
LOGI(" MATRIX\n");
ALOGI(" MATRIX\n");
if (matrixType & SkMatrix::kIdentity_Mask)
LOGI(" Matrix_type : Identity_Mask\n");
ALOGI(" Matrix_type : Identity_Mask\n");
if (matrixType & SkMatrix::kTranslate_Mask)
LOGI(" Matrix_type : Translate_Mask(the matrix has translation)\n");
ALOGI(" Matrix_type : Translate_Mask(the matrix has translation)\n");
if (matrixType & SkMatrix::kScale_Mask)
LOGI(" Matrix_type : Scale_Mask(the matrix has X or Y scale)\n");
ALOGI(" Matrix_type : Scale_Mask(the matrix has X or Y scale)\n");
if (matrixType & SkMatrix::kAffine_Mask)
LOGI(" Matrix_type : Affine_Mask(the matrix skews or rotates)\n");
ALOGI(" Matrix_type : Affine_Mask(the matrix skews or rotates)\n");
if (matrixType & SkMatrix::kPerspective_Mask)
LOGI(" Matrix_type : Perspective_Mask(the matrix is in perspective)\n");
ALOGI(" Matrix_type : Perspective_Mask(the matrix is in perspective)\n");
}

@ -30,8 +30,8 @@
#if defined(REAL_DEBUG)
#ifdef ANDROID_LOG
#define PRINT LOGE
#define PRINTD LOGD
#define PRINT ALOGE
#define PRINTD ALOGD
#else
#define PRINT printf
#define PRINTD printf

@ -17,8 +17,8 @@
**
*/
#define LOG_NDEBUG 0
#define LOG_TAG "FimgExynos5"
#define ALOG_NDEBUG 0
#define ALOG_TAG "FimgExynos5"
#include <utils/Log.h>
#include "FimgExynos5.h"

@ -40,14 +40,14 @@ LOCAL_SRC_FILES := \
ifeq ($(TARGET_PRODUCT), armboard_v7a)
# Support for ARM platforms
LOCAL_CFLAGS:= -DLOG_TAG=\"gralloc\" -DGRALLOC_16_BITS -DSTANDARD_LINUX_SCREEN \
LOCAL_CFLAGS:= -DALOG_TAG=\"gralloc\" -DGRALLOC_16_BITS -DSTANDARD_LINUX_SCREEN \
-march=armv7-a \
-mfloat-abi=softfp
LOCAL_MODULE := gralloc.default
else
#Default to goldfish
LOCAL_CFLAGS:= -DLOG_TAG=\"gralloc\" -DSTANDARD_LINUX_SCREEN \
LOCAL_CFLAGS:= -DALOG_TAG=\"gralloc\" -DSTANDARD_LINUX_SCREEN \
-march=armv7-a \
-mfloat-abi=softfp \
-DVITHAR_HACK

@ -68,13 +68,13 @@ static int gralloc_alloc_buffer(alloc_device_t* dev, size_t size, int usage,
private_module_t* m = reinterpret_cast<private_module_t*>(dev->common.module);
ion_fd = ion_alloc(m->ion_client, size, 0, ION_HEAP_EXYNOS_MASK);
if (ion_fd < 0) {
LOGE("Failed to ion_alloc");
ALOGE("Failed to ion_alloc");
return -1;
}
cpu_ptr = ion_map(ion_fd, size, 0);
if (NULL == cpu_ptr) {
LOGE("Failed to ion_map");
ALOGE("Failed to ion_map");
ion_free(ion_fd);
return -1;
}
@ -83,7 +83,7 @@ static int gralloc_alloc_buffer(alloc_device_t* dev, size_t size, int usage,
if (UMP_INVALID_MEMORY_HANDLE != ump_mem_handle) {
priv_alloc_flag = private_handle_t::PRIV_FLAGS_USES_ION;
} else {
LOGE("gralloc_alloc_buffer() failed to import ION memory");
ALOGE("gralloc_alloc_buffer() failed to import ION memory");
ion_unmap(cpu_ptr, size);
ion_free(ion_fd);
return -1;
@ -120,7 +120,7 @@ static int gralloc_alloc_buffer(alloc_device_t* dev, size_t size, int usage,
if (UMP_INVALID_MEMORY_HANDLE != ump_mem_handle)
cpu_ptr = ump_map(ump_mem_handle, 0, size);
else
LOGE("gralloc_alloc_buffer() failed to allcoate UMP memory");
ALOGE("gralloc_alloc_buffer() failed to allcoate UMP memory");
}
if (NULL != cpu_ptr) {
@ -144,15 +144,15 @@ static int gralloc_alloc_buffer(alloc_device_t* dev, size_t size, int usage,
hnd->voffset = ((EXYNOS_ALIGN((hnd->width >> 1), 8) * EXYNOS_ALIGN((hnd->height >> 1), 8)));
return 0;
} else {
LOGE("gralloc_alloc_buffer() failed to allocate handle");
ALOGE("gralloc_alloc_buffer() failed to allocate handle");
}
} else {
LOGE("gralloc_alloc_buffer() failed to retrieve valid secure id");
ALOGE("gralloc_alloc_buffer() failed to retrieve valid secure id");
}
ump_unmap(ump_mem_handle, cpu_ptr, size);
} else {
LOGE("gralloc_alloc_buffer() failed to map UMP memory");
ALOGE("gralloc_alloc_buffer() failed to map UMP memory");
}
ump_release(ump_mem_handle);
@ -187,13 +187,13 @@ static int gralloc_alloc_framebuffer_locked(alloc_device_t* dev, size_t size, in
*/
int newUsage = (usage & ~GRALLOC_USAGE_HW_FB) | GRALLOC_USAGE_HW_2D;
LOGD("fallback to single buffering");
ALOGD("fallback to single buffering");
return gralloc_alloc_buffer(dev, bufferSize, newUsage, pHandle, w, h, format, bpp, 0, 0);
}
if (bufferMask >= ((1LU<<numBuffers)-1)) {
LOGE("Ran out of buffers");
ALOGE("Ran out of buffers");
return -ENOMEM;
}
@ -236,7 +236,7 @@ static int alloc_device_alloc(alloc_device_t* dev, int w, int h, int format,
int usage, buffer_handle_t* pHandle, int* pStride)
{
if (!pHandle || !pStride) {
LOGE("Invalid Handle, Stride value");
ALOGE("Invalid Handle, Stride value");
return -EINVAL;
}
@ -269,7 +269,7 @@ static int alloc_device_alloc(alloc_device_t* dev, int w, int h, int format,
bpp = 4;
break;
default:
LOGE("Not Support Pixel Format");
ALOGE("Not Support Pixel Format");
return -EINVAL;
}
@ -289,7 +289,7 @@ static int alloc_device_alloc(alloc_device_t* dev, int w, int h, int format,
format, 0, (int)stride_raw, (int)stride);
if (err < 0) {
LOGE("Fail to alloc Gralloc memory");
ALOGE("Fail to alloc Gralloc memory");
return err;
}
@ -300,7 +300,7 @@ static int alloc_device_alloc(alloc_device_t* dev, int w, int h, int format,
static int alloc_device_free(alloc_device_t* dev, buffer_handle_t handle)
{
if (private_handle_t::validate(handle) < 0) {
LOGE("Invalid Value : private_handle");
ALOGE("Invalid Value : private_handle");
return -EINVAL;
}
@ -346,19 +346,19 @@ int alloc_device_open(hw_module_t const* module, const char* name, hw_device_t**
dev = new alloc_device_t;
if (NULL == dev) {
LOGE("Fail to create alloc_device");
ALOGE("Fail to create alloc_device");
return -1;
}
dev->common.module = const_cast<hw_module_t*>(module);
private_module_t* m = reinterpret_cast<private_module_t*>(dev->common.module);
m->ion_client=ion_client_create();
LOGI("gralloc create ion_client %d", m->ion_client);
ALOGI("gralloc create ion_client %d", m->ion_client);
ump_result ump_res = ump_open();
if ((UMP_OK != ump_res) || (0 > m->ion_client)) {
LOGE("UMP open failed, ump_res %d, ion_client %d", ump_res, m->ion_client);
ALOGE("UMP open failed, ump_res %d, ion_client %d", ump_res, m->ion_client);
delete dev;
return -1;
}

@ -73,7 +73,7 @@ static int fb_post(struct framebuffer_device_t* dev, buffer_handle_t buffer)
#ifdef STANDARD_LINUX_SCREEN
if (ioctl(m->framebuffer->fd, FBIOPAN_DISPLAY, &m->info) == -1) {
LOGE("FBIOPAN_DISPLAY failed");
ALOGE("FBIOPAN_DISPLAY failed");
m->base.unlock(&m->base, buffer);
return 0;
}
@ -81,13 +81,13 @@ static int fb_post(struct framebuffer_device_t* dev, buffer_handle_t buffer)
/* wait for VSYNC */
int crtc = 0;
if (ioctl(m->framebuffer->fd, FBIO_WAITFORVSYNC, &crtc) < 0) {
LOGE("FBIO_WAITFORVSYNC failed");
ALOGE("FBIO_WAITFORVSYNC failed");
return 0;
}
#else
/* Standard Android way */
if (ioctl(m->framebuffer->fd, FBIOPUT_VSCREENINFO, &m->info) == -1) {
LOGE("FBIOPUT_VSCREENINFO failed");
ALOGE("FBIOPUT_VSCREENINFO failed");
m->base.unlock(&m->base, buffer);
return -errno;
}
@ -135,19 +135,19 @@ int init_frame_buffer_locked(struct private_module_t* module)
}
if (fd < 0) {
LOGE("/dev/graphics/fb, /dev/fb Open fail");
ALOGE("/dev/graphics/fb, /dev/fb Open fail");
return -errno;
}
struct fb_fix_screeninfo finfo;
if (ioctl(fd, FBIOGET_FSCREENINFO, &finfo) == -1) {
LOGE("Fail to get FB Screen Info");
ALOGE("Fail to get FB Screen Info");
return -errno;
}
struct fb_var_screeninfo info;
if (ioctl(fd, FBIOGET_VSCREENINFO, &info) == -1) {
LOGE("First, Fail to get FB VScreen Info");
ALOGE("First, Fail to get FB VScreen Info");
return -errno;
}
@ -195,19 +195,19 @@ int init_frame_buffer_locked(struct private_module_t* module)
if (ioctl(fd, FBIOPUT_VSCREENINFO, &info) == -1) {
info.yres_virtual = info.yres;
flags &= ~PAGE_FLIP;
LOGW("FBIOPUT_VSCREENINFO failed, page flipping not supported");
ALOGW("FBIOPUT_VSCREENINFO failed, page flipping not supported");
}
if (info.yres_virtual < info.yres * 2) {
/* we need at least 2 for page-flipping */
info.yres_virtual = info.yres;
flags &= ~PAGE_FLIP;
LOGW("page flipping not supported (yres_virtual=%d, requested=%d)",
ALOGW("page flipping not supported (yres_virtual=%d, requested=%d)",
info.yres_virtual, info.yres*2);
}
if (ioctl(fd, FBIOGET_VSCREENINFO, &info) == -1) {
LOGE("Second, Fail to get FB VScreen Info");
ALOGE("Second, Fail to get FB VScreen Info");
return -errno;
}
@ -231,7 +231,7 @@ int init_frame_buffer_locked(struct private_module_t* module)
float ydpi = (info.yres * 25.4f) / info.height;
float fps = refreshRate / 1000.0f;
LOGI("using (fd=%d)\n"
ALOGI("using (fd=%d)\n"
"id = %s\n"
"xres = %d px\n"
"yres = %d px\n"
@ -252,7 +252,7 @@ int init_frame_buffer_locked(struct private_module_t* module)
info.green.offset, info.green.length,
info.blue.offset, info.blue.length);
LOGI("width = %d mm (%f dpi)\n"
ALOGI("width = %d mm (%f dpi)\n"
"height = %d mm (%f dpi)\n"
"refresh rate = %.2f Hz\n",
info.width, xdpi,
@ -260,12 +260,12 @@ int init_frame_buffer_locked(struct private_module_t* module)
fps);
if (ioctl(fd, FBIOGET_FSCREENINFO, &finfo) == -1) {
LOGE("Fail to get FScreen Info");
ALOGE("Fail to get FScreen Info");
return -errno;
}
if (finfo.smem_len <= 0) {
LOGE("Invalid Value : finfo.smem_len");
ALOGE("Invalid Value : finfo.smem_len");
return -errno;
}
@ -282,7 +282,7 @@ int init_frame_buffer_locked(struct private_module_t* module)
size_t fbSize = round_up_to_page_size(finfo.line_length * info.yres_virtual);
void* vaddr = mmap(0, fbSize, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
if (vaddr == MAP_FAILED) {
LOGE("Error mapping the framebuffer (%s)", strerror(errno));
ALOGE("Error mapping the framebuffer (%s)", strerror(errno));
return -errno;
}
@ -346,14 +346,14 @@ int framebuffer_device_open(hw_module_t const* module, const char* name, hw_devi
alloc_device_t* gralloc_device;
status = gralloc_open(module, &gralloc_device);
if (status < 0) {
LOGE("Fail to Open gralloc device");
ALOGE("Fail to Open gralloc device");
return status;
}
private_module_t* m = (private_module_t*)module;
status = init_frame_buffer(m);
if (status < 0) {
LOGE("Fail to init framebuffer");
ALOGE("Fail to init framebuffer");
gralloc_close(gralloc_device);
return status;
}

@ -47,15 +47,15 @@ static int gralloc_map(gralloc_module_t const* module,
void *mappedAddress = ion_map(hnd->fd, size, 0);
if (mappedAddress == MAP_FAILED) {
LOGE("Could not ion_map %s fd(%d)", strerror(errno), hnd->fd);
ALOGE("Could not ion_map %s fd(%d)", strerror(errno), hnd->fd);
return -errno;
}
hnd->base = intptr_t(mappedAddress) + hnd->offset;
LOGD("gralloc_map() succeeded fd=%d, off=%d, size=%d, vaddr=%p",
ALOGD("gralloc_map() succeeded fd=%d, off=%d, size=%d, vaddr=%p",
hnd->fd, hnd->offset, hnd->size, mappedAddress);
} else {
LOGE("In case of ION, It could not reach here!");
ALOGE("In case of ION, It could not reach here!");
}
}
*vaddr = (void*)hnd->base;
@ -72,10 +72,10 @@ static int gralloc_unmap(gralloc_module_t const* module,
if (hnd->flags & private_handle_t::PRIV_FLAGS_USES_ION) {
void* base = (void*)hnd->base;
size_t size = hnd->size;
LOGD("unmapping from %p, size=%d", base, size);
ALOGD("unmapping from %p, size=%d", base, size);
if (ion_unmap(base, size) < 0)
LOGE("Could not ion_unmap %s", strerror(errno));
ALOGE("Could not ion_unmap %s", strerror(errno));
ion_client_destroy(hnd->ion_client);
}
@ -88,7 +88,7 @@ static int gralloc_device_open(const hw_module_t* module, const char* name, hw_d
{
int status = -EINVAL;
LOGI("Opening ARM Gralloc device");
ALOGI("Opening ARM Gralloc device");
if (!strcmp(name, GRALLOC_HARDWARE_GPU0))
status = alloc_device_open(module, name, device);
@ -103,14 +103,14 @@ static int gralloc_register_buffer(gralloc_module_t const* module, buffer_handle
int retval = -EINVAL;
void *vaddr;
if (private_handle_t::validate(handle) < 0) {
LOGE("Registering invalid buffer, returning error");
ALOGE("Registering invalid buffer, returning error");
return -EINVAL;
}
// if this handle was created in this process, then we keep it as is.
private_handle_t* hnd = (private_handle_t*)handle;
if (hnd->pid == getpid()) {
LOGE("Invalid Process ID from Private_Handle");
ALOGE("Invalid Process ID from Private_Handle");
return 0;
}
@ -119,7 +119,7 @@ static int gralloc_register_buffer(gralloc_module_t const* module, buffer_handle
ump_result res = ump_open();
if (res != UMP_OK) {
pthread_mutex_unlock(&s_map_lock);
LOGE("Failed to open UMP library");
ALOGE("Failed to open UMP library");
return retval;
}
s_ump_is_open = 1;
@ -137,18 +137,18 @@ static int gralloc_register_buffer(gralloc_module_t const* module, buffer_handle
pthread_mutex_unlock(&s_map_lock);
return 0;
} else {
LOGE("Failed to map UMP handle");
ALOGE("Failed to map UMP handle");
}
ump_release(hnd->ump_mem_handle);
} else {
LOGE("Failed to create UMP handle");
ALOGE("Failed to create UMP handle");
}
} else if (hnd->flags & private_handle_t::PRIV_FLAGS_USES_ION) {
hnd->ump_mem_handle = ump_handle_create_from_secure_id(hnd->ump_id);
retval = gralloc_map(module, handle, &vaddr);
} else {
LOGE("registering non-UMP&ION buffer not supported");
ALOGE("registering non-UMP&ION buffer not supported");
}
pthread_mutex_unlock(&s_map_lock);
@ -159,13 +159,13 @@ static int gralloc_register_buffer(gralloc_module_t const* module, buffer_handle
static int gralloc_unregister_buffer(gralloc_module_t const* module, buffer_handle_t handle)
{
if (private_handle_t::validate(handle) < 0) {
LOGE("unregistering invalid buffer, returning error");
ALOGE("unregistering invalid buffer, returning error");
return -EINVAL;
}
private_handle_t* hnd = (private_handle_t*)handle;
LOGE_IF(hnd->lockState & private_handle_t::LOCK_STATE_READ_MASK,
ALOGE_IF(hnd->lockState & private_handle_t::LOCK_STATE_READ_MASK,
"[unregister] handle %p still locked (state=%08x)", hnd, hnd->lockState);
/* never unmap buffers that were created in this process */
@ -189,7 +189,7 @@ static int gralloc_unregister_buffer(gralloc_module_t const* module, buffer_hand
hnd->lockState = 0;
hnd->writeOwner = 0;
} else {
LOGE("unregistering non-UMP buffer not supported");
ALOGE("unregistering non-UMP buffer not supported");
}
hnd->base = 0;
@ -206,7 +206,7 @@ static int gralloc_lock(gralloc_module_t const* module, buffer_handle_t handle,
int usage, int l, int t, int w, int h, void** vaddr)
{
if (private_handle_t::validate(handle) < 0) {
LOGE("Locking invalid buffer, returning error");
ALOGE("Locking invalid buffer, returning error");
return -EINVAL;
}
@ -233,7 +233,7 @@ static int gralloc_lock(gralloc_module_t const* module, buffer_handle_t handle,
static int gralloc_unlock(gralloc_module_t const* module, buffer_handle_t handle)
{
if (private_handle_t::validate(handle) < 0) {
LOGE("Unlocking invalid buffer, returning error");
ALOGE("Unlocking invalid buffer, returning error");
return -EINVAL;
}

@ -16,7 +16,7 @@
*/
//#define DEBUG_LIB_FIMC
#define LOG_TAG "libgscaler"
#define ALOG_TAG "libgscaler"
//#define USE_GSC_USERPTR
#include <cutils/log.h>
#include "../libhdmi/SecHdmi/SecGscaler.h"
@ -49,34 +49,34 @@ struct yuv_fmt_list yuv_list[] = {
void dump_pixfmt_mp(struct v4l2_pix_format_mplane *pix_mp)
{
LOGI("w: %d", pix_mp->width);
LOGI("h: %d", pix_mp->height);
LOGI("color: %x", pix_mp->colorspace);
ALOGI("w: %d", pix_mp->width);
ALOGI("h: %d", pix_mp->height);
ALOGI("color: %x", pix_mp->colorspace);
switch (pix_mp->pixelformat) {
case V4L2_PIX_FMT_YUYV:
LOGI ("YUYV");
ALOGI ("YUYV");
break;
case V4L2_PIX_FMT_UYVY:
LOGI ("UYVY");
ALOGI ("UYVY");
break;
case V4L2_PIX_FMT_RGB565:
LOGI ("RGB565");
ALOGI ("RGB565");
break;
case V4L2_PIX_FMT_RGB565X:
LOGI ("RGB565X");
ALOGI ("RGB565X");
break;
default:
LOGI("not supported");
ALOGI("not supported");
}
}
void dump_crop(struct v4l2_rect *rect)
{
LOGI("crop l: %d", rect->left);
LOGI("crop t: %d", rect->top);
LOGI("crop w: %d", rect->width);
LOGI("crop h: %d", rect->height);
ALOGI("crop l: %d", rect->left);
ALOGI("crop t: %d", rect->top);
ALOGI("crop w: %d", rect->width);
ALOGI("crop h: %d", rect->height);
}
void gsc_v4l2_dump_state(int fd)
@ -89,14 +89,14 @@ void gsc_v4l2_dump_state(int fd)
if (ioctl(fd, VIDIOC_G_FMT, &format) < 0)
return;
LOGI("dumping driver state:");
ALOGI("dumping driver state:");
dump_pixfmt_mp(&format.fmt.pix_mp);
crop.type = format.type;
if (ioctl(fd, VIDIOC_G_CROP, &crop) < 0)
return;
LOGI("input image crop:");
ALOGI("input image crop:");
dump_crop(&(crop.c));
sCrop.pad = GSC_SUBDEV_PAD_SOURCE;
@ -104,7 +104,7 @@ void gsc_v4l2_dump_state(int fd)
if (ioctl(fd, VIDIOC_SUBDEV_G_CROP, &sCrop) < 0)
return;
LOGI("output image crop:");
ALOGI("output image crop:");
dump_crop(&(sCrop.rect));
}
@ -112,22 +112,22 @@ void gsc_v4l2_dump_state(int fd)
int gsc_v4l2_querycap(int fd, char *node)
{
#ifdef DEBUG_LIB_FIMC
LOGD("%s", __func__);
ALOGD("%s", __func__);
#endif
struct v4l2_capability v4l2cap;
if (ioctl(fd, VIDIOC_QUERYCAP, &v4l2cap) < 0) {
LOGE("%s::VIDIOC_QUERYCAP failed", __func__);
ALOGE("%s::VIDIOC_QUERYCAP failed", __func__);
return -1;
}
if (!(v4l2cap.capabilities & V4L2_CAP_STREAMING)) {
LOGE("%s::%s is not support streaming", __func__, node);
ALOGE("%s::%s is not support streaming", __func__, node);
return -1;
}
if (!(v4l2cap.capabilities & V4L2_CAP_VIDEO_OUTPUT_MPLANE)) {
LOGE("%s::%s is not support video output mplane", __func__, node);
ALOGE("%s::%s is not support video output mplane", __func__, node);
return -1;
}
@ -137,7 +137,7 @@ int gsc_v4l2_querycap(int fd, char *node)
int gsc_v4l2_query_buf(int fd, SecBuffer *secBuf, enum v4l2_buf_type type, enum v4l2_memory memory, unsigned int buf_index, int num_plane)
{
#ifdef DEBUG_LIB_FIMC
LOGD("%s", __func__);
ALOGD("%s", __func__);
#endif
struct v4l2_buffer buf;
struct v4l2_plane planes[MAX_PLANES_GSCALER];
@ -148,7 +148,7 @@ int gsc_v4l2_query_buf(int fd, SecBuffer *secBuf, enum v4l2_buf_type type, enum
memset(&planes[i], 0, sizeof(struct v4l2_plane));
if (MAX_BUFFERS_GSCALER <= buf_index || MAX_PLANES_GSCALER < num_plane) {
LOGE("%s::exceed MAX! : buf_index=%d, num_plane=%d", __func__, buf_index, num_plane);
ALOGE("%s::exceed MAX! : buf_index=%d, num_plane=%d", __func__, buf_index, num_plane);
return -1;
}
@ -159,24 +159,24 @@ int gsc_v4l2_query_buf(int fd, SecBuffer *secBuf, enum v4l2_buf_type type, enum
buf.m.planes = planes;
if (ioctl(fd, VIDIOC_QUERYBUF, &buf) < 0) {
LOGE("%s::VIDIOC_QUERYBUF failed, plane_cnt=%d", __func__, buf.length);
ALOGE("%s::VIDIOC_QUERYBUF failed, plane_cnt=%d", __func__, buf.length);
return -1;
}
for (int i = 0; i < num_plane; i++) {
if ((secBuf->virt.extP[i] = (char *)mmap(0, buf.m.planes[i].length,
PROT_READ | PROT_WRITE, MAP_SHARED, fd, buf.m.planes[i].m.mem_offset)) < 0) {
LOGE("%s::mmap failed", __func__);
LOGE("%s::Offset = 0x%x", __func__, buf.m.planes[i].m.mem_offset);
LOGE("%s::Legnth = %d" , __func__, buf.m.planes[i].length);
LOGE("%s::vaddr[%d][%d] = 0x%x", __func__, buf_index, i, (unsigned int)secBuf->virt.extP[i]);
ALOGE("%s::mmap failed", __func__);
ALOGE("%s::Offset = 0x%x", __func__, buf.m.planes[i].m.mem_offset);
ALOGE("%s::Legnth = %d" , __func__, buf.m.planes[i].length);
ALOGE("%s::vaddr[%d][%d] = 0x%x", __func__, buf_index, i, (unsigned int)secBuf->virt.extP[i]);
return -1;
}
secBuf->size.extS[i] = buf.m.planes[i].length;
#ifdef DEBUG_LIB_FIMC
LOGD("%s::vaddr[bufindex=%d][planeindex=%d] = 0x%x", __func__, buf_index, i, (unsigned int)secBuf->virt.extP[i]);
LOGD("%s::Legnth = %d" , __func__, buf.m.planes[i].length);
ALOGD("%s::vaddr[bufindex=%d][planeindex=%d] = 0x%x", __func__, buf_index, i, (unsigned int)secBuf->virt.extP[i]);
ALOGD("%s::Legnth = %d" , __func__, buf.m.planes[i].length);
#endif
}
@ -186,7 +186,7 @@ int gsc_v4l2_query_buf(int fd, SecBuffer *secBuf, enum v4l2_buf_type type, enum
int gsc_v4l2_req_buf(int fd, enum v4l2_buf_type type, enum v4l2_memory memory, unsigned int num_bufs)
{
#ifdef DEBUG_LIB_FIMC
LOGD("%s", __func__);
ALOGD("%s", __func__);
#endif
struct v4l2_requestbuffers reqbuf;
@ -195,20 +195,20 @@ int gsc_v4l2_req_buf(int fd, enum v4l2_buf_type type, enum v4l2_memory memory, u
reqbuf.count = num_bufs;
#ifdef DEBUG_LIB_FIMC
LOGI("%d buffers needed", reqbuf.count);
ALOGI("%d buffers needed", reqbuf.count);
#endif
if (ioctl(fd, VIDIOC_REQBUFS, &reqbuf) < 0) {
LOGE("%s::VIDIOC_REQBUFS failed, reqbuf.count=%d", __func__, reqbuf.count);
ALOGE("%s::VIDIOC_REQBUFS failed, reqbuf.count=%d", __func__, reqbuf.count);
return -1;
}
#ifdef DEBUG_LIB_FIMC
LOGI("%d buffers allocated", reqbuf.count);
ALOGI("%d buffers allocated", reqbuf.count);
#endif
if (reqbuf.count < num_bufs) {
LOGE("%s::VIDIOC_REQBUFS failed ((reqbuf.count(%d) < num_bufs(%d))",
ALOGE("%s::VIDIOC_REQBUFS failed ((reqbuf.count(%d) < num_bufs(%d))",
__func__, reqbuf.count, num_bufs);
return -1;
}
@ -219,7 +219,7 @@ int gsc_v4l2_req_buf(int fd, enum v4l2_buf_type type, enum v4l2_memory memory, u
int gsc_v4l2_s_ctrl(int fd, int id, int value)
{
#ifdef DEBUG_LIB_FIMC
LOGD("%s", __func__);
ALOGD("%s", __func__);
#endif
struct v4l2_control vc;
@ -227,7 +227,7 @@ int gsc_v4l2_s_ctrl(int fd, int id, int value)
vc.value = value;
if (ioctl(fd, VIDIOC_S_CTRL, &vc) < 0) {
LOGE("%s::VIDIOC_S_CTRL (id=%d,value=%d) failed", __func__, id, value);
ALOGE("%s::VIDIOC_S_CTRL (id=%d,value=%d) failed", __func__, id, value);
return -1;
}
@ -237,17 +237,17 @@ int gsc_v4l2_s_ctrl(int fd, int id, int value)
int gsc_v4l2_set_fmt(int fd, enum v4l2_buf_type type, enum v4l2_field field, s5p_fimc_img_info *img_info)
{
#ifdef DEBUG_LIB_FIMC
LOGD("%s", __func__);
ALOGD("%s", __func__);
#endif
struct v4l2_format fmt;
struct v4l2_crop crop;
fmt.type = type;
#ifdef DEBUG_LIB_FIMC
LOGD("%s::fmt.type=%d", __func__, fmt.type);
ALOGD("%s::fmt.type=%d", __func__, fmt.type);
#endif
if (ioctl(fd, VIDIOC_G_FMT, &fmt) < 0) {
LOGE("%s::VIDIOC_G_FMT failed", __func__);
ALOGE("%s::VIDIOC_G_FMT failed", __func__);
return -1;
}
@ -268,14 +268,14 @@ int gsc_v4l2_set_fmt(int fd, enum v4l2_buf_type type, enum v4l2_field field, s5p
fmt.fmt.pix_mp.num_planes = img_info->planes;
break;
default:
LOGE("%s::invalid buffer type", __func__);
ALOGE("%s::invalid buffer type", __func__);
return -1;
break;
}
#ifdef DEBUG_LIB_FIMC
for (int i = 0; i < 3; i++) {
LOGD("%s::fmt.fmt.pix_mp. w=%d, h=%d, pixelformat=0x%08x, filed=%d, num_planes=%d",
ALOGD("%s::fmt.fmt.pix_mp. w=%d, h=%d, pixelformat=0x%08x, filed=%d, num_planes=%d",
__func__,
fmt.fmt.pix_mp.width, fmt.fmt.pix_mp.height,
fmt.fmt.pix_mp.pixelformat, fmt.fmt.pix_mp.field,
@ -284,14 +284,14 @@ for (int i = 0; i < 3; i++) {
#endif
if (ioctl(fd, VIDIOC_S_FMT, &fmt) < 0) {
LOGE("%s::VIDIOC_S_FMT failed", __func__);
ALOGE("%s::VIDIOC_S_FMT failed", __func__);
return -1;
}
#ifdef DEBUG_LIB_FIMC
for (int i = 0; i < 3; i++) {
LOGD("%s::pix_mp.pix_mp.plane_fmt[%d].sizeimage =0x%08x", __func__, i, fmt.fmt.pix_mp.plane_fmt[i].sizeimage);
LOGD("%s::pix_mp.pix_mp.plane_fmt[%d].bytesperline=0x%08x", __func__, i, fmt.fmt.pix_mp.plane_fmt[i].bytesperline);
ALOGD("%s::pix_mp.pix_mp.plane_fmt[%d].sizeimage =0x%08x", __func__, i, fmt.fmt.pix_mp.plane_fmt[i].sizeimage);
ALOGD("%s::pix_mp.pix_mp.plane_fmt[%d].bytesperline=0x%08x", __func__, i, fmt.fmt.pix_mp.plane_fmt[i].bytesperline);
}
#endif
@ -302,7 +302,7 @@ for (int i = 0; i < 3; i++) {
crop.c.height = img_info->height;
if (ioctl(fd, VIDIOC_S_CROP, &crop) < 0) {
LOGE("%s::VIDIOC_S_CROP (x=%d, y=%d, w=%d, h=%d) failed",
ALOGE("%s::VIDIOC_S_CROP (x=%d, y=%d, w=%d, h=%d) failed",
__func__,
img_info->start_x,
img_info->start_y,
@ -312,9 +312,9 @@ for (int i = 0; i < 3; i++) {
}
#ifdef DEBUG_LIB_FIMC
LOGD("%s::pix_mp pixelformat=0x%08x", __func__, fmt.fmt.pix_mp.pixelformat);
LOGD("%s::pix_mp w=%d, h=%d, planes=%d", __func__, fmt.fmt.pix_mp.width, fmt.fmt.pix_mp.height, fmt.fmt.pix_mp.num_planes);
LOGD("%s::crop x=%d, y=%d, w=%d, h=%d", __func__, crop.c.left, crop.c.top, crop.c.width, crop.c.height);
ALOGD("%s::pix_mp pixelformat=0x%08x", __func__, fmt.fmt.pix_mp.pixelformat);
ALOGD("%s::pix_mp w=%d, h=%d, planes=%d", __func__, fmt.fmt.pix_mp.width, fmt.fmt.pix_mp.height, fmt.fmt.pix_mp.num_planes);
ALOGD("%s::crop x=%d, y=%d, w=%d, h=%d", __func__, crop.c.left, crop.c.top, crop.c.width, crop.c.height);
#endif
return 0;
@ -323,10 +323,10 @@ for (int i = 0; i < 3; i++) {
int gsc_v4l2_stream_on(int fd, enum v4l2_buf_type type)
{
#ifdef DEBUG_LIB_FIMC
LOGD("%s", __func__);
ALOGD("%s", __func__);
#endif
if (ioctl(fd, VIDIOC_STREAMON, &type) < 0) {
LOGE("%s::VIDIOC_STREAMON failed", __func__);
ALOGE("%s::VIDIOC_STREAMON failed", __func__);
return -1;
}
@ -336,8 +336,8 @@ int gsc_v4l2_stream_on(int fd, enum v4l2_buf_type type)
int gsc_v4l2_queue(int fd, SecBuffer *secBuf, enum v4l2_buf_type type, enum v4l2_memory memory, unsigned int index, int num_plane)
{
#ifdef DEBUG_LIB_FIMC
LOGD("%s", __func__);
LOGD("%s::num_plane=%d", __func__, num_plane);
ALOGD("%s", __func__);
ALOGD("%s::num_plane=%d", __func__, num_plane);
#endif
struct v4l2_buffer buf;
struct v4l2_plane planes[MAX_PLANES_GSCALER];
@ -358,15 +358,15 @@ int gsc_v4l2_queue(int fd, SecBuffer *secBuf, enum v4l2_buf_type type, enum v4l2
buf.m.planes[i].length = secBuf->size.extS[i];
buf.m.planes[i].bytesused = buf.m.planes[i].length;
#ifdef DEBUG_LIB_FIMC
LOGD("%s::buf.index=%d", __func__, buf.index);
LOGD("%s::buf.m.planes[%d].m.userptr=0x%08x", __func__, i, (unsigned int)buf.m.planes[i].m.userptr);
LOGD("%s::buf.m.planes[%d].length =0x%08x", __func__, i, buf.m.planes[i].length);
LOGD("%s::buf.m.planes[%d].bytesused=0x%08x", __func__, i, buf.m.planes[i].bytesused);
ALOGD("%s::buf.index=%d", __func__, buf.index);
ALOGD("%s::buf.m.planes[%d].m.userptr=0x%08x", __func__, i, (unsigned int)buf.m.planes[i].m.userptr);
ALOGD("%s::buf.m.planes[%d].length =0x%08x", __func__, i, buf.m.planes[i].length);
ALOGD("%s::buf.m.planes[%d].bytesused=0x%08x", __func__, i, buf.m.planes[i].bytesused);
#endif
}
if (ioctl(fd, VIDIOC_QBUF, &buf) < 0) {
LOGE("%s::VIDIOC_QBUF failed", __func__);
ALOGE("%s::VIDIOC_QBUF failed", __func__);
return -1;
}
@ -376,7 +376,7 @@ int gsc_v4l2_queue(int fd, SecBuffer *secBuf, enum v4l2_buf_type type, enum v4l2
int gsc_v4l2_dequeue(int fd, enum v4l2_buf_type type, enum v4l2_memory memory, unsigned int *index, int num_plane)
{
#ifdef DEBUG_LIB_FIMC
LOGD("%s", __func__);
ALOGD("%s", __func__);
#endif
struct v4l2_buffer buf;
struct v4l2_plane planes[MAX_PLANES_GSCALER];
@ -393,14 +393,14 @@ int gsc_v4l2_dequeue(int fd, enum v4l2_buf_type type, enum v4l2_memory memory, u
buf.m.planes = planes;
if (ioctl(fd, VIDIOC_DQBUF, &buf) < 0) {
LOGE("%s::VIDIOC_DQBUF failed", __func__);
ALOGE("%s::VIDIOC_DQBUF failed", __func__);
return -1;
}
*index = buf.index;
#ifdef DEBUG_LIB_FIMC
LOGD("%s::buf.index=%d", __func__, buf.index);
ALOGD("%s::buf.index=%d", __func__, buf.index);
#endif
return 0;
@ -409,10 +409,10 @@ int gsc_v4l2_dequeue(int fd, enum v4l2_buf_type type, enum v4l2_memory memory, u
int gsc_v4l2_stream_off(int fd, enum v4l2_buf_type type)
{
#ifdef DEBUG_LIB_FIMC
LOGD("%s", __func__);
ALOGD("%s", __func__);
#endif
if (ioctl(fd, VIDIOC_STREAMOFF, &type) < 0) {
LOGE("%s::VIDIOC_STREAMOFF failed", __func__);
ALOGE("%s::VIDIOC_STREAMOFF failed", __func__);
return -1;
}
@ -422,7 +422,7 @@ int gsc_v4l2_stream_off(int fd, enum v4l2_buf_type type)
int gsc_v4l2_clr_buf(int fd, enum v4l2_buf_type type, enum v4l2_memory memory)
{
#ifdef DEBUG_LIB_FIMC
LOGD("%s", __func__);
ALOGD("%s", __func__);
#endif
struct v4l2_requestbuffers req;
@ -431,7 +431,7 @@ int gsc_v4l2_clr_buf(int fd, enum v4l2_buf_type type, enum v4l2_memory memory)
req.memory = memory;
if (ioctl(fd, VIDIOC_REQBUFS, &req) < 0) {
LOGE("%s::VIDIOC_REQBUFS failed", __func__);
ALOGE("%s::VIDIOC_REQBUFS failed", __func__);
return -1;
}
@ -441,7 +441,7 @@ int gsc_v4l2_clr_buf(int fd, enum v4l2_buf_type type, enum v4l2_memory memory)
int gsc_subdev_set_fmt(int fd, unsigned int pad, enum v4l2_mbus_pixelcode code, s5p_fimc_img_info *img_info)
{
#ifdef DEBUG_LIB_FIMC
LOGD("%s", __func__);
ALOGD("%s", __func__);
#endif
struct v4l2_subdev_format fmt;
struct v4l2_subdev_crop crop;
@ -453,7 +453,7 @@ int gsc_subdev_set_fmt(int fd, unsigned int pad, enum v4l2_mbus_pixelcode code,
fmt.format.code = code;
if (ioctl(fd, VIDIOC_SUBDEV_S_FMT, &fmt) < 0) {
LOGE("%s::VIDIOC_SUBDEV_S_FMT failed", __func__);
ALOGE("%s::VIDIOC_SUBDEV_S_FMT failed", __func__);
return -1;
}
@ -465,12 +465,12 @@ int gsc_subdev_set_fmt(int fd, unsigned int pad, enum v4l2_mbus_pixelcode code,
crop.rect.height = img_info->height;
#ifdef DEBUG_LIB_FIMC
LOGD("%s::pix_mp w=%d, h=%d", __func__, fmt.format.width, fmt.format.height);
LOGD("%s::crop x=%d, y=%d, w=%d, h=%d", __func__, crop.rect.left, crop.rect.top, crop.rect.width, crop.rect.height);
ALOGD("%s::pix_mp w=%d, h=%d", __func__, fmt.format.width, fmt.format.height);
ALOGD("%s::crop x=%d, y=%d, w=%d, h=%d", __func__, crop.rect.left, crop.rect.top, crop.rect.width, crop.rect.height);
#endif
if (ioctl(fd, VIDIOC_SUBDEV_S_CROP, &crop) < 0) {
LOGE("%s::VIDIOC_SUBDEV_S_CROP failed", __func__);
ALOGE("%s::VIDIOC_SUBDEV_S_CROP failed", __func__);
return -1;
}
@ -507,10 +507,10 @@ SecGscaler::SecGscaler()
SecGscaler::~SecGscaler()
{
if (mFlagCreate == true) {
LOGE("%s::this is not Destroyed fail", __func__);
ALOGE("%s::this is not Destroyed fail", __func__);
if (destroy() == false)
LOGE("%s::destroy failed", __func__);
ALOGE("%s::destroy failed", __func__);
}
}
@ -523,10 +523,10 @@ bool SecGscaler::create(enum DEV dev, enum MODE mode, unsigned int numOfBuf)
bool SecGscaler::create(enum DEV dev, unsigned int numOfBuf)
{
#ifdef DEBUG_LIB_FIMC
LOGD("%s", __func__);
ALOGD("%s", __func__);
#endif
if (mFlagCreate == true) {
LOGE("%s::Already Created", __func__);
ALOGE("%s::Already Created", __func__);
return true;
}
@ -576,7 +576,7 @@ bool SecGscaler::create(enum DEV dev, unsigned int numOfBuf)
mSubdevNodeNum = 3; // need to modify //carrotsm
break;
default:
LOGE("%s::invalid mDev(%d)", __func__, mDev);
ALOGE("%s::invalid mDev(%d)", __func__, mDev);
goto err;
break;
}
@ -585,7 +585,7 @@ bool SecGscaler::create(enum DEV dev, unsigned int numOfBuf)
mMediadevFd = open(node, O_RDONLY);
if (mMediadevFd < 0) {
LOGE("%s::open(%s) failed : O_RDONLY", __func__, node);
ALOGE("%s::open(%s) failed : O_RDONLY", __func__, node);
goto err;
}
@ -597,15 +597,15 @@ bool SecGscaler::create(enum DEV dev, unsigned int numOfBuf)
if (ioctl(mMediadevFd, MEDIA_IOC_ENUM_ENTITIES, &entity_desc) < 0) {
if (errno == EINVAL) {
LOGD("%s::MEDIA_IOC_ENUM_ENTITIES ended", __func__);
ALOGD("%s::MEDIA_IOC_ENUM_ENTITIES ended", __func__);
break;
}
LOGE("%s::MEDIA_IOC_ENUM_ENTITIES failed", __func__);
ALOGE("%s::MEDIA_IOC_ENUM_ENTITIES failed", __func__);
goto err;
}
#ifdef DEBUG_LIB_FIMC
LOGD("%s::entity_desc.id=%d, .minor=%d .name=%s", __func__, entity_desc.id, entity_desc.v4l.minor, entity_desc.name);
ALOGD("%s::entity_desc.id=%d, .minor=%d .name=%s", __func__, entity_desc.id, entity_desc.v4l.minor, entity_desc.name);
#endif
if (strncmp(entity_desc.name, subdevname, strlen(subdevname)) == 0)
@ -622,20 +622,20 @@ bool SecGscaler::create(enum DEV dev, unsigned int numOfBuf)
sprintf(node, "%s%d", PFX_NODE_SUBDEV, mSubdevNodeNum);
mSubdevFd = open(node, O_RDWR);
if (mSubdevFd < 0) {
LOGE("%s::open(%s) failed", __func__, node);
ALOGE("%s::open(%s) failed", __func__, node);
goto err;
}
sprintf(node, "%s%d", PFX_NODE_VIDEODEV, mVideoNodeNum);
mVideodevFd = open(node, O_RDWR);
if (mVideodevFd < 0) {
LOGE("%s::open(%s) failed", __func__, node);
ALOGE("%s::open(%s) failed", __func__, node);
goto err;
}
/* check capability */
if (gsc_v4l2_querycap(mVideodevFd, node) < 0 ) {
LOGE("%s::tvout_std_v4l2_querycap failed", __func__);
ALOGE("%s::tvout_std_v4l2_querycap failed", __func__);
goto err;
}
@ -665,18 +665,18 @@ bool SecGscaler::destroy()
s5p_fimc_params_t *params = &(mS5pFimc.params);
if (mFlagCreate == false) {
LOGE("%s::Already Destroyed", __func__);
ALOGE("%s::Already Destroyed", __func__);
return true;
}
if (mFlagStreamOn == true) {
if (streamOff() == false) {
LOGE("%s::streamOff() failed", __func__);
ALOGE("%s::streamOff() failed", __func__);
return false;
}
if (closeVideodevFd() == false) {
LOGE("%s::closeVideodevFd() failed", __func__);
ALOGE("%s::closeVideodevFd() failed", __func__);
return false;
}
@ -720,7 +720,7 @@ bool SecGscaler::openVideodevFd(void)
sprintf(node, "%s%d", PFX_NODE_VIDEODEV, mVideoNodeNum);
mVideodevFd = open(node, O_RDWR);
if (mVideodevFd < 0) {
LOGE("%s::open(%s) failed", __func__, node);
ALOGE("%s::open(%s) failed", __func__, node);
return false;
}
@ -731,14 +731,14 @@ bool SecGscaler::closeVideodevFd(void)
{
if (mFlagSetSrcParam == true) {
if (gsc_v4l2_clr_buf(mVideodevFd, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, V4L2_MEMORY_TYPE) < 0) {
LOGE("%s::gsc_v4l2_clr_buf() failed", __func__);
ALOGE("%s::gsc_v4l2_clr_buf() failed", __func__);
return false;
}
}
if (0 < mVideodevFd) {
if (close(mVideodevFd) < 0) {
LOGE("%s::close Videodev failed", __func__);
ALOGE("%s::close Videodev failed", __func__);
return false;
}
}
@ -770,7 +770,7 @@ bool SecGscaler::getFlagSteamOn(void)
SecBuffer * SecGscaler::getSrcBufferAddr(int index)
{
if (mFlagCreate == false) {
LOGE("%s::Not yet created", __func__);
ALOGE("%s::Not yet created", __func__);
return false;
}
@ -784,17 +784,17 @@ bool SecGscaler::setSrcParams(unsigned int width, unsigned int height,
bool forceChange)
{
#ifdef DEBUG_LIB_FIMC
LOGD("%s", __func__);
ALOGD("%s", __func__);
#endif
if (mFlagCreate == false) {
LOGE("%s::Not yet created", __func__);
ALOGE("%s::Not yet created", __func__);
return false;
}
int v4l2ColorFormat = HAL_PIXEL_FORMAT_2_V4L2_PIX(colorFormat);
if (v4l2ColorFormat < 0) {
LOGE("%s::not supported color format", __func__);
ALOGE("%s::not supported color format", __func__);
return false;
}
@ -809,18 +809,18 @@ bool SecGscaler::setSrcParams(unsigned int width, unsigned int height,
if (m_checkSrcSize(width, height, cropX, cropY,
&fimcWidth, &fimcHeight, v4l2ColorFormat, false) == false) {
LOGE("%s::::size align error!", __func__);
ALOGE("%s::::size align error!", __func__);
return false;
}
if (fimcWidth != *cropWidth || fimcHeight != *cropHeight) {
if (forceChange == true) {
#ifdef DEBUG_LIB_FIMC
LOGD("size is changed from [w=%d, h=%d] to [w=%d, h=%d]",
ALOGD("size is changed from [w=%d, h=%d] to [w=%d, h=%d]",
*cropWidth, *cropHeight, fimcWidth, fimcHeight);
#endif
} else {
LOGE("%s::invalid source params", __func__);
ALOGE("%s::invalid source params", __func__);
return false;
}
}
@ -874,7 +874,7 @@ bool SecGscaler::setSrcParams(unsigned int width, unsigned int height,
mSrcBuffer[buf_index].size.extS[0] = (frame_size * 3) >> 1;
break;
default:
LOGE("%s::invalid color type", __func__);
ALOGE("%s::invalid color type", __func__);
return false;
break;
}
@ -888,7 +888,7 @@ bool SecGscaler::setSrcParams(unsigned int width, unsigned int height,
mSrcBuffer[buf_index].size.extS[2] = frame_size / frame_ratio;
break;
default:
LOGE("%s::invalid color foarmt", __func__);
ALOGE("%s::invalid color foarmt", __func__);
return false;
break;
}
@ -900,25 +900,25 @@ bool SecGscaler::setSrcParams(unsigned int width, unsigned int height,
if (mFlagSetSrcParam == true) {
if (gsc_v4l2_clr_buf(mVideodevFd, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, V4L2_MEMORY_TYPE) < 0) {
LOGE("%s::gsc_v4l2_clr_buf() failed", __func__);
ALOGE("%s::gsc_v4l2_clr_buf() failed", __func__);
return false;
}
}
if (gsc_v4l2_set_fmt(mVideodevFd, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, V4L2_FIELD_NONE, &(params->src)) < 0) {
LOGE("%s::fimc_v4l2_set_fmt()[src] failed", __func__);
ALOGE("%s::fimc_v4l2_set_fmt()[src] failed", __func__);
return false;
}
if (gsc_v4l2_req_buf(mVideodevFd, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, V4L2_MEMORY_TYPE, mNumOfBuf) < 0) {
LOGE("%s::fimc_v4l2_req_buf()[src] failed", __func__);
ALOGE("%s::fimc_v4l2_req_buf()[src] failed", __func__);
return false;
}
#ifdef USE_GSC_USERPTR
#else
for (unsigned int buf_index = 0; buf_index < MAX_BUFFERS_GSCALER; buf_index++) {
if (gsc_v4l2_query_buf(mVideodevFd, &mSrcBuffer[buf_index], V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, V4L2_MEMORY_MMAP, buf_index, params->src.planes) < 0) {
LOGE("%s::gsc_v4l2_query_buf() failed", __func__);
ALOGE("%s::gsc_v4l2_query_buf() failed", __func__);
return false;
}
}
@ -943,7 +943,7 @@ bool SecGscaler::getSrcParams(unsigned int *width, unsigned int *height,
fmt.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
if (ioctl(mVideodevFd, VIDIOC_G_FMT, &fmt) < 0) {
LOGE("%s::VIDIOC_G_FMT(fmt.type : %d) failed", __func__, fmt.type);
ALOGE("%s::VIDIOC_G_FMT(fmt.type : %d) failed", __func__, fmt.type);
return false;
}
@ -962,14 +962,14 @@ bool SecGscaler::getSrcParams(unsigned int *width, unsigned int *height,
*v4l2colorFormat = fmt.fmt.pix_mp.pixelformat;
break;
default:
LOGE("%s::Invalid buffer type", __func__);
ALOGE("%s::Invalid buffer type", __func__);
return false;
break;
}
crop.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
if (ioctl(mVideodevFd, VIDIOC_G_CROP, &crop) < 0) {
LOGE("%s::VIDIOC_G_CROP failed", __func__);
ALOGE("%s::VIDIOC_G_CROP failed", __func__);
return false;
}
@ -987,16 +987,16 @@ bool SecGscaler::setSrcAddr(unsigned int YAddr,
int colorFormat)
{
#ifdef DEBUG_LIB_FIMC
LOGD("%s", __func__);
ALOGD("%s", __func__);
#endif
if (mFlagCreate == false) {
LOGE("%s::Not yet created", __func__);
ALOGE("%s::Not yet created", __func__);
return false;
}
if (mFlagSetSrcParam == false) {
LOGE("%s::mFlagSetSrcParam == false", __func__);
ALOGE("%s::mFlagSetSrcParam == false", __func__);
return false;
}
@ -1026,11 +1026,11 @@ bool SecGscaler::setDstParams(unsigned int width, unsigned int height,
bool forceChange)
{
#ifdef DEBUG_LIB_FIMC
LOGD("%s", __func__);
ALOGD("%s", __func__);
#endif
if (mFlagCreate == false) {
LOGE("%s::Not yet created", __func__);
ALOGE("%s::Not yet created", __func__);
return false;
}
@ -1044,7 +1044,7 @@ bool SecGscaler::setDstParams(unsigned int width, unsigned int height,
if( m_checkDstSize(width, height, cropX, cropY,
&fimcWidth, &fimcHeight, V4L2_PIX_FMT_YUV444,
mRotVal, true) == false) {
LOGE("%s::size align error!", __func__);
ALOGE("%s::size align error!", __func__);
return false;
}
@ -1052,11 +1052,11 @@ bool SecGscaler::setDstParams(unsigned int width, unsigned int height,
if (fimcWidth != *cropWidth || fimcHeight != *cropHeight) {
if (forceChange == true) {
#ifdef DEBUG_LIB_FIMC
LOGD("size is changed from [w = %d, h= %d] to [w = %d, h = %d]",
ALOGD("size is changed from [w = %d, h= %d] to [w = %d, h = %d]",
*cropWidth, *cropHeight, fimcWidth, fimcHeight);
#endif
} else {
LOGE("%s::Invalid destination params", __func__);
ALOGE("%s::Invalid destination params", __func__);
return false;
}
}
@ -1095,7 +1095,7 @@ bool SecGscaler::setDstParams(unsigned int width, unsigned int height,
}
if (gsc_subdev_set_fmt(mSubdevFd, GSC_SUBDEV_PAD_SOURCE, V4L2_MBUS_FMT_YUV8_1X24, &(params->dst)) < 0) {
LOGE("%s::gsc_subdev_set_fmt()[dst] failed", __func__);
ALOGE("%s::gsc_subdev_set_fmt()[dst] failed", __func__);
return false;
}
@ -1116,7 +1116,7 @@ bool SecGscaler::getDstParams(unsigned int *width, unsigned int *height,
fmt.which = V4L2_SUBDEV_FORMAT_ACTIVE;
if (ioctl(mSubdevFd, VIDIOC_SUBDEV_G_FMT, &fmt) < 0) {
LOGE("%s::VIDIOC_SUBDEV_S_FMT", __func__);
ALOGE("%s::VIDIOC_SUBDEV_S_FMT", __func__);
return -1;
}
@ -1128,7 +1128,7 @@ bool SecGscaler::getDstParams(unsigned int *width, unsigned int *height,
crop.which = V4L2_SUBDEV_FORMAT_ACTIVE;
if (ioctl(mSubdevFd, VIDIOC_SUBDEV_G_CROP, &crop) < 0) {
LOGE("%s::VIDIOC_SUBDEV_S_CROP", __func__);
ALOGE("%s::VIDIOC_SUBDEV_S_CROP", __func__);
return -1;
}
@ -1143,11 +1143,11 @@ bool SecGscaler::getDstParams(unsigned int *width, unsigned int *height,
bool SecGscaler::setDstAddr(unsigned int YAddr, unsigned int CbAddr, unsigned int CrAddr, int buf_index)
{
#ifdef DEBUG_LIB_FIMC
LOGD("%s", __func__);
ALOGD("%s", __func__);
#endif
if (mFlagCreate == false) {
LOGE("%s::Not yet created", __func__);
ALOGE("%s::Not yet created", __func__);
return false;
}
@ -1159,12 +1159,12 @@ bool SecGscaler::setRotVal(unsigned int rotVal)
struct v4l2_control vc;
if (mFlagCreate == false) {
LOGE("%s::Not yet created", __func__);
ALOGE("%s::Not yet created", __func__);
return false;
}
if (gsc_v4l2_s_ctrl(mVideodevFd, V4L2_CID_ROTATE, rotVal) < 0) {
LOGE("%s::fimc_v4l2_s_ctrl(V4L2_CID_ROTATE) failed", __func__);
ALOGE("%s::fimc_v4l2_s_ctrl(V4L2_CID_ROTATE) failed", __func__);
return false;
}
@ -1175,12 +1175,12 @@ bool SecGscaler::setRotVal(unsigned int rotVal)
bool SecGscaler::setGlobalAlpha(bool enable, int alpha)
{
if (mFlagCreate == false) {
LOGE("%s::Not yet created", __func__);
ALOGE("%s::Not yet created", __func__);
return false;
}
if (mFlagStreamOn == true) {
LOGE("%s::mFlagStreamOn == true", __func__);
ALOGE("%s::mFlagStreamOn == true", __func__);
return false;
}
@ -1194,12 +1194,12 @@ bool SecGscaler::setGlobalAlpha(bool enable, int alpha)
bool SecGscaler::setLocalAlpha(bool enable)
{
if (mFlagCreate == false) {
LOGE("%s::Not yet created", __func__);
ALOGE("%s::Not yet created", __func__);
return false;
}
if (mFlagStreamOn == true) {
LOGE("%s::mFlagStreamOn == true", __func__);
ALOGE("%s::mFlagStreamOn == true", __func__);
return false;
}
@ -1212,12 +1212,12 @@ bool SecGscaler::setLocalAlpha(bool enable)
bool SecGscaler::setColorKey(bool enable, int colorKey)
{
if (mFlagCreate == false) {
LOGE("%s::Not yet created", __func__);
ALOGE("%s::Not yet created", __func__);
return false;
}
if (mFlagStreamOn == true) {
LOGE("%s::mFlagStreamOn == true", __func__);
ALOGE("%s::mFlagStreamOn == true", __func__);
return false;
}
@ -1230,21 +1230,21 @@ bool SecGscaler::setColorKey(bool enable, int colorKey)
bool SecGscaler::run()
{
#ifdef DEBUG_LIB_FIMC
LOGD("%s", __func__);
ALOGD("%s", __func__);
#endif
if (mFlagCreate == false) {
LOGE("%s::Not yet created", __func__);
ALOGE("%s::Not yet created", __func__);
return false;
}
if (mFlagSetSrcParam == false) {
LOGE("%s::faild : Need to set source parameters of Gscaler", __func__);
ALOGE("%s::faild : Need to set source parameters of Gscaler", __func__);
return false;
}
if (mFlagSetDstParam == false) {
LOGE("%s::faild : Need to set destination parameters of Gscaler", __func__);
ALOGE("%s::faild : Need to set destination parameters of Gscaler", __func__);
return false;
}
@ -1254,7 +1254,7 @@ bool SecGscaler::run()
src_planes = (src_planes == -1) ? 1 : src_planes;
if (gsc_v4l2_queue(mVideodevFd, &(mSrcBuffer[mSrcIndex]), V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, V4L2_MEMORY_TYPE, mSrcIndex, src_planes) < 0) {
LOGE("%s::fimc_v4l2_queue[src](mNumOfBuf : %d,mSrcIndex=%d) failed", __func__, mNumOfBuf, mSrcIndex);
ALOGE("%s::fimc_v4l2_queue[src](mNumOfBuf : %d,mSrcIndex=%d) failed", __func__, mNumOfBuf, mSrcIndex);
return false;
}
@ -1264,7 +1264,7 @@ bool SecGscaler::run()
}
if (gsc_v4l2_dequeue(mVideodevFd, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, V4L2_MEMORY_TYPE, &dqIndex, src_planes) < 0) {
LOGE("%s::fimc_v4l2_dequeue[src](mNumOfBuf : %d, dqIndex=%d) failed", __func__, mNumOfBuf, dqIndex);
ALOGE("%s::fimc_v4l2_dequeue[src](mNumOfBuf : %d, dqIndex=%d) failed", __func__, mNumOfBuf, dqIndex);
return false;
}
@ -1274,16 +1274,16 @@ bool SecGscaler::run()
bool SecGscaler::streamOn(void)
{
#ifdef DEBUG_LIB_FIMC
LOGD("%s", __func__);
ALOGD("%s", __func__);
#endif
if (mFlagCreate == false) {
LOGE("%s::Not yet created", __func__);
ALOGE("%s::Not yet created", __func__);
return false;
}
if (mFlagStreamOn == true) {
LOGE("%s::already streamon", __func__);
ALOGE("%s::already streamon", __func__);
return true;
}
@ -1292,14 +1292,14 @@ bool SecGscaler::streamOn(void)
src_planes = (src_planes == -1) ? 1 : src_planes;
if (gsc_v4l2_queue(mVideodevFd, &(mSrcBuffer[mSrcIndex]), V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, V4L2_MEMORY_TYPE, mSrcIndex, src_planes) < 0) {
LOGE("%s::fimc_v4l2_queue[src](mNumOfBuf : %d,mSrcIndex=%d) failed", __func__, mNumOfBuf, mSrcIndex);
ALOGE("%s::fimc_v4l2_queue[src](mNumOfBuf : %d,mSrcIndex=%d) failed", __func__, mNumOfBuf, mSrcIndex);
return false;
}
mSrcIndex++;
if (mSrcIndex == MAX_BUFFERS_GSCALER - 1) {
if (gsc_v4l2_stream_on(mVideodevFd, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) < 0) {
LOGE("%s::fimc_v4l2_stream_on() failed", __func__);
ALOGE("%s::fimc_v4l2_stream_on() failed", __func__);
return false;
}
mFlagStreamOn = true;
@ -1315,21 +1315,21 @@ bool SecGscaler::streamOn(void)
bool SecGscaler::streamOff(void)
{
#ifdef DEBUG_LIB_FIMC
LOGD("%s", __func__);
ALOGD("%s", __func__);
#endif
if (mFlagCreate == false) {
LOGE("%s::Not yet created", __func__);
ALOGE("%s::Not yet created", __func__);
return false;
}
if (mFlagStreamOn == false) {
LOGE("%s::already streamoff", __func__);
ALOGE("%s::already streamoff", __func__);
return true;
}
if (gsc_v4l2_stream_off(mVideodevFd, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) < 0) {
LOGE("%s::fimc_v4l2_stream_off() failed", __func__);
ALOGE("%s::fimc_v4l2_stream_off() failed", __func__);
return false;
}

File diff suppressed because it is too large Load Diff

@ -14,8 +14,8 @@
* limitations under the License.
*/
//#define LOG_NDEBUG 0
//#define LOG_TAG "libhdmi"
//#define ALOG_NDEBUG 0
//#define ALOG_TAG "libhdmi"
//#define DEBUG_HDMI_HW_LEVEL
#include <cutils/log.h>
@ -69,7 +69,7 @@ void display_menu(void)
struct HDMIAudioParameter audio;
#ifdef DEBUG_HDMI_HW_LEVEL
LOGD("%s", __func__);
ALOGD("%s", __func__);
#endif
audio.formatCode = LPCM_FORMAT;
@ -77,135 +77,135 @@ void display_menu(void)
audio.channelNum = CH_2;
audio.sampleFreq = SF_44KHZ;
LOGI("=============== HDMI Audio =============\n");
ALOGI("=============== HDMI Audio =============\n");
if (EDIDAudioModeSupport(&audio))
LOGI("= 2CH_PCM 44100Hz audio supported =\n");
ALOGI("= 2CH_PCM 44100Hz audio supported =\n");
LOGI("========= HDMI Mode & Color Space =======\n");
ALOGI("========= HDMI Mode & Color Space =======\n");
video.mode = HDMI;
if (EDIDHDMIModeSupport(&video)) {
video.colorSpace = HDMI_CS_YCBCR444;
if (EDIDColorSpaceSupport(&video))
LOGI("= 1. HDMI(YCbCr) =\n");
ALOGI("= 1. HDMI(YCbCr) =\n");
video.colorSpace = HDMI_CS_RGB;
if (EDIDColorSpaceSupport(&video))
LOGI("= 2. HDMI(RGB) =\n");
ALOGI("= 2. HDMI(RGB) =\n");
} else {
video.mode = DVI;
if (EDIDHDMIModeSupport(&video))
LOGI("= 3. DVI =\n");
ALOGI("= 3. DVI =\n");
}
LOGI("=========== HDMI Rseolution ========\n");
ALOGI("=========== HDMI Rseolution ========\n");
/* 480P */
video.resolution = v720x480p_60Hz;
video.pixelAspectRatio = HDMI_PIXEL_RATIO_16_9;
video.hdmi_3d_format = HDMI_2D_VIDEO_FORMAT;
if (EDIDVideoResolutionSupport(&video))
LOGI("= 4. 480P_60_16_9 (0x04000000) =\n");
ALOGI("= 4. 480P_60_16_9 (0x04000000) =\n");
video.resolution = v640x480p_60Hz;
video.pixelAspectRatio = HDMI_PIXEL_RATIO_4_3;
video.hdmi_3d_format = HDMI_2D_VIDEO_FORMAT;
if (EDIDVideoResolutionSupport(&video))
LOGI("= 5. 480P_60_4_3 (0x05000000) =\n");
ALOGI("= 5. 480P_60_4_3 (0x05000000) =\n");
/* 576P */
video.resolution = v720x576p_50Hz;
video.pixelAspectRatio = HDMI_PIXEL_RATIO_16_9;
video.hdmi_3d_format = HDMI_2D_VIDEO_FORMAT;
if (EDIDVideoResolutionSupport(&video))
LOGI("= 6. 576P_50_16_9 (0x06000000) =\n");
ALOGI("= 6. 576P_50_16_9 (0x06000000) =\n");
video.pixelAspectRatio = HDMI_PIXEL_RATIO_4_3;
video.hdmi_3d_format = HDMI_2D_VIDEO_FORMAT;
if (EDIDVideoResolutionSupport(&video))
LOGI("= 7. 576P_50_4_3 (0x07000000) =\n");
ALOGI("= 7. 576P_50_4_3 (0x07000000) =\n");
/* 720P 60 */
video.resolution = v1280x720p_60Hz;
video.hdmi_3d_format = HDMI_2D_VIDEO_FORMAT;
if (EDIDVideoResolutionSupport(&video))
LOGI("= 8. 720P_60 (0x08000000) =\n");
ALOGI("= 8. 720P_60 (0x08000000) =\n");
/* 720P_50 */
video.resolution = v1280x720p_50Hz;
video.hdmi_3d_format = HDMI_2D_VIDEO_FORMAT;
if (EDIDVideoResolutionSupport(&video))
LOGI("= 9. 720P_50 (0x09000000) =\n");
ALOGI("= 9. 720P_50 (0x09000000) =\n");
/* 1080P_60 */
video.resolution = v1920x1080p_60Hz;
video.hdmi_3d_format = HDMI_2D_VIDEO_FORMAT;
if (EDIDVideoResolutionSupport(&video))
LOGI("= a. 1080P_60 (0x0a000000) =\n");
ALOGI("= a. 1080P_60 (0x0a000000) =\n");
/* 1080P_50 */
video.resolution = v1920x1080p_50Hz;
video.hdmi_3d_format = HDMI_2D_VIDEO_FORMAT;
if (EDIDVideoResolutionSupport(&video))
LOGI("= b. 1080P_50 (0x0b000000) =\n");
ALOGI("= b. 1080P_50 (0x0b000000) =\n");
/* 1080I_60 */
video.resolution = v1920x1080i_60Hz;
video.hdmi_3d_format = HDMI_2D_VIDEO_FORMAT;
if (EDIDVideoResolutionSupport(&video))
LOGI("= c. 1080I_60 (0x0c000000) =\n");
ALOGI("= c. 1080I_60 (0x0c000000) =\n");
/* 1080I_50 */
video.resolution = v1920x1080i_50Hz;
video.hdmi_3d_format = HDMI_2D_VIDEO_FORMAT;
if (EDIDVideoResolutionSupport(&video))
LOGI("= d. 1080I_50 (0x0d000000) =\n");
ALOGI("= d. 1080I_50 (0x0d000000) =\n");
/* 1080P_30 */
video.resolution = v1920x1080p_30Hz;
video.hdmi_3d_format = HDMI_2D_VIDEO_FORMAT;
if (EDIDVideoResolutionSupport(&video))
LOGI("= e. 1080P_30 (0x12000000) =\n");
ALOGI("= e. 1080P_30 (0x12000000) =\n");
LOGI("=========== HDMI 3D Format ========\n");
ALOGI("=========== HDMI 3D Format ========\n");
/* 720P_60_SBS_HALF */
video.resolution = v1280x720p_60Hz;
video.hdmi_3d_format = HDMI_3D_SSH_FORMAT;
if (EDIDVideoResolutionSupport(&video))
LOGI("= f. 720P_60_SBS_HALF (0x13000000) =\n");
ALOGI("= f. 720P_60_SBS_HALF (0x13000000) =\n");
/* 720P_59_SBS_HALF */
video.resolution = v1280x720p_60Hz;
video.hdmi_3d_format = HDMI_3D_SSH_FORMAT;
if (EDIDVideoResolutionSupport(&video))
LOGI("= 10. 720P_59_SBS_HALF (0x14000000) =\n");
ALOGI("= 10. 720P_59_SBS_HALF (0x14000000) =\n");
/* 720P_50_TB */
video.resolution = v1280x720p_50Hz;
video.hdmi_3d_format = HDMI_3D_TB_FORMAT;
if (EDIDVideoResolutionSupport(&video))
LOGI("= 11. 720P_50_TB (0x15000000) =\n");
ALOGI("= 11. 720P_50_TB (0x15000000) =\n");
/* 1080P_24_TB */
video.resolution = v1920x1080p_24Hz;
video.hdmi_3d_format = HDMI_3D_TB_FORMAT;
if (EDIDVideoResolutionSupport(&video))
LOGI("= 12. 1080P_24_TB (0x16000000) =\n");
ALOGI("= 12. 1080P_24_TB (0x16000000) =\n");
/* 1080P_23_TB */
video.resolution = v1920x1080p_24Hz;
video.hdmi_3d_format = HDMI_3D_TB_FORMAT;
if (EDIDVideoResolutionSupport(&video))
LOGI("= 13. 1080P_24_TB (0x17000000) =\n");
LOGI("=========================================\n");
ALOGI("= 13. 1080P_24_TB (0x17000000) =\n");
ALOGI("=========================================\n");
}
int tvout_init(int fd_tvout, __u32 preset_id)
{
#ifdef DEBUG_HDMI_HW_LEVEL
LOGD("%s::preset_id = 0x%x", __func__, preset_id);
ALOGD("%s::preset_id = 0x%x", __func__, preset_id);
#endif
int ret;
@ -218,7 +218,7 @@ int tvout_init(int fd_tvout, __u32 preset_id)
if (fd_tvout <= 0) {
fd_tvout = open(TVOUT0_DEV_G0, O_RDWR);
if (fd_tvout < 0) {
LOGE("%s::fd_tvout open failed", __func__);
ALOGE("%s::fd_tvout open failed", __func__);
return -1;
}
}
@ -226,14 +226,14 @@ int tvout_init(int fd_tvout, __u32 preset_id)
if (output_type >= V4L2_OUTPUT_TYPE_DIGITAL &&
output_type <= V4L2_OUTPUT_TYPE_DVI)
if (ioctl(fd_tvout, VIDIOC_HDCP_ENABLE, g_hdcp_en) < 0)
LOGE("%s::VIDIOC_HDCP_ENABLE failed %d", __func__, errno);
ALOGE("%s::VIDIOC_HDCP_ENABLE failed %d", __func__, errno);
*/
i = 0;
do {
output.index = i;
ret = tvout_v4l2_enum_output(fd_tvout, &output);
LOGV("%s::output_type=%d output.index=%d .name=%s", __func__, output_type, output.index, output.name);
ALOGV("%s::output_type=%d output.index=%d .name=%s", __func__, output_type, output.index, output.name);
if (output.type == output_type) {
matched = 1;
break;
@ -242,7 +242,7 @@ int tvout_init(int fd_tvout, __u32 preset_id)
} while (ret >=0);
/*
if (!matched) {
LOGE("%s::no matched output type [type=0x%08x]", __func__, output_type);
ALOGE("%s::no matched output type [type=0x%08x]", __func__, output_type);
return -1;
}
@ -252,14 +252,14 @@ int tvout_init(int fd_tvout, __u32 preset_id)
*/
#ifdef DEBUG_HDMI_HW_LEVEL
LOGD("%s::input preset_id=0x%08x", __func__, preset_id);
ALOGD("%s::input preset_id=0x%08x", __func__, preset_id);
#endif
if (output.capabilities & V4L2_OUT_CAP_PRESETS) {
tvout_std_v4l2_enum_dv_presets(fd_tvout);
preset.preset = preset_id;
if (tvout_std_v4l2_s_dv_preset(fd_tvout, &preset) < 0 ) {
LOGE("%s::tvout_std_v4l2_s_dv_preset failed", __func__);
ALOGE("%s::tvout_std_v4l2_s_dv_preset failed", __func__);
return -1;
}
}
@ -270,7 +270,7 @@ int tvout_init(int fd_tvout, __u32 preset_id)
int tvout_deinit()
{
#ifdef DEBUG_HDMI_HW_LEVEL
LOGD("%s", __func__);
ALOGD("%s", __func__);
#endif
return 0;
@ -279,22 +279,22 @@ int tvout_deinit()
int tvout_std_v4l2_querycap(int fd, char *node)
{
#ifdef DEBUG_HDMI_HW_LEVEL
LOGD("%s", __func__);
ALOGD("%s", __func__);
#endif
struct v4l2_capability v4l2cap;
if (ioctl(fd, VIDIOC_QUERYCAP, &v4l2cap) < 0) {
LOGE("%s::VIDIOC_QUERYCAP failed", __func__);
ALOGE("%s::VIDIOC_QUERYCAP failed", __func__);
return -1;
}
if (!(v4l2cap.capabilities & V4L2_CAP_STREAMING)) {
LOGE("%s::%s is not support streaming", __func__, node);
ALOGE("%s::%s is not support streaming", __func__, node);
return -1;
}
if (!(v4l2cap.capabilities & V4L2_CAP_VIDEO_OUTPUT_MPLANE)) {
LOGE("%s::%s is not support video output mplane", __func__, node);
ALOGE("%s::%s is not support video output mplane", __func__, node);
return -1;
}
@ -304,14 +304,14 @@ int tvout_std_v4l2_querycap(int fd, char *node)
int tvout_std_v4l2_s_fmt(int fd, enum v4l2_buf_type type, enum v4l2_field field, int w, int h, int colorformat, int num_planes)
{
#ifdef DEBUG_HDMI_HW_LEVEL
LOGD("%s", __func__);
ALOGD("%s", __func__);
#endif
struct v4l2_format fmt;
fmt.type = type;
if (ioctl(fd, VIDIOC_G_FMT, &fmt) < 0) {
LOGE("%s::VIDIOC_G_FMT failed", __func__);
ALOGE("%s::VIDIOC_G_FMT failed", __func__);
return -1;
}
@ -332,13 +332,13 @@ int tvout_std_v4l2_s_fmt(int fd, enum v4l2_buf_type type, enum v4l2_field field,
fmt.fmt.pix_mp.num_planes = num_planes;
break;
default:
LOGE("%s::invalid buffer type", __func__);
ALOGE("%s::invalid buffer type", __func__);
return -1;
break;
}
if (ioctl(fd, VIDIOC_S_FMT, &fmt) < 0) {
LOGE("%s::VIDIOC_S_FMT failed", __func__);
ALOGE("%s::VIDIOC_S_FMT failed", __func__);
return -1;
}
@ -348,7 +348,7 @@ int tvout_std_v4l2_s_fmt(int fd, enum v4l2_buf_type type, enum v4l2_field field,
int tvout_std_v4l2_s_crop(int fd, enum v4l2_buf_type type, enum v4l2_field, int x, int y, int w, int h)
{
#ifdef DEBUG_HDMI_HW_LEVEL
LOGD("%s", __func__);
ALOGD("%s", __func__);
#endif
struct v4l2_crop crop;
@ -359,7 +359,7 @@ int tvout_std_v4l2_s_crop(int fd, enum v4l2_buf_type type, enum v4l2_field, int
crop.c.height = h;
if (ioctl(fd, VIDIOC_S_CROP, &crop) < 0) {
LOGE("%s::VIDIOC_S_CROP (x=%d, y=%d, w=%d, h=%d) failed",
ALOGE("%s::VIDIOC_S_CROP (x=%d, y=%d, w=%d, h=%d) failed",
__func__, x, y, w, h);
return -1;
}
@ -370,7 +370,7 @@ int tvout_std_v4l2_s_crop(int fd, enum v4l2_buf_type type, enum v4l2_field, int
int tvout_std_v4l2_s_ctrl(int fd, int id, int value)
{
#ifdef DEBUG_HDMI_HW_LEVEL
LOGD("%s", __func__);
ALOGD("%s", __func__);
#endif
struct v4l2_control vc;
@ -378,7 +378,7 @@ int tvout_std_v4l2_s_ctrl(int fd, int id, int value)
vc.value = value;
if (ioctl(fd, VIDIOC_S_CTRL, &vc) < 0) {
LOGE("%s::VIDIOC_S_CTRL (id=%d,value=%d) failed", __func__, id, value);
ALOGE("%s::VIDIOC_S_CTRL (id=%d,value=%d) failed", __func__, id, value);
return -1;
}
@ -388,7 +388,7 @@ int tvout_std_v4l2_s_ctrl(int fd, int id, int value)
int tvout_std_v4l2_reqbuf(int fd, enum v4l2_buf_type type, enum v4l2_memory memory, unsigned int num_bufs)
{
#ifdef DEBUG_HDMI_HW_LEVEL
LOGD("%s", __func__);
ALOGD("%s", __func__);
#endif
struct v4l2_requestbuffers reqbuf;
@ -397,12 +397,12 @@ int tvout_std_v4l2_reqbuf(int fd, enum v4l2_buf_type type, enum v4l2_memory memo
reqbuf.count = num_bufs;
if (ioctl(fd, VIDIOC_REQBUFS, &reqbuf) < 0) {
LOGE("%s::VIDIOC_REQBUFS failed", __func__);
ALOGE("%s::VIDIOC_REQBUFS failed", __func__);
return -1;
}
if (reqbuf.count < num_bufs) {
LOGE("%s::VIDIOC_REQBUFS failed ((reqbuf.count(%d) < num_bufs(%d))",
ALOGE("%s::VIDIOC_REQBUFS failed ((reqbuf.count(%d) < num_bufs(%d))",
__func__, reqbuf.count, num_bufs);
return -1;
}
@ -413,7 +413,7 @@ int tvout_std_v4l2_reqbuf(int fd, enum v4l2_buf_type type, enum v4l2_memory memo
int tvout_std_v4l2_querybuf(int fd, enum v4l2_buf_type type, enum v4l2_memory memory, unsigned int buf_index, unsigned int num_planes, SecBuffer *secBuf)
{
#ifdef DEBUG_HDMI_HW_LEVEL
LOGD("%s", __func__);
ALOGD("%s", __func__);
#endif
struct v4l2_buffer buf;
struct v4l2_plane planes[MAX_PLANES_MIXER];
@ -424,7 +424,7 @@ int tvout_std_v4l2_querybuf(int fd, enum v4l2_buf_type type, enum v4l2_memory me
memset(&planes[i], 0, sizeof(struct v4l2_plane));
if (MAX_BUFFERS_MIXER <= buf_index || MAX_PLANES_MIXER <= num_planes) {
LOGE("%s::exceed MAX! : buf_index=%d, num_plane=%d", __func__, buf_index, num_planes);
ALOGE("%s::exceed MAX! : buf_index=%d, num_plane=%d", __func__, buf_index, num_planes);
return -1;
}
@ -435,24 +435,24 @@ int tvout_std_v4l2_querybuf(int fd, enum v4l2_buf_type type, enum v4l2_memory me
buf.m.planes = planes;
if (ioctl(fd, VIDIOC_QUERYBUF, &buf) < 0) {
LOGE("%s::VIDIOC_QUERYBUF failed, plane_cnt=%d", __func__, buf.length);
ALOGE("%s::VIDIOC_QUERYBUF failed, plane_cnt=%d", __func__, buf.length);
return -1;
}
for (unsigned int i = 0; i < num_planes; i++) {
if ((secBuf->virt.extP[i] = (char *)mmap(0, buf.m.planes[i].length,
PROT_READ | PROT_WRITE, MAP_SHARED, fd, buf.m.planes[i].m.mem_offset)) < 0) {
LOGE("%s::mmap failed", __func__);
LOGE("%s::Offset = 0x%x", __func__, buf.m.planes[i].m.mem_offset);
LOGE("%s::Legnth = %d" , __func__, buf.m.planes[i].length);
LOGE("%s::vaddr[%d][%d] = 0x%x", __func__, buf_index, i, (unsigned int)secBuf->virt.extP[i]);
ALOGE("%s::mmap failed", __func__);
ALOGE("%s::Offset = 0x%x", __func__, buf.m.planes[i].m.mem_offset);
ALOGE("%s::Legnth = %d" , __func__, buf.m.planes[i].length);
ALOGE("%s::vaddr[%d][%d] = 0x%x", __func__, buf_index, i, (unsigned int)secBuf->virt.extP[i]);
return -1;
}
secBuf->size.extS[i] = buf.m.planes[i].length;
#ifdef DEBUG_HDMI_HW_LEVEL
LOGD("%s::vaddr[bufindex=%d][planeidx=%d] = 0x%x", __func__, buf_index, i, (unsigned int)secBuf->virt.extP[i]);
LOGD("%s::Legnth = %d" , __func__, buf.m.planes[i].length);
ALOGD("%s::vaddr[bufindex=%d][planeidx=%d] = 0x%x", __func__, buf_index, i, (unsigned int)secBuf->virt.extP[i]);
ALOGD("%s::Legnth = %d" , __func__, buf.m.planes[i].length);
#endif
}
@ -462,7 +462,7 @@ int tvout_std_v4l2_querybuf(int fd, enum v4l2_buf_type type, enum v4l2_memory me
int tvout_std_v4l2_qbuf(int fd, enum v4l2_buf_type type, enum v4l2_memory memory, int buf_index, int num_planes, SecBuffer *secBuf)
{
#ifdef DEBUG_HDMI_HW_LEVEL
LOGD("%s", __func__);
ALOGD("%s", __func__);
#endif
struct v4l2_buffer buf;
struct v4l2_plane planes[MAX_PLANES_MIXER];
@ -484,15 +484,15 @@ int tvout_std_v4l2_qbuf(int fd, enum v4l2_buf_type type, enum v4l2_memory memory
buf.m.planes[i].bytesused = buf.m.planes[i].length;
#ifdef DEBUG_HDMI_HW_LEVEL
LOGD("%s::buf.index=%d", __func__, buf.index);
LOGD("%s::buf.m.planes[%d].m.userptr=0x%08x", __func__, i, (unsigned int)buf.m.planes[i].m.userptr);
LOGD("%s::buf.m.planes[%d].length =0x%08x", __func__, i, buf.m.planes[i].length);
LOGD("%s::buf.m.planes[%d].bytesused=0x%08x", __func__, i, buf.m.planes[i].bytesused);
ALOGD("%s::buf.index=%d", __func__, buf.index);
ALOGD("%s::buf.m.planes[%d].m.userptr=0x%08x", __func__, i, (unsigned int)buf.m.planes[i].m.userptr);
ALOGD("%s::buf.m.planes[%d].length =0x%08x", __func__, i, buf.m.planes[i].length);
ALOGD("%s::buf.m.planes[%d].bytesused=0x%08x", __func__, i, buf.m.planes[i].bytesused);
#endif
}
if (ioctl(fd, VIDIOC_QBUF, &buf) < 0) {
LOGE("%s::VIDIOC_QBUF failed", __func__);
ALOGE("%s::VIDIOC_QBUF failed", __func__);
return -1;
}
@ -502,7 +502,7 @@ int tvout_std_v4l2_qbuf(int fd, enum v4l2_buf_type type, enum v4l2_memory memory
int tvout_std_v4l2_dqbuf(int fd, enum v4l2_buf_type type, enum v4l2_memory memory, int *buf_index, int num_planes)
{
#ifdef DEBUG_HDMI_HW_LEVEL
LOGD("%s", __func__);
ALOGD("%s", __func__);
#endif
struct v4l2_buffer buf;
struct v4l2_plane planes[MAX_PLANES_MIXER];
@ -519,13 +519,13 @@ int tvout_std_v4l2_dqbuf(int fd, enum v4l2_buf_type type, enum v4l2_memory memor
buf.m.planes = planes;
if (ioctl(fd, VIDIOC_DQBUF, &buf) < 0) {
LOGE("%s::VIDIOC_DQBUF failed", __func__);
ALOGE("%s::VIDIOC_DQBUF failed", __func__);
return -1;
}
*buf_index = buf.index;
#ifdef DEBUG_HDMI_HW_LEVEL
LOGD("%s::buf.index=%d", __func__, buf.index);
ALOGD("%s::buf.index=%d", __func__, buf.index);
#endif
return 0;
@ -534,10 +534,10 @@ int tvout_std_v4l2_dqbuf(int fd, enum v4l2_buf_type type, enum v4l2_memory memor
int tvout_std_v4l2_streamon(int fd, enum v4l2_buf_type type)
{
#ifdef DEBUG_HDMI_HW_LEVEL
LOGD("%s", __func__);
ALOGD("%s", __func__);
#endif
if (ioctl(fd, VIDIOC_STREAMON, &type) < 0) {
LOGE("%s::VIDIOC_STREAMON failed", __func__);
ALOGE("%s::VIDIOC_STREAMON failed", __func__);
return -1;
}
@ -547,10 +547,10 @@ int tvout_std_v4l2_streamon(int fd, enum v4l2_buf_type type)
int tvout_std_v4l2_streamoff(int fd, enum v4l2_buf_type type)
{
#ifdef DEBUG_HDMI_HW_LEVEL
LOGD("%s", __func__);
ALOGD("%s", __func__);
#endif
if (ioctl(fd, VIDIOC_STREAMOFF, &type) < 0) {
LOGE("%s::VIDIOC_STREAMOFF failed", __func__);
ALOGE("%s::VIDIOC_STREAMOFF failed", __func__);
return -1;
}
@ -560,7 +560,7 @@ int tvout_std_v4l2_streamoff(int fd, enum v4l2_buf_type type)
int tvout_v4l2_enum_output(int fd, struct v4l2_output *output)
{
#ifdef DEBUG_HDMI_HW_LEVEL
LOGD("%s", __func__);
ALOGD("%s", __func__);
#endif
int ret = -1 ;
ret = ioctl(fd, VIDIOC_ENUMOUTPUT, output);
@ -568,10 +568,10 @@ int tvout_v4l2_enum_output(int fd, struct v4l2_output *output)
if (ret < 0) {
if (errno == EINVAL)
return -1;
LOGE("%s::VIDIOC_ENUMOUTPUT", __func__);
ALOGE("%s::VIDIOC_ENUMOUTPUT", __func__);
return -1;
}
LOGD("%s::index=%d, type=0x%08x, name=%s",
ALOGD("%s::index=%d, type=0x%08x, name=%s",
__func__, output->index, output->type, output->name);
return ret;
@ -580,10 +580,10 @@ int tvout_v4l2_enum_output(int fd, struct v4l2_output *output)
int tvout_v4l2_s_output(int fd, int index)
{
#ifdef DEBUG_HDMI_HW_LEVEL
LOGD("%s", __func__);
ALOGD("%s", __func__);
#endif
if (ioctl(fd, VIDIOC_S_OUTPUT, &index) < 0) {
LOGE("%s::VIDIOC_S_OUTPUT failed", __func__);
ALOGE("%s::VIDIOC_S_OUTPUT failed", __func__);
return -1;
}
@ -593,10 +593,10 @@ int tvout_v4l2_s_output(int fd, int index)
int tvout_v4l2_g_output(int fd, int *index)
{
#ifdef DEBUG_HDMI_HW_LEVEL
LOGD("%s", __func__);
ALOGD("%s", __func__);
#endif
if (ioctl(fd, VIDIOC_G_OUTPUT, index) < 0) {
LOGE("%s::VIDIOC_G_OUTPUT failed", __func__);
ALOGE("%s::VIDIOC_G_OUTPUT failed", __func__);
return -1;
}
@ -606,7 +606,7 @@ int tvout_v4l2_g_output(int fd, int *index)
int tvout_std_v4l2_enum_dv_presets(int fd)
{
#ifdef DEBUG_HDMI_HW_LEVEL
LOGD("%s", __func__);
ALOGD("%s", __func__);
#endif
struct v4l2_dv_enum_preset enum_preset;
int ret = -1;
@ -618,10 +618,10 @@ int tvout_std_v4l2_enum_dv_presets(int fd)
if (ret < 0) {
if (errno == EINVAL)
break;
LOGE("%s::VIDIOC_ENUM_DV_PRESETS", __func__);
ALOGE("%s::VIDIOC_ENUM_DV_PRESETS", __func__);
return -1;
}
LOGD("%s::index=%d, preset=0x%08x, name=%s, w=%d, h=%d",
ALOGD("%s::index=%d, preset=0x%08x, name=%s, w=%d, h=%d",
__func__, enum_preset.index, enum_preset.preset, enum_preset.name, enum_preset.width, enum_preset.height);
}
@ -631,14 +631,14 @@ int tvout_std_v4l2_enum_dv_presets(int fd)
int tvout_std_v4l2_s_dv_preset(int fd, struct v4l2_dv_preset *preset)
{
#ifdef DEBUG_HDMI_HW_LEVEL
LOGD("%s", __func__);
ALOGD("%s", __func__);
#endif
if (ioctl(fd, VIDIOC_S_DV_PRESET, preset) < 0) {
LOGE("%s::VIDIOC_S_DV_PRESET failed preset_id=%d", __func__, preset->preset);
ALOGE("%s::VIDIOC_S_DV_PRESET failed preset_id=%d", __func__, preset->preset);
return -1;
}
#ifdef DEBUG_HDMI_HW_LEVEL
LOGD("%s::preset_id=%d", __func__, preset->preset);
ALOGD("%s::preset_id=%d", __func__, preset->preset);
#endif
return 0;
}
@ -646,7 +646,7 @@ int tvout_std_v4l2_s_dv_preset(int fd, struct v4l2_dv_preset *preset)
int tvout_std_subdev_s_fmt(int fd, unsigned int pad, int w, int h, enum v4l2_mbus_pixelcode code)
{
#ifdef DEBUG_HDMI_HW_LEVEL
LOGD("%s", __func__);
ALOGD("%s", __func__);
#endif
struct v4l2_subdev_format fmt;
@ -657,19 +657,19 @@ int tvout_std_subdev_s_fmt(int fd, unsigned int pad, int w, int h, enum v4l2_mbu
fmt.format.code = code;
if (ioctl(fd, VIDIOC_SUBDEV_S_FMT, &fmt) < 0) {
LOGE("%s::VIDIOC_SUBDEV_S_FMT", __func__);
ALOGE("%s::VIDIOC_SUBDEV_S_FMT", __func__);
return -1;
}
#ifdef DEBUG_HDMI_HW_LEVEL
LOGD("%s::format w=%d, h=%d", __func__, fmt.format.width, fmt.format.height);
ALOGD("%s::format w=%d, h=%d", __func__, fmt.format.width, fmt.format.height);
#endif
return 0;
}
int tvout_std_subdev_s_crop(int fd, unsigned int pad, int x, int y, int w, int h)
{
#ifdef DEBUG_HDMI_HW_LEVEL
LOGD("%s::pad=%d, crop x=%d, y=%d, w=%d, h=%d", __func__, pad, x, y, w, h);
ALOGD("%s::pad=%d, crop x=%d, y=%d, w=%d, h=%d", __func__, pad, x, y, w, h);
#endif
struct v4l2_subdev_crop crop;
@ -682,12 +682,12 @@ int tvout_std_subdev_s_crop(int fd, unsigned int pad, int x, int y, int w, int h
crop.rect.height = h;
if (ioctl(fd, VIDIOC_SUBDEV_S_CROP, &crop) < 0) {
LOGE("%s::VIDIOC_SUBDEV_S_CROP", __func__);
ALOGE("%s::VIDIOC_SUBDEV_S_CROP", __func__);
return -1;
}
#ifdef DEBUG_HDMI_HW_LEVEL
LOGD("%s::pad=%d, crop x=%d, y=%d, w=%d, h=%d", __func__, pad, crop.rect.left, crop.rect.top, crop.rect.width, crop.rect.height);
ALOGD("%s::pad=%d, crop x=%d, y=%d, w=%d, h=%d", __func__, pad, crop.rect.left, crop.rect.top, crop.rect.width, crop.rect.height);
#endif
return 0;
@ -715,20 +715,20 @@ void hdmi_cal_rect(int src_w, int src_h, int dst_w, int dst_h, struct v4l2_rect
int hdmi_set_videolayer(int fd, int hdmiW, int hdmiH, struct v4l2_rect * rect)
{
#ifdef DEBUG_HDMI_HW_LEVEL
LOGD("%s", __func__);
ALOGD("%s", __func__);
#endif
if (tvout_std_subdev_s_fmt(fd, MIXER_V_SUBDEV_PAD_SINK, hdmiW, hdmiH, V4L2_MBUS_FMT_YUV8_1X24) < 0) {
LOGE("%s::tvout_std_subdev_s_fmt(PAD=%d)[videolayer] failed", __func__, MIXER_V_SUBDEV_PAD_SINK);
ALOGE("%s::tvout_std_subdev_s_fmt(PAD=%d)[videolayer] failed", __func__, MIXER_V_SUBDEV_PAD_SINK);
return -1;
}
if (tvout_std_subdev_s_crop(fd, MIXER_V_SUBDEV_PAD_SINK, 0, 0, rect->width, rect->height) < 0) {
LOGE("%s::tvout_std_subdev_s_crop(PAD=%d)[videolayer] failed", __func__, MIXER_V_SUBDEV_PAD_SINK);
ALOGE("%s::tvout_std_subdev_s_crop(PAD=%d)[videolayer] failed", __func__, MIXER_V_SUBDEV_PAD_SINK);
return -1;
}
if (tvout_std_subdev_s_crop(fd, MIXER_V_SUBDEV_PAD_SOURCE, rect->left, rect->top, rect->width, rect->height) < 0) {
LOGE("%s::tvout_std_subdev_s_crop(PAD=%d)[videolayer] failed", __func__, MIXER_V_SUBDEV_PAD_SOURCE);
ALOGE("%s::tvout_std_subdev_s_crop(PAD=%d)[videolayer] failed", __func__, MIXER_V_SUBDEV_PAD_SOURCE);
return -1;
}
return 0;
@ -742,7 +742,7 @@ int hdmi_set_graphiclayer(int fd_subdev, int fd_videodev,int layer,
int rotVal)
{
#ifdef DEBUG_HDMI_HW_LEVEL
LOGD("%s", __func__);
ALOGD("%s", __func__);
#endif
#if defined(BOARD_USES_HDMI_FIMGAPI)
int dst_color_format;
@ -822,7 +822,7 @@ int hdmi_set_graphiclayer(int fd_subdev, int fd_videodev,int layer,
g2d_rotation = ROT_270;
break;
default:
LOGE("%s::invalid rotVal(%d) : failed", __func__, rotVal);
ALOGE("%s::invalid rotVal(%d) : failed", __func__, rotVal);
return -1;
break;
}
@ -830,7 +830,7 @@ int hdmi_set_graphiclayer(int fd_subdev, int fd_videodev,int layer,
BlitParam = {BLIT_OP_SRC, NON_PREMULTIPLIED, 0xff, 0, g2d_rotation, &Scaling, 0, 0, &dstClip, 0, &srcImage, &dstImage, NULL, &srcRect, &dstRect, NULL, 0};
if (stretchFimgApi(&BlitParam) < 0) {
LOGE("%s::stretchFimgApi() failed", __func__);
ALOGE("%s::stretchFimgApi() failed", __func__);
return -1;
}
@ -849,7 +849,7 @@ int hdmi_set_g_Params(int fd_subdev, int fd_videodev, int layer,
int dst_x, int dst_y, int dst_w, int dst_h)
{
#ifdef DEBUG_HDMI_HW_LEVEL
LOGD("%s", __func__);
ALOGD("%s", __func__);
#endif
struct v4l2_rect rect;
int src_pad = 0;
@ -866,7 +866,7 @@ int hdmi_set_g_Params(int fd_subdev, int fd_videodev, int layer,
src_pad = MIXER_G1_SUBDEV_PAD_SOURCE;
break;
default:
LOGE("%s::invalid layer(%d)", __func__, layer);
ALOGE("%s::invalid layer(%d)", __func__, layer);
break;
};
@ -883,34 +883,34 @@ int hdmi_set_g_Params(int fd_subdev, int fd_videodev, int layer,
/* set sub device for mixer graphic layer input */
if (tvout_std_subdev_s_fmt(fd_subdev, sink_pad, rect.width, rect.height, V4L2_MBUS_FMT_XRGB8888_4X8_LE) < 0) {
LOGE("%s::tvout_std_subdev_s_fmt(PAD=%d)[graphic layer] failed", __func__, sink_pad);
ALOGE("%s::tvout_std_subdev_s_fmt(PAD=%d)[graphic layer] failed", __func__, sink_pad);
return -1;
}
if (tvout_std_subdev_s_crop(fd_subdev, sink_pad, 0, 0, rect.width, rect.height) < 0) {
LOGE("%s::tvout_std_subdev_s_crop(PAD=%d)[graphic layer] failed", __func__, sink_pad);
ALOGE("%s::tvout_std_subdev_s_crop(PAD=%d)[graphic layer] failed", __func__, sink_pad);
return -1;
}
if (tvout_std_subdev_s_crop(fd_subdev, src_pad, rect.left, rect.top, rect.width, rect.height) < 0) {
LOGE("%s::tvout_std_subdev_s_crop(PAD=%d)[graphic layer] failed", __func__, src_pad);
ALOGE("%s::tvout_std_subdev_s_crop(PAD=%d)[graphic layer] failed", __func__, src_pad);
return -1;
}
/* set format for mixer graphic layer input device*/
if (tvout_std_v4l2_s_fmt(fd_videodev, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, V4L2_FIELD_ANY, rect.width, rect.height, v4l2ColorFormat, 1) < 0) {
LOGE("%s::tvout_std_v4l2_s_fmt()[graphic layer] failed", __func__);
ALOGE("%s::tvout_std_v4l2_s_fmt()[graphic layer] failed", __func__);
return -1;
}
if (tvout_std_v4l2_s_crop(fd_videodev, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, V4L2_FIELD_ANY, rect.left, rect.top, rect.width, rect.height) < 0) {
LOGE("%s::tvout_std_v4l2_s_crop()[graphic layer] failed", __func__);
ALOGE("%s::tvout_std_v4l2_s_crop()[graphic layer] failed", __func__);
return -1;
}
/* request buffer for mixer graphic layer input device */
if (tvout_std_v4l2_reqbuf(fd_videodev, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, V4L2_MEMORY_USERPTR, 2) < 0) {
LOGE("%s::tvout_std_v4l2_reqbuf(buf_num=%d)[graphic layer] failed", __func__, 2);
ALOGE("%s::tvout_std_v4l2_reqbuf(buf_num=%d)[graphic layer] failed", __func__, 2);
return -1;
}
@ -920,7 +920,7 @@ int hdmi_set_g_Params(int fd_subdev, int fd_videodev, int layer,
int hdmi_cable_status()
{
#ifdef DEBUG_HDMI_HW_LEVEL
LOGD("%s", __func__);
ALOGD("%s", __func__);
#endif
int cable_status = 0;
@ -929,21 +929,21 @@ int hdmi_cable_status()
fd = open(TVOUT0_DEV_G0, O_RDWR);
if (fd <= 0) {
LOGE("%s: graphic layer 0 drv open failed", __func__);
ALOGE("%s: graphic layer 0 drv open failed", __func__);
return -1;
}
ctrl.id = V4L2_CID_TV_HPD_STATUS;
if (ioctl(fd, VIDIOC_S_CTRL, &ctrl) < 0) {
LOGE("Get HPD_STATUS fail");
ALOGE("Get HPD_STATUS fail");
cable_status = -1;
} else {
cable_status = ctrl.value;
}
#ifdef DEBUG_HDMI_HW_LEVEL
LOGD("HPD_STATUS = %d", cable_status);
ALOGD("HPD_STATUS = %d", cable_status);
#endif
close(fd);
@ -969,7 +969,7 @@ int hdmi_outputmode_2_v4l2_output_type(int output_mode)
v4l2_output_type = V4L2_OUTPUT_TYPE_COMPOSITE;
break;
default:
LOGE("%s::unmathced HDMI_mode(%d)", __func__, output_mode);
ALOGE("%s::unmathced HDMI_mode(%d)", __func__, output_mode);
v4l2_output_type = -1;
break;
}
@ -995,7 +995,7 @@ int hdmi_v4l2_output_type_2_outputmode(int v4l2_output_type)
outputMode = COMPOSITE_OUTPUT_MODE;
break;
default:
LOGE("%s::unmathced v4l2_output_type(%d)", __func__, v4l2_output_type);
ALOGE("%s::unmathced v4l2_output_type(%d)", __func__, v4l2_output_type);
outputMode = -1;
break;
}
@ -1030,7 +1030,7 @@ int composite_std_2_v4l2_std_id(int std)
std_id = V4L2_STD_PAL_60;
break;
default:
LOGE("%s::unmathced composite_std(%d)", __func__, std);
ALOGE("%s::unmathced composite_std(%d)", __func__, std);
break;
}
@ -1053,14 +1053,14 @@ int hdmi_check_output_mode(int v4l2_output_type)
video.mode = HDMI;
if (!EDIDHDMIModeSupport(&video)) {
calbirate_v4l2_mode = V4L2_OUTPUT_TYPE_DVI;
LOGI("Change mode into DVI\n");
ALOGI("Change mode into DVI\n");
break;
}
video.colorSpace = HDMI_CS_YCBCR444;
if (!EDIDColorSpaceSupport(&video)) {
calbirate_v4l2_mode = V4L2_OUTPUT_TYPE_HDMI_RGB;
LOGI("Change mode into HDMI_RGB\n");
ALOGI("Change mode into HDMI_RGB\n");
}
break;
@ -1068,14 +1068,14 @@ int hdmi_check_output_mode(int v4l2_output_type)
video.mode = HDMI;
if (!EDIDHDMIModeSupport(&video)) {
calbirate_v4l2_mode = V4L2_OUTPUT_TYPE_DVI;
LOGI("Change mode into DVI\n");
ALOGI("Change mode into DVI\n");
break;
}
video.colorSpace = HDMI_CS_RGB;
if (!EDIDColorSpaceSupport(&video)) {
calbirate_v4l2_mode = V4L2_OUTPUT_TYPE_DIGITAL;
LOGI("Change mode into HDMI_YCBCR\n");
ALOGI("Change mode into HDMI_YCBCR\n");
}
break;
@ -1085,10 +1085,10 @@ int hdmi_check_output_mode(int v4l2_output_type)
video.colorSpace = HDMI_CS_YCBCR444;
if (!EDIDColorSpaceSupport(&video)) {
calbirate_v4l2_mode = V4L2_OUTPUT_TYPE_HDMI_RGB;
LOGI("Change mode into HDMI_RGB\n");
ALOGI("Change mode into HDMI_RGB\n");
} else {
calbirate_v4l2_mode = V4L2_OUTPUT_TYPE_DIGITAL;
LOGI("Change mode into HDMI_YCBCR\n");
ALOGI("Change mode into HDMI_YCBCR\n");
}
break;
}
@ -1192,14 +1192,14 @@ int hdmi_check_resolution(v4l2_std_id std_id)
video.hdmi_3d_format = HDMI_3D_TB_FORMAT;
break;
default:
LOGE("%s::unmathced std_id(%lld)", __func__, std_id);
ALOGE("%s::unmathced std_id(%lld)", __func__, std_id);
return -1;
break;
}
if (!EDIDVideoResolutionSupport(&video)) {
#ifdef DEBUG_MSG_ENABLE
LOGD("%s::EDIDVideoResolutionSupport(%llx) fail (not suppoted std_id) \n", __func__, std_id);
ALOGD("%s::EDIDVideoResolutionSupport(%llx) fail (not suppoted std_id) \n", __func__, std_id);
#endif
return -1;
}
@ -1297,7 +1297,7 @@ int hdmi_resolution_2_std_id(unsigned int resolution, int * w, int * h, v4l2_std
*preset_id = V4L2_DV_480P60;
break;
default:
LOGE("%s::unmathced resolution(%d)", __func__, resolution);
ALOGE("%s::unmathced resolution(%d)", __func__, resolution);
ret = -1;
break;
}
@ -1308,7 +1308,7 @@ int hdmi_resolution_2_std_id(unsigned int resolution, int * w, int * h, v4l2_std
int hdmi_enable_hdcp(int fd, unsigned int hdcp_en)
{
if (ioctl(fd, VIDIOC_HDCP_ENABLE, hdcp_en) < 0) {
LOGD("%s::VIDIOC_HDCP_ENABLE(%d) fail \n", __func__, hdcp_en);
ALOGD("%s::VIDIOC_HDCP_ENABLE(%d) fail \n", __func__, hdcp_en);
return -1;
}
@ -1334,12 +1334,12 @@ int hdmi_check_audio(int fd)
#endif
if (audio_state == ON) {
if (ioctl(fd, VIDIOC_INIT_AUDIO, 1) < 0) {
LOGE("%s::VIDIOC_INIT_AUDIO(1) failed", __func__);
ALOGE("%s::VIDIOC_INIT_AUDIO(1) failed", __func__);
ret = -1;
}
} else {
if (ioctl(fd, VIDIOC_INIT_AUDIO, 0) < 0) {
LOGE("%s::VIDIOC_INIT_AUDIO(0) failed", __func__);
ALOGE("%s::VIDIOC_INIT_AUDIO(0) failed", __func__);
ret = -1;
}
}

@ -17,8 +17,8 @@
#ifndef __HDMI_HAL_V4L2_UTILS_H__
#define __HDMI_HAL_V4L2_UTILS_H__
//#define LOG_NDEBUG 0
//#define LOG_TAG "libhdmi"
//#define ALOG_NDEBUG 0
//#define ALOG_TAG "libhdmi"
#include "fimd_api.h"
#include "SecBuffer.h"

@ -41,7 +41,7 @@ int fb_open(int win)
fp = open(node, O_RDWR);
if (fp < 0)
LOGE("%s: fb[%d] open failed", __func__, win);
ALOGE("%s: fb[%d] open failed", __func__, win);
return fp;
}
@ -51,7 +51,7 @@ int fb_close(int fp)
if (fp)
close(fp);
else
LOGE("%s: fb is not allocated %d", __func__, fp);
ALOGE("%s: fb is not allocated %d", __func__, fp);
return 0;
}
@ -62,7 +62,7 @@ int get_fscreeninfo(int fp, struct fb_fix_screeninfo *fix)
ret = ioctl(fp, FBIOGET_FSCREENINFO, fix);
if (ret)
LOGE("%s: FBIOGET_FSCREENINFO failed", __func__);
ALOGE("%s: FBIOGET_FSCREENINFO failed", __func__);
return ret;
}
@ -73,7 +73,7 @@ int get_vscreeninfo(int fp, struct fb_var_screeninfo *var)
ret = ioctl(fp, FBIOGET_VSCREENINFO, var);
if (ret)
LOGE("%s:: FBIOGET_VSCREENINFO failed", __func__);
ALOGE("%s:: FBIOGET_VSCREENINFO failed", __func__);
return ret;
}
@ -84,7 +84,7 @@ int put_vscreeninfo(int fp, struct fb_var_screeninfo *var)
ret = ioctl(fp, FBIOPUT_VSCREENINFO, var);
if (ret)
LOGE("%s:: FBIOPUT_VSCREENINFO failed", __func__);
ALOGE("%s:: FBIOPUT_VSCREENINFO failed", __func__);
return ret;
}
@ -102,7 +102,7 @@ char *fb_mmap(__u32 size, int fp)
buffer = (char *)mmap(0, size, PROT_READ | PROT_WRITE,
MAP_SHARED, fp, 0);
if (!buffer) {
LOGE("%s:: mmap failed", __func__);
ALOGE("%s:: mmap failed", __func__);
return NULL;
}
@ -115,7 +115,7 @@ int fb_ioctl(int fp, __u32 cmd, void *arg)
ret = ioctl(fp, cmd, arg);
if (ret < 0)
LOGE("%s:: ioctl (%d) failed", __func__, cmd);
ALOGE("%s:: ioctl (%d) failed", __func__, cmd);
return ret;
}
@ -126,7 +126,7 @@ int fb_on(int fp)
ret = ioctl(fp, FBIOBLANK, FB_BLANK_UNBLANK);
if (ret)
LOGE("%s:: FBIOBLANK failed", __func__);
ALOGE("%s:: FBIOBLANK failed", __func__);
return ret;
}
@ -137,7 +137,7 @@ int fb_off(int fp)
ret = ioctl(fp, FBIOBLANK, FB_BLANK_POWERDOWN);
if (ret)
LOGE("%s:: FBIOBLANK failed", __func__);
ALOGE("%s:: FBIOBLANK failed", __func__);
return ret;
}
@ -152,7 +152,7 @@ int fb_off_all()
return -1;
if (ioctl(fp, FBIOBLANK, FB_BLANK_POWERDOWN) < 0)
LOGE("%s:: FBIOBLANK failed", __func__);
ALOGE("%s:: FBIOBLANK failed", __func__);
fb_off(fp);
fb_close(fp);

@ -107,7 +107,7 @@ sp<MessageBase> MessageQueue::waitMessage(nsecs_t timeout)
}
if (nextEventTime >= 0) {
//LOGD("nextEventTime = %lld ms", nextEventTime);
//ALOGD("nextEventTime = %lld ms", nextEventTime);
if (nextEventTime > 0) {
// we're about to wait, flush the binder command buffer
IPCThreadState::self()->flushCommands();
@ -117,7 +117,7 @@ sp<MessageBase> MessageQueue::waitMessage(nsecs_t timeout)
}
}
} else {
//LOGD("going to wait");
//ALOGD("going to wait");
// we're about to wait, flush the binder command buffer
IPCThreadState::self()->flushCommands();
mCondition.wait(mLock);
@ -160,7 +160,7 @@ status_t MessageQueue::queueMessage(
message->when = systemTime() + relTime;
mMessages.insert(message);
//LOGD("MessageQueue::queueMessage time = %lld ms", message->when);
//ALOGD("MessageQueue::queueMessage time = %lld ms", message->when);
//dumpLocked(message);
mCondition.signal();
@ -180,7 +180,7 @@ void MessageQueue::dumpLocked(const sp<MessageBase>& message)
int c = 0;
while (cur != end) {
const char tick = (*cur == message) ? '>' : ' ';
LOGD("%c %d: msg{.what=%08x, when=%lld}",
ALOGD("%c %d: msg{.what=%08x, when=%lld}",
tick, c, (*cur)->what, (*cur)->when);
++cur;
c++;

@ -22,7 +22,7 @@
** @date 2011-07-06
*/
#define LOG_TAG "libhdmiclient"
#define ALOG_TAG "libhdmiclient"
#include "SecHdmiClient.h"
@ -47,7 +47,7 @@ SecHdmiClient * SecHdmiClient::getInstance(void)
void SecHdmiClient::setHdmiCableStatus(int status)
{
LOGD("%s HDMI status: %d\n", __func__, status);
ALOGD("%s HDMI status: %d\n", __func__, status);
if (g_SecTVOutService != 0)
g_SecTVOutService->setHdmiCableStatus(status);
@ -55,7 +55,7 @@ void SecHdmiClient::setHdmiCableStatus(int status)
void SecHdmiClient::setHdmiMode(int mode)
{
//LOGD("%s HDMI Mode: %d\n", __func__, mode);
//ALOGD("%s HDMI Mode: %d\n", __func__, mode);
if (g_SecTVOutService != 0)
g_SecTVOutService->setHdmiMode(mode);
@ -63,7 +63,7 @@ void SecHdmiClient::setHdmiMode(int mode)
void SecHdmiClient::setHdmiResolution(int resolution)
{
//LOGD("%s HDMI Resolution: %d\n", __func__, resolution);
//ALOGD("%s HDMI Resolution: %d\n", __func__, resolution);
if (g_SecTVOutService != 0)
g_SecTVOutService->setHdmiResolution(resolution);
@ -71,7 +71,7 @@ void SecHdmiClient::setHdmiResolution(int resolution)
void SecHdmiClient::setHdmiHdcp(int enHdcp)
{
//LOGD("%s HDMI HDCP: %d\n", __func__, enHdcp);
//ALOGD("%s HDMI HDCP: %d\n", __func__, enHdcp);
if (g_SecTVOutService != 0)
g_SecTVOutService->setHdmiHdcp(enHdcp);
@ -79,7 +79,7 @@ void SecHdmiClient::setHdmiHdcp(int enHdcp)
void SecHdmiClient::setHdmiRotate(int rotVal, uint32_t hwcLayer)
{
//LOGD("%s HDMI ROTATE: %d\n", __func__, rotVal);
//ALOGD("%s HDMI ROTATE: %d\n", __func__, rotVal);
if (g_SecTVOutService != 0)
g_SecTVOutService->setHdmiRotate(rotVal, hwcLayer);
@ -87,7 +87,7 @@ void SecHdmiClient::setHdmiRotate(int rotVal, uint32_t hwcLayer)
void SecHdmiClient::setHdmiHwcLayer(uint32_t hwcLayer)
{
//LOGD("%s HDMI HWCLAYER: %d\n", __func__, hwcLayer);
//ALOGD("%s HDMI HWCLAYER: %d\n", __func__, hwcLayer);
if (g_SecTVOutService != 0)
g_SecTVOutService->setHdmiHwcLayer(hwcLayer);
@ -119,7 +119,7 @@ sp<ISecTVOut> SecHdmiClient::m_getSecTVOutService(void)
for(getSvcTimes = 0; getSvcTimes < GETSERVICETIMEOUT; getSvcTimes++) {
binder = sm->getService(String16("SecTVOutService"));
if (binder == 0) {
LOGW("SecTVOutService not published, waiting...");
ALOGW("SecTVOutService not published, waiting...");
usleep(500000); // 0.5 s
} else {
break;
@ -130,7 +130,7 @@ sp<ISecTVOut> SecHdmiClient::m_getSecTVOutService(void)
sc = interface_cast<ISecTVOut>(binder);
g_SecTVOutService = sc;
} else {
LOGW("Failed to get SecTVOutService... SecHdmiClient will get it later..");
ALOGW("Failed to get SecTVOutService... SecHdmiClient will get it later..");
}
}
return g_SecTVOutService;

@ -22,7 +22,7 @@
** @date 2011-07-06
*/
#define LOG_TAG "SecTVOutService"
#define ALOG_TAG "SecTVOutService"
#include <binder/IServiceManager.h>
#include <utils/RefBase.h>
@ -61,15 +61,15 @@ namespace android {
int SecTVOutService::instantiate()
{
LOGD("SecTVOutService instantiate");
ALOGD("SecTVOutService instantiate");
int r = defaultServiceManager()->addService(String16( "SecTVOutService"), new SecTVOutService ());
LOGD("SecTVOutService r=%d", r);
ALOGD("SecTVOutService r=%d", r);
return r;
}
SecTVOutService::SecTVOutService () {
LOGV("SecTVOutService created");
ALOGV("SecTVOutService created");
mHdmiCableInserted = false;
#ifdef SUPPORT_G2D_UI_MODE
mUILayerMode = SecHdmi::HDMI_LAYER_GRAPHIC_1;
@ -81,7 +81,7 @@ namespace android {
setLCDsize();
if (mSecHdmi.create(mLCD_width, mLCD_height) == false)
LOGE("%s::mSecHdmi.create() fail", __func__);
ALOGE("%s::mSecHdmi.create() fail", __func__);
else
setHdmiStatus(1);
@ -118,7 +118,7 @@ namespace android {
}
SecTVOutService::~SecTVOutService () {
LOGV ("SecTVOutService destroyed");
ALOGV ("SecTVOutService destroyed");
if (mHdmiFlushThread != NULL) {
mHdmiFlushThread->requestExit();
@ -178,7 +178,7 @@ namespace android {
} break;
default :
LOGE ( "onTransact::default");
ALOGE ( "onTransact::default");
return BBinder::onTransact (code, data, reply, flags);
}
@ -187,7 +187,7 @@ namespace android {
void SecTVOutService::setHdmiStatus(uint32_t status)
{
LOGD("%s HDMI cable status = %d", __func__, status);
ALOGD("%s HDMI cable status = %d", __func__, status);
{
Mutex::Autolock _l(mLock);
@ -198,12 +198,12 @@ namespace android {
if (hdmiCableInserted == true) {
if (mSecHdmi.connect() == false) {
LOGE("%s::mSecHdmi.connect() fail", __func__);
ALOGE("%s::mSecHdmi.connect() fail", __func__);
hdmiCableInserted = false;
}
} else {
if (mSecHdmi.disconnect() == false)
LOGE("%s::mSecHdmi.disconnect() fail", __func__);
ALOGE("%s::mSecHdmi.disconnect() fail", __func__);
}
mHdmiCableInserted = hdmiCableInserted;
@ -215,51 +215,51 @@ namespace android {
void SecTVOutService::setHdmiMode(uint32_t mode)
{
LOGD("%s TV mode = %d", __func__, mode);
ALOGD("%s TV mode = %d", __func__, mode);
Mutex::Autolock _l(mLock);
if ((hdmiCableInserted() == true) && (mSecHdmi.setHdmiOutputMode(mode)) == false) {
LOGE("%s::mSecHdmi.setHdmiOutputMode() fail", __func__);
ALOGE("%s::mSecHdmi.setHdmiOutputMode() fail", __func__);
return;
}
}
void SecTVOutService::setHdmiResolution(uint32_t resolution)
{
LOGD("%s TV resolution = %d", __func__, resolution);
ALOGD("%s TV resolution = %d", __func__, resolution);
Mutex::Autolock _l(mLock);
if ((hdmiCableInserted() == true) && (mSecHdmi.setHdmiResolution(resolution)) == false) {
LOGE("%s::mSecHdmi.setHdmiResolution() fail", __func__);
ALOGE("%s::mSecHdmi.setHdmiResolution() fail", __func__);
return;
}
}
void SecTVOutService::setHdmiHdcp(uint32_t hdcp_en)
{
LOGD("%s TV HDCP = %d", __func__, hdcp_en);
ALOGD("%s TV HDCP = %d", __func__, hdcp_en);
Mutex::Autolock _l(mLock);
if ((hdmiCableInserted() == true) && (mSecHdmi.setHdcpMode(hdcp_en)) == false) {
LOGE("%s::mSecHdmi.setHdcpMode() fail", __func__);
ALOGE("%s::mSecHdmi.setHdcpMode() fail", __func__);
return;
}
}
void SecTVOutService::setHdmiRotate(uint32_t rotVal, uint32_t hwcLayer)
{
//LOGD("%s TV ROTATE = %d", __func__, rotVal);
//ALOGD("%s TV ROTATE = %d", __func__, rotVal);
Mutex::Autolock _l(mLock);
if ((hdmiCableInserted() == true) && (mSecHdmi.setUIRotation(rotVal, hwcLayer)) == false) {
LOGE("%s::mSecHdmi.setUIRotation() fail", __func__);
ALOGE("%s::mSecHdmi.setUIRotation() fail", __func__);
return;
}
}
void SecTVOutService::setHdmiHwcLayer(uint32_t hwcLayer)
{
//LOGD("%s TV HWCLAYER = %d", __func__, hwcLayer);
//ALOGD("%s TV HWCLAYER = %d", __func__, hwcLayer);
Mutex::Autolock _l(mLock);
mHwcLayer = hwcLayer;
@ -301,14 +301,14 @@ namespace android {
for (int layer = SecHdmi::HDMI_LAYER_BASE + 1; layer < SecHdmi::HDMI_LAYER_MAX; layer++) {
if (layer != mUILayerMode) {
if (mSecHdmi.clear(layer) == false)
LOGE("%s::mSecHdmi.clear(%d) fail", __func__, layer);
ALOGE("%s::mSecHdmi.clear(%d) fail", __func__, layer);
}
}
}
if (mUILayerMode != hdmiLayer) {
if (mSecHdmi.clear(mUILayerMode) == false)
LOGE("%s::mSecHdmi.clear(%d) fail", __func__, mUILayerMode);
ALOGE("%s::mSecHdmi.clear(%d) fail", __func__, mUILayerMode);
}
mUILayerMode = hdmiLayer;
@ -323,10 +323,10 @@ namespace android {
#endif
if (mSecHdmi.flush(w, h, colorFormat, pPhyYAddr, pPhyCbAddr, pPhyCrAddr, dstX, dstY,
mUILayerMode, mHwcLayer) == false)
LOGE("%s::mSecHdmi.flush() on HDMI_MODE_UI fail", __func__);
ALOGE("%s::mSecHdmi.flush() on HDMI_MODE_UI fail", __func__);
#ifdef CHECK_UI_TIME
end = systemTime();
LOGD("[UI] mSecHdmi.flush[end-start] = %ld ms", long(ns2ms(end)) - long(ns2ms(start)));
ALOGD("[UI] mSecHdmi.flush[end-start] = %ld ms", long(ns2ms(end)) - long(ns2ms(start)));
#endif
}
#else
@ -347,10 +347,10 @@ namespace android {
#endif
if (mSecHdmi.flush(w, h, colorFormat, pPhyYAddr, pPhyCbAddr, pPhyCrAddr, dstX, dstY,
SecHdmi::HDMI_LAYER_VIDEO, mHwcLayer) == false)
LOGE("%s::mSecHdmi.flush() on HDMI_MODE_VIDEO fail", __func__);
ALOGE("%s::mSecHdmi.flush() on HDMI_MODE_VIDEO fail", __func__);
#ifdef CHECK_VIDEO_TIME
end = systemTime();
LOGD("[Video] mSecHdmi.flush[end-start] = %ld ms", long(ns2ms(end)) - long(ns2ms(start)));
ALOGD("[Video] mSecHdmi.flush[end-start] = %ld ms", long(ns2ms(end)) - long(ns2ms(start)));
#endif
#else
msg = new SecHdmiEventMsg(&mSecHdmi, w, h, colorFormat, pPhyYAddr, pPhyCbAddr, pPhyCrAddr,
@ -362,7 +362,7 @@ namespace android {
break;
default:
LOGE("unmatched HDMI_MODE : %d", hdmiMode);
ALOGE("unmatched HDMI_MODE : %d", hdmiMode);
break;
}

@ -139,13 +139,13 @@ namespace android {
#endif
if (pSecHdmi->flush(mSrcWidth, mSrcHeight, mSrcColorFormat, mSrcYAddr, mSrcCbAddr, mSrcCrAddr,
mDstX, mDstY, mHdmiLayer, mHwcLayer) == false) {
LOGE("%s::pSecHdmi->flush() fail on HDMI_MODE_UI", __func__);
ALOGE("%s::pSecHdmi->flush() fail on HDMI_MODE_UI", __func__);
ret = false;
}
#ifdef CHECK_UI_TIME
end = systemTime();
LOGD("[UI] pSecHdmi->flush[end-start] = %ld ms", long(ns2ms(end)) - long(ns2ms(start)));
ALOGD("[UI] pSecHdmi->flush[end-start] = %ld ms", long(ns2ms(end)) - long(ns2ms(start)));
#endif
break;
case HDMI_MODE_VIDEO:
@ -154,16 +154,16 @@ namespace android {
#endif
if (pSecHdmi->flush(mSrcWidth, mSrcHeight, mSrcColorFormat, mSrcYAddr, mSrcCbAddr, mSrcCrAddr,
mDstX, mDstY, mHdmiLayer, mHwcLayer) == false) {
LOGE("%s::pSecHdmi->flush() fail on HDMI_MODE_VIDEO", __func__);
ALOGE("%s::pSecHdmi->flush() fail on HDMI_MODE_VIDEO", __func__);
ret = false;
}
#ifdef CHECK_VIDEO_TIME
end = systemTime();
LOGD("[VIDEO] pSecHdmi->flush[end-start] = %ld ms", long(ns2ms(end)) - long(ns2ms(start)));
ALOGD("[VIDEO] pSecHdmi->flush[end-start] = %ld ms", long(ns2ms(end)) - long(ns2ms(start)));
#endif
break;
default:
LOGE("Undefined HDMI_MODE");
ALOGE("Undefined HDMI_MODE");
ret = false;
break;
}

@ -74,7 +74,7 @@ int CECOpen()
CECClose();
if ((fd = open(CEC_DEVICE_NAME, O_RDWR)) < 0) {
LOGE("Can't open %s!\n", CEC_DEVICE_NAME);
ALOGE("Can't open %s!\n", CEC_DEVICE_NAME);
res = 0;
}
@ -92,7 +92,7 @@ int CECClose()
if (fd != -1) {
if (close(fd) != 0) {
LOGE("close() failed!\n");
ALOGE("close() failed!\n");
res = 0;
}
fd = -1;
@ -115,12 +115,12 @@ int CECAllocLogicalAddress(int paddr, enum CECDeviceType devtype)
int i = 0;
if (fd == -1) {
LOGE("open device first!\n");
ALOGE("open device first!\n");
return 0;
}
if (CECSetLogicalAddr(laddr) < 0) {
LOGE("CECSetLogicalAddr() failed!\n");
ALOGE("CECSetLogicalAddr() failed!\n");
return 0;
}
@ -141,12 +141,12 @@ int CECAllocLogicalAddress(int paddr, enum CECDeviceType devtype)
}
if (laddr == CEC_LADDR_UNREGISTERED) {
LOGE("All LA addresses in use!!!\n");
ALOGE("All LA addresses in use!!!\n");
return CEC_LADDR_UNREGISTERED;
}
if (CECSetLogicalAddr(laddr) < 0) {
LOGE("CECSetLogicalAddr() failed!\n");
ALOGE("CECSetLogicalAddr() failed!\n");
return 0;
}
@ -159,7 +159,7 @@ int CECAllocLogicalAddress(int paddr, enum CECDeviceType devtype)
buffer[4] = devtype;
if (CECSendMessage(buffer, 5) != 5) {
LOGE("CECSendMessage() failed!\n");
ALOGE("CECSendMessage() failed!\n");
return 0;
}
@ -177,17 +177,17 @@ int CECAllocLogicalAddress(int paddr, enum CECDeviceType devtype)
int CECSendMessage(unsigned char *buffer, int size)
{
if (fd == -1) {
LOGE("open device first!\n");
ALOGE("open device first!\n");
return 0;
}
if (size > CEC_MAX_FRAME_SIZE) {
LOGE("size should not exceed %d\n", CEC_MAX_FRAME_SIZE);
ALOGE("size should not exceed %d\n", CEC_MAX_FRAME_SIZE);
return 0;
}
#if CEC_DEBUG
LOGI("CECSendMessage() : ");
ALOGI("CECSendMessage() : ");
CECPrintFrame(buffer, size);
#endif
@ -211,7 +211,7 @@ int CECReceiveMessage(unsigned char *buffer, int size, long timeout)
int retval;
if (fd == -1) {
LOGE("open device first!\n");
ALOGE("open device first!\n");
return 0;
}
@ -228,7 +228,7 @@ int CECReceiveMessage(unsigned char *buffer, int size, long timeout)
} else if (retval) {
bytes = read(fd, buffer, size);
#if CEC_DEBUG
LOGI("CECReceiveMessage() : size(%d)", bytes);
ALOGI("CECReceiveMessage() : size(%d)", bytes);
if(bytes > 0)
CECPrintFrame(buffer, bytes);
#endif
@ -245,7 +245,7 @@ int CECReceiveMessage(unsigned char *buffer, int size, long timeout)
int CECSetLogicalAddr(unsigned int laddr)
{
if (ioctl(fd, CEC_IOC_SETLADDR, &laddr)) {
LOGE("ioctl(CEC_IOC_SETLA) failed!\n");
ALOGE("ioctl(CEC_IOC_SETLA) failed!\n");
return 0;
}
@ -260,12 +260,12 @@ void CECPrintFrame(unsigned char *buffer, unsigned int size)
{
if (size > 0) {
int i;
LOGI("fsize: %d ", size);
LOGI("frame: ");
ALOGI("fsize: %d ", size);
ALOGI("frame: ");
for (i = 0; i < size; i++)
LOGI("0x%02x ", buffer[i]);
ALOGI("0x%02x ", buffer[i]);
LOGI("\n");
ALOGI("\n");
}
}
#endif

@ -87,7 +87,7 @@ int DDCOpen()
// open
if ((ddc_fd = open(DEV_NAME,O_RDWR)) < 0) {
LOGE("%s: Cannot open I2C_DDC : %s",__func__, DEV_NAME);
ALOGE("%s: Cannot open I2C_DDC : %s",__func__, DEV_NAME);
ret = 0;
}
@ -106,7 +106,7 @@ int DDCClose()
// check if fd is available
if (ref_cnt == 0) {
#if DDC_DEBUG
LOGE("%s: I2C_DDC is not available!!!!", __func__);
ALOGE("%s: I2C_DDC is not available!!!!", __func__);
#endif
return 1;
}
@ -119,7 +119,7 @@ int DDCClose()
if (close(ddc_fd) < 0) {
#if DDC_DEBUG
LOGE("%s: Cannot close I2C_DDC : %s",__func__,DEV_NAME);
ALOGE("%s: Cannot close I2C_DDC : %s",__func__,DEV_NAME);
#endif
ret = 0;
}
@ -147,7 +147,7 @@ int DDCRead(unsigned char addr, unsigned char offset,
if (!DDCFileAvailable()) {
#if DDC_DEBUG
LOGE("%s: I2C_DDC is not available!!!!", __func__);
ALOGE("%s: I2C_DDC is not available!!!!", __func__);
#endif
return 0;
}
@ -197,7 +197,7 @@ int EDDCRead(unsigned char segpointer, unsigned char segment, unsigned char addr
if (!DDCFileAvailable()) {
#if DDC_DEBUG
LOGE("%s: I2C_DDC is not available!!!!", __func__);
ALOGE("%s: I2C_DDC is not available!!!!", __func__);
#endif
return 0;
}
@ -231,7 +231,7 @@ int EDDCRead(unsigned char segpointer, unsigned char segment, unsigned char addr
// eddc read
if (ioctl(ddc_fd, I2C_RDWR, &msgset) < 0) {
#if DDC_DEBUG
LOGE("%s: ioctl(I2C_RDWR) failed!!!", __func__);
ALOGE("%s: ioctl(I2C_RDWR) failed!!!", __func__);
#endif
ret = 0;
}
@ -255,7 +255,7 @@ int DDCWrite(unsigned char addr, unsigned char offset, unsigned int size, unsign
// allocate temporary buffer
temp = (unsigned char*) malloc((size+1)*sizeof(unsigned char));
if (!temp) {
LOGE("%s: not enough resources at %s", __FUNCTION__);
ALOGE("%s: not enough resources at %s", __FUNCTION__);
goto exit;
}
@ -263,18 +263,18 @@ int DDCWrite(unsigned char addr, unsigned char offset, unsigned int size, unsign
memcpy(temp+1,buffer,size);
if (!DDCFileAvailable()) {
LOGE("%s: I2C_DDC is not available!!!!", __func__);
ALOGE("%s: I2C_DDC is not available!!!!", __func__);
goto exit;
}
if (ioctl(ddc_fd, I2C_SLAVE, addr>>1) < 0) {
LOGE("%s: cannot set slave address 0x%02x", __func__,addr);
ALOGE("%s: cannot set slave address 0x%02x", __func__,addr);
goto exit;
}
// write temp buffer
if ((bytes = write(ddc_fd,temp,size+1)) != (size+1)) {
LOGE("%s: fail to write %d bytes, only write %d bytes",__func__, size, bytes);
ALOGE("%s: fail to write %d bytes, only write %d bytes",__func__, size, bytes);
goto exit;
}

@ -27,7 +27,7 @@
//#define EDID_DEBUG 1
#ifdef EDID_DEBUG
#define DPRINTF(args...) LOGI(args)
#define DPRINTF(args...) ALOGI(args)
#else
#define DPRINTF(args...)
#endif
@ -219,11 +219,11 @@ static int ReadEDIDBlock(const unsigned int blockNum, unsigned char* const outBu
#ifdef EDID_DEBUG
offset = 0;
do {
LOGI("0x%02X", outBuffer[offset++]);
ALOGI("0x%02X", outBuffer[offset++]);
if (offset % 16)
LOGI(" ");
ALOGI(" ");
else
LOGI("\n");
ALOGI("\n");
} while (SIZEOFEDIDBLOCK > offset);
#endif // EDID_DEBUG
return 1;

@ -73,7 +73,7 @@ hwc_module_t HAL_MODULE_INFO_SYM = {
/*****************************************************************************/
static void dump_layer(hwc_layer_t const* l) {
LOGD("\ttype=%d, flags=%08x, handle=%p, tr=%02x, blend=%04x, "
ALOGD("\ttype=%d, flags=%08x, handle=%p, tr=%02x, blend=%04x, "
"{%d,%d,%d,%d}, {%d,%d,%d,%d}",
l->compositionType, l->flags, l->handle, l->transform, l->blending,
l->sourceCrop.left,
@ -243,7 +243,7 @@ static int set_src_dst_img_rect(hwc_layer_t *cur,
}
}
SEC_HWC_Log(HWC_LOG_DEBUG,
SEC_HWC_Log(HWC_ALOG_DEBUG,
"crop information()::"
"sourceCrop left(%d),top(%d),right(%d),bottom(%d),"
"src_rect x(%d),y(%d),w(%d),h(%d),"
@ -271,7 +271,7 @@ static int set_src_dst_img_rect(hwc_layer_t *cur,
dst_rect->h = win->rect_info.h;
/* Summery */
SEC_HWC_Log(HWC_LOG_DEBUG,
SEC_HWC_Log(HWC_ALOG_DEBUG,
"set_src_dst_img_rect()::"
"SRC w(%d),h(%d),f_w(%d),f_h(%d),fmt(0x%x),"
"base(0x%x),offset(%d),paddr(0x%X)=>\r\n"
@ -294,7 +294,7 @@ static int set_src_dst_img_rect(hwc_layer_t *cur,
static int get_hwc_compos_decision(hwc_layer_t* cur, int iter, int win_cnt)
{
if(cur->flags & HWC_SKIP_LAYER || !cur->handle) {
SEC_HWC_Log(HWC_LOG_DEBUG, "%s::is_skip_layer %d cur->handle %x ",
SEC_HWC_Log(HWC_ALOG_DEBUG, "%s::is_skip_layer %d cur->handle %x ",
__func__, cur->flags & HWC_SKIP_LAYER, cur->handle);
return HWC_FRAMEBUFFER;
@ -358,7 +358,7 @@ static int get_hwc_compos_decision(hwc_layer_t* cur, int iter, int win_cnt)
break;
}
SEC_HWC_Log(HWC_LOG_DEBUG, "2nd iter###%s:: compositionType %d bpp %d"
SEC_HWC_Log(HWC_ALOG_DEBUG, "2nd iter###%s:: compositionType %d bpp %d"
" format %x src[%d %d %d %d] dst[%d %d %d %d] srcImg[%d %d]",
__func__, compositionType, prev_handle->bpp,
prev_handle->format,
@ -370,7 +370,7 @@ static int get_hwc_compos_decision(hwc_layer_t* cur, int iter, int win_cnt)
}
#endif
SEC_HWC_Log(HWC_LOG_DEBUG,
SEC_HWC_Log(HWC_ALOG_DEBUG,
"%s::compositionType(%d)=>0:FB,1:OVERLAY \r\n"
" format(0x%x),magic(0x%x),flags(%d),size(%d),offset(%d)"
"b_addr(0x%x),usage(%d),w(%d),h(%d),bpp(%d)",
@ -405,7 +405,7 @@ static int assign_overlay_window(struct hwc_context_t *ctx, hwc_layer_t *cur,
win = &ctx->win[win_idx];
SEC_HWC_Log(HWC_LOG_DEBUG,
SEC_HWC_Log(HWC_ALOG_DEBUG,
"%s:: left(%d),top(%d),right(%d),bottom(%d),transform(%d)"
"lcd_info.xres(%d),lcd_info.yres(%d)",
"++assign_overlay_window()",
@ -423,7 +423,7 @@ static int assign_overlay_window(struct hwc_context_t *ctx, hwc_layer_t *cur,
win->rect_info.h = rect.h;
//turnoff the window and set the window position with new conf...
if (window_set_pos(win) < 0) {
SEC_HWC_Log(HWC_LOG_ERROR, "%s::window_set_pos is failed : %s",
SEC_HWC_Log(HWC_ALOG_ERROR, "%s::window_set_pos is failed : %s",
__func__, strerror(errno));
ret = -1;
}
@ -433,7 +433,7 @@ static int assign_overlay_window(struct hwc_context_t *ctx, hwc_layer_t *cur,
win->layer_index = layer_idx;
win->status = HWC_WIN_RESERVED;
SEC_HWC_Log(HWC_LOG_DEBUG,
SEC_HWC_Log(HWC_ALOG_DEBUG,
"%s:: win_x %d win_y %d win_w %d win_h %d lay_idx %d win_idx %d\n",
"--assign_overlay_window()",
win->rect_info.x, win->rect_info.y, win->rect_info.w,
@ -475,7 +475,7 @@ static int hwc_prepare(hwc_composer_device_t *dev, hwc_layer_list_t* list)
} else {
ret = assign_overlay_window(ctx, cur, overlay_win_cnt, i);
if (ret != 0) {
LOGE("assign_overlay_window fail, change to frambuffer");
ALOGE("assign_overlay_window fail, change to frambuffer");
cur->compositionType = HWC_FRAMEBUFFER;
ctx->num_of_fb_layer++;
continue;
@ -519,7 +519,7 @@ static int hwc_prepare(hwc_composer_device_t *dev, hwc_layer_list_t* list)
#endif
if (list->numHwLayers != (ctx->num_of_fb_layer + ctx->num_of_hwc_layer))
SEC_HWC_Log(HWC_LOG_DEBUG,
SEC_HWC_Log(HWC_ALOG_DEBUG,
"%s:: numHwLayers %d num_of_fb_layer %d num_of_hwc_layer %d ",
__func__, list->numHwLayers, ctx->num_of_fb_layer,
ctx->num_of_hwc_layer);
@ -580,7 +580,7 @@ static int hwc_set(hwc_composer_device_t *dev,
* double buffered (2 or more) this buffer is already rendered.
* It is the redundant src buffer for FIMC rendering.
*/
LOGD("SKIP FIMC rendering for Layer%d", win->layer_index);
ALOGD("SKIP FIMC rendering for Layer%d", win->layer_index);
#if defined(BOARD_USES_HDMI)
skip_hdmi_rendering = 1;
#endif
@ -597,7 +597,7 @@ static int hwc_set(hwc_composer_device_t *dev,
cur->transform);
if (ret < 0) {
SEC_HWC_Log(HWC_LOG_ERROR, "%s::runFimc fail : ret=%d\n",
SEC_HWC_Log(HWC_ALOG_ERROR, "%s::runFimc fail : ret=%d\n",
__func__, ret);
skipped_window_mask |= (1 << i);
continue;
@ -609,14 +609,14 @@ static int hwc_set(hwc_composer_device_t *dev,
if (win->power_state == 0)
window_show(win);
} else {
SEC_HWC_Log(HWC_LOG_ERROR,
SEC_HWC_Log(HWC_ALOG_ERROR,
"%s:: error : layer %d compositionType should have been"
" HWC_OVERLAY ", __func__, win->layer_index);
skipped_window_mask |= (1 << i);
continue;
}
} else {
SEC_HWC_Log(HWC_LOG_ERROR, "%s:: error : window status should have "
SEC_HWC_Log(HWC_ALOG_ERROR, "%s:: error : window status should have "
"been HWC_WIN_RESERVED by now... ", __func__);
skipped_window_mask |= (1 << i);
continue;
@ -634,7 +634,7 @@ static int hwc_set(hwc_composer_device_t *dev,
ret = runG2d(ctx, &srcRect, &dstRect,
cur->transform);
if (ret < 0) {
SEC_HWC_Log(HWC_LOG_ERROR, "%s::runG2d fail : ret=%d\n",
SEC_HWC_Log(HWC_ALOG_ERROR, "%s::runG2d fail : ret=%d\n",
__func__, ret);
skipped_window_mask |= (1 << (ctx->num_of_hwc_layer - 1));
goto g2d_error;
@ -738,7 +738,7 @@ g2d_error:
android::SecHdmiClient::HDMI_MODE_VIDEO,
ctx->num_of_hwc_layer);
} else {
LOGE("%s: Unsupported format = %d", __func__, src_img.format);
ALOGE("%s: Unsupported format = %d", __func__, src_img.format);
}
}
#endif
@ -752,18 +752,18 @@ static int hwc_device_close(struct hw_device_t *dev)
int i;
if (ctx) {
if (destroyVideoDev(&ctx->fimc) < 0) {
SEC_HWC_Log(HWC_LOG_ERROR, "%s::destroyVideoDev fail", __func__);
SEC_HWC_Log(HWC_ALOG_ERROR, "%s::destroyVideoDev fail", __func__);
ret = -1;
}
#ifdef SUB_TITLES_HWC
if (destroyG2d(&ctx->g2d) < 0) {
SEC_HWC_Log(HWC_LOG_ERROR, "%s::destroyG2d() fail", __func__);
SEC_HWC_Log(HWC_ALOG_ERROR, "%s::destroyG2d() fail", __func__);
ret = -1;
}
#endif
for (i = 0; i < NUM_OF_WIN; i++) {
if (window_close(&ctx->win[i]) < 0)
SEC_HWC_Log(HWC_LOG_DEBUG, "%s::window_close() fail", __func__);
SEC_HWC_Log(HWC_ALOG_DEBUG, "%s::window_close() fail", __func__);
}
free(ctx);
@ -806,7 +806,7 @@ static int hwc_device_open(const struct hw_module_t* module, const char* name,
/* open WIN0 & WIN1 here */
for (int i = 0; i < NUM_OF_WIN; i++) {
if (window_open(&(dev->win[i]), i) < 0) {
SEC_HWC_Log(HWC_LOG_ERROR,
SEC_HWC_Log(HWC_ALOG_ERROR,
"%s:: Failed to open window %d device ", __func__, i);
status = -EINVAL;
goto err;
@ -814,7 +814,7 @@ static int hwc_device_open(const struct hw_module_t* module, const char* name,
}
if (window_get_global_lcd_info(dev->win[0].fd, &dev->lcd_info) < 0) {
SEC_HWC_Log(HWC_LOG_ERROR,
SEC_HWC_Log(HWC_ALOG_ERROR,
"%s::window_get_global_lcd_info is failed : %s",
__func__, strerror(errno));
status = -EINVAL;
@ -838,14 +838,14 @@ static int hwc_device_open(const struct hw_module_t* module, const char* name,
win->rect_info.h = win->var_info.yres;
if (window_set_pos(win) < 0) {
SEC_HWC_Log(HWC_LOG_ERROR, "%s::window_set_pos is failed : %s",
SEC_HWC_Log(HWC_ALOG_ERROR, "%s::window_set_pos is failed : %s",
__func__, strerror(errno));
status = -EINVAL;
goto err;
}
if (window_get_info(win, i) < 0) {
SEC_HWC_Log(HWC_LOG_ERROR, "%s::window_get_info is failed : %s",
SEC_HWC_Log(HWC_ALOG_ERROR, "%s::window_get_info is failed : %s",
__func__, strerror(errno));
status = -EINVAL;
goto err;
@ -855,46 +855,46 @@ static int hwc_device_open(const struct hw_module_t* module, const char* name,
#ifdef USE_HW_PMEM
if (createPmem(&dev->sec_pmem, PMEM_SIZE) < 0) {
SEC_HWC_Log(HWC_LOG_ERROR, "%s::initPmem(%d) fail", __func__, PMEM_SIZE);
SEC_HWC_Log(HWC_ALOG_ERROR, "%s::initPmem(%d) fail", __func__, PMEM_SIZE);
}
#endif
//create PP
if (createVideoDev(&dev->fimc) < 0) {
SEC_HWC_Log(HWC_LOG_ERROR, "%s::creatFimc() fail", __func__);
SEC_HWC_Log(HWC_ALOG_ERROR, "%s::creatFimc() fail", __func__);
status = -EINVAL;
goto err;
}
#ifdef SUB_TITLES_HWC
if (createG2d(&dev->g2d) < 0) {
SEC_HWC_Log(HWC_LOG_ERROR, "%s::createG2d() fail", __func__);
SEC_HWC_Log(HWC_ALOG_ERROR, "%s::createG2d() fail", __func__);
status = -EINVAL;
goto err;
}
#endif
SEC_HWC_Log(HWC_LOG_DEBUG, "%s:: hwc_device_open: SUCCESS", __func__);
SEC_HWC_Log(HWC_ALOG_DEBUG, "%s:: hwc_device_open: SUCCESS", __func__);
return 0;
err:
if (destroyVideoDev(&dev->fimc) < 0)
SEC_HWC_Log(HWC_LOG_ERROR, "%s::destroyVideoDev() fail", __func__);
SEC_HWC_Log(HWC_ALOG_ERROR, "%s::destroyVideoDev() fail", __func__);
#ifdef SUB_TITLES_HWC
if (destroyG2d(&dev->g2d) < 0)
SEC_HWC_Log(HWC_LOG_ERROR, "%s::destroyG2d() fail", __func__);
SEC_HWC_Log(HWC_ALOG_ERROR, "%s::destroyG2d() fail", __func__);
#endif
if (destroyMem(&dev->s3c_mem) < 0)
SEC_HWC_Log(HWC_LOG_ERROR, "%s::destroyMem() fail", __func__);
SEC_HWC_Log(HWC_ALOG_ERROR, "%s::destroyMem() fail", __func__);
#ifdef USE_HW_PMEM
if (destroyPmem(&dev->sec_pmem) < 0)
SEC_HWC_Log(HWC_LOG_ERROR, "%s::destroyPmem() fail", __func__);
SEC_HWC_Log(HWC_ALOG_ERROR, "%s::destroyPmem() fail", __func__);
#endif
for (int i = 0; i < NUM_OF_WIN; i++) {
if (window_close(&dev->win[i]) < 0)
SEC_HWC_Log(HWC_LOG_DEBUG, "%s::window_close() fail", __func__);
SEC_HWC_Log(HWC_ALOG_DEBUG, "%s::window_close() fail", __func__);
}
return status;

@ -52,7 +52,7 @@ void check_fps()
memcpy(&tick_old, &tick, sizeof(timeval));
if (cnt == (10 + CHK_FRAME_CNT)) {
FPS = 1000*CHK_FRAME_CNT/total;
LOGE("[FPS]:%d\n", FPS);
ALOGE("[FPS]:%d\n", FPS);
total = 0;
cnt = 10;
}

@ -36,7 +36,7 @@
#include "SecJpegCodecHal.h"
#define JPEG_ERROR_LOG(fmt,...)
#define JPEG_ERROR_ALOG(fmt,...)
#define NUM_PLANES (1)
#define NUM_BUFFERS (1)
@ -66,19 +66,19 @@ int SecJpegDecoderHal::create(void)
if (t_iJpegFd < 0) {
t_iJpegFd = -1;
JPEG_ERROR_LOG("[%s]: JPEG_DEC_NODE open failed", __func__);
JPEG_ERROR_ALOG("[%s]: JPEG_DEC_NODE open failed", __func__);
return ERROR_CANNOT_OPEN_JPEG_DEVICE;
}
if (t_iJpegFd <= 0) {
t_iJpegFd = -1;
JPEG_ERROR_LOG("ERR(%s):JPEG device was closed\n", __func__);
JPEG_ERROR_ALOG("ERR(%s):JPEG device was closed\n", __func__);
return ERROR_JPEG_DEVICE_ALREADY_CLOSED;
}
iRet = t_v4l2Querycap(t_iJpegFd);
if (iRet < 0) {
JPEG_ERROR_LOG("[%s]: QUERYCAP failed", __func__);
JPEG_ERROR_ALOG("[%s]: QUERYCAP failed", __func__);
close(t_iJpegFd);
return ERROR_CANNOT_OPEN_JPEG_DEVICE;
}
@ -127,7 +127,7 @@ int SecJpegDecoderHal::destroy(void)
iRet = close(t_iJpegFd);
if (iRet < 0) {
JPEG_ERROR_LOG("[%s:%d]: JPEG_DEC_NODE close failed", __func__, iRet);
JPEG_ERROR_ALOG("[%s:%d]: JPEG_DEC_NODE close failed", __func__, iRet);
}
}
@ -278,7 +278,7 @@ int SecJpegDecoderHal::setCache(int iValue)
}
if (t_v4l2SetCtrl(t_iJpegFd, V4L2_CID_CACHEABLE, iValue)<0) {
JPEG_ERROR_LOG("%s::cache setting failed\n", __func__);
JPEG_ERROR_ALOG("%s::cache setting failed\n", __func__);
return ERROR_CANNOT_CHANGE_CACHE_SETTING;
}
@ -293,7 +293,7 @@ int SecJpegDecoderHal::getSize(int *piW, int *piH)
int iRet = t_v4l2GetFmt(t_iJpegFd, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, &t_stJpegConfig);
if (iRet < 0) {
JPEG_ERROR_LOG("[%s,%d]: get image size failed", __func__,iRet);
JPEG_ERROR_ALOG("[%s,%d]: get image size failed", __func__,iRet);
return ERROR_GET_SIZE_FAIL;
}
@ -366,7 +366,7 @@ int SecJpegDecoderHal::updateConfig(void)
iRet = t_v4l2SetFmt(t_iJpegFd, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, &t_stJpegConfig);
if (iRet < 0) {
JPEG_ERROR_LOG("[%s,%d]: jpeg input S_FMT failed", __func__,iRet);
JPEG_ERROR_ALOG("[%s,%d]: jpeg input S_FMT failed", __func__,iRet);
return ERROR_INVALID_JPEG_CONFIG;
}
@ -378,14 +378,14 @@ int SecJpegDecoderHal::updateConfig(void)
iRet = t_v4l2Reqbufs(t_iJpegFd, NUM_BUFFERS, &stBufInfo);
if (iRet < 0) {
JPEG_ERROR_LOG("[%s:%d]: Input REQBUFS failed", __func__, iRet);
JPEG_ERROR_ALOG("[%s:%d]: Input REQBUFS failed", __func__, iRet);
return ERROR_EXCUTE_FAIL;
}
t_stJpegConfig.numOfPlanes = t_iPlaneNum;
iRet = t_v4l2SetFmt(t_iJpegFd, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, &t_stJpegConfig);
if (iRet < 0) {
JPEG_ERROR_LOG("[%s,%d]: jpeg output S_FMT failed", __func__,iRet);
JPEG_ERROR_ALOG("[%s,%d]: jpeg output S_FMT failed", __func__,iRet);
return ERROR_INVALID_JPEG_CONFIG;
}
@ -394,7 +394,7 @@ int SecJpegDecoderHal::updateConfig(void)
iRet = t_v4l2Reqbufs(t_iJpegFd, NUM_BUFFERS, &stBufInfo);
if (iRet < 0) {
JPEG_ERROR_LOG("[%s:%d]: Output REQBUFS failed", __func__, iRet);
JPEG_ERROR_ALOG("[%s:%d]: Output REQBUFS failed", __func__, iRet);
return ERROR_REQBUF_FAIL;
}
@ -454,7 +454,7 @@ int SecJpegDecoderHal::decode(void)
iRet = t_v4l2Qbuf(t_iJpegFd, &stBufInfo, &t_stJpegInbuf);
if (iRet < 0) {
JPEG_ERROR_LOG("[%s:%d]: Input QBUF failed", __func__, iRet);
JPEG_ERROR_ALOG("[%s:%d]: Input QBUF failed", __func__, iRet);
return ERROR_EXCUTE_FAIL;
}
@ -463,33 +463,33 @@ int SecJpegDecoderHal::decode(void)
iRet = t_v4l2Qbuf(t_iJpegFd, &stBufInfo, &t_stJpegOutbuf);
if (iRet < 0) {
JPEG_ERROR_LOG("[%s:%d]: Output QBUF failed", __func__, iRet);
JPEG_ERROR_ALOG("[%s:%d]: Output QBUF failed", __func__, iRet);
return ERROR_EXCUTE_FAIL;
}
stBufInfo.numOfPlanes = NUM_PLANES;
iRet = t_v4l2StreamOn(t_iJpegFd, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE);
if (iRet < 0) {
JPEG_ERROR_LOG("[%s:%d]: input stream on failed", __func__, iRet);
JPEG_ERROR_ALOG("[%s:%d]: input stream on failed", __func__, iRet);
return ERROR_EXCUTE_FAIL;
}
stBufInfo.numOfPlanes = t_iPlaneNum;
iRet = t_v4l2StreamOn(t_iJpegFd, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE);
if (iRet < 0) {
JPEG_ERROR_LOG("[%s:%d]: output stream on failed", __func__, iRet);
JPEG_ERROR_ALOG("[%s:%d]: output stream on failed", __func__, iRet);
return ERROR_EXCUTE_FAIL;
}
stBufInfo.numOfPlanes = NUM_PLANES;
iRet = t_v4l2Dqbuf(t_iJpegFd, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, V4L2_MEMORY_MMAP);
if (iRet < 0) {
JPEG_ERROR_LOG("[%s:%d]: Intput DQBUF failed", __func__, iRet);
JPEG_ERROR_ALOG("[%s:%d]: Intput DQBUF failed", __func__, iRet);
return ERROR_EXCUTE_FAIL;
}
stBufInfo.numOfPlanes = t_iPlaneNum;
iRet = t_v4l2Dqbuf(t_iJpegFd, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, V4L2_MEMORY_MMAP);
if (iRet < 0) {
JPEG_ERROR_LOG("[%s:%d]: Output DQBUF failed", __func__, iRet);
JPEG_ERROR_ALOG("[%s:%d]: Output DQBUF failed", __func__, iRet);
return ERROR_EXCUTE_FAIL;
}

@ -21,7 +21,7 @@
static const char ExifAsciiPrefix[] = { 0x41, 0x53, 0x43, 0x49, 0x49, 0x0, 0x0, 0x0 };
#define JPEG_ERROR_LOG(fmt,...)
#define JPEG_ERROR_ALOG(fmt,...)
#define JPEG_MAIN_DUMP (0)
#define JPEG_THUMB_DUMP (0)
@ -71,7 +71,7 @@ int SecJpegEncoder::create(void)
m_jpegMain = new SecJpegEncoderHal;
if (m_jpegMain == NULL) {
JPEG_ERROR_LOG("ERR(%s):Cannot create SecJpegEncoderHal class\n", __func__);
JPEG_ERROR_ALOG("ERR(%s):Cannot create SecJpegEncoderHal class\n", __func__);
return ERROR_CANNOT_CREATE_SEC_JPEG_ENC_HAL;
}
@ -189,7 +189,7 @@ char *SecJpegEncoder::getInBuf(int *input_size)
char *inBuf = *(m_jpegMain->getInBuf(&inSize));
if (inBuf == NULL) {
JPEG_ERROR_LOG("%s::Fail to JPEG input buffer!!\n", __func__);
JPEG_ERROR_ALOG("%s::Fail to JPEG input buffer!!\n", __func__);
return NULL;
}
@ -208,7 +208,7 @@ char *SecJpegEncoder::getOutBuf(int *output_size)
char *outBuf = m_jpegMain->getOutBuf(&outSize);
if (outBuf == NULL) {
JPEG_ERROR_LOG("%s::Fail to JPEG input buffer!!\n", __func__);
JPEG_ERROR_ALOG("%s::Fail to JPEG input buffer!!\n", __func__);
return NULL;
}
@ -241,7 +241,7 @@ int SecJpegEncoder::setInBuf(char *buf, int size)
if (m_ionJpegClient == 0) {
m_ionJpegClient = ion_client_create();
if (m_ionJpegClient < 0) {
JPEG_ERROR_LOG("[%s]src ion client create failed, value = %d\n", __func__, size);
JPEG_ERROR_ALOG("[%s]src ion client create failed, value = %d\n", __func__, size);
m_ionJpegClient = 0;
return ret;
}
@ -254,7 +254,7 @@ int SecJpegEncoder::setInBuf(char *buf, int size)
ret = m_jpegMain->setInBuf(&m_pJpegInputBuffer, &size);
if (ret) {
JPEG_ERROR_LOG("%s::Fail to JPEG input buffer!!\n", __func__);
JPEG_ERROR_ALOG("%s::Fail to JPEG input buffer!!\n", __func__);
return ret;
}
m_iInBufSize = size;
@ -264,7 +264,7 @@ int SecJpegEncoder::setInBuf(char *buf, int size)
#else // NO JPEG_WA_FOR_PAGEFAULT
ret = m_jpegMain->setInBuf(&buf, &size);
if (ret) {
JPEG_ERROR_LOG("%s::Fail to JPEG input buffer!!\n", __func__);
JPEG_ERROR_ALOG("%s::Fail to JPEG input buffer!!\n", __func__);
return ret;
}
#endif // JPEG_WA_FOR_PAGEFAULT
@ -289,7 +289,7 @@ int SecJpegEncoder::setOutBuf(char *buf, int size)
int ret = ERROR_NONE;
ret = m_jpegMain->setOutBuf(buf, size);
if (ret) {
JPEG_ERROR_LOG("%s::Fail to JPEG output buffer!!\n", __func__);
JPEG_ERROR_ALOG("%s::Fail to JPEG output buffer!!\n", __func__);
return ret;
}
@ -311,14 +311,14 @@ int SecJpegEncoder::encode(int *size, exif_attribute_t *exifInfo)
ret = m_jpegMain->encode();
if (ret) {
JPEG_ERROR_LOG("encode failed\n");
JPEG_ERROR_ALOG("encode failed\n");
return ret;
}
int iJpegSize = m_jpegMain->getJpegSize();
if (iJpegSize<=0) {
JPEG_ERROR_LOG("%s:: output_size is too small(%d)!!\n", __func__, iJpegSize);
JPEG_ERROR_ALOG("%s:: output_size is too small(%d)!!\n", __func__, iJpegSize);
return ERROR_OUT_BUFFER_SIZE_TOO_SMALL;
}
@ -326,7 +326,7 @@ int SecJpegEncoder::encode(int *size, exif_attribute_t *exifInfo)
char *pcJpegBuffer = m_jpegMain->getOutBuf(&iOutputSize);
if (pcJpegBuffer == NULL) {
JPEG_ERROR_LOG("%s::buffer is null!!\n", __func__);
JPEG_ERROR_ALOG("%s::buffer is null!!\n", __func__);
return ERROR_OUT_BUFFER_CREATE_FAIL;
}
@ -354,14 +354,14 @@ int SecJpegEncoder::encode(int *size, exif_attribute_t *exifInfo)
exifOut = new unsigned char[bufSize];
if (exifOut == NULL) {
JPEG_ERROR_LOG("%s::Failed to allocate for exifOut", __func__);
JPEG_ERROR_ALOG("%s::Failed to allocate for exifOut", __func__);
delete[] exifOut;
return ERROR_EXIFOUT_ALLOC_FAIL;
}
memset(exifOut, 0, bufSize);
if (makeExif (exifOut, exifInfo, &exifLen)) {
JPEG_ERROR_LOG("%s::Failed to make EXIF", __func__);
JPEG_ERROR_ALOG("%s::Failed to make EXIF", __func__);
delete[] exifOut;
return ERROR_MAKE_EXIF_FAIL;
}
@ -773,44 +773,44 @@ int SecJpegEncoder::encodeThumbnail(unsigned int *size, bool useMain)
m_jpegThumb = new SecJpegEncoderHal;
if (m_jpegThumb == NULL) {
JPEG_ERROR_LOG("ERR(%s):Cannot open a jpeg device file\n", __func__);
JPEG_ERROR_ALOG("ERR(%s):Cannot open a jpeg device file\n", __func__);
return ERROR_CANNOT_CREATE_SEC_THUMB;
}
}
ret = m_jpegThumb->create();
if (ret) {
JPEG_ERROR_LOG("ERR(%s):Fail create\n", __func__);
JPEG_ERROR_ALOG("ERR(%s):Fail create\n", __func__);
return ret;
}
ret = m_jpegThumb->setCache(JPEG_CACHE_ON);
if (ret) {
JPEG_ERROR_LOG("ERR(%s):Fail cache set\n", __func__);
JPEG_ERROR_ALOG("ERR(%s):Fail cache set\n", __func__);
return ret;
}
void *pConfig = m_jpegMain->getJpegConfig();
if (pConfig == NULL) {
JPEG_ERROR_LOG("ERR(%s):Fail getJpegConfig\n", __func__);
JPEG_ERROR_ALOG("ERR(%s):Fail getJpegConfig\n", __func__);
return ERROR_BUFFR_IS_NULL;
}
ret = m_jpegThumb->setJpegConfig(pConfig);
if (ret) {
JPEG_ERROR_LOG("ERR(%s):Fail setJpegConfig\n", __func__);
JPEG_ERROR_ALOG("ERR(%s):Fail setJpegConfig\n", __func__);
return ret;
}
ret = m_jpegThumb->setQuality(JPEG_THUMBNAIL_QUALITY);
if (ret) {
JPEG_ERROR_LOG("ERR(%s):Fail setQuality\n", __func__);
JPEG_ERROR_ALOG("ERR(%s):Fail setQuality\n", __func__);
return ret;
}
ret = m_jpegThumb->setSize(m_thumbnailW, m_thumbnailH);
if (ret) {
JPEG_ERROR_LOG("ERR(%s):Fail setSize\n", __func__);
JPEG_ERROR_ALOG("ERR(%s):Fail setSize\n", __func__);
return ret;
}
@ -825,7 +825,7 @@ int SecJpegEncoder::encodeThumbnail(unsigned int *size, bool useMain)
if (m_ionJpegClient == 0) {
m_ionJpegClient = ion_client_create();
if (m_ionJpegClient < 0) {
JPEG_ERROR_LOG("[%s]src ion client create failed, value = %d\n", __func__, m_ionJpegClient);
JPEG_ERROR_ALOG("[%s]src ion client create failed, value = %d\n", __func__, m_ionJpegClient);
m_ionJpegClient = 0;
return ret;
}
@ -838,7 +838,7 @@ int SecJpegEncoder::encodeThumbnail(unsigned int *size, bool useMain)
ret = m_jpegThumb->setInBuf(&m_pThumbInputBuffer, &iThumbSize);
if (ret) {
JPEG_ERROR_LOG("ERR(%s):Fail setInBuf\n", __func__);
JPEG_ERROR_ALOG("ERR(%s):Fail setInBuf\n", __func__);
return ret;
}
@ -849,13 +849,13 @@ int SecJpegEncoder::encodeThumbnail(unsigned int *size, bool useMain)
ret = m_jpegThumb->setOutBuf((char *)m_pThumbOutputBuffer, iThumbSize);
if (ret) {
JPEG_ERROR_LOG("ERR(%s):Fail setOutBuf\n", __func__);
JPEG_ERROR_ALOG("ERR(%s):Fail setOutBuf\n", __func__);
return ret;
}
ret = m_jpegThumb->updateConfig();
if (ret) {
JPEG_ERROR_LOG("update config failed\n");
JPEG_ERROR_ALOG("update config failed\n");
return ret;
}
@ -866,7 +866,7 @@ int SecJpegEncoder::encodeThumbnail(unsigned int *size, bool useMain)
ret = m_jpegMain->getSize(&iW, &iH);
if (ret) {
JPEG_ERROR_LOG("ERR(%s):Fail setJpegConfig\n", __func__);
JPEG_ERROR_ALOG("ERR(%s):Fail setJpegConfig\n", __func__);
return ret;
}
@ -877,7 +877,7 @@ int SecJpegEncoder::encodeThumbnail(unsigned int *size, bool useMain)
m_thumbnailW,
m_thumbnailH);
if (ret) {
JPEG_ERROR_LOG("%s::m_scaleDownYuv422(%d, %d, %d, %d) fail", __func__, iW, iH, m_thumbnailW, m_thumbnailH);
JPEG_ERROR_ALOG("%s::m_scaleDownYuv422(%d, %d, %d, %d) fail", __func__, iW, iH, m_thumbnailW, m_thumbnailH);
return ret;
}
}
@ -889,13 +889,13 @@ int SecJpegEncoder::encodeThumbnail(unsigned int *size, bool useMain)
ret = m_jpegThumb->encode();
if (ret) {
JPEG_ERROR_LOG("encode failed\n");
JPEG_ERROR_ALOG("encode failed\n");
return ret;
}
outSizeThumb = m_jpegThumb->getJpegSize();
if (outSizeThumb<=0) {
JPEG_ERROR_LOG("jpeg size is too small\n");
JPEG_ERROR_ALOG("jpeg size is too small\n");
return ERROR_THUMB_JPEG_SIZE_TOO_SMALL;
}
@ -910,20 +910,20 @@ int SecJpegEncoder::allocJpegIonMemory(ion_client ionClient, ion_buffer *ionBuff
int ret = ERROR_NONE;
if (ionClient == 0) {
JPEG_ERROR_LOG("[%s]ionClient is zero (%d)\n", __func__, ionClient);
JPEG_ERROR_ALOG("[%s]ionClient is zero (%d)\n", __func__, ionClient);
return ERROR_BUFFR_IS_NULL;
}
*ionBuffer = ion_alloc(ionClient, size, 0, ION_HEAP_SYSTEM_MASK);
if (*ionBuffer == -1) {
JPEG_ERROR_LOG("[%s]ion_alloc(%d) failed\n", __func__, size);
JPEG_ERROR_ALOG("[%s]ion_alloc(%d) failed\n", __func__, size);
*ionBuffer = 0;
return ret;
}
*buffer = (char *)ion_map(*ionBuffer, size, 0);
if (*buffer == MAP_FAILED) {
JPEG_ERROR_LOG("[%s]src ion map failed(%d)\n", __func__, size);
JPEG_ERROR_ALOG("[%s]src ion map failed(%d)\n", __func__, size);
ion_free(*ionBuffer);
*ionBuffer = 0;
*buffer = NULL;

Loading…
Cancel
Save