@@ -2236,11 +2236,7 @@ static void intel_enable_primary_hw_plane(struct drm_plane *plane,
2236
2236
2237
2237
/* If the pipe isn't enabled, we can't pump pixels and may hang */
2238
2238
assert_pipe_enabled (dev_priv , intel_crtc -> pipe );
2239
-
2240
- if (intel_crtc -> primary_enabled )
2241
- return ;
2242
-
2243
- intel_crtc -> primary_enabled = true;
2239
+ to_intel_plane_state (plane -> state )-> visible = true;
2244
2240
2245
2241
dev_priv -> display .update_primary_plane (crtc , plane -> fb ,
2246
2242
crtc -> x , crtc -> y );
@@ -2661,14 +2657,16 @@ static void i9xx_update_primary_plane(struct drm_crtc *crtc,
2661
2657
struct drm_device * dev = crtc -> dev ;
2662
2658
struct drm_i915_private * dev_priv = dev -> dev_private ;
2663
2659
struct intel_crtc * intel_crtc = to_intel_crtc (crtc );
2660
+ struct drm_plane * primary = crtc -> primary ;
2661
+ bool visible = to_intel_plane_state (primary -> state )-> visible ;
2664
2662
struct drm_i915_gem_object * obj ;
2665
2663
int plane = intel_crtc -> plane ;
2666
2664
unsigned long linear_offset ;
2667
2665
u32 dspcntr ;
2668
2666
u32 reg = DSPCNTR (plane );
2669
2667
int pixel_size ;
2670
2668
2671
- if (!intel_crtc -> primary_enabled || !fb ) {
2669
+ if (!visible || !fb ) {
2672
2670
I915_WRITE (reg , 0 );
2673
2671
if (INTEL_INFO (dev )-> gen >= 4 )
2674
2672
I915_WRITE (DSPSURF (plane ), 0 );
@@ -2790,14 +2788,16 @@ static void ironlake_update_primary_plane(struct drm_crtc *crtc,
2790
2788
struct drm_device * dev = crtc -> dev ;
2791
2789
struct drm_i915_private * dev_priv = dev -> dev_private ;
2792
2790
struct intel_crtc * intel_crtc = to_intel_crtc (crtc );
2791
+ struct drm_plane * primary = crtc -> primary ;
2792
+ bool visible = to_intel_plane_state (primary -> state )-> visible ;
2793
2793
struct drm_i915_gem_object * obj ;
2794
2794
int plane = intel_crtc -> plane ;
2795
2795
unsigned long linear_offset ;
2796
2796
u32 dspcntr ;
2797
2797
u32 reg = DSPCNTR (plane );
2798
2798
int pixel_size ;
2799
2799
2800
- if (!intel_crtc -> primary_enabled || !fb ) {
2800
+ if (!visible || !fb ) {
2801
2801
I915_WRITE (reg , 0 );
2802
2802
I915_WRITE (DSPSURF (plane ), 0 );
2803
2803
POSTING_READ (reg );
@@ -3059,24 +3059,24 @@ static void skylake_update_primary_plane(struct drm_crtc *crtc,
3059
3059
struct drm_device * dev = crtc -> dev ;
3060
3060
struct drm_i915_private * dev_priv = dev -> dev_private ;
3061
3061
struct intel_crtc * intel_crtc = to_intel_crtc (crtc );
3062
+ struct drm_plane * plane = crtc -> primary ;
3063
+ bool visible = to_intel_plane_state (plane -> state )-> visible ;
3062
3064
struct drm_i915_gem_object * obj ;
3063
3065
int pipe = intel_crtc -> pipe ;
3064
3066
u32 plane_ctl , stride_div , stride ;
3065
3067
u32 tile_height , plane_offset , plane_size ;
3066
3068
unsigned int rotation ;
3067
3069
int x_offset , y_offset ;
3068
3070
unsigned long surf_addr ;
3069
- struct drm_plane * plane ;
3070
3071
struct intel_crtc_state * crtc_state = intel_crtc -> config ;
3071
3072
struct intel_plane_state * plane_state ;
3072
3073
int src_x = 0 , src_y = 0 , src_w = 0 , src_h = 0 ;
3073
3074
int dst_x = 0 , dst_y = 0 , dst_w = 0 , dst_h = 0 ;
3074
3075
int scaler_id = -1 ;
3075
3076
3076
- plane = crtc -> primary ;
3077
3077
plane_state = to_intel_plane_state (plane -> state );
3078
3078
3079
- if (!intel_crtc -> primary_enabled || !fb ) {
3079
+ if (!visible || !fb ) {
3080
3080
I915_WRITE (PLANE_CTL (pipe , 0 ), 0 );
3081
3081
I915_WRITE (PLANE_SURF (pipe , 0 ), 0 );
3082
3082
POSTING_READ (PLANE_CTL (pipe , 0 ));
@@ -4783,7 +4783,6 @@ static void intel_crtc_disable_planes(struct drm_crtc *crtc)
4783
4783
hsw_disable_ips (intel_crtc );
4784
4784
4785
4785
intel_crtc_dpms_overlay (intel_crtc , false);
4786
- intel_crtc -> primary_enabled = false;
4787
4786
for_each_intel_plane (dev , intel_plane ) {
4788
4787
if (intel_plane -> pipe == pipe ) {
4789
4788
struct drm_crtc * from = intel_plane -> base .crtc ;
@@ -12891,6 +12890,9 @@ static int intel_crtc_set_config(struct drm_mode_set *set)
12891
12890
} else if (config -> fb_changed ) {
12892
12891
struct intel_crtc * intel_crtc = to_intel_crtc (set -> crtc );
12893
12892
struct drm_plane * primary = set -> crtc -> primary ;
12893
+ struct intel_plane_state * plane_state =
12894
+ to_intel_plane_state (primary -> state );
12895
+ bool was_visible = plane_state -> visible ;
12894
12896
int vdisplay , hdisplay ;
12895
12897
12896
12898
drm_crtc_get_hv_timing (set -> mode , & hdisplay , & vdisplay );
@@ -12903,7 +12905,8 @@ static int intel_crtc_set_config(struct drm_mode_set *set)
12903
12905
* We need to make sure the primary plane is re-enabled if it
12904
12906
* has previously been turned off.
12905
12907
*/
12906
- if (!intel_crtc -> primary_enabled && ret == 0 ) {
12908
+ plane_state = to_intel_plane_state (primary -> state );
12909
+ if (ret == 0 && !was_visible && plane_state -> visible ) {
12907
12910
WARN_ON (!intel_crtc -> active );
12908
12911
intel_enable_primary_hw_plane (set -> crtc -> primary , set -> crtc );
12909
12912
}
@@ -13239,6 +13242,9 @@ intel_check_primary_plane(struct drm_plane *plane,
13239
13242
return ret ;
13240
13243
13241
13244
if (intel_crtc -> active ) {
13245
+ struct intel_plane_state * old_state =
13246
+ to_intel_plane_state (plane -> state );
13247
+
13242
13248
intel_crtc -> atomic .wait_for_flips = true;
13243
13249
13244
13250
/*
@@ -13251,20 +13257,20 @@ intel_check_primary_plane(struct drm_plane *plane,
13251
13257
* one is done too late. We eventually need to unify
13252
13258
* this.
13253
13259
*/
13254
- if (intel_crtc -> primary_enabled &&
13260
+ if (state -> visible &&
13255
13261
INTEL_INFO (dev )-> gen <= 4 && !IS_G4X (dev ) &&
13256
13262
dev_priv -> fbc .crtc == intel_crtc &&
13257
13263
state -> base .rotation != BIT (DRM_ROTATE_0 )) {
13258
13264
intel_crtc -> atomic .disable_fbc = true;
13259
13265
}
13260
13266
13261
- if (state -> visible ) {
13267
+ if (state -> visible && ! old_state -> visible ) {
13262
13268
/*
13263
13269
* BDW signals flip done immediately if the plane
13264
13270
* is disabled, even if the plane enable is already
13265
13271
* armed to occur at the next vblank :(
13266
13272
*/
13267
- if (IS_BROADWELL (dev ) && ! intel_crtc -> primary_enabled )
13273
+ if (IS_BROADWELL (dev ))
13268
13274
intel_crtc -> atomic .wait_vblank = true;
13269
13275
}
13270
13276
@@ -13306,8 +13312,6 @@ intel_commit_primary_plane(struct drm_plane *plane,
13306
13312
crtc -> y = src -> y1 >> 16 ;
13307
13313
13308
13314
if (intel_crtc -> active ) {
13309
- intel_crtc -> primary_enabled = state -> visible ;
13310
-
13311
13315
if (state -> visible )
13312
13316
/* FIXME: kill this fastboot hack */
13313
13317
intel_update_pipe_size (intel_crtc );
@@ -13325,9 +13329,6 @@ intel_disable_primary_plane(struct drm_plane *plane,
13325
13329
struct drm_device * dev = plane -> dev ;
13326
13330
struct drm_i915_private * dev_priv = dev -> dev_private ;
13327
13331
13328
- if (!force )
13329
- to_intel_crtc (crtc )-> primary_enabled = false;
13330
-
13331
13332
dev_priv -> display .update_primary_plane (crtc , NULL , 0 , 0 );
13332
13333
}
13333
13334
@@ -14791,8 +14792,8 @@ static void intel_sanitize_crtc(struct intel_crtc *crtc)
14791
14792
* Temporarily change the plane mapping and disable everything
14792
14793
* ... */
14793
14794
plane = crtc -> plane ;
14795
+ to_intel_plane_state (crtc -> base .primary -> state )-> visible = true;
14794
14796
crtc -> plane = !plane ;
14795
- crtc -> primary_enabled = true;
14796
14797
dev_priv -> display .crtc_disable (& crtc -> base );
14797
14798
crtc -> plane = plane ;
14798
14799
@@ -14969,6 +14970,9 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev)
14969
14970
int i ;
14970
14971
14971
14972
for_each_intel_crtc (dev , crtc ) {
14973
+ struct drm_plane * primary = crtc -> base .primary ;
14974
+ struct intel_plane_state * plane_state ;
14975
+
14972
14976
memset (crtc -> config , 0 , sizeof (* crtc -> config ));
14973
14977
14974
14978
crtc -> config -> quirks |= PIPE_CONFIG_QUIRK_INHERITED_MODE ;
@@ -14978,7 +14982,9 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev)
14978
14982
14979
14983
crtc -> base .state -> enable = crtc -> active ;
14980
14984
crtc -> base .enabled = crtc -> active ;
14981
- crtc -> primary_enabled = primary_get_hw_state (crtc );
14985
+
14986
+ plane_state = to_intel_plane_state (primary -> state );
14987
+ plane_state -> visible = primary_get_hw_state (crtc );
14982
14988
14983
14989
DRM_DEBUG_KMS ("[CRTC:%d] hw state readout: %s\n" ,
14984
14990
crtc -> base .base .id ,
0 commit comments