From patchwork Thu Jul 5 13:03:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 141135 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp1922774ljj; Thu, 5 Jul 2018 06:09:03 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcIJig8SUDrAd1NNIAmZLihBC2qfzXyFfKZpeD1lpMbsFmb8KijoMx7p0bpXktdW0ecFgGx X-Received: by 2002:a62:4ece:: with SMTP id c197-v6mr6437936pfb.240.1530796143329; Thu, 05 Jul 2018 06:09:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530796143; cv=none; d=google.com; s=arc-20160816; b=ZOEBntAvVv3S4zSZbLBqc0yVWdI3+pPKQIhXStpRG1Yqt2xyoq31XHBDA53e7Q4o1Q S3bRgjgnAuubAuSbk8vl6iGNLqE+7EjftkTYQTYrJLYUkgrylS1Uqza9ZXw1b/YhlSCP YeRkmTHFFNmDQ6EeMyih8Z4EckDGd0F60yZiKAwQBqXamCTrIQsTcfREBRAdNkuZGAT1 6vSW8DPZXkCs/k04ujtKG0bwRkBj25+E2sks5lHb/Mzcwhj6w2mO+ReP6triGUaEvkSr bn/eOUvxIL8GfoY22FBrQfKpNptPfwoiEMH9kpW1VGwDqMnnFMCI60oAe/YggU9rsJ9N S38A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=wy9DYft3c2tGcMabTQhgj6VntbANhHTXg8GE/1KNNrk=; b=Nq55/0fSgnDltNnh32iBhlnPyZKyvFCIKhxTRRVnqgSdmw3z72PGX6nhSWjKI4mo8k KRBiFWQwp96pASyDOGQ1pfdpePsY0GbmF17HTCB56nWe5HVlqPK2NfkyHKhrY9/lWDGL QACQpEkIoo63LGuLy2HyktLRbmZT56VmyFoes7kGZvjgm80wjlwmqDzCFwG2VUWmAzgz 5VNSAOuXbUFp0akLcHT27OHcYPg2ixkhL2e3GwjkWnixC2uLX6cv+uTgQm+tAMcRzAvi 1k4fp7dZHIV7feecSBRPLTeeP+8d//6ZrT3OG2M9JDIS7WyQq5g0LQzY5M14MDxuCm3D RBKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=ARsYTs3v; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 62-v6si5900266ply.176.2018.07.05.06.09.03; Thu, 05 Jul 2018 06:09:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=ARsYTs3v; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754650AbeGENIv (ORCPT + 13 others); Thu, 5 Jul 2018 09:08:51 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:55405 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754457AbeGENF2 (ORCPT ); Thu, 5 Jul 2018 09:05:28 -0400 Received: by mail-wm0-f65.google.com with SMTP id v16-v6so11019884wmv.5 for ; Thu, 05 Jul 2018 06:05:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=xjY2pgEoTA9v1GrVLiJUVDtWBCCmEDIrn4PrFqxnYRw=; b=ARsYTs3v6lFEkzXCmw8I0Cfe4mVJ2ViQCjSlhZy95NOXUaMka8YJQrB9ePCF9NHZ6D 8L6KUJgieytQzjeHwPkDb0Ae5AxExIuU0SMspMilyPsixSOWXOp8ErsKOV/Y53LKhEco lLPRG7duYQFoliOJfR32zRNQJyPWFrmJaud+I= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=xjY2pgEoTA9v1GrVLiJUVDtWBCCmEDIrn4PrFqxnYRw=; b=h8M8b2qEneyHxGUwprFWmHWedFxQfMlLei7TQC63gMhzbaCDPe+Fb+/hqkI1CeJyZQ KKEEVELiMN2Xcm3dwOBSDWU4LW150tmX9K71BCj5EH2oy1RV9od3MHGnKTp74CsUT5qc Ytq79yWi42xyuVS9HkiosYY128mezx4UljEoFVk6+um7nXlgevkaCL83lPshqpvg1CKZ 56DeKNwbx9PSnO37CfruzPLITiEwysxwOjA8OI+fOVbW4OCxODsGSwL6egUktnb6nl2i fgFaoMRxe9035Eled7Q4ZWSU28tbfkk1qpG1NWp6dV3O1GWMsJ4I2+lw3nEfwi0ay2La tAnw== X-Gm-Message-State: APt69E3W0Do47D8ROxUYa/KBPhWdPDJ5L/zfIIn2bEMrD7COxDDPG0il 7J/gd4qQqyI+XiAJbMBLG/VbfQ== X-Received: by 2002:a1c:ac03:: with SMTP id v3-v6mr3963295wme.100.1530795926779; Thu, 05 Jul 2018 06:05:26 -0700 (PDT) Received: from mms-0440.qualcomm.mm-sol.com ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id 11-v6sm2109102wrw.67.2018.07.05.06.05.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Jul 2018 06:05:26 -0700 (PDT) From: Stanimir Varbanov To: Mauro Carvalho Chehab , Hans Verkuil Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Vikash Garodia , Tomasz Figa , Alexandre Courbot , Stanimir Varbanov Subject: [PATCH v5 18/27] venus: helpers: add a new helper to set raw format Date: Thu, 5 Jul 2018 16:03:52 +0300 Message-Id: <20180705130401.24315-19-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180705130401.24315-1-stanimir.varbanov@linaro.org> References: <20180705130401.24315-1-stanimir.varbanov@linaro.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org The new helper will has one more argument for buffer type, that way the decoder can configure the format on it's secondary output. Signed-off-by: Stanimir Varbanov Reviewed-by: Tomasz Figa --- drivers/media/platform/qcom/venus/helpers.c | 52 ++++++++++++++++++----------- drivers/media/platform/qcom/venus/helpers.h | 2 ++ 2 files changed, 35 insertions(+), 19 deletions(-) -- 2.14.1 -- To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/media/platform/qcom/venus/helpers.c b/drivers/media/platform/qcom/venus/helpers.c index 7e764eeeb07c..4e4109e80988 100644 --- a/drivers/media/platform/qcom/venus/helpers.c +++ b/drivers/media/platform/qcom/venus/helpers.c @@ -412,6 +412,20 @@ static int session_register_bufs(struct venus_inst *inst) return ret; } +static u32 to_hfi_raw_fmt(u32 v4l2_fmt) +{ + switch (v4l2_fmt) { + case V4L2_PIX_FMT_NV12: + return HFI_COLOR_FORMAT_NV12; + case V4L2_PIX_FMT_NV21: + return HFI_COLOR_FORMAT_NV21; + default: + break; + } + + return 0; +} + int venus_helper_get_bufreq(struct venus_inst *inst, u32 type, struct hfi_buffer_requirements *req) { @@ -493,35 +507,35 @@ int venus_helper_set_num_bufs(struct venus_inst *inst, unsigned int input_bufs, } EXPORT_SYMBOL_GPL(venus_helper_set_num_bufs); -int venus_helper_set_color_format(struct venus_inst *inst, u32 pixfmt) +int venus_helper_set_raw_format(struct venus_inst *inst, u32 hfi_format, + u32 buftype) { + const u32 ptype = HFI_PROPERTY_PARAM_UNCOMPRESSED_FORMAT_SELECT; struct hfi_uncompressed_format_select fmt; - u32 ptype = HFI_PROPERTY_PARAM_UNCOMPRESSED_FORMAT_SELECT; - int ret; + + fmt.buffer_type = buftype; + fmt.format = hfi_format; + + return hfi_session_set_property(inst, ptype, &fmt); +} +EXPORT_SYMBOL_GPL(venus_helper_set_raw_format); + +int venus_helper_set_color_format(struct venus_inst *inst, u32 pixfmt) +{ + u32 hfi_format, buftype; if (inst->session_type == VIDC_SESSION_TYPE_DEC) - fmt.buffer_type = HFI_BUFFER_OUTPUT; + buftype = HFI_BUFFER_OUTPUT; else if (inst->session_type == VIDC_SESSION_TYPE_ENC) - fmt.buffer_type = HFI_BUFFER_INPUT; + buftype = HFI_BUFFER_INPUT; else return -EINVAL; - switch (pixfmt) { - case V4L2_PIX_FMT_NV12: - fmt.format = HFI_COLOR_FORMAT_NV12; - break; - case V4L2_PIX_FMT_NV21: - fmt.format = HFI_COLOR_FORMAT_NV21; - break; - default: + hfi_format = to_hfi_raw_fmt(pixfmt); + if (!hfi_format) return -EINVAL; - } - ret = hfi_session_set_property(inst, ptype, &fmt); - if (ret) - return ret; - - return 0; + return venus_helper_set_raw_format(inst, hfi_format, buftype); } EXPORT_SYMBOL_GPL(venus_helper_set_color_format); diff --git a/drivers/media/platform/qcom/venus/helpers.h b/drivers/media/platform/qcom/venus/helpers.h index 0de9989adcdb..79af7845efbd 100644 --- a/drivers/media/platform/qcom/venus/helpers.h +++ b/drivers/media/platform/qcom/venus/helpers.h @@ -40,6 +40,8 @@ int venus_helper_set_output_resolution(struct venus_inst *inst, u32 buftype); int venus_helper_set_num_bufs(struct venus_inst *inst, unsigned int input_bufs, unsigned int output_bufs); +int venus_helper_set_raw_format(struct venus_inst *inst, u32 hfi_format, + u32 buftype); int venus_helper_set_color_format(struct venus_inst *inst, u32 fmt); int venus_helper_set_dyn_bufmode(struct venus_inst *inst); int venus_helper_set_bufsize(struct venus_inst *inst, u32 bufsize, u32 buftype);