Skip to content

Commit 42a7b08

Browse files
Damien Lespiaudanvet
authored andcommitted
drm/i915: Make sure the primary plane is enabled before reading out the fb state
We don't want to end up in a state where we track that the pipe has its primary plane enabled when primary plane registers are programmed with values that look possible but the plane actually disabled. Refuse to read out the fb state when the primary plane isn't enabled. Suggested-by: Ville Syrjälä <[email protected]> Suggested-by: Matt Roper <[email protected]> Signed-off-by: Damien Lespiau <[email protected]> Reviewed-by: Matt Roper <[email protected]> Signed-off-by: Daniel Vetter <[email protected]>
1 parent fb9981a commit 42a7b08

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

drivers/gpu/drm/i915/intel_display.c

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6613,6 +6613,10 @@ i9xx_get_initial_plane_config(struct intel_crtc *crtc,
66136613
struct drm_framebuffer *fb;
66146614
struct intel_framebuffer *intel_fb;
66156615

6616+
val = I915_READ(DSPCNTR(plane));
6617+
if (!(val & DISPLAY_PLANE_ENABLE))
6618+
return;
6619+
66166620
intel_fb = kzalloc(sizeof(*intel_fb), GFP_KERNEL);
66176621
if (!intel_fb) {
66186622
DRM_DEBUG_KMS("failed to alloc fb\n");
@@ -6621,8 +6625,6 @@ i9xx_get_initial_plane_config(struct intel_crtc *crtc,
66216625

66226626
fb = &intel_fb->base;
66236627

6624-
val = I915_READ(DSPCNTR(plane));
6625-
66266628
if (INTEL_INFO(dev)->gen >= 4)
66276629
if (val & DISPPLANE_TILED)
66286630
plane_config->tiling = I915_TILING_X;
@@ -7654,6 +7656,9 @@ skylake_get_initial_plane_config(struct intel_crtc *crtc,
76547656
fb = &intel_fb->base;
76557657

76567658
val = I915_READ(PLANE_CTL(pipe, 0));
7659+
if (!(val & PLANE_CTL_ENABLE))
7660+
goto error;
7661+
76577662
if (val & PLANE_CTL_TILED_MASK)
76587663
plane_config->tiling = I915_TILING_X;
76597664

@@ -7741,6 +7746,10 @@ ironlake_get_initial_plane_config(struct intel_crtc *crtc,
77417746
struct drm_framebuffer *fb;
77427747
struct intel_framebuffer *intel_fb;
77437748

7749+
val = I915_READ(DSPCNTR(pipe));
7750+
if (!(val & DISPLAY_PLANE_ENABLE))
7751+
return;
7752+
77447753
intel_fb = kzalloc(sizeof(*intel_fb), GFP_KERNEL);
77457754
if (!intel_fb) {
77467755
DRM_DEBUG_KMS("failed to alloc fb\n");
@@ -7749,8 +7758,6 @@ ironlake_get_initial_plane_config(struct intel_crtc *crtc,
77497758

77507759
fb = &intel_fb->base;
77517760

7752-
val = I915_READ(DSPCNTR(pipe));
7753-
77547761
if (INTEL_INFO(dev)->gen >= 4)
77557762
if (val & DISPPLANE_TILED)
77567763
plane_config->tiling = I915_TILING_X;

0 commit comments

Comments
 (0)