From: Paul Cercueil <paul@crapouillou.net>
To: Daniel Vetter <daniel@ffwll.ch>
Cc: Neil Armstrong <narmstrong@baylibre.com>,
David Airlie <airlied@linux.ie>,
linux-mips@vger.kernel.org, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org,
Thomas Zimmermann <tzimmermann@suse.de>,
list@opendingux.net
Subject: Re: [PATCH 04/11] drm/ingenic: Move no_vblank to private state
Date: Thu, 10 Jun 2021 16:09:19 +0100 [thread overview]
Message-ID: <JFRHUQ.5QKJTG7CMA3P2@crapouillou.net> (raw)
In-Reply-To: <YLZWvFDJzZ6Ij2qy@phenom.ffwll.local>
Hi Daniel,
Le mar., juin 1 2021 at 17:48:12 +0200, Daniel Vetter <daniel@ffwll.ch>
a écrit :
> On Fri, May 28, 2021 at 12:20:58AM +0100, Paul Cercueil wrote:
>> This information is carried from the ".atomic_check" to the
>> ".atomic_commit_tail"; as such it is state-specific, and should be
>> moved
>> to the private state structure.
>>
>> Signed-off-by: Paul Cercueil <paul@crapouillou.net>
>
> Not sure this applies to your hw, but drm_crtc_state.no_vblank exists.
> Might want to move to that instead of rolling your own. Or explain
> why you
> need your own here in your own private state. It does look quite a bit
> like you're just rolling your own version of this support that helpers
> gained meanwhile.
If I use drm_crtc_state->no_vblank, then I need a custom
.atomic_commit_tail() that only calls
drm_atomic_helper_wait_for_vblanks() when !no_vblank. That works, but I
don't understand why drm_atomic_helper_commit_tail() doesn't do that by
default, and makes me think I'm using it wrong.
Cheers,
-Paul
> -Daniel
>
>
>> ---
>> drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 41
>> ++++++++++++++++++++---
>> 1 file changed, 37 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
>> b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
>> index e81084eb3b0e..639994329c60 100644
>> --- a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
>> +++ b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
>> @@ -66,6 +66,8 @@ struct jz_soc_info {
>>
>> struct ingenic_drm_private_state {
>> struct drm_private_state base;
>> +
>> + bool no_vblank;
>> };
>>
>> struct ingenic_drm {
>> @@ -87,7 +89,6 @@ struct ingenic_drm {
>> dma_addr_t dma_hwdescs_phys;
>>
>> bool panel_is_sharp;
>> - bool no_vblank;
>>
>> /*
>> * clk_mutex is used to synchronize the pixel clock rate update
>> with
>> @@ -113,6 +114,30 @@ to_ingenic_drm_priv_state(struct
>> drm_private_state *state)
>> return container_of(state, struct ingenic_drm_private_state,
>> base);
>> }
>>
>> +static struct ingenic_drm_private_state *
>> +ingenic_drm_get_priv_state(struct ingenic_drm *priv, struct
>> drm_atomic_state *state)
>> +{
>> + struct drm_private_state *priv_state;
>> +
>> + priv_state = drm_atomic_get_private_obj_state(state,
>> &priv->private_obj);
>> + if (IS_ERR(priv_state))
>> + return ERR_CAST(priv_state);
>> +
>> + return to_ingenic_drm_priv_state(priv_state);
>> +}
>> +
>> +static struct ingenic_drm_private_state *
>> +ingenic_drm_get_new_priv_state(struct ingenic_drm *priv, struct
>> drm_atomic_state *state)
>> +{
>> + struct drm_private_state *priv_state;
>> +
>> + priv_state = drm_atomic_get_new_private_obj_state(state,
>> &priv->private_obj);
>> + if (!priv_state)
>> + return NULL;
>> +
>> + return to_ingenic_drm_priv_state(priv_state);
>> +}
>> +
>> static bool ingenic_drm_writeable_reg(struct device *dev, unsigned
>> int reg)
>> {
>> switch (reg) {
>> @@ -268,6 +293,7 @@ static int ingenic_drm_crtc_atomic_check(struct
>> drm_crtc *crtc,
>> crtc);
>> struct ingenic_drm *priv = drm_crtc_get_priv(crtc);
>> struct drm_plane_state *f1_state, *f0_state, *ipu_state = NULL;
>> + struct ingenic_drm_private_state *priv_state;
>>
>> if (crtc_state->gamma_lut &&
>> drm_color_lut_size(crtc_state->gamma_lut) !=
>> ARRAY_SIZE(priv->dma_hwdescs->palette)) {
>> @@ -299,9 +325,13 @@ static int
>> ingenic_drm_crtc_atomic_check(struct drm_crtc *crtc,
>> }
>> }
>>
>> + priv_state = ingenic_drm_get_priv_state(priv, state);
>> + if (IS_ERR(priv_state))
>> + return PTR_ERR(priv_state);
>> +
>> /* If all the planes are disabled, we won't get a VBLANK IRQ */
>> - priv->no_vblank = !f1_state->fb && !f0_state->fb &&
>> - !(ipu_state && ipu_state->fb);
>> + priv_state->no_vblank = !f1_state->fb && !f0_state->fb &&
>> + !(ipu_state && ipu_state->fb);
>> }
>>
>> return 0;
>> @@ -727,6 +757,7 @@ static void
>> ingenic_drm_atomic_helper_commit_tail(struct drm_atomic_state *old_s
>> */
>> struct drm_device *dev = old_state->dev;
>> struct ingenic_drm *priv = drm_device_get_priv(dev);
>> + struct ingenic_drm_private_state *priv_state;
>>
>> drm_atomic_helper_commit_modeset_disables(dev, old_state);
>>
>> @@ -736,7 +767,9 @@ static void
>> ingenic_drm_atomic_helper_commit_tail(struct drm_atomic_state *old_s
>>
>> drm_atomic_helper_commit_hw_done(old_state);
>>
>> - if (!priv->no_vblank)
>> + priv_state = ingenic_drm_get_new_priv_state(priv, old_state);
>> +
>> + if (!priv_state || !priv_state->no_vblank)
>> drm_atomic_helper_wait_for_vblanks(dev, old_state);
>>
>> drm_atomic_helper_cleanup_planes(dev, old_state);
>> --
>> 2.30.2
>>
>
> --
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch
next prev parent reply other threads:[~2021-06-11 8:05 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-27 23:20 [PATCH 00/11] ingenic-drm cleanups and doublescan feature Paul Cercueil
2021-05-27 23:20 ` [PATCH 01/11] drm/ingenic: Remove dead code Paul Cercueil
2021-05-27 23:20 ` [PATCH 02/11] drm/ingenic: Simplify code by using hwdescs array Paul Cercueil
2021-05-27 23:20 ` [PATCH 03/11] drm/ingenic: Add support for private objects Paul Cercueil
2021-05-27 23:20 ` [PATCH 04/11] drm/ingenic: Move no_vblank to private state Paul Cercueil
2021-06-01 15:48 ` Daniel Vetter
2021-06-10 15:09 ` Paul Cercueil [this message]
2021-06-11 9:05 ` Daniel Vetter
2021-05-27 23:20 ` [PATCH 05/11] drm/ingenic: Move IPU scale settings " Paul Cercueil
2021-05-27 23:21 ` [PATCH 06/11] drm/ingenic: Set DMA descriptor chain register when starting CRTC Paul Cercueil
2021-05-27 23:21 ` [PATCH 07/11] drm/ingenic: Upload palette before frame Paul Cercueil
2021-05-27 23:21 ` [PATCH 08/11] drm/ingenic: Support custom GEM object Paul Cercueil
2021-05-27 23:21 ` [PATCH 09/11] drm/ingenic: Add ingenic_drm_gem_fb_destroy() function Paul Cercueil
2021-05-27 23:22 ` [PATCH 10/11] drm/ingenic: Add doublescan feature Paul Cercueil
2021-05-27 23:22 ` [PATCH 11/11] drm/ingenic: Attach bridge chain to encoders Paul Cercueil
2021-06-01 15:54 ` [PATCH 10/11] drm/ingenic: Add doublescan feature Daniel Vetter
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=JFRHUQ.5QKJTG7CMA3P2@crapouillou.net \
--to=paul@crapouillou.net \
--cc=airlied@linux.ie \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=list@opendingux.net \
--cc=narmstrong@baylibre.com \
--cc=tzimmermann@suse.de \
/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;
as well as URLs for NNTP newsgroup(s).