Loading drivers/media/platform/msm/vpu/vpu_configuration.c +37 −1 Original line number Diff line number Diff line /* Copyright (c) 2013, The Linux Foundation. All rights reserved. /* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -151,6 +151,38 @@ static int auto_manual_bounds_check(const struct vpu_ctrl_desc *desc, return __check_bounds(bounds, arg->value); } int configure_colorspace(struct vpu_dev_session *session, int port) { struct vpu_prop_session_color_space cs_param_1; struct vpu_prop_session_color_space cs_param_2; int ret; int colorspace; colorspace = session->port_info[port].format.colorspace; if (!colorspace) return 0; translate_colorspace_to_hfi(colorspace, &cs_param_1, &cs_param_2); ret = vpu_hw_session_s_property(session->id, VPU_PROP_SESSION_COLOR_SPACE, &cs_param_1, sizeof(cs_param_1)); if (ret) { pr_err("Failed to set port colorspace\n"); return ret; } if (cs_param_1.cs_config != CONFIG_RGB_RANGE) { ret = vpu_hw_session_s_property(session->id, VPU_PROP_SESSION_COLOR_SPACE, &cs_param_2, sizeof(cs_param_2)); if (ret) { pr_err("Failed to set port colorspace\n"); return ret; } } return ret; } int configure_nr_buffers(struct vpu_dev_session *session, const struct vpu_ctrl_auto_manual *nr) { Loading Loading @@ -996,6 +1028,10 @@ int is_format_valid(struct v4l2_format *fmt) if ((height & 1) || (width & 1)) /* must be even */ return 0; if (fmt->fmt.pix_mp.colorspace <= VPU_CS_MIN || fmt->fmt.pix_mp.colorspace >= VPU_CS_MAX) fmt->fmt.pix_mp.colorspace = 0; return 1; } Loading drivers/media/platform/msm/vpu/vpu_configuration.h +3 −1 Original line number Diff line number Diff line /* Copyright (c) 2013, The Linux Foundation. All rights reserved. /* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -47,6 +47,8 @@ int apply_vpu_control_extended(struct vpu_client *client, int cmd, void *get_control(struct vpu_controller *controller, u32 id); int configure_colorspace(struct vpu_dev_session *session, int port); int configure_nr_buffers(struct vpu_dev_session *session, const struct vpu_ctrl_auto_manual *nr); Loading drivers/media/platform/msm/vpu/vpu_ioctl.c +11 −2 Original line number Diff line number Diff line /* Copyright (c) 2013, The Linux Foundation. All rights reserved. /* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -471,9 +471,14 @@ int vpu_get_fmt(struct vpu_client *client, struct v4l2_format *f) if (port == INPUT_PORT) { ret = vpu_hw_session_g_input_params(session->id, &in_param); translate_input_format_to_api(&in_param, f); f->fmt.pix_mp.colorspace = session->port_info[INPUT_PORT].format.colorspace; } else { ret = vpu_hw_session_g_output_params(session->id, &out_param); translate_output_format_to_api(&out_param, f); f->fmt.pix_mp.colorspace = session->port_info[OUTPUT_PORT].format.colorspace; } return ret; Loading Loading @@ -547,8 +552,12 @@ int vpu_set_fmt(struct vpu_client *client, struct v4l2_format *f) session->port_info[INPUT_PORT].scan_mode = translate_v4l2_scan_mode(pix_mp->field); ret = commit_port_config(session, port, 1); ret = configure_colorspace(session, port); if (ret) goto exit; ret = commit_port_config(session, port, 1); exit: mutex_unlock(&session->lock); return ret; } Loading drivers/media/platform/msm/vpu/vpu_translate.c +56 −1 Original line number Diff line number Diff line /* Copyright (c) 2013, The Linux Foundation. All rights reserved. /* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -131,6 +131,61 @@ u32 translate_pixelformat_to_hfi(u32 api_pix_fmt) return hfi_pix_fmt; } void translate_colorspace_to_hfi(u32 api_colorspace, struct vpu_prop_session_color_space *cs_1, struct vpu_prop_session_color_space *cs_2) { switch (api_colorspace) { case VPU_CS_RGB_FULL: cs_1->cs_config = CONFIG_RGB_RANGE; cs_1->value = RGB_RANGE_FULL; break; case VPU_CS_RGB_LIMITED: cs_1->cs_config = CONFIG_RGB_RANGE; cs_1->value = RGB_RANGE_LIMITED; break; case VPU_CS_REC601_FULL: cs_1->cs_config = CONFIG_NOMINAL_RANGE; cs_1->value = NOMINAL_RANGE_FULL; cs_2->cs_config = CONFIG_YCBCR_MATRIX; cs_2->value = YCbCr_MATRIX_BT601; break; case VPU_CS_REC601_LIMITED: cs_1->cs_config = CONFIG_NOMINAL_RANGE; cs_1->value = NOMINAL_RANGE_LIMITED; cs_2->cs_config = CONFIG_YCBCR_MATRIX; cs_2->value = YCbCr_MATRIX_BT601; break; case VPU_CS_REC709_FULL: cs_1->cs_config = CONFIG_NOMINAL_RANGE; cs_1->value = NOMINAL_RANGE_FULL; cs_2->cs_config = CONFIG_YCBCR_MATRIX; cs_2->value = YCbCr_MATRIX_BT709; break; case VPU_CS_REC709_LIMITED: cs_1->cs_config = CONFIG_NOMINAL_RANGE; cs_1->value = NOMINAL_RANGE_LIMITED; cs_2->cs_config = CONFIG_YCBCR_MATRIX; cs_2->value = YCbCr_MATRIX_BT709; break; case VPU_CS_SMPTE240_FULL: cs_1->cs_config = CONFIG_NOMINAL_RANGE; cs_1->value = NOMINAL_RANGE_FULL; cs_2->cs_config = CONFIG_YCBCR_MATRIX; cs_2->value = YCbCr_MATRIX_BT240; break; case VPU_CS_SMPTE240_LIMITED: cs_1->cs_config = CONFIG_NOMINAL_RANGE; cs_1->value = NOMINAL_RANGE_LIMITED; cs_2->cs_config = CONFIG_YCBCR_MATRIX; cs_2->value = YCbCr_MATRIX_BT240; break; default: pr_warn("Unsupported api colorspace %d\n", api_colorspace); break; } } u32 translate_input_source(u32 in) { u32 hfi_source = 100; /* invaid */ Loading drivers/media/platform/msm/vpu/vpu_translate.h +5 −1 Original line number Diff line number Diff line /* Copyright (c) 2013, The Linux Foundation. All rights reserved. /* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -28,6 +28,10 @@ u32 translate_output_destination(u32 out); u32 translate_pixelformat_to_hfi(u32 api_pix_fmt); u32 translate_pixelformat_to_api(u32 hfi_pix_fmt); void translate_colorspace_to_hfi(u32 api_colorspace, struct vpu_prop_session_color_space *cs_1, struct vpu_prop_session_color_space *cs_2); void translate_input_format_to_hfi(const struct vpu_port_info *port_info, struct vpu_prop_session_input *in); void translate_output_format_to_hfi(const struct vpu_port_info *port_info, Loading Loading
drivers/media/platform/msm/vpu/vpu_configuration.c +37 −1 Original line number Diff line number Diff line /* Copyright (c) 2013, The Linux Foundation. All rights reserved. /* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -151,6 +151,38 @@ static int auto_manual_bounds_check(const struct vpu_ctrl_desc *desc, return __check_bounds(bounds, arg->value); } int configure_colorspace(struct vpu_dev_session *session, int port) { struct vpu_prop_session_color_space cs_param_1; struct vpu_prop_session_color_space cs_param_2; int ret; int colorspace; colorspace = session->port_info[port].format.colorspace; if (!colorspace) return 0; translate_colorspace_to_hfi(colorspace, &cs_param_1, &cs_param_2); ret = vpu_hw_session_s_property(session->id, VPU_PROP_SESSION_COLOR_SPACE, &cs_param_1, sizeof(cs_param_1)); if (ret) { pr_err("Failed to set port colorspace\n"); return ret; } if (cs_param_1.cs_config != CONFIG_RGB_RANGE) { ret = vpu_hw_session_s_property(session->id, VPU_PROP_SESSION_COLOR_SPACE, &cs_param_2, sizeof(cs_param_2)); if (ret) { pr_err("Failed to set port colorspace\n"); return ret; } } return ret; } int configure_nr_buffers(struct vpu_dev_session *session, const struct vpu_ctrl_auto_manual *nr) { Loading Loading @@ -996,6 +1028,10 @@ int is_format_valid(struct v4l2_format *fmt) if ((height & 1) || (width & 1)) /* must be even */ return 0; if (fmt->fmt.pix_mp.colorspace <= VPU_CS_MIN || fmt->fmt.pix_mp.colorspace >= VPU_CS_MAX) fmt->fmt.pix_mp.colorspace = 0; return 1; } Loading
drivers/media/platform/msm/vpu/vpu_configuration.h +3 −1 Original line number Diff line number Diff line /* Copyright (c) 2013, The Linux Foundation. All rights reserved. /* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -47,6 +47,8 @@ int apply_vpu_control_extended(struct vpu_client *client, int cmd, void *get_control(struct vpu_controller *controller, u32 id); int configure_colorspace(struct vpu_dev_session *session, int port); int configure_nr_buffers(struct vpu_dev_session *session, const struct vpu_ctrl_auto_manual *nr); Loading
drivers/media/platform/msm/vpu/vpu_ioctl.c +11 −2 Original line number Diff line number Diff line /* Copyright (c) 2013, The Linux Foundation. All rights reserved. /* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -471,9 +471,14 @@ int vpu_get_fmt(struct vpu_client *client, struct v4l2_format *f) if (port == INPUT_PORT) { ret = vpu_hw_session_g_input_params(session->id, &in_param); translate_input_format_to_api(&in_param, f); f->fmt.pix_mp.colorspace = session->port_info[INPUT_PORT].format.colorspace; } else { ret = vpu_hw_session_g_output_params(session->id, &out_param); translate_output_format_to_api(&out_param, f); f->fmt.pix_mp.colorspace = session->port_info[OUTPUT_PORT].format.colorspace; } return ret; Loading Loading @@ -547,8 +552,12 @@ int vpu_set_fmt(struct vpu_client *client, struct v4l2_format *f) session->port_info[INPUT_PORT].scan_mode = translate_v4l2_scan_mode(pix_mp->field); ret = commit_port_config(session, port, 1); ret = configure_colorspace(session, port); if (ret) goto exit; ret = commit_port_config(session, port, 1); exit: mutex_unlock(&session->lock); return ret; } Loading
drivers/media/platform/msm/vpu/vpu_translate.c +56 −1 Original line number Diff line number Diff line /* Copyright (c) 2013, The Linux Foundation. All rights reserved. /* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -131,6 +131,61 @@ u32 translate_pixelformat_to_hfi(u32 api_pix_fmt) return hfi_pix_fmt; } void translate_colorspace_to_hfi(u32 api_colorspace, struct vpu_prop_session_color_space *cs_1, struct vpu_prop_session_color_space *cs_2) { switch (api_colorspace) { case VPU_CS_RGB_FULL: cs_1->cs_config = CONFIG_RGB_RANGE; cs_1->value = RGB_RANGE_FULL; break; case VPU_CS_RGB_LIMITED: cs_1->cs_config = CONFIG_RGB_RANGE; cs_1->value = RGB_RANGE_LIMITED; break; case VPU_CS_REC601_FULL: cs_1->cs_config = CONFIG_NOMINAL_RANGE; cs_1->value = NOMINAL_RANGE_FULL; cs_2->cs_config = CONFIG_YCBCR_MATRIX; cs_2->value = YCbCr_MATRIX_BT601; break; case VPU_CS_REC601_LIMITED: cs_1->cs_config = CONFIG_NOMINAL_RANGE; cs_1->value = NOMINAL_RANGE_LIMITED; cs_2->cs_config = CONFIG_YCBCR_MATRIX; cs_2->value = YCbCr_MATRIX_BT601; break; case VPU_CS_REC709_FULL: cs_1->cs_config = CONFIG_NOMINAL_RANGE; cs_1->value = NOMINAL_RANGE_FULL; cs_2->cs_config = CONFIG_YCBCR_MATRIX; cs_2->value = YCbCr_MATRIX_BT709; break; case VPU_CS_REC709_LIMITED: cs_1->cs_config = CONFIG_NOMINAL_RANGE; cs_1->value = NOMINAL_RANGE_LIMITED; cs_2->cs_config = CONFIG_YCBCR_MATRIX; cs_2->value = YCbCr_MATRIX_BT709; break; case VPU_CS_SMPTE240_FULL: cs_1->cs_config = CONFIG_NOMINAL_RANGE; cs_1->value = NOMINAL_RANGE_FULL; cs_2->cs_config = CONFIG_YCBCR_MATRIX; cs_2->value = YCbCr_MATRIX_BT240; break; case VPU_CS_SMPTE240_LIMITED: cs_1->cs_config = CONFIG_NOMINAL_RANGE; cs_1->value = NOMINAL_RANGE_LIMITED; cs_2->cs_config = CONFIG_YCBCR_MATRIX; cs_2->value = YCbCr_MATRIX_BT240; break; default: pr_warn("Unsupported api colorspace %d\n", api_colorspace); break; } } u32 translate_input_source(u32 in) { u32 hfi_source = 100; /* invaid */ Loading
drivers/media/platform/msm/vpu/vpu_translate.h +5 −1 Original line number Diff line number Diff line /* Copyright (c) 2013, The Linux Foundation. All rights reserved. /* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -28,6 +28,10 @@ u32 translate_output_destination(u32 out); u32 translate_pixelformat_to_hfi(u32 api_pix_fmt); u32 translate_pixelformat_to_api(u32 hfi_pix_fmt); void translate_colorspace_to_hfi(u32 api_colorspace, struct vpu_prop_session_color_space *cs_1, struct vpu_prop_session_color_space *cs_2); void translate_input_format_to_hfi(const struct vpu_port_info *port_info, struct vpu_prop_session_input *in); void translate_output_format_to_hfi(const struct vpu_port_info *port_info, Loading