All of lore.kernel.org
 help / color / mirror / Atom feed
From: Abhinav Kumar <quic_abhinavk@quicinc.com>
To: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>,
	<freedreno@lists.freedesktop.org>
Cc: markyacoub@chromium.org, liviu.dudau@arm.com,
	dri-devel@lists.freedesktop.org, swboyd@chromium.org,
	seanpaul@chromium.org, laurent.pinchart@ideasonboard.com,
	quic_jesszhan@quicinc.com, quic_aravindh@quicinc.com
Subject: Re: [PATCH v2 09/17] drm/msm/dpu: add an API to reset the encoder related hw blocks
Date: Wed, 20 Apr 2022 14:28:27 -0700	[thread overview]
Message-ID: <13fac83c-99e7-0ca6-f93d-b4e6b975abdb@quicinc.com> (raw)
In-Reply-To: <2f37ee8d-6b6a-3e05-cdb7-cd84d81632bf@linaro.org>



On 4/20/2022 12:23 AM, Dmitry Baryshkov wrote:
> On 20/04/2022 04:46, Abhinav Kumar wrote:
>> Add an API to reset the encoder related hw blocks to ensure
>> a proper teardown of the pipeline. At the moment this is being
>> used only for the writeback encoder but eventually we can start
>> using this for all interfaces.
>>
>> changes in v2:
>>     - split the writeback part to another commit
>>
>> Signed-off-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
> 
> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> 
> A minor question: do we need to also reset the DSPP alongside resetting 
> the LM?

So this function is mostly doing what the downstream equivalent of it 
does which is to disable all the sspp blend stages, the ping-pong 
binding and 3d-merge connection.

For DSPP, there is no ability to *bind* it or connect it. Its a 
hard-wired connection. Its just a question of whether to enable it or not.

When the CTL path connections are removed, there is no need to 
explicitly disable the DSPP.

Thats why even downstream doesnt do it today.

