diff mbox series

[CI,04/12] drm/i915: Perform manual conversions for crtc uapi/hw split, v2.

Message ID 20191029072229.27092-4-maarten.lankhorst@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series [CI,01/12] drm/i915: Introduce intel_atomic_get_plane_state_after_check(), v2. | expand

Commit Message

Maarten Lankhorst Oct. 29, 2019, 7:22 a.m. UTC
intel_get_load_detect_pipe() needs to set uapi active,
uapi enable is set by the call to drm_atomic_set_mode_for_crtc(),
so we can remove it.

intel_pipe_config_compare() needs to look at hw state, but I didn't
change spatch to look at it. It's easy enough to do manually.

intel_atomic_check() definitely needs to check for uapi enable,
otherwise intel_modeset_pipe_config cannot copy uapi state to hw.

Changes since v1:
- Actually set uapi.active in get_load_detect_pipe().

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
---
 drivers/gpu/drm/i915/display/intel_display.c | 42 ++++++++++----------
 1 file changed, 21 insertions(+), 21 deletions(-)

Comments

Ville Syrjälä Oct. 29, 2019, 1:23 p.m. UTC | #1
On Tue, Oct 29, 2019 at 08:22:21AM +0100, Maarten Lankhorst wrote:
> intel_get_load_detect_pipe() needs to set uapi active,
> uapi enable is set by the call to drm_atomic_set_mode_for_crtc(),
> so we can remove it.
> 
> intel_pipe_config_compare() needs to look at hw state, but I didn't
> change spatch to look at it. It's easy enough to do manually.
> 
> intel_atomic_check() definitely needs to check for uapi enable,
> otherwise intel_modeset_pipe_config cannot copy uapi state to hw.
> 
> Changes since v1:
> - Actually set uapi.active in get_load_detect_pipe().
> 
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_display.c | 42 ++++++++++----------
>  1 file changed, 21 insertions(+), 21 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> index d0df9b24a969..4baa0226abff 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -11433,7 +11433,7 @@ int intel_get_load_detect_pipe(struct drm_connector *connector,
>  		goto fail;
>  	}
>  
> -	crtc_state->base.active = crtc_state->base.enable = true;
> +	crtc_state->uapi.active = true;

The fact that load detection broke in ci makes this a bit suspicious.
But AFAICS it should work.


Hmm. Long ago I had a patch to fix something in
drm_atomic_set_mode_for_crtc()...
https://patchwork.freedesktop.org/patch/262996/?series=52778&rev=1

Doesn't seem like it should make a difference unless somehow uapi.mode
is left with the load detect mode but uapi.enable is set to false before
another call to drm_atomic_set_mode_for_crtc(load_detect_mode).


