From: Ville Syrjälä <[email protected]>

Since we now have a ->get_hw_state() method for planes, let's use
that during the initial plane fb readout.

Cc: Daniel Vetter <[email protected]>
Suggested-by: Daniel Vetter <[email protected]>
Signed-off-by: Ville Syrjälä <[email protected]>
---
 drivers/gpu/drm/i915/intel_display.c | 30 ++++++++++++++++--------------
 1 file changed, 16 insertions(+), 14 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c 
b/drivers/gpu/drm/i915/intel_display.c
index 2da670628e35..268d320690f4 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -7465,19 +7465,20 @@ i9xx_get_initial_plane_config(struct intel_crtc *crtc,
        struct drm_framebuffer *fb;
        struct intel_framebuffer *intel_fb;
 
+       if (!plane->get_hw_state(plane))
+               return;
+
+       intel_fb = kzalloc(sizeof(*intel_fb), GFP_KERNEL);
+       if (!intel_fb) {
+               DRM_DEBUG_KMS("failed to alloc fb\n");
+               return;
+       }
+
+       fb = &intel_fb->base;
+
+       fb->dev = dev;
+
        val = I915_READ(DSPCNTR(plane_id));
-       if (!(val & DISPLAY_PLANE_ENABLE))
-               return;
-
-       intel_fb = kzalloc(sizeof(*intel_fb), GFP_KERNEL);
-       if (!intel_fb) {
-               DRM_DEBUG_KMS("failed to alloc fb\n");
-               return;
-       }
-
-       fb = &intel_fb->base;
-
-       fb->dev = dev;
 
        if (INTEL_GEN(dev_priv) >= 4) {
                if (val & DISPPLANE_TILED) {
@@ -8496,6 +8497,9 @@ skylake_get_initial_plane_config(struct intel_crtc *crtc,
        struct drm_framebuffer *fb;
        struct intel_framebuffer *intel_fb;
 
+       if (!plane->get_hw_state(plane))
+               return;
+
        intel_fb = kzalloc(sizeof(*intel_fb), GFP_KERNEL);
        if (!intel_fb) {
                DRM_DEBUG_KMS("failed to alloc fb\n");
@@ -8507,8 +8511,6 @@ skylake_get_initial_plane_config(struct intel_crtc *crtc,
        fb->dev = dev;
 
        val = I915_READ(PLANE_CTL(pipe, plane_id));
-       if (!(val & PLANE_CTL_ENABLE))
-               goto error;
 
        pixel_format = val & PLANE_CTL_FORMAT_MASK;
        fourcc = skl_format_to_fourcc(pixel_format,
-- 
2.13.6

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to