From patchwork Wed Jun 27 15:27:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 140345 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp1028060ljj; Wed, 27 Jun 2018 08:31:14 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcl7nbEDeMeVJVd7GFX7XOmZlr1gOayBAIQg1BCdfLt3KUoYLm+A4XoYSs8Qesv0gFV7p3A X-Received: by 2002:a62:820a:: with SMTP id w10-v6mr6233500pfd.71.1530113474621; Wed, 27 Jun 2018 08:31:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530113474; cv=none; d=google.com; s=arc-20160816; b=p+G7eK6QH7Dq1Nr/m0xM5dvn684+KxqMEK880+hJIkuj99Z0rS5p8rmkxLdeTfPwU6 rR7sPg+xs+8Y82qUTCCyHXrAl/i7U/TP9FKztp//4BUVz0kFdzjPi8MqUlyBfo3rKs2t nQRIjzV62PiIpkIk202Io26HmjYcuQaDN6DeGSKEXq8SGl3zo1e0iZON/eh5VHL6DZgE sws6CZulVcUXHhCtVwRTTquOPeV58AIeKkQPjHUj9xnFC29hpwoiXguLYF5YnoaeRYgG +Y8eMUIHAKHIkCV5m/w9hzmbxIFLLAjB3KTbn2T7jIDLfwK46a7GJc96C7JRbakLXCXj kUyg== 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=dBNFMYHtBk25cq657W5saatgm8VT3r2BxDc+quPr6ks=; b=P64Zzceh3MHPkiV2cghuLjMNT5hXVVAeaY8RpHPxdW1wNUzLw1y1aD+vPdMcKfCVRG 4IPC5z1Cusq9al0kk3FF+7SSJCQnQNz3kgv0yXcSsxsCwLWhP0IBfaNlHRhPvJfSNtZY uf5iapDf1qQcLCJ1JO9nrIZeY0D36NHBcvts4BImNloJFDRUoR7e5UTkeipHd4CgFfde 8dFO7g9O3Y7zB90r0zmei9W6CbozFya5/GeamLVwPCXgiGxIxhXKyxue7JfDbVA8jreQ ZjO5Sp33Npqu+MWXXbDs4XuYL/bOE8JVW216n/8PDmRu2DMqggzR2bVA09Sp1XjIaXSQ Shyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="PAX/j7JN"; spf=pass (google.com: best guess record for domain of linux-media-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-media-owner@vger.kernel.org; dmarc=pass (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 g5-v6si3819352pgp.91.2018.06.27.08.31.14; Wed, 27 Jun 2018 08:31:14 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-media-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="PAX/j7JN"; spf=pass (google.com: best guess record for domain of linux-media-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-media-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965578AbeF0PbL (ORCPT + 4 others); Wed, 27 Jun 2018 11:31:11 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:56072 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934938AbeF0P2V (ORCPT ); Wed, 27 Jun 2018 11:28:21 -0400 Received: by mail-wm0-f66.google.com with SMTP id v16-v6so6340635wmv.5 for ; Wed, 27 Jun 2018 08:28:20 -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=dBNFMYHtBk25cq657W5saatgm8VT3r2BxDc+quPr6ks=; b=PAX/j7JN8AxISUMxyJyg51rqePRavoKFk9K917ZcvsOszrJJWk5qqfB6t8SzWmAlcd ECUN2FQ+m9JZ7/3JfrB9+Y5CIgVJ5bZ8gHn9tzvFej1xW1sZG3lQfdWrBsKyM6wY+dGt Erzpmy9rGRAQzuPFO43CkRegVJejuSnvEkNoI= 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=dBNFMYHtBk25cq657W5saatgm8VT3r2BxDc+quPr6ks=; b=CH0AeDs3xgHaqrqKT0mev1V9/Zghi+5lADd3Lar2MKgtUHJVUxaLPPRJv2SQVjksO8 WsobwVZhHw/Ay+2BD3uwRjquZaKjP1IBave4TLfs2YLUnygIyw59fJ4uF3+DpiQt2+pi /xb06n9bHRaC4+dV9TNqAzWCoGrPDpp/miD0ZKfHXrQospNORlx8KTvR8beHkdO8Wa6C lBSBNMdW3WHqLT+Jp/mvHlJOvFG1S3j0YQpqvZ/e2ljewv7RWHhLZ4RFYUqEMquDMbz2 5IawyKQEuIrSXEHQUUPmMxMka0IP7gv7FxFN0p0BToalU3VZdmcR0In9zT2/ujvKPAWR 96Eg== X-Gm-Message-State: APt69E2Wwe8zKC2WkkaaFzNqr3W6bMm53zhGLfCd4G2fSkmxIUwi1qD3 TfcA/6RDcqec42f8hWh56HNddA== X-Received: by 2002:a1c:aa12:: with SMTP id t18-v6mr5219571wme.54.1530113299674; Wed, 27 Jun 2018 08:28:19 -0700 (PDT) Received: from mms-0440.qualcomm.mm-sol.com ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id o203-v6sm2916075wmd.30.2018.06.27.08.28.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 27 Jun 2018 08:28:19 -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 , Stanimir Varbanov Subject: [PATCH v4 18/27] venus: helpers: add a new helper to set raw format Date: Wed, 27 Jun 2018 18:27:16 +0300 Message-Id: <20180627152725.9783-19-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180627152725.9783-1-stanimir.varbanov@linaro.org> References: <20180627152725.9783-1-stanimir.varbanov@linaro.org> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@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 diff --git a/drivers/media/platform/qcom/venus/helpers.c b/drivers/media/platform/qcom/venus/helpers.c index 2eeb243e4dbe..a1590d5cc921 100644 --- a/drivers/media/platform/qcom/venus/helpers.c +++ b/drivers/media/platform/qcom/venus/helpers.c @@ -407,6 +407,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) { @@ -488,35 +502,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) { - struct hfi_uncompressed_format_select fmt; u32 ptype = HFI_PROPERTY_PARAM_UNCOMPRESSED_FORMAT_SELECT; - int ret; + struct hfi_uncompressed_format_select fmt; + + 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);