From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org,
"Liviu Dudau" <liviu.dudau@arm.com>,
"Russell King" <linux@armlinux.org.uk>,
"Inki Dae" <inki.dae@samsung.com>,
"Patrik Jakobsson" <patrik.r.jakobsson@gmail.com>,
"Alain Volmat" <alain.volmat@foss.st.com>,
"Sandy Huang" <hjc@rock-chips.com>,
"Jyri Sarha" <jyri.sarha@iki.fi>,
"Alexey Brodkin" <abrodkin@synopsys.com>,
"Hans de Goede" <hdegoede@redhat.com>,
"Maíra Canal" <mairacanal@riseup.net>,
"Zack Rusin" <zack.rusin@broadcom.com>,
amd-gfx@lists.freedesktop.org,
linux-mediatek@lists.infradead.org,
linux-amlogic@lists.infradead.org, linux-arm-msm@vger.kernel.org,
freedreno@lists.freedesktop.org, nouveau@lists.freedesktop.org,
virtualization@lists.linux.dev,
spice-devel@lists.freedesktop.org,
linux-renesas-soc@vger.kernel.org,
xen-devel@lists.xenproject.org
Subject: Re: [PATCH 2/2] drm: Move crtc->{x, y, mode, enabled} to legacy sub-structure
Date: Thu, 3 Oct 2024 16:46:48 +0300 [thread overview]
Message-ID: <Zv6gSGMXZZARf3oV@intel.com> (raw)
In-Reply-To: <Zv6QF2EmIcogtlLA@louis-chauvet-laptop>
On Thu, Oct 03, 2024 at 02:38:35PM +0200, Louis Chauvet wrote:
> Le 02/10/24 - 21:22, Ville Syrjala a écrit :
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> >
> > Atomic drivers shouldn't be using the legacy state stored
> > directly under drm_crtc. Move that junk into a 'legacy' sub
> > structure to highlight the offenders, of which there are
> > quite a few unfortunately.
>
> Hi,
>
> Do we need to do something particular in an atomic driver except using
> state content?
>
> I proposed some modifications for VKMS bellow. If you think this is good,
> I can send a patch to avoid being an offender :-) I just tested it, and it
> seems to work.
>
> > I'm hoping we could get all these fixed and then declare
> > the legacy state off limits for atomic drivers (which is
> > what did long ago for plane->fb/etc). And maybe eventually
> > turn crtc->legacy into a pointer and only allocate it on
> > legacy drivers.
> >
> > TODO: hwmode should probably go there too but it probably
> > needs a closer look, maybe other stuff too...
>
> [...]
>
> > diff --git a/drivers/gpu/drm/vkms/vkms_composer.c b/drivers/gpu/drm/vkms/vkms_composer.c
> > index 57a5769fc994..a7f8b1da6e85 100644
> > --- a/drivers/gpu/drm/vkms/vkms_composer.c
> > +++ b/drivers/gpu/drm/vkms/vkms_composer.c
> > @@ -187,7 +187,7 @@ static void blend(struct vkms_writeback_job *wb,
> >
> > const struct pixel_argb_u16 background_color = { .a = 0xffff };
> >
> > - size_t crtc_y_limit = crtc_state->base.crtc->mode.vdisplay;
> > + size_t crtc_y_limit = crtc_state->base.crtc->legacy.mode.vdisplay;
>
> size_t crtc_y_limit = crtc_state->base.mode.vdisplay;
>
> > /*
> > * The planes are composed line-by-line to avoid heavy memory usage. It is a necessary
> > @@ -270,7 +270,7 @@ static int compose_active_planes(struct vkms_writeback_job *active_wb,
> > if (WARN_ON(check_format_funcs(crtc_state, active_wb)))
> > return -EINVAL;
> >
> > - line_width = crtc_state->base.crtc->mode.hdisplay;
> > + line_width = crtc_state->base.crtc->legacy.mode.hdisplay;
>
> line_width = crtc_state->base.mode.hdisplay;
>
> > stage_buffer.n_pixels = line_width;
> > output_buffer.n_pixels = line_width;
> >
> > diff --git a/drivers/gpu/drm/vkms/vkms_crtc.c b/drivers/gpu/drm/vkms/vkms_crtc.c
> > index a40295c18b48..780681ea77e4 100644
> > --- a/drivers/gpu/drm/vkms/vkms_crtc.c
> > +++ b/drivers/gpu/drm/vkms/vkms_crtc.c
> > @@ -64,7 +64,7 @@ static int vkms_enable_vblank(struct drm_crtc *crtc)
> > struct drm_vblank_crtc *vblank = drm_crtc_vblank_crtc(crtc);
> > struct vkms_output *out = drm_crtc_to_vkms_output(crtc);
> >
> > - drm_calc_timestamping_constants(crtc, &crtc->mode);
> > + drm_calc_timestamping_constants(crtc, &crtc->legacy.mode);
>
> drm_calc_timestamping_constants(crtc, &crtc->state->mode);
This one doesn't look safe. You want to call that during your atomic
commit already.
The rest look reasonable.
>
> > hrtimer_init(&out->vblank_hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
> > out->vblank_hrtimer.function = &vkms_vblank_simulate;
> > diff --git a/drivers/gpu/drm/vkms/vkms_writeback.c b/drivers/gpu/drm/vkms/vkms_writeback.c
> > index bc724cbd5e3a..27164cddb94d 100644
> > --- a/drivers/gpu/drm/vkms/vkms_writeback.c
> > +++ b/drivers/gpu/drm/vkms/vkms_writeback.c
> > @@ -131,8 +131,8 @@ static void vkms_wb_atomic_commit(struct drm_connector *conn,
> > struct drm_connector_state *conn_state = wb_conn->base.state;
> > struct vkms_crtc_state *crtc_state = output->composer_state;
> > struct drm_framebuffer *fb = connector_state->writeback_job->fb;
> > - u16 crtc_height = crtc_state->base.crtc->mode.vdisplay;
> > - u16 crtc_width = crtc_state->base.crtc->mode.hdisplay;
> > + u16 crtc_height = crtc_state->base.crtc->legacy.mode.vdisplay;
> > + u16 crtc_width = crtc_state->base.crtc->legacy.mode.hdisplay;
>
> u16 crtc_height = crtc_state->base.mode.vdisplay;
> u16 crtc_width = crtc_state->base.mode.hdisplay;
>
> > struct vkms_writeback_job *active_wb;
> > struct vkms_frame_info *wb_frame_info;
> > u32 wb_format = fb->format->format;
>
> [...]
>
> --
> Louis Chauvet, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com
--
Ville Syrjälä
Intel
next prev parent reply other threads:[~2024-10-03 13:46 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-02 18:21 [PATCH 0/2] drm: Treewide plane/crtc legacy state sweeping Ville Syrjala
2024-10-02 18:21 ` [PATCH 1/2] drm: Move plane->{fb,old_fb,crtc} to legacy sub-structure Ville Syrjala
2024-10-03 11:12 ` Ville Syrjälä
2024-10-25 9:57 ` Jani Nikula
2024-10-25 10:15 ` Ville Syrjälä
[not found] ` <20241002182200.15363-3-ville.syrjala@linux.intel.com>
2024-10-03 12:38 ` [PATCH 2/2] drm: Move crtc->{x, y, mode, enabled} " Louis Chauvet
2024-10-03 13:46 ` Ville Syrjälä [this message]
2024-10-03 15:07 ` Louis Chauvet
2024-10-03 15:29 ` Ville Syrjälä
2024-10-03 15:45 ` Louis Chauvet
2024-10-25 7:46 ` [PATCH 0/2] drm: Treewide plane/crtc legacy state sweeping Ville Syrjälä
2024-10-25 9:54 ` Dmitry Baryshkov
2024-10-25 9:59 ` Jani Nikula
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=Zv6gSGMXZZARf3oV@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=abrodkin@synopsys.com \
--cc=alain.volmat@foss.st.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=freedreno@lists.freedesktop.org \
--cc=hdegoede@redhat.com \
--cc=hjc@rock-chips.com \
--cc=inki.dae@samsung.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jyri.sarha@iki.fi \
--cc=linux-amlogic@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=liviu.dudau@arm.com \
--cc=mairacanal@riseup.net \
--cc=nouveau@lists.freedesktop.org \
--cc=patrik.r.jakobsson@gmail.com \
--cc=spice-devel@lists.freedesktop.org \
--cc=virtualization@lists.linux.dev \
--cc=xen-devel@lists.xenproject.org \
--cc=zack.rusin@broadcom.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;
as well as URLs for NNTP newsgroup(s).