From patchwork Wed Jun 27 15:27:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 140340 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp1026499ljj; Wed, 27 Jun 2018 08:30:07 -0700 (PDT) X-Google-Smtp-Source: AAOMgpel7Xu9frQL+zItV8DMPK7gLFWhaJlWcjoMjfxpD4G7ktFAuCh7z/t3VQULm2jXR8MLl+p6 X-Received: by 2002:a63:b00f:: with SMTP id h15-v6mr5161490pgf.442.1530113406973; Wed, 27 Jun 2018 08:30:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530113406; cv=none; d=google.com; s=arc-20160816; b=kTGFURc0I6eE/DAq9oCS7XWb1Dfktm82bf89RkRBx/2P0UTrD5XKVI11ChZ7Rgqvcu fifxwRxJv2G7ugLFYUsuf/hi7TAPQTz7QxRQWn3tW0qur8PdcKLFui3IuURQOWLPpGjg ie6axUr5GgGNvcIVM9BCAP4+sE6/V4uEnggLUayZ2vI8PO9HLJeVirfNXGY/7lDrmz1B R7qfFVMC4mWqpJGtQP3a2EiE6Ca2C0b0Aq6CySrd8YK4Vk7WgoNbFkbhBtuQs5JYQaT6 RCLeg5fZOKShbOiuYyUGQF3Pwexs9jh/xi4dtzmHdQkiHWWmP/qQOjygHdlIWMBpw+tp JJ8g== 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=+ssufRupM9PR8pPvQwm/oq0OgQo86xh959S5/coLDU0=; b=IyOkuuvQhg771jS+xDzoZMbyhWJrF8oqjBb/7/JR2mrUctDer5eB5rFIHd+aHMvwYk SEt3PA2MXvzUxwRF4IXt44h3clakxUTGOaOxPTqsjxCp9uSMBA2JvN9I1CASq0BEMzvJ 1ztwWfIFy6snSEF7j636EL4rSWhklfJ+0mWNcfHQJDx4HQCo+pI05fLOPa/w6NwOGy4g H46UbcO8PxrMzIWe2EXRmkKNdODe/PPRhaj5rPsABQwJgpGnzqrq2KZAs0H/KAhIcOwo ruztMZiVzmgl0jTwSCFX1K5E552kURfn6WzQTAb41nmGYjapgcvOfNx9ZstcxtZ01D1d h+BQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FRDJndGe; 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 j10-v6si3940956pff.269.2018.06.27.08.30.06; Wed, 27 Jun 2018 08:30:06 -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=FRDJndGe; 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 S965245AbeF0P2Z (ORCPT + 4 others); Wed, 27 Jun 2018 11:28:25 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:52283 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934924AbeF0P2R (ORCPT ); Wed, 27 Jun 2018 11:28:17 -0400 Received: by mail-wm0-f65.google.com with SMTP id e69-v6so3402161wme.2 for ; Wed, 27 Jun 2018 08:28:16 -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=+ssufRupM9PR8pPvQwm/oq0OgQo86xh959S5/coLDU0=; b=FRDJndGeLO6T30aFBXt+ka12bRhUi4mBx3XxdjQDypdkW8l3fgdngkKvKySig+4QrS y9TwB6jrKDV2AOjjTbDMBO7ieTFQfuNpjgf4b36OI5zmwDpzEHQo9yHUVYF61ALC6r79 ylYEP/wB/WjqFfVxxbsejhp/+8U1WkCAU6EQk= 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=+ssufRupM9PR8pPvQwm/oq0OgQo86xh959S5/coLDU0=; b=oGj40U2Cxxx5iiPL1XJTdLqpFaRX/HebMxumOU7ZI5RbMPyvBrwCDUNp4o3YaWoDpV 01GFDb1RfNbdu1B7kU3Kb7TZuiDGG2kyeeFjGc6UxQ+kdWRSMRM9pbXXt3uV5M95Lx81 2M1Bia8S/rR9g35xGiCylUrLpOIzU0/p0vODjLoZNNT1/hnbCREmSndVHSc3I3IIvYIc Aax3iiSRbbunTXq3nLZJfDlKmPSnVLQlUFdY+YdzdFjqAsnlR4pjZxtCNH29L0A0CrZT ZDNq1KKFAseESC5qlVaxKLBso7iBuhNDAu4cHwPGiSfMMO1pmLFzvVRl16yAtOTPvm1D 5fhA== X-Gm-Message-State: APt69E39k2eRkFD4zKSGzVmHNjKOKw0dcbGBhq124YnZfWjORAuPvRWG 1Yz4wPUEt/QReZRhwI8OHoHzOQ== X-Received: by 2002:a1c:b590:: with SMTP id e138-v6mr2406569wmf.154.1530113296331; Wed, 27 Jun 2018 08:28:16 -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.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 27 Jun 2018 08:28:15 -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 15/27] venus: helpers: add helper function to set actual buffer size Date: Wed, 27 Jun 2018 18:27:13 +0300 Message-Id: <20180627152725.9783-16-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 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 Reviewed-by: Tomasz Figa --- 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(-) -- 2.14.1 diff --git a/drivers/media/platform/qcom/venus/helpers.c b/drivers/media/platform/qcom/venus/helpers.c index e3dc2772946f..0cce664f093d 100644 --- a/drivers/media/platform/qcom/venus/helpers.c +++ b/drivers/media/platform/qcom/venus/helpers.c @@ -541,6 +541,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 92669a358a90..eae9c651ac91 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; }