Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp612047pxu; Tue, 1 Dec 2020 21:38:02 -0800 (PST) X-Google-Smtp-Source: ABdhPJzmhu0u3EKnQGauEBsMnA8Ittw1YcfGOlFz+mUt0XZvtL3X+Du9+jElmofewESSNY7RvfLU X-Received: by 2002:a17:906:971a:: with SMTP id k26mr772119ejx.279.1606887482753; Tue, 01 Dec 2020 21:38:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606887482; cv=none; d=google.com; s=arc-20160816; b=PfY6fGryiruEPm4oqeBXdDAz5GG58PYtqckyWw/+UQIvSxWzpiGjGcICJlnBxpvA0i YL45eaw6ub8LwlZJbAfC8yy9oi37fWpR0bzVsmai+5482C6js3Tq30IlZkCu7klMo7LB jomF6F8f39uhMZlWiXoNlByOvp4uNJs0LN4YlhRQISVLqT3ljUYgfAMVjNAlt43w65eM +u4X7DplaEXKYJZKjK4XpnzgQY4qI85i++XTsqA/jfHLB/9wCFXDCJR0t3d6SNkHc3Ui OavVvLW893U4zs3FARbav4MFzCK/VrdraSy9iOjsbi+4SzA3hULrOf9jRhlHElcboLBE a+0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=sik+f/8dnNc/1d+9ZjFIrdy+AbOu+lGJYDKoQ11nPsM=; b=kc8uEpHdMarh8yytQb6tpLCtIp6AIOz7qzkDmawuY6vg/N2l3nOAqzRQBq/Tm1N51M kNhKsI9aE3aSPIy5Y6bTvYYXqM2m3J71kW/Lb4rW7nMQs26UGVC6dI3j43ZYyi70Ipl/ cRQei+3VAU32NOXL3j6HXdJAiX+NAyW5pqnZg2I+x0998npUrtEkFK3iTMFrzV77UAk8 FqyNfoBqRg4dgthXXjZX9sufhmp2VrQYR2vP+HGmFpxX0UaMq7A+Va6pGG4WyLRLljol l5QxUaycfC3j0NJ/XiX6yMZUmBDFy5C8D+JGVCSEd1dc2NlqqMjG2JmmCewO8chJp7lN M1Jg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=cF2fB0qS; 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=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n19si395360eda.345.2020.12.01.21.37.36; Tue, 01 Dec 2020 21:38:02 -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=@chromium.org header.s=google header.b=cF2fB0qS; 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=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728503AbgLBFfL (ORCPT + 99 others); Wed, 2 Dec 2020 00:35:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44866 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726228AbgLBFfL (ORCPT ); Wed, 2 Dec 2020 00:35:11 -0500 Received: from mail-pf1-x441.google.com (mail-pf1-x441.google.com [IPv6:2607:f8b0:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1AD45C0613D6 for ; Tue, 1 Dec 2020 21:34:31 -0800 (PST) Received: by mail-pf1-x441.google.com with SMTP id s21so498733pfu.13 for ; Tue, 01 Dec 2020 21:34:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=sik+f/8dnNc/1d+9ZjFIrdy+AbOu+lGJYDKoQ11nPsM=; b=cF2fB0qSj0Qccv1ckETTttkVFWJQCbFazEin2dD5sm/QaCmzuwNCeeDjdJEjQ3LB2R tNaRfRjvv/Th39pNUwNRM2rCe1fDJ3zQVrwXd3NqUOQWrTeMBJPHp+OnHhhWO5BLOamo SUHd7xnm6xOGTuJeJ8VV9zq7OQOAJXIxNQCnk= 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:mime-version :content-transfer-encoding; bh=sik+f/8dnNc/1d+9ZjFIrdy+AbOu+lGJYDKoQ11nPsM=; b=MGuQRpDVe2P+59SS0I3qftYgvB+ZukMO5UJMoLr1FWZRHpwUW24+FU7vkvtHb0C15v nSCS30SB/hvsV4kUgTIDf4/8joPs1aVOaxIogs0i15tALnvc20rIgOKMHPWQ3qcREb7P +569mSF/6+fkl/FXQswqO8h+zHMO/+OcUEsNLyybzsYJlAf+4g5hMGCbLdwHtQYIN7yv jcP8jmO41PrQwnXRClBzNGyjusph8YSTkQy7JpxxdocsB/tEvNx8YNolnSsikIjeM06r j3fjKjuZBTD+bG/JfQeABQesp0mrtKSuEkDaxEsPKUud5tDmE2HFEGH/H+RbuCmIutz9 lq1g== X-Gm-Message-State: AOAM530bZ0yO9hv+Hdlj2OMRXuQo8sCSSIvo+f/rmuC5nuz/o25gGYJH 8pU/Srasbmn9O4hWmWO50cs6Ng== X-Received: by 2002:a62:a11a:0:b029:18a:df9e:f537 with SMTP id b26-20020a62a11a0000b029018adf9ef537mr1036557pff.29.1606887270467; Tue, 01 Dec 2020 21:34:30 -0800 (PST) Received: from acourbot.tok.corp.google.com ([2401:fa00:8f:203:eeb1:d7ff:fe57:b7e5]) by smtp.gmail.com with ESMTPSA id q72sm730790pfq.62.2020.12.01.21.34.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Dec 2020 21:34:29 -0800 (PST) From: Alexandre Courbot To: Stanimir Varbanov Cc: linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Alexandre Courbot Subject: [PATCH] media: venus: preserve DRC state across seeks Date: Wed, 2 Dec 2020 14:34:24 +0900 Message-Id: <20201202053424.3286774-1-acourbot@chromium.org> X-Mailer: git-send-email 2.29.2.454.gaff20da3a2-goog MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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; inst->reconfig = true; v4l2_event_queue_fh(&inst->fh, &ev); wake_up(&inst->reconf_wait); -- 2.29.2.454.gaff20da3a2-goog