Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/i915: Remove some duplicated plane swapping logic

On pre-gen4 we connect plane A to pipe B and vice versa to get an FBC
capable plane feeding the LVDS port by default. We have the logic for
the plane swapping duplicated in many places. Let's remove a bit of the
duplication by having the crtc look up the thing from the primary plane.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1478616439-10150-2-git-send-email-ville.syrjala@linux.intel.com
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>

+9 -12
+9 -12
drivers/gpu/drm/i915/intel_display.c
··· 15013 15013 state->scaler_id = -1; 15014 15014 } 15015 15015 primary->pipe = pipe; 15016 - primary->plane = pipe; 15016 + /* 15017 + * On gen2/3 only plane A can do FBC, but the panel fitter and LVDS 15018 + * port is hooked to pipe B. Hence we want plane A feeding pipe B. 15019 + */ 15020 + if (HAS_FBC(dev_priv) && INTEL_GEN(dev_priv) < 4) 15021 + primary->plane = (enum plane) !pipe; 15022 + else 15023 + primary->plane = (enum plane) pipe; 15017 15024 primary->frontbuffer_bit = INTEL_FRONTBUFFER_PRIMARY(pipe); 15018 15025 primary->check_plane = intel_check_primary_plane; 15019 - if (HAS_FBC(dev_priv) && INTEL_GEN(dev_priv) < 4) 15020 - primary->plane = !pipe; 15021 15026 15022 15027 if (INTEL_GEN(dev_priv) >= 9) { 15023 15028 intel_primary_formats = skl_primary_formats; ··· 15332 15327 if (ret) 15333 15328 goto fail; 15334 15329 15335 - /* 15336 - * On gen2/3 only plane A can do fbc, but the panel fitter and lvds port 15337 - * is hooked to pipe B. Hence we want plane A feeding pipe B. 15338 - */ 15339 15330 intel_crtc->pipe = pipe; 15340 - intel_crtc->plane = (enum plane) pipe; 15341 - if (HAS_FBC(dev_priv) && INTEL_GEN(dev_priv) < 4) { 15342 - DRM_DEBUG_KMS("swapping pipes & planes for FBC\n"); 15343 - intel_crtc->plane = !pipe; 15344 - } 15331 + intel_crtc->plane = primary->plane; 15345 15332 15346 15333 intel_crtc->cursor_base = ~0; 15347 15334 intel_crtc->cursor_cntl = ~0;