>  
>  	if (!mode)
>  		mode = &load_detect_mode;
> @@ -13080,19 +13080,19 @@ intel_pipe_config_compare(const struct intel_crtc_state *current_config,
>  
>  	PIPE_CONF_CHECK_X(output_types);
>  
> -	PIPE_CONF_CHECK_I(base.adjusted_mode.crtc_hdisplay);
> -	PIPE_CONF_CHECK_I(base.adjusted_mode.crtc_htotal);
> -	PIPE_CONF_CHECK_I(base.adjusted_mode.crtc_hblank_start);
> -	PIPE_CONF_CHECK_I(base.adjusted_mode.crtc_hblank_end);
> -	PIPE_CONF_CHECK_I(base.adjusted_mode.crtc_hsync_start);
> -	PIPE_CONF_CHECK_I(base.adjusted_mode.crtc_hsync_end);
> +	PIPE_CONF_CHECK_I(hw.adjusted_mode.crtc_hdisplay);
> +	PIPE_CONF_CHECK_I(hw.adjusted_mode.crtc_htotal);
> +	PIPE_CONF_CHECK_I(hw.adjusted_mode.crtc_hblank_start);
> +	PIPE_CONF_CHECK_I(hw.adjusted_mode.crtc_hblank_end);
> +	PIPE_CONF_CHECK_I(hw.adjusted_mode.crtc_hsync_start);
> +	PIPE_CONF_CHECK_I(hw.adjusted_mode.crtc_hsync_end);
>  
> -	PIPE_CONF_CHECK_I(base.adjusted_mode.crtc_vdisplay);
> -	PIPE_CONF_CHECK_I(base.adjusted_mode.crtc_vtotal);
> -	PIPE_CONF_CHECK_I(base.adjusted_mode.crtc_vblank_start);
> -	PIPE_CONF_CHECK_I(base.adjusted_mode.crtc_vblank_end);
> -	PIPE_CONF_CHECK_I(base.adjusted_mode.crtc_vsync_start);
> -	PIPE_CONF_CHECK_I(base.adjusted_mode.crtc_vsync_end);
> +	PIPE_CONF_CHECK_I(hw.adjusted_mode.crtc_vdisplay);
> +	PIPE_CONF_CHECK_I(hw.adjusted_mode.crtc_vtotal);
> +	PIPE_CONF_CHECK_I(hw.adjusted_mode.crtc_vblank_start);
> +	PIPE_CONF_CHECK_I(hw.adjusted_mode.crtc_vblank_end);
> +	PIPE_CONF_CHECK_I(hw.adjusted_mode.crtc_vsync_start);
> +	PIPE_CONF_CHECK_I(hw.adjusted_mode.crtc_vsync_end);
>  
>  	PIPE_CONF_CHECK_I(pixel_multiplier);
>  	PIPE_CONF_CHECK_I(output_format);
> @@ -13109,17 +13109,17 @@ intel_pipe_config_compare(const struct intel_crtc_state *current_config,
>  
>  	PIPE_CONF_CHECK_BOOL_INCOMPLETE(has_audio);
>  
> -	PIPE_CONF_CHECK_FLAGS(base.adjusted_mode.flags,
> +	PIPE_CONF_CHECK_FLAGS(hw.adjusted_mode.flags,
>  			      DRM_MODE_FLAG_INTERLACE);
>  
>  	if (!PIPE_CONF_QUIRK(PIPE_CONFIG_QUIRK_MODE_SYNC_FLAGS)) {
> -		PIPE_CONF_CHECK_FLAGS(base.adjusted_mode.flags,
> +		PIPE_CONF_CHECK_FLAGS(hw.adjusted_mode.flags,
>  				      DRM_MODE_FLAG_PHSYNC);
> -		PIPE_CONF_CHECK_FLAGS(base.adjusted_mode.flags,
> +		PIPE_CONF_CHECK_FLAGS(hw.adjusted_mode.flags,
>  				      DRM_MODE_FLAG_NHSYNC);
> -		PIPE_CONF_CHECK_FLAGS(base.adjusted_mode.flags,
> +		PIPE_CONF_CHECK_FLAGS(hw.adjusted_mode.flags,
>  				      DRM_MODE_FLAG_PVSYNC);
> -		PIPE_CONF_CHECK_FLAGS(base.adjusted_mode.flags,
> +		PIPE_CONF_CHECK_FLAGS(hw.adjusted_mode.flags,
>  				      DRM_MODE_FLAG_NVSYNC);
>  	}
>  
> @@ -13158,7 +13158,7 @@ intel_pipe_config_compare(const struct intel_crtc_state *current_config,
>  
>  		bp_gamma = intel_color_get_gamma_bit_precision(pipe_config);
>  		if (bp_gamma)
> -			PIPE_CONF_CHECK_COLOR_LUT(gamma_mode, base.gamma_lut, bp_gamma);
> +			PIPE_CONF_CHECK_COLOR_LUT(gamma_mode, hw.gamma_lut, bp_gamma);
>  
>  	}
>  
> @@ -13203,7 +13203,7 @@ intel_pipe_config_compare(const struct intel_crtc_state *current_config,
>  	if (IS_G4X(dev_priv) || INTEL_GEN(dev_priv) >= 5)
>  		PIPE_CONF_CHECK_I(pipe_bpp);
>  
> -	PIPE_CONF_CHECK_CLOCK_FUZZY(base.adjusted_mode.crtc_clock);
> +	PIPE_CONF_CHECK_CLOCK_FUZZY(hw.adjusted_mode.crtc_clock);
>  	PIPE_CONF_CHECK_CLOCK_FUZZY(port_clock);
>  
>  	PIPE_CONF_CHECK_I(min_voltage_level);
> @@ -14010,7 +14010,7 @@ static int intel_atomic_check(struct drm_device *dev,
>  		if (!needs_modeset(new_crtc_state))
>  			continue;
>  
> -		if (!new_crtc_state->base.enable) {
> +		if (!new_crtc_state->uapi.enable) {
>  			any_ms = true;
>  			continue;
>  		}
> -- 
> 2.23.0
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Maarten Lankhorst Oct. 30, 2019, 10:12 a.m. UTC | #2
Op 29-10-2019 om 14:23 schreef Ville Syrjälä:
> On Tue, Oct 29, 2019 at 08:22:21AM +0100, Maarten Lankhorst wrote:
>> intel_get_load_detect_pipe() needs to set uapi active,
>> uapi enable is set by the call to drm_atomic_set_mode_for_crtc(),
>> so we can remove it.
>>
>> intel_pipe_config_compare() needs to look at hw state, but I didn't
>> change spatch to look at it. It's easy enough to do manually.
>>
>> intel_atomic_check() definitely needs to check for uapi enable,
>> otherwise intel_modeset_pipe_config cannot copy uapi state to hw.
>>
>> Changes since v1:
>> - Actually set uapi.active in get_load_detect_pipe().
>>
>> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
>> ---
>>  drivers/gpu/drm/i915/display/intel_display.c | 42 ++++++++++----------
>>  1 file changed, 21 insertions(+), 21 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
>> index d0df9b24a969..4baa0226abff 100644
>> --- a/drivers/gpu/drm/i915/display/intel_display.c
>> +++ b/drivers/gpu/drm/i915/display/intel_display.c
>> @@ -11433,7 +11433,7 @@ int intel_get_load_detect_pipe(struct drm_connector *connector,
>>  		goto fail;
>>  	}
>>  
>> -	crtc_state->base.active = crtc_state->base.enable = true;
>> +	crtc_state->uapi.active = true;
> The fact that load detection broke in ci makes this a bit suspicious.
> But AFAICS it should work.
>
>
> Hmm. Long ago I had a patch to fix something in
> drm_atomic_set_mode_for_crtc()...
> https://patchwork.freedesktop.org/patch/262996/?series=52778&rev=1
>
> Doesn't seem like it should make a difference unless somehow uapi.mode
> is left with the load detect mode but uapi.enable is set to false before
> another call to drm_atomic_set_mode_for_crtc(load_detect_mode).

Ah, I will just put back the base.enable for now then, can fix the core later. :)


>
>>  
>>  	if (!mode)
>>  		mode = &load_detect_mode;
>> @@ -13080,19 +13080,19 @@ intel_pipe_config_compare(const struct intel_crtc_state *current_config,
>>  
>>  	PIPE_CONF_CHECK_X(output_types);
>>  
>> -	PIPE_CONF_CHECK_I(base.adjusted_mode.crtc_hdisplay);
>> -	PIPE_CONF_CHECK_I(base.adjusted_mode.crtc_htotal);
>> -	PIPE_CONF_CHECK_I(base.adjusted_mode.crtc_hblank_start);
>> -	PIPE_CONF_CHECK_I(base.adjusted_mode.crtc_hblank_end);
>> -	PIPE_CONF_CHECK_I(base.adjusted_mode.crtc_hsync_start);
>> -	PIPE_CONF_CHECK_I(base.adjusted_mode.crtc_hsync_end);
>> +	PIPE_CONF_CHECK_I(hw.adjusted_mode.crtc_hdisplay);
>> +	PIPE_CONF_CHECK_I(hw.adjusted_mode.crtc_htotal);
>> +	PIPE_CONF_CHECK_I(hw.adjusted_mode.crtc_hblank_start);
>> +	PIPE_CONF_CHECK_I(hw.adjusted_mode.crtc_hblank_end);
>> +	PIPE_CONF_CHECK_I(hw.adjusted_mode.crtc_hsync_start);
>> +	PIPE_CONF_CHECK_I(hw.adjusted_mode.crtc_hsync_end);
>>  
>> -	PIPE_CONF_CHECK_I(base.adjusted_mode.crtc_vdisplay);
>> -	PIPE_CONF_CHECK_I(base.adjusted_mode.crtc_vtotal);
>> -	PIPE_CONF_CHECK_I(base.adjusted_mode.crtc_vblank_start);
>> -	PIPE_CONF_CHECK_I(base.adjusted_mode.crtc_vblank_end);
>> -	PIPE_CONF_CHECK_I(base.adjusted_mode.crtc_vsync_start);
>> -	PIPE_CONF_CHECK_I(base.adjusted_mode.crtc_vsync_end);
>> +	PIPE_CONF_CHECK_I(hw.adjusted_mode.crtc_vdisplay);
>> +	PIPE_CONF_CHECK_I(hw.adjusted_mode.crtc_vtotal);
>> +	PIPE_CONF_CHECK_I(hw.adjusted_mode.crtc_vblank_start);
>> +	PIPE_CONF_CHECK_I(hw.adjusted_mode.crtc_vblank_end);
>> +	PIPE_CONF_CHECK_I(hw.adjusted_mode.crtc_vsync_start);
>> +	PIPE_CONF_CHECK_I(hw.adjusted_mode.crtc_vsync_end);
>>  
>>  	PIPE_CONF_CHECK_I(pixel_multiplier);
>>  	PIPE_CONF_CHECK_I(output_format);
>> @@ -13109,17 +13109,17 @@ intel_pipe_config_compare(const struct intel_crtc_state *current_config,
>>  
>>  	PIPE_CONF_CHECK_BOOL_INCOMPLETE(has_audio);
>>  
>> -	PIPE_CONF_CHECK_FLAGS(base.adjusted_mode.flags,
>> +	PIPE_CONF_CHECK_FLAGS(hw.adjusted_mode.flags,
>>  			      DRM_MODE_FLAG_INTERLACE);
>>  
>>  	if (!PIPE_CONF_QUIRK(PIPE_CONFIG_QUIRK_MODE_SYNC_FLAGS)) {
>> -		PIPE_CONF_CHECK_FLAGS(base.adjusted_mode.flags,
>> +		PIPE_CONF_CHECK_FLAGS(hw.adjusted_mode.flags,
>>  				      DRM_MODE_FLAG_PHSYNC);
>> -		PIPE_CONF_CHECK_FLAGS(base.adjusted_mode.flags,
>> +		PIPE_CONF_CHECK_FLAGS(hw.adjusted_mode.flags,
>>  				      DRM_MODE_FLAG_NHSYNC);
>> -		PIPE_CONF_CHECK_FLAGS(base.adjusted_mode.flags,
>> +		PIPE_CONF_CHECK_FLAGS(hw.adjusted_mode.flags,
>>  				      DRM_MODE_FLAG_PVSYNC);
>> -		PIPE_CONF_CHECK_FLAGS(base.adjusted_mode.flags,
>> +		PIPE_CONF_CHECK_FLAGS(hw.adjusted_mode.flags,
>>  				      DRM_MODE_FLAG_NVSYNC);
>>  	}
>>  
>> @@ -13158,7 +13158,7 @@ intel_pipe_config_compare(const struct intel_crtc_state *current_config,
>>  
>>  		bp_gamma = intel_color_get_gamma_bit_precision(pipe_config);
>>  		if (bp_gamma)
>> -			PIPE_CONF_CHECK_COLOR_LUT(gamma_mode, base.gamma_lut, bp_gamma);
>> +			PIPE_CONF_CHECK_COLOR_LUT(gamma_mode, hw.gamma_lut, bp_gamma);
>>  
>>  	}
>>  
>> @@ -13203,7 +13203,7 @@ intel_pipe_config_compare(const struct intel_crtc_state *current_config,
>>  	if (IS_G4X(dev_priv) || INTEL_GEN(dev_priv) >= 5)
>>  		PIPE_CONF_CHECK_I(pipe_bpp);
>>  
>> -	PIPE_CONF_CHECK_CLOCK_FUZZY(base.adjusted_mode.crtc_clock);
>> +	PIPE_CONF_CHECK_CLOCK_FUZZY(hw.adjusted_mode.crtc_clock);
>>  	PIPE_CONF_CHECK_CLOCK_FUZZY(port_clock);
>>  
>>  	PIPE_CONF_CHECK_I(min_voltage_level);
>> @@ -14010,7 +14010,7 @@ static int intel_atomic_check(struct drm_device *dev,
>>  		if (!needs_modeset(new_crtc_state))
>>  			continue;
>>  
>> -		if (!new_crtc_state->base.enable) {
>> +		if (!new_crtc_state->uapi.enable) {
>>  			any_ms = true;
>>  			continue;
>>  		}
>> -- 
>> 2.23.0
>>
>> _______________________________________________
>> Intel-gfx mailing list
>> Intel-gfx@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
index d0df9b24a969..4baa0226abff 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -11433,7 +11433,7 @@  int intel_get_load_detect_pipe(struct drm_connector *connector,
 		goto fail;
 	}
 
-	crtc_state->base.active = crtc_state->base.enable = true;
+	crtc_state->uapi.active = true;
 
 	if (!mode)
 		mode = &load_detect_mode;
@@ -13080,19 +13080,19 @@  intel_pipe_config_compare(const struct intel_crtc_state *current_config,
 
 	PIPE_CONF_CHECK_X(output_types);
 
-	PIPE_CONF_CHECK_I(base.adjusted_mode.crtc_hdisplay);
-	PIPE_CONF_CHECK_I(base.adjusted_mode.crtc_htotal);
-	PIPE_CONF_CHECK_I(base.adjusted_mode.crtc_hblank_start);
-	PIPE_CONF_CHECK_I(base.adjusted_mode.crtc_hblank_end);
-	PIPE_CONF_CHECK_I(base.adjusted_mode.crtc_hsync_start);
-	PIPE_CONF_CHECK_I(base.adjusted_mode.crtc_hsync_end);
+	PIPE_CONF_CHECK_I(hw.adjusted_mode.crtc_hdisplay);
+	PIPE_CONF_CHECK_I(hw.adjusted_mode.crtc_htotal);
+	PIPE_CONF_CHECK_I(hw.adjusted_mode.crtc_hblank_start);
+	PIPE_CONF_CHECK_I(hw.adjusted_mode.crtc_hblank_end);
+	PIPE_CONF_CHECK_I(hw.adjusted_mode.crtc_hsync_start);
+	PIPE_CONF_CHECK_I(hw.adjusted_mode.crtc_hsync_end);
 
-	PIPE_CONF_CHECK_I(base.adjusted_mode.crtc_vdisplay);
-	PIPE_CONF_CHECK_I(base.adjusted_mode.crtc_vtotal);
-	PIPE_CONF_CHECK_I(base.adjusted_mode.crtc_vblank_start);
-	PIPE_CONF_CHECK_I(base.adjusted_mode.crtc_vblank_end);
-	PIPE_CONF_CHECK_I(base.adjusted_mode.crtc_vsync_start);
-	PIPE_CONF_CHECK_I(base.adjusted_mode.crtc_vsync_end);
+	PIPE_CONF_CHECK_I(hw.adjusted_mode.crtc_vdisplay);
+	PIPE_CONF_CHECK_I(hw.adjusted_mode.crtc_vtotal);
+	PIPE_CONF_CHECK_I(hw.adjusted_mode.crtc_vblank_start);
+	PIPE_CONF_CHECK_I(hw.adjusted_mode.crtc_vblank_end);
+	PIPE_CONF_CHECK_I(hw.adjusted_mode.crtc_vsync_start);
+	PIPE_CONF_CHECK_I(hw.adjusted_mode.crtc_vsync_end);
 
 	PIPE_CONF_CHECK_I(pixel_multiplier);
 	PIPE_CONF_CHECK_I(output_format);
@@ -13109,17 +13109,17 @@  intel_pipe_config_compare(const struct intel_crtc_state *current_config,
 
 	PIPE_CONF_CHECK_BOOL_INCOMPLETE(has_audio);
 
-	PIPE_CONF_CHECK_FLAGS(base.adjusted_mode.flags,
+	PIPE_CONF_CHECK_FLAGS(hw.adjusted_mode.flags,
 			      DRM_MODE_FLAG_INTERLACE);
 
 	if (!PIPE_CONF_QUIRK(PIPE_CONFIG_QUIRK_MODE_SYNC_FLAGS)) {
-		PIPE_CONF_CHECK_FLAGS(base.adjusted_mode.flags,
+		PIPE_CONF_CHECK_FLAGS(hw.adjusted_mode.flags,
 				      DRM_MODE_FLAG_PHSYNC);
-		PIPE_CONF_CHECK_FLAGS(base.adjusted_mode.flags,
+		PIPE_CONF_CHECK_FLAGS(hw.adjusted_mode.flags,
 				      DRM_MODE_FLAG_NHSYNC);
-		PIPE_CONF_CHECK_FLAGS(base.adjusted_mode.flags,
+		PIPE_CONF_CHECK_FLAGS(hw.adjusted_mode.flags,
 				      DRM_MODE_FLAG_PVSYNC);
-		PIPE_CONF_CHECK_FLAGS(base.adjusted_mode.flags,
+		PIPE_CONF_CHECK_FLAGS(hw.adjusted_mode.flags,
 				      DRM_MODE_FLAG_NVSYNC);
 	}
 
@@ -13158,7 +13158,7 @@  intel_pipe_config_compare(const struct intel_crtc_state *current_config,
 
 		bp_gamma = intel_color_get_gamma_bit_precision(pipe_config);
 		if (bp_gamma)
-			PIPE_CONF_CHECK_COLOR_LUT(gamma_mode, base.gamma_lut, bp_gamma);
+			PIPE_CONF_CHECK_COLOR_LUT(gamma_mode, hw.gamma_lut, bp_gamma);
 
 	}
 
@@ -13203,7 +13203,7 @@  intel_pipe_config_compare(const struct intel_crtc_state *current_config,
 	if (IS_G4X(dev_priv) || INTEL_GEN(dev_priv) >= 5)
 		PIPE_CONF_CHECK_I(pipe_bpp);
 
-	PIPE_CONF_CHECK_CLOCK_FUZZY(base.adjusted_mode.crtc_clock);
+	PIPE_CONF_CHECK_CLOCK_FUZZY(hw.adjusted_mode.crtc_clock);
 	PIPE_CONF_CHECK_CLOCK_FUZZY(port_clock);
 
 	PIPE_CONF_CHECK_I(min_voltage_level);
@@ -14010,7 +14010,7 @@  static int intel_atomic_check(struct drm_device *dev,
 		if (!needs_modeset(new_crtc_state))
 			continue;
 
-		if (!new_crtc_state->base.enable) {
+		if (!new_crtc_state->uapi.enable) {
 			any_ms = true;
 			continue;
 		}