static CSC_ERRORCODE csc_init_hw( void *handle) { CSC_HANDLE *csc_handle; CSC_ERRORCODE ret = CSC_ErrorNone; csc_handle = (CSC_HANDLE *)handle; if (csc_handle->csc_method == CSC_METHOD_HW) { switch (csc_handle->csc_hw_type) { #ifdef ENABLE_FIMC case CSC_HW_TYPE_FIMC: csc_handle->csc_hw_handle = csc_hwconverter_open(); ALOGV("%s:: CSC_HW_TYPE_FIMC", __func__); break; #endif #ifdef ENABLE_GSCALER case CSC_HW_TYPE_GSCALER: if (csc_handle->hw_property.fixed_node >= 0) csc_handle->csc_hw_handle = exynos_gsc_create_exclusive(csc_handle->hw_property.fixed_node, GSC_M2M_MODE, 0, 0); else csc_handle->csc_hw_handle = exynos_gsc_create(); ALOGV("%s:: CSC_HW_TYPE_GSCALER", __func__); break; #endif #ifdef ENABLE_G2D case CSC_HW_TYPE_G2D: { g2d_data *g2d = calloc(1, sizeof(g2d_data)); if (!g2d) { ALOGE("failed to allocate G2D data"); break; } g2d->fd = open("/dev/fimg2d", O_RDWR); if (g2d->fd < 0) { ALOGE("failed to open G2D: %s", strerror(errno)); free(g2d); } else { csc_handle->csc_hw_handle = g2d; } break; } #endif default: ALOGE("%s:: unsupported csc_hw_type, csc use sw", __func__); csc_handle->csc_hw_handle = NULL; break; } } if (csc_handle->csc_method == CSC_METHOD_HW) { if (csc_handle->csc_hw_handle == NULL) { ALOGE("%s:: CSC_METHOD_HW can't open HW", __func__); ret = CSC_Error; } } ALOGV("%s:: CSC_METHOD=%d", __func__, csc_handle->csc_method); return ret; }
static CSC_ERRORCODE csc_init_hw( void *handle) { CSC_HANDLE *csc_handle; CSC_ERRORCODE ret = CSC_ErrorNone; csc_handle = (CSC_HANDLE *)handle; if (csc_handle->csc_method == CSC_METHOD_HW) { #ifdef ENABLE_FIMC csc_handle->csc_hw_type = CSC_HW_TYPE_FIMC; #endif #ifdef ENABLE_GSCALER csc_handle->csc_hw_type = CSC_HW_TYPE_GSCALER; #endif switch (csc_handle->csc_hw_type) { #ifdef ENABLE_FIMC case CSC_HW_TYPE_FIMC: csc_handle->csc_hw_handle = csc_hwconverter_open(); ALOGV("%s:: CSC_HW_TYPE_FIMC", __func__); break; #endif #ifdef ENABLE_GSCALER case CSC_HW_TYPE_GSCALER: if (csc_handle->hw_property.fixed_node >= 0) csc_handle->csc_hw_handle = exynos_gsc_create_exclusive(csc_handle->hw_property.fixed_node, GSC_M2M_MODE, 0, 0); else csc_handle->csc_hw_handle = exynos_gsc_create(); ALOGV("%s:: CSC_HW_TYPE_GSCALER", __func__); break; #endif default: ALOGE("%s:: unsupported csc_hw_type, csc use sw", __func__); csc_handle->csc_hw_handle == NULL; break; } } if (csc_handle->csc_method == CSC_METHOD_HW) { if (csc_handle->csc_hw_handle == NULL) { ALOGE("%s:: CSC_METHOD_HW can't open HW", __func__); free(csc_handle); csc_handle = NULL; } } ALOGV("%s:: CSC_METHOD=%d", __func__, csc_handle->csc_method); return ret; }