Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1740364imu; Thu, 24 Jan 2019 00:44:48 -0800 (PST) X-Google-Smtp-Source: ALg8bN7ltqBpmRzb8r3bhaWcKu4ub45J4jfzWobBtsTRIFGb2hVMgQoSi7h263uw54iE6fmJZJr0 X-Received: by 2002:a63:f30d:: with SMTP id l13mr5138013pgh.399.1548319488779; Thu, 24 Jan 2019 00:44:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548319488; cv=none; d=google.com; s=arc-20160816; b=UAJhCDCCKwmfjozx6AoHpJ+/E5SoMflWGEYmgto2BHA29cTQy1K6musMavjnyfg4+9 s4o2AVHjhRQMgHHY+HG2OaC09iweXfS1Rae31DXLDND6160pw+YPv9KXIGN4ib58yOmr r3Pf2bJlSDa1Xw9xJtD2DJhdJW4t16LXXFNe7RVzJDafWtonMXu9+XaOjOXsk8/8j+Qo xl0axfe3Cyzhh39QLcprIWZXjNhQWMXCIu1NLzOHhId8v8dDwMk4piocO+mADsh9RgkH /Hbd2gECbm2l5hSpXQIj9Q6XA3Qa4HQCBXs9mkORRPrkRoxzqyRhnsi7dCHPvuK5OiGu 3uuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=WdibVqAgbR5ok31tdt/O+WwBRfsYGvLwJnb1/CwmST4=; b=BuxLydx8c8Fs3dYurYIiGpZ30EWlUD4DPn0IUVabVZrW9r1qiphYW5Rm6Qt7mCBQdm QLMf7z2mwDWN3Hsbu3GtbduEuFvBvyEwRVNuyXJC5Un729X2qHg9BqH9TNQNY9wpzDwH Yktms/edzhnT+hYqxa34T9O8fxB/6ffrsJn1ay4Yl2kfgrzzrqChZJjyHkjLnWaIQcUD GLSl0qyN0CPCWypuFL1Ukm0YIx943DmKhnO9gmkMLyMZFx4th+oZDrNHX5tIzNeKV4yA rjyl6x6bnKSekdY41Z6k15j+FllkAKsiwR6GYbfG1ghlHCQT3Wz10MBGiER12G7+JESR thpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=QgFqV6Wz; 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=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a4si20408635pls.262.2019.01.24.00.44.33; Thu, 24 Jan 2019 00:44:48 -0800 (PST) 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=@chromium.org header.s=google header.b=QgFqV6Wz; 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=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727582AbfAXIni (ORCPT + 99 others); Thu, 24 Jan 2019 03:43:38 -0500 Received: from mail-oi1-f196.google.com ([209.85.167.196]:43921 "EHLO mail-oi1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727572AbfAXIni (ORCPT ); Thu, 24 Jan 2019 03:43:38 -0500 Received: by mail-oi1-f196.google.com with SMTP id u18so4183236oie.10 for ; Thu, 24 Jan 2019 00:43:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=WdibVqAgbR5ok31tdt/O+WwBRfsYGvLwJnb1/CwmST4=; b=QgFqV6WzKgpjdFy8xOlY7wKGE4wo8hKQpaBCLDmH/VH+sKxK5DMPTb4rAd8AKAHWK/ RK6ylLa+fF5AbTabu0OBYUBMzlPS9rxThwEJLAsDzVSbizvyMPYpIsSBMLcTvmBGbwOW KfiOeCIOBSJ8F0mHQVzu1Pqn37n9OJzQHKkNg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=WdibVqAgbR5ok31tdt/O+WwBRfsYGvLwJnb1/CwmST4=; b=nYFE3I7z5pGqx4zNjjpLkdNGMIypgmK/+cs6gLIMtJLQrYWEDJo+wWvJrXE3753CI6 dBiK1J651Gxb6D0u3Glu9cDoTIsPbSi6j1+djHWXwVMt3NohQkdptY9waW0IM7Yvy85n tMAFUt965PHxMUNg0SXP3yTcak7ZyRqPXdEnfZsUyfhdssvJzLijF0YphTvuCRooTFor al9rV+VWuQunRvUgYvCk9rfTWiC4+NrmqdBon9O9R1FQriPa/iUej8dRGHWlkq5VvVV6 lQ73TqbVO327Rml7Og0c2PIcK2zMM82GXYwq39PFpd08QMmasrNjpuiAC3qqm5VQFHI2 HQwg== X-Gm-Message-State: AJcUukd3UJztWOlxouT4fU90GY5qtJwXxcewykLhgYParg3A9VZ4XBjj 8eG2jH9tjqMloWfa2Va4mxrA0unaxt0= X-Received: by 2002:a54:4f86:: with SMTP id g6mr533155oiy.205.1548319416724; Thu, 24 Jan 2019 00:43:36 -0800 (PST) Received: from mail-oi1-f175.google.com (mail-oi1-f175.google.com. [209.85.167.175]) by smtp.gmail.com with ESMTPSA id r1sm8521110oti.44.2019.01.24.00.43.35 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 24 Jan 2019 00:43:36 -0800 (PST) Received: by mail-oi1-f175.google.com with SMTP id c206so4242090oib.0 for ; Thu, 24 Jan 2019 00:43:35 -0800 (PST) X-Received: by 2002:a54:4486:: with SMTP id v6mr555965oiv.233.1548319415393; Thu, 24 Jan 2019 00:43:35 -0800 (PST) MIME-Version: 1.0 References: <20190117162008.25217-1-stanimir.varbanov@linaro.org> <20190117162008.25217-8-stanimir.varbanov@linaro.org> In-Reply-To: <20190117162008.25217-8-stanimir.varbanov@linaro.org> From: Alexandre Courbot Date: Thu, 24 Jan 2019 17:43:24 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 07/10] venus: helpers: add three more helper functions To: Stanimir Varbanov Cc: Linux Media Mailing List , Mauro Carvalho Chehab , Hans Verkuil , LKML , linux-arm-msm@vger.kernel.org, Vikash Garodia , Tomasz Figa , Malathi Gottam Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 18, 2019 at 1:21 AM Stanimir Varbanov wrote: > > 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(+) > > 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) Does this function actually reallocate buffers? It seems to just free what we had previously. > +{ > + 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 > -- > 2.17.1 >