Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp267538imm; Tue, 15 May 2018 01:09:13 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqbEqrNZqyk73GONc1XieLBFDzbNyfhm7dihUElkisAi6N1dN6hAyAk1awwJLVzT/jr68xA X-Received: by 2002:a17:902:5c6:: with SMTP id f64-v6mr13336478plf.77.1526371752957; Tue, 15 May 2018 01:09:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526371752; cv=none; d=google.com; s=arc-20160816; b=I1hHCCmXZj25J9KTRC/x2SoBBL5e3tPD234n7vXQVWvzCfe1gKv0u4b/UoVBmT3zLH m08gtP8y3+GZXwEHeifB+p1F4Uq7pIaMoL9hbHlpDmruXiRSAOcr8NvruZymqEZFqTMK +bfojGHH5kwyR5QCbPeNGMpcidSURhwlKbpnmmFl4hBPTXkJyXXjOjmrApi43VykcLuE pcLxSNNk4HPLOrRX4J2kLT911xNBeycL+/InZkCCLRMU5MTNeepP0+f+F/pFBEbj5ZZp 4e2CCnTtRn6qrb/30bcJhhgS1vbZWbXelsw5HbIJ5lx8n6z1pZeRNvhM8r3H3n50Gvwp mlHA== 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=zJxnpqaIIqZtdOKFlNGYC5gg+khf/QPmLkujQMd3QTs=; b=vdvgC4xyeV81pPFvSQ/Z5bR+bB5Otv9Kufn5E4FEWEaC55UDuIEijS0DyQhCwqPhT8 dgObnDelLVkH9oP6wwDD/At7LsBewEIk6EFYpLpGNLmXa3+lJc9aPO3x5odRCx8LM4iv PDKNhXREKFAwYdcvuVhrYQN19LezAIo4XrCaLZwo48Q69ixVPgTWKfCEaiycMEPbWY+q 2bXRQZ4StRhkZZDP+9m/T6Pljm3p33dkcp69n1o+sK7s0uzGYtn8vh963zfz3q3oiLYW q7Rwogt3bntGtokH91T9stckBiwwz3VYT94MRt7gKNOSrinFUkJwxhiPx3jHhkj4Szhc PWtw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZAJ7XiVR; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 m26-v6si11084364pfa.45.2018.05.15.01.08.58; Tue, 15 May 2018 01:09:12 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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=ZAJ7XiVR; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 S1752698AbeEOIGb (ORCPT + 99 others); Tue, 15 May 2018 04:06:31 -0400 Received: from mail-wr0-f194.google.com ([209.85.128.194]:37204 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752562AbeEOH7r (ORCPT ); Tue, 15 May 2018 03:59:47 -0400 Received: by mail-wr0-f194.google.com with SMTP id h5-v6so14902565wrm.4 for ; Tue, 15 May 2018 00:59:46 -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=zJxnpqaIIqZtdOKFlNGYC5gg+khf/QPmLkujQMd3QTs=; b=ZAJ7XiVRqN+rP8ZWjFxT4DnjjxuecrOcRi0HG83jhBVYNMvHjMao0yL8E2AtKi6XjC gTKU0MQ0+5ZTntU+vbFYGJ2AOOn6u8l42e8W+w3Jyaznz1BhCRBxXA4Lu9bwAbhRGDUl LEn3j0/UQi/9ECKwg7LeZ5DR/fHKUZCIdWTew= 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=zJxnpqaIIqZtdOKFlNGYC5gg+khf/QPmLkujQMd3QTs=; b=H7xl+T/KqLazdEBgzpkZf7R2S0OXIqjL73YgVW9DOt9UxZaRhg6FHh9CdAd45ZdjVQ 8ZsnqNM2ias3iSyeOd8ntUn6iU4Zcvs+r0mw1t4eS2rFORksUtzSVQ0xITWRXM3wmeKp 9bZ4auMuY47cSQXyBX2jahVrXvaoljjzL+PJpkkwDKNMNhQdXHvEUG39Q2ixjtWtnTSa IYDG5w5mtS7wy/RYlCdeJrgh8cNW3JOjnMTbHtl6y2Q3IzjpFo2IEFaysujcnuFldQY6 gt+kScMDlnR29XAf9m9NN4/mHqF0nnoSIGpPh7c/IUHbyAqzvYx/ZQm8MYop429Puh9G y2fg== X-Gm-Message-State: ALKqPwcfl/grlQJ/lOBaLyXvo0+bUila5UfeDumQJaBhVvem9QUQTCPZ ktIE9B3b/y2Ig+33mOXnzY5PHojMZJA= X-Received: by 2002:adf:e78b:: with SMTP id n11-v6mr9049314wrm.192.1526371185922; Tue, 15 May 2018 00:59:45 -0700 (PDT) Received: from mms-0440.qualcomm.mm-sol.com ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id 4-v6sm10918510wmg.40.2018.05.15.00.59.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 15 May 2018 00:59:45 -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 , Stanimir Varbanov Subject: [PATCH v2 17/29] venus: add helper function to set actual buffer size Date: Tue, 15 May 2018 10:58:47 +0300 Message-Id: <20180515075859.17217-18-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180515075859.17217-1-stanimir.varbanov@linaro.org> References: <20180515075859.17217-1-stanimir.varbanov@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add and use a helper function to set actual buffer size for particular buffer type. This is also preparation to use the second decoder output. Signed-off-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/helpers.c | 12 ++++++++++++ drivers/media/platform/qcom/venus/helpers.h | 1 + drivers/media/platform/qcom/venus/vdec.c | 10 ++-------- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/drivers/media/platform/qcom/venus/helpers.c b/drivers/media/platform/qcom/venus/helpers.c index 824ad4d2d064..94664a3ce3e2 100644 --- a/drivers/media/platform/qcom/venus/helpers.c +++ b/drivers/media/platform/qcom/venus/helpers.c @@ -544,6 +544,18 @@ int venus_helper_set_dyn_bufmode(struct venus_inst *inst) } EXPORT_SYMBOL_GPL(venus_helper_set_dyn_bufmode); +int venus_helper_set_bufsize(struct venus_inst *inst, u32 bufsize, u32 buftype) +{ + u32 ptype = HFI_PROPERTY_PARAM_BUFFER_SIZE_ACTUAL; + struct hfi_buffer_size_actual bufsz; + + bufsz.type = buftype; + bufsz.size = bufsize; + + return hfi_session_set_property(inst, ptype, &bufsz); +} +EXPORT_SYMBOL_GPL(venus_helper_set_bufsize); + static void delayed_process_buf_func(struct work_struct *work) { struct venus_buffer *buf, *n; diff --git a/drivers/media/platform/qcom/venus/helpers.h b/drivers/media/platform/qcom/venus/helpers.h index 52b961ed491e..cd306bd8978f 100644 --- a/drivers/media/platform/qcom/venus/helpers.h +++ b/drivers/media/platform/qcom/venus/helpers.h @@ -41,6 +41,7 @@ int venus_helper_set_num_bufs(struct venus_inst *inst, unsigned int input_bufs, unsigned int output_bufs); 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); void venus_helper_acquire_buf_ref(struct vb2_v4l2_buffer *vbuf); void venus_helper_release_buf_ref(struct venus_inst *inst, unsigned int idx); void venus_helper_init_instance(struct venus_inst *inst); diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/platform/qcom/venus/vdec.c index 271192273953..e8e00d0650e9 100644 --- a/drivers/media/platform/qcom/venus/vdec.c +++ b/drivers/media/platform/qcom/venus/vdec.c @@ -710,7 +710,6 @@ static int vdec_start_streaming(struct vb2_queue *q, unsigned int count) { struct venus_inst *inst = vb2_get_drv_priv(q); struct venus_core *core = inst->core; - u32 ptype; int ret; mutex_lock(&inst->lock); @@ -740,13 +739,8 @@ static int vdec_start_streaming(struct vb2_queue *q, unsigned int count) goto deinit_sess; if (core->res->hfi_version == HFI_VERSION_3XX) { - struct hfi_buffer_size_actual buf_sz; - - ptype = HFI_PROPERTY_PARAM_BUFFER_SIZE_ACTUAL; - buf_sz.type = HFI_BUFFER_OUTPUT; - buf_sz.size = inst->output_buf_size; - - ret = hfi_session_set_property(inst, ptype, &buf_sz); + ret = venus_helper_set_bufsize(inst, inst->output_buf_size, + HFI_BUFFER_OUTPUT); if (ret) goto deinit_sess; } -- 2.14.1