diff mbox series

[v2,2/6] drm/gma500: Sanitize possible_clones

Message ID 20200207135950.6655-3-ville.syrjala@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series drm: Try to fix encoder possible_clones/crtc | expand

Commit Message

Ville Syrjala Feb. 7, 2020, 1:59 p.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

I doubt the DP+DP and SDVO+SDVO cloning works for this driver.
i915 at least doesn't do those. Truthfully there could be some very
specific circumstances where some of them would do doable, but
genereally it's too much pain to deal with so we've chose not to
bother. Let's use the same approach for gma500.

Also the LVDS+LVDS and DSI+DSI cases probably don't really exist as
there is one of each at most.

This does mean we'll now leave possible_clones at 0 for these encoder
types whereas previosuly we included the encoder itself in the bitmask.
But that's fine as the core now treaks 0 as a special case and adds
the encoder itself into the final bitmask reported to userspace.

Cc: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/gma500/framebuffer.c   | 16 ++++++++--------
 drivers/gpu/drm/gma500/mdfld_dsi_dpi.c |  4 ++--
 2 files changed, 10 insertions(+), 10 deletions(-)

Comments

Daniel Vetter Feb. 7, 2020, 4:30 p.m. UTC | #1
On Fri, Feb 07, 2020 at 03:59:46PM +0200, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> I doubt the DP+DP and SDVO+SDVO cloning works for this driver.
> i915 at least doesn't do those. Truthfully there could be some very
> specific circumstances where some of them would do doable, but
> genereally it's too much pain to deal with so we've chose not to
> bother. Let's use the same approach for gma500.
> 
> Also the LVDS+LVDS and DSI+DSI cases probably don't really exist as
> there is one of each at most.
> 
> This does mean we'll now leave possible_clones at 0 for these encoder
> types whereas previosuly we included the encoder itself in the bitmask.
> But that's fine as the core now treaks 0 as a special case and adds
> the encoder itself into the final bitmask reported to userspace.
> 
> Cc: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Looks reasonable.

Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> ---
>  drivers/gpu/drm/gma500/framebuffer.c   | 16 ++++++++--------
>  drivers/gpu/drm/gma500/mdfld_dsi_dpi.c |  4 ++--
>  2 files changed, 10 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/gpu/drm/gma500/framebuffer.c b/drivers/gpu/drm/gma500/framebuffer.c
> index 1459076d1980..6ca4e6ded96c 100644
> --- a/drivers/gpu/drm/gma500/framebuffer.c
> +++ b/drivers/gpu/drm/gma500/framebuffer.c
> @@ -581,31 +581,31 @@ static void psb_setup_outputs(struct drm_device *dev)
>  			break;
>  		case INTEL_OUTPUT_SDVO:
>  			crtc_mask = dev_priv->ops->sdvo_mask;
> -			clone_mask = (1 << INTEL_OUTPUT_SDVO);
> +			clone_mask = 0;
>  			break;
>  		case INTEL_OUTPUT_LVDS:
> -		        crtc_mask = dev_priv->ops->lvds_mask;
> -			clone_mask = (1 << INTEL_OUTPUT_LVDS);
> +			crtc_mask = dev_priv->ops->lvds_mask;
> +			clone_mask = 0;
>  			break;
>  		case INTEL_OUTPUT_MIPI:
>  			crtc_mask = (1 << 0);
> -			clone_mask = (1 << INTEL_OUTPUT_MIPI);
> +			clone_mask = 0;
>  			break;
>  		case INTEL_OUTPUT_MIPI2:
>  			crtc_mask = (1 << 2);
> -			clone_mask = (1 << INTEL_OUTPUT_MIPI2);
> +			clone_mask = 0;
>  			break;
>  		case INTEL_OUTPUT_HDMI:
> -		        crtc_mask = dev_priv->ops->hdmi_mask;
> +			crtc_mask = dev_priv->ops->hdmi_mask;
>  			clone_mask = (1 << INTEL_OUTPUT_HDMI);
>  			break;
>  		case INTEL_OUTPUT_DISPLAYPORT:
>  			crtc_mask = (1 << 0) | (1 << 1);
> -			clone_mask = (1 << INTEL_OUTPUT_DISPLAYPORT);
> +			clone_mask = 0;
>  			break;
>  		case INTEL_OUTPUT_EDP:
>  			crtc_mask = (1 << 1);
> -			clone_mask = (1 << INTEL_OUTPUT_EDP);
> +			clone_mask = 0;
>  		}
>  		encoder->possible_crtcs = crtc_mask;
>  		encoder->possible_clones =
> diff --git a/drivers/gpu/drm/gma500/mdfld_dsi_dpi.c b/drivers/gpu/drm/gma500/mdfld_dsi_dpi.c
> index d4c65f268922..187817e0c004 100644
> --- a/drivers/gpu/drm/gma500/mdfld_dsi_dpi.c
> +++ b/drivers/gpu/drm/gma500/mdfld_dsi_dpi.c
> @@ -1006,10 +1006,10 @@ struct mdfld_dsi_encoder *mdfld_dsi_dpi_init(struct drm_device *dev,
>  	/*set possible crtcs and clones*/
>  	if (dsi_connector->pipe) {
>  		encoder->possible_crtcs = (1 << 2);
> -		encoder->possible_clones = (1 << 1);
> +		encoder->possible_clones = 0;
>  	} else {
>  		encoder->possible_crtcs = (1 << 0);
> -		encoder->possible_clones = (1 << 0);
> +		encoder->possible_clones = 0;
>  	}
>  
>  	dsi_connector->base.encoder = &dpi_output->base.base;
> -- 
> 2.24.1
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
diff mbox series

Patch

diff --git a/drivers/gpu/drm/gma500/framebuffer.c b/drivers/gpu/drm/gma500/framebuffer.c
index 1459076d1980..6ca4e6ded96c 100644
--- a/drivers/gpu/drm/gma500/framebuffer.c
+++ b/drivers/gpu/drm/gma500/framebuffer.c
@@ -581,31 +581,31 @@  static void psb_setup_outputs(struct drm_device *dev)
 			break;
 		case INTEL_OUTPUT_SDVO:
 			crtc_mask = dev_priv->ops->sdvo_mask;
-			clone_mask = (1 << INTEL_OUTPUT_SDVO);
+			clone_mask = 0;
 			break;
 		case INTEL_OUTPUT_LVDS:
-		        crtc_mask = dev_priv->ops->lvds_mask;
-			clone_mask = (1 << INTEL_OUTPUT_LVDS);
+			crtc_mask = dev_priv->ops->lvds_mask;
+			clone_mask = 0;
 			break;
 		case INTEL_OUTPUT_MIPI:
 			crtc_mask = (1 << 0);
-			clone_mask = (1 << INTEL_OUTPUT_MIPI);
+			clone_mask = 0;
 			break;
 		case INTEL_OUTPUT_MIPI2:
 			crtc_mask = (1 << 2);
-			clone_mask = (1 << INTEL_OUTPUT_MIPI2);
+			clone_mask = 0;
 			break;
 		case INTEL_OUTPUT_HDMI:
-		        crtc_mask = dev_priv->ops->hdmi_mask;
+			crtc_mask = dev_priv->ops->hdmi_mask;
 			clone_mask = (1 << INTEL_OUTPUT_HDMI);
 			break;
 		case INTEL_OUTPUT_DISPLAYPORT:
 			crtc_mask = (1 << 0) | (1 << 1);
-			clone_mask = (1 << INTEL_OUTPUT_DISPLAYPORT);
+			clone_mask = 0;
 			break;
 		case INTEL_OUTPUT_EDP:
 			crtc_mask = (1 << 1);
-			clone_mask = (1 << INTEL_OUTPUT_EDP);
+			clone_mask = 0;
 		}
 		encoder->possible_crtcs = crtc_mask;
 		encoder->possible_clones =
diff --git a/drivers/gpu/drm/gma500/mdfld_dsi_dpi.c b/drivers/gpu/drm/gma500/mdfld_dsi_dpi.c
index d4c65f268922..187817e0c004 100644
--- a/drivers/gpu/drm/gma500/mdfld_dsi_dpi.c
+++ b/drivers/gpu/drm/gma500/mdfld_dsi_dpi.c
@@ -1006,10 +1006,10 @@  struct mdfld_dsi_encoder *mdfld_dsi_dpi_init(struct drm_device *dev,
 	/*set possible crtcs and clones*/
 	if (dsi_connector->pipe) {
 		encoder->possible_crtcs = (1 << 2);
-		encoder->possible_clones = (1 << 1);
+		encoder->possible_clones = 0;
 	} else {
 		encoder->possible_crtcs = (1 << 0);
-		encoder->possible_clones = (1 << 0);
+		encoder->possible_clones = 0;
 	}
 
 	dsi_connector->base.encoder = &dpi_output->base.base;