diff mbox series

drm/fb-helper: Blacklist writeback when adding connectors to fbdev

Message ID 20181115163248.21168-1-paul.kocialkowski@bootlin.com (mailing list archive)
State Mainlined, archived
Commit 8fd3b90300bec541806dac271de2fd44e2e4e2d2
Headers show
Series drm/fb-helper: Blacklist writeback when adding connectors to fbdev | expand

Commit Message

Paul Kocialkowski Nov. 15, 2018, 4:32 p.m. UTC
Writeback connectors do not produce any on-screen output and require
special care for use. Such connectors are hidden from enumeration in
DRM resources by default, but they are still picked-up by fbdev.
This makes rather little sense since fbdev is not really adapted for
dealing with writeback.

Moreover, this is also a source of issues when userspace disables the
CRTC (and associated plane) without detaching the CRTC from the
connector (which is hidden by default). In this case, the connector is
still using the CRTC, leading to am "enabled/connectors mismatch" and
eventually the failure of the associated atomic commit. This situation
happens with VC4 testing under IGT GPU Tools.

Filter out writeback connectors in the fbdev helper to solve this.

Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
---
 drivers/gpu/drm/drm_fb_helper.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Boris Brezillon Nov. 15, 2018, 4:42 p.m. UTC | #1
On Thu, 15 Nov 2018 17:32:48 +0100
Paul Kocialkowski <paul.kocialkowski@bootlin.com> wrote:

> Writeback connectors do not produce any on-screen output and require
> special care for use. Such connectors are hidden from enumeration in
> DRM resources by default, but they are still picked-up by fbdev.
> This makes rather little sense since fbdev is not really adapted for
> dealing with writeback.
> 
> Moreover, this is also a source of issues when userspace disables the
> CRTC (and associated plane) without detaching the CRTC from the
> connector (which is hidden by default). In this case, the connector is
> still using the CRTC, leading to am "enabled/connectors mismatch" and

				   ^an

> eventually the failure of the associated atomic commit. This situation
> happens with VC4 testing under IGT GPU Tools.
> 
> Filter out writeback connectors in the fbdev helper to solve this.
> 
> Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>

Reviewed-by: Boris Brezillon <boris.brezillon@bootlin.com>

> ---
>  drivers/gpu/drm/drm_fb_helper.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
> index a502f3e519fd..dd852a25d375 100644
> --- a/drivers/gpu/drm/drm_fb_helper.c
> +++ b/drivers/gpu/drm/drm_fb_helper.c
> @@ -219,6 +219,9 @@ int drm_fb_helper_single_add_all_connectors(struct drm_fb_helper *fb_helper)
>  	mutex_lock(&fb_helper->lock);
>  	drm_connector_list_iter_begin(dev, &conn_iter);
>  	drm_for_each_connector_iter(connector, &conn_iter) {
> +		if (connector->connector_type == DRM_MODE_CONNECTOR_WRITEBACK)
> +			continue;
> +
>  		ret = __drm_fb_helper_add_one_connector(fb_helper, connector);
>  		if (ret)
>  			goto fail;
Maxime Ripard Nov. 19, 2018, 9:28 a.m. UTC | #2
On Thu, Nov 15, 2018 at 05:32:48PM +0100, Paul Kocialkowski wrote:
> Writeback connectors do not produce any on-screen output and require
> special care for use. Such connectors are hidden from enumeration in
> DRM resources by default, but they are still picked-up by fbdev.
> This makes rather little sense since fbdev is not really adapted for
> dealing with writeback.
> 
> Moreover, this is also a source of issues when userspace disables the
> CRTC (and associated plane) without detaching the CRTC from the
> connector (which is hidden by default). In this case, the connector is
> still using the CRTC, leading to am "enabled/connectors mismatch" and
> eventually the failure of the associated atomic commit. This situation
> happens with VC4 testing under IGT GPU Tools.
> 
> Filter out writeback connectors in the fbdev helper to solve this.
> 
> Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>

Reviewed-by: Maxime Ripard <maxime.ripard@bootlin.com>
Tested-by: Maxime Ripard <maxime.ripard@bootlin.com>

Thanks!
Maxime
Daniel Vetter Nov. 21, 2018, 9:40 a.m. UTC | #3
On Mon, Nov 19, 2018 at 10:28:35AM +0100, Maxime Ripard wrote:
> On Thu, Nov 15, 2018 at 05:32:48PM +0100, Paul Kocialkowski wrote:
> > Writeback connectors do not produce any on-screen output and require
> > special care for use. Such connectors are hidden from enumeration in
> > DRM resources by default, but they are still picked-up by fbdev.
> > This makes rather little sense since fbdev is not really adapted for
> > dealing with writeback.
> > 
> > Moreover, this is also a source of issues when userspace disables the
> > CRTC (and associated plane) without detaching the CRTC from the
> > connector (which is hidden by default). In this case, the connector is
> > still using the CRTC, leading to am "enabled/connectors mismatch" and
> > eventually the failure of the associated atomic commit. This situation
> > happens with VC4 testing under IGT GPU Tools.
> > 
> > Filter out writeback connectors in the fbdev helper to solve this.
> > 
> > Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
> 
> Reviewed-by: Maxime Ripard <maxime.ripard@bootlin.com>
> Tested-by: Maxime Ripard <maxime.ripard@bootlin.com>

Applied with a cc: stable to drm-misc-fixes. Btw, 2 r-b from committers,
someone should have pushed this I think :-)

Thanks for patch&review.
-Daniel
diff mbox series

Patch

diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index a502f3e519fd..dd852a25d375 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -219,6 +219,9 @@  int drm_fb_helper_single_add_all_connectors(struct drm_fb_helper *fb_helper)
 	mutex_lock(&fb_helper->lock);
 	drm_connector_list_iter_begin(dev, &conn_iter);
 	drm_for_each_connector_iter(connector, &conn_iter) {
+		if (connector->connector_type == DRM_MODE_CONNECTOR_WRITEBACK)
+			continue;
+
 		ret = __drm_fb_helper_add_one_connector(fb_helper, connector);
 		if (ret)
 			goto fail;