mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
To: Sachin Kumar Garg <sachin.garg@oss.qualcomm.com>
Cc: Vikash Garodia <vikash.garodia@oss.qualcomm.com>,
	Dikshita Agarwal <dikshita.agarwal@oss.qualcomm.com>,
	Abhinav Kumar <abhinav.kumar@linux.dev>,
	Bryan O'Donoghue <bod@kernel.org>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 2/2] media: iris: add support for vbv delay
Date: Sun, 4 Oct 2026 01:28:11 +0300	[thread overview]
Message-ID: <zttltt3f5zmajyy2fbhod5vc7x4l7l6htcalu5hpbrpmd2kgze@p675hgd5pwko> (raw)
In-Reply-To: <1eeccb79-540f-4a84-987c-77dc2b05fd18@oss.qualcomm.com>

On Tue, Sep 29, 2026 at 09:37:38PM +0530, Sachin Kumar Garg wrote:
> 
> 
> On 9/29/2026 8:35 PM, Dmitry Baryshkov wrote:
> > On Tue, 29 Sept 2026 at 14:54, Sachin Kumar Garg
> > <sachin.garg@oss.qualcomm.com> wrote:
> > > 
> > > 
> > > 
> > > On 9/27/2026 11:55 PM, Dmitry Baryshkov wrote:
> > > > On Sun, Sep 27, 2026 at 09:27:46AM +0530, Sachin Kumar Garg wrote:
> > > > > Add the VBV_DELAY instance capability for the HFI Gen2 encoder,
> > > > > exposed to userspace via V4L2_CID_MPEG_VIDEO_VBV_DELAY and mapped to
> > > > > HFI_PROP_VBV_DELAY through a new iris_set_vbv_delay(). The property
> > > > > is only meaningful for CBR rate-control modes.
> > > > > 
> > > > > Low VBV delay values (34-100 ms) require the encoder to run
> > > > > with a single video pipe, so extend iris_set_pipe() to force
> > > > > work_route to 1 whenever the configured VBV_DELAY falls in that
> > > > > range.
> > > > > 
> > > > > Reviewed-by: Vikash Garodia <vikash.garodia@oss.qualcomm.com>
> > > > > Signed-off-by: Sachin Kumar Garg <sachin.garg@oss.qualcomm.com>
> > > > > ---
> > > > >    drivers/media/platform/qcom/iris/iris_ctrls.c      | 37 +++++++++++++++++++++-
> > > > >    drivers/media/platform/qcom/iris/iris_ctrls.h      |  1 +
> > > > >    drivers/media/platform/qcom/iris/iris_hfi_gen2.c   | 12 ++++++-
> > > > >    .../platform/qcom/iris/iris_hfi_gen2_defines.h     |  1 +
> > > > >    .../platform/qcom/iris/iris_platform_common.h      |  1 +
> > > > >    5 files changed, 50 insertions(+), 2 deletions(-)
> > > > > 
> > > > > @@ -541,8 +545,19 @@ int iris_set_stage(struct iris_inst *inst, enum platform_inst_fw_cap_type cap_id
> > > > >    int iris_set_pipe(struct iris_inst *inst, enum platform_inst_fw_cap_type cap_id)
> > > > >    {
> > > > >       const struct iris_hfi_session_ops *hfi_ops = inst->hfi_session_ops;
> > > > > -    u32 work_route = inst->fw_caps[PIPE].value;
> > > > > +    u32 work_route = inst->fw_caps[PIPE].max;
> > > > 
> > > > Why is being set to the max value instead of using the .value?
> > > > 
> > > 
> > > fw_caps[PIPE].min/.max/.value are all seeded from the same platform
> > > constant (num_vpp_pipe) at init, so .max and .value were interchangeable
> > > before this patch. This patch now writes the applied pipe count back
> > > into .value (used elsewhere for power/cycle estimation), which makes
> > > .value stateful. Since iris_set_pipe() is re-invoked on every resolution
> > > change while streaming, seeding work_route from .value would let a
> > > previous single-pipe override persist as the new baseline on the next
> > > call, even after the VBV-delay/CBR condition no longer applies. Reading
> > > from .max instead keeps the default pipe count stable and re-evaluates
> > > the workaround fresh on every call.
> > 
> > With the .value being written, does it need a lock protection?
> > 
> No — inst->lock already serializes this. iris_set_pipe()'s write to
> fw_caps[PIPE].value only happens inside start_streaming
> (iris_venc/vdec_streamon_output(), both the iris_set_properties() cap loop
> and the DRC re-apply path), and start_streaming takes inst->lock before
> reaching either. The only reader outside that same call chain is the
> power/clock-scaling code (iris_vpu3x_vpu4x_calculate_frequency()), which is
> only invoked via iris_scale_power(), itself called from start_streaming and
> buf_queue — both of which also hold inst->lock. So writer and readers
> already can't run concurrently; adding a lock here would just be redundant
> with the existing vb2-op locking, and no other .set() callback in this file
> takes one either.

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>


-- 
With best wishes
Dmitry

      reply	other threads:[~2026-10-03 22:28 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-30 14:55 [PATCH 0/2] media: iris: add vbv delay support Sachin Kumar Garg
2026-07-30 14:55 ` [PATCH 1/2] media: iris: enable pipe for hfi gen2 encoder Sachin Kumar Garg
2026-09-22 13:50   ` Vikash Garodia
2026-07-30 14:55 ` [PATCH 2/2] media: iris: add support for vbv delay Sachin Kumar Garg
2026-09-22 13:51   ` Vikash Garodia
2026-09-26 13:08 ` [PATCH v2 0/2] media: iris: add vbv delay support Sachin Kumar Garg
2026-09-26 13:08   ` [PATCH v2 1/2] media: iris: enable pipe for hfi gen2 encoder Sachin Kumar Garg
2026-09-26 13:08   ` [PATCH v2 2/2] media: iris: add support for vbv delay Sachin Kumar Garg
2026-09-26 17:09   ` [PATCH v3 0/2] media: iris: add vbv delay support Sachin Kumar Garg
2026-09-26 17:09     ` [PATCH v3 1/2] media: iris: enable pipe for hfi gen2 encoder Sachin Kumar Garg
2026-09-26 17:09     ` [PATCH v3 2/2] media: iris: add support for vbv delay Sachin Kumar Garg
2026-09-27  3:57     ` [PATCH v4 0/2] media: iris: add vbv delay support Sachin Kumar Garg
2026-09-27  3:57       ` [PATCH v4 1/2] media: iris: enable pipe for hfi gen2 encoder Sachin Kumar Garg
2026-09-27 18:23         ` Dmitry Baryshkov
2026-09-27  3:57       ` [PATCH v4 2/2] media: iris: add support for vbv delay Sachin Kumar Garg
2026-09-27 18:25         ` Dmitry Baryshkov
2026-09-29 11:53           ` Sachin Kumar Garg
2026-09-29 15:05             ` Dmitry Baryshkov
2026-09-29 16:07               ` Sachin Kumar Garg
2026-10-03 22:28                 ` Dmitry Baryshkov [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=zttltt3f5zmajyy2fbhod5vc7x4l7l6htcalu5hpbrpmd2kgze@p675hgd5pwko \
    --to=dmitry.baryshkov@oss.qualcomm.com \
    --cc=abhinav.kumar@linux.dev \
    --cc=bod@kernel.org \
    --cc=dikshita.agarwal@oss.qualcomm.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=sachin.garg@oss.qualcomm.com \
    --cc=vikash.garodia@oss.qualcomm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®