From mboxrd@z Thu Jan 1 00:00:00 1970 From: eric@anholt.net (Eric Anholt) Date: Sat, 10 Feb 2018 17:08:34 +0000 Subject: [PATCH 1/3] drm: simple_kms_helper: Add mode_valid() callback support In-Reply-To: <20180206121854.4407-2-linus.walleij@linaro.org> References: <20180206121854.4407-1-linus.walleij@linaro.org> <20180206121854.4407-2-linus.walleij@linaro.org> Message-ID: <87bmgwdb71.fsf@anholt.net> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org Linus Walleij writes: > The PL111 needs to filter valid modes based on memory bandwidth. > I guess it is a pretty simple operation, so we can still claim > the DRM KMS helper pipeline is simple after adding this (optional) > vtable callback. > > Signed-off-by: Linus Walleij > --- > drivers/gpu/drm/drm_simple_kms_helper.c | 15 +++++++++++++++ > include/drm/drm_simple_kms_helper.h | 15 +++++++++++++++ > 2 files changed, 30 insertions(+) > > diff --git a/drivers/gpu/drm/drm_simple_kms_helper.c b/drivers/gpu/drm/drm_simple_kms_helper.c > index dc9fd109de14..b7840cf34808 100644 > --- a/drivers/gpu/drm/drm_simple_kms_helper.c > +++ b/drivers/gpu/drm/drm_simple_kms_helper.c > @@ -34,6 +34,20 @@ static const struct drm_encoder_funcs drm_simple_kms_encoder_funcs = { > .destroy = drm_encoder_cleanup, > }; > > +static enum drm_mode_status > +drm_simple_kms_crtc_mode_valid(struct drm_crtc *crtc, > + const struct drm_display_mode *mode) > +{ > + struct drm_simple_display_pipe *pipe; > + > + pipe = container_of(crtc, struct drm_simple_display_pipe, crtc); > + if (!pipe->funcs || !pipe->funcs->mode_valid) > + /* Anything goes */ > + return MODE_OK; > + > + return pipe->funcs->mode_valid(crtc, mode); > +} > + > static int drm_simple_kms_crtc_check(struct drm_crtc *crtc, > struct drm_crtc_state *state) > { > @@ -72,6 +86,7 @@ static void drm_simple_kms_crtc_disable(struct drm_crtc *crtc, > } > > static const struct drm_crtc_helper_funcs drm_simple_kms_crtc_helper_funcs = { > + .mode_valid = drm_simple_kms_crtc_mode_valid, > .atomic_check = drm_simple_kms_crtc_check, > .atomic_enable = drm_simple_kms_crtc_enable, > .atomic_disable = drm_simple_kms_crtc_disable, > diff --git a/include/drm/drm_simple_kms_helper.h b/include/drm/drm_simple_kms_helper.h > index 6d9adbb46293..ad74cb33c539 100644 > --- a/include/drm/drm_simple_kms_helper.h > +++ b/include/drm/drm_simple_kms_helper.h > @@ -21,6 +21,21 @@ struct drm_simple_display_pipe; > * display pipeline > */ > struct drm_simple_display_pipe_funcs { > + /** > + * @mode_valid: > + * > + * This function is called to filter out valid modes from the > + * suggestions suggested by the bridge or display. This optional > + * hook is passed in when initializing the pipeline. > + * > + * RETURNS: > + * > + * MODE_OK if the mode is acceptable. > + * MODE_BAD if we need to try something else. > + */ I don't see why MODE_BAD would be the only valid error return from this hook. Can we just use the same RETURNS docs as other mode_valid methods? Other than that, Reviewed-by: Eric Anholt > + enum drm_mode_status (*mode_valid)(struct drm_crtc *crtc, > + const struct drm_display_mode *mode); > + > /** > * @enable: > * > -- > 2.14.3 -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 832 bytes Desc: not available URL: From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Anholt Subject: Re: [PATCH 1/3] drm: simple_kms_helper: Add mode_valid() callback support Date: Sat, 10 Feb 2018 17:08:34 +0000 Message-ID: <87bmgwdb71.fsf@anholt.net> References: <20180206121854.4407-1-linus.walleij@linaro.org> <20180206121854.4407-2-linus.walleij@linaro.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1433808930==" Return-path: Received: from anholt.net (anholt.net [50.246.234.109]) by gabe.freedesktop.org (Postfix) with ESMTP id 6C5866E121 for ; Sat, 10 Feb 2018 17:10:24 +0000 (UTC) In-Reply-To: <20180206121854.4407-2-linus.walleij@linaro.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" To: Linus Walleij , Daniel Vetter , Jani Nikula , Sean Paul , Peter Ujfalusi , Tomi Valkeinen Cc: linux-arm-kernel@lists.infradead.org, dri-devel@lists.freedesktop.org List-Id: dri-devel@lists.freedesktop.org --===============1433808930== Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Linus Walleij writes: > The PL111 needs to filter valid modes based on memory bandwidth. > I guess it is a pretty simple operation, so we can still claim > the DRM KMS helper pipeline is simple after adding this (optional) > vtable callback. > > Signed-off-by: Linus Walleij > --- > drivers/gpu/drm/drm_simple_kms_helper.c | 15 +++++++++++++++ > include/drm/drm_simple_kms_helper.h | 15 +++++++++++++++ > 2 files changed, 30 insertions(+) > > diff --git a/drivers/gpu/drm/drm_simple_kms_helper.c b/drivers/gpu/drm/dr= m_simple_kms_helper.c > index dc9fd109de14..b7840cf34808 100644 > --- a/drivers/gpu/drm/drm_simple_kms_helper.c > +++ b/drivers/gpu/drm/drm_simple_kms_helper.c > @@ -34,6 +34,20 @@ static const struct drm_encoder_funcs drm_simple_kms_e= ncoder_funcs =3D { > .destroy =3D drm_encoder_cleanup, > }; >=20=20 > +static enum drm_mode_status > +drm_simple_kms_crtc_mode_valid(struct drm_crtc *crtc, > + const struct drm_display_mode *mode) > +{ > + struct drm_simple_display_pipe *pipe; > + > + pipe =3D container_of(crtc, struct drm_simple_display_pipe, crtc); > + if (!pipe->funcs || !pipe->funcs->mode_valid) > + /* Anything goes */ > + return MODE_OK; > + > + return pipe->funcs->mode_valid(crtc, mode); > +} > + > static int drm_simple_kms_crtc_check(struct drm_crtc *crtc, > struct drm_crtc_state *state) > { > @@ -72,6 +86,7 @@ static void drm_simple_kms_crtc_disable(struct drm_crtc= *crtc, > } >=20=20 > static const struct drm_crtc_helper_funcs drm_simple_kms_crtc_helper_fun= cs =3D { > + .mode_valid =3D drm_simple_kms_crtc_mode_valid, > .atomic_check =3D drm_simple_kms_crtc_check, > .atomic_enable =3D drm_simple_kms_crtc_enable, > .atomic_disable =3D drm_simple_kms_crtc_disable, > diff --git a/include/drm/drm_simple_kms_helper.h b/include/drm/drm_simple= _kms_helper.h > index 6d9adbb46293..ad74cb33c539 100644 > --- a/include/drm/drm_simple_kms_helper.h > +++ b/include/drm/drm_simple_kms_helper.h > @@ -21,6 +21,21 @@ struct drm_simple_display_pipe; > * display pipeline > */ > struct drm_simple_display_pipe_funcs { > + /** > + * @mode_valid: > + * > + * This function is called to filter out valid modes from the > + * suggestions suggested by the bridge or display. This optional > + * hook is passed in when initializing the pipeline. > + * > + * RETURNS: > + * > + * MODE_OK if the mode is acceptable. > + * MODE_BAD if we need to try something else. > + */ I don't see why MODE_BAD would be the only valid error return from this hook. Can we just use the same RETURNS docs as other mode_valid methods? Other than that, Reviewed-by: Eric Anholt > + enum drm_mode_status (*mode_valid)(struct drm_crtc *crtc, > + const struct drm_display_mode *mode); > + > /** > * @enable: > * > --=20 > 2.14.3 --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEE/JuuFDWp9/ZkuCBXtdYpNtH8nugFAlp/JxIACgkQtdYpNtH8 nujWAw/9GZoz+uiE4HBvh/SxnpiVGYaRtB13w8k3ZRNzdENtcL8QDqgHUAtpBlPc MC82jlIEHvG6aCLJBAUfhJ+AMD2PMabR1jyZDBt1EN9GgxdNAwAm3g+2B6XYQQaU gPNQCNFL36MIizUpYXhC6R80bJAn6IE8hXR3R/fZPwv2PKGEzKpsgrcDxRG1h0FZ eCpHfNcTQu1KRwFjJehnoPPyVekj8icky1zBaxyUihMAQ9DxzQnCzsYDZFEp80ra wi/QpDg/OvIsBn+/tziIr8AKtN8Y1uPnnXTEnIlr5hK6Ie10T1RDtDcvuPrCttDM 3q6l+FhhSXKl7f0cEixxhyJ1HAtYkPAhgbPrDmnvTwsNqcehQXFo8JoFSD71az7f N6/Dgs3y1L3hQ5oK6MIFerBTT9j5ZPShvQN4EPN2Cf93AKLr/dWy0h1ZD5qYF/X0 ylkucoYd49OYSY7Bb3jVp7J12yNRjvCcTck6Ek5NkUf/au8B96Gh+RWINHtVwSJo sOVc81Equ0/l3QhIivDYWo0EhhTg8LICV42eaVc92dA5SmMU2YdJR6RGuoIzuxbL XHPoAEZk1jbS50gY60Z+xmPLCYlbd1iabOiA8prowLrpi+CCphLx2yxbz2LpY57S N8sYjcE387zI0zWA2UNOm3qZbwwLGTPlSuOCZh8eR2XEWKwVumk= =Xmkw -----END PGP SIGNATURE----- --=-=-=-- --===============1433808930== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KZHJpLWRldmVs IG1haWxpbmcgbGlzdApkcmktZGV2ZWxAbGlzdHMuZnJlZWRlc2t0b3Aub3JnCmh0dHBzOi8vbGlz dHMuZnJlZWRlc2t0b3Aub3JnL21haWxtYW4vbGlzdGluZm8vZHJpLWRldmVsCg== --===============1433808930==--