Lines Matching refs:gsc_handle
304 struct GSC_HANDLE *gsc_handle, in m_exynos_gsc_output_create() argument
325 gsc_handle->out_mode = out_mode; in m_exynos_gsc_output_create()
402 gsc_handle->gsc_sd_entity = gsc_sd_entity; in m_exynos_gsc_output_create()
403 gsc_handle->gsc_vd_entity = gsc_vd_entity; in m_exynos_gsc_output_create()
404 gsc_handle->sink_sd_entity = sink_sd_entity; in m_exynos_gsc_output_create()
405 gsc_handle->media0 = media0; in m_exynos_gsc_output_create()
471 static bool m_exynos_gsc_out_destroy(struct GSC_HANDLE *gsc_handle) in m_exynos_gsc_out_destroy() argument
478 if (gsc_handle == NULL) { in m_exynos_gsc_out_destroy()
483 if (gsc_handle->src.stream_on == true) { in m_exynos_gsc_out_destroy()
484 if (exynos_gsc_out_stop((void *)gsc_handle) < 0) in m_exynos_gsc_out_destroy()
487 gsc_handle->src.stream_on = false; in m_exynos_gsc_out_destroy()
491 for (i = 0; i < (int) gsc_handle->gsc_sd_entity->num_links; i++) { in m_exynos_gsc_out_destroy()
492 links = &gsc_handle->gsc_sd_entity->links[i]; in m_exynos_gsc_out_destroy()
494 if (links == NULL || links->source->entity != gsc_handle->gsc_sd_entity || in m_exynos_gsc_out_destroy()
495 links->sink->entity != gsc_handle->sink_sd_entity) { in m_exynos_gsc_out_destroy()
497 } else if (exynos_media_setup_link(gsc_handle->media0, links->source, in m_exynos_gsc_out_destroy()
504 close(gsc_handle->gsc_vd_entity->fd); in m_exynos_gsc_out_destroy()
505 close(gsc_handle->gsc_sd_entity->fd); in m_exynos_gsc_out_destroy()
506 gsc_handle->gsc_vd_entity->fd = -1; in m_exynos_gsc_out_destroy()
507 gsc_handle->gsc_vd_entity->fd = -1; in m_exynos_gsc_out_destroy()
516 struct GSC_HANDLE *gsc_handle) in m_exynos_gsc_destroy() argument
523 exynos_gsc_m2m_stop(gsc_handle); in m_exynos_gsc_destroy()
525 if (0 < gsc_handle->gsc_fd) in m_exynos_gsc_destroy()
526 close(gsc_handle->gsc_fd); in m_exynos_gsc_destroy()
527 gsc_handle->gsc_fd = 0; in m_exynos_gsc_destroy()
535 struct GSC_HANDLE *gsc_handle) in m_exynos_gsc_find_and_trylock_and_create() argument
550 if (exynos_mutex_trylock(gsc_handle->obj_mutex[i]) == true) { in m_exynos_gsc_find_and_trylock_and_create()
553 m_exynos_gsc_destroy(gsc_handle); in m_exynos_gsc_find_and_trylock_and_create()
556 gsc_handle->gsc_id = i; in m_exynos_gsc_find_and_trylock_and_create()
557 gsc_handle->gsc_fd = m_exynos_gsc_m2m_create(i); in m_exynos_gsc_find_and_trylock_and_create()
558 if (gsc_handle->gsc_fd < 0) { in m_exynos_gsc_find_and_trylock_and_create()
559 gsc_handle->gsc_fd = 0; in m_exynos_gsc_find_and_trylock_and_create()
560 exynos_mutex_unlock(gsc_handle->obj_mutex[i]); in m_exynos_gsc_find_and_trylock_and_create()
565 if (gsc_handle->cur_obj_mutex) { in m_exynos_gsc_find_and_trylock_and_create()
566 exynos_mutex_unlock(gsc_handle->cur_obj_mutex); in m_exynos_gsc_find_and_trylock_and_create()
567 if (gsc_handle->destroy_cur_obj_mutex) in m_exynos_gsc_find_and_trylock_and_create()
568 exynos_mutex_destroy(gsc_handle->cur_obj_mutex); in m_exynos_gsc_find_and_trylock_and_create()
571 gsc_handle->destroy_cur_obj_mutex = false; in m_exynos_gsc_find_and_trylock_and_create()
572 gsc_handle->cur_obj_mutex = gsc_handle->obj_mutex[i]; in m_exynos_gsc_find_and_trylock_and_create()
719 struct GSC_HANDLE *gsc_handle = (struct GSC_HANDLE *)malloc(sizeof(struct GSC_HANDLE)); in exynos_gsc_create() local
720 if (gsc_handle == NULL) { in exynos_gsc_create()
725 gsc_handle->gsc_fd = 0; in exynos_gsc_create()
726 memset(&gsc_handle->src, 0, sizeof(struct gsc_info)); in exynos_gsc_create()
727 memset(&gsc_handle->dst, 0, sizeof(struct gsc_info)); in exynos_gsc_create()
729 gsc_handle->src.buf_type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE; in exynos_gsc_create()
730 gsc_handle->dst.buf_type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; in exynos_gsc_create()
732 gsc_handle->op_mutex = NULL; in exynos_gsc_create()
734 gsc_handle->obj_mutex[i] = NULL; in exynos_gsc_create()
736 gsc_handle->cur_obj_mutex = NULL; in exynos_gsc_create()
737 gsc_handle->destroy_cur_obj_mutex = false; in exynos_gsc_create()
738 gsc_handle->flag_local_path = false; in exynos_gsc_create()
739 gsc_handle->flag_exclusive_open = false; in exynos_gsc_create()
744 gsc_handle->op_mutex = exynos_mutex_create(EXYNOS_MUTEX_TYPE_PRIVATE, mutex_name); in exynos_gsc_create()
745 if (gsc_handle->op_mutex == NULL) { in exynos_gsc_create()
750 exynos_mutex_lock(gsc_handle->op_mutex); in exynos_gsc_create()
756 gsc_handle->obj_mutex[i] = exynos_mutex_create(EXYNOS_MUTEX_TYPE_SHARED, mutex_name); in exynos_gsc_create()
757 if (gsc_handle->obj_mutex[i] == NULL) { in exynos_gsc_create()
763 if (m_exynos_gsc_find_and_trylock_and_create(gsc_handle) == false) { in exynos_gsc_create()
768 exynos_mutex_unlock(gsc_handle->cur_obj_mutex); in exynos_gsc_create()
769 exynos_mutex_unlock(gsc_handle->op_mutex); in exynos_gsc_create()
771 return (void *)gsc_handle; in exynos_gsc_create()
774 if (gsc_handle) { in exynos_gsc_create()
775 m_exynos_gsc_destroy(gsc_handle); in exynos_gsc_create()
777 if (gsc_handle->cur_obj_mutex) in exynos_gsc_create()
778 exynos_mutex_unlock(gsc_handle->cur_obj_mutex); in exynos_gsc_create()
781 if ((gsc_handle->obj_mutex[i] != NULL) && in exynos_gsc_create()
782 (exynos_mutex_get_created_status(gsc_handle->obj_mutex[i]) == true)) { in exynos_gsc_create()
783 if (exynos_mutex_destroy(gsc_handle->obj_mutex[i]) == false) in exynos_gsc_create()
788 if (gsc_handle->op_mutex) in exynos_gsc_create()
789 exynos_mutex_unlock(gsc_handle->op_mutex); in exynos_gsc_create()
791 if (exynos_mutex_destroy(gsc_handle->op_mutex) == false) in exynos_gsc_create()
794 free(gsc_handle); in exynos_gsc_create()
813 struct GSC_HANDLE *gsc_handle = (struct GSC_HANDLE *)malloc(sizeof(struct GSC_HANDLE)); in exynos_gsc_reserve() local
814 if (gsc_handle == NULL) { in exynos_gsc_reserve()
819 gsc_handle->gsc_fd = -1; in exynos_gsc_reserve()
820 gsc_handle->op_mutex = NULL; in exynos_gsc_reserve()
821 gsc_handle->cur_obj_mutex = NULL; in exynos_gsc_reserve()
822 gsc_handle->destroy_cur_obj_mutex = true; in exynos_gsc_reserve()
825 gsc_handle->cur_obj_mutex = exynos_mutex_create(EXYNOS_MUTEX_TYPE_SHARED, mutex_name); in exynos_gsc_reserve()
826 if (gsc_handle->cur_obj_mutex == NULL) { in exynos_gsc_reserve()
832 if (exynos_mutex_trylock(gsc_handle->cur_obj_mutex) == true) { in exynos_gsc_reserve()
842 return (void *)gsc_handle; in exynos_gsc_reserve()
845 if (gsc_handle) { in exynos_gsc_reserve()
846 free(gsc_handle); in exynos_gsc_reserve()
854 struct GSC_HANDLE *gsc_handle = (struct GSC_HANDLE *)handle; in exynos_gsc_release() local
861 exynos_mutex_unlock(gsc_handle->cur_obj_mutex); in exynos_gsc_release()
862 exynos_mutex_destroy(gsc_handle->cur_obj_mutex); in exynos_gsc_release()
863 free(gsc_handle); in exynos_gsc_release()
899 struct GSC_HANDLE *gsc_handle = (struct GSC_HANDLE *)malloc(sizeof(struct GSC_HANDLE)); in exynos_gsc_create_exclusive() local
900 if (gsc_handle == NULL) { in exynos_gsc_create_exclusive()
904 memset(gsc_handle, 0, sizeof(struct GSC_HANDLE)); in exynos_gsc_create_exclusive()
905 gsc_handle->gsc_fd = -1; in exynos_gsc_create_exclusive()
906 gsc_handle->gsc_mode = mode; in exynos_gsc_create_exclusive()
907 gsc_handle->gsc_id = dev_num; in exynos_gsc_create_exclusive()
908 gsc_handle->allow_drm = allow_drm; in exynos_gsc_create_exclusive()
910 gsc_handle->src.buf_type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE; in exynos_gsc_create_exclusive()
911 gsc_handle->dst.buf_type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; in exynos_gsc_create_exclusive()
913 gsc_handle->op_mutex = NULL; in exynos_gsc_create_exclusive()
915 gsc_handle->obj_mutex[i] = NULL; in exynos_gsc_create_exclusive()
917 gsc_handle->cur_obj_mutex = NULL; in exynos_gsc_create_exclusive()
918 gsc_handle->destroy_cur_obj_mutex = false; in exynos_gsc_create_exclusive()
919 gsc_handle->flag_local_path = false; in exynos_gsc_create_exclusive()
920 gsc_handle->flag_exclusive_open = true; in exynos_gsc_create_exclusive()
925 gsc_handle->op_mutex = exynos_mutex_create(EXYNOS_MUTEX_TYPE_PRIVATE, mutex_name); in exynos_gsc_create_exclusive()
926 if (gsc_handle->op_mutex == NULL) { in exynos_gsc_create_exclusive()
931 exynos_mutex_lock(gsc_handle->op_mutex); in exynos_gsc_create_exclusive()
934 gsc_handle->cur_obj_mutex = exynos_mutex_create(EXYNOS_MUTEX_TYPE_SHARED, mutex_name); in exynos_gsc_create_exclusive()
935 if (gsc_handle->cur_obj_mutex == NULL) { in exynos_gsc_create_exclusive()
939 gsc_handle->destroy_cur_obj_mutex = true; in exynos_gsc_create_exclusive()
942 if (exynos_mutex_trylock(gsc_handle->cur_obj_mutex) == true) { in exynos_gsc_create_exclusive()
944 gsc_handle->gsc_fd = m_exynos_gsc_m2m_create(dev_num); in exynos_gsc_create_exclusive()
945 if (gsc_handle->gsc_fd < 0) { in exynos_gsc_create_exclusive()
950 ret = m_exynos_gsc_output_create(gsc_handle, dev_num, out_mode); in exynos_gsc_create_exclusive()
967 exynos_mutex_unlock(gsc_handle->op_mutex); in exynos_gsc_create_exclusive()
970 return (void *)gsc_handle; in exynos_gsc_create_exclusive()
974 if (gsc_handle) { in exynos_gsc_create_exclusive()
975 m_exynos_gsc_destroy(gsc_handle); in exynos_gsc_create_exclusive()
977 if (gsc_handle->cur_obj_mutex) { in exynos_gsc_create_exclusive()
978 exynos_mutex_unlock(gsc_handle->cur_obj_mutex); in exynos_gsc_create_exclusive()
979 if (gsc_handle->destroy_cur_obj_mutex) in exynos_gsc_create_exclusive()
980 exynos_mutex_destroy(gsc_handle->cur_obj_mutex); in exynos_gsc_create_exclusive()
984 if ((gsc_handle->obj_mutex[i] != NULL) && in exynos_gsc_create_exclusive()
985 (exynos_mutex_get_created_status(gsc_handle->obj_mutex[i]) == true)) { in exynos_gsc_create_exclusive()
986 if (exynos_mutex_destroy(gsc_handle->obj_mutex[i]) == false) in exynos_gsc_create_exclusive()
991 if (gsc_handle->op_mutex) in exynos_gsc_create_exclusive()
992 exynos_mutex_unlock(gsc_handle->op_mutex); in exynos_gsc_create_exclusive()
994 if (exynos_mutex_destroy(gsc_handle->op_mutex) == false) in exynos_gsc_create_exclusive()
997 free(gsc_handle); in exynos_gsc_create_exclusive()
1009 struct GSC_HANDLE *gsc_handle = (struct GSC_HANDLE *)handle; in exynos_gsc_destroy() local
1018 exynos_mutex_lock(gsc_handle->op_mutex); in exynos_gsc_destroy()
1020 if (gsc_handle->flag_exclusive_open == false) in exynos_gsc_destroy()
1021 exynos_mutex_lock(gsc_handle->cur_obj_mutex); in exynos_gsc_destroy()
1023 if (gsc_handle->gsc_mode == GSC_OUTPUT_MODE) in exynos_gsc_destroy()
1024 m_exynos_gsc_out_destroy(gsc_handle); in exynos_gsc_destroy()
1026 m_exynos_gsc_destroy(gsc_handle); in exynos_gsc_destroy()
1028 exynos_mutex_unlock(gsc_handle->cur_obj_mutex); in exynos_gsc_destroy()
1031 if ((gsc_handle->obj_mutex[i] != NULL) && in exynos_gsc_destroy()
1032 (exynos_mutex_get_created_status(gsc_handle->obj_mutex[i]) == true)) { in exynos_gsc_destroy()
1033 if (exynos_mutex_destroy(gsc_handle->obj_mutex[i]) == false) in exynos_gsc_destroy()
1038 if (gsc_handle->destroy_cur_obj_mutex) in exynos_gsc_destroy()
1039 exynos_mutex_destroy(gsc_handle->cur_obj_mutex); in exynos_gsc_destroy()
1041 exynos_mutex_unlock(gsc_handle->op_mutex); in exynos_gsc_destroy()
1043 if (exynos_mutex_destroy(gsc_handle->op_mutex) == false) in exynos_gsc_destroy()
1046 if (gsc_handle) in exynos_gsc_destroy()
1047 free(gsc_handle); in exynos_gsc_destroy()
1067 struct GSC_HANDLE *gsc_handle; in exynos_gsc_set_src_format() local
1068 gsc_handle = (struct GSC_HANDLE *)handle; in exynos_gsc_set_src_format()
1075 exynos_mutex_lock(gsc_handle->op_mutex); in exynos_gsc_set_src_format()
1077 gsc_handle->src.width = width; in exynos_gsc_set_src_format()
1078 gsc_handle->src.height = height; in exynos_gsc_set_src_format()
1079 gsc_handle->src.crop_left = crop_left; in exynos_gsc_set_src_format()
1080 gsc_handle->src.crop_top = crop_top; in exynos_gsc_set_src_format()
1081 gsc_handle->src.crop_width = crop_width; in exynos_gsc_set_src_format()
1082 gsc_handle->src.crop_height = crop_height; in exynos_gsc_set_src_format()
1083 gsc_handle->src.v4l2_colorformat = v4l2_colorformat; in exynos_gsc_set_src_format()
1084 gsc_handle->src.cacheable = cacheable; in exynos_gsc_set_src_format()
1085 gsc_handle->src.mode_drm = mode_drm; in exynos_gsc_set_src_format()
1086 gsc_handle->src.dirty = true; in exynos_gsc_set_src_format()
1089 exynos_mutex_unlock(gsc_handle->op_mutex); in exynos_gsc_set_src_format()
1111 struct GSC_HANDLE *gsc_handle; in exynos_gsc_set_dst_format() local
1112 gsc_handle = (struct GSC_HANDLE *)handle; in exynos_gsc_set_dst_format()
1119 exynos_mutex_lock(gsc_handle->op_mutex); in exynos_gsc_set_dst_format()
1121 gsc_handle->dst.width = width; in exynos_gsc_set_dst_format()
1122 gsc_handle->dst.height = height; in exynos_gsc_set_dst_format()
1123 gsc_handle->dst.crop_left = crop_left; in exynos_gsc_set_dst_format()
1124 gsc_handle->dst.crop_top = crop_top; in exynos_gsc_set_dst_format()
1125 gsc_handle->dst.crop_width = crop_width; in exynos_gsc_set_dst_format()
1126 gsc_handle->dst.crop_height = crop_height; in exynos_gsc_set_dst_format()
1127 gsc_handle->dst.v4l2_colorformat = v4l2_colorformat; in exynos_gsc_set_dst_format()
1128 gsc_handle->dst.cacheable = cacheable; in exynos_gsc_set_dst_format()
1129 gsc_handle->dst.mode_drm = mode_drm; in exynos_gsc_set_dst_format()
1130 gsc_handle->dst.dirty = true; in exynos_gsc_set_dst_format()
1131 gsc_handle->dst.csc_range = !narrowRgb; in exynos_gsc_set_dst_format()
1133 exynos_mutex_unlock(gsc_handle->op_mutex); in exynos_gsc_set_dst_format()
1146 struct GSC_HANDLE *gsc_handle; in exynos_gsc_set_rotation() local
1147 gsc_handle = (struct GSC_HANDLE *)handle; in exynos_gsc_set_rotation()
1154 exynos_mutex_lock(gsc_handle->op_mutex); in exynos_gsc_set_rotation()
1166 gsc_handle->dst.rotation = new_rotation; in exynos_gsc_set_rotation()
1167 gsc_handle->dst.flip_horizontal = flip_horizontal; in exynos_gsc_set_rotation()
1168 gsc_handle->dst.flip_vertical = flip_vertical; in exynos_gsc_set_rotation()
1172 exynos_mutex_unlock(gsc_handle->op_mutex); in exynos_gsc_set_rotation()
1182 struct GSC_HANDLE *gsc_handle; in exynos_gsc_set_src_addr() local
1183 gsc_handle = (struct GSC_HANDLE *)handle; in exynos_gsc_set_src_addr()
1192 exynos_mutex_lock(gsc_handle->op_mutex); in exynos_gsc_set_src_addr()
1194 gsc_handle->src.addr[0] = addr[0]; in exynos_gsc_set_src_addr()
1195 gsc_handle->src.addr[1] = addr[1]; in exynos_gsc_set_src_addr()
1196 gsc_handle->src.addr[2] = addr[2]; in exynos_gsc_set_src_addr()
1197 gsc_handle->src.acquireFenceFd = acquireFenceFd; in exynos_gsc_set_src_addr()
1199 exynos_mutex_unlock(gsc_handle->op_mutex); in exynos_gsc_set_src_addr()
1211 struct GSC_HANDLE *gsc_handle; in exynos_gsc_set_dst_addr() local
1212 gsc_handle = (struct GSC_HANDLE *)handle; in exynos_gsc_set_dst_addr()
1222 exynos_mutex_lock(gsc_handle->op_mutex); in exynos_gsc_set_dst_addr()
1224 gsc_handle->dst.addr[0] = addr[0]; in exynos_gsc_set_dst_addr()
1225 gsc_handle->dst.addr[1] = addr[1]; in exynos_gsc_set_dst_addr()
1226 gsc_handle->dst.addr[2] = addr[2]; in exynos_gsc_set_dst_addr()
1227 gsc_handle->dst.acquireFenceFd = acquireFenceFd; in exynos_gsc_set_dst_addr()
1230 exynos_mutex_unlock(gsc_handle->op_mutex); in exynos_gsc_set_dst_addr()
1340 struct GSC_HANDLE *gsc_handle; in exynos_gsc_m2m_config() local
1350 gsc_handle = (struct GSC_HANDLE *)handle; in exynos_gsc_m2m_config()
1351 if (gsc_handle == NULL) { in exynos_gsc_m2m_config()
1356 if ((src_img->drmMode && !gsc_handle->allow_drm) || in exynos_gsc_m2m_config()
1359 __func__, gsc_handle->gsc_id, in exynos_gsc_m2m_config()
1367 exynos_gsc_set_rotation(gsc_handle, rotate, hflip, vflip); in exynos_gsc_m2m_config()
1369 ret = exynos_gsc_set_src_format(gsc_handle, src_img->fw, src_img->fh, in exynos_gsc_m2m_config()
1379 ret = exynos_gsc_set_dst_format(gsc_handle, dst_img->fw, dst_img->fh, in exynos_gsc_m2m_config()
1399 struct GSC_HANDLE *gsc_handle; in exynos_gsc_out_config() local
1418 gsc_handle = (struct GSC_HANDLE *)handle; in exynos_gsc_out_config()
1419 if (gsc_handle == NULL) { in exynos_gsc_out_config()
1426 if (gsc_handle->src.stream_on != false) { in exynos_gsc_out_config()
1431 memcpy(&gsc_handle->src_img, src_img, sizeof(exynos_gsc_img)); in exynos_gsc_out_config()
1432 memcpy(&gsc_handle->dst_img, dst_img, sizeof(exynos_gsc_img)); in exynos_gsc_out_config()
1440 if (m_exynos_gsc_check_src_size(&gsc_handle->src_img.fw, &gsc_handle->src_img.fh, in exynos_gsc_out_config()
1441 &gsc_handle->src_img.x, &gsc_handle->src_img.y, in exynos_gsc_out_config()
1442 &gsc_handle->src_img.w, &gsc_handle->src_img.h, in exynos_gsc_out_config()
1448 if (m_exynos_gsc_check_dst_size(&gsc_handle->dst_img.fw, &gsc_handle->dst_img.fh, in exynos_gsc_out_config()
1449 &gsc_handle->dst_img.x, &gsc_handle->dst_img.y, in exynos_gsc_out_config()
1450 &gsc_handle->dst_img.w, &gsc_handle->dst_img.h, in exynos_gsc_out_config()
1458 gsc_handle->src.src_buf_idx = 0; in exynos_gsc_out_config()
1459 gsc_handle->src.qbuf_cnt = 0; in exynos_gsc_out_config()
1463 if (gsc_handle->out_mode == GSC_OUT_FIMD) { in exynos_gsc_out_config()
1464 sd_fmt.format.width = gsc_handle->dst_img.fw; in exynos_gsc_out_config()
1465 sd_fmt.format.height = gsc_handle->dst_img.fh; in exynos_gsc_out_config()
1467 sd_fmt.format.width = gsc_handle->dst_img.w; in exynos_gsc_out_config()
1468 sd_fmt.format.height = gsc_handle->dst_img.h; in exynos_gsc_out_config()
1472 if (exynos_subdev_s_fmt(gsc_handle->gsc_sd_entity->fd, &sd_fmt) < 0) { in exynos_gsc_out_config()
1480 if (gsc_handle->out_mode == GSC_OUT_FIMD) { in exynos_gsc_out_config()
1481 sd_crop.rect.left = gsc_handle->dst_img.x; in exynos_gsc_out_config()
1482 sd_crop.rect.top = gsc_handle->dst_img.y; in exynos_gsc_out_config()
1483 sd_crop.rect.width = gsc_handle->dst_img.w; in exynos_gsc_out_config()
1484 sd_crop.rect.height = gsc_handle->dst_img.h; in exynos_gsc_out_config()
1488 sd_crop.rect.width = gsc_handle->dst_img.w; in exynos_gsc_out_config()
1489 sd_crop.rect.height = gsc_handle->dst_img.h; in exynos_gsc_out_config()
1491 if (exynos_subdev_s_crop(gsc_handle->gsc_sd_entity->fd, &sd_crop) < 0) { in exynos_gsc_out_config()
1498 if (gsc_handle->out_mode == GSC_OUT_FIMD) { in exynos_gsc_out_config()
1500 sd_fmt.format.width = gsc_handle->dst_img.w; in exynos_gsc_out_config()
1501 sd_fmt.format.height = gsc_handle->dst_img.h; in exynos_gsc_out_config()
1504 sd_fmt.format.width = gsc_handle->dst_img.w + gsc_handle->dst_img.x*2; in exynos_gsc_out_config()
1505 sd_fmt.format.height = gsc_handle->dst_img.h + gsc_handle->dst_img.y*2; in exynos_gsc_out_config()
1511 if (exynos_subdev_s_fmt(gsc_handle->sink_sd_entity->fd, &sd_fmt) < 0) { in exynos_gsc_out_config()
1517 if (gsc_handle->out_mode == GSC_OUT_FIMD) in exynos_gsc_out_config()
1523 if (gsc_handle->out_mode == GSC_OUT_FIMD) { in exynos_gsc_out_config()
1524 sd_crop.rect.left = gsc_handle->dst_img.x; in exynos_gsc_out_config()
1525 sd_crop.rect.top = gsc_handle->dst_img.y; in exynos_gsc_out_config()
1526 sd_crop.rect.width = gsc_handle->dst_img.w; in exynos_gsc_out_config()
1527 sd_crop.rect.height = gsc_handle->dst_img.h; in exynos_gsc_out_config()
1531 sd_crop.rect.width = gsc_handle->dst_img.w; in exynos_gsc_out_config()
1532 sd_crop.rect.height = gsc_handle->dst_img.h; in exynos_gsc_out_config()
1534 if (exynos_subdev_s_crop(gsc_handle->sink_sd_entity->fd, &sd_crop) < 0) { in exynos_gsc_out_config()
1539 if (gsc_handle->out_mode != GSC_OUT_FIMD) { in exynos_gsc_out_config()
1542 sd_fmt.format.width = gsc_handle->dst_img.w + gsc_handle->dst_img.x*2; in exynos_gsc_out_config()
1543 sd_fmt.format.height = gsc_handle->dst_img.h + gsc_handle->dst_img.y*2; in exynos_gsc_out_config()
1545 if (exynos_subdev_s_fmt(gsc_handle->sink_sd_entity->fd, &sd_fmt) < 0) { in exynos_gsc_out_config()
1552 sd_crop.rect.left = gsc_handle->dst_img.x; in exynos_gsc_out_config()
1553 sd_crop.rect.top = gsc_handle->dst_img.y; in exynos_gsc_out_config()
1554 sd_crop.rect.width = gsc_handle->dst_img.w; in exynos_gsc_out_config()
1555 sd_crop.rect.height = gsc_handle->dst_img.h; in exynos_gsc_out_config()
1556 if (exynos_subdev_s_crop(gsc_handle->sink_sd_entity->fd, &sd_crop) < 0) { in exynos_gsc_out_config()
1563 if (exynos_v4l2_s_ctrl(gsc_handle->gsc_vd_entity->fd, V4L2_CID_ROTATE, rotate) < 0) { in exynos_gsc_out_config()
1568 if (exynos_v4l2_s_ctrl(gsc_handle->gsc_vd_entity->fd, V4L2_CID_HFLIP, hflip) < 0) { in exynos_gsc_out_config()
1573 if (exynos_v4l2_s_ctrl(gsc_handle->gsc_vd_entity->fd, V4L2_CID_VFLIP, vflip) < 0) { in exynos_gsc_out_config()
1578 if (exynos_v4l2_s_ctrl(gsc_handle->gsc_vd_entity->fd, V4L2_CID_CACHEABLE, 1) < 0) { in exynos_gsc_out_config()
1583 if (exynos_v4l2_s_ctrl(gsc_handle->gsc_vd_entity->fd, in exynos_gsc_out_config()
1584 V4L2_CID_CONTENT_PROTECTION, gsc_handle->src_img.drmMode) < 0) { in exynos_gsc_out_config()
1589 if (exynos_v4l2_s_ctrl(gsc_handle->gsc_vd_entity->fd, V4L2_CID_CSC_RANGE, in exynos_gsc_out_config()
1598 fmt.fmt.pix_mp.width = gsc_handle->src_img.fw; in exynos_gsc_out_config()
1599 fmt.fmt.pix_mp.height = gsc_handle->src_img.fh; in exynos_gsc_out_config()
1604 if (exynos_v4l2_s_fmt(gsc_handle->gsc_vd_entity->fd, &fmt) < 0) { in exynos_gsc_out_config()
1611 crop.c.left = gsc_handle->src_img.x; in exynos_gsc_out_config()
1612 crop.c.top = gsc_handle->src_img.y; in exynos_gsc_out_config()
1613 crop.c.width = gsc_handle->src_img.w; in exynos_gsc_out_config()
1614 crop.c.height = gsc_handle->src_img.h; in exynos_gsc_out_config()
1616 if (exynos_v4l2_s_crop(gsc_handle->gsc_vd_entity->fd, &crop) < 0) { in exynos_gsc_out_config()
1625 if (exynos_v4l2_reqbufs(gsc_handle->gsc_vd_entity->fd, &reqbuf) < 0) { in exynos_gsc_out_config()
1638 struct GSC_HANDLE *gsc_handle; in exynos_gsc_out_run() local
1646 gsc_handle = (struct GSC_HANDLE *)handle; in exynos_gsc_out_run()
1653 if (gsc_handle->src.qbuf_cnt == MAX_BUFFERS_GSCALER_OUT) { in exynos_gsc_out_run()
1663 if (exynos_v4l2_dqbuf(gsc_handle->gsc_vd_entity->fd, &buf) < 0) { in exynos_gsc_out_run()
1665 gsc_handle->src.src_buf_idx, MAX_BUFFERS_GSCALER_OUT); in exynos_gsc_out_run()
1668 gsc_handle->src.qbuf_cnt--; in exynos_gsc_out_run()
1675 src_color_space = HAL_PIXEL_FORMAT_2_V4L2_PIX(gsc_handle->src_img.format); in exynos_gsc_out_run()
1683 buf.index = gsc_handle->src.src_buf_idx; in exynos_gsc_out_run()
1687 gsc_handle->src.addr[0] = src_img->yaddr; in exynos_gsc_out_run()
1688 gsc_handle->src.addr[1] = src_img->uaddr; in exynos_gsc_out_run()
1689 gsc_handle->src.addr[2] = src_img->vaddr; in exynos_gsc_out_run()
1692 gsc_handle->src_img.fw * gsc_handle->src_img.fh, src_planes) != true) { in exynos_gsc_out_run()
1698 buf.m.planes[i].m.fd = (int)gsc_handle->src.addr[i]; in exynos_gsc_out_run()
1704 if (exynos_v4l2_qbuf(gsc_handle->gsc_vd_entity->fd, &buf) < 0) { in exynos_gsc_out_run()
1706 gsc_handle->src.src_buf_idx, MAX_BUFFERS_GSCALER_OUT); in exynos_gsc_out_run()
1709 gsc_handle->src.src_buf_idx++; in exynos_gsc_out_run()
1710 gsc_handle->src.src_buf_idx = gsc_handle->src.src_buf_idx % MAX_BUFFERS_GSCALER_OUT; in exynos_gsc_out_run()
1711 gsc_handle->src.qbuf_cnt++; in exynos_gsc_out_run()
1713 if (gsc_handle->src.stream_on == false) { in exynos_gsc_out_run()
1714 if (exynos_v4l2_streamon(gsc_handle->gsc_vd_entity->fd, buf.type) < 0) { in exynos_gsc_out_run()
1718 gsc_handle->src.stream_on = true; in exynos_gsc_out_run()
1727 struct GSC_HANDLE *gsc_handle; in exynos_gsc_out_stop() local
1735 gsc_handle = (struct GSC_HANDLE *)handle; in exynos_gsc_out_stop()
1741 if (gsc_handle->src.stream_on == true) { in exynos_gsc_out_stop()
1742 if (exynos_v4l2_streamoff(gsc_handle->gsc_vd_entity->fd, in exynos_gsc_out_stop()
1747 gsc_handle->src.stream_on = false; in exynos_gsc_out_stop()
1750 gsc_handle->src.src_buf_idx = 0; in exynos_gsc_out_stop()
1751 gsc_handle->src.qbuf_cnt = 0; in exynos_gsc_out_stop()
1757 if (exynos_v4l2_reqbufs(gsc_handle->gsc_vd_entity->fd, &reqbuf) < 0) { in exynos_gsc_out_stop()
1769 struct GSC_HANDLE *gsc_handle; in exynos_gsc_m2m_run_core() local
1773 gsc_handle = (struct GSC_HANDLE *)handle; in exynos_gsc_m2m_run_core()
1782 is_dirty = gsc_handle->src.dirty || gsc_handle->dst.dirty; in exynos_gsc_m2m_run_core()
1783 is_drm = gsc_handle->src.mode_drm; in exynos_gsc_m2m_run_core()
1785 if (is_dirty && (gsc_handle->src.mode_drm != gsc_handle->dst.mode_drm)) { in exynos_gsc_m2m_run_core()
1787 __func__, gsc_handle->gsc_id, gsc_handle->src.mode_drm, in exynos_gsc_m2m_run_core()
1788 gsc_handle->dst.mode_drm); in exynos_gsc_m2m_run_core()
1790 } else if (is_drm && !gsc_handle->allow_drm) { in exynos_gsc_m2m_run_core()
1792 gsc_handle->gsc_id); in exynos_gsc_m2m_run_core()
1796 if (m_exynos_gsc_check_src_size(&gsc_handle->src.width, &gsc_handle->src.height, in exynos_gsc_m2m_run_core()
1797 &gsc_handle->src.crop_left, &gsc_handle->src.crop_top, in exynos_gsc_m2m_run_core()
1798 &gsc_handle->src.crop_width, &gsc_handle->src.crop_height, in exynos_gsc_m2m_run_core()
1799 gsc_handle->src.v4l2_colorformat) == false) { in exynos_gsc_m2m_run_core()
1804 if (m_exynos_gsc_check_dst_size(&gsc_handle->dst.width, &gsc_handle->dst.height, in exynos_gsc_m2m_run_core()
1805 &gsc_handle->dst.crop_left, &gsc_handle->dst.crop_top, in exynos_gsc_m2m_run_core()
1806 &gsc_handle->dst.crop_width, &gsc_handle->dst.crop_height, in exynos_gsc_m2m_run_core()
1807 gsc_handle->dst.v4l2_colorformat, in exynos_gsc_m2m_run_core()
1808 gsc_handle->dst.rotation) == false) { in exynos_gsc_m2m_run_core()
1814 if (gsc_handle->src.stream_on == true) { in exynos_gsc_m2m_run_core()
1825 if (is_dirty && gsc_handle->allow_drm && is_drm) { in exynos_gsc_m2m_run_core()
1826 if (exynos_v4l2_s_ctrl(gsc_handle->gsc_fd, in exynos_gsc_m2m_run_core()
1838 if (gsc_handle->src.dirty) { in exynos_gsc_m2m_run_core()
1839 if (m_exynos_gsc_set_format(gsc_handle->gsc_fd, &gsc_handle->src) == false) { in exynos_gsc_m2m_run_core()
1843 gsc_handle->src.dirty = false; in exynos_gsc_m2m_run_core()
1846 if (gsc_handle->dst.dirty) { in exynos_gsc_m2m_run_core()
1847 if (m_exynos_gsc_set_format(gsc_handle->gsc_fd, &gsc_handle->dst) == false) { in exynos_gsc_m2m_run_core()
1851 gsc_handle->dst.dirty = false; in exynos_gsc_m2m_run_core()
1858 if (is_dirty && gsc_handle->allow_drm && is_drm) { in exynos_gsc_m2m_run_core()
1861 if (gsc_handle->gsc_id == 0) { in exynos_gsc_m2m_run_core()
1863 } else if (gsc_handle->gsc_id == 3) { in exynos_gsc_m2m_run_core()
1867 gsc_handle->gsc_id); in exynos_gsc_m2m_run_core()
1875 gsc_handle->protection_enabled = true; in exynos_gsc_m2m_run_core()
1878 if (m_exynos_gsc_set_addr(gsc_handle->gsc_fd, &gsc_handle->src) == false) { in exynos_gsc_m2m_run_core()
1883 if (m_exynos_gsc_set_addr(gsc_handle->gsc_fd, &gsc_handle->dst) == false) { in exynos_gsc_m2m_run_core()
1888 if (gsc_handle->src.stream_on == false) { in exynos_gsc_m2m_run_core()
1889 if (exynos_v4l2_streamon(gsc_handle->gsc_fd, gsc_handle->src.buf_type) < 0) { in exynos_gsc_m2m_run_core()
1893 gsc_handle->src.stream_on = true; in exynos_gsc_m2m_run_core()
1896 if (gsc_handle->dst.stream_on == false) { in exynos_gsc_m2m_run_core()
1897 if (exynos_v4l2_streamon(gsc_handle->gsc_fd, gsc_handle->dst.buf_type) < 0) { in exynos_gsc_m2m_run_core()
1901 gsc_handle->dst.stream_on = true; in exynos_gsc_m2m_run_core()
1915 struct GSC_HANDLE *gsc_handle; in exynos_gsc_m2m_wait_frame_done() local
1917 gsc_handle = (struct GSC_HANDLE *)handle; in exynos_gsc_m2m_wait_frame_done()
1926 if ((gsc_handle->src.stream_on == false) || (gsc_handle->dst.stream_on == false)) { in exynos_gsc_m2m_wait_frame_done()
1931 if (gsc_handle->src.buffer_queued) { in exynos_gsc_m2m_wait_frame_done()
1932 if (exynos_v4l2_dqbuf(gsc_handle->gsc_fd, &gsc_handle->src.buffer) < 0) { in exynos_gsc_m2m_wait_frame_done()
1936 gsc_handle->src.buffer_queued = false; in exynos_gsc_m2m_wait_frame_done()
1939 if (gsc_handle->dst.buffer_queued) { in exynos_gsc_m2m_wait_frame_done()
1940 if (exynos_v4l2_dqbuf(gsc_handle->gsc_fd, &gsc_handle->dst.buffer) < 0) { in exynos_gsc_m2m_wait_frame_done()
1944 gsc_handle->dst.buffer_queued = false; in exynos_gsc_m2m_wait_frame_done()
1954 struct GSC_HANDLE *gsc_handle; in exynos_gsc_m2m_stop() local
1958 gsc_handle = (struct GSC_HANDLE *)handle; in exynos_gsc_m2m_stop()
1962 if (!gsc_handle->src.stream_on && !gsc_handle->dst.stream_on) { in exynos_gsc_m2m_stop()
1965 } else if (gsc_handle->src.stream_on != gsc_handle->dst.stream_on) { in exynos_gsc_m2m_stop()
1967 __func__, gsc_handle->src.stream_on, gsc_handle->dst.stream_on); in exynos_gsc_m2m_stop()
1978 if (gsc_handle->src.stream_on == true) { in exynos_gsc_m2m_stop()
1979 if (exynos_v4l2_streamoff(gsc_handle->gsc_fd, gsc_handle->src.buf_type) < 0) { in exynos_gsc_m2m_stop()
1983 gsc_handle->src.stream_on = false; in exynos_gsc_m2m_stop()
1987 if (gsc_handle->dst.stream_on == true) { in exynos_gsc_m2m_stop()
1988 if (exynos_v4l2_streamoff(gsc_handle->gsc_fd, gsc_handle->dst.buf_type) < 0) { in exynos_gsc_m2m_stop()
1992 gsc_handle->dst.stream_on = false; in exynos_gsc_m2m_stop()
1996 if (gsc_handle->allow_drm && gsc_handle->protection_enabled) { in exynos_gsc_m2m_stop()
1999 if (gsc_handle->gsc_id == 0) in exynos_gsc_m2m_stop()
2001 else if (gsc_handle->gsc_id == 3) in exynos_gsc_m2m_stop()
2005 gsc_handle->protection_enabled = false; in exynos_gsc_m2m_stop()
2008 if (exynos_v4l2_s_ctrl(gsc_handle->gsc_fd, in exynos_gsc_m2m_stop()
2017 req_buf.type = gsc_handle->src.buf_type; in exynos_gsc_m2m_stop()
2019 if (exynos_v4l2_reqbufs(gsc_handle->gsc_fd, &req_buf) < 0) { in exynos_gsc_m2m_stop()
2026 req_buf.type = gsc_handle->dst.buf_type; in exynos_gsc_m2m_stop()
2028 if (exynos_v4l2_reqbufs(gsc_handle->gsc_fd, &req_buf) < 0) { in exynos_gsc_m2m_stop()
2041 struct GSC_HANDLE *gsc_handle; in exynos_gsc_convert() local
2043 gsc_handle = (struct GSC_HANDLE *)handle; in exynos_gsc_convert()
2052 exynos_mutex_lock(gsc_handle->op_mutex); in exynos_gsc_convert()
2054 if (gsc_handle->flag_local_path == true) { in exynos_gsc_convert()
2069 if (gsc_handle->src.releaseFenceFd >= 0) { in exynos_gsc_convert()
2070 close(gsc_handle->src.releaseFenceFd); in exynos_gsc_convert()
2071 gsc_handle->src.releaseFenceFd = -1; in exynos_gsc_convert()
2074 if (gsc_handle->dst.releaseFenceFd >= 0) { in exynos_gsc_convert()
2075 close(gsc_handle->dst.releaseFenceFd); in exynos_gsc_convert()
2076 gsc_handle->dst.releaseFenceFd = -1; in exynos_gsc_convert()
2087 if (gsc_handle->flag_exclusive_open == false) { in exynos_gsc_convert()
2088 if (gsc_handle->flag_local_path == false) in exynos_gsc_convert()
2089 exynos_mutex_unlock(gsc_handle->cur_obj_mutex); in exynos_gsc_convert()
2092 exynos_mutex_unlock(gsc_handle->op_mutex); in exynos_gsc_convert()
2103 struct GSC_HANDLE *gsc_handle = handle; in exynos_gsc_m2m_run() local
2145 src_img->releaseFenceFd = gsc_handle->src.releaseFenceFd; in exynos_gsc_m2m_run()
2146 dst_img->releaseFenceFd = gsc_handle->dst.releaseFenceFd; in exynos_gsc_m2m_run()
2160 struct GSC_HANDLE *gsc_handle; in exynos_gsc_config_exclusive() local
2162 gsc_handle = (struct GSC_HANDLE *)handle; in exynos_gsc_config_exclusive()
2168 switch (gsc_handle->gsc_mode) { in exynos_gsc_config_exclusive()
2192 struct GSC_HANDLE *gsc_handle; in exynos_gsc_run_exclusive() local
2197 gsc_handle = (struct GSC_HANDLE *)handle; in exynos_gsc_run_exclusive()
2203 switch (gsc_handle->gsc_mode) { in exynos_gsc_run_exclusive()
2224 struct GSC_HANDLE *gsc_handle; in exynos_gsc_wait_frame_done_exclusive() local
2226 gsc_handle = (struct GSC_HANDLE *)handle; in exynos_gsc_wait_frame_done_exclusive()
2235 if (gsc_handle->gsc_mode == GSC_M2M_MODE) in exynos_gsc_wait_frame_done_exclusive()
2245 struct GSC_HANDLE *gsc_handle; in exynos_gsc_stop_exclusive() local
2247 gsc_handle = (struct GSC_HANDLE *)handle; in exynos_gsc_stop_exclusive()
2256 switch (gsc_handle->gsc_mode) { in exynos_gsc_stop_exclusive()
2279 struct GSC_HANDLE *gsc_handle; in exynos_gsc_connect() local
2281 gsc_handle = (struct GSC_HANDLE *)handle; in exynos_gsc_connect()
2290 exynos_mutex_lock(gsc_handle->op_mutex); in exynos_gsc_connect()
2292 gsc_handle->flag_local_path = true; in exynos_gsc_connect()
2294 if (exynos_mutex_trylock(gsc_handle->cur_obj_mutex) == false) { in exynos_gsc_connect()
2295 if (m_exynos_gsc_find_and_trylock_and_create(gsc_handle) == false) { in exynos_gsc_connect()
2306 exynos_mutex_unlock(gsc_handle->op_mutex); in exynos_gsc_connect()
2315 struct GSC_HANDLE *gsc_handle; in exynos_gsc_disconnect() local
2316 gsc_handle = (struct GSC_HANDLE *)handle; in exynos_gsc_disconnect()
2325 exynos_mutex_lock(gsc_handle->op_mutex); in exynos_gsc_disconnect()
2327 gsc_handle->flag_local_path = false; in exynos_gsc_disconnect()
2329 exynos_mutex_unlock(gsc_handle->cur_obj_mutex); in exynos_gsc_disconnect()
2331 exynos_mutex_unlock(gsc_handle->op_mutex); in exynos_gsc_disconnect()