From patchwork Thu Jan 17 16:20:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 155840 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp2158762jaa; Thu, 17 Jan 2019 08:21:13 -0800 (PST) X-Google-Smtp-Source: ALg8bN7WIJ0/Lxe8PK0j2BsN4GMCIsNdLprBdKSEPL7xgOJYXX0732Mcs8zufbTwz8towk4Mw8K3 X-Received: by 2002:a17:902:d68c:: with SMTP id v12mr15481202ply.4.1547742072867; Thu, 17 Jan 2019 08:21:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547742072; cv=none; d=google.com; s=arc-20160816; b=QWoPVeAaFLsUxAgdrPeJmaNhoCndK9DYz6ftXo3PEJvaVgyHtW+1H4FrlO/GZOTMCn CeRiEtHar6ba2oWp4gTBu8kGZ8RluR9j7cBM1fQKfWCQl34cOY07ElFSI+e1sQhWTvfS 4fiXDSREqp4TsNv9+14f9eSt/5s//kM7RNYiWe1U09ayiF9HenPchb7tvzYJVgg0iBBX DC9fB+fjB0i9mDkDr23AP7ZQatnCd7Pm0CvFQ2vUSSxD0QDwvFo0jg4YnSDrpFaSVNef fBA1GQQPF5TPy+XwbRPXjWa+BA10bShD/A9CM9nI/svMnQXlbfeckgVDPVP7Vm156my7 FNLA== 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; bh=MkbOUFHDsrDG1TGvqhepL8zE+1a5aus1syCufXPfhww=; b=N8RVOv0o+5j6OP9jpkvdVbGBJvncaQFKCMGvHSEIKMSG0raRvw1/9ZcTGBfG74HSFY wt+lfHehYmydYcTbJRS8eZFIUVjRPPeCYh0vnxqKTiw1LXWn6hhitOiNO+LLjYOK94Xp ZS6NS5rcAWCyX6etaygQ3B+nltHi/Kb6bwYOmTIikN/+ccFj61lM/7yfrlw4m6rgITpi 5MJUgTrAQQ9rdCtTYOZQ/McuDRgXwSr5SKfh8meGYH+Fj81ZE1RIIafSd0aObo0/okUm E95eNbt9A+kB7tkvEW1NF3MjFj6wjzHGIPwR4JBj+rNCkBAkWooy5SYtdTPpxEHy+0Dg rrXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WRKhZf4R; 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 r17si1958855pls.380.2019.01.17.08.21.12; Thu, 17 Jan 2019 08:21:12 -0800 (PST) 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=WRKhZf4R; 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 S1729130AbfAQQVL (ORCPT + 4 others); Thu, 17 Jan 2019 11:21:11 -0500 Received: from mail-wm1-f68.google.com ([209.85.128.68]:52324 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729108AbfAQQVK (ORCPT ); Thu, 17 Jan 2019 11:21:10 -0500 Received: by mail-wm1-f68.google.com with SMTP id m1so1694172wml.2 for ; Thu, 17 Jan 2019 08:21:08 -0800 (PST) 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=MkbOUFHDsrDG1TGvqhepL8zE+1a5aus1syCufXPfhww=; b=WRKhZf4RUsxe3qwNVAqkut2X4sPhjyKbKboB/6lzkNvpEPB690MAHkE9otoCgA3iCa sEDi+1WICELvvqYkxsUIfeEexgdDrAxRPeJ/eF/uJ05JRhnj4kyyrIouRwEqMwAe11Go Iv9bcBTxbyPc2omRNkdybZCKrY7uq19n5v19g= 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=MkbOUFHDsrDG1TGvqhepL8zE+1a5aus1syCufXPfhww=; b=CP7LgLa6eF02d2ojurFnh6H0KiaiRnxuuxj/Vo+i41rQISQWfeW8Vp3381IwD1/f8n 4FWQy2QybrC/TDaVsd6/u6ohPwe++ZVsLfFleURUdp8s8mDq01iWGInl4wb2fUyRn2nt oPkkG8pF7ehkDJc9NdHCSuIehSznkWcB42JImUGaoISF9E1ApPBeU39A8U3HSXZ2yp6J M8FWqnYOxDlguTUsEqAvHLU76XctORg13X+03OWtKDEU9kw8lTa6455EzD+DwBQJx4b1 +A6ykZNw0pg+EPUoUXZ7wys0IxYxmBbnd97I9u8ddSA7E9kI9q8GbifawvCjNonOUm3y zUJw== X-Gm-Message-State: AJcUukdqM3aXFIcxA7xppBbNz5POXU0WdP+43/fLGTeurlaFdDtYyKUi 9SKiEJDbyV8hAuXvwjxzh1b9RLt5Lb8= X-Received: by 2002:a1c:9d57:: with SMTP id g84mr12654932wme.16.1547742068013; Thu, 17 Jan 2019 08:21:08 -0800 (PST) Received: from localhost.localdomain ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id v133sm31124734wmf.19.2019.01.17.08.21.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 17 Jan 2019 08:21:07 -0800 (PST) From: Stanimir Varbanov To: linux-media@vger.kernel.org Cc: Mauro Carvalho Chehab , Hans Verkuil , linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Vikash Garodia , Tomasz Figa , Alexandre Courbot , Malathi Gottam , Stanimir Varbanov Subject: [PATCH 06/10] venus: hfi: return an error if session_init is already called Date: Thu, 17 Jan 2019 18:20:04 +0200 Message-Id: <20190117162008.25217-7-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190117162008.25217-1-stanimir.varbanov@linaro.org> References: <20190117162008.25217-1-stanimir.varbanov@linaro.org> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org This makes hfi_session_init to return an error when it is already called without a call to hfi_session_deinit. Signed-off-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/hfi.c | 3 +++ 1 file changed, 3 insertions(+) -- 2.17.1 diff --git a/drivers/media/platform/qcom/venus/hfi.c b/drivers/media/platform/qcom/venus/hfi.c index eaa82af9ec09..5374655eda39 100644 --- a/drivers/media/platform/qcom/venus/hfi.c +++ b/drivers/media/platform/qcom/venus/hfi.c @@ -207,6 +207,9 @@ int hfi_session_init(struct venus_inst *inst, u32 pixfmt) const struct hfi_ops *ops = core->ops; int ret; + if (inst->state != INST_UNINIT) + return -EINVAL; + inst->hfi_codec = to_codec_type(pixfmt); reinit_completion(&inst->done); From patchwork Thu Jan 17 16:20:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 155841 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp2158803jaa; Thu, 17 Jan 2019 08:21:15 -0800 (PST) X-Google-Smtp-Source: ALg8bN5m8FVsllyBsRo+bIyI/KIM5ayVqfDpzrYWmmsClnLeU60An4rEFeXSkC39R3UhIApKMxr4 X-Received: by 2002:a63:e156:: with SMTP id h22mr14041521pgk.255.1547742075139; Thu, 17 Jan 2019 08:21:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547742075; cv=none; d=google.com; s=arc-20160816; b=DDApu+uJv39sgadeaeuT1um7khcXjRE1qqa0Bo0feDzbYoP3xmr2QbKjc1MtmKE52C 8WV9g/4yM/FubQy9L+JN1PyiTV0Z7Q6n9/o1DTXHLHCeKoRzutoqijjjhNCSLRmX+gi7 ChUOe2ULL/3BDQ0Prxi0d2AOecLz/Kog78MHva6VLTyaKC/N5jNfFPe/2B83jgUK5U6+ 3gTqpgLRfuqPWeVymUtMrDtRjsFI+KiOGYy/l/XKbWyMyR8KnXcIuskqpTeOylqxxSqC 1OIxbrzEdCfpTDGa5V491oSjn+5xsRMxca/59gjS6cYJSDH/Qr6mFgpe0+1HbtvIPsvH +cmA== 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; bh=rqq2iTJQ0mjQYAqKv+ITvoSKpjYT4Sn2iEPmLEqQ1y8=; b=itUoZ/qrYMzAxZk2C3xsrik7jxz/2saNWecshSGOlOadsT5oJBia4JKI9NV9KD1A1u XyC54wKn44WnXIBFDSNOqGf/Lj6TVnkThfWMJ9uMHnZSc+9+IzqyBOFob16z6KzuyNWg A+vj3uKZl8Gzwl5+1DY9nTNxSpFivH4gL0ThhuDd0QjFHne570boDI+qHEl5imXjz4/r hooLPdTO3SWySY51R2krXpSFjiKY8cpVQqrXkBbzyb0qY7fO3WcykPvetTAmbl4CbqJP ypn30TDgfEGYPHC2A/RNa8+a8vql8lmS4tht7CPNQtzZKVdrROIPV4EyufJnwSSOB5tP UYJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fpaoJNuE; 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 r17si1958855pls.380.2019.01.17.08.21.14; Thu, 17 Jan 2019 08:21:15 -0800 (PST) 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=fpaoJNuE; 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 S1729134AbfAQQVN (ORCPT + 4 others); Thu, 17 Jan 2019 11:21:13 -0500 Received: from mail-wm1-f66.google.com ([209.85.128.66]:56058 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729125AbfAQQVM (ORCPT ); Thu, 17 Jan 2019 11:21:12 -0500 Received: by mail-wm1-f66.google.com with SMTP id y139so1664961wmc.5 for ; Thu, 17 Jan 2019 08:21:10 -0800 (PST) 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=rqq2iTJQ0mjQYAqKv+ITvoSKpjYT4Sn2iEPmLEqQ1y8=; b=fpaoJNuEYdX6Q0gc/SsxQ6igfVQvhHken4mff/K5Ft8HGQFDwRbdfnWWzHgsruKouG ElA8aeaDwJxzOvfvsBw7co33LD4k2mu/57A348xKulDYFWcUCYFJFdqtfNFV4FDh4kbp Jh+QuhbhdI3mohfZsg01luVG6YLvIpqntHI4Y= 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=rqq2iTJQ0mjQYAqKv+ITvoSKpjYT4Sn2iEPmLEqQ1y8=; b=YKL9lM7AwqZad1VZp/aQj46DSRf8B9ETs4O6bTaeOll+54/3SBlFXxNAo3pOapmaTO etUhtY9YgxX6WFchXLNG4zFEBIh2a4N+N/PVMxPcfubeDl2lN3vV2lgK9vgnQwkplm/7 94xtyvkxEnRLNhdsYK5i4FXdT6hnxTZff0i7AEf+EWebACM5K1VlIcqIbl/IRpDIQYdi heGd/4XlwQT87j00lWD9z81cOLrZ3tssz3H+r2uEuBBoCDv90HrnEX81SbfsDm7fGnRN bMxG/fhVGZ37mAGQh/d/M3gJ39ltKv9d2Op0mrmqEelK4ZZ9eimOjNKzg6KRpup4qM4B Hnyw== X-Gm-Message-State: AJcUukfYdVZxxU3jLs5B9Ym38WPoPzVmoUP9Rc+qgkdsDiU6euRYiCWU iqNbpk1I6czIrrKxMst/B5ymDEyZZeE= X-Received: by 2002:a1c:de57:: with SMTP id v84mr12264913wmg.55.1547742069669; Thu, 17 Jan 2019 08:21:09 -0800 (PST) Received: from localhost.localdomain ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id v133sm31124734wmf.19.2019.01.17.08.21.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 17 Jan 2019 08:21:09 -0800 (PST) From: Stanimir Varbanov To: linux-media@vger.kernel.org Cc: Mauro Carvalho Chehab , Hans Verkuil , linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Vikash Garodia , Tomasz Figa , Alexandre Courbot , Malathi Gottam , Stanimir Varbanov Subject: [PATCH 07/10] venus: helpers: add three more helper functions Date: Thu, 17 Jan 2019 18:20:05 +0200 Message-Id: <20190117162008.25217-8-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190117162008.25217-1-stanimir.varbanov@linaro.org> References: <20190117162008.25217-1-stanimir.varbanov@linaro.org> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org This adds three more helper functions: * for internal buffers reallocation, applicable when we are doing dynamic resolution change * for initial buffer processing of capture and output queue buffer types All of them will be needed for stateful Codec API support. Signed-off-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/helpers.c | 82 +++++++++++++++++++++ drivers/media/platform/qcom/venus/helpers.h | 2 + 2 files changed, 84 insertions(+) -- 2.17.1 diff --git a/drivers/media/platform/qcom/venus/helpers.c b/drivers/media/platform/qcom/venus/helpers.c index f33bbfea3576..637ce7b82d94 100644 --- a/drivers/media/platform/qcom/venus/helpers.c +++ b/drivers/media/platform/qcom/venus/helpers.c @@ -322,6 +322,52 @@ int venus_helper_intbufs_free(struct venus_inst *inst) } EXPORT_SYMBOL_GPL(venus_helper_intbufs_free); +int venus_helper_intbufs_realloc(struct venus_inst *inst) +{ + enum hfi_version ver = inst->core->res->hfi_version; + struct hfi_buffer_desc bd; + struct intbuf *buf, *n; + int ret; + + list_for_each_entry_safe(buf, n, &inst->internalbufs, list) { + if (buf->type == HFI_BUFFER_INTERNAL_PERSIST || + buf->type == HFI_BUFFER_INTERNAL_PERSIST_1) + continue; + + memset(&bd, 0, sizeof(bd)); + bd.buffer_size = buf->size; + bd.buffer_type = buf->type; + bd.num_buffers = 1; + bd.device_addr = buf->da; + bd.response_required = true; + + ret = hfi_session_unset_buffers(inst, &bd); + + dma_free_attrs(inst->core->dev, buf->size, buf->va, buf->da, + buf->attrs); + + list_del_init(&buf->list); + kfree(buf); + } + + ret = intbufs_set_buffer(inst, HFI_BUFFER_INTERNAL_SCRATCH(ver)); + if (ret) + goto err; + + ret = intbufs_set_buffer(inst, HFI_BUFFER_INTERNAL_SCRATCH_1(ver)); + if (ret) + goto err; + + ret = intbufs_set_buffer(inst, HFI_BUFFER_INTERNAL_SCRATCH_2(ver)); + if (ret) + goto err; + + return 0; +err: + return ret; +} +EXPORT_SYMBOL_GPL(venus_helper_intbufs_realloc); + static u32 load_per_instance(struct venus_inst *inst) { u32 mbs; @@ -1050,6 +1096,42 @@ void venus_helper_vb2_stop_streaming(struct vb2_queue *q) } EXPORT_SYMBOL_GPL(venus_helper_vb2_stop_streaming); +int venus_helper_process_initial_cap_bufs(struct venus_inst *inst) +{ + struct v4l2_m2m_ctx *m2m_ctx = inst->m2m_ctx; + struct v4l2_m2m_buffer *buf, *n; + int ret; + + v4l2_m2m_for_each_dst_buf_safe(m2m_ctx, buf, n) { + ret = session_process_buf(inst, &buf->vb); + if (ret) { + return_buf_error(inst, &buf->vb); + return ret; + } + } + + return 0; +} +EXPORT_SYMBOL_GPL(venus_helper_process_initial_cap_bufs); + +int venus_helper_process_initial_out_bufs(struct venus_inst *inst) +{ + struct v4l2_m2m_ctx *m2m_ctx = inst->m2m_ctx; + struct v4l2_m2m_buffer *buf, *n; + int ret; + + v4l2_m2m_for_each_src_buf_safe(m2m_ctx, buf, n) { + ret = session_process_buf(inst, &buf->vb); + if (ret) { + return_buf_error(inst, &buf->vb); + return ret; + } + } + + return 0; +} +EXPORT_SYMBOL_GPL(venus_helper_process_initial_out_bufs); + int venus_helper_vb2_start_streaming(struct venus_inst *inst) { struct venus_core *core = inst->core; diff --git a/drivers/media/platform/qcom/venus/helpers.h b/drivers/media/platform/qcom/venus/helpers.h index 24faae5abd93..2ec1c1a8b416 100644 --- a/drivers/media/platform/qcom/venus/helpers.h +++ b/drivers/media/platform/qcom/venus/helpers.h @@ -69,4 +69,6 @@ int venus_helper_intbufs_realloc(struct venus_inst *inst); int venus_helper_queue_dpb_bufs(struct venus_inst *inst); int venus_helper_unregister_bufs(struct venus_inst *inst); int venus_helper_load_scale_clocks(struct venus_core *core); +int venus_helper_process_initial_cap_bufs(struct venus_inst *inst); +int venus_helper_process_initial_out_bufs(struct venus_inst *inst); #endif From patchwork Thu Jan 17 16:20:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 155844 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp2159161jaa; Thu, 17 Jan 2019 08:21:34 -0800 (PST) X-Google-Smtp-Source: ALg8bN50B1LY5nkjQvmqLXj2yCwStPxM/93C3085+CZmRbrNTIvudfVVr3Nk3NciP9o588lra7K2 X-Received: by 2002:a17:902:7588:: with SMTP id j8mr15782614pll.215.1547742094227; Thu, 17 Jan 2019 08:21:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547742094; cv=none; d=google.com; s=arc-20160816; b=xE3JVs/oLwaTrmhu6qjJHYVTbk8Cqbs8WimRWGNH1mXygNgXANh1s1V/hrxL06kArd Lb7VH03nTtRWzcP6g6+1wyX5ULxSpHlN36xd6XoZwPnk/Db9YfL8g/rvZOTk7visrA9r 0jl5nBO9OOaodxYz5+A27JqST2IlgG9GIBVt0kAUsHRD3oRDVaqXfYC+9SVdhZgDmobj NCbR9a1n8RUk+wIm/W5mVKMw+G2XU5C9ewNVGmxvbDmyrTbTW4d4qKZEu6jKfWxcj3wf GFcJMmowPK6829SdR2fJQzuJMnYuv5CC4icmtlfLs9gTZPLw2JvrUa8v2JD0+YDGTNY1 CBXA== 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; bh=SNb+6XKLjhFXr1Fd19oZUt5CC0wXzn1Vgn9kxNRJIs0=; b=RkQqk+R5smr5AUGP5hyMGvq051TDXMKuA7BuuUI8VO1JqlNKmlEZ7XR1swqKN85rnD 7pBp22CQTfpbOW18otxCWBXPf8Vo1fcN5Jqih/H4uMoFAhN8QqQsuO6MzNz/yKP1Cp/5 OA8elBv05c2y9tIX6KJKeFIyTsf5w8+eIB14dRfBoXhUuKpiNGwY8E7IweJN9DEMBvXD JblHo/htTcXBlcCi44JP+1rggALvaHgyDJm4KxNDP68I3n19OgpSSYRBfSRwWRT0li3k M4jm9RLlvOPcFMNYMT6UqdMCYt3aH67FlNyEJdTEmnBY63J7DnDNPSqPNvS/70oc4zCa y8oA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gSQu0bn7; 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 w27si1598547pge.182.2019.01.17.08.21.34; Thu, 17 Jan 2019 08:21:34 -0800 (PST) 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=gSQu0bn7; 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 S1729083AbfAQQVd (ORCPT + 4 others); Thu, 17 Jan 2019 11:21:33 -0500 Received: from mail-wr1-f66.google.com ([209.85.221.66]:46573 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729135AbfAQQVN (ORCPT ); Thu, 17 Jan 2019 11:21:13 -0500 Received: by mail-wr1-f66.google.com with SMTP id l9so11617304wrt.13 for ; Thu, 17 Jan 2019 08:21:11 -0800 (PST) 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=SNb+6XKLjhFXr1Fd19oZUt5CC0wXzn1Vgn9kxNRJIs0=; b=gSQu0bn7+O02Yk6QIAPNDwgLFN9/1QiHD7Y7r9xiwfiK2A8k6xb2SBc3Ut5JWrx3Bl p/ZdugOLdtFScafh51vgS+65J/yoxM64/2HBwL6fmXbJBxCpWlYWKIW1V1zN8s0r/JbI XckqEWMvXNs6n7Zx5LE0LUDxztKeZWJ+SHmD4= 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=SNb+6XKLjhFXr1Fd19oZUt5CC0wXzn1Vgn9kxNRJIs0=; b=mal+11OXW5r6QggalykaN9RUwUYKzNLOCrwUCIIBs1woSZId88F5Qz9MPdP1KmZx6k Hxgki2w0EOgtDxIp9AwgizGtKEvU7cZAin94BF8T3QWdhvCy6zTXYFz2yRzyUerKV52u lX/bjcC1Qbu5xVlK6+gjZ51eUhvviprzSuxUVgbtAaMUvlbiw2drXXxCHHBjF3o7Nwui X/bEcOXeg4MnVnLeFfxrOmgBUsWWuKZq/rtZvxhyc2maDcWibCSpCUgHpCfGSF3GYOY/ K8ZC1jT9SQbZ8kLWwUufvWmK8GjiU1CZlvqXVEJ1n7E4Fp+3AraUZKQufd/ScOiT9kms syWQ== X-Gm-Message-State: AJcUukcuhZqxUi3Gq30mv4SYH4UW+7P5kaCLCL3F2qXIGWtNpDxnExaS yBxh9R39m9/p07tVkEP9E2Tv5ITf954= X-Received: by 2002:adf:b6a1:: with SMTP id j33mr12641852wre.55.1547742071200; Thu, 17 Jan 2019 08:21:11 -0800 (PST) Received: from localhost.localdomain ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id v133sm31124734wmf.19.2019.01.17.08.21.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 17 Jan 2019 08:21:10 -0800 (PST) From: Stanimir Varbanov To: linux-media@vger.kernel.org Cc: Mauro Carvalho Chehab , Hans Verkuil , linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Vikash Garodia , Tomasz Figa , Alexandre Courbot , Malathi Gottam , Stanimir Varbanov Subject: [PATCH 08/10] venus: vdec_ctrls: get real minimum buffers for capture Date: Thu, 17 Jan 2019 18:20:06 +0200 Message-Id: <20190117162008.25217-9-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190117162008.25217-1-stanimir.varbanov@linaro.org> References: <20190117162008.25217-1-stanimir.varbanov@linaro.org> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Until now we returned num_output_bufs set during reqbuf but that could be wrong when we implement stateful Codec API. So get the minimum buffers for capture from HFI. This is supposed to be called after stream header parsing, i.e. after dequeue v4l2 event for change resolution. Signed-off-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/vdec_ctrls.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) -- 2.17.1 diff --git a/drivers/media/platform/qcom/venus/vdec_ctrls.c b/drivers/media/platform/qcom/venus/vdec_ctrls.c index f4604b0cd57e..e1da87bf52bc 100644 --- a/drivers/media/platform/qcom/venus/vdec_ctrls.c +++ b/drivers/media/platform/qcom/venus/vdec_ctrls.c @@ -16,6 +16,7 @@ #include #include "core.h" +#include "helpers.h" #include "vdec.h" static int vdec_op_s_ctrl(struct v4l2_ctrl *ctrl) @@ -47,7 +48,9 @@ static int vdec_op_g_volatile_ctrl(struct v4l2_ctrl *ctrl) { struct venus_inst *inst = ctrl_to_inst(ctrl); struct vdec_controls *ctr = &inst->controls.dec; + struct hfi_buffer_requirements bufreq; union hfi_get_property hprop; + enum hfi_version ver = inst->core->res->hfi_version; u32 ptype = HFI_PROPERTY_PARAM_PROFILE_LEVEL_CURRENT; int ret; @@ -71,7 +74,9 @@ static int vdec_op_g_volatile_ctrl(struct v4l2_ctrl *ctrl) ctrl->val = ctr->post_loop_deb_mode; break; case V4L2_CID_MIN_BUFFERS_FOR_CAPTURE: - ctrl->val = inst->num_output_bufs; + ret = venus_helper_get_bufreq(inst, HFI_BUFFER_OUTPUT, &bufreq); + if (!ret) + ctrl->val = HFI_BUFREQ_COUNT_MIN(&bufreq, ver); break; default: return -EINVAL;