Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1091790pxu; Thu, 17 Dec 2020 01:49:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJwxNFWsNoZAco12ZqsSnyrKmk9z5H4FUPQ5Vrb2xNseWoNm6Mfkiy6C1WtHWcyzZ9HH6Zgl X-Received: by 2002:a17:906:9a07:: with SMTP id ai7mr34838974ejc.216.1608198539880; Thu, 17 Dec 2020 01:48:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608198539; cv=none; d=google.com; s=arc-20160816; b=uB4QTUKuEmp83yWAealiJ7JgYWsKQhj0Qt+pHxe8dBabMu4lkqh3/sfjyU/mAvD031 uUZhvxDEPhYqXOumGxthhZawY9lhvP/8SeySLeBxcdL0PBkISy9YFiTQJgJDzz8D/JQK GVqejuKuR1y66ogybMqjdXKv8CnxJwREFERzO1V79It3FJzt7dvm5qIx2dvuUoxO/P30 J6BVNPZItYIG/ULx2zi7JI+NYNbb5SEOqXbeQBUnqqow4xUVmEdK/U2u3xvEDspsv5Wg E8l8oWQlmUewbNC/hZcsa9/9Ugt4rIQLqLX7Sg46lmw70Q9PzEQnJxEvBRgfFCTojXm1 gXkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=qs9G1Hna8FkBf2U6+3PXrFWB1lYrYKjRbwLmbEVDCSA=; b=rXeqfypznVnxCpQrIlIdfYkdc4PEA0axRSuiVb6CewJflFoRsoNH4pOwffWUpR6/fX KUWivTJ9jZqz//dLw1hlKThrUmRKI2oun3/Fz1d6prf+73LATZSDk+8qsp1yFa66ESBu HNECl+f3jUhFzQZYIDiYFh7dPQe/wRHf2UvicEuHPDTgG/vf99n3R1WBXhCjFm60Zuuc 3N7wKAqwm2p5S3xQX4u35X03gtBtXNn7N0PlEbLYenorzVqh4YZw9Qt94HegYgiS+feJ IJt4Upgqyq9a3CU4uQ47jG7aNyCuccB8A2jGjjDhOtvTdf+BdntCbnZWsiWD+Qs+bnT7 PjVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=N3vnIoF+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id u23si3801867eds.248.2020.12.17.01.48.37; Thu, 17 Dec 2020 01:48:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=N3vnIoF+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1728100AbgLQJq5 (ORCPT + 99 others); Thu, 17 Dec 2020 04:46:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727767AbgLQJq4 (ORCPT ); Thu, 17 Dec 2020 04:46:56 -0500 Received: from mail-ed1-x534.google.com (mail-ed1-x534.google.com [IPv6:2a00:1450:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EED53C061285 for ; Thu, 17 Dec 2020 01:46:15 -0800 (PST) Received: by mail-ed1-x534.google.com with SMTP id q16so27938209edv.10 for ; Thu, 17 Dec 2020 01:46:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=qs9G1Hna8FkBf2U6+3PXrFWB1lYrYKjRbwLmbEVDCSA=; b=N3vnIoF+/gaqAFgniw8NeEhMQDYOrBskumgwQ3O8y03aarMUdEz0RbfezB7KPfb2Nb ORN1bAqwLGanHEXDeORKayuExhSAcVPyhxEFGJiRLr1hIUmQsZUYHGXWl2VTt2fDUTj2 Dp0BSJggXRG7zQrCXC+Gh1zl8COmTYJdGt37CC/04j00HL4T/eK3wy0PmMs/7Vevw+w2 q10EgBFo6oihBZBbNbbD9/ynB9Clt1dn1Pe0VN35GBRkgfE9ZGzWccOWy0SbF1gzHMNx iFm+T7xBg4ci8Utf39+lMzZJ/kdZzu+UF3jE01UGlgcnWL+wIySdoUd4a4HK9ACeJsl2 saAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=qs9G1Hna8FkBf2U6+3PXrFWB1lYrYKjRbwLmbEVDCSA=; b=rACfbdjPtCDyebK/YUjcv9lQ1jj9hXRUw+MCv/SfSGvHq/sqcEZZAlWaeV8ng66nVn MA5l7qGW8PVZ4a6yqO4RnNC23pVGQmRotxkDX1X+RzKeqrPGZXz5n4kkWV6sQ0U+DsQB MwR0f3rmnpSzOaXRIYKoGSjyo0NXdI5qaixv22XfPmWPpkPJBbv2edyqSQdtP7nbX3BY rdRujDefkBHbBhy7eiDhD1opSGOYaw8WJqGVKVyQ3G6QDMUdLfUk0lGCbgpCS/VnDR1J EIh/6k56oJLYCr+fy+TvTPvOo+IR5wBQE5GKMyARRPYjdVUeoSDTB06fP4Pr+lCJcVWg Qn3w== X-Gm-Message-State: AOAM532pt8xEth2J76FzWo/CvL4GnCF68Co273yHmwQsQw0KBXO8bl1M AUi/k/Cqwo6jJ4A+aIzgMOhSpwqJeNreG7mt X-Received: by 2002:a05:6402:13d1:: with SMTP id a17mr37073638edx.202.1608198374469; Thu, 17 Dec 2020 01:46:14 -0800 (PST) Received: from [192.168.0.3] (hst-221-81.medicom.bg. [84.238.221.81]) by smtp.googlemail.com with ESMTPSA id o13sm22683887edr.94.2020.12.17.01.46.12 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 17 Dec 2020 01:46:13 -0800 (PST) Subject: Re: [PATCH] media: venus: preserve DRC state across seeks To: Alexandre Courbot , Stanimir Varbanov Cc: linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org References: <20201202053424.3286774-1-acourbot@chromium.org> From: Stanimir Varbanov Message-ID: <02c8623d-66b6-b4d3-8bb2-43dc78c3d5d6@linaro.org> Date: Thu, 17 Dec 2020 11:46:12 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20201202053424.3286774-1-acourbot@chromium.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Alex, On 12/2/20 7:34 AM, Alexandre Courbot wrote: > DRC events can happen virtually at anytime, including when we are > starting a seek. Should this happen, we must make sure to return to the > DRC state, otherwise the firmware will expect buffers of the new > resolution whereas userspace will still work with the old one. > > Returning to the DRC state upon resume for seeking makes sure that the > client will get the DRC event and will reallocate the buffers to fit the > firmware's expectations. > > Signed-off-by: Alexandre Courbot > --- > drivers/media/platform/qcom/venus/vdec.c | 11 +++++++++-- > 1 file changed, 9 insertions(+), 2 deletions(-) > > diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/platform/qcom/venus/vdec.c > index 8488411204c3..e3d0df7fd765 100644 > --- a/drivers/media/platform/qcom/venus/vdec.c > +++ b/drivers/media/platform/qcom/venus/vdec.c > @@ -972,7 +972,10 @@ static int vdec_start_output(struct venus_inst *inst) > > if (inst->codec_state == VENUS_DEC_STATE_SEEK) { > ret = venus_helper_process_initial_out_bufs(inst); > - inst->codec_state = VENUS_DEC_STATE_DECODING; > + if (inst->next_buf_last) > + inst->codec_state = VENUS_DEC_STATE_DRC; > + else > + inst->codec_state = VENUS_DEC_STATE_DECODING; > goto done; > } > > @@ -1077,8 +1080,10 @@ static int vdec_stop_capture(struct venus_inst *inst) > ret = hfi_session_flush(inst, HFI_FLUSH_ALL, true); > fallthrough; > case VENUS_DEC_STATE_DRAIN: > - vdec_cancel_dst_buffers(inst); > inst->codec_state = VENUS_DEC_STATE_STOPPED; > + fallthrough; > + case VENUS_DEC_STATE_SEEK: > + vdec_cancel_dst_buffers(inst); > break; > case VENUS_DEC_STATE_DRC: > WARN_ON(1); > @@ -1102,6 +1107,7 @@ static int vdec_stop_output(struct venus_inst *inst) > case VENUS_DEC_STATE_DECODING: > case VENUS_DEC_STATE_DRAIN: > case VENUS_DEC_STATE_STOPPED: > + case VENUS_DEC_STATE_DRC: > ret = hfi_session_flush(inst, HFI_FLUSH_ALL, true); > inst->codec_state = VENUS_DEC_STATE_SEEK; > break; > @@ -1371,6 +1377,7 @@ static void vdec_event_change(struct venus_inst *inst, > dev_dbg(dev, VDBGH "flush output error %d\n", ret); > } > > + inst->next_buf_last = true; Setting next_buf_last unconditionally makes me think can we reuse inst->reconfig instead? > inst->reconfig = true; > v4l2_event_queue_fh(&inst->fh, &ev); > wake_up(&inst->reconf_wait); > -- regards, Stan