From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Anholt Subject: Re: [RFC 7/7] drm/vc4: update cursors asynchronously through atomic Date: Mon, 10 Apr 2017 13:06:46 -0700 Message-ID: <8760icjacp.fsf@eliezer.anholt.net> References: <20170410002448.12460-1-gustavo@padovan.org> <20170410002448.12460-8-gustavo@padovan.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0804170878==" Return-path: Received: from anholt.net (anholt.net [50.246.234.109]) by gabe.freedesktop.org (Postfix) with ESMTP id 006686E3B3 for ; Mon, 10 Apr 2017 20:06:48 +0000 (UTC) In-Reply-To: <20170410002448.12460-8-gustavo@padovan.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" To: Gustavo Padovan , dri-devel@lists.freedesktop.org Cc: Gustavo Padovan List-Id: dri-devel@lists.freedesktop.org --===============0804170878== Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Gustavo Padovan writes: > From: Gustavo Padovan > > Add support to async updates of cursors by using the new atomic > interface for that. Basically what this commit does is do what > vc4_update_plane() did but through atomic. > > Cc: Eric Anholt > Signed-off-by: Gustavo Padovan > --- > drivers/gpu/drm/vc4/vc4_plane.c | 94 ++++++++++++-----------------------= ------ > 1 file changed, 27 insertions(+), 67 deletions(-) > > diff --git a/drivers/gpu/drm/vc4/vc4_plane.c b/drivers/gpu/drm/vc4/vc4_pl= ane.c > index d34cd53..e33c75b 100644 > --- a/drivers/gpu/drm/vc4/vc4_plane.c > +++ b/drivers/gpu/drm/vc4/vc4_plane.c > @@ -735,70 +735,27 @@ void vc4_plane_async_set_fb(struct drm_plane *plane= , struct drm_framebuffer *fb) > vc4_state->dlist[vc4_state->ptr0_offset] =3D addr; > } >=20=20 > -static const struct drm_plane_helper_funcs vc4_plane_helper_funcs =3D { > - .atomic_check =3D vc4_plane_atomic_check, > - .atomic_update =3D vc4_plane_atomic_update, > -}; > - > -static void vc4_plane_destroy(struct drm_plane *plane) > -{ > - drm_plane_helper_disable(plane); > - drm_plane_cleanup(plane); > -} > - > -/* Implements immediate (non-vblank-synced) updates of the cursor > - * position, or falls back to the atomic helper otherwise. > - */ > -static int > -vc4_update_plane(struct drm_plane *plane, > - struct drm_crtc *crtc, > - struct drm_framebuffer *fb, > - int crtc_x, int crtc_y, > - unsigned int crtc_w, unsigned int crtc_h, > - uint32_t src_x, uint32_t src_y, > - uint32_t src_w, uint32_t src_h, > - struct drm_modeset_acquire_ctx *ctx) > +static int vc4_plane_atomic_async_check(struct drm_plane *plane, > + struct drm_plane_state *state) > { > - struct drm_plane_state *plane_state; > - struct vc4_plane_state *vc4_state; > - > - if (plane !=3D crtc->cursor) > - goto out; > - > - plane_state =3D plane->state; > - vc4_state =3D to_vc4_plane_state(plane_state); > - > - if (!plane_state) > - goto out; > + if (plane !=3D state->crtc->cursor) > + return -EINVAL; >=20=20 > - /* No configuring new scaling in the fast path. */ > - if (crtc_w !=3D plane_state->crtc_w || > - crtc_h !=3D plane_state->crtc_h || > - src_w !=3D plane_state->src_w || > - src_h !=3D plane_state->src_h) { > - goto out; > - } > + if (!plane->state) > + return -EINVAL; >=20=20 > - if (fb !=3D plane_state->fb) { > - drm_atomic_set_fb_for_plane(plane->state, fb); > - vc4_plane_async_set_fb(plane, fb); > - } > + return 0; > +} >=20=20 > - /* Set the cursor's position on the screen. This is the > - * expected change from the drm_mode_cursor_universal() > - * helper. > - */ > - plane_state->crtc_x =3D crtc_x; > - plane_state->crtc_y =3D crtc_y; > +static void vc4_plane_atomic_async_update(struct drm_plane *plane, > + struct drm_plane_state *new_state) > +{ > + struct vc4_plane_state *vc4_state =3D to_vc4_plane_state(plane->state); >=20=20 > - /* Allow changing the start position within the cursor BO, if > - * that matters. > - */ > - plane_state->src_x =3D src_x; > - plane_state->src_y =3D src_y; > + if (plane->state->fb !=3D new_state->fb) > + vc4_plane_async_set_fb(plane, new_state->fb); >=20=20 > - /* Update the display list based on the new crtc_x/y. */ > - vc4_plane_atomic_check(plane, plane_state); > + plane->state->fb =3D new_state->fb; The vc4_plane_atomic_check() is what sets up the dlist[]'s position fields that are used right after this, so this call needs to stay in place, and x/y need to be updated already (since we're looking at plane->state, not new_state). Also, I think we'll need to make sure that you're not trying to enable/disable the plane in the fast path, since we're not updating the CTL0_VALID field. > /* Note that we can't just call vc4_plane_write_dlist() > * because that would smash the context data that the HVS is > @@ -810,20 +767,23 @@ vc4_update_plane(struct drm_plane *plane, > &vc4_state->hw_dlist[vc4_state->pos2_offset]); > writel(vc4_state->dlist[vc4_state->ptr0_offset], > &vc4_state->hw_dlist[vc4_state->ptr0_offset]); > +} --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEE/JuuFDWp9/ZkuCBXtdYpNtH8nugFAljr5dYACgkQtdYpNtH8 nuibAQ/9FBnK/LCeIESPnxYmkqC0NBdcN8papcOgvAC5PaZyRIEmwHyxsLh8HptH 67c/zMvGpUpnQC4OypZSjwWdU8g8vo8IEzXBNfAcaJEFTij2uvlPoHJ0V36woIkV ClHWJugGOSf0+edP86T2hdWVutmayEGsXW/1WSqwawbmUC7DYW5wdNqXIyLZjwto vj+Nt8WV8tSIeUkXZoAk2aGBxrQ4GNSEBqPliIXXhX2L+Lr3oKx5ujxw4bb9ZLnI bIW7DwFtqLpraZwve8vzRV79S5OFXwn/t4x4xicjfwTLzarrgHX/6TxXRBUa1MQo BcgjuaUy6DWdsqy6B2eryM2lobdImCUxaelu/kQfjsclIb5BgS9/SzuNUGDDJTvA eMgMWuk/qPnF5oAnjFvEi0FqLN3PUdXJhgSkfNQfozD4XuMi6F4/+HWIgFZslm2g pXubNnA2zGcKPr/OSuK2+mVdZFu/r1/p2ggUHFZFjTkwiaH6k3QSRWxVT9j9Qtip rw9ha/ekiIe6b2x26Pli7Vt9vKeAq0Pqe+sZuoKVbeyAXawj8yefq/pRzwIDUmyg 3/lHcBb7JNYEKAUPtAa/491VpA9vIkgDt6X3nxfuiubJwPmdawsVXh4nLAHgE7+C DdmNDxUfqcRg9lDLgBJuDbescAN5DMQ61NEDXr0ndYRpiJwvdBs= =QMxp -----END PGP SIGNATURE----- --=-=-=-- --===============0804170878== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KZHJpLWRldmVs IG1haWxpbmcgbGlzdApkcmktZGV2ZWxAbGlzdHMuZnJlZWRlc2t0b3Aub3JnCmh0dHBzOi8vbGlz dHMuZnJlZWRlc2t0b3Aub3JnL21haWxtYW4vbGlzdGluZm8vZHJpLWRldmVsCg== --===============0804170878==--