> 
>> ---
>>   drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c      | 82 
>> ++++++++++++++++++++++++
>>   drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h |  7 ++
>>   2 files changed, 89 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c 
>> b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
>> index 4523693..0e31ad3 100644
>> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
>> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
>> @@ -1,5 +1,6 @@
>>   // SPDX-License-Identifier: GPL-2.0-only
>>   /*
>> + * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights 
>> reserved.
>>    * Copyright (c) 2014-2018, 2020-2021 The Linux Foundation. All 
>> rights reserved.
>>    * Copyright (C) 2013 Red Hat
>>    * Author: Rob Clark <robdclark@gmail.com>
>> @@ -22,6 +23,7 @@
>>   #include "dpu_hw_ctl.h"
>>   #include "dpu_hw_dspp.h"
>>   #include "dpu_hw_dsc.h"
>> +#include "dpu_hw_merge3d.h"
>>   #include "dpu_formats.h"
>>   #include "dpu_encoder_phys.h"
>>   #include "dpu_crtc.h"
>> @@ -1838,6 +1840,86 @@ void dpu_encoder_kickoff(struct drm_encoder 
>> *drm_enc)
>>       DPU_ATRACE_END("encoder_kickoff");
>>   }
>> +static void dpu_encoder_helper_reset_mixers(struct dpu_encoder_phys 
>> *phys_enc)
>> +{
>> +    struct dpu_hw_mixer_cfg mixer;
>> +    int i, num_lm;
>> +    u32 flush_mask = 0;
>> +    struct dpu_global_state *global_state;
>> +    struct dpu_hw_blk *hw_lm[2];
>> +    struct dpu_hw_mixer *hw_mixer[2];
>> +    struct dpu_hw_ctl *ctl = phys_enc->hw_ctl;
>> +
>> +    memset(&mixer, 0, sizeof(mixer));
>> +
>> +    /* reset all mixers for this encoder */
>> +    if (phys_enc->hw_ctl->ops.clear_all_blendstages)
>> +        phys_enc->hw_ctl->ops.clear_all_blendstages(phys_enc->hw_ctl);
>> +
>> +    global_state = dpu_kms_get_existing_global_state(phys_enc->dpu_kms);
>> +
>> +    num_lm = dpu_rm_get_assigned_resources(&phys_enc->dpu_kms->rm, 
>> global_state,
>> +        phys_enc->parent->base.id, DPU_HW_BLK_LM, hw_lm, 
>> ARRAY_SIZE(hw_lm));
>> +
>> +    for (i = 0; i < num_lm; i++) {
>> +        hw_mixer[i] = to_dpu_hw_mixer(hw_lm[i]);
>> +        flush_mask = phys_enc->hw_ctl->ops.get_bitmask_mixer(ctl, 
>> hw_mixer[i]->idx);
>> +        if (phys_enc->hw_ctl->ops.update_pending_flush)
>> +            phys_enc->hw_ctl->ops.update_pending_flush(ctl, flush_mask);
>> +
>> +        /* clear all blendstages */
>> +        if (phys_enc->hw_ctl->ops.setup_blendstage)
>> +            phys_enc->hw_ctl->ops.setup_blendstage(ctl, 
>> hw_mixer[i]->idx, NULL);
>> +    }
>> +}
>> +
>> +void dpu_encoder_helper_phys_cleanup(struct dpu_encoder_phys *phys_enc)
>> +{
>> +    struct dpu_hw_ctl *ctl = phys_enc->hw_ctl;
>> +    struct dpu_hw_intf_cfg intf_cfg = { 0 };
>> +    int i;
>> +    struct dpu_encoder_virt *dpu_enc;
>> +
>> +    dpu_enc = to_dpu_encoder_virt(phys_enc->parent);
>> +
>> +    phys_enc->hw_ctl->ops.reset(ctl);
>> +
>> +    dpu_encoder_helper_reset_mixers(phys_enc);
>> +
>> +    for (i = 0; i < dpu_enc->num_phys_encs; i++) {
>> +        if (dpu_enc->phys_encs[i] && 
>> phys_enc->hw_intf->ops.bind_pingpong_blk)
>> +            phys_enc->hw_intf->ops.bind_pingpong_blk(
>> +                    dpu_enc->phys_encs[i]->hw_intf, false,
>> +                    dpu_enc->phys_encs[i]->hw_pp->idx);
>> +
>> +        /* mark INTF flush as pending */
>> +        if (phys_enc->hw_ctl->ops.update_pending_flush_intf)
>> +            
>> phys_enc->hw_ctl->ops.update_pending_flush_intf(phys_enc->hw_ctl,
>> +                    dpu_enc->phys_encs[i]->hw_intf->idx);
>> +    }
>> +
>> +    /* reset the merge 3D HW block */
>> +    if (phys_enc->hw_pp->merge_3d) {
>> +        
>> phys_enc->hw_pp->merge_3d->ops.setup_3d_mode(phys_enc->hw_pp->merge_3d,
>> +                BLEND_3D_NONE);
>> +        if (phys_enc->hw_ctl->ops.update_pending_flush_merge_3d)
>> +            phys_enc->hw_ctl->ops.update_pending_flush_merge_3d(ctl,
>> +                    phys_enc->hw_pp->merge_3d->idx);
>> +    }
>> +
>> +    intf_cfg.stream_sel = 0; /* Don't care value for video mode */
>> +    intf_cfg.mode_3d = dpu_encoder_helper_get_3d_blend_mode(phys_enc);
>> +    if (phys_enc->hw_pp->merge_3d)
>> +        intf_cfg.merge_3d = phys_enc->hw_pp->merge_3d->idx;
>> +
>> +    if (ctl->ops.reset_intf_cfg)
>> +        ctl->ops.reset_intf_cfg(ctl, &intf_cfg);
>> +
>> +    ctl->ops.trigger_flush(ctl);
>> +    ctl->ops.trigger_start(ctl);
>> +    ctl->ops.clear_pending_flush(ctl);
>> +}
>> +
>>   void dpu_encoder_prepare_commit(struct drm_encoder *drm_enc)
>>   {
>>       struct dpu_encoder_virt *dpu_enc;
>> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h 
>> b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h
>> index 706b566..544a9a4 100644
>> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h
>> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h
>> @@ -1,5 +1,6 @@
>>   /* SPDX-License-Identifier: GPL-2.0-only */
>>   /*
>> + * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights 
>> reserved.
>>    * Copyright (c) 2015-2018 The Linux Foundation. All rights reserved.
>>    */
>> @@ -350,4 +351,10 @@ int dpu_encoder_helper_wait_for_irq(struct 
>> dpu_encoder_phys *phys_enc,
>>           void (*func)(void *arg, int irq_idx),
>>           struct dpu_encoder_wait_info *wait_info);
>> +/**
>> + * dpu_encoder_helper_phys_cleanup - helper to cleanup dpu pipeline
>> + * @phys_enc: Pointer to physical encoder structure
>> + */
>> +void dpu_encoder_helper_phys_cleanup(struct dpu_encoder_phys *phys_enc);
>> +
>>   #endif /* __dpu_encoder_phys_H__ */
> 
> 

  reply	other threads:[~2022-04-20 21:28 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-20  1:45 [PATCH v2 00/17] Add writeback block support for DPU Abhinav Kumar
2022-04-20  1:45 ` [PATCH v2 01/17] drm: allow passing possible_crtcs to drm_writeback_connector_init() Abhinav Kumar
2022-04-20  1:45 ` [PATCH v2 02/17] drm: introduce drm_writeback_connector_init_with_encoder() API Abhinav Kumar
2022-04-20  1:45 ` [PATCH v2 03/17] drm: allow real encoder to be passed for drm_writeback_connector Abhinav Kumar
2022-04-20  1:45 ` [PATCH v2 04/17] drm/msm/dpu: add writeback blocks to the sm8250 DPU catalog Abhinav Kumar
2022-04-21 12:16   ` Liviu Dudau
2022-04-22 23:08     ` Abhinav Kumar
2022-04-20  1:45 ` [PATCH v2 05/17] drm/msm/dpu: add reset_intf_cfg operation for dpu_hw_ctl Abhinav Kumar
2022-04-20  7:02   ` Dmitry Baryshkov
2022-04-20  1:45 ` [PATCH v2 06/17] drm/msm/dpu: add dpu_hw_wb abstraction for writeback blocks Abhinav Kumar
2022-04-20  7:20   ` Dmitry Baryshkov
2022-04-20 17:01     ` Abhinav Kumar
2022-04-20 17:49       ` Dmitry Baryshkov
2022-04-20 18:11         ` Abhinav Kumar
2022-04-20 18:49           ` Dmitry Baryshkov
2022-04-20  1:45 ` [PATCH v2 07/17] drm/msm/dpu: add writeback blocks to DPU RM Abhinav Kumar
2022-04-20  6:47   ` Dmitry Baryshkov
2022-04-20  1:46 ` [PATCH v2 08/17] drm/msm/dpu: add changes to support writeback in hw_ctl Abhinav Kumar
2022-04-20  6:59   ` Dmitry Baryshkov
2022-04-20 17:16     ` Abhinav Kumar
2022-04-20 18:48       ` Dmitry Baryshkov
2022-04-20  1:46 ` [PATCH v2 09/17] drm/msm/dpu: add an API to reset the encoder related hw blocks Abhinav Kumar
2022-04-20  7:23   ` Dmitry Baryshkov
2022-04-20 21:28     ` Abhinav Kumar [this message]
2022-04-20 22:42       ` Dmitry Baryshkov
2022-04-20  1:46 ` [PATCH v2 10/17] drm/msm/dpu: make changes to dpu_encoder to support virtual encoder Abhinav Kumar
2022-04-20  7:44   ` Dmitry Baryshkov
2022-04-20 17:41     ` Abhinav Kumar
2022-04-20 18:37       ` Dmitry Baryshkov
2022-04-20 18:46         ` [Freedreno] " Abhinav Kumar
2022-04-20 22:06           ` Abhinav Kumar
2022-04-20 22:38             ` Dmitry Baryshkov
2022-04-20  1:46 ` [PATCH v2 11/17] drm/msm/dpu: add encoder operations to prepare/cleanup wb job Abhinav Kumar
2022-04-20  1:46 ` [PATCH v2 12/17] drm/msm/dpu: move _dpu_plane_get_qos_lut to dpu_hw_util file Abhinav Kumar
2022-04-20  7:26   ` Dmitry Baryshkov
2022-04-20  1:46 ` [PATCH v2 13/17] drm/msm/dpu: introduce the dpu_encoder_phys_* for writeback Abhinav Kumar
2022-04-20  7:49   ` Dmitry Baryshkov
2022-04-20 18:17     ` Abhinav Kumar
2022-04-20 19:26       ` Dmitry Baryshkov
2022-04-20 19:36         ` Abhinav Kumar
2022-04-20 19:37           ` Dmitry Baryshkov
2022-04-20  1:46 ` [PATCH v2 14/17] drm/msm/dpu: add the writeback connector layer Abhinav Kumar
2022-04-20  7:52   ` Dmitry Baryshkov
2022-04-20 19:10     ` Abhinav Kumar
2022-04-20 19:26       ` Dmitry Baryshkov
2022-04-20 19:26   ` Dmitry Baryshkov
2022-04-20  1:46 ` [PATCH v2 15/17] drm/msm/dpu: initialize dpu encoder and connector for writeback Abhinav Kumar
2022-04-20  7:54   ` Dmitry Baryshkov
2022-04-20  1:46 ` [PATCH v2 16/17] drm/msm/dpu: gracefully handle null fb commits " Abhinav Kumar
2022-04-20  7:55   ` Dmitry Baryshkov
2022-04-20  1:46 ` [PATCH v2 17/17] drm/msm/dpu: add writeback blocks to the display snapshot Abhinav Kumar

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=13fac83c-99e7-0ca6-f93d-b4e6b975abdb@quicinc.com \
    --to=quic_abhinavk@quicinc.com \
    --cc=dmitry.baryshkov@linaro.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=freedreno@lists.freedesktop.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=liviu.dudau@arm.com \
    --cc=markyacoub@chromium.org \
    --cc=quic_aravindh@quicinc.com \
    --cc=quic_jesszhan@quicinc.com \
    --cc=seanpaul@chromium.org \
    --cc=swboyd@chromium.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.