From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 36558C83012 for ; Wed, 2 Dec 2020 10:29:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C57E0221FB for ; Wed, 2 Dec 2020 10:29:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729476AbgLBK2r (ORCPT ); Wed, 2 Dec 2020 05:28:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33628 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728555AbgLBK2r (ORCPT ); Wed, 2 Dec 2020 05:28:47 -0500 Received: from mail-ed1-x543.google.com (mail-ed1-x543.google.com [IPv6:2a00:1450:4864:20::543]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E7554C0613D4 for ; Wed, 2 Dec 2020 02:28:06 -0800 (PST) Received: by mail-ed1-x543.google.com with SMTP id c7so3116487edv.6 for ; Wed, 02 Dec 2020 02:28:06 -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=pOIFH2c7aUrVRRVYvlUc1syo0njMuyaej3dxXHicsn4=; b=ty5mGyimYDzNAdXwX4p0YYa/HTJwKSg39bxZcVdfLzO5uBXF7g9TAzd3ltuq7gSK57 K6XqMTxW3lF+x5bN6nQzDY/rURK4j2m1C/B/9uYhnIcTDWTw2UZIREILi5FF70l4jRSf RVLsuwHSioHJJpwEBEeksk54zPu+K9N7FfpKw7FSizTGbP+ok45jdcyZQxk5FmT5Iwcv tT7JoKoCuOBEEHlkPo+GPSc1oVJSIBItWQDNyJho0YrUzsmWJi8qdQ/NuvUFrB0U8wsI Fos44l+j/d5kJR7oQaYPodtpXkEn1ze/wWbL73hIK4hv/ZiRZgcqaSd0nhuUN6i5E7UY khxQ== 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=pOIFH2c7aUrVRRVYvlUc1syo0njMuyaej3dxXHicsn4=; b=Bx6whsGfLVvYdJkBfSRppWgZK+AawkjYWuZlZcBPoQRvhgJ7bcoXaS6qVMCQMXcGY2 bQFr1H64U8SkE6h4+Kftj0b/i0+HPQs7T2oQ9sJ8JF7itNK+ORxbm6KcfNfpS4+dKHqP n4fJuDez29vYCml3zpftX/0AmL8WI/tkecETsG9Nx770lQ3wcE0LevvEAI/pnc8rMIg7 FMbMA+FOzNtVZE2uYEMVgmehA7/uZCqBESrrDYg9KhmQebJl6jpd511JUT3/caIewuq3 WL7rtR8BtZp/YDAYoptle48CI2gl0PU2dIgGpApGED2i9W4ZzpMe5nKLsdLwAfxSYoGQ +T3g== X-Gm-Message-State: AOAM532dhZgJFWqSHSjuiFqiR1xn2zfousS6LP3eqe4Va/BaRnuz/qwi ONBc/WPItwXSb38Phn9tDL4DXw== X-Google-Smtp-Source: ABdhPJzzpjIL5eskPImxD4ZAPuWyPJAyD6Vtl15araHbU4xgAdWPTaamVhoHl/cKP4dVI8Fl6aes+w== X-Received: by 2002:a50:d8c8:: with SMTP id y8mr1878914edj.82.1606904885590; Wed, 02 Dec 2020 02:28:05 -0800 (PST) Received: from [192.168.0.3] (hst-221-33.medicom.bg. [84.238.221.33]) by smtp.googlemail.com with ESMTPSA id n17sm779483ejh.49.2020.12.02.02.28.04 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 02 Dec 2020 02:28:05 -0800 (PST) Subject: Re: [PATCH] media: venus: preserve DRC state across seeks To: Alexandre Courbot Cc: Linux Media Mailing List , linux-arm-msm@vger.kernel.org, LKML References: <20201202053424.3286774-1-acourbot@chromium.org> From: Stanimir Varbanov Message-ID: <89086086-c0d9-62b0-2819-a537fe92782f@linaro.org> Date: Wed, 2 Dec 2020 12:28:03 +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: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Hi, On 12/2/20 12:24 PM, Alexandre Courbot wrote: > On Wed, Dec 2, 2020 at 2:34 PM 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. > > Oops, please ignore as this seems to depend on another patch... I will > repost once I can figure out the correct dependency chain, unless > Stanimir can find a better way to handle DRC during seek and flush. This patch depends on [1] series which is still under review. [1] https://www.spinics.net/lists/linux-media/msg177801.html > >> >> 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; >> inst->reconfig = true; >> v4l2_event_queue_fh(&inst->fh, &ev); >> wake_up(&inst->reconf_wait); >> -- >> 2.29.2.454.gaff20da3a2-goog >> -- regards, Stan