refactor intel display a bit more
Subsystems (3)
Dave Airlie
maintainerThe first 3 are just moving some functions to inline and fixing a wrong comma, the next 4 are cleaned up from yesterday.
hsw fdi is definitely a WIP.
Skl planes migration is along the lines of what danvet asked for.
Dave.
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Dave Airlie
maintainerPATCH 1/9 drm/i915/display: move needs_modeset to an inline in header
From: Dave Airlie <[email protected]>
This function is going to be used in a later change, so clean it up first before moving it.
--- drivers/gpu/drm/i915/display/intel_display.c | 78 +++++++++---------- .../drm/i915/display/intel_display_types.h | 6 ++ 2 files changed, 42 insertions(+), 42 deletions(-)
drivers/gpu/drm/i915/display/intel_display.c +36 -42
@@ -542,12 +542,6 @@ icl_wa_scalerclkgating(struct drm_i915_private *dev_priv, enum pipe pipe, intel_de_read(dev_priv, CLKGATE_DIS_PSL(pipe)) & ~DPFR_GATING_DIS); } -static bool -needs_modeset (const struct intel_crtc_state *state) -{ -return drm_atomic_crtc_needs_modeset (&state->uapi); -} -static bool is_trans_port_sync_slave (const struct intel_crtc_state *crtc_state) {
@@ -6474,7 +6468,7 @@ static bool hsw_pre_update_disable_ips(const struct intel_crtc_state *old_crtc_sif (!old_crtc_state->ips_enabled)return false; -if (needs_modeset (new_crtc_state)) +if (intel_crtc_needs_modeset (new_crtc_state))return true;/*
@@ -6501,7 +6495,7 @@ static bool hsw_post_update_enable_ips(const struct intel_crtc_state *old_crtc_sif (!new_crtc_state->ips_enabled)return false; -if (needs_modeset (new_crtc_state)) +if (intel_crtc_needs_modeset (new_crtc_state))return true;/*
@@ -6554,7 +6548,7 @@ static bool needs_scalerclk_wa(const struct intel_crtc_state *crtc_state)static bool planes_enabling (const struct intel_crtc_state *old_crtc_state,const struct intel_crtc_state *new_crtc_state) { -return (!old_crtc_state->active_planes ||needs_modeset (new_crtc_state)) && +return (!old_crtc_state->active_planes ||intel_crtc_needs_modeset (new_crtc_state)) && new_crtc_state->active_planes; }
@@ -6562,7 +6556,7 @@ static bool planes_disabling(const struct intel_crtc_state *old_crtc_state, const struct intel_crtc_state *new_crtc_state) {return old_crtc_state->active_planes && - (!new_crtc_state->active_planes ||needs_modeset (new_crtc_state)); + (!new_crtc_state->active_planes ||intel_crtc_needs_modeset (new_crtc_state)); } static void intel_post_plane_update(struct intel_atomic_state *state,
@@ -6685,7 +6679,7 @@ static void intel_pre_plane_update(struct intel_atomic_state *state,* If we're doing a modeset we don't need to do any * pre-vblank watermark programming here. */ -if (!needs_modeset (new_crtc_state)) { +if (!intel_crtc_needs_modeset (new_crtc_state)) {/* * For platforms that support atomic watermarks, program the * 'intermediate' watermarks immediately. On pre-gen9 platforms, these
@@ -12046,7 +12040,7 @@ static void i9xx_update_cursor(struct intel_plane *plane,if (INTEL_GEN (dev_priv) >=9 )skl_write_cursor_wm (plane, crtc_state); -if (!needs_modeset (crtc_state)) +if (!intel_crtc_needs_modeset (crtc_state))intel_psr2_program_plane_sel_fetch (plane, crtc_state, plane_state,0 ); if (plane->cursor.base != base ||
@@ -12616,7 +12610,7 @@ int intel_plane_atomic_calc_changes(const struct intel_crtc_state *old_crtc_statstruct intel_crtc *crtc =to_intel_crtc (crtc_state->uapi.crtc);struct intel_plane *plane =to_intel_plane (plane_state->uapi.plane);struct drm_i915_private *dev_priv =to_i915 (crtc->base.dev); -bool mode_changed =needs_modeset (crtc_state); +bool mode_changed =intel_crtc_needs_modeset (crtc_state);bool was_crtc_enabled = old_crtc_state->hw.active;bool is_crtc_enabled = crtc_state->hw.active;bool turn_off, turn_on, visible, was_visible;
@@ -12980,7 +12974,7 @@ static int intel_crtc_atomic_check(struct intel_atomic_state *state,struct drm_i915_private *dev_priv =to_i915 (crtc->base.dev);struct intel_crtc_state *crtc_state =intel_atomic_get_new_crtc_state (state, crtc); -bool mode_changed =needs_modeset (crtc_state); +bool mode_changed =intel_crtc_needs_modeset (crtc_state);int ret; if (INTEL_GEN(dev_priv) < 5 && !IS_G4X(dev_priv) &&
@@ -14812,7 +14806,7 @@ intel_modeset_verify_crtc(struct intel_crtc *crtc, struct intel_crtc_state *old_crtc_state, struct intel_crtc_state *new_crtc_state) { -if (!needs_modeset (new_crtc_state) && !new_crtc_state->update_pipe) +if (!intel_crtc_needs_modeset (new_crtc_state) && !new_crtc_state->update_pipe)return ;verify_wm_state (crtc, new_crtc_state);
@@ -14907,7 +14901,7 @@ static void intel_modeset_clear_plls(struct intel_atomic_state *state)return ;for_each_new_intel_crtc_in_state (state, crtc, new_crtc_state, i) { -if (!needs_modeset (new_crtc_state)) +if (!intel_crtc_needs_modeset (new_crtc_state))continue ;intel_release_shared_dplls (state, crtc);
@@ -14932,7 +14926,7 @@ static int hsw_mode_set_planes_workaround(struct intel_atomic_state *state)/* look at all crtc's that are going to be enabled in during modeset */ for_each_new_intel_crtc_in_state (state, crtc, crtc_state, i) {if (!crtc_state->hw.active || - !needs_modeset (crtc_state)) + !intel_crtc_needs_modeset (crtc_state))continue ;if (first_crtc_state) {
@@ -14957,7 +14951,7 @@ static int hsw_mode_set_planes_workaround(struct intel_atomic_state *state) crtc_state->hsw_workaround_pipe =INVALID_PIPE ;if (!crtc_state->hw.active || -needs_modeset (crtc_state)) +intel_crtc_needs_modeset (crtc_state))continue ;/* 2 or more enabled crtcs means no need for w/a */
@@ -15276,7 +15270,7 @@ static bool intel_cpu_transcoders_need_modeset(struct intel_atomic_state *state,for_each_new_intel_crtc_in_state (state, crtc, new_crtc_state, i) {if (new_crtc_state->hw.enable && transcoders &BIT (new_crtc_state->cpu_transcoder) && -needs_modeset (new_crtc_state)) +intel_crtc_needs_modeset (new_crtc_state))return true; }
@@ -15297,7 +15291,7 @@ static int intel_atomic_check_bigjoiner(struct intel_atomic_state *state, slave = crtc; master = old_crtc_state->bigjoiner_linked_crtc; master_crtc_state =intel_atomic_get_new_crtc_state (state, master); -if (!master_crtc_state || !needs_modeset (master_crtc_state)) +if (!master_crtc_state || !intel_crtc_needs_modeset (master_crtc_state)) goto claimed; }
@@ -15376,7 +15370,7 @@ static int intel_atomic_check_async(struct intel_atomic_state *state)for_each_oldnew_intel_crtc_in_state (state, crtc, old_crtc_state, new_crtc_state, i) { -if (needs_modeset (new_crtc_state)) { +if (intel_crtc_needs_modeset (new_crtc_state)) {drm_dbg_kms (&i915->drm,"Modeset Required. Async flip not supported\n" );return -EINVAL ; }
@@ -15499,7 +15493,7 @@ static int intel_bigjoiner_add_affected_crtcs(struct intel_atomic_state *state)if (IS_ERR (linked_crtc_state))return PTR_ERR (linked_crtc_state); -if (!needs_modeset (crtc_state)) +if (!intel_crtc_needs_modeset (crtc_state))continue ; linked_crtc_state->uapi.mode_changed = true;
@@ -15516,7 +15510,7 @@ static int intel_bigjoiner_add_affected_crtcs(struct intel_atomic_state *state)for_each_new_intel_crtc_in_state (state, crtc, crtc_state, i) {/* Kill old bigjoiner link, we may re-establish afterwards */ -if (needs_modeset (crtc_state) && +if (intel_crtc_needs_modeset (crtc_state) && crtc_state->bigjoiner && !crtc_state->bigjoiner_slave)kill_bigjoiner_slave (state, crtc_state); }
@@ -15555,7 +15549,7 @@ static int intel_atomic_check(struct drm_device *dev,for_each_oldnew_intel_crtc_in_state (state, crtc, old_crtc_state, new_crtc_state, i) { -if (!needs_modeset (new_crtc_state)) { +if (!intel_crtc_needs_modeset (new_crtc_state)) {/* Light copy */ intel_crtc_copy_uapi_to_hw_state_nomodeset (state, new_crtc_state);
@@ -15586,7 +15580,7 @@ static int intel_atomic_check(struct drm_device *dev,for_each_oldnew_intel_crtc_in_state (state, crtc, old_crtc_state, new_crtc_state, i) { -if (!needs_modeset (new_crtc_state)) +if (!intel_crtc_needs_modeset (new_crtc_state))continue ; ret =intel_modeset_pipe_config_late (new_crtc_state);
@@ -15608,7 +15602,7 @@ static int intel_atomic_check(struct drm_device *dev,* forced a full modeset. */ for_each_new_intel_crtc_in_state (state, crtc, new_crtc_state, i) { -if (!new_crtc_state->hw.enable ||needs_modeset (new_crtc_state)) +if (!new_crtc_state->hw.enable ||intel_crtc_needs_modeset (new_crtc_state))continue ;if (intel_dp_mst_is_slave_trans (new_crtc_state)) {
@@ -15636,7 +15630,7 @@ static int intel_atomic_check(struct drm_device *dev,struct intel_crtc_state *linked_crtc_state =intel_atomic_get_new_crtc_state (state, new_crtc_state->bigjoiner_linked_crtc); -if (needs_modeset (linked_crtc_state)) { +if (intel_crtc_needs_modeset (linked_crtc_state)) { new_crtc_state->uapi.mode_changed = true; new_crtc_state->update_pipe = false; }
@@ -15645,7 +15639,7 @@ static int intel_atomic_check(struct drm_device *dev,for_each_oldnew_intel_crtc_in_state (state, crtc, old_crtc_state, new_crtc_state, i) { -if (needs_modeset (new_crtc_state)) { +if (intel_crtc_needs_modeset (new_crtc_state)) { any_ms = true;continue ; }
@@ -15722,12 +15716,12 @@ static int intel_atomic_check(struct drm_device *dev, goto fail; } -if (!needs_modeset (new_crtc_state) && +if (!intel_crtc_needs_modeset (new_crtc_state) && !new_crtc_state->update_pipe)continue ;intel_dump_pipe_config (new_crtc_state, state, -needs_modeset (new_crtc_state) ? +intel_crtc_needs_modeset (new_crtc_state) ?"[modeset]" :"[fastset]" ); }
@@ -15759,7 +15753,7 @@ static int intel_atomic_prepare_commit(struct intel_atomic_state *state)return ret;for_each_new_intel_crtc_in_state (state, crtc, crtc_state, i) { -bool mode_changed =needs_modeset (crtc_state); +bool mode_changed =intel_crtc_needs_modeset (crtc_state);if (mode_changed || crtc_state->update_pipe || crtc_state->uapi.color_mgmt_changed) {
@@ -15850,7 +15844,7 @@ static void commit_pipe_config(struct intel_atomic_state *state,intel_atomic_get_old_crtc_state (state, crtc);const struct intel_crtc_state *new_crtc_state =intel_atomic_get_new_crtc_state (state, crtc); -bool modeset =needs_modeset (new_crtc_state); +bool modeset =intel_crtc_needs_modeset (new_crtc_state);/* * During modesets pipe configuration was programmed as the
@@ -15884,7 +15878,7 @@ static void intel_enable_crtc(struct intel_atomic_state *state,const struct intel_crtc_state *new_crtc_state =intel_atomic_get_new_crtc_state (state, crtc); -if (!needs_modeset (new_crtc_state)) +if (!intel_crtc_needs_modeset (new_crtc_state))return ;intel_crtc_update_active_timings (new_crtc_state);
@@ -15906,7 +15900,7 @@ static void intel_update_crtc(struct intel_atomic_state *state,intel_atomic_get_old_crtc_state (state, crtc);struct intel_crtc_state *new_crtc_state =intel_atomic_get_new_crtc_state (state, crtc); -bool modeset =needs_modeset (new_crtc_state); +bool modeset =intel_crtc_needs_modeset (new_crtc_state);if (!modeset) { if (new_crtc_state->preload_luts &&
@@ -15998,7 +15992,7 @@ static void intel_commit_modeset_disables(struct intel_atomic_state *state)/* Only disable port sync and MST slaves */ for_each_oldnew_intel_crtc_in_state (state, crtc, old_crtc_state, new_crtc_state, i) { -if (!needs_modeset (new_crtc_state) || old_crtc_state->bigjoiner) +if (!intel_crtc_needs_modeset (new_crtc_state) || old_crtc_state->bigjoiner)continue ;if (!old_crtc_state->hw.active)
@@ -16022,7 +16016,7 @@ static void intel_commit_modeset_disables(struct intel_atomic_state *state)/* Disable everything else left on */ for_each_oldnew_intel_crtc_in_state (state, crtc, old_crtc_state, new_crtc_state, i) { -if (!needs_modeset (new_crtc_state) || +if (!intel_crtc_needs_modeset (new_crtc_state) || (handled &BIT (crtc->pipe)) || old_crtc_state->bigjoiner_slave)continue ;
@@ -16072,7 +16066,7 @@ static void skl_commit_modeset_enables(struct intel_atomic_state *state)continue ;/* ignore allocations for crtc's that have been turned off. */ -if (!needs_modeset (new_crtc_state)) { +if (!intel_crtc_needs_modeset (new_crtc_state)) { entries[pipe] = old_crtc_state->wm.skl.ddb; update_pipes |=BIT (pipe); }else {
@@ -16267,7 +16261,7 @@ static void intel_atomic_commit_tail(struct intel_atomic_state *state)for_each_oldnew_intel_crtc_in_state (state, crtc, old_crtc_state, new_crtc_state, i) { -if (needs_modeset (new_crtc_state) || +if (intel_crtc_needs_modeset (new_crtc_state) || new_crtc_state->update_pipe) { put_domains[crtc->pipe] =
@@ -16293,7 +16287,7 @@ static void intel_atomic_commit_tail(struct intel_atomic_state *state)/* Complete the events for pipes that have now been disabled */ for_each_new_intel_crtc_in_state (state, crtc, new_crtc_state, i) { -bool modeset =needs_modeset (new_crtc_state); +bool modeset =intel_crtc_needs_modeset (new_crtc_state);/* Complete events for now disable pipes here. */ if (modeset && !new_crtc_state->hw.active && new_crtc_state->uapi.event) {
@@ -16341,7 +16335,7 @@ static void intel_atomic_commit_tail(struct intel_atomic_state *state)skl_disable_flip_done (crtc);if (new_crtc_state->hw.active && - !needs_modeset (new_crtc_state) && + !intel_crtc_needs_modeset (new_crtc_state) && !new_crtc_state->preload_luts && (new_crtc_state->uapi.color_mgmt_changed || new_crtc_state->update_pipe))
@@ -16712,7 +16706,7 @@ intel_prepare_plane_fb(struct drm_plane *_plane,* This should only fail upon a hung GPU, in which case we * can safely continue. */ -if (needs_modeset (crtc_state)) { +if (intel_crtc_needs_modeset (crtc_state)) { ret = i915_sw_fence_await_reservation(&state->commit_ready, old_obj->base.resv, NULL, false, 0,
@@ -16937,7 +16931,7 @@ intel_legacy_cursor_update(struct drm_plane *_plane,* * FIXME bigjoiner fastpath would be good */ -if (!crtc_state->hw.active ||needs_modeset (crtc_state) || +if (!crtc_state->hw.active ||intel_crtc_needs_modeset (crtc_state) || crtc_state->update_pipe || crtc_state->bigjoiner) goto slow;
drivers/gpu/drm/i915/display/intel_display_types.h +6 -0
@@ -1777,6 +1777,12 @@ intel_crtc_has_dp_encoder(const struct intel_crtc_state *crtc_state) (1 << INTEL_OUTPUT_EDP)); } +static inline bool +intel_crtc_needs_modeset (const struct intel_crtc_state *state) +{ +return drm_atomic_crtc_needs_modeset (&state->uapi); +} +static inline void intel_wait_for_vblank (struct drm_i915_private *dev_priv,enum pipe pipe) {
Signature · 6 lines
2.27.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH 1/9] drm/i915/display: move needs_modeset to an inline in header
Quoted 11 lines · Dave Airlie
From: Dave Airlie <[email protected]>
This function is going to be used in a later change, so clean it up first before moving it.
Signed-off-by Dave Airlie <[email protected]>--- drivers/gpu/drm/i915/display/intel_display.c | 78 +++++++++---------- .../drm/i915/display/intel_display_types.h | 6 ++ 2 files changed, 42 insertions(+), 42 deletions(-)
<snip>
drivers/gpu/drm/i915/display/intel_display_types.h intel_crtc_has_dp_encoder(const struct intel_crtc_state *crtc_state) · line 1781
Quoted 10 lines
drivers/gpu/drm/i915/display/intel_display_types.h +2
-0@@ -1777,6 +1777,12 @@ intel_crtc_has_dp_encoder(const struct intel_crtc_state *crtc_state) (1 << INTEL_OUTPUT_EDP)); } +static inline bool +intel_crtc_needs_modeset (const struct intel_crtc_state *state)
s/state/crtc_state/ please.
With that
Quoted 14 lines
drivers/gpu/drm/i915/display/intel_display_types.h +4
-0+{ +return drm_atomic_crtc_needs_modeset (&state->uapi); +} +static inline void intel_wait_for_vblank (struct drm_i915_private *dev_priv,enum pipe pipe) {Signature · 6 lines
2.27.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 6 lines
Ville Syrjälä Intel _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Dave Airlie
maintainerPATCH 2/9 drm/i915/display: move to_intel_frontbuffer to header
In reply to Dave AirlieFrom: Dave Airlie <[email protected]>
This will be used for some refactoring in other files, so move it first.
--- drivers/gpu/drm/i915/display/intel_display.c | 6 ------ drivers/gpu/drm/i915/display/intel_display_types.h | 6 ++++++ 2 files changed, 6 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/display/intel_display.c +0 -6
@@ -3611,12 +3611,6 @@ static void intel_plane_disable_noatomic(struct intel_crtc *crtc,intel_disable_plane (plane, crtc_state); } -static struct intel_frontbuffer * -to_intel_frontbuffer (struct drm_framebuffer *fb) -{ -return fb ?to_intel_framebuffer (fb)->frontbuffer :NULL ; -} -static void intel_find_initial_plane_obj (struct intel_crtc *intel_crtc,struct intel_initial_plane_config *plane_config)
drivers/gpu/drm/i915/display/intel_display_types.h +6 -0
@@ -1805,4 +1805,10 @@ static inline u32 intel_plane_ggtt_offset(const struct intel_plane_state *state) return i915_ggtt_offset(state->vma); } +static inline struct intel_frontbuffer * +to_intel_frontbuffer (struct drm_framebuffer *fb) +{ +return fb ?to_intel_framebuffer (fb)->frontbuffer :NULL ; +} +#endif /* __INTEL_DISPLAY_TYPES_H__ */
Signature · 6 lines
2.27.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH 2/9] drm/i915/display: move to_intel_frontbuffer to header
Quoted 6 lines · Dave Airlie
From: Dave Airlie <[email protected]>
This will be used for some refactoring in other files, so move it first.
Signed-off-by Dave Airlie <[email protected]>
Quoted 44 lines
--- drivers/gpu/drm/i915/display/intel_display.c | 6 ------ drivers/gpu/drm/i915/display/intel_display_types.h | 6 ++++++ 2 files changed, 6 insertions(+), 6 deletions(-)drivers/gpu/drm/i915/display/intel_display.c +0
-6@@ -3611,12 +3611,6 @@ static void intel_plane_disable_noatomic(struct intel_crtc *crtc,intel_disable_plane (plane, crtc_state); } -static struct intel_frontbuffer * -to_intel_frontbuffer (struct drm_framebuffer *fb) -{ -return fb ?to_intel_framebuffer (fb)->frontbuffer :NULL ; -} -static void intel_find_initial_plane_obj (struct intel_crtc *intel_crtc,struct intel_initial_plane_config *plane_config)drivers/gpu/drm/i915/display/intel_display_types.h +6
-0@@ -1805,4 +1805,10 @@ static inline u32 intel_plane_ggtt_offset(const struct intel_plane_state *state) return i915_ggtt_offset(state->vma); } +static inline struct intel_frontbuffer * +to_intel_frontbuffer (struct drm_framebuffer *fb) +{ +return fb ?to_intel_framebuffer (fb)->frontbuffer :NULL ; +} +#endif /* __INTEL_DISPLAY_TYPES_H__ */ Signature · 6 lines
2.27.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 6 lines
Ville Syrjälä Intel _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Dave Airlie
maintainerPATCH 3/9 drm/i915/display: fix misused comma
In reply to Dave AirlieFrom: Dave Airlie <[email protected]>
There is no need for a comma use here.
--- drivers/gpu/drm/i915/display/intel_display.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/display/intel_display.c +2 -1
@@ -989,7 +989,8 @@ chv_find_best_dpll(const struct intel_limit *limit,* set to 2. If requires to support 200Mhz refclk, we need to * revisit this because n may not 1 anymore. */ - clock.n =1 , clock.m1 =2 ; + clock.n =1 ; + clock.m1 =2 ; target *=5 ;/* fast clock */ for (clock.p1 = limit->p1.max; clock.p1 >= limit->p1.min; clock.p1--) {
Signature · 6 lines
2.27.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH 3/9] drm/i915/display: fix misused comma
Quoted 5 lines · Dave Airlie
From: Dave Airlie <[email protected]>
There is no need for a comma use here.
Signed-off-by Dave Airlie <[email protected]>
Quoted 25 lines
--- drivers/gpu/drm/i915/display/intel_display.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/gpu/drm/i915/display/intel_display.c +2
-1@@ -989,7 +989,8 @@ chv_find_best_dpll(const struct intel_limit *limit,* set to 2. If requires to support 200Mhz refclk, we need to * revisit this because n may not 1 anymore. */ - clock.n =1 , clock.m1 =2 ; + clock.n =1 ; + clock.m1 =2 ; target *=5 ;/* fast clock */ for (clock.p1 = limit->p1.max; clock.p1 >= limit->p1.min; clock.p1--) {Signature · 6 lines
2.27.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 6 lines
Ville Syrjälä Intel _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Dave Airlie
maintainerPATCH 4/9 drm/i915: refactor cursor code out of i915_display.c
In reply to Dave AirlieFrom: Dave Airlie <[email protected]>
This file is a monster, let's start simple, the cursor plane code seems pretty standalone, and splits out easily enough.
--- drivers/gpu/drm/i915/Makefile | 1 + drivers/gpu/drm/i915/display/intel_cursor.c | 805 +++++++++++++++++++ drivers/gpu/drm/i915/display/intel_display.c | 796 +----------------- drivers/gpu/drm/i915/display/intel_display.h | 12 + 4 files changed, 824 insertions(+), 790 deletions(-) create mode 100644 drivers/gpu/drm/i915/display/intel_cursor.c
drivers/gpu/drm/i915/Makefile +1 -0
@@ -197,6 +197,7 @@ i915-y += \ display/intel_combo_phy.o \ display/intel_connector.o \ display/intel_csr.o \ + display/intel_cursor.o \ display/intel_display.o \ display/intel_display_power.o \ display/intel_dpio_phy.o \
drivers/gpu/drm/i915/display/intel_cursor.c new file +805 -0
805 lines not on this page · raw message
drivers/gpu/drm/i915/display/intel_display.c +6 -790
850 lines not on this page · raw message
drivers/gpu/drm/i915/display/intel_display.h +12 -0
@@ -647,6 +647,18 @@ bool intel_format_info_is_yuv_semiplanar(const struct drm_format_info *info, uint64_t modifier); +int intel_plane_compute_gtt (struct intel_plane_state *plane_state); +u32 intel_plane_compute_aligned_offset (int *x,int *y, +const struct intel_plane_state *state, +int color_plane); +int intel_plane_pin_fb (struct intel_plane_state *plane_state); +void intel_plane_unpin_fb (struct intel_plane_state *old_plane_state); + +/* cursor */ +struct intel_plane * +intel_cursor_plane_create (struct drm_i915_private *dev_priv, +enum pipe pipe); +/* modesetting */ void intel_modeset_init_hw (struct drm_i915_private *i915);int intel_modeset_init_noirq (struct drm_i915_private *i915);
Signature · 6 lines
2.27.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH 4/9] drm/i915: refactor cursor code out of i915_display.c
Quoted 11 lines · Dave Airlie
From: Dave Airlie <[email protected]>
This file is a monster, let's start simple, the cursor plane code seems pretty standalone, and splits out easily enough.
Signed-off-by Dave Airlie <[email protected]>--- drivers/gpu/drm/i915/Makefile | 1 + drivers/gpu/drm/i915/display/intel_cursor.c | 805 +++++++++++++++++++ drivers/gpu/drm/i915/display/intel_display.c | 796 +----------------- drivers/gpu/drm/i915/display/intel_display.h | 12 +
I would just add the intel_cursor.h for this. intel_display.h is an even bigger mess than intel_display.c, and causing no end of redundant rebuilds. The smaller we can make it the better IMO.
Looks like a mechanical move, and seems to match my attempt at it so
Quoted 1,719 lines
4 files changed, 824 insertions(+), 790 deletions(-) create mode 100644 drivers/gpu/drm/i915/display/intel_cursor.cdrivers/gpu/drm/i915/Makefile +1
-0@@ -197,6 +197,7 @@ i915-y += \ display/intel_combo_phy.o \ display/intel_connector.o \ display/intel_csr.o \ + display/intel_cursor.o \ display/intel_display.o \ display/intel_display_power.o \ display/intel_dpio_phy.o \drivers/gpu/drm/i915/display/intel_cursor.c new file +805
-0@@ -0,0 +1,805 @@ +// SPDX-License-Identifier: MIT +/* +* Copyright © 2020 Intel Corporation +*/ +#include <linux/kernel.h> + +#include <drm/drm_atomic_helper.h> +#include <drm/drm_atomic_uapi.h> +#include <drm/drm_damage_helper.h> +#include <drm/drm_plane_helper.h> +#include <drm/drm_fourcc.h> + +#include "intel_atomic.h" +#include "intel_atomic_plane.h" +#include "intel_display_types.h" +#include "intel_display.h" + +#include "intel_frontbuffer.h" +#include "intel_pm.h" +#include "intel_psr.h" +#include "intel_sprite.h" + +/* Cursor formats */ +static const u32 intel_cursor_formats[] = { +DRM_FORMAT_ARGB8888 , +}; + +static const u64 cursor_format_modifiers[] = { +DRM_FORMAT_MOD_LINEAR , +DRM_FORMAT_MOD_INVALID +}; + +static u32 intel_cursor_base (const struct intel_plane_state *plane_state) +{ +struct drm_i915_private *dev_priv = +to_i915 (plane_state->uapi.plane->dev); +const struct drm_framebuffer *fb = plane_state->hw.fb; +const struct drm_i915_gem_object *obj =intel_fb_obj (fb); +u32 base; + +if (INTEL_INFO (dev_priv)->display.cursor_needs_physical) + base =sg_dma_address (obj->mm.pages->sgl); +else + base =intel_plane_ggtt_offset (plane_state); + +return base + plane_state->color_plane[0 ].offset; +} + +static u32 intel_cursor_position (const struct intel_plane_state *plane_state) +{ +int x = plane_state->uapi.dst.x1; +int y = plane_state->uapi.dst.y1; +u32 pos =0 ; + +if (x <0 ) { + pos |=CURSOR_POS_SIGN <<CURSOR_X_SHIFT ; + x = -x; + } + pos |= x <<CURSOR_X_SHIFT ; + +if (y <0 ) { + pos |=CURSOR_POS_SIGN <<CURSOR_Y_SHIFT ; + y = -y; + } + pos |= y <<CURSOR_Y_SHIFT ; + +return pos; +} + +static bool intel_cursor_size_ok (const struct intel_plane_state *plane_state) +{ +const struct drm_mode_config *config = + &plane_state->uapi.plane->dev->mode_config; +int width =drm_rect_width (&plane_state->uapi.dst); +int height =drm_rect_height (&plane_state->uapi.dst); + +return width >0 && width <= config->cursor_width && + height >0 && height <= config->cursor_height; +} + +static int intel_cursor_check_surface (struct intel_plane_state *plane_state) +{ +struct drm_i915_private *dev_priv = +to_i915 (plane_state->uapi.plane->dev); +unsigned int rotation = plane_state->hw.rotation; +int src_x, src_y; +u32 offset; +int ret; + + ret =intel_plane_compute_gtt (plane_state); +if (ret) +return ret; + +if (!plane_state->uapi.visible) +return 0 ; + + src_x = plane_state->uapi.src.x1 >>16 ; + src_y = plane_state->uapi.src.y1 >>16 ; + +intel_add_fb_offsets (&src_x, &src_y, plane_state,0 ); + offset =intel_plane_compute_aligned_offset (&src_x, &src_y, + plane_state,0 ); + +if (src_x !=0 || src_y !=0 ) { +drm_dbg_kms (&dev_priv->drm, +"Arbitrary cursor panning not supported\n" ); +return -EINVAL ; + } + +/* +* Put the final coordinates back so that the src +* coordinate checks will see the right values. +*/ +drm_rect_translate_to (&plane_state->uapi.src, + src_x <<16 , src_y <<16 ); + +/* ILK+ do this automagically in hardware */ +if (HAS_GMCH (dev_priv) && rotation &DRM_MODE_ROTATE_180 ) { +const struct drm_framebuffer *fb = plane_state->hw.fb; +int src_w =drm_rect_width (&plane_state->uapi.src) >>16 ; +int src_h =drm_rect_height (&plane_state->uapi.src) >>16 ; + + offset += (src_h * src_w -1 ) * fb->format->cpp[0 ]; + } + + plane_state->color_plane[0 ].offset = offset; + plane_state->color_plane[0 ].x = src_x; + plane_state->color_plane[0 ].y = src_y; + +return 0 ; +} + +static int intel_check_cursor (struct intel_crtc_state *crtc_state, +struct intel_plane_state *plane_state) +{ +const struct drm_framebuffer *fb = plane_state->hw.fb; +struct drm_i915_private *i915 =to_i915 (plane_state->uapi.plane->dev); +const struct drm_rect src = plane_state->uapi.src; +const struct drm_rect dst = plane_state->uapi.dst; +int ret; + +if (fb && fb->modifier !=DRM_FORMAT_MOD_LINEAR ) { +drm_dbg_kms (&i915->drm,"cursor cannot be tiled\n" ); +return -EINVAL ; + } + + ret =intel_atomic_plane_check_clipping (plane_state, crtc_state, +DRM_PLANE_HELPER_NO_SCALING , +DRM_PLANE_HELPER_NO_SCALING , + true); +if (ret) +return ret; + +/* Use the unclipped src/dst rectangles, which we program to hw */ + plane_state->uapi.src = src; + plane_state->uapi.dst = dst; + + ret =intel_cursor_check_surface (plane_state); +if (ret) +return ret; + +if (!plane_state->uapi.visible) +return 0 ; + + ret =intel_plane_check_src_coordinates (plane_state); +if (ret) +return ret; + +return 0 ; +} + +static unsigned int +i845_cursor_max_stride (struct intel_plane *plane, +u32 pixel_format,u64 modifier, +unsigned int rotation) +{ +return 2048 ; +} + +static u32 i845_cursor_ctl_crtc (const struct intel_crtc_state *crtc_state) +{ +u32 cntl =0 ; + +if (crtc_state->gamma_enable) + cntl |=CURSOR_GAMMA_ENABLE ; + +return cntl; +} + +static u32 i845_cursor_ctl (const struct intel_crtc_state *crtc_state, +const struct intel_plane_state *plane_state) +{ +return CURSOR_ENABLE | +CURSOR_FORMAT_ARGB | +CURSOR_STRIDE (plane_state->color_plane[0 ].stride); +} + +static bool i845_cursor_size_ok (const struct intel_plane_state *plane_state) +{ +int width =drm_rect_width (&plane_state->uapi.dst); + +/* +* 845g/865g are only limited by the width of their cursors, +* the height is arbitrary up to the precision of the register. +*/ +return intel_cursor_size_ok (plane_state) &&IS_ALIGNED (width,64 ); +} + +static int i845_check_cursor (struct intel_crtc_state *crtc_state, +struct intel_plane_state *plane_state) +{ +const struct drm_framebuffer *fb = plane_state->hw.fb; +struct drm_i915_private *i915 =to_i915 (plane_state->uapi.plane->dev); +int ret; + + ret =intel_check_cursor (crtc_state, plane_state); +if (ret) +return ret; + +/* if we want to turn off the cursor ignore width and height */ +if (!fb) +return 0 ; + +/* Check for which cursor types we support */ +if (!i845_cursor_size_ok (plane_state)) { +drm_dbg_kms (&i915->drm, +"Cursor dimension %dx%d not supported\n" , +drm_rect_width (&plane_state->uapi.dst), +drm_rect_height (&plane_state->uapi.dst)); +return -EINVAL ; + } + +drm_WARN_ON (&i915->drm, plane_state->uapi.visible && + plane_state->color_plane[0 ].stride != fb->pitches[0 ]); + +switch (fb->pitches[0 ]) { +case 256 : +case 512 : +case 1024 : +case 2048 : +break ; +default : +drm_dbg_kms (&i915->drm,"Invalid cursor stride (%u)\n" , + fb->pitches[0 ]); +return -EINVAL ; + } + + plane_state->ctl =i845_cursor_ctl (crtc_state, plane_state); + +return 0 ; +} + +static void i845_update_cursor (struct intel_plane *plane, +const struct intel_crtc_state *crtc_state, +const struct intel_plane_state *plane_state) +{ +struct drm_i915_private *dev_priv =to_i915 (plane->base.dev); +u32 cntl =0 , base =0 , pos =0 , size =0 ; +unsigned long irqflags; + +if (plane_state && plane_state->uapi.visible) { +unsigned int width =drm_rect_width (&plane_state->uapi.dst); +unsigned int height =drm_rect_height (&plane_state->uapi.dst); + + cntl = plane_state->ctl | +i845_cursor_ctl_crtc (crtc_state); + + size = (height <<12 ) | width; + + base =intel_cursor_base (plane_state); + pos =intel_cursor_position (plane_state); + } + +spin_lock_irqsave (&dev_priv->uncore.lock, irqflags); + +/* On these chipsets we can only modify the base/size/stride +* whilst the cursor is disabled. +*/ +if (plane->cursor.base != base || + plane->cursor.size != size || + plane->cursor.cntl != cntl) { +intel_de_write_fw (dev_priv,CURCNTR (PIPE_A ),0 ); +intel_de_write_fw (dev_priv,CURBASE (PIPE_A ), base); +intel_de_write_fw (dev_priv,CURSIZE , size); +intel_de_write_fw (dev_priv,CURPOS (PIPE_A ), pos); +intel_de_write_fw (dev_priv,CURCNTR (PIPE_A ), cntl); + + plane->cursor.base = base; + plane->cursor.size = size; + plane->cursor.cntl = cntl; + }else { +intel_de_write_fw (dev_priv,CURPOS (PIPE_A ), pos); + } + +spin_unlock_irqrestore (&dev_priv->uncore.lock, irqflags); +} + +static void i845_disable_cursor (struct intel_plane *plane, +const struct intel_crtc_state *crtc_state) +{ +i845_update_cursor (plane, crtc_state,NULL ); +} + +static bool i845_cursor_get_hw_state (struct intel_plane *plane, +enum pipe *pipe) +{ +struct drm_i915_private *dev_priv =to_i915 (plane->base.dev); +enum intel_display_power_domain power_domain; +intel_wakeref_t wakeref; +bool ret; + + power_domain =POWER_DOMAIN_PIPE (PIPE_A ); + wakeref =intel_display_power_get_if_enabled (dev_priv, power_domain); +if (!wakeref) +return false; + + ret =intel_de_read (dev_priv,CURCNTR (PIPE_A )) &CURSOR_ENABLE ; + + *pipe =PIPE_A ; + +intel_display_power_put (dev_priv, power_domain, wakeref); + +return ret; +} + +static unsigned int +i9xx_cursor_max_stride (struct intel_plane *plane, +u32 pixel_format,u64 modifier, +unsigned int rotation) +{ +return plane->base.dev->mode_config.cursor_width *4 ; +} + +static u32 i9xx_cursor_ctl_crtc (const struct intel_crtc_state *crtc_state) +{ +struct intel_crtc *crtc =to_intel_crtc (crtc_state->uapi.crtc); +struct drm_i915_private *dev_priv =to_i915 (crtc->base.dev); +u32 cntl =0 ; + +if (INTEL_GEN (dev_priv) >=11 ) +return cntl; + +if (crtc_state->gamma_enable) + cntl =MCURSOR_GAMMA_ENABLE ; + +if (crtc_state->csc_enable) + cntl |=MCURSOR_PIPE_CSC_ENABLE ; + +if (INTEL_GEN (dev_priv) <5 && !IS_G4X (dev_priv)) + cntl |=MCURSOR_PIPE_SELECT (crtc->pipe); + +return cntl; +} + +static u32 i9xx_cursor_ctl (const struct intel_crtc_state *crtc_state, +const struct intel_plane_state *plane_state) +{ +struct drm_i915_private *dev_priv = +to_i915 (plane_state->uapi.plane->dev); +u32 cntl =0 ; + +if (IS_GEN (dev_priv,6 ) ||IS_IVYBRIDGE (dev_priv)) + cntl |=MCURSOR_TRICKLE_FEED_DISABLE ; + +switch (drm_rect_width (&plane_state->uapi.dst)) { +case 64 : + cntl |=MCURSOR_MODE_64_ARGB_AX ; +break ; +case 128 : + cntl |=MCURSOR_MODE_128_ARGB_AX ; +break ; +case 256 : + cntl |=MCURSOR_MODE_256_ARGB_AX ; +break ; +default : +MISSING_CASE (drm_rect_width (&plane_state->uapi.dst)); +return 0 ; + } + +if (plane_state->hw.rotation &DRM_MODE_ROTATE_180 ) + cntl |=MCURSOR_ROTATE_180 ; + +return cntl; +} + +static bool i9xx_cursor_size_ok (const struct intel_plane_state *plane_state) +{ +struct drm_i915_private *dev_priv = +to_i915 (plane_state->uapi.plane->dev); +int width =drm_rect_width (&plane_state->uapi.dst); +int height =drm_rect_height (&plane_state->uapi.dst); + +if (!intel_cursor_size_ok (plane_state)) +return false; + +/* Cursor width is limited to a few power-of-two sizes */ +switch (width) { +case 256 : +case 128 : +case 64 : +break ; +default : +return false; + } + +/* +* IVB+ have CUR_FBC_CTL which allows an arbitrary cursor +* height from 8 lines up to the cursor width, when the +* cursor is not rotated. Everything else requires square +* cursors. +*/ +if (HAS_CUR_FBC (dev_priv) && + plane_state->hw.rotation &DRM_MODE_ROTATE_0 ) { +if (height <8 || height > width) +return false; + }else { +if (height != width) +return false; + } + +return true; +} + +static int i9xx_check_cursor (struct intel_crtc_state *crtc_state, +struct intel_plane_state *plane_state) +{ +struct intel_plane *plane =to_intel_plane (plane_state->uapi.plane); +struct drm_i915_private *dev_priv =to_i915 (plane->base.dev); +const struct drm_framebuffer *fb = plane_state->hw.fb; +enum pipe pipe = plane->pipe; +int ret; + + ret =intel_check_cursor (crtc_state, plane_state); +if (ret) +return ret; + +/* if we want to turn off the cursor ignore width and height */ +if (!fb) +return 0 ; + +/* Check for which cursor types we support */ +if (!i9xx_cursor_size_ok (plane_state)) { +drm_dbg (&dev_priv->drm, +"Cursor dimension %dx%d not supported\n" , +drm_rect_width (&plane_state->uapi.dst), +drm_rect_height (&plane_state->uapi.dst)); +return -EINVAL ; + } + +drm_WARN_ON (&dev_priv->drm, plane_state->uapi.visible && + plane_state->color_plane[0 ].stride != fb->pitches[0 ]); + +if (fb->pitches[0 ] != +drm_rect_width (&plane_state->uapi.dst) * fb->format->cpp[0 ]) { +drm_dbg_kms (&dev_priv->drm, +"Invalid cursor stride (%u) (cursor width %d)\n" , + fb->pitches[0 ], +drm_rect_width (&plane_state->uapi.dst)); +return -EINVAL ; + } + +/* +* There's something wrong with the cursor on CHV pipe C. +* If it straddles the left edge of the screen then +* moving it away from the edge or disabling it often +* results in a pipe underrun, and often that can lead to +* dead pipe (constant underrun reported, and it scans +* out just a solid color). To recover from that, the +* display power well must be turned off and on again. +* Refuse the put the cursor into that compromised position. +*/ +if (IS_CHERRYVIEW (dev_priv) && pipe ==PIPE_C && + plane_state->uapi.visible && plane_state->uapi.dst.x1 <0 ) { +drm_dbg_kms (&dev_priv->drm, +"CHV cursor C not allowed to straddle the left screen edge\n" ); +return -EINVAL ; + } + + plane_state->ctl =i9xx_cursor_ctl (crtc_state, plane_state); + +return 0 ; +} + +static void i9xx_update_cursor (struct intel_plane *plane, +const struct intel_crtc_state *crtc_state, +const struct intel_plane_state *plane_state) +{ +struct drm_i915_private *dev_priv =to_i915 (plane->base.dev); +enum pipe pipe = plane->pipe; +u32 cntl =0 , base =0 , pos =0 , fbc_ctl =0 ; +unsigned long irqflags; + +if (plane_state && plane_state->uapi.visible) { +unsigned width =drm_rect_width (&plane_state->uapi.dst); +unsigned height =drm_rect_height (&plane_state->uapi.dst); + + cntl = plane_state->ctl | +i9xx_cursor_ctl_crtc (crtc_state); + +if (width != height) + fbc_ctl =CUR_FBC_CTL_EN | (height -1 ); + + base =intel_cursor_base (plane_state); + pos =intel_cursor_position (plane_state); + } + +spin_lock_irqsave (&dev_priv->uncore.lock, irqflags); + +/* +* On some platforms writing CURCNTR first will also +* cause CURPOS to be armed by the CURBASE write. +* Without the CURCNTR write the CURPOS write would +* arm itself. Thus we always update CURCNTR before +* CURPOS. +* +* On other platforms CURPOS always requires the +* CURBASE write to arm the update. Additonally +* a write to any of the cursor register will cancel +* an already armed cursor update. Thus leaving out +* the CURBASE write after CURPOS could lead to a +* cursor that doesn't appear to move, or even change +* shape. Thus we always write CURBASE. +* +* The other registers are armed by by the CURBASE write +* except when the plane is getting enabled at which time +* the CURCNTR write arms the update. +*/ + +if (INTEL_GEN (dev_priv) >=9 ) +skl_write_cursor_wm (plane, crtc_state); + +if (!intel_crtc_needs_modeset (crtc_state)) +intel_psr2_program_plane_sel_fetch (plane, crtc_state, plane_state,0 ); + +if (plane->cursor.base != base || + plane->cursor.size != fbc_ctl || + plane->cursor.cntl != cntl) { +if (HAS_CUR_FBC (dev_priv)) +intel_de_write_fw (dev_priv,CUR_FBC_CTL (pipe), + fbc_ctl); +intel_de_write_fw (dev_priv,CURCNTR (pipe), cntl); +intel_de_write_fw (dev_priv,CURPOS (pipe), pos); +intel_de_write_fw (dev_priv,CURBASE (pipe), base); + + plane->cursor.base = base; + plane->cursor.size = fbc_ctl; + plane->cursor.cntl = cntl; + }else { +intel_de_write_fw (dev_priv,CURPOS (pipe), pos); +intel_de_write_fw (dev_priv,CURBASE (pipe), base); + } + +spin_unlock_irqrestore (&dev_priv->uncore.lock, irqflags); +} + +static void i9xx_disable_cursor (struct intel_plane *plane, +const struct intel_crtc_state *crtc_state) +{ +i9xx_update_cursor (plane, crtc_state,NULL ); +} + +static bool i9xx_cursor_get_hw_state (struct intel_plane *plane, +enum pipe *pipe) +{ +struct drm_i915_private *dev_priv =to_i915 (plane->base.dev); +enum intel_display_power_domain power_domain; +intel_wakeref_t wakeref; +bool ret; +u32 val; + +/* +* Not 100% correct for planes that can move between pipes, +* but that's only the case for gen2-3 which don't have any +* display power wells. +*/ + power_domain =POWER_DOMAIN_PIPE (plane->pipe); + wakeref =intel_display_power_get_if_enabled (dev_priv, power_domain); +if (!wakeref) +return false; + + val =intel_de_read (dev_priv,CURCNTR (plane->pipe)); + + ret = val &MCURSOR_MODE ; + +if (INTEL_GEN (dev_priv) >=5 ||IS_G4X (dev_priv)) + *pipe = plane->pipe; +else + *pipe = (val &MCURSOR_PIPE_SELECT_MASK ) >> +MCURSOR_PIPE_SELECT_SHIFT ; + +intel_display_power_put (dev_priv, power_domain, wakeref); + +return ret; +} + +static bool intel_cursor_format_mod_supported (struct drm_plane *_plane, +u32 format,u64 modifier) +{ +return modifier ==DRM_FORMAT_MOD_LINEAR && + format ==DRM_FORMAT_ARGB8888 ; +} + +static int +intel_legacy_cursor_update (struct drm_plane *_plane, +struct drm_crtc *_crtc, +struct drm_framebuffer *fb, +int crtc_x,int crtc_y, +unsigned int crtc_w,unsigned int crtc_h, +u32 src_x,u32 src_y, +u32 src_w,u32 src_h, +struct drm_modeset_acquire_ctx *ctx) +{ +struct intel_plane *plane =to_intel_plane (_plane); +struct intel_crtc *crtc =to_intel_crtc (_crtc); +struct intel_plane_state *old_plane_state = +to_intel_plane_state (plane->base.state); +struct intel_plane_state *new_plane_state; +struct intel_crtc_state *crtc_state = +to_intel_crtc_state (crtc->base.state); +struct intel_crtc_state *new_crtc_state; +int ret; + +/* +* When crtc is inactive or there is a modeset pending, +* wait for it to complete in the slowpath +* +* FIXME bigjoiner fastpath would be good +*/ +if (!crtc_state->hw.active ||intel_crtc_needs_modeset (crtc_state) || + crtc_state->update_pipe || crtc_state->bigjoiner) + goto slow; + +/* +* Don't do an async update if there is an outstanding commit modifying +* the plane. This prevents our async update's changes from getting +* overridden by a previous synchronous update's state. +*/ +if (old_plane_state->uapi.commit && + !try_wait_for_completion (&old_plane_state->uapi.commit->hw_done)) + goto slow; + +/* +* If any parameters change that may affect watermarks, +* take the slowpath. Only changing fb or position should be +* in the fastpath. +*/ +if (old_plane_state->uapi.crtc != &crtc->base || + old_plane_state->uapi.src_w != src_w || + old_plane_state->uapi.src_h != src_h || + old_plane_state->uapi.crtc_w != crtc_w || + old_plane_state->uapi.crtc_h != crtc_h || + !old_plane_state->uapi.fb != !fb) + goto slow; + + new_plane_state =to_intel_plane_state (intel_plane_duplicate_state (&plane->base)); +if (!new_plane_state) +return -ENOMEM ; + + new_crtc_state =to_intel_crtc_state (intel_crtc_duplicate_state (&crtc->base)); +if (!new_crtc_state) { + ret = -ENOMEM ; + goto out_free; + } + +drm_atomic_set_fb_for_plane (&new_plane_state->uapi, fb); + + new_plane_state->uapi.src_x = src_x; + new_plane_state->uapi.src_y = src_y; + new_plane_state->uapi.src_w = src_w; + new_plane_state->uapi.src_h = src_h; + new_plane_state->uapi.crtc_x = crtc_x; + new_plane_state->uapi.crtc_y = crtc_y; + new_plane_state->uapi.crtc_w = crtc_w; + new_plane_state->uapi.crtc_h = crtc_h; + +intel_plane_copy_uapi_to_hw_state (new_plane_state, new_plane_state, crtc); + + ret =intel_plane_atomic_check_with_state (crtc_state, new_crtc_state, + old_plane_state, new_plane_state); +if (ret) + goto out_free; + + ret =intel_plane_pin_fb (new_plane_state); +if (ret) + goto out_free; + +intel_frontbuffer_flush (to_intel_frontbuffer (new_plane_state->hw.fb), +ORIGIN_FLIP ); +intel_frontbuffer_track (to_intel_frontbuffer (old_plane_state->hw.fb), +to_intel_frontbuffer (new_plane_state->hw.fb), + plane->frontbuffer_bit); + +/* Swap plane state */ + plane->base.state = &new_plane_state->uapi; + +/* +* We cannot swap crtc_state as it may be in use by an atomic commit or +* page flip that's running simultaneously. If we swap crtc_state and +* destroy the old state, we will cause a use-after-free there. +* +* Only update active_planes, which is needed for our internal +* bookkeeping. Either value will do the right thing when updating +* planes atomically. If the cursor was part of the atomic update then +* we would have taken the slowpath. +*/ + crtc_state->active_planes = new_crtc_state->active_planes; + +if (new_plane_state->uapi.visible) +intel_update_plane (plane, crtc_state, new_plane_state); +else +intel_disable_plane (plane, crtc_state); + +intel_plane_unpin_fb (old_plane_state); + +out_free: +if (new_crtc_state) +intel_crtc_destroy_state (&crtc->base, &new_crtc_state->uapi); +if (ret) +intel_plane_destroy_state (&plane->base, &new_plane_state->uapi); +else +intel_plane_destroy_state (&plane->base, &old_plane_state->uapi); +return ret; + +slow: +return drm_atomic_helper_update_plane (&plane->base, &crtc->base, fb, + crtc_x, crtc_y, crtc_w, crtc_h, + src_x, src_y, src_w, src_h, ctx); +} + +static const struct drm_plane_funcs intel_cursor_plane_funcs = { + .update_plane = intel_legacy_cursor_update, + .disable_plane = drm_atomic_helper_disable_plane, + .destroy = intel_plane_destroy, + .atomic_duplicate_state = intel_plane_duplicate_state, + .atomic_destroy_state = intel_plane_destroy_state, + .format_mod_supported = intel_cursor_format_mod_supported, +}; + +struct intel_plane * +intel_cursor_plane_create (struct drm_i915_private *dev_priv, +enum pipe pipe) +{ +struct intel_plane *cursor; +int ret, zpos; + + cursor =intel_plane_alloc (); +if (IS_ERR (cursor)) +return cursor; + + cursor->pipe = pipe; + cursor->i9xx_plane = (enum i9xx_plane_id ) pipe; + cursor->id =PLANE_CURSOR ; + cursor->frontbuffer_bit =INTEL_FRONTBUFFER (pipe, cursor->id); + +if (IS_I845G (dev_priv) ||IS_I865G (dev_priv)) { + cursor->max_stride = i845_cursor_max_stride; + cursor->update_plane = i845_update_cursor; + cursor->disable_plane = i845_disable_cursor; + cursor->get_hw_state = i845_cursor_get_hw_state; + cursor->check_plane = i845_check_cursor; + }else { + cursor->max_stride = i9xx_cursor_max_stride; + cursor->update_plane = i9xx_update_cursor; + cursor->disable_plane = i9xx_disable_cursor; + cursor->get_hw_state = i9xx_cursor_get_hw_state; + cursor->check_plane = i9xx_check_cursor; + } + + cursor->cursor.base = ~0 ; + cursor->cursor.cntl = ~0 ; + +if (IS_I845G (dev_priv) ||IS_I865G (dev_priv) ||HAS_CUR_FBC (dev_priv)) + cursor->cursor.size = ~0 ; + + ret =drm_universal_plane_init (&dev_priv->drm, &cursor->base, +0 , &intel_cursor_plane_funcs, + intel_cursor_formats, +ARRAY_SIZE (intel_cursor_formats), + cursor_format_modifiers, +DRM_PLANE_TYPE_CURSOR , +"cursor %c" ,pipe_name (pipe)); +if (ret) + goto fail; + +if (INTEL_GEN (dev_priv) >=4 ) +drm_plane_create_rotation_property (&cursor->base, +DRM_MODE_ROTATE_0 , +DRM_MODE_ROTATE_0 | +DRM_MODE_ROTATE_180 ); + + zpos =RUNTIME_INFO (dev_priv)->num_sprites[pipe] +1 ; +drm_plane_create_zpos_immutable_property (&cursor->base, zpos); + +if (INTEL_GEN (dev_priv) >=12 ) +drm_plane_enable_fb_damage_clips (&cursor->base); + +drm_plane_helper_add (&cursor->base, &intel_plane_helper_funcs); + +return cursor; + +fail: +intel_plane_free (cursor); + +return ERR_PTR (ret); +}drivers/gpu/drm/i915/display/intel_display.c +6
-790@@ -137,16 +137,6 @@ static const u64 i9xx_format_modifiers[] = {DRM_FORMAT_MOD_INVALID }; -/* Cursor formats */ -static const u32 intel_cursor_formats[] = { -DRM_FORMAT_ARGB8888 , -}; - -static const u64 cursor_format_modifiers[] = { -DRM_FORMAT_MOD_LINEAR , -DRM_FORMAT_MOD_INVALID -}; -static void i9xx_crtc_clock_get (struct intel_crtc *crtc,struct intel_crtc_state *pipe_config); static void ilk_pch_clock_get(struct intel_crtc *crtc,@@ -2528,9 +2518,9 @@ static u32 intel_compute_aligned_offset(struct drm_i915_private *dev_priv,return offset_aligned; } -static u32 intel_plane_compute_aligned_offset (int *x,int *y, -const struct intel_plane_state *state, -int color_plane) +u32 intel_plane_compute_aligned_offset (int *x,int *y, +const struct intel_plane_state *state, +int color_plane) {struct intel_plane *intel_plane =to_intel_plane (state->uapi.plane);struct drm_i915_private *dev_priv =to_i915 (intel_plane->base.dev);@@ -3267,7 +3257,7 @@ intel_plane_remap_gtt(struct intel_plane_state *plane_state) } } -static int +int intel_plane_compute_gtt (struct intel_plane_state *plane_state) { const struct intel_framebuffer *fb =@@ -11536,569 +11526,6 @@ static bool intel_crtc_get_pipe_config(struct intel_crtc_state *crtc_state)return true; } -static u32 intel_cursor_base (const struct intel_plane_state *plane_state) -{ -struct drm_i915_private *dev_priv = -to_i915 (plane_state->uapi.plane->dev); -const struct drm_framebuffer *fb = plane_state->hw.fb; -const struct drm_i915_gem_object *obj =intel_fb_obj (fb); -u32 base; - -if (INTEL_INFO (dev_priv)->display.cursor_needs_physical) - base =sg_dma_address (obj->mm.pages->sgl); -else - base =intel_plane_ggtt_offset (plane_state); - -return base + plane_state->color_plane[0 ].offset; -} - -static u32 intel_cursor_position (const struct intel_plane_state *plane_state) -{ -int x = plane_state->uapi.dst.x1; -int y = plane_state->uapi.dst.y1; -u32 pos =0 ; - -if (x <0 ) { - pos |=CURSOR_POS_SIGN <<CURSOR_X_SHIFT ; - x = -x; - } - pos |= x <<CURSOR_X_SHIFT ; - -if (y <0 ) { - pos |=CURSOR_POS_SIGN <<CURSOR_Y_SHIFT ; - y = -y; - } - pos |= y <<CURSOR_Y_SHIFT ; - -return pos; -} - -static bool intel_cursor_size_ok (const struct intel_plane_state *plane_state) -{ -const struct drm_mode_config *config = - &plane_state->uapi.plane->dev->mode_config; -int width =drm_rect_width (&plane_state->uapi.dst); -int height =drm_rect_height (&plane_state->uapi.dst); - -return width >0 && width <= config->cursor_width && - height >0 && height <= config->cursor_height; -} - -static int intel_cursor_check_surface (struct intel_plane_state *plane_state) -{ -struct drm_i915_private *dev_priv = -to_i915 (plane_state->uapi.plane->dev); -unsigned int rotation = plane_state->hw.rotation; -int src_x, src_y; -u32 offset; -int ret; - - ret =intel_plane_compute_gtt (plane_state); -if (ret) -return ret; - -if (!plane_state->uapi.visible) -return 0 ; - - src_x = plane_state->uapi.src.x1 >>16 ; - src_y = plane_state->uapi.src.y1 >>16 ; - -intel_add_fb_offsets (&src_x, &src_y, plane_state,0 ); - offset =intel_plane_compute_aligned_offset (&src_x, &src_y, - plane_state,0 ); - -if (src_x !=0 || src_y !=0 ) { -drm_dbg_kms (&dev_priv->drm, -"Arbitrary cursor panning not supported\n" ); -return -EINVAL ; - } - -/* -* Put the final coordinates back so that the src -* coordinate checks will see the right values. -*/ -drm_rect_translate_to (&plane_state->uapi.src, - src_x <<16 , src_y <<16 ); - -/* ILK+ do this automagically in hardware */ -if (HAS_GMCH (dev_priv) && rotation &DRM_MODE_ROTATE_180 ) { -const struct drm_framebuffer *fb = plane_state->hw.fb; -int src_w =drm_rect_width (&plane_state->uapi.src) >>16 ; -int src_h =drm_rect_height (&plane_state->uapi.src) >>16 ; - - offset += (src_h * src_w -1 ) * fb->format->cpp[0 ]; - } - - plane_state->color_plane[0 ].offset = offset; - plane_state->color_plane[0 ].x = src_x; - plane_state->color_plane[0 ].y = src_y; - -return 0 ; -} - -static int intel_check_cursor (struct intel_crtc_state *crtc_state, -struct intel_plane_state *plane_state) -{ -const struct drm_framebuffer *fb = plane_state->hw.fb; -struct drm_i915_private *i915 =to_i915 (plane_state->uapi.plane->dev); -const struct drm_rect src = plane_state->uapi.src; -const struct drm_rect dst = plane_state->uapi.dst; -int ret; - -if (fb && fb->modifier !=DRM_FORMAT_MOD_LINEAR ) { -drm_dbg_kms (&i915->drm,"cursor cannot be tiled\n" ); -return -EINVAL ; - } - - ret =intel_atomic_plane_check_clipping (plane_state, crtc_state, -DRM_PLANE_HELPER_NO_SCALING , -DRM_PLANE_HELPER_NO_SCALING , - true); -if (ret) -return ret; - -/* Use the unclipped src/dst rectangles, which we program to hw */ - plane_state->uapi.src = src; - plane_state->uapi.dst = dst; - - ret =intel_cursor_check_surface (plane_state); -if (ret) -return ret; - -if (!plane_state->uapi.visible) -return 0 ; - - ret =intel_plane_check_src_coordinates (plane_state); -if (ret) -return ret; - -return 0 ; -} - -static unsigned int -i845_cursor_max_stride (struct intel_plane *plane, -u32 pixel_format,u64 modifier, -unsigned int rotation) -{ -return 2048 ; -} - -static u32 i845_cursor_ctl_crtc (const struct intel_crtc_state *crtc_state) -{ -u32 cntl =0 ; - -if (crtc_state->gamma_enable) - cntl |=CURSOR_GAMMA_ENABLE ; - -return cntl; -} - -static u32 i845_cursor_ctl (const struct intel_crtc_state *crtc_state, -const struct intel_plane_state *plane_state) -{ -return CURSOR_ENABLE | -CURSOR_FORMAT_ARGB | -CURSOR_STRIDE (plane_state->color_plane[0 ].stride); -} - -static bool i845_cursor_size_ok (const struct intel_plane_state *plane_state) -{ -int width =drm_rect_width (&plane_state->uapi.dst); - -/* -* 845g/865g are only limited by the width of their cursors, -* the height is arbitrary up to the precision of the register. -*/ -return intel_cursor_size_ok (plane_state) &&IS_ALIGNED (width,64 ); -} - -static int i845_check_cursor (struct intel_crtc_state *crtc_state, -struct intel_plane_state *plane_state) -{ -const struct drm_framebuffer *fb = plane_state->hw.fb; -struct drm_i915_private *i915 =to_i915 (plane_state->uapi.plane->dev); -int ret; - - ret =intel_check_cursor (crtc_state, plane_state); -if (ret) -return ret; - -/* if we want to turn off the cursor ignore width and height */ -if (!fb) -return 0 ; - -/* Check for which cursor types we support */ -if (!i845_cursor_size_ok (plane_state)) { -drm_dbg_kms (&i915->drm, -"Cursor dimension %dx%d not supported\n" , -drm_rect_width (&plane_state->uapi.dst), -drm_rect_height (&plane_state->uapi.dst)); -return -EINVAL ; - } - -drm_WARN_ON (&i915->drm, plane_state->uapi.visible && - plane_state->color_plane[0 ].stride != fb->pitches[0 ]); - -switch (fb->pitches[0 ]) { -case 256 : -case 512 : -case 1024 : -case 2048 : -break ; -default : -drm_dbg_kms (&i915->drm,"Invalid cursor stride (%u)\n" , - fb->pitches[0 ]); -return -EINVAL ; - } - - plane_state->ctl =i845_cursor_ctl (crtc_state, plane_state); - -return 0 ; -} - -static void i845_update_cursor (struct intel_plane *plane, -const struct intel_crtc_state *crtc_state, -const struct intel_plane_state *plane_state) -{ -struct drm_i915_private *dev_priv =to_i915 (plane->base.dev); -u32 cntl =0 , base =0 , pos =0 , size =0 ; -unsigned long irqflags; - -if (plane_state && plane_state->uapi.visible) { -unsigned int width =drm_rect_width (&plane_state->uapi.dst); -unsigned int height =drm_rect_height (&plane_state->uapi.dst); - - cntl = plane_state->ctl | -i845_cursor_ctl_crtc (crtc_state); - - size = (height <<12 ) | width; - - base =intel_cursor_base (plane_state); - pos =intel_cursor_position (plane_state); - } - -spin_lock_irqsave (&dev_priv->uncore.lock, irqflags); - -/* On these chipsets we can only modify the base/size/stride -* whilst the cursor is disabled. -*/ -if (plane->cursor.base != base || - plane->cursor.size != size || - plane->cursor.cntl != cntl) { -intel_de_write_fw (dev_priv,CURCNTR (PIPE_A ),0 ); -intel_de_write_fw (dev_priv,CURBASE (PIPE_A ), base); -intel_de_write_fw (dev_priv,CURSIZE , size); -intel_de_write_fw (dev_priv,CURPOS (PIPE_A ), pos); -intel_de_write_fw (dev_priv,CURCNTR (PIPE_A ), cntl); - - plane->cursor.base = base; - plane->cursor.size = size; - plane->cursor.cntl = cntl; - }else { -intel_de_write_fw (dev_priv,CURPOS (PIPE_A ), pos); - } - -spin_unlock_irqrestore (&dev_priv->uncore.lock, irqflags); -} - -static void i845_disable_cursor (struct intel_plane *plane, -const struct intel_crtc_state *crtc_state) -{ -i845_update_cursor (plane, crtc_state,NULL ); -} - -static bool i845_cursor_get_hw_state (struct intel_plane *plane, -enum pipe *pipe) -{ -struct drm_i915_private *dev_priv =to_i915 (plane->base.dev); -enum intel_display_power_domain power_domain; -intel_wakeref_t wakeref; -bool ret; - - power_domain =POWER_DOMAIN_PIPE (PIPE_A ); - wakeref =intel_display_power_get_if_enabled (dev_priv, power_domain); -if (!wakeref) -return false; - - ret =intel_de_read (dev_priv,CURCNTR (PIPE_A )) &CURSOR_ENABLE ; - - *pipe =PIPE_A ; - -intel_display_power_put (dev_priv, power_domain, wakeref); - -return ret; -} - -static unsigned int -i9xx_cursor_max_stride (struct intel_plane *plane, -u32 pixel_format,u64 modifier, -unsigned int rotation) -{ -return plane->base.dev->mode_config.cursor_width *4 ; -} - -static u32 i9xx_cursor_ctl_crtc (const struct intel_crtc_state *crtc_state) -{ -struct intel_crtc *crtc =to_intel_crtc (crtc_state->uapi.crtc); -struct drm_i915_private *dev_priv =to_i915 (crtc->base.dev); -u32 cntl =0 ; - -if (INTEL_GEN (dev_priv) >=11 ) -return cntl; - -if (crtc_state->gamma_enable) - cntl =MCURSOR_GAMMA_ENABLE ; - -if (crtc_state->csc_enable) - cntl |=MCURSOR_PIPE_CSC_ENABLE ; - -if (INTEL_GEN (dev_priv) <5 && !IS_G4X (dev_priv)) - cntl |=MCURSOR_PIPE_SELECT (crtc->pipe); - -return cntl; -} - -static u32 i9xx_cursor_ctl (const struct intel_crtc_state *crtc_state, -const struct intel_plane_state *plane_state) -{ -struct drm_i915_private *dev_priv = -to_i915 (plane_state->uapi.plane->dev); -u32 cntl =0 ; - -if (IS_GEN (dev_priv,6 ) ||IS_IVYBRIDGE (dev_priv)) - cntl |=MCURSOR_TRICKLE_FEED_DISABLE ; - -switch (drm_rect_width (&plane_state->uapi.dst)) { -case 64 : - cntl |=MCURSOR_MODE_64_ARGB_AX ; -break ; -case 128 : - cntl |=MCURSOR_MODE_128_ARGB_AX ; -break ; -case 256 : - cntl |=MCURSOR_MODE_256_ARGB_AX ; -break ; -default : -MISSING_CASE (drm_rect_width (&plane_state->uapi.dst)); -return 0 ; - } - -if (plane_state->hw.rotation &DRM_MODE_ROTATE_180 ) - cntl |=MCURSOR_ROTATE_180 ; - -return cntl; -} - -static bool i9xx_cursor_size_ok (const struct intel_plane_state *plane_state) -{ -struct drm_i915_private *dev_priv = -to_i915 (plane_state->uapi.plane->dev); -int width =drm_rect_width (&plane_state->uapi.dst); -int height =drm_rect_height (&plane_state->uapi.dst); - -if (!intel_cursor_size_ok (plane_state)) -return false; - -/* Cursor width is limited to a few power-of-two sizes */ -switch (width) { -case 256 : -case 128 : -case 64 : -break ; -default : -return false; - } - -/* -* IVB+ have CUR_FBC_CTL which allows an arbitrary cursor -* height from 8 lines up to the cursor width, when the -* cursor is not rotated. Everything else requires square -* cursors. -*/ -if (HAS_CUR_FBC (dev_priv) && - plane_state->hw.rotation &DRM_MODE_ROTATE_0 ) { -if (height <8 || height > width) -return false; - }else { -if (height != width) -return false; - } - -return true; -} - -static int i9xx_check_cursor (struct intel_crtc_state *crtc_state, -struct intel_plane_state *plane_state) -{ -struct intel_plane *plane =to_intel_plane (plane_state->uapi.plane); -struct drm_i915_private *dev_priv =to_i915 (plane->base.dev); -const struct drm_framebuffer *fb = plane_state->hw.fb; -enum pipe pipe = plane->pipe; -int ret; - - ret =intel_check_cursor (crtc_state, plane_state); -if (ret) -return ret; - -/* if we want to turn off the cursor ignore width and height */ -if (!fb) -return 0 ; - -/* Check for which cursor types we support */ -if (!i9xx_cursor_size_ok (plane_state)) { -drm_dbg (&dev_priv->drm, -"Cursor dimension %dx%d not supported\n" , -drm_rect_width (&plane_state->uapi.dst), -drm_rect_height (&plane_state->uapi.dst)); -return -EINVAL ; - } - -drm_WARN_ON (&dev_priv->drm, plane_state->uapi.visible && - plane_state->color_plane[0 ].stride != fb->pitches[0 ]); - -if (fb->pitches[0 ] != -drm_rect_width (&plane_state->uapi.dst) * fb->format->cpp[0 ]) { -drm_dbg_kms (&dev_priv->drm, -"Invalid cursor stride (%u) (cursor width %d)\n" , - fb->pitches[0 ], -drm_rect_width (&plane_state->uapi.dst)); -return -EINVAL ; - } - -/* -* There's something wrong with the cursor on CHV pipe C. -* If it straddles the left edge of the screen then -* moving it away from the edge or disabling it often -* results in a pipe underrun, and often that can lead to -* dead pipe (constant underrun reported, and it scans -* out just a solid color). To recover from that, the -* display power well must be turned off and on again. -* Refuse the put the cursor into that compromised position. -*/ -if (IS_CHERRYVIEW (dev_priv) && pipe ==PIPE_C && - plane_state->uapi.visible && plane_state->uapi.dst.x1 <0 ) { -drm_dbg_kms (&dev_priv->drm, -"CHV cursor C not allowed to straddle the left screen edge\n" ); -return -EINVAL ; - } - - plane_state->ctl =i9xx_cursor_ctl (crtc_state, plane_state); - -return 0 ; -} - -static void i9xx_update_cursor (struct intel_plane *plane, -const struct intel_crtc_state *crtc_state, -const struct intel_plane_state *plane_state) -{ -struct drm_i915_private *dev_priv =to_i915 (plane->base.dev); -enum pipe pipe = plane->pipe; -u32 cntl =0 , base =0 , pos =0 , fbc_ctl =0 ; -unsigned long irqflags; - -if (plane_state && plane_state->uapi.visible) { -unsigned width =drm_rect_width (&plane_state->uapi.dst); -unsigned height =drm_rect_height (&plane_state->uapi.dst); - - cntl = plane_state->ctl | -i9xx_cursor_ctl_crtc (crtc_state); - -if (width != height) - fbc_ctl =CUR_FBC_CTL_EN | (height -1 ); - - base =intel_cursor_base (plane_state); - pos =intel_cursor_position (plane_state); - } - -spin_lock_irqsave (&dev_priv->uncore.lock, irqflags); - -/* -* On some platforms writing CURCNTR first will also -* cause CURPOS to be armed by the CURBASE write. -* Without the CURCNTR write the CURPOS write would -* arm itself. Thus we always update CURCNTR before -* CURPOS. -* -* On other platforms CURPOS always requires the -* CURBASE write to arm the update. Additonally -* a write to any of the cursor register will cancel -* an already armed cursor update. Thus leaving out -* the CURBASE write after CURPOS could lead to a -* cursor that doesn't appear to move, or even change -* shape. Thus we always write CURBASE. -* -* The other registers are armed by by the CURBASE write -* except when the plane is getting enabled at which time -* the CURCNTR write arms the update. -*/ - -if (INTEL_GEN (dev_priv) >=9 ) -skl_write_cursor_wm (plane, crtc_state); - -if (!intel_crtc_needs_modeset (crtc_state)) -intel_psr2_program_plane_sel_fetch (plane, crtc_state, plane_state,0 ); - -if (plane->cursor.base != base || - plane->cursor.size != fbc_ctl || - plane->cursor.cntl != cntl) { -if (HAS_CUR_FBC (dev_priv)) -intel_de_write_fw (dev_priv,CUR_FBC_CTL (pipe), - fbc_ctl); -intel_de_write_fw (dev_priv,CURCNTR (pipe), cntl); -intel_de_write_fw (dev_priv,CURPOS (pipe), pos); -intel_de_write_fw (dev_priv,CURBASE (pipe), base); - - plane->cursor.base = base; - plane->cursor.size = fbc_ctl; - plane->cursor.cntl = cntl; - }else { -intel_de_write_fw (dev_priv,CURPOS (pipe), pos); -intel_de_write_fw (dev_priv,CURBASE (pipe), base); - } - -spin_unlock_irqrestore (&dev_priv->uncore.lock, irqflags); -} - -static void i9xx_disable_cursor (struct intel_plane *plane, -const struct intel_crtc_state *crtc_state) -{ -i9xx_update_cursor (plane, crtc_state,NULL ); -} - -static bool i9xx_cursor_get_hw_state (struct intel_plane *plane, -enum pipe *pipe) -{ -struct drm_i915_private *dev_priv =to_i915 (plane->base.dev); -enum intel_display_power_domain power_domain; -intel_wakeref_t wakeref; -bool ret; -u32 val; - -/* -* Not 100% correct for planes that can move between pipes, -* but that's only the case for gen2-3 which don't have any -* display power wells. -*/ - power_domain =POWER_DOMAIN_PIPE (plane->pipe); - wakeref =intel_display_power_get_if_enabled (dev_priv, power_domain); -if (!wakeref) -return false; - - val =intel_de_read (dev_priv,CURCNTR (plane->pipe)); - - ret = val &MCURSOR_MODE ; - -if (INTEL_GEN (dev_priv) >=5 ||IS_G4X (dev_priv)) - *pipe = plane->pipe; -else - *pipe = (val &MCURSOR_PIPE_SELECT_MASK ) >> -MCURSOR_PIPE_SELECT_SHIFT ; - -intel_display_power_put (dev_priv, power_domain, wakeref); - -return ret; -} -/* VESA 640x480x72Hz mode to set on the pipe */ static const struct drm_display_mode load_detect_mode = { DRM_MODE("640x480", DRM_MODE_TYPE_DEFAULT, 31500, 640, 664,@@ -16609,7 +16036,7 @@ static void add_rps_boost_after_vblank(struct drm_crtc *crtc,add_wait_queue (drm_crtc_vblank_waitqueue (crtc), &wait->wait); } -static int intel_plane_pin_fb (struct intel_plane_state *plane_state) +int intel_plane_pin_fb (struct intel_plane_state *plane_state) {struct intel_plane *plane =to_intel_plane (plane_state->uapi.plane);struct drm_i915_private *dev_priv =to_i915 (plane->base.dev);@@ -16639,7 +16066,7 @@ static int intel_plane_pin_fb(struct intel_plane_state *plane_state)return 0 ; } -static void intel_plane_unpin_fb (struct intel_plane_state *old_plane_state) +void intel_plane_unpin_fb (struct intel_plane_state *old_plane_state) {struct i915_vma *vma;@@ -16875,13 +16302,6 @@ static bool i965_plane_format_mod_supported(struct drm_plane *_plane, } } -static bool intel_cursor_format_mod_supported (struct drm_plane *_plane, -u32 format,u64 modifier) -{ -return modifier ==DRM_FORMAT_MOD_LINEAR && - format ==DRM_FORMAT_ARGB8888 ; -} -static const struct drm_plane_funcs i965_plane_funcs = { .update_plane = drm_atomic_helper_update_plane, .disable_plane = drm_atomic_helper_disable_plane,@@ -16900,142 +16320,6 @@ static const struct drm_plane_funcs i8xx_plane_funcs = { .format_mod_supported = i8xx_plane_format_mod_supported, }; -static int -intel_legacy_cursor_update (struct drm_plane *_plane, -struct drm_crtc *_crtc, -struct drm_framebuffer *fb, -int crtc_x,int crtc_y, -unsigned int crtc_w,unsigned int crtc_h, -u32 src_x,u32 src_y, -u32 src_w,u32 src_h, -struct drm_modeset_acquire_ctx *ctx) -{ -struct intel_plane *plane =to_intel_plane (_plane); -struct intel_crtc *crtc =to_intel_crtc (_crtc); -struct intel_plane_state *old_plane_state = -to_intel_plane_state (plane->base.state); -struct intel_plane_state *new_plane_state; -struct intel_crtc_state *crtc_state = -to_intel_crtc_state (crtc->base.state); -struct intel_crtc_state *new_crtc_state; -int ret; - -/* -* When crtc is inactive or there is a modeset pending, -* wait for it to complete in the slowpath -* -* FIXME bigjoiner fastpath would be good -*/ -if (!crtc_state->hw.active ||intel_crtc_needs_modeset (crtc_state) || - crtc_state->update_pipe || crtc_state->bigjoiner) - goto slow; - -/* -* Don't do an async update if there is an outstanding commit modifying -* the plane. This prevents our async update's changes from getting -* overridden by a previous synchronous update's state. -*/ -if (old_plane_state->uapi.commit && - !try_wait_for_completion (&old_plane_state->uapi.commit->hw_done)) - goto slow; - -/* -* If any parameters change that may affect watermarks, -* take the slowpath. Only changing fb or position should be -* in the fastpath. -*/ -if (old_plane_state->uapi.crtc != &crtc->base || - old_plane_state->uapi.src_w != src_w || - old_plane_state->uapi.src_h != src_h || - old_plane_state->uapi.crtc_w != crtc_w || - old_plane_state->uapi.crtc_h != crtc_h || - !old_plane_state->uapi.fb != !fb) - goto slow; - - new_plane_state =to_intel_plane_state (intel_plane_duplicate_state (&plane->base)); -if (!new_plane_state) -return -ENOMEM ; - - new_crtc_state =to_intel_crtc_state (intel_crtc_duplicate_state (&crtc->base)); -if (!new_crtc_state) { - ret = -ENOMEM ; - goto out_free; - } - -drm_atomic_set_fb_for_plane (&new_plane_state->uapi, fb); - - new_plane_state->uapi.src_x = src_x; - new_plane_state->uapi.src_y = src_y; - new_plane_state->uapi.src_w = src_w; - new_plane_state->uapi.src_h = src_h; - new_plane_state->uapi.crtc_x = crtc_x; - new_plane_state->uapi.crtc_y = crtc_y; - new_plane_state->uapi.crtc_w = crtc_w; - new_plane_state->uapi.crtc_h = crtc_h; - -intel_plane_copy_uapi_to_hw_state (new_plane_state, new_plane_state, crtc); - - ret =intel_plane_atomic_check_with_state (crtc_state, new_crtc_state, - old_plane_state, new_plane_state); -if (ret) - goto out_free; - - ret =intel_plane_pin_fb (new_plane_state); -if (ret) - goto out_free; - -intel_frontbuffer_flush (to_intel_frontbuffer (new_plane_state->hw.fb), -ORIGIN_FLIP ); -intel_frontbuffer_track (to_intel_frontbuffer (old_plane_state->hw.fb), -to_intel_frontbuffer (new_plane_state->hw.fb), - plane->frontbuffer_bit); - -/* Swap plane state */ - plane->base.state = &new_plane_state->uapi; - -/* -* We cannot swap crtc_state as it may be in use by an atomic commit or -* page flip that's running simultaneously. If we swap crtc_state and -* destroy the old state, we will cause a use-after-free there. -* -* Only update active_planes, which is needed for our internal -* bookkeeping. Either value will do the right thing when updating -* planes atomically. If the cursor was part of the atomic update then -* we would have taken the slowpath. -*/ - crtc_state->active_planes = new_crtc_state->active_planes; - -if (new_plane_state->uapi.visible) -intel_update_plane (plane, crtc_state, new_plane_state); -else -intel_disable_plane (plane, crtc_state); - -intel_plane_unpin_fb (old_plane_state); - -out_free: -if (new_crtc_state) -intel_crtc_destroy_state (&crtc->base, &new_crtc_state->uapi); -if (ret) -intel_plane_destroy_state (&plane->base, &new_plane_state->uapi); -else -intel_plane_destroy_state (&plane->base, &old_plane_state->uapi); -return ret; - -slow: -return drm_atomic_helper_update_plane (&plane->base, &crtc->base, fb, - crtc_x, crtc_y, crtc_w, crtc_h, - src_x, src_y, src_w, src_h, ctx); -} - -static const struct drm_plane_funcs intel_cursor_plane_funcs = { - .update_plane = intel_legacy_cursor_update, - .disable_plane = drm_atomic_helper_disable_plane, - .destroy = intel_plane_destroy, - .atomic_duplicate_state = intel_plane_duplicate_state, - .atomic_destroy_state = intel_plane_destroy_state, - .format_mod_supported = intel_cursor_format_mod_supported, -}; -static bool i9xx_plane_has_fbc (struct drm_i915_private *dev_priv,enum i9xx_plane_id i9xx_plane) {@@ -17187,74 +16471,6 @@ intel_primary_plane_create(struct drm_i915_private *dev_priv, enum pipe pipe)return ERR_PTR (ret); } -static struct intel_plane * -intel_cursor_plane_create (struct drm_i915_private *dev_priv, -enum pipe pipe) -{ -struct intel_plane *cursor; -int ret, zpos; - - cursor =intel_plane_alloc (); -if (IS_ERR (cursor)) -return cursor; - - cursor->pipe = pipe; - cursor->i9xx_plane = (enum i9xx_plane_id ) pipe; - cursor->id =PLANE_CURSOR ; - cursor->frontbuffer_bit =INTEL_FRONTBUFFER (pipe, cursor->id); - -if (IS_I845G (dev_priv) ||IS_I865G (dev_priv)) { - cursor->max_stride = i845_cursor_max_stride; - cursor->update_plane = i845_update_cursor; - cursor->disable_plane = i845_disable_cursor; - cursor->get_hw_state = i845_cursor_get_hw_state; - cursor->check_plane = i845_check_cursor; - }else { - cursor->max_stride = i9xx_cursor_max_stride; - cursor->update_plane = i9xx_update_cursor; - cursor->disable_plane = i9xx_disable_cursor; - cursor->get_hw_state = i9xx_cursor_get_hw_state; - cursor->check_plane = i9xx_check_cursor; - } - - cursor->cursor.base = ~0 ; - cursor->cursor.cntl = ~0 ; - -if (IS_I845G (dev_priv) ||IS_I865G (dev_priv) ||HAS_CUR_FBC (dev_priv)) - cursor->cursor.size = ~0 ; - - ret =drm_universal_plane_init (&dev_priv->drm, &cursor->base, -0 , &intel_cursor_plane_funcs, - intel_cursor_formats, -ARRAY_SIZE (intel_cursor_formats), - cursor_format_modifiers, -DRM_PLANE_TYPE_CURSOR , -"cursor %c" ,pipe_name (pipe)); -if (ret) - goto fail; - -if (INTEL_GEN (dev_priv) >=4 ) -drm_plane_create_rotation_property (&cursor->base, -DRM_MODE_ROTATE_0 , -DRM_MODE_ROTATE_0 | -DRM_MODE_ROTATE_180 ); - - zpos =RUNTIME_INFO (dev_priv)->num_sprites[pipe] +1 ; -drm_plane_create_zpos_immutable_property (&cursor->base, zpos); - -if (INTEL_GEN (dev_priv) >=12 ) -drm_plane_enable_fb_damage_clips (&cursor->base); - -drm_plane_helper_add (&cursor->base, &intel_plane_helper_funcs); - -return cursor; - -fail: -intel_plane_free (cursor); - -return ERR_PTR (ret); -} -static int intel_crtc_late_register (struct drm_crtc *crtc) {intel_crtc_debugfs_add (crtc);drivers/gpu/drm/i915/display/intel_display.h +12
-0@@ -647,6 +647,18 @@ bool intel_format_info_is_yuv_semiplanar(const struct drm_format_info *info, uint64_t modifier); +int intel_plane_compute_gtt (struct intel_plane_state *plane_state); +u32 intel_plane_compute_aligned_offset (int *x,int *y, +const struct intel_plane_state *state, +int color_plane); +int intel_plane_pin_fb (struct intel_plane_state *plane_state); +void intel_plane_unpin_fb (struct intel_plane_state *old_plane_state); + +/* cursor */ +struct intel_plane * +intel_cursor_plane_create (struct drm_i915_private *dev_priv, +enum pipe pipe); +/* modesetting */ void intel_modeset_init_hw (struct drm_i915_private *i915);int intel_modeset_init_noirq (struct drm_i915_private *i915);Signature · 6 lines
2.27.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 6 lines
Ville Syrjälä Intel _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Jani Nikula
maintainerRe: [Intel-gfx] [PATCH 4/9] drm/i915: refactor cursor code out of i915_display.c
Quoted 13 lines · Ville Syrjälä
Quoted 11 lines · Dave Airlie
From: Dave Airlie <[email protected]>
This file is a monster, let's start simple, the cursor plane code seems pretty standalone, and splits out easily enough.
Signed-off-by Dave Airlie <[email protected]>--- drivers/gpu/drm/i915/Makefile | 1 + drivers/gpu/drm/i915/display/intel_cursor.c | 805 +++++++++++++++++++ drivers/gpu/drm/i915/display/intel_display.c | 796 +----------------- drivers/gpu/drm/i915/display/intel_display.h | 12 +
Quoted 3 lines
I would just add the
intel_cursor.hfor this.intel_display.his an even bigger mess thanintel_display.c, and causing no end of redundant rebuilds. The smaller we can make it the better IMO.
Separate header for each .c is where we've been heading since we started refactoring the driver to multiple subdirs instead of the flat structure, and started chopping up files as a consequence.
Also, please prefix the functions in intel_foo.[ch] with intel_foo_. This is also where we've been heading for a while now.
BR,
Jani.
Quoted 1,723 lines
Looks like a mechanical move, and seems to match my attempt at it so
Reviewed-by Ville Syrjälä <[email protected]>Quoted 1,719 lines
4 files changed, 824 insertions(+), 790 deletions(-) create mode 100644 drivers/gpu/drm/i915/display/intel_cursor.cdrivers/gpu/drm/i915/Makefile +1
-0@@ -197,6 +197,7 @@ i915-y += \ display/intel_combo_phy.o \ display/intel_connector.o \ display/intel_csr.o \ + display/intel_cursor.o \ display/intel_display.o \ display/intel_display_power.o \ display/intel_dpio_phy.o \drivers/gpu/drm/i915/display/intel_cursor.c new file +805
-0@@ -0,0 +1,805 @@ +// SPDX-License-Identifier: MIT +/* +* Copyright © 2020 Intel Corporation +*/ +#include <linux/kernel.h> + +#include <drm/drm_atomic_helper.h> +#include <drm/drm_atomic_uapi.h> +#include <drm/drm_damage_helper.h> +#include <drm/drm_plane_helper.h> +#include <drm/drm_fourcc.h> + +#include "intel_atomic.h" +#include "intel_atomic_plane.h" +#include "intel_display_types.h" +#include "intel_display.h" + +#include "intel_frontbuffer.h" +#include "intel_pm.h" +#include "intel_psr.h" +#include "intel_sprite.h" + +/* Cursor formats */ +static const u32 intel_cursor_formats[] = { +DRM_FORMAT_ARGB8888 , +}; + +static const u64 cursor_format_modifiers[] = { +DRM_FORMAT_MOD_LINEAR , +DRM_FORMAT_MOD_INVALID +}; + +static u32 intel_cursor_base (const struct intel_plane_state *plane_state) +{ +struct drm_i915_private *dev_priv = +to_i915 (plane_state->uapi.plane->dev); +const struct drm_framebuffer *fb = plane_state->hw.fb; +const struct drm_i915_gem_object *obj =intel_fb_obj (fb); +u32 base; + +if (INTEL_INFO (dev_priv)->display.cursor_needs_physical) + base =sg_dma_address (obj->mm.pages->sgl); +else + base =intel_plane_ggtt_offset (plane_state); + +return base + plane_state->color_plane[0 ].offset; +} + +static u32 intel_cursor_position (const struct intel_plane_state *plane_state) +{ +int x = plane_state->uapi.dst.x1; +int y = plane_state->uapi.dst.y1; +u32 pos =0 ; + +if (x <0 ) { + pos |=CURSOR_POS_SIGN <<CURSOR_X_SHIFT ; + x = -x; + } + pos |= x <<CURSOR_X_SHIFT ; + +if (y <0 ) { + pos |=CURSOR_POS_SIGN <<CURSOR_Y_SHIFT ; + y = -y; + } + pos |= y <<CURSOR_Y_SHIFT ; + +return pos; +} + +static bool intel_cursor_size_ok (const struct intel_plane_state *plane_state) +{ +const struct drm_mode_config *config = + &plane_state->uapi.plane->dev->mode_config; +int width =drm_rect_width (&plane_state->uapi.dst); +int height =drm_rect_height (&plane_state->uapi.dst); + +return width >0 && width <= config->cursor_width && + height >0 && height <= config->cursor_height; +} + +static int intel_cursor_check_surface (struct intel_plane_state *plane_state) +{ +struct drm_i915_private *dev_priv = +to_i915 (plane_state->uapi.plane->dev); +unsigned int rotation = plane_state->hw.rotation; +int src_x, src_y; +u32 offset; +int ret; + + ret =intel_plane_compute_gtt (plane_state); +if (ret) +return ret; + +if (!plane_state->uapi.visible) +return 0 ; + + src_x = plane_state->uapi.src.x1 >>16 ; + src_y = plane_state->uapi.src.y1 >>16 ; + +intel_add_fb_offsets (&src_x, &src_y, plane_state,0 ); + offset =intel_plane_compute_aligned_offset (&src_x, &src_y, + plane_state,0 ); + +if (src_x !=0 || src_y !=0 ) { +drm_dbg_kms (&dev_priv->drm, +"Arbitrary cursor panning not supported\n" ); +return -EINVAL ; + } + +/* +* Put the final coordinates back so that the src +* coordinate checks will see the right values. +*/ +drm_rect_translate_to (&plane_state->uapi.src, + src_x <<16 , src_y <<16 ); + +/* ILK+ do this automagically in hardware */ +if (HAS_GMCH (dev_priv) && rotation &DRM_MODE_ROTATE_180 ) { +const struct drm_framebuffer *fb = plane_state->hw.fb; +int src_w =drm_rect_width (&plane_state->uapi.src) >>16 ; +int src_h =drm_rect_height (&plane_state->uapi.src) >>16 ; + + offset += (src_h * src_w -1 ) * fb->format->cpp[0 ]; + } + + plane_state->color_plane[0 ].offset = offset; + plane_state->color_plane[0 ].x = src_x; + plane_state->color_plane[0 ].y = src_y; + +return 0 ; +} + +static int intel_check_cursor (struct intel_crtc_state *crtc_state, +struct intel_plane_state *plane_state) +{ +const struct drm_framebuffer *fb = plane_state->hw.fb; +struct drm_i915_private *i915 =to_i915 (plane_state->uapi.plane->dev); +const struct drm_rect src = plane_state->uapi.src; +const struct drm_rect dst = plane_state->uapi.dst; +int ret; + +if (fb && fb->modifier !=DRM_FORMAT_MOD_LINEAR ) { +drm_dbg_kms (&i915->drm,"cursor cannot be tiled\n" ); +return -EINVAL ; + } + + ret =intel_atomic_plane_check_clipping (plane_state, crtc_state, +DRM_PLANE_HELPER_NO_SCALING , +DRM_PLANE_HELPER_NO_SCALING , + true); +if (ret) +return ret; + +/* Use the unclipped src/dst rectangles, which we program to hw */ + plane_state->uapi.src = src; + plane_state->uapi.dst = dst; + + ret =intel_cursor_check_surface (plane_state); +if (ret) +return ret; + +if (!plane_state->uapi.visible) +return 0 ; + + ret =intel_plane_check_src_coordinates (plane_state); +if (ret) +return ret; + +return 0 ; +} + +static unsigned int +i845_cursor_max_stride (struct intel_plane *plane, +u32 pixel_format,u64 modifier, +unsigned int rotation) +{ +return 2048 ; +} + +static u32 i845_cursor_ctl_crtc (const struct intel_crtc_state *crtc_state) +{ +u32 cntl =0 ; + +if (crtc_state->gamma_enable) + cntl |=CURSOR_GAMMA_ENABLE ; + +return cntl; +} + +static u32 i845_cursor_ctl (const struct intel_crtc_state *crtc_state, +const struct intel_plane_state *plane_state) +{ +return CURSOR_ENABLE | +CURSOR_FORMAT_ARGB | +CURSOR_STRIDE (plane_state->color_plane[0 ].stride); +} + +static bool i845_cursor_size_ok (const struct intel_plane_state *plane_state) +{ +int width =drm_rect_width (&plane_state->uapi.dst); + +/* +* 845g/865g are only limited by the width of their cursors, +* the height is arbitrary up to the precision of the register. +*/ +return intel_cursor_size_ok (plane_state) &&IS_ALIGNED (width,64 ); +} + +static int i845_check_cursor (struct intel_crtc_state *crtc_state, +struct intel_plane_state *plane_state) +{ +const struct drm_framebuffer *fb = plane_state->hw.fb; +struct drm_i915_private *i915 =to_i915 (plane_state->uapi.plane->dev); +int ret; + + ret =intel_check_cursor (crtc_state, plane_state); +if (ret) +return ret; + +/* if we want to turn off the cursor ignore width and height */ +if (!fb) +return 0 ; + +/* Check for which cursor types we support */ +if (!i845_cursor_size_ok (plane_state)) { +drm_dbg_kms (&i915->drm, +"Cursor dimension %dx%d not supported\n" , +drm_rect_width (&plane_state->uapi.dst), +drm_rect_height (&plane_state->uapi.dst)); +return -EINVAL ; + } + +drm_WARN_ON (&i915->drm, plane_state->uapi.visible && + plane_state->color_plane[0 ].stride != fb->pitches[0 ]); + +switch (fb->pitches[0 ]) { +case 256 : +case 512 : +case 1024 : +case 2048 : +break ; +default : +drm_dbg_kms (&i915->drm,"Invalid cursor stride (%u)\n" , + fb->pitches[0 ]); +return -EINVAL ; + } + + plane_state->ctl =i845_cursor_ctl (crtc_state, plane_state); + +return 0 ; +} + +static void i845_update_cursor (struct intel_plane *plane, +const struct intel_crtc_state *crtc_state, +const struct intel_plane_state *plane_state) +{ +struct drm_i915_private *dev_priv =to_i915 (plane->base.dev); +u32 cntl =0 , base =0 , pos =0 , size =0 ; +unsigned long irqflags; + +if (plane_state && plane_state->uapi.visible) { +unsigned int width =drm_rect_width (&plane_state->uapi.dst); +unsigned int height =drm_rect_height (&plane_state->uapi.dst); + + cntl = plane_state->ctl | +i845_cursor_ctl_crtc (crtc_state); + + size = (height <<12 ) | width; + + base =intel_cursor_base (plane_state); + pos =intel_cursor_position (plane_state); + } + +spin_lock_irqsave (&dev_priv->uncore.lock, irqflags); + +/* On these chipsets we can only modify the base/size/stride +* whilst the cursor is disabled. +*/ +if (plane->cursor.base != base || + plane->cursor.size != size || + plane->cursor.cntl != cntl) { +intel_de_write_fw (dev_priv,CURCNTR (PIPE_A ),0 ); +intel_de_write_fw (dev_priv,CURBASE (PIPE_A ), base); +intel_de_write_fw (dev_priv,CURSIZE , size); +intel_de_write_fw (dev_priv,CURPOS (PIPE_A ), pos); +intel_de_write_fw (dev_priv,CURCNTR (PIPE_A ), cntl); + + plane->cursor.base = base; + plane->cursor.size = size; + plane->cursor.cntl = cntl; + }else { +intel_de_write_fw (dev_priv,CURPOS (PIPE_A ), pos); + } + +spin_unlock_irqrestore (&dev_priv->uncore.lock, irqflags); +} + +static void i845_disable_cursor (struct intel_plane *plane, +const struct intel_crtc_state *crtc_state) +{ +i845_update_cursor (plane, crtc_state,NULL ); +} + +static bool i845_cursor_get_hw_state (struct intel_plane *plane, +enum pipe *pipe) +{ +struct drm_i915_private *dev_priv =to_i915 (plane->base.dev); +enum intel_display_power_domain power_domain; +intel_wakeref_t wakeref; +bool ret; + + power_domain =POWER_DOMAIN_PIPE (PIPE_A ); + wakeref =intel_display_power_get_if_enabled (dev_priv, power_domain); +if (!wakeref) +return false; + + ret =intel_de_read (dev_priv,CURCNTR (PIPE_A )) &CURSOR_ENABLE ; + + *pipe =PIPE_A ; + +intel_display_power_put (dev_priv, power_domain, wakeref); + +return ret; +} + +static unsigned int +i9xx_cursor_max_stride (struct intel_plane *plane, +u32 pixel_format,u64 modifier, +unsigned int rotation) +{ +return plane->base.dev->mode_config.cursor_width *4 ; +} + +static u32 i9xx_cursor_ctl_crtc (const struct intel_crtc_state *crtc_state) +{ +struct intel_crtc *crtc =to_intel_crtc (crtc_state->uapi.crtc); +struct drm_i915_private *dev_priv =to_i915 (crtc->base.dev); +u32 cntl =0 ; + +if (INTEL_GEN (dev_priv) >=11 ) +return cntl; + +if (crtc_state->gamma_enable) + cntl =MCURSOR_GAMMA_ENABLE ; + +if (crtc_state->csc_enable) + cntl |=MCURSOR_PIPE_CSC_ENABLE ; + +if (INTEL_GEN (dev_priv) <5 && !IS_G4X (dev_priv)) + cntl |=MCURSOR_PIPE_SELECT (crtc->pipe); + +return cntl; +} + +static u32 i9xx_cursor_ctl (const struct intel_crtc_state *crtc_state, +const struct intel_plane_state *plane_state) +{ +struct drm_i915_private *dev_priv = +to_i915 (plane_state->uapi.plane->dev); +u32 cntl =0 ; + +if (IS_GEN (dev_priv,6 ) ||IS_IVYBRIDGE (dev_priv)) + cntl |=MCURSOR_TRICKLE_FEED_DISABLE ; + +switch (drm_rect_width (&plane_state->uapi.dst)) { +case 64 : + cntl |=MCURSOR_MODE_64_ARGB_AX ; +break ; +case 128 : + cntl |=MCURSOR_MODE_128_ARGB_AX ; +break ; +case 256 : + cntl |=MCURSOR_MODE_256_ARGB_AX ; +break ; +default : +MISSING_CASE (drm_rect_width (&plane_state->uapi.dst)); +return 0 ; + } + +if (plane_state->hw.rotation &DRM_MODE_ROTATE_180 ) + cntl |=MCURSOR_ROTATE_180 ; + +return cntl; +} + +static bool i9xx_cursor_size_ok (const struct intel_plane_state *plane_state) +{ +struct drm_i915_private *dev_priv = +to_i915 (plane_state->uapi.plane->dev); +int width =drm_rect_width (&plane_state->uapi.dst); +int height =drm_rect_height (&plane_state->uapi.dst); + +if (!intel_cursor_size_ok (plane_state)) +return false; + +/* Cursor width is limited to a few power-of-two sizes */ +switch (width) { +case 256 : +case 128 : +case 64 : +break ; +default : +return false; + } + +/* +* IVB+ have CUR_FBC_CTL which allows an arbitrary cursor +* height from 8 lines up to the cursor width, when the +* cursor is not rotated. Everything else requires square +* cursors. +*/ +if (HAS_CUR_FBC (dev_priv) && + plane_state->hw.rotation &DRM_MODE_ROTATE_0 ) { +if (height <8 || height > width) +return false; + }else { +if (height != width) +return false; + } + +return true; +} + +static int i9xx_check_cursor (struct intel_crtc_state *crtc_state, +struct intel_plane_state *plane_state) +{ +struct intel_plane *plane =to_intel_plane (plane_state->uapi.plane); +struct drm_i915_private *dev_priv =to_i915 (plane->base.dev); +const struct drm_framebuffer *fb = plane_state->hw.fb; +enum pipe pipe = plane->pipe; +int ret; + + ret =intel_check_cursor (crtc_state, plane_state); +if (ret) +return ret; + +/* if we want to turn off the cursor ignore width and height */ +if (!fb) +return 0 ; + +/* Check for which cursor types we support */ +if (!i9xx_cursor_size_ok (plane_state)) { +drm_dbg (&dev_priv->drm, +"Cursor dimension %dx%d not supported\n" , +drm_rect_width (&plane_state->uapi.dst), +drm_rect_height (&plane_state->uapi.dst)); +return -EINVAL ; + } + +drm_WARN_ON (&dev_priv->drm, plane_state->uapi.visible && + plane_state->color_plane[0 ].stride != fb->pitches[0 ]); + +if (fb->pitches[0 ] != +drm_rect_width (&plane_state->uapi.dst) * fb->format->cpp[0 ]) { +drm_dbg_kms (&dev_priv->drm, +"Invalid cursor stride (%u) (cursor width %d)\n" , + fb->pitches[0 ], +drm_rect_width (&plane_state->uapi.dst)); +return -EINVAL ; + } + +/* +* There's something wrong with the cursor on CHV pipe C. +* If it straddles the left edge of the screen then +* moving it away from the edge or disabling it often +* results in a pipe underrun, and often that can lead to +* dead pipe (constant underrun reported, and it scans +* out just a solid color). To recover from that, the +* display power well must be turned off and on again. +* Refuse the put the cursor into that compromised position. +*/ +if (IS_CHERRYVIEW (dev_priv) && pipe ==PIPE_C && + plane_state->uapi.visible && plane_state->uapi.dst.x1 <0 ) { +drm_dbg_kms (&dev_priv->drm, +"CHV cursor C not allowed to straddle the left screen edge\n" ); +return -EINVAL ; + } + + plane_state->ctl =i9xx_cursor_ctl (crtc_state, plane_state); + +return 0 ; +} + +static void i9xx_update_cursor (struct intel_plane *plane, +const struct intel_crtc_state *crtc_state, +const struct intel_plane_state *plane_state) +{ +struct drm_i915_private *dev_priv =to_i915 (plane->base.dev); +enum pipe pipe = plane->pipe; +u32 cntl =0 , base =0 , pos =0 , fbc_ctl =0 ; +unsigned long irqflags; + +if (plane_state && plane_state->uapi.visible) { +unsigned width =drm_rect_width (&plane_state->uapi.dst); +unsigned height =drm_rect_height (&plane_state->uapi.dst); + + cntl = plane_state->ctl | +i9xx_cursor_ctl_crtc (crtc_state); + +if (width != height) + fbc_ctl =CUR_FBC_CTL_EN | (height -1 ); + + base =intel_cursor_base (plane_state); + pos =intel_cursor_position (plane_state); + } + +spin_lock_irqsave (&dev_priv->uncore.lock, irqflags); + +/* +* On some platforms writing CURCNTR first will also +* cause CURPOS to be armed by the CURBASE write. +* Without the CURCNTR write the CURPOS write would +* arm itself. Thus we always update CURCNTR before +* CURPOS. +* +* On other platforms CURPOS always requires the +* CURBASE write to arm the update. Additonally +* a write to any of the cursor register will cancel +* an already armed cursor update. Thus leaving out +* the CURBASE write after CURPOS could lead to a +* cursor that doesn't appear to move, or even change +* shape. Thus we always write CURBASE. +* +* The other registers are armed by by the CURBASE write +* except when the plane is getting enabled at which time +* the CURCNTR write arms the update. +*/ + +if (INTEL_GEN (dev_priv) >=9 ) +skl_write_cursor_wm (plane, crtc_state); + +if (!intel_crtc_needs_modeset (crtc_state)) +intel_psr2_program_plane_sel_fetch (plane, crtc_state, plane_state,0 ); + +if (plane->cursor.base != base || + plane->cursor.size != fbc_ctl || + plane->cursor.cntl != cntl) { +if (HAS_CUR_FBC (dev_priv)) +intel_de_write_fw (dev_priv,CUR_FBC_CTL (pipe), + fbc_ctl); +intel_de_write_fw (dev_priv,CURCNTR (pipe), cntl); +intel_de_write_fw (dev_priv,CURPOS (pipe), pos); +intel_de_write_fw (dev_priv,CURBASE (pipe), base); + + plane->cursor.base = base; + plane->cursor.size = fbc_ctl; + plane->cursor.cntl = cntl; + }else { +intel_de_write_fw (dev_priv,CURPOS (pipe), pos); +intel_de_write_fw (dev_priv,CURBASE (pipe), base); + } + +spin_unlock_irqrestore (&dev_priv->uncore.lock, irqflags); +} + +static void i9xx_disable_cursor (struct intel_plane *plane, +const struct intel_crtc_state *crtc_state) +{ +i9xx_update_cursor (plane, crtc_state,NULL ); +} + +static bool i9xx_cursor_get_hw_state (struct intel_plane *plane, +enum pipe *pipe) +{ +struct drm_i915_private *dev_priv =to_i915 (plane->base.dev); +enum intel_display_power_domain power_domain; +intel_wakeref_t wakeref; +bool ret; +u32 val; + +/* +* Not 100% correct for planes that can move between pipes, +* but that's only the case for gen2-3 which don't have any +* display power wells. +*/ + power_domain =POWER_DOMAIN_PIPE (plane->pipe); + wakeref =intel_display_power_get_if_enabled (dev_priv, power_domain); +if (!wakeref) +return false; + + val =intel_de_read (dev_priv,CURCNTR (plane->pipe)); + + ret = val &MCURSOR_MODE ; + +if (INTEL_GEN (dev_priv) >=5 ||IS_G4X (dev_priv)) + *pipe = plane->pipe; +else + *pipe = (val &MCURSOR_PIPE_SELECT_MASK ) >> +MCURSOR_PIPE_SELECT_SHIFT ; + +intel_display_power_put (dev_priv, power_domain, wakeref); + +return ret; +} + +static bool intel_cursor_format_mod_supported (struct drm_plane *_plane, +u32 format,u64 modifier) +{ +return modifier ==DRM_FORMAT_MOD_LINEAR && + format ==DRM_FORMAT_ARGB8888 ; +} + +static int +intel_legacy_cursor_update (struct drm_plane *_plane, +struct drm_crtc *_crtc, +struct drm_framebuffer *fb, +int crtc_x,int crtc_y, +unsigned int crtc_w,unsigned int crtc_h, +u32 src_x,u32 src_y, +u32 src_w,u32 src_h, +struct drm_modeset_acquire_ctx *ctx) +{ +struct intel_plane *plane =to_intel_plane (_plane); +struct intel_crtc *crtc =to_intel_crtc (_crtc); +struct intel_plane_state *old_plane_state = +to_intel_plane_state (plane->base.state); +struct intel_plane_state *new_plane_state; +struct intel_crtc_state *crtc_state = +to_intel_crtc_state (crtc->base.state); +struct intel_crtc_state *new_crtc_state; +int ret; + +/* +* When crtc is inactive or there is a modeset pending, +* wait for it to complete in the slowpath +* +* FIXME bigjoiner fastpath would be good +*/ +if (!crtc_state->hw.active ||intel_crtc_needs_modeset (crtc_state) || + crtc_state->update_pipe || crtc_state->bigjoiner) + goto slow; + +/* +* Don't do an async update if there is an outstanding commit modifying +* the plane. This prevents our async update's changes from getting +* overridden by a previous synchronous update's state. +*/ +if (old_plane_state->uapi.commit && + !try_wait_for_completion (&old_plane_state->uapi.commit->hw_done)) + goto slow; + +/* +* If any parameters change that may affect watermarks, +* take the slowpath. Only changing fb or position should be +* in the fastpath. +*/ +if (old_plane_state->uapi.crtc != &crtc->base || + old_plane_state->uapi.src_w != src_w || + old_plane_state->uapi.src_h != src_h || + old_plane_state->uapi.crtc_w != crtc_w || + old_plane_state->uapi.crtc_h != crtc_h || + !old_plane_state->uapi.fb != !fb) + goto slow; + + new_plane_state =to_intel_plane_state (intel_plane_duplicate_state (&plane->base)); +if (!new_plane_state) +return -ENOMEM ; + + new_crtc_state =to_intel_crtc_state (intel_crtc_duplicate_state (&crtc->base)); +if (!new_crtc_state) { + ret = -ENOMEM ; + goto out_free; + } + +drm_atomic_set_fb_for_plane (&new_plane_state->uapi, fb); + + new_plane_state->uapi.src_x = src_x; + new_plane_state->uapi.src_y = src_y; + new_plane_state->uapi.src_w = src_w; + new_plane_state->uapi.src_h = src_h; + new_plane_state->uapi.crtc_x = crtc_x; + new_plane_state->uapi.crtc_y = crtc_y; + new_plane_state->uapi.crtc_w = crtc_w; + new_plane_state->uapi.crtc_h = crtc_h; + +intel_plane_copy_uapi_to_hw_state (new_plane_state, new_plane_state, crtc); + + ret =intel_plane_atomic_check_with_state (crtc_state, new_crtc_state, + old_plane_state, new_plane_state); +if (ret) + goto out_free; + + ret =intel_plane_pin_fb (new_plane_state); +if (ret) + goto out_free; + +intel_frontbuffer_flush (to_intel_frontbuffer (new_plane_state->hw.fb), +ORIGIN_FLIP ); +intel_frontbuffer_track (to_intel_frontbuffer (old_plane_state->hw.fb), +to_intel_frontbuffer (new_plane_state->hw.fb), + plane->frontbuffer_bit); + +/* Swap plane state */ + plane->base.state = &new_plane_state->uapi; + +/* +* We cannot swap crtc_state as it may be in use by an atomic commit or +* page flip that's running simultaneously. If we swap crtc_state and +* destroy the old state, we will cause a use-after-free there. +* +* Only update active_planes, which is needed for our internal +* bookkeeping. Either value will do the right thing when updating +* planes atomically. If the cursor was part of the atomic update then +* we would have taken the slowpath. +*/ + crtc_state->active_planes = new_crtc_state->active_planes; + +if (new_plane_state->uapi.visible) +intel_update_plane (plane, crtc_state, new_plane_state); +else +intel_disable_plane (plane, crtc_state); + +intel_plane_unpin_fb (old_plane_state); + +out_free: +if (new_crtc_state) +intel_crtc_destroy_state (&crtc->base, &new_crtc_state->uapi); +if (ret) +intel_plane_destroy_state (&plane->base, &new_plane_state->uapi); +else +intel_plane_destroy_state (&plane->base, &old_plane_state->uapi); +return ret; + +slow: +return drm_atomic_helper_update_plane (&plane->base, &crtc->base, fb, + crtc_x, crtc_y, crtc_w, crtc_h, + src_x, src_y, src_w, src_h, ctx); +} + +static const struct drm_plane_funcs intel_cursor_plane_funcs = { + .update_plane = intel_legacy_cursor_update, + .disable_plane = drm_atomic_helper_disable_plane, + .destroy = intel_plane_destroy, + .atomic_duplicate_state = intel_plane_duplicate_state, + .atomic_destroy_state = intel_plane_destroy_state, + .format_mod_supported = intel_cursor_format_mod_supported, +}; + +struct intel_plane * +intel_cursor_plane_create (struct drm_i915_private *dev_priv, +enum pipe pipe) +{ +struct intel_plane *cursor; +int ret, zpos; + + cursor =intel_plane_alloc (); +if (IS_ERR (cursor)) +return cursor; + + cursor->pipe = pipe; + cursor->i9xx_plane = (enum i9xx_plane_id ) pipe; + cursor->id =PLANE_CURSOR ; + cursor->frontbuffer_bit =INTEL_FRONTBUFFER (pipe, cursor->id); + +if (IS_I845G (dev_priv) ||IS_I865G (dev_priv)) { + cursor->max_stride = i845_cursor_max_stride; + cursor->update_plane = i845_update_cursor; + cursor->disable_plane = i845_disable_cursor; + cursor->get_hw_state = i845_cursor_get_hw_state; + cursor->check_plane = i845_check_cursor; + }else { + cursor->max_stride = i9xx_cursor_max_stride; + cursor->update_plane = i9xx_update_cursor; + cursor->disable_plane = i9xx_disable_cursor; + cursor->get_hw_state = i9xx_cursor_get_hw_state; + cursor->check_plane = i9xx_check_cursor; + } + + cursor->cursor.base = ~0 ; + cursor->cursor.cntl = ~0 ; + +if (IS_I845G (dev_priv) ||IS_I865G (dev_priv) ||HAS_CUR_FBC (dev_priv)) + cursor->cursor.size = ~0 ; + + ret =drm_universal_plane_init (&dev_priv->drm, &cursor->base, +0 , &intel_cursor_plane_funcs, + intel_cursor_formats, +ARRAY_SIZE (intel_cursor_formats), + cursor_format_modifiers, +DRM_PLANE_TYPE_CURSOR , +"cursor %c" ,pipe_name (pipe)); +if (ret) + goto fail; + +if (INTEL_GEN (dev_priv) >=4 ) +drm_plane_create_rotation_property (&cursor->base, +DRM_MODE_ROTATE_0 , +DRM_MODE_ROTATE_0 | +DRM_MODE_ROTATE_180 ); + + zpos =RUNTIME_INFO (dev_priv)->num_sprites[pipe] +1 ; +drm_plane_create_zpos_immutable_property (&cursor->base, zpos); + +if (INTEL_GEN (dev_priv) >=12 ) +drm_plane_enable_fb_damage_clips (&cursor->base); + +drm_plane_helper_add (&cursor->base, &intel_plane_helper_funcs); + +return cursor; + +fail: +intel_plane_free (cursor); + +return ERR_PTR (ret); +}drivers/gpu/drm/i915/display/intel_display.c +6
-790@@ -137,16 +137,6 @@ static const u64 i9xx_format_modifiers[] = {DRM_FORMAT_MOD_INVALID }; -/* Cursor formats */ -static const u32 intel_cursor_formats[] = { -DRM_FORMAT_ARGB8888 , -}; - -static const u64 cursor_format_modifiers[] = { -DRM_FORMAT_MOD_LINEAR , -DRM_FORMAT_MOD_INVALID -}; -static void i9xx_crtc_clock_get (struct intel_crtc *crtc,struct intel_crtc_state *pipe_config); static void ilk_pch_clock_get(struct intel_crtc *crtc,@@ -2528,9 +2518,9 @@ static u32 intel_compute_aligned_offset(struct drm_i915_private *dev_priv,return offset_aligned; } -static u32 intel_plane_compute_aligned_offset (int *x,int *y, -const struct intel_plane_state *state, -int color_plane) +u32 intel_plane_compute_aligned_offset (int *x,int *y, +const struct intel_plane_state *state, +int color_plane) {struct intel_plane *intel_plane =to_intel_plane (state->uapi.plane);struct drm_i915_private *dev_priv =to_i915 (intel_plane->base.dev);@@ -3267,7 +3257,7 @@ intel_plane_remap_gtt(struct intel_plane_state *plane_state) } } -static int +int intel_plane_compute_gtt (struct intel_plane_state *plane_state) { const struct intel_framebuffer *fb =@@ -11536,569 +11526,6 @@ static bool intel_crtc_get_pipe_config(struct intel_crtc_state *crtc_state)return true; } -static u32 intel_cursor_base (const struct intel_plane_state *plane_state) -{ -struct drm_i915_private *dev_priv = -to_i915 (plane_state->uapi.plane->dev); -const struct drm_framebuffer *fb = plane_state->hw.fb; -const struct drm_i915_gem_object *obj =intel_fb_obj (fb); -u32 base; - -if (INTEL_INFO (dev_priv)->display.cursor_needs_physical) - base =sg_dma_address (obj->mm.pages->sgl); -else - base =intel_plane_ggtt_offset (plane_state); - -return base + plane_state->color_plane[0 ].offset; -} - -static u32 intel_cursor_position (const struct intel_plane_state *plane_state) -{ -int x = plane_state->uapi.dst.x1; -int y = plane_state->uapi.dst.y1; -u32 pos =0 ; - -if (x <0 ) { - pos |=CURSOR_POS_SIGN <<CURSOR_X_SHIFT ; - x = -x; - } - pos |= x <<CURSOR_X_SHIFT ; - -if (y <0 ) { - pos |=CURSOR_POS_SIGN <<CURSOR_Y_SHIFT ; - y = -y; - } - pos |= y <<CURSOR_Y_SHIFT ; - -return pos; -} - -static bool intel_cursor_size_ok (const struct intel_plane_state *plane_state) -{ -const struct drm_mode_config *config = - &plane_state->uapi.plane->dev->mode_config; -int width =drm_rect_width (&plane_state->uapi.dst); -int height =drm_rect_height (&plane_state->uapi.dst); - -return width >0 && width <= config->cursor_width && - height >0 && height <= config->cursor_height; -} - -static int intel_cursor_check_surface (struct intel_plane_state *plane_state) -{ -struct drm_i915_private *dev_priv = -to_i915 (plane_state->uapi.plane->dev); -unsigned int rotation = plane_state->hw.rotation; -int src_x, src_y; -u32 offset; -int ret; - - ret =intel_plane_compute_gtt (plane_state); -if (ret) -return ret; - -if (!plane_state->uapi.visible) -return 0 ; - - src_x = plane_state->uapi.src.x1 >>16 ; - src_y = plane_state->uapi.src.y1 >>16 ; - -intel_add_fb_offsets (&src_x, &src_y, plane_state,0 ); - offset =intel_plane_compute_aligned_offset (&src_x, &src_y, - plane_state,0 ); - -if (src_x !=0 || src_y !=0 ) { -drm_dbg_kms (&dev_priv->drm, -"Arbitrary cursor panning not supported\n" ); -return -EINVAL ; - } - -/* -* Put the final coordinates back so that the src -* coordinate checks will see the right values. -*/ -drm_rect_translate_to (&plane_state->uapi.src, - src_x <<16 , src_y <<16 ); - -/* ILK+ do this automagically in hardware */ -if (HAS_GMCH (dev_priv) && rotation &DRM_MODE_ROTATE_180 ) { -const struct drm_framebuffer *fb = plane_state->hw.fb; -int src_w =drm_rect_width (&plane_state->uapi.src) >>16 ; -int src_h =drm_rect_height (&plane_state->uapi.src) >>16 ; - - offset += (src_h * src_w -1 ) * fb->format->cpp[0 ]; - } - - plane_state->color_plane[0 ].offset = offset; - plane_state->color_plane[0 ].x = src_x; - plane_state->color_plane[0 ].y = src_y; - -return 0 ; -} - -static int intel_check_cursor (struct intel_crtc_state *crtc_state, -struct intel_plane_state *plane_state) -{ -const struct drm_framebuffer *fb = plane_state->hw.fb; -struct drm_i915_private *i915 =to_i915 (plane_state->uapi.plane->dev); -const struct drm_rect src = plane_state->uapi.src; -const struct drm_rect dst = plane_state->uapi.dst; -int ret; - -if (fb && fb->modifier !=DRM_FORMAT_MOD_LINEAR ) { -drm_dbg_kms (&i915->drm,"cursor cannot be tiled\n" ); -return -EINVAL ; - } - - ret =intel_atomic_plane_check_clipping (plane_state, crtc_state, -DRM_PLANE_HELPER_NO_SCALING , -DRM_PLANE_HELPER_NO_SCALING , - true); -if (ret) -return ret; - -/* Use the unclipped src/dst rectangles, which we program to hw */ - plane_state->uapi.src = src; - plane_state->uapi.dst = dst; - - ret =intel_cursor_check_surface (plane_state); -if (ret) -return ret; - -if (!plane_state->uapi.visible) -return 0 ; - - ret =intel_plane_check_src_coordinates (plane_state); -if (ret) -return ret; - -return 0 ; -} - -static unsigned int -i845_cursor_max_stride (struct intel_plane *plane, -u32 pixel_format,u64 modifier, -unsigned int rotation) -{ -return 2048 ; -} - -static u32 i845_cursor_ctl_crtc (const struct intel_crtc_state *crtc_state) -{ -u32 cntl =0 ; - -if (crtc_state->gamma_enable) - cntl |=CURSOR_GAMMA_ENABLE ; - -return cntl; -} - -static u32 i845_cursor_ctl (const struct intel_crtc_state *crtc_state, -const struct intel_plane_state *plane_state) -{ -return CURSOR_ENABLE | -CURSOR_FORMAT_ARGB | -CURSOR_STRIDE (plane_state->color_plane[0 ].stride); -} - -static bool i845_cursor_size_ok (const struct intel_plane_state *plane_state) -{ -int width =drm_rect_width (&plane_state->uapi.dst); - -/* -* 845g/865g are only limited by the width of their cursors, -* the height is arbitrary up to the precision of the register. -*/ -return intel_cursor_size_ok (plane_state) &&IS_ALIGNED (width,64 ); -} - -static int i845_check_cursor (struct intel_crtc_state *crtc_state, -struct intel_plane_state *plane_state) -{ -const struct drm_framebuffer *fb = plane_state->hw.fb; -struct drm_i915_private *i915 =to_i915 (plane_state->uapi.plane->dev); -int ret; - - ret =intel_check_cursor (crtc_state, plane_state); -if (ret) -return ret; - -/* if we want to turn off the cursor ignore width and height */ -if (!fb) -return 0 ; - -/* Check for which cursor types we support */ -if (!i845_cursor_size_ok (plane_state)) { -drm_dbg_kms (&i915->drm, -"Cursor dimension %dx%d not supported\n" , -drm_rect_width (&plane_state->uapi.dst), -drm_rect_height (&plane_state->uapi.dst)); -return -EINVAL ; - } - -drm_WARN_ON (&i915->drm, plane_state->uapi.visible && - plane_state->color_plane[0 ].stride != fb->pitches[0 ]); - -switch (fb->pitches[0 ]) { -case 256 : -case 512 : -case 1024 : -case 2048 : -break ; -default : -drm_dbg_kms (&i915->drm,"Invalid cursor stride (%u)\n" , - fb->pitches[0 ]); -return -EINVAL ; - } - - plane_state->ctl =i845_cursor_ctl (crtc_state, plane_state); - -return 0 ; -} - -static void i845_update_cursor (struct intel_plane *plane, -const struct intel_crtc_state *crtc_state, -const struct intel_plane_state *plane_state) -{ -struct drm_i915_private *dev_priv =to_i915 (plane->base.dev); -u32 cntl =0 , base =0 , pos =0 , size =0 ; -unsigned long irqflags; - -if (plane_state && plane_state->uapi.visible) { -unsigned int width =drm_rect_width (&plane_state->uapi.dst); -unsigned int height =drm_rect_height (&plane_state->uapi.dst); - - cntl = plane_state->ctl | -i845_cursor_ctl_crtc (crtc_state); - - size = (height <<12 ) | width; - - base =intel_cursor_base (plane_state); - pos =intel_cursor_position (plane_state); - } - -spin_lock_irqsave (&dev_priv->uncore.lock, irqflags); - -/* On these chipsets we can only modify the base/size/stride -* whilst the cursor is disabled. -*/ -if (plane->cursor.base != base || - plane->cursor.size != size || - plane->cursor.cntl != cntl) { -intel_de_write_fw (dev_priv,CURCNTR (PIPE_A ),0 ); -intel_de_write_fw (dev_priv,CURBASE (PIPE_A ), base); -intel_de_write_fw (dev_priv,CURSIZE , size); -intel_de_write_fw (dev_priv,CURPOS (PIPE_A ), pos); -intel_de_write_fw (dev_priv,CURCNTR (PIPE_A ), cntl); - - plane->cursor.base = base; - plane->cursor.size = size; - plane->cursor.cntl = cntl; - }else { -intel_de_write_fw (dev_priv,CURPOS (PIPE_A ), pos); - } - -spin_unlock_irqrestore (&dev_priv->uncore.lock, irqflags); -} - -static void i845_disable_cursor (struct intel_plane *plane, -const struct intel_crtc_state *crtc_state) -{ -i845_update_cursor (plane, crtc_state,NULL ); -} - -static bool i845_cursor_get_hw_state (struct intel_plane *plane, -enum pipe *pipe) -{ -struct drm_i915_private *dev_priv =to_i915 (plane->base.dev); -enum intel_display_power_domain power_domain; -intel_wakeref_t wakeref; -bool ret; - - power_domain =POWER_DOMAIN_PIPE (PIPE_A ); - wakeref =intel_display_power_get_if_enabled (dev_priv, power_domain); -if (!wakeref) -return false; - - ret =intel_de_read (dev_priv,CURCNTR (PIPE_A )) &CURSOR_ENABLE ; - - *pipe =PIPE_A ; - -intel_display_power_put (dev_priv, power_domain, wakeref); - -return ret; -} - -static unsigned int -i9xx_cursor_max_stride (struct intel_plane *plane, -u32 pixel_format,u64 modifier, -unsigned int rotation) -{ -return plane->base.dev->mode_config.cursor_width *4 ; -} - -static u32 i9xx_cursor_ctl_crtc (const struct intel_crtc_state *crtc_state) -{ -struct intel_crtc *crtc =to_intel_crtc (crtc_state->uapi.crtc); -struct drm_i915_private *dev_priv =to_i915 (crtc->base.dev); -u32 cntl =0 ; - -if (INTEL_GEN (dev_priv) >=11 ) -return cntl; - -if (crtc_state->gamma_enable) - cntl =MCURSOR_GAMMA_ENABLE ; - -if (crtc_state->csc_enable) - cntl |=MCURSOR_PIPE_CSC_ENABLE ; - -if (INTEL_GEN (dev_priv) <5 && !IS_G4X (dev_priv)) - cntl |=MCURSOR_PIPE_SELECT (crtc->pipe); - -return cntl; -} - -static u32 i9xx_cursor_ctl (const struct intel_crtc_state *crtc_state, -const struct intel_plane_state *plane_state) -{ -struct drm_i915_private *dev_priv = -to_i915 (plane_state->uapi.plane->dev); -u32 cntl =0 ; - -if (IS_GEN (dev_priv,6 ) ||IS_IVYBRIDGE (dev_priv)) - cntl |=MCURSOR_TRICKLE_FEED_DISABLE ; - -switch (drm_rect_width (&plane_state->uapi.dst)) { -case 64 : - cntl |=MCURSOR_MODE_64_ARGB_AX ; -break ; -case 128 : - cntl |=MCURSOR_MODE_128_ARGB_AX ; -break ; -case 256 : - cntl |=MCURSOR_MODE_256_ARGB_AX ; -break ; -default : -MISSING_CASE (drm_rect_width (&plane_state->uapi.dst)); -return 0 ; - } - -if (plane_state->hw.rotation &DRM_MODE_ROTATE_180 ) - cntl |=MCURSOR_ROTATE_180 ; - -return cntl; -} - -static bool i9xx_cursor_size_ok (const struct intel_plane_state *plane_state) -{ -struct drm_i915_private *dev_priv = -to_i915 (plane_state->uapi.plane->dev); -int width =drm_rect_width (&plane_state->uapi.dst); -int height =drm_rect_height (&plane_state->uapi.dst); - -if (!intel_cursor_size_ok (plane_state)) -return false; - -/* Cursor width is limited to a few power-of-two sizes */ -switch (width) { -case 256 : -case 128 : -case 64 : -break ; -default : -return false; - } - -/* -* IVB+ have CUR_FBC_CTL which allows an arbitrary cursor -* height from 8 lines up to the cursor width, when the -* cursor is not rotated. Everything else requires square -* cursors. -*/ -if (HAS_CUR_FBC (dev_priv) && - plane_state->hw.rotation &DRM_MODE_ROTATE_0 ) { -if (height <8 || height > width) -return false; - }else { -if (height != width) -return false; - } - -return true; -} - -static int i9xx_check_cursor (struct intel_crtc_state *crtc_state, -struct intel_plane_state *plane_state) -{ -struct intel_plane *plane =to_intel_plane (plane_state->uapi.plane); -struct drm_i915_private *dev_priv =to_i915 (plane->base.dev); -const struct drm_framebuffer *fb = plane_state->hw.fb; -enum pipe pipe = plane->pipe; -int ret; - - ret =intel_check_cursor (crtc_state, plane_state); -if (ret) -return ret; - -/* if we want to turn off the cursor ignore width and height */ -if (!fb) -return 0 ; - -/* Check for which cursor types we support */ -if (!i9xx_cursor_size_ok (plane_state)) { -drm_dbg (&dev_priv->drm, -"Cursor dimension %dx%d not supported\n" , -drm_rect_width (&plane_state->uapi.dst), -drm_rect_height (&plane_state->uapi.dst)); -return -EINVAL ; - } - -drm_WARN_ON (&dev_priv->drm, plane_state->uapi.visible && - plane_state->color_plane[0 ].stride != fb->pitches[0 ]); - -if (fb->pitches[0 ] != -drm_rect_width (&plane_state->uapi.dst) * fb->format->cpp[0 ]) { -drm_dbg_kms (&dev_priv->drm, -"Invalid cursor stride (%u) (cursor width %d)\n" , - fb->pitches[0 ], -drm_rect_width (&plane_state->uapi.dst)); -return -EINVAL ; - } - -/* -* There's something wrong with the cursor on CHV pipe C. -* If it straddles the left edge of the screen then -* moving it away from the edge or disabling it often -* results in a pipe underrun, and often that can lead to -* dead pipe (constant underrun reported, and it scans -* out just a solid color). To recover from that, the -* display power well must be turned off and on again. -* Refuse the put the cursor into that compromised position. -*/ -if (IS_CHERRYVIEW (dev_priv) && pipe ==PIPE_C && - plane_state->uapi.visible && plane_state->uapi.dst.x1 <0 ) { -drm_dbg_kms (&dev_priv->drm, -"CHV cursor C not allowed to straddle the left screen edge\n" ); -return -EINVAL ; - } - - plane_state->ctl =i9xx_cursor_ctl (crtc_state, plane_state); - -return 0 ; -} - -static void i9xx_update_cursor (struct intel_plane *plane, -const struct intel_crtc_state *crtc_state, -const struct intel_plane_state *plane_state) -{ -struct drm_i915_private *dev_priv =to_i915 (plane->base.dev); -enum pipe pipe = plane->pipe; -u32 cntl =0 , base =0 , pos =0 , fbc_ctl =0 ; -unsigned long irqflags; - -if (plane_state && plane_state->uapi.visible) { -unsigned width =drm_rect_width (&plane_state->uapi.dst); -unsigned height =drm_rect_height (&plane_state->uapi.dst); - - cntl = plane_state->ctl | -i9xx_cursor_ctl_crtc (crtc_state); - -if (width != height) - fbc_ctl =CUR_FBC_CTL_EN | (height -1 ); - - base =intel_cursor_base (plane_state); - pos =intel_cursor_position (plane_state); - } - -spin_lock_irqsave (&dev_priv->uncore.lock, irqflags); - -/* -* On some platforms writing CURCNTR first will also -* cause CURPOS to be armed by the CURBASE write. -* Without the CURCNTR write the CURPOS write would -* arm itself. Thus we always update CURCNTR before -* CURPOS. -* -* On other platforms CURPOS always requires the -* CURBASE write to arm the update. Additonally -* a write to any of the cursor register will cancel -* an already armed cursor update. Thus leaving out -* the CURBASE write after CURPOS could lead to a -* cursor that doesn't appear to move, or even change -* shape. Thus we always write CURBASE. -* -* The other registers are armed by by the CURBASE write -* except when the plane is getting enabled at which time -* the CURCNTR write arms the update. -*/ - -if (INTEL_GEN (dev_priv) >=9 ) -skl_write_cursor_wm (plane, crtc_state); - -if (!intel_crtc_needs_modeset (crtc_state)) -intel_psr2_program_plane_sel_fetch (plane, crtc_state, plane_state,0 ); - -if (plane->cursor.base != base || - plane->cursor.size != fbc_ctl || - plane->cursor.cntl != cntl) { -if (HAS_CUR_FBC (dev_priv)) -intel_de_write_fw (dev_priv,CUR_FBC_CTL (pipe), - fbc_ctl); -intel_de_write_fw (dev_priv,CURCNTR (pipe), cntl); -intel_de_write_fw (dev_priv,CURPOS (pipe), pos); -intel_de_write_fw (dev_priv,CURBASE (pipe), base); - - plane->cursor.base = base; - plane->cursor.size = fbc_ctl; - plane->cursor.cntl = cntl; - }else { -intel_de_write_fw (dev_priv,CURPOS (pipe), pos); -intel_de_write_fw (dev_priv,CURBASE (pipe), base); - } - -spin_unlock_irqrestore (&dev_priv->uncore.lock, irqflags); -} - -static void i9xx_disable_cursor (struct intel_plane *plane, -const struct intel_crtc_state *crtc_state) -{ -i9xx_update_cursor (plane, crtc_state,NULL ); -} - -static bool i9xx_cursor_get_hw_state (struct intel_plane *plane, -enum pipe *pipe) -{ -struct drm_i915_private *dev_priv =to_i915 (plane->base.dev); -enum intel_display_power_domain power_domain; -intel_wakeref_t wakeref; -bool ret; -u32 val; - -/* -* Not 100% correct for planes that can move between pipes, -* but that's only the case for gen2-3 which don't have any -* display power wells. -*/ - power_domain =POWER_DOMAIN_PIPE (plane->pipe); - wakeref =intel_display_power_get_if_enabled (dev_priv, power_domain); -if (!wakeref) -return false; - - val =intel_de_read (dev_priv,CURCNTR (plane->pipe)); - - ret = val &MCURSOR_MODE ; - -if (INTEL_GEN (dev_priv) >=5 ||IS_G4X (dev_priv)) - *pipe = plane->pipe; -else - *pipe = (val &MCURSOR_PIPE_SELECT_MASK ) >> -MCURSOR_PIPE_SELECT_SHIFT ; - -intel_display_power_put (dev_priv, power_domain, wakeref); - -return ret; -} -/* VESA 640x480x72Hz mode to set on the pipe */ static const struct drm_display_mode load_detect_mode = { DRM_MODE("640x480", DRM_MODE_TYPE_DEFAULT, 31500, 640, 664,@@ -16609,7 +16036,7 @@ static void add_rps_boost_after_vblank(struct drm_crtc *crtc,add_wait_queue (drm_crtc_vblank_waitqueue (crtc), &wait->wait); } -static int intel_plane_pin_fb (struct intel_plane_state *plane_state) +int intel_plane_pin_fb (struct intel_plane_state *plane_state) {struct intel_plane *plane =to_intel_plane (plane_state->uapi.plane);struct drm_i915_private *dev_priv =to_i915 (plane->base.dev);@@ -16639,7 +16066,7 @@ static int intel_plane_pin_fb(struct intel_plane_state *plane_state)return 0 ; } -static void intel_plane_unpin_fb (struct intel_plane_state *old_plane_state) +void intel_plane_unpin_fb (struct intel_plane_state *old_plane_state) {struct i915_vma *vma;@@ -16875,13 +16302,6 @@ static bool i965_plane_format_mod_supported(struct drm_plane *_plane, } } -static bool intel_cursor_format_mod_supported (struct drm_plane *_plane, -u32 format,u64 modifier) -{ -return modifier ==DRM_FORMAT_MOD_LINEAR && - format ==DRM_FORMAT_ARGB8888 ; -} -static const struct drm_plane_funcs i965_plane_funcs = { .update_plane = drm_atomic_helper_update_plane, .disable_plane = drm_atomic_helper_disable_plane,@@ -16900,142 +16320,6 @@ static const struct drm_plane_funcs i8xx_plane_funcs = { .format_mod_supported = i8xx_plane_format_mod_supported, }; -static int -intel_legacy_cursor_update (struct drm_plane *_plane, -struct drm_crtc *_crtc, -struct drm_framebuffer *fb, -int crtc_x,int crtc_y, -unsigned int crtc_w,unsigned int crtc_h, -u32 src_x,u32 src_y, -u32 src_w,u32 src_h, -struct drm_modeset_acquire_ctx *ctx) -{ -struct intel_plane *plane =to_intel_plane (_plane); -struct intel_crtc *crtc =to_intel_crtc (_crtc); -struct intel_plane_state *old_plane_state = -to_intel_plane_state (plane->base.state); -struct intel_plane_state *new_plane_state; -struct intel_crtc_state *crtc_state = -to_intel_crtc_state (crtc->base.state); -struct intel_crtc_state *new_crtc_state; -int ret; - -/* -* When crtc is inactive or there is a modeset pending, -* wait for it to complete in the slowpath -* -* FIXME bigjoiner fastpath would be good -*/ -if (!crtc_state->hw.active ||intel_crtc_needs_modeset (crtc_state) || - crtc_state->update_pipe || crtc_state->bigjoiner) - goto slow; - -/* -* Don't do an async update if there is an outstanding commit modifying -* the plane. This prevents our async update's changes from getting -* overridden by a previous synchronous update's state. -*/ -if (old_plane_state->uapi.commit && - !try_wait_for_completion (&old_plane_state->uapi.commit->hw_done)) - goto slow; - -/* -* If any parameters change that may affect watermarks, -* take the slowpath. Only changing fb or position should be -* in the fastpath. -*/ -if (old_plane_state->uapi.crtc != &crtc->base || - old_plane_state->uapi.src_w != src_w || - old_plane_state->uapi.src_h != src_h || - old_plane_state->uapi.crtc_w != crtc_w || - old_plane_state->uapi.crtc_h != crtc_h || - !old_plane_state->uapi.fb != !fb) - goto slow; - - new_plane_state =to_intel_plane_state (intel_plane_duplicate_state (&plane->base)); -if (!new_plane_state) -return -ENOMEM ; - - new_crtc_state =to_intel_crtc_state (intel_crtc_duplicate_state (&crtc->base)); -if (!new_crtc_state) { - ret = -ENOMEM ; - goto out_free; - } - -drm_atomic_set_fb_for_plane (&new_plane_state->uapi, fb); - - new_plane_state->uapi.src_x = src_x; - new_plane_state->uapi.src_y = src_y; - new_plane_state->uapi.src_w = src_w; - new_plane_state->uapi.src_h = src_h; - new_plane_state->uapi.crtc_x = crtc_x; - new_plane_state->uapi.crtc_y = crtc_y; - new_plane_state->uapi.crtc_w = crtc_w; - new_plane_state->uapi.crtc_h = crtc_h; - -intel_plane_copy_uapi_to_hw_state (new_plane_state, new_plane_state, crtc); - - ret =intel_plane_atomic_check_with_state (crtc_state, new_crtc_state, - old_plane_state, new_plane_state); -if (ret) - goto out_free; - - ret =intel_plane_pin_fb (new_plane_state); -if (ret) - goto out_free; - -intel_frontbuffer_flush (to_intel_frontbuffer (new_plane_state->hw.fb), -ORIGIN_FLIP ); -intel_frontbuffer_track (to_intel_frontbuffer (old_plane_state->hw.fb), -to_intel_frontbuffer (new_plane_state->hw.fb), - plane->frontbuffer_bit); - -/* Swap plane state */ - plane->base.state = &new_plane_state->uapi; - -/* -* We cannot swap crtc_state as it may be in use by an atomic commit or -* page flip that's running simultaneously. If we swap crtc_state and -* destroy the old state, we will cause a use-after-free there. -* -* Only update active_planes, which is needed for our internal -* bookkeeping. Either value will do the right thing when updating -* planes atomically. If the cursor was part of the atomic update then -* we would have taken the slowpath. -*/ - crtc_state->active_planes = new_crtc_state->active_planes; - -if (new_plane_state->uapi.visible) -intel_update_plane (plane, crtc_state, new_plane_state); -else -intel_disable_plane (plane, crtc_state); - -intel_plane_unpin_fb (old_plane_state); - -out_free: -if (new_crtc_state) -intel_crtc_destroy_state (&crtc->base, &new_crtc_state->uapi); -if (ret) -intel_plane_destroy_state (&plane->base, &new_plane_state->uapi); -else -intel_plane_destroy_state (&plane->base, &old_plane_state->uapi); -return ret; - -slow: -return drm_atomic_helper_update_plane (&plane->base, &crtc->base, fb, - crtc_x, crtc_y, crtc_w, crtc_h, - src_x, src_y, src_w, src_h, ctx); -} - -static const struct drm_plane_funcs intel_cursor_plane_funcs = { - .update_plane = intel_legacy_cursor_update, - .disable_plane = drm_atomic_helper_disable_plane, - .destroy = intel_plane_destroy, - .atomic_duplicate_state = intel_plane_duplicate_state, - .atomic_destroy_state = intel_plane_destroy_state, - .format_mod_supported = intel_cursor_format_mod_supported, -}; -static bool i9xx_plane_has_fbc (struct drm_i915_private *dev_priv,enum i9xx_plane_id i9xx_plane) {@@ -17187,74 +16471,6 @@ intel_primary_plane_create(struct drm_i915_private *dev_priv, enum pipe pipe)return ERR_PTR (ret); } -static struct intel_plane * -intel_cursor_plane_create (struct drm_i915_private *dev_priv, -enum pipe pipe) -{ -struct intel_plane *cursor; -int ret, zpos; - - cursor =intel_plane_alloc (); -if (IS_ERR (cursor)) -return cursor; - - cursor->pipe = pipe; - cursor->i9xx_plane = (enum i9xx_plane_id ) pipe; - cursor->id =PLANE_CURSOR ; - cursor->frontbuffer_bit =INTEL_FRONTBUFFER (pipe, cursor->id); - -if (IS_I845G (dev_priv) ||IS_I865G (dev_priv)) { - cursor->max_stride = i845_cursor_max_stride; - cursor->update_plane = i845_update_cursor; - cursor->disable_plane = i845_disable_cursor; - cursor->get_hw_state = i845_cursor_get_hw_state; - cursor->check_plane = i845_check_cursor; - }else { - cursor->max_stride = i9xx_cursor_max_stride; - cursor->update_plane = i9xx_update_cursor; - cursor->disable_plane = i9xx_disable_cursor; - cursor->get_hw_state = i9xx_cursor_get_hw_state; - cursor->check_plane = i9xx_check_cursor; - } - - cursor->cursor.base = ~0 ; - cursor->cursor.cntl = ~0 ; - -if (IS_I845G (dev_priv) ||IS_I865G (dev_priv) ||HAS_CUR_FBC (dev_priv)) - cursor->cursor.size = ~0 ; - - ret =drm_universal_plane_init (&dev_priv->drm, &cursor->base, -0 , &intel_cursor_plane_funcs, - intel_cursor_formats, -ARRAY_SIZE (intel_cursor_formats), - cursor_format_modifiers, -DRM_PLANE_TYPE_CURSOR , -"cursor %c" ,pipe_name (pipe)); -if (ret) - goto fail; - -if (INTEL_GEN (dev_priv) >=4 ) -drm_plane_create_rotation_property (&cursor->base, -DRM_MODE_ROTATE_0 , -DRM_MODE_ROTATE_0 | -DRM_MODE_ROTATE_180 ); - - zpos =RUNTIME_INFO (dev_priv)->num_sprites[pipe] +1 ; -drm_plane_create_zpos_immutable_property (&cursor->base, zpos); - -if (INTEL_GEN (dev_priv) >=12 ) -drm_plane_enable_fb_damage_clips (&cursor->base); - -drm_plane_helper_add (&cursor->base, &intel_plane_helper_funcs); - -return cursor; - -fail: -intel_plane_free (cursor); - -return ERR_PTR (ret); -} -static int intel_crtc_late_register (struct drm_crtc *crtc) {intel_crtc_debugfs_add (crtc);drivers/gpu/drm/i915/display/intel_display.h +12
-0@@ -647,6 +647,18 @@ bool intel_format_info_is_yuv_semiplanar(const struct drm_format_info *info, uint64_t modifier); +int intel_plane_compute_gtt (struct intel_plane_state *plane_state); +u32 intel_plane_compute_aligned_offset (int *x,int *y, +const struct intel_plane_state *state, +int color_plane); +int intel_plane_pin_fb (struct intel_plane_state *plane_state); +void intel_plane_unpin_fb (struct intel_plane_state *old_plane_state); + +/* cursor */ +struct intel_plane * +intel_cursor_plane_create (struct drm_i915_private *dev_priv, +enum pipe pipe); +/* modesetting */ void intel_modeset_init_hw (struct drm_i915_private *i915);int intel_modeset_init_noirq (struct drm_i915_private *i915);Signature · 6 lines
2.27.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 5 lines
Jani Nikula, Intel Open Source Graphics Center _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH 4/9] drm/i915: refactor cursor code out of i915_display.c
Quoted 15 lines · Jani Nikula
Quoted 13 lines · Ville Syrjälä
Quoted 11 lines · Dave Airlie
From: Dave Airlie <[email protected]>
This file is a monster, let's start simple, the cursor plane code seems pretty standalone, and splits out easily enough.
Signed-off-by Dave Airlie <[email protected]>--- drivers/gpu/drm/i915/Makefile | 1 + drivers/gpu/drm/i915/display/intel_cursor.c | 805 +++++++++++++++++++ drivers/gpu/drm/i915/display/intel_display.c | 796 +----------------- drivers/gpu/drm/i915/display/intel_display.h | 12 +
Quoted 7 lines
Quoted 3 lines
I would just add the
intel_cursor.hfor this.intel_display.his an even bigger mess thanintel_display.c, and causing no end of redundant rebuilds. The smaller we can make it the better IMO.Separate header for each .c is where we've been heading since we started refactoring the driver to multiple subdirs instead of the flat structure, and started chopping up files as a consequence.
Yeah +1 on separate headers. It's mildly more pain for the splitting, but eventually it allows us to move the structs together with the functions and actually untangle the spaghetti instead of just putting it over a few more plates.
-Daniel
Quoted 1,738 lines
Also, please prefix the functions in intel_foo.[ch] with
intel_foo_. This is also where we've been heading for a while now.BR,
Jani.Quoted 1,719 lines
Looks like a mechanical move, and seems to match my attempt at it so
Reviewed-by Ville Syrjälä <[email protected]>Quoted 1,715 lines
4 files changed, 824 insertions(+), 790 deletions(-) create mode 100644 drivers/gpu/drm/i915/display/intel_cursor.cdrivers/gpu/drm/i915/Makefile +1
-0@@ -197,6 +197,7 @@ i915-y += \ display/intel_combo_phy.o \ display/intel_connector.o \ display/intel_csr.o \ + display/intel_cursor.o \ display/intel_display.o \ display/intel_display_power.o \ display/intel_dpio_phy.o \drivers/gpu/drm/i915/display/intel_cursor.c new file +805
-0@@ -0,0 +1,805 @@ +// SPDX-License-Identifier: MIT +/* +* Copyright © 2020 Intel Corporation +*/ +#include <linux/kernel.h> + +#include <drm/drm_atomic_helper.h> +#include <drm/drm_atomic_uapi.h> +#include <drm/drm_damage_helper.h> +#include <drm/drm_plane_helper.h> +#include <drm/drm_fourcc.h> + +#include "intel_atomic.h" +#include "intel_atomic_plane.h" +#include "intel_display_types.h" +#include "intel_display.h" + +#include "intel_frontbuffer.h" +#include "intel_pm.h" +#include "intel_psr.h" +#include "intel_sprite.h" + +/* Cursor formats */ +static const u32 intel_cursor_formats[] = { +DRM_FORMAT_ARGB8888 , +}; + +static const u64 cursor_format_modifiers[] = { +DRM_FORMAT_MOD_LINEAR , +DRM_FORMAT_MOD_INVALID +}; + +static u32 intel_cursor_base (const struct intel_plane_state *plane_state) +{ +struct drm_i915_private *dev_priv = +to_i915 (plane_state->uapi.plane->dev); +const struct drm_framebuffer *fb = plane_state->hw.fb; +const struct drm_i915_gem_object *obj =intel_fb_obj (fb); +u32 base; + +if (INTEL_INFO (dev_priv)->display.cursor_needs_physical) + base =sg_dma_address (obj->mm.pages->sgl); +else + base =intel_plane_ggtt_offset (plane_state); + +return base + plane_state->color_plane[0 ].offset; +} + +static u32 intel_cursor_position (const struct intel_plane_state *plane_state) +{ +int x = plane_state->uapi.dst.x1; +int y = plane_state->uapi.dst.y1; +u32 pos =0 ; + +if (x <0 ) { + pos |=CURSOR_POS_SIGN <<CURSOR_X_SHIFT ; + x = -x; + } + pos |= x <<CURSOR_X_SHIFT ; + +if (y <0 ) { + pos |=CURSOR_POS_SIGN <<CURSOR_Y_SHIFT ; + y = -y; + } + pos |= y <<CURSOR_Y_SHIFT ; + +return pos; +} + +static bool intel_cursor_size_ok (const struct intel_plane_state *plane_state) +{ +const struct drm_mode_config *config = + &plane_state->uapi.plane->dev->mode_config; +int width =drm_rect_width (&plane_state->uapi.dst); +int height =drm_rect_height (&plane_state->uapi.dst); + +return width >0 && width <= config->cursor_width && + height >0 && height <= config->cursor_height; +} + +static int intel_cursor_check_surface (struct intel_plane_state *plane_state) +{ +struct drm_i915_private *dev_priv = +to_i915 (plane_state->uapi.plane->dev); +unsigned int rotation = plane_state->hw.rotation; +int src_x, src_y; +u32 offset; +int ret; + + ret =intel_plane_compute_gtt (plane_state); +if (ret) +return ret; + +if (!plane_state->uapi.visible) +return 0 ; + + src_x = plane_state->uapi.src.x1 >>16 ; + src_y = plane_state->uapi.src.y1 >>16 ; + +intel_add_fb_offsets (&src_x, &src_y, plane_state,0 ); + offset =intel_plane_compute_aligned_offset (&src_x, &src_y, + plane_state,0 ); + +if (src_x !=0 || src_y !=0 ) { +drm_dbg_kms (&dev_priv->drm, +"Arbitrary cursor panning not supported\n" ); +return -EINVAL ; + } + +/* +* Put the final coordinates back so that the src +* coordinate checks will see the right values. +*/ +drm_rect_translate_to (&plane_state->uapi.src, + src_x <<16 , src_y <<16 ); + +/* ILK+ do this automagically in hardware */ +if (HAS_GMCH (dev_priv) && rotation &DRM_MODE_ROTATE_180 ) { +const struct drm_framebuffer *fb = plane_state->hw.fb; +int src_w =drm_rect_width (&plane_state->uapi.src) >>16 ; +int src_h =drm_rect_height (&plane_state->uapi.src) >>16 ; + + offset += (src_h * src_w -1 ) * fb->format->cpp[0 ]; + } + + plane_state->color_plane[0 ].offset = offset; + plane_state->color_plane[0 ].x = src_x; + plane_state->color_plane[0 ].y = src_y; + +return 0 ; +} + +static int intel_check_cursor (struct intel_crtc_state *crtc_state, +struct intel_plane_state *plane_state) +{ +const struct drm_framebuffer *fb = plane_state->hw.fb; +struct drm_i915_private *i915 =to_i915 (plane_state->uapi.plane->dev); +const struct drm_rect src = plane_state->uapi.src; +const struct drm_rect dst = plane_state->uapi.dst; +int ret; + +if (fb && fb->modifier !=DRM_FORMAT_MOD_LINEAR ) { +drm_dbg_kms (&i915->drm,"cursor cannot be tiled\n" ); +return -EINVAL ; + } + + ret =intel_atomic_plane_check_clipping (plane_state, crtc_state, +DRM_PLANE_HELPER_NO_SCALING , +DRM_PLANE_HELPER_NO_SCALING , + true); +if (ret) +return ret; + +/* Use the unclipped src/dst rectangles, which we program to hw */ + plane_state->uapi.src = src; + plane_state->uapi.dst = dst; + + ret =intel_cursor_check_surface (plane_state); +if (ret) +return ret; + +if (!plane_state->uapi.visible) +return 0 ; + + ret =intel_plane_check_src_coordinates (plane_state); +if (ret) +return ret; + +return 0 ; +} + +static unsigned int +i845_cursor_max_stride (struct intel_plane *plane, +u32 pixel_format,u64 modifier, +unsigned int rotation) +{ +return 2048 ; +} + +static u32 i845_cursor_ctl_crtc (const struct intel_crtc_state *crtc_state) +{ +u32 cntl =0 ; + +if (crtc_state->gamma_enable) + cntl |=CURSOR_GAMMA_ENABLE ; + +return cntl; +} + +static u32 i845_cursor_ctl (const struct intel_crtc_state *crtc_state, +const struct intel_plane_state *plane_state) +{ +return CURSOR_ENABLE | +CURSOR_FORMAT_ARGB | +CURSOR_STRIDE (plane_state->color_plane[0 ].stride); +} + +static bool i845_cursor_size_ok (const struct intel_plane_state *plane_state) +{ +int width =drm_rect_width (&plane_state->uapi.dst); + +/* +* 845g/865g are only limited by the width of their cursors, +* the height is arbitrary up to the precision of the register. +*/ +return intel_cursor_size_ok (plane_state) &&IS_ALIGNED (width,64 ); +} + +static int i845_check_cursor (struct intel_crtc_state *crtc_state, +struct intel_plane_state *plane_state) +{ +const struct drm_framebuffer *fb = plane_state->hw.fb; +struct drm_i915_private *i915 =to_i915 (plane_state->uapi.plane->dev); +int ret; + + ret =intel_check_cursor (crtc_state, plane_state); +if (ret) +return ret; + +/* if we want to turn off the cursor ignore width and height */ +if (!fb) +return 0 ; + +/* Check for which cursor types we support */ +if (!i845_cursor_size_ok (plane_state)) { +drm_dbg_kms (&i915->drm, +"Cursor dimension %dx%d not supported\n" , +drm_rect_width (&plane_state->uapi.dst), +drm_rect_height (&plane_state->uapi.dst)); +return -EINVAL ; + } + +drm_WARN_ON (&i915->drm, plane_state->uapi.visible && + plane_state->color_plane[0 ].stride != fb->pitches[0 ]); + +switch (fb->pitches[0 ]) { +case 256 : +case 512 : +case 1024 : +case 2048 : +break ; +default : +drm_dbg_kms (&i915->drm,"Invalid cursor stride (%u)\n" , + fb->pitches[0 ]); +return -EINVAL ; + } + + plane_state->ctl =i845_cursor_ctl (crtc_state, plane_state); + +return 0 ; +} + +static void i845_update_cursor (struct intel_plane *plane, +const struct intel_crtc_state *crtc_state, +const struct intel_plane_state *plane_state) +{ +struct drm_i915_private *dev_priv =to_i915 (plane->base.dev); +u32 cntl =0 , base =0 , pos =0 , size =0 ; +unsigned long irqflags; + +if (plane_state && plane_state->uapi.visible) { +unsigned int width =drm_rect_width (&plane_state->uapi.dst); +unsigned int height =drm_rect_height (&plane_state->uapi.dst); + + cntl = plane_state->ctl | +i845_cursor_ctl_crtc (crtc_state); + + size = (height <<12 ) | width; + + base =intel_cursor_base (plane_state); + pos =intel_cursor_position (plane_state); + } + +spin_lock_irqsave (&dev_priv->uncore.lock, irqflags); + +/* On these chipsets we can only modify the base/size/stride +* whilst the cursor is disabled. +*/ +if (plane->cursor.base != base || + plane->cursor.size != size || + plane->cursor.cntl != cntl) { +intel_de_write_fw (dev_priv,CURCNTR (PIPE_A ),0 ); +intel_de_write_fw (dev_priv,CURBASE (PIPE_A ), base); +intel_de_write_fw (dev_priv,CURSIZE , size); +intel_de_write_fw (dev_priv,CURPOS (PIPE_A ), pos); +intel_de_write_fw (dev_priv,CURCNTR (PIPE_A ), cntl); + + plane->cursor.base = base; + plane->cursor.size = size; + plane->cursor.cntl = cntl; + }else { +intel_de_write_fw (dev_priv,CURPOS (PIPE_A ), pos); + } + +spin_unlock_irqrestore (&dev_priv->uncore.lock, irqflags); +} + +static void i845_disable_cursor (struct intel_plane *plane, +const struct intel_crtc_state *crtc_state) +{ +i845_update_cursor (plane, crtc_state,NULL ); +} + +static bool i845_cursor_get_hw_state (struct intel_plane *plane, +enum pipe *pipe) +{ +struct drm_i915_private *dev_priv =to_i915 (plane->base.dev); +enum intel_display_power_domain power_domain; +intel_wakeref_t wakeref; +bool ret; + + power_domain =POWER_DOMAIN_PIPE (PIPE_A ); + wakeref =intel_display_power_get_if_enabled (dev_priv, power_domain); +if (!wakeref) +return false; + + ret =intel_de_read (dev_priv,CURCNTR (PIPE_A )) &CURSOR_ENABLE ; + + *pipe =PIPE_A ; + +intel_display_power_put (dev_priv, power_domain, wakeref); + +return ret; +} + +static unsigned int +i9xx_cursor_max_stride (struct intel_plane *plane, +u32 pixel_format,u64 modifier, +unsigned int rotation) +{ +return plane->base.dev->mode_config.cursor_width *4 ; +} + +static u32 i9xx_cursor_ctl_crtc (const struct intel_crtc_state *crtc_state) +{ +struct intel_crtc *crtc =to_intel_crtc (crtc_state->uapi.crtc); +struct drm_i915_private *dev_priv =to_i915 (crtc->base.dev); +u32 cntl =0 ; + +if (INTEL_GEN (dev_priv) >=11 ) +return cntl; + +if (crtc_state->gamma_enable) + cntl =MCURSOR_GAMMA_ENABLE ; + +if (crtc_state->csc_enable) + cntl |=MCURSOR_PIPE_CSC_ENABLE ; + +if (INTEL_GEN (dev_priv) <5 && !IS_G4X (dev_priv)) + cntl |=MCURSOR_PIPE_SELECT (crtc->pipe); + +return cntl; +} + +static u32 i9xx_cursor_ctl (const struct intel_crtc_state *crtc_state, +const struct intel_plane_state *plane_state) +{ +struct drm_i915_private *dev_priv = +to_i915 (plane_state->uapi.plane->dev); +u32 cntl =0 ; + +if (IS_GEN (dev_priv,6 ) ||IS_IVYBRIDGE (dev_priv)) + cntl |=MCURSOR_TRICKLE_FEED_DISABLE ; + +switch (drm_rect_width (&plane_state->uapi.dst)) { +case 64 : + cntl |=MCURSOR_MODE_64_ARGB_AX ; +break ; +case 128 : + cntl |=MCURSOR_MODE_128_ARGB_AX ; +break ; +case 256 : + cntl |=MCURSOR_MODE_256_ARGB_AX ; +break ; +default : +MISSING_CASE (drm_rect_width (&plane_state->uapi.dst)); +return 0 ; + } + +if (plane_state->hw.rotation &DRM_MODE_ROTATE_180 ) + cntl |=MCURSOR_ROTATE_180 ; + +return cntl; +} + +static bool i9xx_cursor_size_ok (const struct intel_plane_state *plane_state) +{ +struct drm_i915_private *dev_priv = +to_i915 (plane_state->uapi.plane->dev); +int width =drm_rect_width (&plane_state->uapi.dst); +int height =drm_rect_height (&plane_state->uapi.dst); + +if (!intel_cursor_size_ok (plane_state)) +return false; + +/* Cursor width is limited to a few power-of-two sizes */ +switch (width) { +case 256 : +case 128 : +case 64 : +break ; +default : +return false; + } + +/* +* IVB+ have CUR_FBC_CTL which allows an arbitrary cursor +* height from 8 lines up to the cursor width, when the +* cursor is not rotated. Everything else requires square +* cursors. +*/ +if (HAS_CUR_FBC (dev_priv) && + plane_state->hw.rotation &DRM_MODE_ROTATE_0 ) { +if (height <8 || height > width) +return false; + }else { +if (height != width) +return false; + } + +return true; +} + +static int i9xx_check_cursor (struct intel_crtc_state *crtc_state, +struct intel_plane_state *plane_state) +{ +struct intel_plane *plane =to_intel_plane (plane_state->uapi.plane); +struct drm_i915_private *dev_priv =to_i915 (plane->base.dev); +const struct drm_framebuffer *fb = plane_state->hw.fb; +enum pipe pipe = plane->pipe; +int ret; + + ret =intel_check_cursor (crtc_state, plane_state); +if (ret) +return ret; + +/* if we want to turn off the cursor ignore width and height */ +if (!fb) +return 0 ; + +/* Check for which cursor types we support */ +if (!i9xx_cursor_size_ok (plane_state)) { +drm_dbg (&dev_priv->drm, +"Cursor dimension %dx%d not supported\n" , +drm_rect_width (&plane_state->uapi.dst), +drm_rect_height (&plane_state->uapi.dst)); +return -EINVAL ; + } + +drm_WARN_ON (&dev_priv->drm, plane_state->uapi.visible && + plane_state->color_plane[0 ].stride != fb->pitches[0 ]); + +if (fb->pitches[0 ] != +drm_rect_width (&plane_state->uapi.dst) * fb->format->cpp[0 ]) { +drm_dbg_kms (&dev_priv->drm, +"Invalid cursor stride (%u) (cursor width %d)\n" , + fb->pitches[0 ], +drm_rect_width (&plane_state->uapi.dst)); +return -EINVAL ; + } + +/* +* There's something wrong with the cursor on CHV pipe C. +* If it straddles the left edge of the screen then +* moving it away from the edge or disabling it often +* results in a pipe underrun, and often that can lead to +* dead pipe (constant underrun reported, and it scans +* out just a solid color). To recover from that, the +* display power well must be turned off and on again. +* Refuse the put the cursor into that compromised position. +*/ +if (IS_CHERRYVIEW (dev_priv) && pipe ==PIPE_C && + plane_state->uapi.visible && plane_state->uapi.dst.x1 <0 ) { +drm_dbg_kms (&dev_priv->drm, +"CHV cursor C not allowed to straddle the left screen edge\n" ); +return -EINVAL ; + } + + plane_state->ctl =i9xx_cursor_ctl (crtc_state, plane_state); + +return 0 ; +} + +static void i9xx_update_cursor (struct intel_plane *plane, +const struct intel_crtc_state *crtc_state, +const struct intel_plane_state *plane_state) +{ +struct drm_i915_private *dev_priv =to_i915 (plane->base.dev); +enum pipe pipe = plane->pipe; +u32 cntl =0 , base =0 , pos =0 , fbc_ctl =0 ; +unsigned long irqflags; + +if (plane_state && plane_state->uapi.visible) { +unsigned width =drm_rect_width (&plane_state->uapi.dst); +unsigned height =drm_rect_height (&plane_state->uapi.dst); + + cntl = plane_state->ctl | +i9xx_cursor_ctl_crtc (crtc_state); + +if (width != height) + fbc_ctl =CUR_FBC_CTL_EN | (height -1 ); + + base =intel_cursor_base (plane_state); + pos =intel_cursor_position (plane_state); + } + +spin_lock_irqsave (&dev_priv->uncore.lock, irqflags); + +/* +* On some platforms writing CURCNTR first will also +* cause CURPOS to be armed by the CURBASE write. +* Without the CURCNTR write the CURPOS write would +* arm itself. Thus we always update CURCNTR before +* CURPOS. +* +* On other platforms CURPOS always requires the +* CURBASE write to arm the update. Additonally +* a write to any of the cursor register will cancel +* an already armed cursor update. Thus leaving out +* the CURBASE write after CURPOS could lead to a +* cursor that doesn't appear to move, or even change +* shape. Thus we always write CURBASE. +* +* The other registers are armed by by the CURBASE write +* except when the plane is getting enabled at which time +* the CURCNTR write arms the update. +*/ + +if (INTEL_GEN (dev_priv) >=9 ) +skl_write_cursor_wm (plane, crtc_state); + +if (!intel_crtc_needs_modeset (crtc_state)) +intel_psr2_program_plane_sel_fetch (plane, crtc_state, plane_state,0 ); + +if (plane->cursor.base != base || + plane->cursor.size != fbc_ctl || + plane->cursor.cntl != cntl) { +if (HAS_CUR_FBC (dev_priv)) +intel_de_write_fw (dev_priv,CUR_FBC_CTL (pipe), + fbc_ctl); +intel_de_write_fw (dev_priv,CURCNTR (pipe), cntl); +intel_de_write_fw (dev_priv,CURPOS (pipe), pos); +intel_de_write_fw (dev_priv,CURBASE (pipe), base); + + plane->cursor.base = base; + plane->cursor.size = fbc_ctl; + plane->cursor.cntl = cntl; + }else { +intel_de_write_fw (dev_priv,CURPOS (pipe), pos); +intel_de_write_fw (dev_priv,CURBASE (pipe), base); + } + +spin_unlock_irqrestore (&dev_priv->uncore.lock, irqflags); +} + +static void i9xx_disable_cursor (struct intel_plane *plane, +const struct intel_crtc_state *crtc_state) +{ +i9xx_update_cursor (plane, crtc_state,NULL ); +} + +static bool i9xx_cursor_get_hw_state (struct intel_plane *plane, +enum pipe *pipe) +{ +struct drm_i915_private *dev_priv =to_i915 (plane->base.dev); +enum intel_display_power_domain power_domain; +intel_wakeref_t wakeref; +bool ret; +u32 val; + +/* +* Not 100% correct for planes that can move between pipes, +* but that's only the case for gen2-3 which don't have any +* display power wells. +*/ + power_domain =POWER_DOMAIN_PIPE (plane->pipe); + wakeref =intel_display_power_get_if_enabled (dev_priv, power_domain); +if (!wakeref) +return false; + + val =intel_de_read (dev_priv,CURCNTR (plane->pipe)); + + ret = val &MCURSOR_MODE ; + +if (INTEL_GEN (dev_priv) >=5 ||IS_G4X (dev_priv)) + *pipe = plane->pipe; +else + *pipe = (val &MCURSOR_PIPE_SELECT_MASK ) >> +MCURSOR_PIPE_SELECT_SHIFT ; + +intel_display_power_put (dev_priv, power_domain, wakeref); + +return ret; +} + +static bool intel_cursor_format_mod_supported (struct drm_plane *_plane, +u32 format,u64 modifier) +{ +return modifier ==DRM_FORMAT_MOD_LINEAR && + format ==DRM_FORMAT_ARGB8888 ; +} + +static int +intel_legacy_cursor_update (struct drm_plane *_plane, +struct drm_crtc *_crtc, +struct drm_framebuffer *fb, +int crtc_x,int crtc_y, +unsigned int crtc_w,unsigned int crtc_h, +u32 src_x,u32 src_y, +u32 src_w,u32 src_h, +struct drm_modeset_acquire_ctx *ctx) +{ +struct intel_plane *plane =to_intel_plane (_plane); +struct intel_crtc *crtc =to_intel_crtc (_crtc); +struct intel_plane_state *old_plane_state = +to_intel_plane_state (plane->base.state); +struct intel_plane_state *new_plane_state; +struct intel_crtc_state *crtc_state = +to_intel_crtc_state (crtc->base.state); +struct intel_crtc_state *new_crtc_state; +int ret; + +/* +* When crtc is inactive or there is a modeset pending, +* wait for it to complete in the slowpath +* +* FIXME bigjoiner fastpath would be good +*/ +if (!crtc_state->hw.active ||intel_crtc_needs_modeset (crtc_state) || + crtc_state->update_pipe || crtc_state->bigjoiner) + goto slow; + +/* +* Don't do an async update if there is an outstanding commit modifying +* the plane. This prevents our async update's changes from getting +* overridden by a previous synchronous update's state. +*/ +if (old_plane_state->uapi.commit && + !try_wait_for_completion (&old_plane_state->uapi.commit->hw_done)) + goto slow; + +/* +* If any parameters change that may affect watermarks, +* take the slowpath. Only changing fb or position should be +* in the fastpath. +*/ +if (old_plane_state->uapi.crtc != &crtc->base || + old_plane_state->uapi.src_w != src_w || + old_plane_state->uapi.src_h != src_h || + old_plane_state->uapi.crtc_w != crtc_w || + old_plane_state->uapi.crtc_h != crtc_h || + !old_plane_state->uapi.fb != !fb) + goto slow; + + new_plane_state =to_intel_plane_state (intel_plane_duplicate_state (&plane->base)); +if (!new_plane_state) +return -ENOMEM ; + + new_crtc_state =to_intel_crtc_state (intel_crtc_duplicate_state (&crtc->base)); +if (!new_crtc_state) { + ret = -ENOMEM ; + goto out_free; + } + +drm_atomic_set_fb_for_plane (&new_plane_state->uapi, fb); + + new_plane_state->uapi.src_x = src_x; + new_plane_state->uapi.src_y = src_y; + new_plane_state->uapi.src_w = src_w; + new_plane_state->uapi.src_h = src_h; + new_plane_state->uapi.crtc_x = crtc_x; + new_plane_state->uapi.crtc_y = crtc_y; + new_plane_state->uapi.crtc_w = crtc_w; + new_plane_state->uapi.crtc_h = crtc_h; + +intel_plane_copy_uapi_to_hw_state (new_plane_state, new_plane_state, crtc); + + ret =intel_plane_atomic_check_with_state (crtc_state, new_crtc_state, + old_plane_state, new_plane_state); +if (ret) + goto out_free; + + ret =intel_plane_pin_fb (new_plane_state); +if (ret) + goto out_free; + +intel_frontbuffer_flush (to_intel_frontbuffer (new_plane_state->hw.fb), +ORIGIN_FLIP ); +intel_frontbuffer_track (to_intel_frontbuffer (old_plane_state->hw.fb), +to_intel_frontbuffer (new_plane_state->hw.fb), + plane->frontbuffer_bit); + +/* Swap plane state */ + plane->base.state = &new_plane_state->uapi; + +/* +* We cannot swap crtc_state as it may be in use by an atomic commit or +* page flip that's running simultaneously. If we swap crtc_state and +* destroy the old state, we will cause a use-after-free there. +* +* Only update active_planes, which is needed for our internal +* bookkeeping. Either value will do the right thing when updating +* planes atomically. If the cursor was part of the atomic update then +* we would have taken the slowpath. +*/ + crtc_state->active_planes = new_crtc_state->active_planes; + +if (new_plane_state->uapi.visible) +intel_update_plane (plane, crtc_state, new_plane_state); +else +intel_disable_plane (plane, crtc_state); + +intel_plane_unpin_fb (old_plane_state); + +out_free: +if (new_crtc_state) +intel_crtc_destroy_state (&crtc->base, &new_crtc_state->uapi); +if (ret) +intel_plane_destroy_state (&plane->base, &new_plane_state->uapi); +else +intel_plane_destroy_state (&plane->base, &old_plane_state->uapi); +return ret; + +slow: +return drm_atomic_helper_update_plane (&plane->base, &crtc->base, fb, + crtc_x, crtc_y, crtc_w, crtc_h, + src_x, src_y, src_w, src_h, ctx); +} + +static const struct drm_plane_funcs intel_cursor_plane_funcs = { + .update_plane = intel_legacy_cursor_update, + .disable_plane = drm_atomic_helper_disable_plane, + .destroy = intel_plane_destroy, + .atomic_duplicate_state = intel_plane_duplicate_state, + .atomic_destroy_state = intel_plane_destroy_state, + .format_mod_supported = intel_cursor_format_mod_supported, +}; + +struct intel_plane * +intel_cursor_plane_create (struct drm_i915_private *dev_priv, +enum pipe pipe) +{ +struct intel_plane *cursor; +int ret, zpos; + + cursor =intel_plane_alloc (); +if (IS_ERR (cursor)) +return cursor; + + cursor->pipe = pipe; + cursor->i9xx_plane = (enum i9xx_plane_id ) pipe; + cursor->id =PLANE_CURSOR ; + cursor->frontbuffer_bit =INTEL_FRONTBUFFER (pipe, cursor->id); + +if (IS_I845G (dev_priv) ||IS_I865G (dev_priv)) { + cursor->max_stride = i845_cursor_max_stride; + cursor->update_plane = i845_update_cursor; + cursor->disable_plane = i845_disable_cursor; + cursor->get_hw_state = i845_cursor_get_hw_state; + cursor->check_plane = i845_check_cursor; + }else { + cursor->max_stride = i9xx_cursor_max_stride; + cursor->update_plane = i9xx_update_cursor; + cursor->disable_plane = i9xx_disable_cursor; + cursor->get_hw_state = i9xx_cursor_get_hw_state; + cursor->check_plane = i9xx_check_cursor; + } + + cursor->cursor.base = ~0 ; + cursor->cursor.cntl = ~0 ; + +if (IS_I845G (dev_priv) ||IS_I865G (dev_priv) ||HAS_CUR_FBC (dev_priv)) + cursor->cursor.size = ~0 ; + + ret =drm_universal_plane_init (&dev_priv->drm, &cursor->base, +0 , &intel_cursor_plane_funcs, + intel_cursor_formats, +ARRAY_SIZE (intel_cursor_formats), + cursor_format_modifiers, +DRM_PLANE_TYPE_CURSOR , +"cursor %c" ,pipe_name (pipe)); +if (ret) + goto fail; + +if (INTEL_GEN (dev_priv) >=4 ) +drm_plane_create_rotation_property (&cursor->base, +DRM_MODE_ROTATE_0 , +DRM_MODE_ROTATE_0 | +DRM_MODE_ROTATE_180 ); + + zpos =RUNTIME_INFO (dev_priv)->num_sprites[pipe] +1 ; +drm_plane_create_zpos_immutable_property (&cursor->base, zpos); + +if (INTEL_GEN (dev_priv) >=12 ) +drm_plane_enable_fb_damage_clips (&cursor->base); + +drm_plane_helper_add (&cursor->base, &intel_plane_helper_funcs); + +return cursor; + +fail: +intel_plane_free (cursor); + +return ERR_PTR (ret); +}drivers/gpu/drm/i915/display/intel_display.c +6
-790@@ -137,16 +137,6 @@ static const u64 i9xx_format_modifiers[] = {DRM_FORMAT_MOD_INVALID }; -/* Cursor formats */ -static const u32 intel_cursor_formats[] = { -DRM_FORMAT_ARGB8888 , -}; - -static const u64 cursor_format_modifiers[] = { -DRM_FORMAT_MOD_LINEAR , -DRM_FORMAT_MOD_INVALID -}; -static void i9xx_crtc_clock_get (struct intel_crtc *crtc,struct intel_crtc_state *pipe_config); static void ilk_pch_clock_get(struct intel_crtc *crtc,@@ -2528,9 +2518,9 @@ static u32 intel_compute_aligned_offset(struct drm_i915_private *dev_priv,return offset_aligned; } -static u32 intel_plane_compute_aligned_offset (int *x,int *y, -const struct intel_plane_state *state, -int color_plane) +u32 intel_plane_compute_aligned_offset (int *x,int *y, +const struct intel_plane_state *state, +int color_plane) {struct intel_plane *intel_plane =to_intel_plane (state->uapi.plane);struct drm_i915_private *dev_priv =to_i915 (intel_plane->base.dev);@@ -3267,7 +3257,7 @@ intel_plane_remap_gtt(struct intel_plane_state *plane_state) } } -static int +int intel_plane_compute_gtt (struct intel_plane_state *plane_state) { const struct intel_framebuffer *fb =@@ -11536,569 +11526,6 @@ static bool intel_crtc_get_pipe_config(struct intel_crtc_state *crtc_state)return true; } -static u32 intel_cursor_base (const struct intel_plane_state *plane_state) -{ -struct drm_i915_private *dev_priv = -to_i915 (plane_state->uapi.plane->dev); -const struct drm_framebuffer *fb = plane_state->hw.fb; -const struct drm_i915_gem_object *obj =intel_fb_obj (fb); -u32 base; - -if (INTEL_INFO (dev_priv)->display.cursor_needs_physical) - base =sg_dma_address (obj->mm.pages->sgl); -else - base =intel_plane_ggtt_offset (plane_state); - -return base + plane_state->color_plane[0 ].offset; -} - -static u32 intel_cursor_position (const struct intel_plane_state *plane_state) -{ -int x = plane_state->uapi.dst.x1; -int y = plane_state->uapi.dst.y1; -u32 pos =0 ; - -if (x <0 ) { - pos |=CURSOR_POS_SIGN <<CURSOR_X_SHIFT ; - x = -x; - } - pos |= x <<CURSOR_X_SHIFT ; - -if (y <0 ) { - pos |=CURSOR_POS_SIGN <<CURSOR_Y_SHIFT ; - y = -y; - } - pos |= y <<CURSOR_Y_SHIFT ; - -return pos; -} - -static bool intel_cursor_size_ok (const struct intel_plane_state *plane_state) -{ -const struct drm_mode_config *config = - &plane_state->uapi.plane->dev->mode_config; -int width =drm_rect_width (&plane_state->uapi.dst); -int height =drm_rect_height (&plane_state->uapi.dst); - -return width >0 && width <= config->cursor_width && - height >0 && height <= config->cursor_height; -} - -static int intel_cursor_check_surface (struct intel_plane_state *plane_state) -{ -struct drm_i915_private *dev_priv = -to_i915 (plane_state->uapi.plane->dev); -unsigned int rotation = plane_state->hw.rotation; -int src_x, src_y; -u32 offset; -int ret; - - ret =intel_plane_compute_gtt (plane_state); -if (ret) -return ret; - -if (!plane_state->uapi.visible) -return 0 ; - - src_x = plane_state->uapi.src.x1 >>16 ; - src_y = plane_state->uapi.src.y1 >>16 ; - -intel_add_fb_offsets (&src_x, &src_y, plane_state,0 ); - offset =intel_plane_compute_aligned_offset (&src_x, &src_y, - plane_state,0 ); - -if (src_x !=0 || src_y !=0 ) { -drm_dbg_kms (&dev_priv->drm, -"Arbitrary cursor panning not supported\n" ); -return -EINVAL ; - } - -/* -* Put the final coordinates back so that the src -* coordinate checks will see the right values. -*/ -drm_rect_translate_to (&plane_state->uapi.src, - src_x <<16 , src_y <<16 ); - -/* ILK+ do this automagically in hardware */ -if (HAS_GMCH (dev_priv) && rotation &DRM_MODE_ROTATE_180 ) { -const struct drm_framebuffer *fb = plane_state->hw.fb; -int src_w =drm_rect_width (&plane_state->uapi.src) >>16 ; -int src_h =drm_rect_height (&plane_state->uapi.src) >>16 ; - - offset += (src_h * src_w -1 ) * fb->format->cpp[0 ]; - } - - plane_state->color_plane[0 ].offset = offset; - plane_state->color_plane[0 ].x = src_x; - plane_state->color_plane[0 ].y = src_y; - -return 0 ; -} - -static int intel_check_cursor (struct intel_crtc_state *crtc_state, -struct intel_plane_state *plane_state) -{ -const struct drm_framebuffer *fb = plane_state->hw.fb; -struct drm_i915_private *i915 =to_i915 (plane_state->uapi.plane->dev); -const struct drm_rect src = plane_state->uapi.src; -const struct drm_rect dst = plane_state->uapi.dst; -int ret; - -if (fb && fb->modifier !=DRM_FORMAT_MOD_LINEAR ) { -drm_dbg_kms (&i915->drm,"cursor cannot be tiled\n" ); -return -EINVAL ; - } - - ret =intel_atomic_plane_check_clipping (plane_state, crtc_state, -DRM_PLANE_HELPER_NO_SCALING , -DRM_PLANE_HELPER_NO_SCALING , - true); -if (ret) -return ret; - -/* Use the unclipped src/dst rectangles, which we program to hw */ - plane_state->uapi.src = src; - plane_state->uapi.dst = dst; - - ret =intel_cursor_check_surface (plane_state); -if (ret) -return ret; - -if (!plane_state->uapi.visible) -return 0 ; - - ret =intel_plane_check_src_coordinates (plane_state); -if (ret) -return ret; - -return 0 ; -} - -static unsigned int -i845_cursor_max_stride (struct intel_plane *plane, -u32 pixel_format,u64 modifier, -unsigned int rotation) -{ -return 2048 ; -} - -static u32 i845_cursor_ctl_crtc (const struct intel_crtc_state *crtc_state) -{ -u32 cntl =0 ; - -if (crtc_state->gamma_enable) - cntl |=CURSOR_GAMMA_ENABLE ; - -return cntl; -} - -static u32 i845_cursor_ctl (const struct intel_crtc_state *crtc_state, -const struct intel_plane_state *plane_state) -{ -return CURSOR_ENABLE | -CURSOR_FORMAT_ARGB | -CURSOR_STRIDE (plane_state->color_plane[0 ].stride); -} - -static bool i845_cursor_size_ok (const struct intel_plane_state *plane_state) -{ -int width =drm_rect_width (&plane_state->uapi.dst); - -/* -* 845g/865g are only limited by the width of their cursors, -* the height is arbitrary up to the precision of the register. -*/ -return intel_cursor_size_ok (plane_state) &&IS_ALIGNED (width,64 ); -} - -static int i845_check_cursor (struct intel_crtc_state *crtc_state, -struct intel_plane_state *plane_state) -{ -const struct drm_framebuffer *fb = plane_state->hw.fb; -struct drm_i915_private *i915 =to_i915 (plane_state->uapi.plane->dev); -int ret; - - ret =intel_check_cursor (crtc_state, plane_state); -if (ret) -return ret; - -/* if we want to turn off the cursor ignore width and height */ -if (!fb) -return 0 ; - -/* Check for which cursor types we support */ -if (!i845_cursor_size_ok (plane_state)) { -drm_dbg_kms (&i915->drm, -"Cursor dimension %dx%d not supported\n" , -drm_rect_width (&plane_state->uapi.dst), -drm_rect_height (&plane_state->uapi.dst)); -return -EINVAL ; - } - -drm_WARN_ON (&i915->drm, plane_state->uapi.visible && - plane_state->color_plane[0 ].stride != fb->pitches[0 ]); - -switch (fb->pitches[0 ]) { -case 256 : -case 512 : -case 1024 : -case 2048 : -break ; -default : -drm_dbg_kms (&i915->drm,"Invalid cursor stride (%u)\n" , - fb->pitches[0 ]); -return -EINVAL ; - } - - plane_state->ctl =i845_cursor_ctl (crtc_state, plane_state); - -return 0 ; -} - -static void i845_update_cursor (struct intel_plane *plane, -const struct intel_crtc_state *crtc_state, -const struct intel_plane_state *plane_state) -{ -struct drm_i915_private *dev_priv =to_i915 (plane->base.dev); -u32 cntl =0 , base =0 , pos =0 , size =0 ; -unsigned long irqflags; - -if (plane_state && plane_state->uapi.visible) { -unsigned int width =drm_rect_width (&plane_state->uapi.dst); -unsigned int height =drm_rect_height (&plane_state->uapi.dst); - - cntl = plane_state->ctl | -i845_cursor_ctl_crtc (crtc_state); - - size = (height <<12 ) | width; - - base =intel_cursor_base (plane_state); - pos =intel_cursor_position (plane_state); - } - -spin_lock_irqsave (&dev_priv->uncore.lock, irqflags); - -/* On these chipsets we can only modify the base/size/stride -* whilst the cursor is disabled. -*/ -if (plane->cursor.base != base || - plane->cursor.size != size || - plane->cursor.cntl != cntl) { -intel_de_write_fw (dev_priv,CURCNTR (PIPE_A ),0 ); -intel_de_write_fw (dev_priv,CURBASE (PIPE_A ), base); -intel_de_write_fw (dev_priv,CURSIZE , size); -intel_de_write_fw (dev_priv,CURPOS (PIPE_A ), pos); -intel_de_write_fw (dev_priv,CURCNTR (PIPE_A ), cntl); - - plane->cursor.base = base; - plane->cursor.size = size; - plane->cursor.cntl = cntl; - }else { -intel_de_write_fw (dev_priv,CURPOS (PIPE_A ), pos); - } - -spin_unlock_irqrestore (&dev_priv->uncore.lock, irqflags); -} - -static void i845_disable_cursor (struct intel_plane *plane, -const struct intel_crtc_state *crtc_state) -{ -i845_update_cursor (plane, crtc_state,NULL ); -} - -static bool i845_cursor_get_hw_state (struct intel_plane *plane, -enum pipe *pipe) -{ -struct drm_i915_private *dev_priv =to_i915 (plane->base.dev); -enum intel_display_power_domain power_domain; -intel_wakeref_t wakeref; -bool ret; - - power_domain =POWER_DOMAIN_PIPE (PIPE_A ); - wakeref =intel_display_power_get_if_enabled (dev_priv, power_domain); -if (!wakeref) -return false; - - ret =intel_de_read (dev_priv,CURCNTR (PIPE_A )) &CURSOR_ENABLE ; - - *pipe =PIPE_A ; - -intel_display_power_put (dev_priv, power_domain, wakeref); - -return ret; -} - -static unsigned int -i9xx_cursor_max_stride (struct intel_plane *plane, -u32 pixel_format,u64 modifier, -unsigned int rotation) -{ -return plane->base.dev->mode_config.cursor_width *4 ; -} - -static u32 i9xx_cursor_ctl_crtc (const struct intel_crtc_state *crtc_state) -{ -struct intel_crtc *crtc =to_intel_crtc (crtc_state->uapi.crtc); -struct drm_i915_private *dev_priv =to_i915 (crtc->base.dev); -u32 cntl =0 ; - -if (INTEL_GEN (dev_priv) >=11 ) -return cntl; - -if (crtc_state->gamma_enable) - cntl =MCURSOR_GAMMA_ENABLE ; - -if (crtc_state->csc_enable) - cntl |=MCURSOR_PIPE_CSC_ENABLE ; - -if (INTEL_GEN (dev_priv) <5 && !IS_G4X (dev_priv)) - cntl |=MCURSOR_PIPE_SELECT (crtc->pipe); - -return cntl; -} - -static u32 i9xx_cursor_ctl (const struct intel_crtc_state *crtc_state, -const struct intel_plane_state *plane_state) -{ -struct drm_i915_private *dev_priv = -to_i915 (plane_state->uapi.plane->dev); -u32 cntl =0 ; - -if (IS_GEN (dev_priv,6 ) ||IS_IVYBRIDGE (dev_priv)) - cntl |=MCURSOR_TRICKLE_FEED_DISABLE ; - -switch (drm_rect_width (&plane_state->uapi.dst)) { -case 64 : - cntl |=MCURSOR_MODE_64_ARGB_AX ; -break ; -case 128 : - cntl |=MCURSOR_MODE_128_ARGB_AX ; -break ; -case 256 : - cntl |=MCURSOR_MODE_256_ARGB_AX ; -break ; -default : -MISSING_CASE (drm_rect_width (&plane_state->uapi.dst)); -return 0 ; - } - -if (plane_state->hw.rotation &DRM_MODE_ROTATE_180 ) - cntl |=MCURSOR_ROTATE_180 ; - -return cntl; -} - -static bool i9xx_cursor_size_ok (const struct intel_plane_state *plane_state) -{ -struct drm_i915_private *dev_priv = -to_i915 (plane_state->uapi.plane->dev); -int width =drm_rect_width (&plane_state->uapi.dst); -int height =drm_rect_height (&plane_state->uapi.dst); - -if (!intel_cursor_size_ok (plane_state)) -return false; - -/* Cursor width is limited to a few power-of-two sizes */ -switch (width) { -case 256 : -case 128 : -case 64 : -break ; -default : -return false; - } - -/* -* IVB+ have CUR_FBC_CTL which allows an arbitrary cursor -* height from 8 lines up to the cursor width, when the -* cursor is not rotated. Everything else requires square -* cursors. -*/ -if (HAS_CUR_FBC (dev_priv) && - plane_state->hw.rotation &DRM_MODE_ROTATE_0 ) { -if (height <8 || height > width) -return false; - }else { -if (height != width) -return false; - } - -return true; -} - -static int i9xx_check_cursor (struct intel_crtc_state *crtc_state, -struct intel_plane_state *plane_state) -{ -struct intel_plane *plane =to_intel_plane (plane_state->uapi.plane); -struct drm_i915_private *dev_priv =to_i915 (plane->base.dev); -const struct drm_framebuffer *fb = plane_state->hw.fb; -enum pipe pipe = plane->pipe; -int ret; - - ret =intel_check_cursor (crtc_state, plane_state); -if (ret) -return ret; - -/* if we want to turn off the cursor ignore width and height */ -if (!fb) -return 0 ; - -/* Check for which cursor types we support */ -if (!i9xx_cursor_size_ok (plane_state)) { -drm_dbg (&dev_priv->drm, -"Cursor dimension %dx%d not supported\n" , -drm_rect_width (&plane_state->uapi.dst), -drm_rect_height (&plane_state->uapi.dst)); -return -EINVAL ; - } - -drm_WARN_ON (&dev_priv->drm, plane_state->uapi.visible && - plane_state->color_plane[0 ].stride != fb->pitches[0 ]); - -if (fb->pitches[0 ] != -drm_rect_width (&plane_state->uapi.dst) * fb->format->cpp[0 ]) { -drm_dbg_kms (&dev_priv->drm, -"Invalid cursor stride (%u) (cursor width %d)\n" , - fb->pitches[0 ], -drm_rect_width (&plane_state->uapi.dst)); -return -EINVAL ; - } - -/* -* There's something wrong with the cursor on CHV pipe C. -* If it straddles the left edge of the screen then -* moving it away from the edge or disabling it often -* results in a pipe underrun, and often that can lead to -* dead pipe (constant underrun reported, and it scans -* out just a solid color). To recover from that, the -* display power well must be turned off and on again. -* Refuse the put the cursor into that compromised position. -*/ -if (IS_CHERRYVIEW (dev_priv) && pipe ==PIPE_C && - plane_state->uapi.visible && plane_state->uapi.dst.x1 <0 ) { -drm_dbg_kms (&dev_priv->drm, -"CHV cursor C not allowed to straddle the left screen edge\n" ); -return -EINVAL ; - } - - plane_state->ctl =i9xx_cursor_ctl (crtc_state, plane_state); - -return 0 ; -} - -static void i9xx_update_cursor (struct intel_plane *plane, -const struct intel_crtc_state *crtc_state, -const struct intel_plane_state *plane_state) -{ -struct drm_i915_private *dev_priv =to_i915 (plane->base.dev); -enum pipe pipe = plane->pipe; -u32 cntl =0 , base =0 , pos =0 , fbc_ctl =0 ; -unsigned long irqflags; - -if (plane_state && plane_state->uapi.visible) { -unsigned width =drm_rect_width (&plane_state->uapi.dst); -unsigned height =drm_rect_height (&plane_state->uapi.dst); - - cntl = plane_state->ctl | -i9xx_cursor_ctl_crtc (crtc_state); - -if (width != height) - fbc_ctl =CUR_FBC_CTL_EN | (height -1 ); - - base =intel_cursor_base (plane_state); - pos =intel_cursor_position (plane_state); - } - -spin_lock_irqsave (&dev_priv->uncore.lock, irqflags); - -/* -* On some platforms writing CURCNTR first will also -* cause CURPOS to be armed by the CURBASE write. -* Without the CURCNTR write the CURPOS write would -* arm itself. Thus we always update CURCNTR before -* CURPOS. -* -* On other platforms CURPOS always requires the -* CURBASE write to arm the update. Additonally -* a write to any of the cursor register will cancel -* an already armed cursor update. Thus leaving out -* the CURBASE write after CURPOS could lead to a -* cursor that doesn't appear to move, or even change -* shape. Thus we always write CURBASE. -* -* The other registers are armed by by the CURBASE write -* except when the plane is getting enabled at which time -* the CURCNTR write arms the update. -*/ - -if (INTEL_GEN (dev_priv) >=9 ) -skl_write_cursor_wm (plane, crtc_state); - -if (!intel_crtc_needs_modeset (crtc_state)) -intel_psr2_program_plane_sel_fetch (plane, crtc_state, plane_state,0 ); - -if (plane->cursor.base != base || - plane->cursor.size != fbc_ctl || - plane->cursor.cntl != cntl) { -if (HAS_CUR_FBC (dev_priv)) -intel_de_write_fw (dev_priv,CUR_FBC_CTL (pipe), - fbc_ctl); -intel_de_write_fw (dev_priv,CURCNTR (pipe), cntl); -intel_de_write_fw (dev_priv,CURPOS (pipe), pos); -intel_de_write_fw (dev_priv,CURBASE (pipe), base); - - plane->cursor.base = base; - plane->cursor.size = fbc_ctl; - plane->cursor.cntl = cntl; - }else { -intel_de_write_fw (dev_priv,CURPOS (pipe), pos); -intel_de_write_fw (dev_priv,CURBASE (pipe), base); - } - -spin_unlock_irqrestore (&dev_priv->uncore.lock, irqflags); -} - -static void i9xx_disable_cursor (struct intel_plane *plane, -const struct intel_crtc_state *crtc_state) -{ -i9xx_update_cursor (plane, crtc_state,NULL ); -} - -static bool i9xx_cursor_get_hw_state (struct intel_plane *plane, -enum pipe *pipe) -{ -struct drm_i915_private *dev_priv =to_i915 (plane->base.dev); -enum intel_display_power_domain power_domain; -intel_wakeref_t wakeref; -bool ret; -u32 val; - -/* -* Not 100% correct for planes that can move between pipes, -* but that's only the case for gen2-3 which don't have any -* display power wells. -*/ - power_domain =POWER_DOMAIN_PIPE (plane->pipe); - wakeref =intel_display_power_get_if_enabled (dev_priv, power_domain); -if (!wakeref) -return false; - - val =intel_de_read (dev_priv,CURCNTR (plane->pipe)); - - ret = val &MCURSOR_MODE ; - -if (INTEL_GEN (dev_priv) >=5 ||IS_G4X (dev_priv)) - *pipe = plane->pipe; -else - *pipe = (val &MCURSOR_PIPE_SELECT_MASK ) >> -MCURSOR_PIPE_SELECT_SHIFT ; - -intel_display_power_put (dev_priv, power_domain, wakeref); - -return ret; -} -/* VESA 640x480x72Hz mode to set on the pipe */ static const struct drm_display_mode load_detect_mode = { DRM_MODE("640x480", DRM_MODE_TYPE_DEFAULT, 31500, 640, 664,@@ -16609,7 +16036,7 @@ static void add_rps_boost_after_vblank(struct drm_crtc *crtc,add_wait_queue (drm_crtc_vblank_waitqueue (crtc), &wait->wait); } -static int intel_plane_pin_fb (struct intel_plane_state *plane_state) +int intel_plane_pin_fb (struct intel_plane_state *plane_state) {struct intel_plane *plane =to_intel_plane (plane_state->uapi.plane);struct drm_i915_private *dev_priv =to_i915 (plane->base.dev);@@ -16639,7 +16066,7 @@ static int intel_plane_pin_fb(struct intel_plane_state *plane_state)return 0 ; } -static void intel_plane_unpin_fb (struct intel_plane_state *old_plane_state) +void intel_plane_unpin_fb (struct intel_plane_state *old_plane_state) {struct i915_vma *vma;@@ -16875,13 +16302,6 @@ static bool i965_plane_format_mod_supported(struct drm_plane *_plane, } } -static bool intel_cursor_format_mod_supported (struct drm_plane *_plane, -u32 format,u64 modifier) -{ -return modifier ==DRM_FORMAT_MOD_LINEAR && - format ==DRM_FORMAT_ARGB8888 ; -} -static const struct drm_plane_funcs i965_plane_funcs = { .update_plane = drm_atomic_helper_update_plane, .disable_plane = drm_atomic_helper_disable_plane,@@ -16900,142 +16320,6 @@ static const struct drm_plane_funcs i8xx_plane_funcs = { .format_mod_supported = i8xx_plane_format_mod_supported, }; -static int -intel_legacy_cursor_update (struct drm_plane *_plane, -struct drm_crtc *_crtc, -struct drm_framebuffer *fb, -int crtc_x,int crtc_y, -unsigned int crtc_w,unsigned int crtc_h, -u32 src_x,u32 src_y, -u32 src_w,u32 src_h, -struct drm_modeset_acquire_ctx *ctx) -{ -struct intel_plane *plane =to_intel_plane (_plane); -struct intel_crtc *crtc =to_intel_crtc (_crtc); -struct intel_plane_state *old_plane_state = -to_intel_plane_state (plane->base.state); -struct intel_plane_state *new_plane_state; -struct intel_crtc_state *crtc_state = -to_intel_crtc_state (crtc->base.state); -struct intel_crtc_state *new_crtc_state; -int ret; - -/* -* When crtc is inactive or there is a modeset pending, -* wait for it to complete in the slowpath -* -* FIXME bigjoiner fastpath would be good -*/ -if (!crtc_state->hw.active ||intel_crtc_needs_modeset (crtc_state) || - crtc_state->update_pipe || crtc_state->bigjoiner) - goto slow; - -/* -* Don't do an async update if there is an outstanding commit modifying -* the plane. This prevents our async update's changes from getting -* overridden by a previous synchronous update's state. -*/ -if (old_plane_state->uapi.commit && - !try_wait_for_completion (&old_plane_state->uapi.commit->hw_done)) - goto slow; - -/* -* If any parameters change that may affect watermarks, -* take the slowpath. Only changing fb or position should be -* in the fastpath. -*/ -if (old_plane_state->uapi.crtc != &crtc->base || - old_plane_state->uapi.src_w != src_w || - old_plane_state->uapi.src_h != src_h || - old_plane_state->uapi.crtc_w != crtc_w || - old_plane_state->uapi.crtc_h != crtc_h || - !old_plane_state->uapi.fb != !fb) - goto slow; - - new_plane_state =to_intel_plane_state (intel_plane_duplicate_state (&plane->base)); -if (!new_plane_state) -return -ENOMEM ; - - new_crtc_state =to_intel_crtc_state (intel_crtc_duplicate_state (&crtc->base)); -if (!new_crtc_state) { - ret = -ENOMEM ; - goto out_free; - } - -drm_atomic_set_fb_for_plane (&new_plane_state->uapi, fb); - - new_plane_state->uapi.src_x = src_x; - new_plane_state->uapi.src_y = src_y; - new_plane_state->uapi.src_w = src_w; - new_plane_state->uapi.src_h = src_h; - new_plane_state->uapi.crtc_x = crtc_x; - new_plane_state->uapi.crtc_y = crtc_y; - new_plane_state->uapi.crtc_w = crtc_w; - new_plane_state->uapi.crtc_h = crtc_h; - -intel_plane_copy_uapi_to_hw_state (new_plane_state, new_plane_state, crtc); - - ret =intel_plane_atomic_check_with_state (crtc_state, new_crtc_state, - old_plane_state, new_plane_state); -if (ret) - goto out_free; - - ret =intel_plane_pin_fb (new_plane_state); -if (ret) - goto out_free; - -intel_frontbuffer_flush (to_intel_frontbuffer (new_plane_state->hw.fb), -ORIGIN_FLIP ); -intel_frontbuffer_track (to_intel_frontbuffer (old_plane_state->hw.fb), -to_intel_frontbuffer (new_plane_state->hw.fb), - plane->frontbuffer_bit); - -/* Swap plane state */ - plane->base.state = &new_plane_state->uapi; - -/* -* We cannot swap crtc_state as it may be in use by an atomic commit or -* page flip that's running simultaneously. If we swap crtc_state and -* destroy the old state, we will cause a use-after-free there. -* -* Only update active_planes, which is needed for our internal -* bookkeeping. Either value will do the right thing when updating -* planes atomically. If the cursor was part of the atomic update then -* we would have taken the slowpath. -*/ - crtc_state->active_planes = new_crtc_state->active_planes; - -if (new_plane_state->uapi.visible) -intel_update_plane (plane, crtc_state, new_plane_state); -else -intel_disable_plane (plane, crtc_state); - -intel_plane_unpin_fb (old_plane_state); - -out_free: -if (new_crtc_state) -intel_crtc_destroy_state (&crtc->base, &new_crtc_state->uapi); -if (ret) -intel_plane_destroy_state (&plane->base, &new_plane_state->uapi); -else -intel_plane_destroy_state (&plane->base, &old_plane_state->uapi); -return ret; - -slow: -return drm_atomic_helper_update_plane (&plane->base, &crtc->base, fb, - crtc_x, crtc_y, crtc_w, crtc_h, - src_x, src_y, src_w, src_h, ctx); -} - -static const struct drm_plane_funcs intel_cursor_plane_funcs = { - .update_plane = intel_legacy_cursor_update, - .disable_plane = drm_atomic_helper_disable_plane, - .destroy = intel_plane_destroy, - .atomic_duplicate_state = intel_plane_duplicate_state, - .atomic_destroy_state = intel_plane_destroy_state, - .format_mod_supported = intel_cursor_format_mod_supported, -}; -static bool i9xx_plane_has_fbc (struct drm_i915_private *dev_priv,enum i9xx_plane_id i9xx_plane) {@@ -17187,74 +16471,6 @@ intel_primary_plane_create(struct drm_i915_private *dev_priv, enum pipe pipe)return ERR_PTR (ret); } -static struct intel_plane * -intel_cursor_plane_create (struct drm_i915_private *dev_priv, -enum pipe pipe) -{ -struct intel_plane *cursor; -int ret, zpos; - - cursor =intel_plane_alloc (); -if (IS_ERR (cursor)) -return cursor; - - cursor->pipe = pipe; - cursor->i9xx_plane = (enum i9xx_plane_id ) pipe; - cursor->id =PLANE_CURSOR ; - cursor->frontbuffer_bit =INTEL_FRONTBUFFER (pipe, cursor->id); - -if (IS_I845G (dev_priv) ||IS_I865G (dev_priv)) { - cursor->max_stride = i845_cursor_max_stride; - cursor->update_plane = i845_update_cursor; - cursor->disable_plane = i845_disable_cursor; - cursor->get_hw_state = i845_cursor_get_hw_state; - cursor->check_plane = i845_check_cursor; - }else { - cursor->max_stride = i9xx_cursor_max_stride; - cursor->update_plane = i9xx_update_cursor; - cursor->disable_plane = i9xx_disable_cursor; - cursor->get_hw_state = i9xx_cursor_get_hw_state; - cursor->check_plane = i9xx_check_cursor; - } - - cursor->cursor.base = ~0 ; - cursor->cursor.cntl = ~0 ; - -if (IS_I845G (dev_priv) ||IS_I865G (dev_priv) ||HAS_CUR_FBC (dev_priv)) - cursor->cursor.size = ~0 ; - - ret =drm_universal_plane_init (&dev_priv->drm, &cursor->base, -0 , &intel_cursor_plane_funcs, - intel_cursor_formats, -ARRAY_SIZE (intel_cursor_formats), - cursor_format_modifiers, -DRM_PLANE_TYPE_CURSOR , -"cursor %c" ,pipe_name (pipe)); -if (ret) - goto fail; - -if (INTEL_GEN (dev_priv) >=4 ) -drm_plane_create_rotation_property (&cursor->base, -DRM_MODE_ROTATE_0 , -DRM_MODE_ROTATE_0 | -DRM_MODE_ROTATE_180 ); - - zpos =RUNTIME_INFO (dev_priv)->num_sprites[pipe] +1 ; -drm_plane_create_zpos_immutable_property (&cursor->base, zpos); - -if (INTEL_GEN (dev_priv) >=12 ) -drm_plane_enable_fb_damage_clips (&cursor->base); - -drm_plane_helper_add (&cursor->base, &intel_plane_helper_funcs); - -return cursor; - -fail: -intel_plane_free (cursor); - -return ERR_PTR (ret); -} -static int intel_crtc_late_register (struct drm_crtc *crtc) {intel_crtc_debugfs_add (crtc);drivers/gpu/drm/i915/display/intel_display.h +12
-1@@ -647,6 +647,18 @@ bool intel_format_info_is_yuv_semiplanar(const struct drm_format_info *info, uint64_t modifier); +int intel_plane_compute_gtt (struct intel_plane_state *plane_state); +u32 intel_plane_compute_aligned_offset (int *x,int *y, +const struct intel_plane_state *state, +int color_plane); +int intel_plane_pin_fb (struct intel_plane_state *plane_state); +void intel_plane_unpin_fb (struct intel_plane_state *old_plane_state); + +/* cursor */ +struct intel_plane * +intel_cursor_plane_create (struct drm_i915_private *dev_priv, +enum pipe pipe); +/* modesetting */ void intel_modeset_init_hw (struct drm_i915_private *i915);int intel_modeset_init_noirq (struct drm_i915_private *i915); --2.27.0
Quoted 4 lines
Quoted 4 lines
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx--
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Dave Airlie
maintainerPATCH 5/9 drm/i915: refactor some crtc code out of intel display.
In reply to Dave AirlieFrom: Dave Airlie <[email protected]>
There may be more crtc code that can be pulled out, but this is a good start.
RFC: maybe call the new file something different
--- drivers/gpu/drm/i915/Makefile | 1 + drivers/gpu/drm/i915/display/intel_crtc.c | 951 +++++++++++++++++++ drivers/gpu/drm/i915/display/intel_display.c | 932 ------------------ drivers/gpu/drm/i915/display/intel_display.h | 7 + 4 files changed, 959 insertions(+), 932 deletions(-) create mode 100644 drivers/gpu/drm/i915/display/intel_crtc.c
drivers/gpu/drm/i915/Makefile +1 -0
@@ -196,6 +196,7 @@ i915-y += \ display/intel_color.o \ display/intel_combo_phy.o \ display/intel_connector.o \ + display/intel_crtc.o \ display/intel_csr.o \ display/intel_cursor.o \ display/intel_display.o \
drivers/gpu/drm/i915/display/intel_crtc.c new file +951 -0
951 lines not on this page · raw message
drivers/gpu/drm/i915/display/intel_display.c +0 -932
998 lines not on this page · raw message
drivers/gpu/drm/i915/display/intel_display.h +7 -0
@@ -659,6 +659,13 @@ struct intel_plane * intel_cursor_plane_create(struct drm_i915_private *dev_priv, enum pipe pipe); +/* crtc */ +u32 intel_crtc_max_vblank_count (const struct intel_crtc_state *crtc_state); +int intel_crtc_init (struct drm_i915_private *dev_priv,enum pipe pipe); +struct intel_crtc_state *intel_crtc_state_alloc (struct intel_crtc *crtc); +void intel_crtc_state_reset (struct intel_crtc_state *crtc_state, +struct intel_crtc *crtc); +/* modesetting */ void intel_modeset_init_hw (struct drm_i915_private *i915);int intel_modeset_init_noirq (struct drm_i915_private *i915);
Signature · 6 lines
2.27.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH 5/9] drm/i915: refactor some crtc code out of intel display.
Quoted 4 lines · Dave Airlie
From: Dave Airlie <[email protected]>
There may be more crtc code that can be pulled out, but this is a good start.
a>
Quoted 1 line
RFC: maybe call the new file something different
Most of that seems to be the primary plane code.
What I would so is:
* i9xx_plane.c for all pre-skl plane code
* skl_universal_plane.c for the skl+ plane code
* non-platform specific plane code probably should go to intel_atomic_plane.c which could perhaps use a rename to just intel_plane.c
Quoted 2,017 lines
Signed-off-by Dave Airlie <[email protected]>--- drivers/gpu/drm/i915/Makefile | 1 + drivers/gpu/drm/i915/display/intel_crtc.c | 951 +++++++++++++++++++ drivers/gpu/drm/i915/display/intel_display.c | 932 ------------------ drivers/gpu/drm/i915/display/intel_display.h | 7 + 4 files changed, 959 insertions(+), 932 deletions(-) create mode 100644 drivers/gpu/drm/i915/display/intel_crtc.cdrivers/gpu/drm/i915/Makefile +1
-0@@ -196,6 +196,7 @@ i915-y += \ display/intel_color.o \ display/intel_combo_phy.o \ display/intel_connector.o \ + display/intel_crtc.o \ display/intel_csr.o \ display/intel_cursor.o \ display/intel_display.o \drivers/gpu/drm/i915/display/intel_crtc.c new file +951
-0@@ -0,0 +1,951 @@ +// SPDX-License-Identifier: MIT +/* +* Copyright © 2020 Intel Corporation +*/ +#include <linux/kernel.h> +#include <linux/slab.h> + +#include <drm/drm_atomic_helper.h> +#include <drm/drm_fourcc.h> +#include <drm/drm_plane.h> +#include <drm/drm_plane_helper.h> + +#include "intel_atomic.h" +#include "intel_atomic_plane.h" +#include "intel_color.h" +#include "intel_display_debugfs.h" +#include "intel_display_types.h" +#include "intel_pipe_crc.h" +#include "intel_sprite.h" + +/* Primary plane formats for gen <= 3 */ +static const u32 i8xx_primary_formats[] = { +DRM_FORMAT_C8 , +DRM_FORMAT_XRGB1555 , +DRM_FORMAT_RGB565 , +DRM_FORMAT_XRGB8888 , +}; + +/* Primary plane formats for ivb (no fp16 due to hw issue) */ +static const u32 ivb_primary_formats[] = { +DRM_FORMAT_C8 , +DRM_FORMAT_RGB565 , +DRM_FORMAT_XRGB8888 , +DRM_FORMAT_XBGR8888 , +DRM_FORMAT_XRGB2101010 , +DRM_FORMAT_XBGR2101010 , +}; + +/* Primary plane formats for gen >= 4, except ivb */ +static const u32 i965_primary_formats[] = { +DRM_FORMAT_C8 , +DRM_FORMAT_RGB565 , +DRM_FORMAT_XRGB8888 , +DRM_FORMAT_XBGR8888 , +DRM_FORMAT_XRGB2101010 , +DRM_FORMAT_XBGR2101010 , +DRM_FORMAT_XBGR16161616F , +}; + +/* Primary plane formats for vlv/chv */ +static const u32 vlv_primary_formats[] = { +DRM_FORMAT_C8 , +DRM_FORMAT_RGB565 , +DRM_FORMAT_XRGB8888 , +DRM_FORMAT_XBGR8888 , +DRM_FORMAT_ARGB8888 , +DRM_FORMAT_ABGR8888 , +DRM_FORMAT_XRGB2101010 , +DRM_FORMAT_XBGR2101010 , +DRM_FORMAT_ARGB2101010 , +DRM_FORMAT_ABGR2101010 , +DRM_FORMAT_XBGR16161616F , +}; + +static const u64 i9xx_format_modifiers[] = { +I915_FORMAT_MOD_X_TILED , +DRM_FORMAT_MOD_LINEAR , +DRM_FORMAT_MOD_INVALID +}; + +static bool i8xx_plane_format_mod_supported (struct drm_plane *_plane, +u32 format,u64 modifier) +{ +switch (modifier) { +case DRM_FORMAT_MOD_LINEAR : +case I915_FORMAT_MOD_X_TILED : +break ; +default : +return false; + } + +switch (format) { +case DRM_FORMAT_C8 : +case DRM_FORMAT_RGB565 : +case DRM_FORMAT_XRGB1555 : +case DRM_FORMAT_XRGB8888 : +return modifier ==DRM_FORMAT_MOD_LINEAR || + modifier ==I915_FORMAT_MOD_X_TILED ; +default : +return false; + } +} + +static bool i965_plane_format_mod_supported (struct drm_plane *_plane, +u32 format,u64 modifier) +{ +switch (modifier) { +case DRM_FORMAT_MOD_LINEAR : +case I915_FORMAT_MOD_X_TILED : +break ; +default : +return false; + } + +switch (format) { +case DRM_FORMAT_C8 : +case DRM_FORMAT_RGB565 : +case DRM_FORMAT_XRGB8888 : +case DRM_FORMAT_XBGR8888 : +case DRM_FORMAT_ARGB8888 : +case DRM_FORMAT_ABGR8888 : +case DRM_FORMAT_XRGB2101010 : +case DRM_FORMAT_XBGR2101010 : +case DRM_FORMAT_ARGB2101010 : +case DRM_FORMAT_ABGR2101010 : +case DRM_FORMAT_XBGR16161616F : +return modifier ==DRM_FORMAT_MOD_LINEAR || + modifier ==I915_FORMAT_MOD_X_TILED ; +default : +return false; + } +} + +static bool i9xx_plane_has_fbc (struct drm_i915_private *dev_priv, +enum i9xx_plane_id i9xx_plane) +{ +if (!HAS_FBC (dev_priv)) +return false; + +if (IS_BROADWELL (dev_priv) ||IS_HASWELL (dev_priv)) +return i9xx_plane ==PLANE_A ;/* tied to pipe A */ +else if (IS_IVYBRIDGE (dev_priv)) +return i9xx_plane ==PLANE_A || i9xx_plane ==PLANE_B || + i9xx_plane ==PLANE_C ; +else if (INTEL_GEN (dev_priv) >=4 ) +return i9xx_plane ==PLANE_A || i9xx_plane ==PLANE_B ; +else +return i9xx_plane ==PLANE_A ; +} + +static void assert_vblank_disabled (struct drm_crtc *crtc) +{ +if (I915_STATE_WARN_ON (drm_crtc_vblank_get (crtc) ==0 )) +drm_crtc_vblank_put (crtc); +} + +u32 intel_crtc_get_vblank_counter (struct intel_crtc *crtc) +{ +struct drm_device *dev = crtc->base.dev; +struct drm_vblank_crtc *vblank = &dev->vblank[drm_crtc_index (&crtc->base)]; + +if (!vblank->max_vblank_count) +return (u32 )drm_crtc_accurate_vblank_count (&crtc->base); + +return crtc->base.funcs->get_vblank_counter (&crtc->base); +} + +u32 intel_crtc_max_vblank_count (const struct intel_crtc_state *crtc_state) +{ +struct drm_i915_private *dev_priv =to_i915 (crtc_state->uapi.crtc->dev); +struct intel_crtc *crtc =to_intel_crtc (crtc_state->uapi.crtc); +u32 mode_flags = crtc->mode_flags; + +/* +* From Gen 11, In case of dsi cmd mode, frame counter wouldnt +* have updated at the beginning of TE, if we want to use +* the hw counter, then we would find it updated in only +* the next TE, hence switching to sw counter. +*/ +if (mode_flags & (I915_MODE_FLAG_DSI_USE_TE0 |I915_MODE_FLAG_DSI_USE_TE1 )) +return 0 ; + +/* +* On i965gm the hardware frame counter reads +* zero when the TV encoder is enabled :( +*/ +if (IS_I965GM (dev_priv) && + (crtc_state->output_types &BIT (INTEL_OUTPUT_TVOUT ))) +return 0 ; + +if (INTEL_GEN (dev_priv) >=5 ||IS_G4X (dev_priv)) +return 0xffffffff ;/* full 32 bit counter */ +else if (INTEL_GEN (dev_priv) >=3 ) +return 0xffffff ;/* only 24 bits of frame count */ +else +return 0 ;/* Gen2 doesn't have a hardware frame counter */ +} + +void intel_crtc_vblank_on (const struct intel_crtc_state *crtc_state) +{ +struct intel_crtc *crtc =to_intel_crtc (crtc_state->uapi.crtc); + +assert_vblank_disabled (&crtc->base); +drm_crtc_set_max_vblank_count (&crtc->base, +intel_crtc_max_vblank_count (crtc_state)); +drm_crtc_vblank_on (&crtc->base); +} + +void intel_crtc_vblank_off (const struct intel_crtc_state *crtc_state) +{ +struct intel_crtc *crtc =to_intel_crtc (crtc_state->uapi.crtc); + +drm_crtc_vblank_off (&crtc->base); +assert_vblank_disabled (&crtc->base); +} + +struct intel_crtc_state *intel_crtc_state_alloc (struct intel_crtc *crtc) +{ +struct intel_crtc_state *crtc_state; + + crtc_state =kmalloc (sizeof (*crtc_state),GFP_KERNEL ); + +if (crtc_state) +intel_crtc_state_reset (crtc_state, crtc); + +return crtc_state; +} + +void intel_crtc_state_reset (struct intel_crtc_state *crtc_state, +struct intel_crtc *crtc) +{ +memset (crtc_state,0 ,sizeof (*crtc_state)); + +__drm_atomic_helper_crtc_state_reset (&crtc_state->uapi, &crtc->base); + + crtc_state->cpu_transcoder =INVALID_TRANSCODER ; + crtc_state->master_transcoder =INVALID_TRANSCODER ; + crtc_state->hsw_workaround_pipe =INVALID_PIPE ; + crtc_state->output_format =INTEL_OUTPUT_FORMAT_INVALID ; + crtc_state->scaler_state.scaler_id =-1 ; + crtc_state->mst_master_transcoder =INVALID_TRANSCODER ; +} + +static bool i9xx_plane_has_windowing (struct intel_plane *plane) +{ +struct drm_i915_private *dev_priv =to_i915 (plane->base.dev); +enum i9xx_plane_id i9xx_plane = plane->i9xx_plane; + +if (IS_CHERRYVIEW (dev_priv)) +return i9xx_plane ==PLANE_B ; +else if (INTEL_GEN (dev_priv) >=5 ||IS_G4X (dev_priv)) +return false; +else if (IS_GEN (dev_priv,4 )) +return i9xx_plane ==PLANE_C ; +else +return i9xx_plane ==PLANE_B || + i9xx_plane ==PLANE_C ; +} + +static u32 i9xx_plane_ctl (const struct intel_crtc_state *crtc_state, +const struct intel_plane_state *plane_state) +{ +struct drm_i915_private *dev_priv = +to_i915 (plane_state->uapi.plane->dev); +const struct drm_framebuffer *fb = plane_state->hw.fb; +unsigned int rotation = plane_state->hw.rotation; +u32 dspcntr; + + dspcntr =DISPLAY_PLANE_ENABLE ; + +if (IS_G4X (dev_priv) ||IS_GEN (dev_priv,5 ) || +IS_GEN (dev_priv,6 ) ||IS_IVYBRIDGE (dev_priv)) + dspcntr |=DISPPLANE_TRICKLE_FEED_DISABLE ; + +switch (fb->format->format) { +case DRM_FORMAT_C8 : + dspcntr |=DISPPLANE_8BPP ; +break ; +case DRM_FORMAT_XRGB1555 : + dspcntr |=DISPPLANE_BGRX555 ; +break ; +case DRM_FORMAT_ARGB1555 : + dspcntr |=DISPPLANE_BGRA555 ; +break ; +case DRM_FORMAT_RGB565 : + dspcntr |=DISPPLANE_BGRX565 ; +break ; +case DRM_FORMAT_XRGB8888 : + dspcntr |=DISPPLANE_BGRX888 ; +break ; +case DRM_FORMAT_XBGR8888 : + dspcntr |=DISPPLANE_RGBX888 ; +break ; +case DRM_FORMAT_ARGB8888 : + dspcntr |=DISPPLANE_BGRA888 ; +break ; +case DRM_FORMAT_ABGR8888 : + dspcntr |=DISPPLANE_RGBA888 ; +break ; +case DRM_FORMAT_XRGB2101010 : + dspcntr |=DISPPLANE_BGRX101010 ; +break ; +case DRM_FORMAT_XBGR2101010 : + dspcntr |=DISPPLANE_RGBX101010 ; +break ; +case DRM_FORMAT_ARGB2101010 : + dspcntr |=DISPPLANE_BGRA101010 ; +break ; +case DRM_FORMAT_ABGR2101010 : + dspcntr |=DISPPLANE_RGBA101010 ; +break ; +case DRM_FORMAT_XBGR16161616F : + dspcntr |=DISPPLANE_RGBX161616 ; +break ; +default : +MISSING_CASE (fb->format->format); +return 0 ; + } + +if (INTEL_GEN (dev_priv) >=4 && + fb->modifier ==I915_FORMAT_MOD_X_TILED ) + dspcntr |=DISPPLANE_TILED ; + +if (rotation &DRM_MODE_ROTATE_180 ) + dspcntr |=DISPPLANE_ROTATE_180 ; + +if (rotation &DRM_MODE_REFLECT_X ) + dspcntr |=DISPPLANE_MIRROR ; + +return dspcntr; +} + +static int +i9xx_plane_check (struct intel_crtc_state *crtc_state, +struct intel_plane_state *plane_state) +{ +struct intel_plane *plane =to_intel_plane (plane_state->uapi.plane); +int ret; + + ret =chv_plane_check_rotation (plane_state); +if (ret) +return ret; + + ret =intel_atomic_plane_check_clipping (plane_state, crtc_state, +DRM_PLANE_HELPER_NO_SCALING , +DRM_PLANE_HELPER_NO_SCALING , +i9xx_plane_has_windowing (plane)); +if (ret) +return ret; + + ret =i9xx_check_plane_surface (plane_state); +if (ret) +return ret; + +if (!plane_state->uapi.visible) +return 0 ; + + ret =intel_plane_check_src_coordinates (plane_state); +if (ret) +return ret; + + plane_state->ctl =i9xx_plane_ctl (crtc_state, plane_state); + +return 0 ; +} + +static u32 i9xx_plane_ctl_crtc (const struct intel_crtc_state *crtc_state) +{ +struct intel_crtc *crtc =to_intel_crtc (crtc_state->uapi.crtc); +struct drm_i915_private *dev_priv =to_i915 (crtc->base.dev); +u32 dspcntr =0 ; + +if (crtc_state->gamma_enable) + dspcntr |=DISPPLANE_GAMMA_ENABLE ; + +if (crtc_state->csc_enable) + dspcntr |=DISPPLANE_PIPE_CSC_ENABLE ; + +if (INTEL_GEN (dev_priv) <5 ) + dspcntr |=DISPPLANE_SEL_PIPE (crtc->pipe); + +return dspcntr; +} + +static void i9xx_plane_ratio (const struct intel_crtc_state *crtc_state, +const struct intel_plane_state *plane_state, +unsigned int *num,unsigned int *den) +{ +const struct drm_framebuffer *fb = plane_state->hw.fb; +unsigned int cpp = fb->format->cpp[0 ]; + +/* +* g4x bspec says 64bpp pixel rate can't exceed 80% +* of cdclk when the sprite plane is enabled on the +* same pipe. ilk/snb bspec says 64bpp pixel rate is +* never allowed to exceed 80% of cdclk. Let's just go +* with the ilk/snb limit always. +*/ +if (cpp ==8 ) { + *num =10 ; + *den =8 ; + }else { + *num =1 ; + *den =1 ; + } +} + +static int i9xx_plane_min_cdclk (const struct intel_crtc_state *crtc_state, +const struct intel_plane_state *plane_state) +{ +unsigned int pixel_rate; +unsigned int num, den; + +/* +* Note that crtc_state->pixel_rate accounts for both +* horizontal and vertical panel fitter downscaling factors. +* Pre-HSW bspec tells us to only consider the horizontal +* downscaling factor here. We ignore that and just consider +* both for simplicity. +*/ + pixel_rate = crtc_state->pixel_rate; + +i9xx_plane_ratio (crtc_state, plane_state, &num, &den); + +/* two pixels per clock with double wide pipe */ +if (crtc_state->double_wide) + den *=2 ; + +return DIV_ROUND_UP (pixel_rate * num, den); +} + +static void i9xx_update_plane (struct intel_plane *plane, +const struct intel_crtc_state *crtc_state, +const struct intel_plane_state *plane_state) +{ +struct drm_i915_private *dev_priv =to_i915 (plane->base.dev); +enum i9xx_plane_id i9xx_plane = plane->i9xx_plane; +u32 linear_offset; +int x = plane_state->color_plane[0 ].x; +int y = plane_state->color_plane[0 ].y; +int crtc_x = plane_state->uapi.dst.x1; +int crtc_y = plane_state->uapi.dst.y1; +int crtc_w =drm_rect_width (&plane_state->uapi.dst); +int crtc_h =drm_rect_height (&plane_state->uapi.dst); +unsigned long irqflags; +u32 dspaddr_offset; +u32 dspcntr; + + dspcntr = plane_state->ctl |i9xx_plane_ctl_crtc (crtc_state); + + linear_offset =intel_fb_xy_to_linear (x, y, plane_state,0 ); + +if (INTEL_GEN (dev_priv) >=4 ) + dspaddr_offset = plane_state->color_plane[0 ].offset; +else + dspaddr_offset = linear_offset; + +spin_lock_irqsave (&dev_priv->uncore.lock, irqflags); + +intel_de_write_fw (dev_priv,DSPSTRIDE (i9xx_plane), + plane_state->color_plane[0 ].stride); + +if (INTEL_GEN (dev_priv) <4 ) { +/* +* PLANE_A doesn't actually have a full window +* generator but let's assume we still need to +* program whatever is there. +*/ +intel_de_write_fw (dev_priv,DSPPOS (i9xx_plane), + (crtc_y <<16 ) | crtc_x); +intel_de_write_fw (dev_priv,DSPSIZE (i9xx_plane), + ((crtc_h -1 ) <<16 ) | (crtc_w -1 )); + }else if (IS_CHERRYVIEW (dev_priv) && i9xx_plane ==PLANE_B ) { +intel_de_write_fw (dev_priv,PRIMPOS (i9xx_plane), + (crtc_y <<16 ) | crtc_x); +intel_de_write_fw (dev_priv,PRIMSIZE (i9xx_plane), + ((crtc_h -1 ) <<16 ) | (crtc_w -1 )); +intel_de_write_fw (dev_priv,PRIMCNSTALPHA (i9xx_plane),0 ); + } + +if (IS_HASWELL (dev_priv) ||IS_BROADWELL (dev_priv)) { +intel_de_write_fw (dev_priv,DSPOFFSET (i9xx_plane), + (y <<16 ) | x); + }else if (INTEL_GEN (dev_priv) >=4 ) { +intel_de_write_fw (dev_priv,DSPLINOFF (i9xx_plane), + linear_offset); +intel_de_write_fw (dev_priv,DSPTILEOFF (i9xx_plane), + (y <<16 ) | x); + } + +/* +* The control register self-arms if the plane was previously +* disabled. Try to make the plane enable atomic by writing +* the control register just before the surface register. +*/ +intel_de_write_fw (dev_priv,DSPCNTR (i9xx_plane), dspcntr); +if (INTEL_GEN (dev_priv) >=4 ) +intel_de_write_fw (dev_priv,DSPSURF (i9xx_plane), +intel_plane_ggtt_offset (plane_state) + dspaddr_offset); +else +intel_de_write_fw (dev_priv,DSPADDR (i9xx_plane), +intel_plane_ggtt_offset (plane_state) + dspaddr_offset); + +spin_unlock_irqrestore (&dev_priv->uncore.lock, irqflags); +} + +static void i9xx_disable_plane (struct intel_plane *plane, +const struct intel_crtc_state *crtc_state) +{ +struct drm_i915_private *dev_priv =to_i915 (plane->base.dev); +enum i9xx_plane_id i9xx_plane = plane->i9xx_plane; +unsigned long irqflags; +u32 dspcntr; + +/* +* DSPCNTR pipe gamma enable on g4x+ and pipe csc +* enable on ilk+ affect the pipe bottom color as +* well, so we must configure them even if the plane +* is disabled. +* +* On pre-g4x there is no way to gamma correct the +* pipe bottom color but we'll keep on doing this +* anyway so that the crtc state readout works correctly. +*/ + dspcntr =i9xx_plane_ctl_crtc (crtc_state); + +spin_lock_irqsave (&dev_priv->uncore.lock, irqflags); + +intel_de_write_fw (dev_priv,DSPCNTR (i9xx_plane), dspcntr); +if (INTEL_GEN (dev_priv) >=4 ) +intel_de_write_fw (dev_priv,DSPSURF (i9xx_plane),0 ); +else +intel_de_write_fw (dev_priv,DSPADDR (i9xx_plane),0 ); + +spin_unlock_irqrestore (&dev_priv->uncore.lock, irqflags); +} + +static bool i9xx_plane_get_hw_state (struct intel_plane *plane, +enum pipe *pipe) +{ +struct drm_i915_private *dev_priv =to_i915 (plane->base.dev); +enum intel_display_power_domain power_domain; +enum i9xx_plane_id i9xx_plane = plane->i9xx_plane; +intel_wakeref_t wakeref; +bool ret; +u32 val; + +/* +* Not 100% correct for planes that can move between pipes, +* but that's only the case for gen2-4 which don't have any +* display power wells. +*/ + power_domain =POWER_DOMAIN_PIPE (plane->pipe); + wakeref =intel_display_power_get_if_enabled (dev_priv, power_domain); +if (!wakeref) +return false; + + val =intel_de_read (dev_priv,DSPCNTR (i9xx_plane)); + + ret = val &DISPLAY_PLANE_ENABLE ; + +if (INTEL_GEN (dev_priv) >=5 ) + *pipe = plane->pipe; +else + *pipe = (val &DISPPLANE_SEL_PIPE_MASK ) >> +DISPPLANE_SEL_PIPE_SHIFT ; + +intel_display_power_put (dev_priv, power_domain, wakeref); + +return ret; +} + +unsigned int +i9xx_plane_max_stride (struct intel_plane *plane, +u32 pixel_format,u64 modifier, +unsigned int rotation) +{ +struct drm_i915_private *dev_priv =to_i915 (plane->base.dev); + +if (!HAS_GMCH (dev_priv)) { +return 32 *1024 ; + }else if (INTEL_GEN (dev_priv) >=4 ) { +if (modifier ==I915_FORMAT_MOD_X_TILED ) +return 16 *1024 ; +else +return 32 *1024 ; + }else if (INTEL_GEN (dev_priv) >=3 ) { +if (modifier ==I915_FORMAT_MOD_X_TILED ) +return 8 *1024 ; +else +return 16 *1024 ; + }else { +if (plane->i9xx_plane ==PLANE_C ) +return 4 *1024 ; +else +return 8 *1024 ; + } +} + +static const struct drm_plane_funcs i965_plane_funcs = { + .update_plane = drm_atomic_helper_update_plane, + .disable_plane = drm_atomic_helper_disable_plane, + .destroy = intel_plane_destroy, + .atomic_duplicate_state = intel_plane_duplicate_state, + .atomic_destroy_state = intel_plane_destroy_state, + .format_mod_supported = i965_plane_format_mod_supported, +}; + +static const struct drm_plane_funcs i8xx_plane_funcs = { + .update_plane = drm_atomic_helper_update_plane, + .disable_plane = drm_atomic_helper_disable_plane, + .destroy = intel_plane_destroy, + .atomic_duplicate_state = intel_plane_duplicate_state, + .atomic_destroy_state = intel_plane_destroy_state, + .format_mod_supported = i8xx_plane_format_mod_supported, +}; + +static struct intel_plane * +intel_primary_plane_create (struct drm_i915_private *dev_priv,enum pipe pipe) +{ +struct intel_plane *plane; +const struct drm_plane_funcs *plane_funcs; +unsigned int supported_rotations; +const u32 *formats; +int num_formats; +int ret, zpos; + +if (INTEL_GEN (dev_priv) >=9 ) +return skl_universal_plane_create (dev_priv, pipe, +PLANE_PRIMARY ); + + plane =intel_plane_alloc (); +if (IS_ERR (plane)) +return plane; + + plane->pipe = pipe; +/* +* On gen2/3 only plane A can do FBC, but the panel fitter and LVDS +* port is hooked to pipe B. Hence we want plane A feeding pipe B. +*/ +if (HAS_FBC (dev_priv) &&INTEL_GEN (dev_priv) <4 && +INTEL_NUM_PIPES (dev_priv) ==2 ) + plane->i9xx_plane = (enum i9xx_plane_id ) !pipe; +else + plane->i9xx_plane = (enum i9xx_plane_id ) pipe; + plane->id =PLANE_PRIMARY ; + plane->frontbuffer_bit =INTEL_FRONTBUFFER (pipe, plane->id); + + plane->has_fbc =i9xx_plane_has_fbc (dev_priv, plane->i9xx_plane); +if (plane->has_fbc) { +struct intel_fbc *fbc = &dev_priv->fbc; + + fbc->possible_framebuffer_bits |= plane->frontbuffer_bit; + } + +if (IS_VALLEYVIEW (dev_priv) ||IS_CHERRYVIEW (dev_priv)) { + formats = vlv_primary_formats; + num_formats =ARRAY_SIZE (vlv_primary_formats); + }else if (INTEL_GEN (dev_priv) >=4 ) { +/* +* WaFP16GammaEnabling:ivb +* "Workaround : When using the 64-bit format, the plane +* output on each color channel has one quarter amplitude. +* It can be brought up to full amplitude by using pipe +* gamma correction or pipe color space conversion to +* multiply the plane output by four." +* +* There is no dedicated plane gamma for the primary plane, +* and using the pipe gamma/csc could conflict with other +* planes, so we choose not to expose fp16 on IVB primary +* planes. HSW primary planes no longer have this problem. +*/ +if (IS_IVYBRIDGE (dev_priv)) { + formats = ivb_primary_formats; + num_formats =ARRAY_SIZE (ivb_primary_formats); + }else { + formats = i965_primary_formats; + num_formats =ARRAY_SIZE (i965_primary_formats); + } + }else { + formats = i8xx_primary_formats; + num_formats =ARRAY_SIZE (i8xx_primary_formats); + } + +if (INTEL_GEN (dev_priv) >=4 ) + plane_funcs = &i965_plane_funcs; +else + plane_funcs = &i8xx_plane_funcs; + +if (IS_VALLEYVIEW (dev_priv) ||IS_CHERRYVIEW (dev_priv)) + plane->min_cdclk = vlv_plane_min_cdclk; +else if (IS_BROADWELL (dev_priv) ||IS_HASWELL (dev_priv)) + plane->min_cdclk = hsw_plane_min_cdclk; +else if (IS_IVYBRIDGE (dev_priv)) + plane->min_cdclk = ivb_plane_min_cdclk; +else + plane->min_cdclk = i9xx_plane_min_cdclk; + + plane->max_stride = i9xx_plane_max_stride; + plane->update_plane = i9xx_update_plane; + plane->disable_plane = i9xx_disable_plane; + plane->get_hw_state = i9xx_plane_get_hw_state; + plane->check_plane = i9xx_plane_check; + +if (INTEL_GEN (dev_priv) >=5 ||IS_G4X (dev_priv)) + ret =drm_universal_plane_init (&dev_priv->drm, &plane->base, +0 , plane_funcs, + formats, num_formats, + i9xx_format_modifiers, +DRM_PLANE_TYPE_PRIMARY , +"primary %c" ,pipe_name (pipe)); +else + ret =drm_universal_plane_init (&dev_priv->drm, &plane->base, +0 , plane_funcs, + formats, num_formats, + i9xx_format_modifiers, +DRM_PLANE_TYPE_PRIMARY , +"plane %c" , +plane_name (plane->i9xx_plane)); +if (ret) + goto fail; + +if (IS_CHERRYVIEW (dev_priv) && pipe ==PIPE_B ) { + supported_rotations = +DRM_MODE_ROTATE_0 |DRM_MODE_ROTATE_180 | +DRM_MODE_REFLECT_X ; + }else if (INTEL_GEN (dev_priv) >=4 ) { + supported_rotations = +DRM_MODE_ROTATE_0 |DRM_MODE_ROTATE_180 ; + }else { + supported_rotations =DRM_MODE_ROTATE_0 ; + } + +if (INTEL_GEN (dev_priv) >=4 ) +drm_plane_create_rotation_property (&plane->base, +DRM_MODE_ROTATE_0 , + supported_rotations); + + zpos =0 ; +drm_plane_create_zpos_immutable_property (&plane->base, zpos); + +drm_plane_helper_add (&plane->base, &intel_plane_helper_funcs); + +return plane; + +fail: +intel_plane_free (plane); + +return ERR_PTR (ret); +} + +static struct intel_crtc *intel_crtc_alloc (void ) +{ +struct intel_crtc_state *crtc_state; +struct intel_crtc *crtc; + + crtc =kzalloc (sizeof (*crtc),GFP_KERNEL ); +if (!crtc) +return ERR_PTR (-ENOMEM ); + + crtc_state =intel_crtc_state_alloc (crtc); +if (!crtc_state) { +kfree (crtc); +return ERR_PTR (-ENOMEM ); + } + + crtc->base.state = &crtc_state->uapi; + crtc->config = crtc_state; + +return crtc; +} + +static void intel_crtc_free (struct intel_crtc *crtc) +{ +intel_crtc_destroy_state (&crtc->base, crtc->base.state); +kfree (crtc); +} + +static void intel_crtc_destroy (struct drm_crtc *crtc) +{ +struct intel_crtc *intel_crtc =to_intel_crtc (crtc); + +drm_crtc_cleanup (crtc); +kfree (intel_crtc); +} + +static int intel_crtc_late_register (struct drm_crtc *crtc) +{ +intel_crtc_debugfs_add (crtc); +return 0 ; +} + +#define INTEL_CRTC_FUNCS \ + .gamma_set = drm_atomic_helper_legacy_gamma_set, \ + .set_config = drm_atomic_helper_set_config, \ + .destroy = intel_crtc_destroy, \ + .page_flip = drm_atomic_helper_page_flip, \ + .atomic_duplicate_state = intel_crtc_duplicate_state, \ + .atomic_destroy_state = intel_crtc_destroy_state, \ + .set_crc_source = intel_crtc_set_crc_source, \ + .verify_crc_source = intel_crtc_verify_crc_source, \ + .get_crc_sources = intel_crtc_get_crc_sources, \ + .late_register = intel_crtc_late_register + +static const struct drm_crtc_funcs bdw_crtc_funcs = { +INTEL_CRTC_FUNCS , + + .get_vblank_counter = g4x_get_vblank_counter, + .enable_vblank = bdw_enable_vblank, + .disable_vblank = bdw_disable_vblank, + .get_vblank_timestamp = intel_crtc_get_vblank_timestamp, +}; + +static const struct drm_crtc_funcs ilk_crtc_funcs = { +INTEL_CRTC_FUNCS , + + .get_vblank_counter = g4x_get_vblank_counter, + .enable_vblank = ilk_enable_vblank, + .disable_vblank = ilk_disable_vblank, + .get_vblank_timestamp = intel_crtc_get_vblank_timestamp, +}; + +static const struct drm_crtc_funcs g4x_crtc_funcs = { +INTEL_CRTC_FUNCS , + + .get_vblank_counter = g4x_get_vblank_counter, + .enable_vblank = i965_enable_vblank, + .disable_vblank = i965_disable_vblank, + .get_vblank_timestamp = intel_crtc_get_vblank_timestamp, +}; + +static const struct drm_crtc_funcs i965_crtc_funcs = { +INTEL_CRTC_FUNCS , + + .get_vblank_counter = i915_get_vblank_counter, + .enable_vblank = i965_enable_vblank, + .disable_vblank = i965_disable_vblank, + .get_vblank_timestamp = intel_crtc_get_vblank_timestamp, +}; + +static const struct drm_crtc_funcs i915gm_crtc_funcs = { +INTEL_CRTC_FUNCS , + + .get_vblank_counter = i915_get_vblank_counter, + .enable_vblank = i915gm_enable_vblank, + .disable_vblank = i915gm_disable_vblank, + .get_vblank_timestamp = intel_crtc_get_vblank_timestamp, +}; + +static const struct drm_crtc_funcs i915_crtc_funcs = { +INTEL_CRTC_FUNCS , + + .get_vblank_counter = i915_get_vblank_counter, + .enable_vblank = i8xx_enable_vblank, + .disable_vblank = i8xx_disable_vblank, + .get_vblank_timestamp = intel_crtc_get_vblank_timestamp, +}; + +static const struct drm_crtc_funcs i8xx_crtc_funcs = { +INTEL_CRTC_FUNCS , + +/* no hw vblank counter */ + .enable_vblank = i8xx_enable_vblank, + .disable_vblank = i8xx_disable_vblank, + .get_vblank_timestamp = intel_crtc_get_vblank_timestamp, +}; + +int intel_crtc_init (struct drm_i915_private *dev_priv,enum pipe pipe) +{ +struct intel_plane *primary, *cursor; +const struct drm_crtc_funcs *funcs; +struct intel_crtc *crtc; +int sprite, ret; + + crtc =intel_crtc_alloc (); +if (IS_ERR (crtc)) +return PTR_ERR (crtc); + + crtc->pipe = pipe; + crtc->num_scalers =RUNTIME_INFO (dev_priv)->num_scalers[pipe]; + + primary =intel_primary_plane_create (dev_priv, pipe); +if (IS_ERR (primary)) { + ret =PTR_ERR (primary); + goto fail; + } + crtc->plane_ids_mask |=BIT (primary->id); + +for_each_sprite (dev_priv, pipe, sprite) { +struct intel_plane *plane; + + plane =intel_sprite_plane_create (dev_priv, pipe, sprite); +if (IS_ERR (plane)) { + ret =PTR_ERR (plane); + goto fail; + } + crtc->plane_ids_mask |=BIT (plane->id); + } + + cursor =intel_cursor_plane_create (dev_priv, pipe); +if (IS_ERR (cursor)) { + ret =PTR_ERR (cursor); + goto fail; + } + crtc->plane_ids_mask |=BIT (cursor->id); + +if (HAS_GMCH (dev_priv)) { +if (IS_CHERRYVIEW (dev_priv) || +IS_VALLEYVIEW (dev_priv) ||IS_G4X (dev_priv)) + funcs = &g4x_crtc_funcs; +else if (IS_GEN (dev_priv,4 )) + funcs = &i965_crtc_funcs; +else if (IS_I945GM (dev_priv) ||IS_I915GM (dev_priv)) + funcs = &i915gm_crtc_funcs; +else if (IS_GEN (dev_priv,3 )) + funcs = &i915_crtc_funcs; +else + funcs = &i8xx_crtc_funcs; + }else { +if (INTEL_GEN (dev_priv) >=8 ) + funcs = &bdw_crtc_funcs; +else + funcs = &ilk_crtc_funcs; + } + + ret =drm_crtc_init_with_planes (&dev_priv->drm, &crtc->base, + &primary->base, &cursor->base, + funcs,"pipe %c" ,pipe_name (pipe)); +if (ret) + goto fail; + +BUG_ON (pipe >=ARRAY_SIZE (dev_priv->pipe_to_crtc_mapping) || + dev_priv->pipe_to_crtc_mapping[pipe] !=NULL ); + dev_priv->pipe_to_crtc_mapping[pipe] = crtc; + +if (INTEL_GEN (dev_priv) <9 ) { +enum i9xx_plane_id i9xx_plane = primary->i9xx_plane; + +BUG_ON (i9xx_plane >=ARRAY_SIZE (dev_priv->plane_to_crtc_mapping) || + dev_priv->plane_to_crtc_mapping[i9xx_plane] !=NULL ); + dev_priv->plane_to_crtc_mapping[i9xx_plane] = crtc; + } + +if (INTEL_GEN (dev_priv) >=10 ) +drm_crtc_create_scaling_filter_property (&crtc->base, +BIT (DRM_SCALING_FILTER_DEFAULT ) | +BIT (DRM_SCALING_FILTER_NEAREST_NEIGHBOR )); + +intel_color_init (crtc); + +intel_crtc_crc_init (crtc); + +drm_WARN_ON (&dev_priv->drm,drm_crtc_index (&crtc->base) != crtc->pipe); + +return 0 ; + +fail: +intel_crtc_free (crtc); + +return ret; +}drivers/gpu/drm/i915/display/intel_display.c +0
-932@@ -87,56 +87,6 @@#include "intel_tc.h" #include "intel_vga.h" -/* Primary plane formats for gen <= 3 */ -static const u32 i8xx_primary_formats[] = { -DRM_FORMAT_C8 , -DRM_FORMAT_XRGB1555 , -DRM_FORMAT_RGB565 , -DRM_FORMAT_XRGB8888 , -}; - -/* Primary plane formats for ivb (no fp16 due to hw issue) */ -static const u32 ivb_primary_formats[] = { -DRM_FORMAT_C8 , -DRM_FORMAT_RGB565 , -DRM_FORMAT_XRGB8888 , -DRM_FORMAT_XBGR8888 , -DRM_FORMAT_XRGB2101010 , -DRM_FORMAT_XBGR2101010 , -}; - -/* Primary plane formats for gen >= 4, except ivb */ -static const u32 i965_primary_formats[] = { -DRM_FORMAT_C8 , -DRM_FORMAT_RGB565 , -DRM_FORMAT_XRGB8888 , -DRM_FORMAT_XBGR8888 , -DRM_FORMAT_XRGB2101010 , -DRM_FORMAT_XBGR2101010 , -DRM_FORMAT_XBGR16161616F , -}; - -/* Primary plane formats for vlv/chv */ -static const u32 vlv_primary_formats[] = { -DRM_FORMAT_C8 , -DRM_FORMAT_RGB565 , -DRM_FORMAT_XRGB8888 , -DRM_FORMAT_XBGR8888 , -DRM_FORMAT_ARGB8888 , -DRM_FORMAT_ABGR8888 , -DRM_FORMAT_XRGB2101010 , -DRM_FORMAT_XBGR2101010 , -DRM_FORMAT_ARGB2101010 , -DRM_FORMAT_ABGR2101010 , -DRM_FORMAT_XBGR16161616F , -}; - -static const u64 i9xx_format_modifiers[] = { -I915_FORMAT_MOD_X_TILED , -DRM_FORMAT_MOD_LINEAR , -DRM_FORMAT_MOD_INVALID -}; -static void i9xx_crtc_clock_get (struct intel_crtc *crtc,struct intel_crtc_state *pipe_config); static void ilk_pch_clock_get(struct intel_crtc *crtc,@@ -162,7 +112,6 @@ static void skl_pfit_enable(const struct intel_crtc_state *crtc_state);static void ilk_pfit_enable (const struct intel_crtc_state *crtc_state);static void intel_modeset_setup_hw_state (struct drm_device *dev,struct drm_modeset_acquire_ctx *ctx); -static struct intel_crtc_state *intel_crtc_state_alloc (struct intel_crtc *crtc); struct intel_limit { struct {@@ -1301,12 +1250,6 @@ static void assert_planes_disabled(struct intel_crtc *crtc)assert_plane_disabled (plane); } -static void assert_vblank_disabled (struct drm_crtc *crtc) -{ -if (I915_STATE_WARN_ON (drm_crtc_vblank_get (crtc) ==0 )) -drm_crtc_vblank_put (crtc); -} -void assert_pch_transcoder_disabled (struct drm_i915_private *dev_priv,enum pipe pipe) {@@ -1791,55 +1734,6 @@ enum pipe intel_crtc_pch_transcoder(struct intel_crtc *crtc)return crtc->pipe; } -static u32 intel_crtc_max_vblank_count (const struct intel_crtc_state *crtc_state) -{ -struct drm_i915_private *dev_priv =to_i915 (crtc_state->uapi.crtc->dev); -struct intel_crtc *crtc =to_intel_crtc (crtc_state->uapi.crtc); -u32 mode_flags = crtc->mode_flags; - -/* -* From Gen 11, In case of dsi cmd mode, frame counter wouldnt -* have updated at the beginning of TE, if we want to use -* the hw counter, then we would find it updated in only -* the next TE, hence switching to sw counter. -*/ -if (mode_flags & (I915_MODE_FLAG_DSI_USE_TE0 |I915_MODE_FLAG_DSI_USE_TE1 )) -return 0 ; - -/* -* On i965gm the hardware frame counter reads -* zero when the TV encoder is enabled :( -*/ -if (IS_I965GM (dev_priv) && - (crtc_state->output_types &BIT (INTEL_OUTPUT_TVOUT ))) -return 0 ; - -if (INTEL_GEN (dev_priv) >=5 ||IS_G4X (dev_priv)) -return 0xffffffff ;/* full 32 bit counter */ -else if (INTEL_GEN (dev_priv) >=3 ) -return 0xffffff ;/* only 24 bits of frame count */ -else -return 0 ;/* Gen2 doesn't have a hardware frame counter */ -} - -void intel_crtc_vblank_on (const struct intel_crtc_state *crtc_state) -{ -struct intel_crtc *crtc =to_intel_crtc (crtc_state->uapi.crtc); - -assert_vblank_disabled (&crtc->base); -drm_crtc_set_max_vblank_count (&crtc->base, -intel_crtc_max_vblank_count (crtc_state)); -drm_crtc_vblank_on (&crtc->base); -} - -void intel_crtc_vblank_off (const struct intel_crtc_state *crtc_state) -{ -struct intel_crtc *crtc =to_intel_crtc (crtc_state->uapi.crtc); - -drm_crtc_vblank_off (&crtc->base); -assert_vblank_disabled (&crtc->base); -} -void intel_enable_pipe (const struct intel_crtc_state *new_crtc_state) {struct intel_crtc *crtc =to_intel_crtc (new_crtc_state->uapi.crtc);@@ -4046,171 +3940,6 @@ int skl_check_plane_surface(struct intel_plane_state *plane_state)return 0 ; } -static void i9xx_plane_ratio (const struct intel_crtc_state *crtc_state, -const struct intel_plane_state *plane_state, -unsigned int *num,unsigned int *den) -{ -const struct drm_framebuffer *fb = plane_state->hw.fb; -unsigned int cpp = fb->format->cpp[0 ]; - -/* -* g4x bspec says 64bpp pixel rate can't exceed 80% -* of cdclk when the sprite plane is enabled on the -* same pipe. ilk/snb bspec says 64bpp pixel rate is -* never allowed to exceed 80% of cdclk. Let's just go -* with the ilk/snb limit always. -*/ -if (cpp ==8 ) { - *num =10 ; - *den =8 ; - }else { - *num =1 ; - *den =1 ; - } -} - -static int i9xx_plane_min_cdclk (const struct intel_crtc_state *crtc_state, -const struct intel_plane_state *plane_state) -{ -unsigned int pixel_rate; -unsigned int num, den; - -/* -* Note that crtc_state->pixel_rate accounts for both -* horizontal and vertical panel fitter downscaling factors. -* Pre-HSW bspec tells us to only consider the horizontal -* downscaling factor here. We ignore that and just consider -* both for simplicity. -*/ - pixel_rate = crtc_state->pixel_rate; - -i9xx_plane_ratio (crtc_state, plane_state, &num, &den); - -/* two pixels per clock with double wide pipe */ -if (crtc_state->double_wide) - den *=2 ; - -return DIV_ROUND_UP (pixel_rate * num, den); -} - -unsigned int -i9xx_plane_max_stride (struct intel_plane *plane, -u32 pixel_format,u64 modifier, -unsigned int rotation) -{ -struct drm_i915_private *dev_priv =to_i915 (plane->base.dev); - -if (!HAS_GMCH (dev_priv)) { -return 32 *1024 ; - }else if (INTEL_GEN (dev_priv) >=4 ) { -if (modifier ==I915_FORMAT_MOD_X_TILED ) -return 16 *1024 ; -else -return 32 *1024 ; - }else if (INTEL_GEN (dev_priv) >=3 ) { -if (modifier ==I915_FORMAT_MOD_X_TILED ) -return 8 *1024 ; -else -return 16 *1024 ; - }else { -if (plane->i9xx_plane ==PLANE_C ) -return 4 *1024 ; -else -return 8 *1024 ; - } -} - -static u32 i9xx_plane_ctl_crtc (const struct intel_crtc_state *crtc_state) -{ -struct intel_crtc *crtc =to_intel_crtc (crtc_state->uapi.crtc); -struct drm_i915_private *dev_priv =to_i915 (crtc->base.dev); -u32 dspcntr =0 ; - -if (crtc_state->gamma_enable) - dspcntr |=DISPPLANE_GAMMA_ENABLE ; - -if (crtc_state->csc_enable) - dspcntr |=DISPPLANE_PIPE_CSC_ENABLE ; - -if (INTEL_GEN (dev_priv) <5 ) - dspcntr |=DISPPLANE_SEL_PIPE (crtc->pipe); - -return dspcntr; -} - -static u32 i9xx_plane_ctl (const struct intel_crtc_state *crtc_state, -const struct intel_plane_state *plane_state) -{ -struct drm_i915_private *dev_priv = -to_i915 (plane_state->uapi.plane->dev); -const struct drm_framebuffer *fb = plane_state->hw.fb; -unsigned int rotation = plane_state->hw.rotation; -u32 dspcntr; - - dspcntr =DISPLAY_PLANE_ENABLE ; - -if (IS_G4X (dev_priv) ||IS_GEN (dev_priv,5 ) || -IS_GEN (dev_priv,6 ) ||IS_IVYBRIDGE (dev_priv)) - dspcntr |=DISPPLANE_TRICKLE_FEED_DISABLE ; - -switch (fb->format->format) { -case DRM_FORMAT_C8 : - dspcntr |=DISPPLANE_8BPP ; -break ; -case DRM_FORMAT_XRGB1555 : - dspcntr |=DISPPLANE_BGRX555 ; -break ; -case DRM_FORMAT_ARGB1555 : - dspcntr |=DISPPLANE_BGRA555 ; -break ; -case DRM_FORMAT_RGB565 : - dspcntr |=DISPPLANE_BGRX565 ; -break ; -case DRM_FORMAT_XRGB8888 : - dspcntr |=DISPPLANE_BGRX888 ; -break ; -case DRM_FORMAT_XBGR8888 : - dspcntr |=DISPPLANE_RGBX888 ; -break ; -case DRM_FORMAT_ARGB8888 : - dspcntr |=DISPPLANE_BGRA888 ; -break ; -case DRM_FORMAT_ABGR8888 : - dspcntr |=DISPPLANE_RGBA888 ; -break ; -case DRM_FORMAT_XRGB2101010 : - dspcntr |=DISPPLANE_BGRX101010 ; -break ; -case DRM_FORMAT_XBGR2101010 : - dspcntr |=DISPPLANE_RGBX101010 ; -break ; -case DRM_FORMAT_ARGB2101010 : - dspcntr |=DISPPLANE_BGRA101010 ; -break ; -case DRM_FORMAT_ABGR2101010 : - dspcntr |=DISPPLANE_RGBA101010 ; -break ; -case DRM_FORMAT_XBGR16161616F : - dspcntr |=DISPPLANE_RGBX161616 ; -break ; -default : -MISSING_CASE (fb->format->format); -return 0 ; - } - -if (INTEL_GEN (dev_priv) >=4 && - fb->modifier ==I915_FORMAT_MOD_X_TILED ) - dspcntr |=DISPPLANE_TILED ; - -if (rotation &DRM_MODE_ROTATE_180 ) - dspcntr |=DISPPLANE_ROTATE_180 ; - -if (rotation &DRM_MODE_REFLECT_X ) - dspcntr |=DISPPLANE_MIRROR ; - -return dspcntr; -} -int i9xx_check_plane_surface (struct intel_plane_state *plane_state) { struct drm_i915_private *dev_priv =@@ -4271,197 +4000,6 @@ int i9xx_check_plane_surface(struct intel_plane_state *plane_state)return 0 ; } -static bool i9xx_plane_has_windowing (struct intel_plane *plane) -{ -struct drm_i915_private *dev_priv =to_i915 (plane->base.dev); -enum i9xx_plane_id i9xx_plane = plane->i9xx_plane; - -if (IS_CHERRYVIEW (dev_priv)) -return i9xx_plane ==PLANE_B ; -else if (INTEL_GEN (dev_priv) >=5 ||IS_G4X (dev_priv)) -return false; -else if (IS_GEN (dev_priv,4 )) -return i9xx_plane ==PLANE_C ; -else -return i9xx_plane ==PLANE_B || - i9xx_plane ==PLANE_C ; -} - -static int -i9xx_plane_check (struct intel_crtc_state *crtc_state, -struct intel_plane_state *plane_state) -{ -struct intel_plane *plane =to_intel_plane (plane_state->uapi.plane); -int ret; - - ret =chv_plane_check_rotation (plane_state); -if (ret) -return ret; - - ret =intel_atomic_plane_check_clipping (plane_state, crtc_state, -DRM_PLANE_HELPER_NO_SCALING , -DRM_PLANE_HELPER_NO_SCALING , -i9xx_plane_has_windowing (plane)); -if (ret) -return ret; - - ret =i9xx_check_plane_surface (plane_state); -if (ret) -return ret; - -if (!plane_state->uapi.visible) -return 0 ; - - ret =intel_plane_check_src_coordinates (plane_state); -if (ret) -return ret; - - plane_state->ctl =i9xx_plane_ctl (crtc_state, plane_state); - -return 0 ; -} - -static void i9xx_update_plane (struct intel_plane *plane, -const struct intel_crtc_state *crtc_state, -const struct intel_plane_state *plane_state) -{ -struct drm_i915_private *dev_priv =to_i915 (plane->base.dev); -enum i9xx_plane_id i9xx_plane = plane->i9xx_plane; -u32 linear_offset; -int x = plane_state->color_plane[0 ].x; -int y = plane_state->color_plane[0 ].y; -int crtc_x = plane_state->uapi.dst.x1; -int crtc_y = plane_state->uapi.dst.y1; -int crtc_w =drm_rect_width (&plane_state->uapi.dst); -int crtc_h =drm_rect_height (&plane_state->uapi.dst); -unsigned long irqflags; -u32 dspaddr_offset; -u32 dspcntr; - - dspcntr = plane_state->ctl |i9xx_plane_ctl_crtc (crtc_state); - - linear_offset =intel_fb_xy_to_linear (x, y, plane_state,0 ); - -if (INTEL_GEN (dev_priv) >=4 ) - dspaddr_offset = plane_state->color_plane[0 ].offset; -else - dspaddr_offset = linear_offset; - -spin_lock_irqsave (&dev_priv->uncore.lock, irqflags); - -intel_de_write_fw (dev_priv,DSPSTRIDE (i9xx_plane), - plane_state->color_plane[0 ].stride); - -if (INTEL_GEN (dev_priv) <4 ) { -/* -* PLANE_A doesn't actually have a full window -* generator but let's assume we still need to -* program whatever is there. -*/ -intel_de_write_fw (dev_priv,DSPPOS (i9xx_plane), - (crtc_y <<16 ) | crtc_x); -intel_de_write_fw (dev_priv,DSPSIZE (i9xx_plane), - ((crtc_h -1 ) <<16 ) | (crtc_w -1 )); - }else if (IS_CHERRYVIEW (dev_priv) && i9xx_plane ==PLANE_B ) { -intel_de_write_fw (dev_priv,PRIMPOS (i9xx_plane), - (crtc_y <<16 ) | crtc_x); -intel_de_write_fw (dev_priv,PRIMSIZE (i9xx_plane), - ((crtc_h -1 ) <<16 ) | (crtc_w -1 )); -intel_de_write_fw (dev_priv,PRIMCNSTALPHA (i9xx_plane),0 ); - } - -if (IS_HASWELL (dev_priv) ||IS_BROADWELL (dev_priv)) { -intel_de_write_fw (dev_priv,DSPOFFSET (i9xx_plane), - (y <<16 ) | x); - }else if (INTEL_GEN (dev_priv) >=4 ) { -intel_de_write_fw (dev_priv,DSPLINOFF (i9xx_plane), - linear_offset); -intel_de_write_fw (dev_priv,DSPTILEOFF (i9xx_plane), - (y <<16 ) | x); - } - -/* -* The control register self-arms if the plane was previously -* disabled. Try to make the plane enable atomic by writing -* the control register just before the surface register. -*/ -intel_de_write_fw (dev_priv,DSPCNTR (i9xx_plane), dspcntr); -if (INTEL_GEN (dev_priv) >=4 ) -intel_de_write_fw (dev_priv,DSPSURF (i9xx_plane), -intel_plane_ggtt_offset (plane_state) + dspaddr_offset); -else -intel_de_write_fw (dev_priv,DSPADDR (i9xx_plane), -intel_plane_ggtt_offset (plane_state) + dspaddr_offset); - -spin_unlock_irqrestore (&dev_priv->uncore.lock, irqflags); -} - -static void i9xx_disable_plane (struct intel_plane *plane, -const struct intel_crtc_state *crtc_state) -{ -struct drm_i915_private *dev_priv =to_i915 (plane->base.dev); -enum i9xx_plane_id i9xx_plane = plane->i9xx_plane; -unsigned long irqflags; -u32 dspcntr; - -/* -* DSPCNTR pipe gamma enable on g4x+ and pipe csc -* enable on ilk+ affect the pipe bottom color as -* well, so we must configure them even if the plane -* is disabled. -* -* On pre-g4x there is no way to gamma correct the -* pipe bottom color but we'll keep on doing this -* anyway so that the crtc state readout works correctly. -*/ - dspcntr =i9xx_plane_ctl_crtc (crtc_state); - -spin_lock_irqsave (&dev_priv->uncore.lock, irqflags); - -intel_de_write_fw (dev_priv,DSPCNTR (i9xx_plane), dspcntr); -if (INTEL_GEN (dev_priv) >=4 ) -intel_de_write_fw (dev_priv,DSPSURF (i9xx_plane),0 ); -else -intel_de_write_fw (dev_priv,DSPADDR (i9xx_plane),0 ); - -spin_unlock_irqrestore (&dev_priv->uncore.lock, irqflags); -} - -static bool i9xx_plane_get_hw_state (struct intel_plane *plane, -enum pipe *pipe) -{ -struct drm_i915_private *dev_priv =to_i915 (plane->base.dev); -enum intel_display_power_domain power_domain; -enum i9xx_plane_id i9xx_plane = plane->i9xx_plane; -intel_wakeref_t wakeref; -bool ret; -u32 val; - -/* -* Not 100% correct for planes that can move between pipes, -* but that's only the case for gen2-4 which don't have any -* display power wells. -*/ - power_domain =POWER_DOMAIN_PIPE (plane->pipe); - wakeref =intel_display_power_get_if_enabled (dev_priv, power_domain); -if (!wakeref) -return false; - - val =intel_de_read (dev_priv,DSPCNTR (i9xx_plane)); - - ret = val &DISPLAY_PLANE_ENABLE ; - -if (INTEL_GEN (dev_priv) >=5 ) - *pipe = plane->pipe; -else - *pipe = (val &DISPPLANE_SEL_PIPE_MASK ) >> -DISPPLANE_SEL_PIPE_SHIFT ; - -intel_display_power_put (dev_priv, power_domain, wakeref); - -return ret; -} -static void skl_detach_scaler (struct intel_crtc *intel_crtc,int id) {struct drm_device *dev = intel_crtc->base.dev;@@ -11908,33 +11446,6 @@ static void ilk_pch_clock_get(struct intel_crtc *crtc, &pipe_config->fdi_m_n); } -static void intel_crtc_state_reset (struct intel_crtc_state *crtc_state, -struct intel_crtc *crtc) -{ -memset (crtc_state,0 ,sizeof (*crtc_state)); - -__drm_atomic_helper_crtc_state_reset (&crtc_state->uapi, &crtc->base); - - crtc_state->cpu_transcoder =INVALID_TRANSCODER ; - crtc_state->master_transcoder =INVALID_TRANSCODER ; - crtc_state->hsw_workaround_pipe =INVALID_PIPE ; - crtc_state->output_format =INTEL_OUTPUT_FORMAT_INVALID ; - crtc_state->scaler_state.scaler_id =-1 ; - crtc_state->mst_master_transcoder =INVALID_TRANSCODER ; -} - -static struct intel_crtc_state *intel_crtc_state_alloc (struct intel_crtc *crtc) -{ -struct intel_crtc_state *crtc_state; - - crtc_state =kmalloc (sizeof (*crtc_state),GFP_KERNEL ); - -if (crtc_state) -intel_crtc_state_reset (crtc_state, crtc); - -return crtc_state; -} -/* Returns the currently programmed mode of the given encoder. */ struct drm_display_mode *intel_encoder_current_mode (struct intel_encoder *encoder)@@ -11975,14 +11486,6 @@ intel_encoder_current_mode(struct intel_encoder *encoder)return mode; } -static void intel_crtc_destroy (struct drm_crtc *crtc) -{ -struct intel_crtc *intel_crtc =to_intel_crtc (crtc); - -drm_crtc_cleanup (crtc); -kfree (intel_crtc); -} -/** * intel_wm_need_update - Check whether watermarks need updating * @cur: current plane state @@ -15186,17 +14689,6 @@ static int intel_atomic_prepare_commit(struct intel_atomic_state *state)return 0 ; } -u32 intel_crtc_get_vblank_counter (struct intel_crtc *crtc) -{ -struct drm_device *dev = crtc->base.dev; -struct drm_vblank_crtc *vblank = &dev->vblank[drm_crtc_index (&crtc->base)]; - -if (!vblank->max_vblank_count) -return (u32 )drm_crtc_accurate_vblank_count (&crtc->base); - -return crtc->base.funcs->get_vblank_counter (&crtc->base); -} -void intel_crtc_arm_fifo_underrun (struct intel_crtc *crtc,struct intel_crtc_state *crtc_state) {@@ -16249,336 +15741,6 @@ void intel_plane_destroy(struct drm_plane *plane)kfree (to_intel_plane (plane)); } -static bool i8xx_plane_format_mod_supported (struct drm_plane *_plane, -u32 format,u64 modifier) -{ -switch (modifier) { -case DRM_FORMAT_MOD_LINEAR : -case I915_FORMAT_MOD_X_TILED : -break ; -default : -return false; - } - -switch (format) { -case DRM_FORMAT_C8 : -case DRM_FORMAT_RGB565 : -case DRM_FORMAT_XRGB1555 : -case DRM_FORMAT_XRGB8888 : -return modifier ==DRM_FORMAT_MOD_LINEAR || - modifier ==I915_FORMAT_MOD_X_TILED ; -default : -return false; - } -} - -static bool i965_plane_format_mod_supported (struct drm_plane *_plane, -u32 format,u64 modifier) -{ -switch (modifier) { -case DRM_FORMAT_MOD_LINEAR : -case I915_FORMAT_MOD_X_TILED : -break ; -default : -return false; - } - -switch (format) { -case DRM_FORMAT_C8 : -case DRM_FORMAT_RGB565 : -case DRM_FORMAT_XRGB8888 : -case DRM_FORMAT_XBGR8888 : -case DRM_FORMAT_ARGB8888 : -case DRM_FORMAT_ABGR8888 : -case DRM_FORMAT_XRGB2101010 : -case DRM_FORMAT_XBGR2101010 : -case DRM_FORMAT_ARGB2101010 : -case DRM_FORMAT_ABGR2101010 : -case DRM_FORMAT_XBGR16161616F : -return modifier ==DRM_FORMAT_MOD_LINEAR || - modifier ==I915_FORMAT_MOD_X_TILED ; -default : -return false; - } -} - -static const struct drm_plane_funcs i965_plane_funcs = { - .update_plane = drm_atomic_helper_update_plane, - .disable_plane = drm_atomic_helper_disable_plane, - .destroy = intel_plane_destroy, - .atomic_duplicate_state = intel_plane_duplicate_state, - .atomic_destroy_state = intel_plane_destroy_state, - .format_mod_supported = i965_plane_format_mod_supported, -}; - -static const struct drm_plane_funcs i8xx_plane_funcs = { - .update_plane = drm_atomic_helper_update_plane, - .disable_plane = drm_atomic_helper_disable_plane, - .destroy = intel_plane_destroy, - .atomic_duplicate_state = intel_plane_duplicate_state, - .atomic_destroy_state = intel_plane_destroy_state, - .format_mod_supported = i8xx_plane_format_mod_supported, -}; - -static bool i9xx_plane_has_fbc (struct drm_i915_private *dev_priv, -enum i9xx_plane_id i9xx_plane) -{ -if (!HAS_FBC (dev_priv)) -return false; - -if (IS_BROADWELL (dev_priv) ||IS_HASWELL (dev_priv)) -return i9xx_plane ==PLANE_A ;/* tied to pipe A */ -else if (IS_IVYBRIDGE (dev_priv)) -return i9xx_plane ==PLANE_A || i9xx_plane ==PLANE_B || - i9xx_plane ==PLANE_C ; -else if (INTEL_GEN (dev_priv) >=4 ) -return i9xx_plane ==PLANE_A || i9xx_plane ==PLANE_B ; -else -return i9xx_plane ==PLANE_A ; -} - -static struct intel_plane * -intel_primary_plane_create (struct drm_i915_private *dev_priv,enum pipe pipe) -{ -struct intel_plane *plane; -const struct drm_plane_funcs *plane_funcs; -unsigned int supported_rotations; -const u32 *formats; -int num_formats; -int ret, zpos; - -if (INTEL_GEN (dev_priv) >=9 ) -return skl_universal_plane_create (dev_priv, pipe, -PLANE_PRIMARY ); - - plane =intel_plane_alloc (); -if (IS_ERR (plane)) -return plane; - - plane->pipe = pipe; -/* -* On gen2/3 only plane A can do FBC, but the panel fitter and LVDS -* port is hooked to pipe B. Hence we want plane A feeding pipe B. -*/ -if (HAS_FBC (dev_priv) &&INTEL_GEN (dev_priv) <4 && -INTEL_NUM_PIPES (dev_priv) ==2 ) - plane->i9xx_plane = (enum i9xx_plane_id ) !pipe; -else - plane->i9xx_plane = (enum i9xx_plane_id ) pipe; - plane->id =PLANE_PRIMARY ; - plane->frontbuffer_bit =INTEL_FRONTBUFFER (pipe, plane->id); - - plane->has_fbc =i9xx_plane_has_fbc (dev_priv, plane->i9xx_plane); -if (plane->has_fbc) { -struct intel_fbc *fbc = &dev_priv->fbc; - - fbc->possible_framebuffer_bits |= plane->frontbuffer_bit; - } - -if (IS_VALLEYVIEW (dev_priv) ||IS_CHERRYVIEW (dev_priv)) { - formats = vlv_primary_formats; - num_formats =ARRAY_SIZE (vlv_primary_formats); - }else if (INTEL_GEN (dev_priv) >=4 ) { -/* -* WaFP16GammaEnabling:ivb -* "Workaround : When using the 64-bit format, the plane -* output on each color channel has one quarter amplitude. -* It can be brought up to full amplitude by using pipe -* gamma correction or pipe color space conversion to -* multiply the plane output by four." -* -* There is no dedicated plane gamma for the primary plane, -* and using the pipe gamma/csc could conflict with other -* planes, so we choose not to expose fp16 on IVB primary -* planes. HSW primary planes no longer have this problem. -*/ -if (IS_IVYBRIDGE (dev_priv)) { - formats = ivb_primary_formats; - num_formats =ARRAY_SIZE (ivb_primary_formats); - }else { - formats = i965_primary_formats; - num_formats =ARRAY_SIZE (i965_primary_formats); - } - }else { - formats = i8xx_primary_formats; - num_formats =ARRAY_SIZE (i8xx_primary_formats); - } - -if (INTEL_GEN (dev_priv) >=4 ) - plane_funcs = &i965_plane_funcs; -else - plane_funcs = &i8xx_plane_funcs; - -if (IS_VALLEYVIEW (dev_priv) ||IS_CHERRYVIEW (dev_priv)) - plane->min_cdclk = vlv_plane_min_cdclk; -else if (IS_BROADWELL (dev_priv) ||IS_HASWELL (dev_priv)) - plane->min_cdclk = hsw_plane_min_cdclk; -else if (IS_IVYBRIDGE (dev_priv)) - plane->min_cdclk = ivb_plane_min_cdclk; -else - plane->min_cdclk = i9xx_plane_min_cdclk; - - plane->max_stride = i9xx_plane_max_stride; - plane->update_plane = i9xx_update_plane; - plane->disable_plane = i9xx_disable_plane; - plane->get_hw_state = i9xx_plane_get_hw_state; - plane->check_plane = i9xx_plane_check; - -if (INTEL_GEN (dev_priv) >=5 ||IS_G4X (dev_priv)) - ret =drm_universal_plane_init (&dev_priv->drm, &plane->base, -0 , plane_funcs, - formats, num_formats, - i9xx_format_modifiers, -DRM_PLANE_TYPE_PRIMARY , -"primary %c" ,pipe_name (pipe)); -else - ret =drm_universal_plane_init (&dev_priv->drm, &plane->base, -0 , plane_funcs, - formats, num_formats, - i9xx_format_modifiers, -DRM_PLANE_TYPE_PRIMARY , -"plane %c" , -plane_name (plane->i9xx_plane)); -if (ret) - goto fail; - -if (IS_CHERRYVIEW (dev_priv) && pipe ==PIPE_B ) { - supported_rotations = -DRM_MODE_ROTATE_0 |DRM_MODE_ROTATE_180 | -DRM_MODE_REFLECT_X ; - }else if (INTEL_GEN (dev_priv) >=4 ) { - supported_rotations = -DRM_MODE_ROTATE_0 |DRM_MODE_ROTATE_180 ; - }else { - supported_rotations =DRM_MODE_ROTATE_0 ; - } - -if (INTEL_GEN (dev_priv) >=4 ) -drm_plane_create_rotation_property (&plane->base, -DRM_MODE_ROTATE_0 , - supported_rotations); - - zpos =0 ; -drm_plane_create_zpos_immutable_property (&plane->base, zpos); - -drm_plane_helper_add (&plane->base, &intel_plane_helper_funcs); - -return plane; - -fail: -intel_plane_free (plane); - -return ERR_PTR (ret); -} - -static int intel_crtc_late_register (struct drm_crtc *crtc) -{ -intel_crtc_debugfs_add (crtc); -return 0 ; -} - -#define INTEL_CRTC_FUNCS \ - .gamma_set = drm_atomic_helper_legacy_gamma_set, \ - .set_config = drm_atomic_helper_set_config, \ - .destroy = intel_crtc_destroy, \ - .page_flip = drm_atomic_helper_page_flip, \ - .atomic_duplicate_state = intel_crtc_duplicate_state, \ - .atomic_destroy_state = intel_crtc_destroy_state, \ - .set_crc_source = intel_crtc_set_crc_source, \ - .verify_crc_source = intel_crtc_verify_crc_source, \ - .get_crc_sources = intel_crtc_get_crc_sources, \ - .late_register = intel_crtc_late_register - -static const struct drm_crtc_funcs bdw_crtc_funcs = { -INTEL_CRTC_FUNCS , - - .get_vblank_counter = g4x_get_vblank_counter, - .enable_vblank = bdw_enable_vblank, - .disable_vblank = bdw_disable_vblank, - .get_vblank_timestamp = intel_crtc_get_vblank_timestamp, -}; - -static const struct drm_crtc_funcs ilk_crtc_funcs = { -INTEL_CRTC_FUNCS , - - .get_vblank_counter = g4x_get_vblank_counter, - .enable_vblank = ilk_enable_vblank, - .disable_vblank = ilk_disable_vblank, - .get_vblank_timestamp = intel_crtc_get_vblank_timestamp, -}; - -static const struct drm_crtc_funcs g4x_crtc_funcs = { -INTEL_CRTC_FUNCS , - - .get_vblank_counter = g4x_get_vblank_counter, - .enable_vblank = i965_enable_vblank, - .disable_vblank = i965_disable_vblank, - .get_vblank_timestamp = intel_crtc_get_vblank_timestamp, -}; - -static const struct drm_crtc_funcs i965_crtc_funcs = { -INTEL_CRTC_FUNCS , - - .get_vblank_counter = i915_get_vblank_counter, - .enable_vblank = i965_enable_vblank, - .disable_vblank = i965_disable_vblank, - .get_vblank_timestamp = intel_crtc_get_vblank_timestamp, -}; - -static const struct drm_crtc_funcs i915gm_crtc_funcs = { -INTEL_CRTC_FUNCS , - - .get_vblank_counter = i915_get_vblank_counter, - .enable_vblank = i915gm_enable_vblank, - .disable_vblank = i915gm_disable_vblank, - .get_vblank_timestamp = intel_crtc_get_vblank_timestamp, -}; - -static const struct drm_crtc_funcs i915_crtc_funcs = { -INTEL_CRTC_FUNCS , - - .get_vblank_counter = i915_get_vblank_counter, - .enable_vblank = i8xx_enable_vblank, - .disable_vblank = i8xx_disable_vblank, - .get_vblank_timestamp = intel_crtc_get_vblank_timestamp, -}; - -static const struct drm_crtc_funcs i8xx_crtc_funcs = { -INTEL_CRTC_FUNCS , - -/* no hw vblank counter */ - .enable_vblank = i8xx_enable_vblank, - .disable_vblank = i8xx_disable_vblank, - .get_vblank_timestamp = intel_crtc_get_vblank_timestamp, -}; - -static struct intel_crtc *intel_crtc_alloc (void ) -{ -struct intel_crtc_state *crtc_state; -struct intel_crtc *crtc; - - crtc =kzalloc (sizeof (*crtc),GFP_KERNEL ); -if (!crtc) -return ERR_PTR (-ENOMEM ); - - crtc_state =intel_crtc_state_alloc (crtc); -if (!crtc_state) { -kfree (crtc); -return ERR_PTR (-ENOMEM ); - } - - crtc->base.state = &crtc_state->uapi; - crtc->config = crtc_state; - -return crtc; -} - -static void intel_crtc_free (struct intel_crtc *crtc) -{ -intel_crtc_destroy_state (&crtc->base, crtc->base.state); -kfree (crtc); -} -static void intel_plane_possible_crtcs_init (struct drm_i915_private *dev_priv) {struct intel_plane *plane;@@ -16591,100 +15753,6 @@ static void intel_plane_possible_crtcs_init(struct drm_i915_private *dev_priv) } } -static int intel_crtc_init (struct drm_i915_private *dev_priv,enum pipe pipe) -{ -struct intel_plane *primary, *cursor; -const struct drm_crtc_funcs *funcs; -struct intel_crtc *crtc; -int sprite, ret; - - crtc =intel_crtc_alloc (); -if (IS_ERR (crtc)) -return PTR_ERR (crtc); - - crtc->pipe = pipe; - crtc->num_scalers =RUNTIME_INFO (dev_priv)->num_scalers[pipe]; - - primary =intel_primary_plane_create (dev_priv, pipe); -if (IS_ERR (primary)) { - ret =PTR_ERR (primary); - goto fail; - } - crtc->plane_ids_mask |=BIT (primary->id); - -for_each_sprite (dev_priv, pipe, sprite) { -struct intel_plane *plane; - - plane =intel_sprite_plane_create (dev_priv, pipe, sprite); -if (IS_ERR (plane)) { - ret =PTR_ERR (plane); - goto fail; - } - crtc->plane_ids_mask |=BIT (plane->id); - } - - cursor =intel_cursor_plane_create (dev_priv, pipe); -if (IS_ERR (cursor)) { - ret =PTR_ERR (cursor); - goto fail; - } - crtc->plane_ids_mask |=BIT (cursor->id); - -if (HAS_GMCH (dev_priv)) { -if (IS_CHERRYVIEW (dev_priv) || -IS_VALLEYVIEW (dev_priv) ||IS_G4X (dev_priv)) - funcs = &g4x_crtc_funcs; -else if (IS_GEN (dev_priv,4 )) - funcs = &i965_crtc_funcs; -else if (IS_I945GM (dev_priv) ||IS_I915GM (dev_priv)) - funcs = &i915gm_crtc_funcs; -else if (IS_GEN (dev_priv,3 )) - funcs = &i915_crtc_funcs; -else - funcs = &i8xx_crtc_funcs; - }else { -if (INTEL_GEN (dev_priv) >=8 ) - funcs = &bdw_crtc_funcs; -else - funcs = &ilk_crtc_funcs; - } - - ret =drm_crtc_init_with_planes (&dev_priv->drm, &crtc->base, - &primary->base, &cursor->base, - funcs,"pipe %c" ,pipe_name (pipe)); -if (ret) - goto fail; - -BUG_ON (pipe >=ARRAY_SIZE (dev_priv->pipe_to_crtc_mapping) || - dev_priv->pipe_to_crtc_mapping[pipe] !=NULL ); - dev_priv->pipe_to_crtc_mapping[pipe] = crtc; - -if (INTEL_GEN (dev_priv) <9 ) { -enum i9xx_plane_id i9xx_plane = primary->i9xx_plane; - -BUG_ON (i9xx_plane >=ARRAY_SIZE (dev_priv->plane_to_crtc_mapping) || - dev_priv->plane_to_crtc_mapping[i9xx_plane] !=NULL ); - dev_priv->plane_to_crtc_mapping[i9xx_plane] = crtc; - } - -if (INTEL_GEN (dev_priv) >=10 ) -drm_crtc_create_scaling_filter_property (&crtc->base, -BIT (DRM_SCALING_FILTER_DEFAULT ) | -BIT (DRM_SCALING_FILTER_NEAREST_NEIGHBOR )); - -intel_color_init (crtc); - -intel_crtc_crc_init (crtc); - -drm_WARN_ON (&dev_priv->drm,drm_crtc_index (&crtc->base) != crtc->pipe); - -return 0 ; - -fail: -intel_crtc_free (crtc); - -return ret; -}int intel_get_pipe_from_crtc_id_ioctl (struct drm_device *dev,void *data,struct drm_file *file)drivers/gpu/drm/i915/display/intel_display.h +7
-0@@ -659,6 +659,13 @@ struct intel_plane * intel_cursor_plane_create(struct drm_i915_private *dev_priv, enum pipe pipe); +/* crtc */ +u32 intel_crtc_max_vblank_count (const struct intel_crtc_state *crtc_state); +int intel_crtc_init (struct drm_i915_private *dev_priv,enum pipe pipe); +struct intel_crtc_state *intel_crtc_state_alloc (struct intel_crtc *crtc); +void intel_crtc_state_reset (struct intel_crtc_state *crtc_state, +struct intel_crtc *crtc); +/* modesetting */ void intel_modeset_init_hw (struct drm_i915_private *i915);int intel_modeset_init_noirq (struct drm_i915_private *i915);Signature · 6 lines
2.27.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 6 lines
Ville Syrjälä Intel _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Dave Airlie
maintainerPATCH 6/9 drm/i915: refactor pll code out into intel_dpll_legacy.c
In reply to Dave AirlieFrom: Dave Airlie <[email protected]>
This pulls a large chunk of the pll calculation code out of intel_display.c to a new file.
One function makse sense to be an inline, otherwise this is pretty much a straight copy cover. also all the remaining hooks for g45 and older end up the same now.
--- drivers/gpu/drm/i915/Makefile | 1 + drivers/gpu/drm/i915/display/intel_display.c | 1393 +---------------- drivers/gpu/drm/i915/display/intel_display.h | 13 +- .../drm/i915/display/intel_display_types.h | 5 + .../gpu/drm/i915/display/intel_dpll_legacy.c | 1370 ++++++++++++++++ 5 files changed, 1398 insertions(+), 1384 deletions(-) create mode 100644 drivers/gpu/drm/i915/display/intel_dpll_legacy.c
drivers/gpu/drm/i915/Makefile +1 -0
@@ -202,6 +202,7 @@ i915-y += \ display/intel_display.o \ display/intel_display_power.o \ display/intel_dpio_phy.o \ + display/intel_dpll_legacy.o \ display/intel_dpll_mgr.o \ display/intel_dsb.o \ display/intel_fbc.o \
drivers/gpu/drm/i915/display/intel_display.c +10 -1383
1,485 lines not on this page · raw message
drivers/gpu/drm/i915/display/intel_display.h +12 -1
@@ -653,7 +653,9 @@ u32 intel_plane_compute_aligned_offset(int *x, int *y, int color_plane);int intel_plane_pin_fb (struct intel_plane_state *plane_state);void intel_plane_unpin_fb (struct intel_plane_state *old_plane_state); - +struct intel_encoder * +intel_get_crtc_new_encoder (const struct intel_atomic_state *state, +const struct intel_crtc_state *crtc_state);/* cursor */ struct intel_plane * intel_cursor_plane_create(struct drm_i915_private *dev_priv,
@@ -665,6 +667,15 @@ int intel_crtc_init(struct drm_i915_private *dev_priv, enum pipe pipe);struct intel_crtc_state *intel_crtc_state_alloc (struct intel_crtc *crtc);void intel_crtc_state_reset (struct intel_crtc_state *crtc_state,struct intel_crtc *crtc); +/* clock */ +void intel_init_clock_hook (struct drm_i915_private *dev_priv); +int vlv_calc_dpll_params (int refclk,struct dpll *clock); +int pnv_calc_dpll_params (int refclk,struct dpll *clock); +int i9xx_calc_dpll_params (int refclk,struct dpll *clock); +void vlv_compute_dpll (struct intel_crtc *crtc, +struct intel_crtc_state *pipe_config); +void chv_compute_dpll (struct intel_crtc *crtc, +struct intel_crtc_state *pipe_config);/* modesetting */ void intel_modeset_init_hw (struct drm_i915_private *i915);
drivers/gpu/drm/i915/display/intel_display_types.h +5 -0
@@ -1811,4 +1811,9 @@ to_intel_frontbuffer(struct drm_framebuffer *fb) return fb ? to_intel_framebuffer(fb)->frontbuffer : NULL; } +static inline u32 i9xx_dpll_compute_fp (struct dpll *dpll) +{ +return dpll->n <<16 | dpll->m1 <<8 | dpll->m2; +} +#endif /* __INTEL_DISPLAY_TYPES_H__ */
drivers/gpu/drm/i915/display/intel_dpll_legacy.c new file +1370 -0
1,370 lines not on this page · raw message
Signature · 6 lines
2.27.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH 6/9] drm/i915: refactor pll code out into intel_dpll_legacy.c
Quoted 19 lines · Dave Airlie
From: Dave Airlie <[email protected]>
This pulls a large chunk of the pll calculation code out of
intel_display.cto a new file.One function makse sense to be an inline, otherwise this is pretty much a straight copy cover. also all the remaining hooks for g45 and older end up the same now.
Signed-off-by Dave Airlie <[email protected]>--- drivers/gpu/drm/i915/Makefile | 1 + drivers/gpu/drm/i915/display/intel_display.c | 1393 +---------------- drivers/gpu/drm/i915/display/intel_display.h | 13 +- .../drm/i915/display/intel_display_types.h | 5 + .../gpu/drm/i915/display/intel_dpll_legacy.c | 1370 ++++++++++++++++ 5 files changed, 1398 insertions(+), 1384 deletions(-) create mode 100644 drivers/gpu/drm/i915/display/intel_dpll_legacy.c
<snip>
Quoted 12 lines
drivers/gpu/drm/i915/display/intel_dpll_legacy.c new file +12
-0+static int hsw_crtc_compute_clock (struct intel_crtc *crtc, +struct intel_crtc_state *crtc_state) +{ +struct drm_i915_private *dev_priv =to_i915 (crtc->base.dev); +struct intel_atomic_state *state = +to_intel_atomic_state (crtc_state->uapi.state); + +if (!intel_crtc_has_type (crtc_state,INTEL_OUTPUT_DSI ) || +INTEL_GEN (dev_priv) >=11 ) { +struct intel_encoder *encoder = +intel_get_crtc_new_encoder (state, crtc_state); +
drivers/gpu/drm/i915/display/intel_dpll_legacy.c line 947
Quoted 10 lines
drivers/gpu/drm/i915/display/intel_dpll_legacy.c new file +10
-0+if (!intel_reserve_shared_dplls (state, crtc, encoder)) { +drm_dbg_kms (&dev_priv->drm, +"failed to find PLL for pipe %c\n" , +pipe_name (crtc->pipe)); +return -EINVAL ; + } + } + +return 0 ; +}
If you're moving this then the "legacy" in the fine name is just wrong. I guess just call it intel_dpll.c if we lack a better idea?
Signature · 6 lines
Ville Syrjälä Intel _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH 6/9] drm/i915: refactor pll code out into intel_dpll_legacy.c
Quoted 39 lines · Ville Syrjälä
Quoted 19 lines · Dave Airlie
From: Dave Airlie <[email protected]>
This pulls a large chunk of the pll calculation code out of
intel_display.cto a new file.One function makse sense to be an inline, otherwise this is pretty much a straight copy cover. also all the remaining hooks for g45 and older end up the same now.
Signed-off-by Dave Airlie <[email protected]>--- drivers/gpu/drm/i915/Makefile | 1 + drivers/gpu/drm/i915/display/intel_display.c | 1393 +---------------- drivers/gpu/drm/i915/display/intel_display.h | 13 +- .../drm/i915/display/intel_display_types.h | 5 + .../gpu/drm/i915/display/intel_dpll_legacy.c | 1370 ++++++++++++++++ 5 files changed, 1398 insertions(+), 1384 deletions(-) create mode 100644 drivers/gpu/drm/i915/display/intel_dpll_legacy.c<snip>
Quoted 17 lines
drivers/gpu/drm/i915/display/intel_dpll_legacy.c new file +17
-0+static int hsw_crtc_compute_clock (struct intel_crtc *crtc, +struct intel_crtc_state *crtc_state) +{ +struct drm_i915_private *dev_priv =to_i915 (crtc->base.dev); +struct intel_atomic_state *state = +to_intel_atomic_state (crtc_state->uapi.state); + +if (!intel_crtc_has_type (crtc_state,INTEL_OUTPUT_DSI ) || +INTEL_GEN (dev_priv) >=11 ) { +struct intel_encoder *encoder = +intel_get_crtc_new_encoder (state, crtc_state); + +if (!intel_reserve_shared_dplls (state, crtc, encoder)) { +drm_dbg_kms (&dev_priv->drm, +"failed to find PLL for pipe %c\n" , +pipe_name (crtc->pipe)); +return -EINVAL ;
Quoted 8 lines
drivers/gpu/drm/i915/display/intel_dpll_legacy.c line 330
Quoted 5 lines
drivers/gpu/drm/i915/display/intel_dpll_legacy.c new file +5
-0+ } + } + +return 0 ; +}If you're moving this then the "legacy" in the fine name is just wrong. I guess just call it
intel_dpll.cif we lack a better idea?
Ah yes I missed that it's also pulling the ilk/hsw stuff which uses the intel_dpll_mgr.c stuff. Probably more splitting to do eventually, but just intel_dpll.c sounds reasonable for now.
-Daniel
Quoted 8 lines
--
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Dave Airlie
maintainerPATCH 7/9 drm/i915: split fdi code out from intel_display.c
In reply to Dave AirlieFrom: Dave Airlie <[email protected]>
This just refactors out the fdi code to a separate file.
--- drivers/gpu/drm/i915/Makefile | 1 + drivers/gpu/drm/i915/display/intel_display.c | 684 +----------------- drivers/gpu/drm/i915/display/intel_display.h | 10 + .../drm/i915/display/intel_display_types.h | 9 + drivers/gpu/drm/i915/display/intel_fdi.c | 682 +++++++++++++++++ 5 files changed, 704 insertions(+), 682 deletions(-) create mode 100644 drivers/gpu/drm/i915/display/intel_fdi.c
drivers/gpu/drm/i915/Makefile +1 -0
@@ -206,6 +206,7 @@ i915-y += \ display/intel_dpll_mgr.o \ display/intel_dsb.o \ display/intel_fbc.o \ + display/intel_fdi.o \ display/intel_fifo_underrun.o \ display/intel_frontbuffer.o \ display/intel_global_state.o \
drivers/gpu/drm/i915/display/intel_display.c +2 -682
714 lines not on this page · raw message
drivers/gpu/drm/i915/display/intel_display.h +10 -0
@@ -677,6 +677,16 @@ void vlv_compute_dpll(struct intel_crtc *crtc,void chv_compute_dpll (struct intel_crtc *crtc,struct intel_crtc_state *pipe_config); +/* fdi */ +#define I915_DISPLAY_CONFIG_RETRY 1 +int ilk_fdi_compute_config (struct intel_crtc *intel_crtc, +struct intel_crtc_state *pipe_config); +void intel_fdi_normal_train (struct intel_crtc *crtc); +void ilk_fdi_disable (struct intel_crtc *crtc); +void ilk_fdi_pll_disable (struct intel_crtc *intel_crtc); +void ilk_fdi_pll_enable (const struct intel_crtc_state *crtc_state); +void intel_init_fdi_hook (struct drm_i915_private *dev_priv); +/* modesetting */ void intel_modeset_init_hw (struct drm_i915_private *i915);int intel_modeset_init_noirq (struct drm_i915_private *i915);
drivers/gpu/drm/i915/display/intel_display_types.h +9 -0
@@ -1816,4 +1816,13 @@ static inline u32 i9xx_dpll_compute_fp(struct dpll *dpll) return dpll->n << 16 | dpll->m1 << 8 | dpll->m2; } +static inline u32 intel_fdi_link_freq (struct drm_i915_private *dev_priv, +const struct intel_crtc_state *pipe_config) +{ +if (HAS_DDI (dev_priv)) +return pipe_config->port_clock;/* SPLL */ +else +return dev_priv->fdi_pll_freq; +} +#endif /* __INTEL_DISPLAY_TYPES_H__ */
drivers/gpu/drm/i915/display/intel_fdi.c new file +682 -0
682 lines not on this page · raw message
Signature · 6 lines
2.27.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Dave Airlie
maintainerPATCH 8/9 drm/i915: migrate hsw fdi code to new file.
In reply to Dave AirlieFrom: Dave Airlie <[email protected]>
Daniel asked for this, but it's a bit messy and I'm not sure how best to clean it up yet.
--- drivers/gpu/drm/i915/display/intel_ddi.c | 151 +------------------ drivers/gpu/drm/i915/display/intel_ddi.h | 14 +- drivers/gpu/drm/i915/display/intel_display.h | 2 + drivers/gpu/drm/i915/display/intel_fdi.c | 147 ++++++++++++++++++ 4 files changed, 166 insertions(+), 148 deletions(-)
drivers/gpu/drm/i915/display/intel_ddi.c +5 -146
@@ -51,12 +51,6 @@#include "intel_tc.h" #include "intel_vdsc.h" -struct ddi_buf_trans { -u32 trans1;/* balance leg enable, de-emph level */ -u32 trans2;/* vref sel, vswing */ -u8 i_boost;/* SKL: I_boost; valid: 0x0, 0x1, 0x3, 0x7 */ -}; -static const u8 index_to_dp_signal_levels[] = { [0 ] =DP_TRAIN_VOLTAGE_SWING_LEVEL_0 |DP_TRAIN_PRE_EMPH_LEVEL_0 , [1 ] =DP_TRAIN_VOLTAGE_SWING_LEVEL_0 |DP_TRAIN_PRE_EMPH_LEVEL_1 ,
@@ -1398,8 +1392,8 @@ static int intel_ddi_hdmi_level(struct intel_encoder *encoder,* values in advance. This function programs the correct values for * DP/eDP/FDI use cases. */ -static void intel_prepare_dp_ddi_buffers (struct intel_encoder *encoder, -const struct intel_crtc_state *crtc_state) +void intel_prepare_dp_ddi_buffers (struct intel_encoder *encoder, +const struct intel_crtc_state *crtc_state) {struct drm_i915_private *dev_priv =to_i915 (encoder->base.dev);u32 iboost_bit =0 ;
@@ -1461,8 +1455,8 @@ static void intel_prepare_hdmi_ddi_buffers(struct intel_encoder *encoder, ddi_translations[level].trans2); } -static void intel_wait_ddi_buf_idle (struct drm_i915_private *dev_priv, -enum port port) +void intel_wait_ddi_buf_idle (struct drm_i915_private *dev_priv, +enum port port) {if (IS_BROXTON (dev_priv)) {udelay (16 );
@@ -1490,7 +1484,7 @@ static void intel_wait_ddi_buf_active(struct drm_i915_private *dev_priv, port_name(port)); } -static u32 hsw_pll_to_ddi_pll_sel (const struct intel_shared_dpll *pll) +u32 hsw_pll_to_ddi_pll_sel (const struct intel_shared_dpll *pll) {switch (pll->info->id) {case DPLL_ID_WRPLL1 :
@@ -1550,141 +1544,6 @@ static u32 icl_pll_to_ddi_clk_sel(struct intel_encoder *encoder, } } -/* Starting with Haswell, different DDI ports can work in FDI mode for -* connection to the PCH-located connectors. For this, it is necessary to train -* both the DDI port and PCH receiver for the desired DDI buffer settings. -* -* The recommended port to work in FDI mode is DDI E, which we use here. Also, -* please note that when FDI mode is active on DDI E, it shares 2 lines with -* DDI A (which is used for eDP) -*/ - -void hsw_fdi_link_train (struct intel_encoder *encoder, -const struct intel_crtc_state *crtc_state) -{ -struct intel_crtc *crtc =to_intel_crtc (crtc_state->uapi.crtc); -struct drm_i915_private *dev_priv =to_i915 (crtc->base.dev); -u32 temp, i, rx_ctl_val, ddi_pll_sel; - -intel_prepare_dp_ddi_buffers (encoder, crtc_state); - -/* Set the FDI_RX_MISC pwrdn lanes and the 2 workarounds listed at the -* mode set "sequence for CRT port" document: -* - TP1 to TP2 time with the default value -* - FDI delay to 90h -* -* WaFDIAutoLinkSetTimingOverrride:hsw -*/ -intel_de_write (dev_priv,FDI_RX_MISC (PIPE_A ), -FDI_RX_PWRDN_LANE1_VAL (2 ) |FDI_RX_PWRDN_LANE0_VAL (2 ) |FDI_RX_TP1_TO_TP2_48 |FDI_RX_FDI_DELAY_90 ); - -/* Enable the PCH Receiver FDI PLL */ - rx_ctl_val = dev_priv->fdi_rx_config |FDI_RX_ENHANCE_FRAME_ENABLE | -FDI_RX_PLL_ENABLE | -FDI_DP_PORT_WIDTH (crtc_state->fdi_lanes); -intel_de_write (dev_priv,FDI_RX_CTL (PIPE_A ), rx_ctl_val); -intel_de_posting_read (dev_priv,FDI_RX_CTL (PIPE_A )); -udelay (220 ); - -/* Switch from Rawclk to PCDclk */ - rx_ctl_val |=FDI_PCDCLK ; -intel_de_write (dev_priv,FDI_RX_CTL (PIPE_A ), rx_ctl_val); - -/* Configure Port Clock Select */ - ddi_pll_sel =hsw_pll_to_ddi_pll_sel (crtc_state->shared_dpll); -intel_de_write (dev_priv,PORT_CLK_SEL (PORT_E ), ddi_pll_sel); -drm_WARN_ON (&dev_priv->drm, ddi_pll_sel !=PORT_CLK_SEL_SPLL ); - -/* Start the training iterating through available voltages and emphasis, -* testing each value twice. */ -for (i =0 ; i <ARRAY_SIZE (hsw_ddi_translations_fdi) *2 ; i++) { -/* Configure DP_TP_CTL with auto-training */ -intel_de_write (dev_priv,DP_TP_CTL (PORT_E ), -DP_TP_CTL_FDI_AUTOTRAIN | -DP_TP_CTL_ENHANCED_FRAME_ENABLE | -DP_TP_CTL_LINK_TRAIN_PAT1 | -DP_TP_CTL_ENABLE ); - -/* Configure and enable DDI_BUF_CTL for DDI E with next voltage. -* DDI E does not support port reversal, the functionality is -* achieved on the PCH side in FDI_RX_CTL, so no need to set the -* port reversal bit */ -intel_de_write (dev_priv,DDI_BUF_CTL (PORT_E ), -DDI_BUF_CTL_ENABLE | ((crtc_state->fdi_lanes -1 ) <<1 ) |DDI_BUF_TRANS_SELECT (i /2 )); -intel_de_posting_read (dev_priv,DDI_BUF_CTL (PORT_E )); - -udelay (600 ); - -/* Program PCH FDI Receiver TU */ -intel_de_write (dev_priv,FDI_RX_TUSIZE1 (PIPE_A ),TU_SIZE (64 )); - -/* Enable PCH FDI Receiver with auto-training */ - rx_ctl_val |=FDI_RX_ENABLE |FDI_LINK_TRAIN_AUTO ; -intel_de_write (dev_priv,FDI_RX_CTL (PIPE_A ), rx_ctl_val); -intel_de_posting_read (dev_priv,FDI_RX_CTL (PIPE_A )); - -/* Wait for FDI receiver lane calibration */ -udelay (30 ); - -/* Unset FDI_RX_MISC pwrdn lanes */ - temp =intel_de_read (dev_priv,FDI_RX_MISC (PIPE_A )); - temp &= ~(FDI_RX_PWRDN_LANE1_MASK |FDI_RX_PWRDN_LANE0_MASK ); -intel_de_write (dev_priv,FDI_RX_MISC (PIPE_A ), temp); -intel_de_posting_read (dev_priv,FDI_RX_MISC (PIPE_A )); - -/* Wait for FDI auto training time */ -udelay (5 ); - - temp =intel_de_read (dev_priv,DP_TP_STATUS (PORT_E )); -if (temp &DP_TP_STATUS_AUTOTRAIN_DONE ) { -drm_dbg_kms (&dev_priv->drm, -"FDI link training done on step %d\n" , i); -break ; - } - -/* -* Leave things enabled even if we failed to train FDI. -* Results in less fireworks from the state checker. -*/ -if (i ==ARRAY_SIZE (hsw_ddi_translations_fdi) *2 -1 ) { -drm_err (&dev_priv->drm,"FDI link training failed!\n" ); -break ; - } - - rx_ctl_val &= ~FDI_RX_ENABLE ; -intel_de_write (dev_priv,FDI_RX_CTL (PIPE_A ), rx_ctl_val); -intel_de_posting_read (dev_priv,FDI_RX_CTL (PIPE_A )); - - temp =intel_de_read (dev_priv,DDI_BUF_CTL (PORT_E )); - temp &= ~DDI_BUF_CTL_ENABLE ; -intel_de_write (dev_priv,DDI_BUF_CTL (PORT_E ), temp); -intel_de_posting_read (dev_priv,DDI_BUF_CTL (PORT_E )); - -/* Disable DP_TP_CTL and FDI_RX_CTL and retry */ - temp =intel_de_read (dev_priv,DP_TP_CTL (PORT_E )); - temp &= ~(DP_TP_CTL_ENABLE |DP_TP_CTL_LINK_TRAIN_MASK ); - temp |=DP_TP_CTL_LINK_TRAIN_PAT1 ; -intel_de_write (dev_priv,DP_TP_CTL (PORT_E ), temp); -intel_de_posting_read (dev_priv,DP_TP_CTL (PORT_E )); - -intel_wait_ddi_buf_idle (dev_priv,PORT_E ); - -/* Reset FDI_RX_MISC pwrdn lanes */ - temp =intel_de_read (dev_priv,FDI_RX_MISC (PIPE_A )); - temp &= ~(FDI_RX_PWRDN_LANE1_MASK |FDI_RX_PWRDN_LANE0_MASK ); - temp |=FDI_RX_PWRDN_LANE1_VAL (2 ) |FDI_RX_PWRDN_LANE0_VAL (2 ); -intel_de_write (dev_priv,FDI_RX_MISC (PIPE_A ), temp); -intel_de_posting_read (dev_priv,FDI_RX_MISC (PIPE_A )); - } - -/* Enable normal pixel sending for FDI */ -intel_de_write (dev_priv,DP_TP_CTL (PORT_E ), -DP_TP_CTL_FDI_AUTOTRAIN | -DP_TP_CTL_LINK_TRAIN_NORMAL | -DP_TP_CTL_ENHANCED_FRAME_ENABLE | -DP_TP_CTL_ENABLE ); -} -static void intel_ddi_init_dp_buf_reg (struct intel_encoder *encoder,const struct intel_crtc_state *crtc_state) {
drivers/gpu/drm/i915/display/intel_ddi.h +12 -2
@@ -9,6 +9,12 @@#include "intel_display.h" #include "i915_reg.h" +struct ddi_buf_trans { +u32 trans1;/* balance leg enable, de-emph level */ +u32 trans2;/* vref sel, vswing */ +u8 i_boost;/* SKL: I_boost; valid: 0x0, 0x1, 0x3, 0x7 */ +}; +struct drm_connector_state ;struct drm_i915_private ;struct intel_connector ;
@@ -17,6 +23,7 @@ struct intel_crtc_state;struct intel_dp ;struct intel_dpll_hw_state ;struct intel_encoder ; +struct intel_shared_dpll ;enum transcoder ; i915_reg_t dp_tp_ctl_reg(struct intel_encoder *encoder,
@@ -27,8 +34,11 @@ void intel_ddi_fdi_post_disable(struct intel_atomic_state *state,struct intel_encoder *intel_encoder, const struct intel_crtc_state *old_crtc_state, const struct drm_connector_state *old_conn_state); -void hsw_fdi_link_train (struct intel_encoder *encoder, -const struct intel_crtc_state *crtc_state); +u32 hsw_pll_to_ddi_pll_sel (const struct intel_shared_dpll *pll); +void intel_prepare_dp_ddi_buffers (struct intel_encoder *encoder, +const struct intel_crtc_state *crtc_state); +void intel_wait_ddi_buf_idle (struct drm_i915_private *dev_priv, +enum port port);void intel_ddi_init (struct drm_i915_private *dev_priv,enum port port);bool intel_ddi_get_hw_state (struct intel_encoder *encoder,enum pipe *pipe); void intel_ddi_enable_transcoder_func(struct intel_encoder *encoder,
drivers/gpu/drm/i915/display/intel_display.h +2 -0
@@ -686,6 +686,8 @@ void ilk_fdi_disable(struct intel_crtc *crtc);void ilk_fdi_pll_disable (struct intel_crtc *intel_crtc);void ilk_fdi_pll_enable (const struct intel_crtc_state *crtc_state);void intel_init_fdi_hook (struct drm_i915_private *dev_priv); +void hsw_fdi_link_train (struct intel_encoder *encoder, +const struct intel_crtc_state *crtc_state);/* modesetting */ void intel_modeset_init_hw (struct drm_i915_private *i915);
drivers/gpu/drm/i915/display/intel_fdi.c +147 -0
159 lines not on this page · raw message
Signature · 6 lines
2.27.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Dave Airlie
maintainerPATCH 9/9 drm/i915: migrate skl planes code new file
In reply to Dave AirlieFrom: Dave Airlie <[email protected]>
rework the plane init calls to do the gen test one level higher.
--- drivers/gpu/drm/i915/Makefile | 1 + drivers/gpu/drm/i915/display/intel_crtc.c | 16 +- .../gpu/drm/i915/display/intel_gen9_plane.c | 1427 +++++++++++++++++ drivers/gpu/drm/i915/display/intel_sprite.c | 1417 +--------------- 4 files changed, 1449 insertions(+), 1412 deletions(-) create mode 100644 drivers/gpu/drm/i915/display/intel_gen9_plane.c
drivers/gpu/drm/i915/Makefile +1 -0
@@ -210,6 +210,7 @@ i915-y += \ display/intel_fifo_underrun.o \ display/intel_frontbuffer.o \ display/intel_global_state.o \ + display/intel_gen9_plane.o \ display/intel_hdcp.o \ display/intel_hotplug.o \ display/intel_lpe_audio.o \
drivers/gpu/drm/i915/display/intel_crtc.c +10 -6
@@ -615,10 +615,6 @@ intel_primary_plane_create(struct drm_i915_private *dev_priv, enum pipe pipe)int num_formats;int ret, zpos; -if (INTEL_GEN (dev_priv) >=9 ) -return skl_universal_plane_create (dev_priv, pipe, -PLANE_PRIMARY ); - plane =intel_plane_alloc ();if (IS_ERR (plane))return plane;
@@ -869,7 +865,11 @@ int intel_crtc_init(struct drm_i915_private *dev_priv, enum pipe pipe) crtc->pipe = pipe; crtc->num_scalers =RUNTIME_INFO (dev_priv)->num_scalers[pipe]; - primary =intel_primary_plane_create (dev_priv, pipe); +if (INTEL_GEN (dev_priv) >=9 ) + primary =skl_universal_plane_create (dev_priv, pipe, +PLANE_PRIMARY ); +else + primary =intel_primary_plane_create (dev_priv, pipe);if (IS_ERR (primary)) { ret =PTR_ERR (primary); goto fail;
@@ -879,7 +879,11 @@ int intel_crtc_init(struct drm_i915_private *dev_priv, enum pipe pipe)for_each_sprite (dev_priv, pipe, sprite) {struct intel_plane *plane; - plane =intel_sprite_plane_create (dev_priv, pipe, sprite); +if (INTEL_GEN (dev_priv) >=9 ) + plane =skl_universal_plane_create (dev_priv, pipe, +PLANE_SPRITE0 + sprite); +else + plane =intel_sprite_plane_create (dev_priv, pipe, sprite);if (IS_ERR (plane)) { ret =PTR_ERR (plane); goto fail;
drivers/gpu/drm/i915/display/intel_gen9_plane.c new file +1427 -0
1,427 lines not on this page · raw message
drivers/gpu/drm/i915/display/intel_sprite.c +11 -1406
1,487 lines not on this page · raw message
Signature · 6 lines
2.27.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI[Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for series starting with [1/9] drm/i915/display: move needs_modeset to an inline in header
In reply to Dave Airlie== Series Details ==
== Series Details ==
Series: series starting with [1/9] drm/i915/display: move needs_modeset to an inline in header
URL : https://patchwork.freedesktop.org/series/84761/
State : warning
== Summary ==
$ dim checkpatch origin/drm-tip ee7dca5fec1e drm/i915/display: move needs_modeset to an inline in header f7906d61c852 drm/i915/display: move to_intel_frontbuffer to header 89c17eeef1fa drm/i915/display: fix misused comma e673ce40272b drm/i915: refactor cursor code out of i915_display.c -:24: WARNING:FILE_PATH_CHANGES: added, moved or deleted file(s), does MAINTAINERS need updating? #24: new file mode 100644
-:522: WARNING:UNSPECIFIED_INT: Prefer 'unsigned int' to bare use of 'unsigned' #522: FILE: drivers/gpu/drm/i915/display/intel_cursor.c:494:
+ unsigned width = drm_rect_width(&plane_state->uapi.dst);
-:523: WARNING:UNSPECIFIED_INT: Prefer 'unsigned int' to bare use of 'unsigned' #523: FILE: drivers/gpu/drm/i915/display/intel_cursor.c:495:
+ unsigned height = drm_rect_height(&plane_state->uapi.dst);
-:552: WARNING:REPEATED_WORD: Possible repeated word: 'by' #552: FILE: drivers/gpu/drm/i915/display/intel_cursor.c:524:
+ * The other registers are armed by by the CURBASE write
-:779: CHECK:SPACING: No space is necessary after a cast #779: FILE: drivers/gpu/drm/i915/display/intel_cursor.c:751:
+ cursor->i9xx_plane = (enum i9xx_plane_id) pipe;
total: 0 errors, 4 warnings, 1 checks, 1680 lines checkedcda39caa4c68 drm/i915: refactor some crtc code out of intel display.
-:26: WARNING:FILE_PATH_CHANGES: added, moved or deleted file(s), does MAINTAINERS need updating? #26:
new file mode 100644
-:601: CHECK:SPACING: spaces preferred around that '*' (ctx:VxV) #601: FILE: drivers/gpu/drm/i915/display/intel_crtc.c:571:
+ return 32*1024;
^
-:604: CHECK:SPACING: spaces preferred around that '*' (ctx:VxV) #604: FILE: drivers/gpu/drm/i915/display/intel_crtc.c:574:
+ return 16*1024;
^
-:606: CHECK:SPACING: spaces preferred around that '*' (ctx:VxV) #606: FILE: drivers/gpu/drm/i915/display/intel_crtc.c:576:
+ return 32*1024;
^
-:609: CHECK:SPACING: spaces preferred around that '*' (ctx:VxV) #609: FILE: drivers/gpu/drm/i915/display/intel_crtc.c:579:
+ return 8*1024;
^
-:611: CHECK:SPACING: spaces preferred around that '*' (ctx:VxV) #611: FILE: drivers/gpu/drm/i915/display/intel_crtc.c:581:
+ return 16*1024;
^
-:614: CHECK:SPACING: spaces preferred around that '*' (ctx:VxV) #614: FILE: drivers/gpu/drm/i915/display/intel_crtc.c:584:
+ return 4*1024;
^
-:616: CHECK:SPACING: spaces preferred around that '*' (ctx:VxV) #616: FILE: drivers/gpu/drm/i915/display/intel_crtc.c:586:
+ return 8*1024;
^
-:663: CHECK:SPACING: No space is necessary after a cast #663: FILE: drivers/gpu/drm/i915/display/intel_crtc.c:633:
+ plane->i9xx_plane = (enum i9xx_plane_id) !pipe;
-:665: CHECK:SPACING: No space is necessary after a cast #665: FILE: drivers/gpu/drm/i915/display/intel_crtc.c:635:
+ plane->i9xx_plane = (enum i9xx_plane_id) pipe;
-:952: WARNING:AVOID_BUG: Avoid crashing the kernel - try using WARN_ON & recovery code rather than BUG() or BUG_ON() #952: FILE: drivers/gpu/drm/i915/display/intel_crtc.c:922:
+ BUG_ON(pipe >= ARRAY_SIZE(dev_priv->pipe_to_crtc_mapping) ||
-:953: CHECK:COMPARISON_TO_NULL: Comparison to NULL could be written "dev_priv->pipe_to_crtc_mapping[pipe]" #953: FILE: drivers/gpu/drm/i915/display/intel_crtc.c:923:
+ dev_priv->pipe_to_crtc_mapping[pipe] != NULL);
-:959: WARNING:AVOID_BUG: Avoid crashing the kernel - try using WARN_ON & recovery code rather than BUG() or BUG_ON() #959: FILE: drivers/gpu/drm/i915/display/intel_crtc.c:929:
+ BUG_ON(i9xx_plane >= ARRAY_SIZE(dev_priv->plane_to_crtc_mapping) ||
-:960: CHECK:COMPARISON_TO_NULL: Comparison to NULL could be written "dev_priv->plane_to_crtc_mapping[i9xx_plane]" #960: FILE: drivers/gpu/drm/i915/display/intel_crtc.c:930:
+ dev_priv->plane_to_crtc_mapping[i9xx_plane] != NULL);
-:966: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #966: FILE: drivers/gpu/drm/i915/display/intel_crtc.c:936:
+ drm_crtc_create_scaling_filter_property(&crtc->base,
+ BIT(DRM_SCALING_FILTER_DEFAULT) |
total: 0 errors, 3 warnings, 12 checks, 1969 lines checked3a72e7ca995f drm/i915: refactor pll code out into intel_dpll_legacy.c
-:1574: WARNING:FILE_PATH_CHANGES: added, moved or deleted file(s), does MAINTAINERS need updating? #1574:
new file mode 100644
-:1594: CHECK:LOGICAL_CONTINUATIONS: Logical continuations should be on the previous line #1594: FILE: drivers/gpu/drm/i915/display/intel_dpll_legacy.c:16:
+ return dev_priv->vbt.lvds_use_ssc
+ && !(dev_priv->quirks & QUIRK_LVDS_SSC_DISABLE);
-:1607: CHECK:LINE_SPACING: Please use a blank line after function/struct/union/enum declarations #1607: FILE: drivers/gpu/drm/i915/display/intel_dpll_legacy.c:29:
+};
+static const struct intel_limit intel_limits_i8xx_dac = {
-:1672: CHECK:LINE_SPACING: Please don't use multiple blank lines #1672: FILE: drivers/gpu/drm/i915/display/intel_dpll_legacy.c:94:
+
+
-:2244: WARNING:LONG_LINE: line length of 103 exceeds 100 columns #2244: FILE: drivers/gpu/drm/i915/display/intel_dpll_legacy.c:666:
+ for (clock.m1 = limit->m1.min; clock.m1 <= limit->m1.max; clock.m1++) {
-:2315: CHECK:SPACING: spaces preferred around that '/' (ctx:VxV) #2315: FILE: drivers/gpu/drm/i915/display/intel_dpll_legacy.c:737:
+ if (m2 > INT_MAX/clock.m1)
^
-:2412: CHECK:BRACES: braces {} should be used on all arms of this statement #2412: FILE: drivers/gpu/drm/i915/display/intel_dpll_legacy.c:834:
+ if (IS_PINEVIEW(dev_priv))
[...]
+ else {
[...]
-:2414: CHECK:BRACES: Unbalanced braces around else statement #2414: FILE: drivers/gpu/drm/i915/display/intel_dpll_legacy.c:836:
+ else {
-:2532: CHECK:LINE_SPACING: Please don't use multiple blank lines #2532: FILE: drivers/gpu/drm/i915/display/intel_dpll_legacy.c:954:
+
+
total: 0 errors, 2 warnings, 7 checks, 2896 lines checked3f29deb02bb0 drm/i915: split fdi code out from intel_display.c
-:785: WARNING:FILE_PATH_CHANGES: added, moved or deleted file(s), does MAINTAINERS need updating? #785:
new file mode 100644
-:880: WARNING:AVOID_BUG: Avoid crashing the kernel - try using WARN_ON & recovery code rather than BUG() or BUG_ON() #880: FILE: drivers/gpu/drm/i915/display/intel_fdi.c:91:
+ BUG();
-:885: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #885: FILE: drivers/gpu/drm/i915/display/intel_fdi.c:96:
+int ilk_fdi_compute_config(struct intel_crtc *intel_crtc,
+ struct intel_crtc_state *pipe_config)
-:917: CHECK:SPACING: spaces preferred around that '*' (ctx:VxV) #917: FILE: drivers/gpu/drm/i915/display/intel_fdi.c:128:
+ if (ret == -EINVAL && pipe_config->pipe_bpp > 6*3) {
^
-:918: CHECK:SPACING: spaces preferred around that '*' (ctx:VxV) #918: FILE: drivers/gpu/drm/i915/display/intel_fdi.c:129:
+ pipe_config->pipe_bpp -= 2*3;
^
-:967: CHECK:USLEEP_RANGE: usleep_range is preferred over udelay; see Documentation/timers/timers-howto.rst #967: FILE: drivers/gpu/drm/i915/display/intel_fdi.c:178:
+ udelay(1000);
-:972: WARNING:LONG_LINE: line length of 103 exceeds 100 columns #972: FILE: drivers/gpu/drm/i915/display/intel_fdi.c:183:
+ intel_de_read(dev_priv, reg) | FDI_FS_ERRC_ENABLE | FDI_FE_ERRC_ENABLE);
-:989: WARNING:BLOCK_COMMENT_STYLE: Block comments use * on subsequent lines #989: FILE: drivers/gpu/drm/i915/display/intel_fdi.c:200:
+ /* Train 1: umask FDI RX Interrupt symbol_lock and bit_lock bit
+ for train result */
-:989: WARNING:BLOCK_COMMENT_STYLE: Block comments use a trailing */ on a separate line #989: FILE: drivers/gpu/drm/i915/display/intel_fdi.c:200:
+ for train result */
-:996: CHECK:USLEEP_RANGE: usleep_range is preferred over udelay; see Documentation/timers/timers-howto.rst #996: FILE: drivers/gpu/drm/i915/display/intel_fdi.c:207:
+ udelay(150);
-:1014: CHECK:USLEEP_RANGE: usleep_range is preferred over udelay; see Documentation/timers/timers-howto.rst #1014: FILE: drivers/gpu/drm/i915/display/intel_fdi.c:225:
+ udelay(150);
-:1050: CHECK:USLEEP_RANGE: usleep_range is preferred over udelay; see Documentation/timers/timers-howto.rst #1050: FILE: drivers/gpu/drm/i915/display/intel_fdi.c:261:
+ udelay(150);
-:1069: CHECK:BRACES: Blank lines aren't necessary before a close brace '}' #1069: FILE: drivers/gpu/drm/i915/display/intel_fdi.c:280:
+
+}
-:1089: WARNING:BLOCK_COMMENT_STYLE: Block comments use * on subsequent lines #1089: FILE: drivers/gpu/drm/i915/display/intel_fdi.c:300:
+ /* Train 1: umask FDI RX Interrupt symbol_lock and bit_lock bit
+ for train result */
-:1089: WARNING:BLOCK_COMMENT_STYLE: Block comments use a trailing */ on a separate line #1089: FILE: drivers/gpu/drm/i915/display/intel_fdi.c:300:
+ for train result */
-:1097: CHECK:USLEEP_RANGE: usleep_range is preferred over udelay; see Documentation/timers/timers-howto.rst #1097: FILE: drivers/gpu/drm/i915/display/intel_fdi.c:308:
+ udelay(150);
-:1126: CHECK:USLEEP_RANGE: usleep_range is preferred over udelay; see Documentation/timers/timers-howto.rst #1126: FILE: drivers/gpu/drm/i915/display/intel_fdi.c:337:
+ udelay(150);
-:1136: CHECK:USLEEP_RANGE: usleep_range is preferred over udelay; see Documentation/timers/timers-howto.rst #1136: FILE: drivers/gpu/drm/i915/display/intel_fdi.c:347:
+ udelay(500);
-:1149: CHECK:USLEEP_RANGE: usleep_range is preferred over udelay; see Documentation/timers/timers-howto.rst #1149: FILE: drivers/gpu/drm/i915/display/intel_fdi.c:360:
+ udelay(50);
-:1181: CHECK:USLEEP_RANGE: usleep_range is preferred over udelay; see Documentation/timers/timers-howto.rst #1181: FILE: drivers/gpu/drm/i915/display/intel_fdi.c:392:
+ udelay(150);
-:1191: CHECK:USLEEP_RANGE: usleep_range is preferred over udelay; see Documentation/timers/timers-howto.rst #1191: FILE: drivers/gpu/drm/i915/display/intel_fdi.c:402:
+ udelay(500);
-:1204: CHECK:USLEEP_RANGE: usleep_range is preferred over udelay; see Documentation/timers/timers-howto.rst #1204: FILE: drivers/gpu/drm/i915/display/intel_fdi.c:415:
+ udelay(50);
-:1226: WARNING:BLOCK_COMMENT_STYLE: Block comments use * on subsequent lines #1226: FILE: drivers/gpu/drm/i915/display/intel_fdi.c:437:
+ /* Train 1: umask FDI RX Interrupt symbol_lock and bit_lock bit
+ for train result */
-:1226: WARNING:BLOCK_COMMENT_STYLE: Block comments use a trailing */ on a separate line #1226: FILE: drivers/gpu/drm/i915/display/intel_fdi.c:437:
+ for train result */
-:1234: CHECK:USLEEP_RANGE: usleep_range is preferred over udelay; see Documentation/timers/timers-howto.rst #1234: FILE: drivers/gpu/drm/i915/display/intel_fdi.c:445:
+ udelay(150);
-:1262: CHECK:SPACING: spaces preferred around that '/' (ctx:VxV) #1262: FILE: drivers/gpu/drm/i915/display/intel_fdi.c:473:
+ temp |= snb_b_fdi_train_param[j/2];
^
-:1358: CHECK:USLEEP_RANGE: usleep_range is preferred over udelay; see Documentation/timers/timers-howto.rst #1358: FILE: drivers/gpu/drm/i915/display/intel_fdi.c:569:
+ udelay(200);
-:1365: CHECK:USLEEP_RANGE: usleep_range is preferred over udelay; see Documentation/timers/timers-howto.rst #1365: FILE: drivers/gpu/drm/i915/display/intel_fdi.c:576:
+ udelay(200);
-:1374: CHECK:USLEEP_RANGE: usleep_range is preferred over udelay; see Documentation/timers/timers-howto.rst #1374: FILE: drivers/gpu/drm/i915/display/intel_fdi.c:585:
+ udelay(100);
-:1397: CHECK:USLEEP_RANGE: usleep_range is preferred over udelay; see Documentation/timers/timers-howto.rst #1397: FILE: drivers/gpu/drm/i915/display/intel_fdi.c:608:
+ udelay(100);
-:1405: CHECK:USLEEP_RANGE: usleep_range is preferred over udelay; see Documentation/timers/timers-howto.rst #1405: FILE: drivers/gpu/drm/i915/display/intel_fdi.c:616:
+ udelay(100);
-:1428: CHECK:USLEEP_RANGE: usleep_range is preferred over udelay; see Documentation/timers/timers-howto.rst #1428: FILE: drivers/gpu/drm/i915/display/intel_fdi.c:639:
+ udelay(100);
-:1457: CHECK:USLEEP_RANGE: usleep_range is preferred over udelay; see Documentation/timers/timers-howto.rst #1457: FILE: drivers/gpu/drm/i915/display/intel_fdi.c:668:
+ udelay(100);
total: 0 errors, 9 warnings, 24 checks, 1432 lines checked 8fd0727c2a20 drm/i915: migrate hsw fdi code to new file. -:306: WARNING:LONG_LINE: line length of 123 exceeds 100 columns #306: FILE: drivers/gpu/drm/i915/display/intel_fdi.c:590:
+ FDI_RX_PWRDN_LANE1_VAL(2) | FDI_RX_PWRDN_LANE0_VAL(2) | FDI_RX_TP1_TO_TP2_48 | FDI_RX_FDI_DELAY_90);
-:314: CHECK:USLEEP_RANGE: usleep_range is preferred over udelay; see Documentation/timers/timers-howto.rst #314: FILE: drivers/gpu/drm/i915/display/intel_fdi.c:598:
+ udelay(220);
-:326: WARNING:BLOCK_COMMENT_STYLE: Block comments use a trailing */ on a separate line #326: FILE: drivers/gpu/drm/i915/display/intel_fdi.c:610:
+ * testing each value twice. */
-:338: WARNING:BLOCK_COMMENT_STYLE: Block comments use a trailing */ on a separate line #338: FILE: drivers/gpu/drm/i915/display/intel_fdi.c:622:
+ * port reversal bit */
-:340: WARNING:LONG_LINE: line length of 118 exceeds 100 columns #340: FILE: drivers/gpu/drm/i915/display/intel_fdi.c:624:
+ DDI_BUF_CTL_ENABLE | ((crtc_state->fdi_lanes - 1) << 1) | DDI_BUF_TRANS_SELECT(i / 2));
-:343: CHECK:USLEEP_RANGE: usleep_range is preferred over udelay; see Documentation/timers/timers-howto.rst #343: FILE: drivers/gpu/drm/i915/display/intel_fdi.c:627:
+ udelay(600);
-:354: CHECK:USLEEP_RANGE: usleep_range is preferred over udelay; see Documentation/timers/timers-howto.rst #354: FILE: drivers/gpu/drm/i915/display/intel_fdi.c:638:
+ udelay(30);
total: 0 errors, 4 warnings, 3 checks, 380 lines checked6a72e6f85636 drm/i915: migrate skl planes code new file
-:64: WARNING:FILE_PATH_CHANGES: added, moved or deleted file(s), does MAINTAINERS need updating? #64:
new file mode 100644
-:264: CHECK:LINE_SPACING: Please don't use multiple blank lines #264: FILE: drivers/gpu/drm/i915/display/intel_gen9_plane.c:196:
+
+
-:592: WARNING:TYPO_SPELLING: 'Limted' may be misspelled - perhaps 'Limited'? #592: FILE: drivers/gpu/drm/i915/display/intel_gen9_plane.c:524:
+ * BT.601 Limted range YCbCr -> full range RGB
-:779: WARNING:LONG_LINE: line length of 105 exceeds 100 columns #779: FILE: drivers/gpu/drm/i915/display/intel_gen9_plane.c:711:
+ (plane_state->color_plane[1].y << 16) | plane_state->color_plane[1].x);
-:812: CHECK:LINE_SPACING: Please use a blank line after function/struct/union/enum declarations #812: FILE: drivers/gpu/drm/i915/display/intel_gen9_plane.c:744:
+}
+static void
-:1141: WARNING:UNNECESSARY_ELSE: else is not generally useful after a break or return #1141: FILE: drivers/gpu/drm/i915/display/intel_gen9_plane.c:1073:
+ return skl_planar_formats;
+ } else {
-:1154: WARNING:UNNECESSARY_ELSE: else is not generally useful after a break or return #1154: FILE: drivers/gpu/drm/i915/display/intel_gen9_plane.c:1086:
+ return glk_planar_formats;
+ } else {
-:1170: WARNING:UNNECESSARY_ELSE: else is not generally useful after a break or return #1170: FILE: drivers/gpu/drm/i915/display/intel_gen9_plane.c:1102:
+ return icl_sdr_y_plane_formats;
+ } else {
-:1454: ERROR:TRAILING_WHITESPACE: trailing whitespace #1454: FILE: drivers/gpu/drm/i915/display/intel_gen9_plane.c:1386:
+ $
-:1454: WARNING:LEADING_SPACE: please, no spaces at the start of a line #1454: FILE: drivers/gpu/drm/i915/display/intel_gen9_plane.c:1386:
+ $
-:1455: ERROR:CODE_INDENT: code indent should use tabs where possible #1455: FILE: drivers/gpu/drm/i915/display/intel_gen9_plane.c:1387:
+ ^Idrm_plane_create_rotation_property(&plane->base,$
-:1455: WARNING:SPACE_BEFORE_TAB: please, no space before tabs #1455: FILE: drivers/gpu/drm/i915/display/intel_gen9_plane.c:1387:
+ ^Idrm_plane_create_rotation_property(&plane->base,$
-:1455: WARNING:LEADING_SPACE: please, no spaces at the start of a line #1455: FILE: drivers/gpu/drm/i915/display/intel_gen9_plane.c:1387:
+ ^Idrm_plane_create_rotation_property(&plane->base,$
-:1484: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #1484: FILE: drivers/gpu/drm/i915/display/intel_gen9_plane.c:1416:
+ drm_plane_create_scaling_filter_property(&plane->base,
+ BIT(DRM_SCALING_FILTER_DEFAULT) |
total: 2 errors, 9 warnings, 3 checks, 2955 lines checked
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI[Intel-gfx] ✗ Fi.CI.SPARSE: warning for series starting with [1/9] drm/i915/display: move needs_modeset to an inline in header
In reply to Dave Airlie== Series Details ==
== Series Details ==
Series: series starting with [1/9] drm/i915/display: move needs_modeset to an inline in header
URL : https://patchwork.freedesktop.org/series/84761/
State : warning
== Summary ==
$ dim sparse --fast origin/drm-tip Sparse version: v0.6.2 Fast mode used, each commit won't be checked separately. - +drivers/gpu/drm/i915/gt/intel_reset.c:1310:5: warning: context imbalance in 'intel_gt_reset_trylock' - different lock contexts for basic block +drivers/gpu/drm/i915/gt/selftest_reset.c:100:20: expected void *in +drivers/gpu/drm/i915/gt/selftest_reset.c:100:20: got void [noderef] __iomem *[assigned] s +drivers/gpu/drm/i915/gt/selftest_reset.c:100:20: warning: incorrect type in assignment (different address spaces) +drivers/gpu/drm/i915/gt/selftest_reset.c:101:46: expected void const *src +drivers/gpu/drm/i915/gt/selftest_reset.c:101:46: got void [noderef] __iomem *[assigned] s +drivers/gpu/drm/i915/gt/selftest_reset.c:101:46: warning: incorrect type in argument 2 (different address spaces) +drivers/gpu/drm/i915/gt/selftest_reset.c:136:20: expected void *in +drivers/gpu/drm/i915/gt/selftest_reset.c:136:20: got void [noderef] __iomem *[assigned] s +drivers/gpu/drm/i915/gt/selftest_reset.c:136:20: warning: incorrect type in assignment (different address spaces) +drivers/gpu/drm/i915/gt/selftest_reset.c:137:46: expected void const *src +drivers/gpu/drm/i915/gt/selftest_reset.c:137:46: got void [noderef] __iomem *[assigned] s +drivers/gpu/drm/i915/gt/selftest_reset.c:137:46: warning: incorrect type in argument 2 (different address spaces) +drivers/gpu/drm/i915/gt/selftest_reset.c:98:34: expected unsigned int [usertype] *s +drivers/gpu/drm/i915/gt/selftest_reset.c:98:34: got void [noderef] __iomem *[assigned] s +drivers/gpu/drm/i915/gt/selftest_reset.c:98:34: warning: incorrect type in argument 1 (different address spaces) +drivers/gpu/drm/i915/gvt/mmio.c:295:23: warning: memcpy with byte count of 279040 +drivers/gpu/drm/i915/i915_perf.c:1448:15: warning: memset with byte count of 16777216 +drivers/gpu/drm/i915/i915_perf.c:1502:15: warning: memset with byte count of 16777216 +drivers/gpu/drm/i915/intel_wakeref.c:137:19: warning: context imbalance in 'wakeref_auto_timeout' - unexpected unlock +./include/linux/seqlock.h:838:24: warning: trying to copy expression type 31 +./include/linux/seqlock.h:838:24: warning: trying to copy expression type 31 +./include/linux/seqlock.h:864:16: warning: trying to copy expression type 31 +./include/linux/spinlock.h:409:9: warning: context imbalance in 'fwtable_read16' - different lock contexts for basic block +./include/linux/spinlock.h:409:9: warning: context imbalance in 'fwtable_read32' - different lock contexts for basic block +./include/linux/spinlock.h:409:9: warning: context imbalance in 'fwtable_read64' - different lock contexts for basic block +./include/linux/spinlock.h:409:9: warning: context imbalance in 'fwtable_read8' - different lock contexts for basic block +./include/linux/spinlock.h:409:9: warning: context imbalance in 'fwtable_write16' - different lock contexts for basic block +./include/linux/spinlock.h:409:9: warning: context imbalance in 'fwtable_write32' - different lock contexts for basic block +./include/linux/spinlock.h:409:9: warning: context imbalance in 'fwtable_write8' - different lock contexts for basic block +./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen11_fwtable_read16' - different lock contexts for basic block +./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen11_fwtable_read32' - different lock contexts for basic block +./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen11_fwtable_read64' - different lock contexts for basic block +./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen11_fwtable_read8' - different lock contexts for basic block +./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen11_fwtable_write16' - different lock contexts for basic block +./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen11_fwtable_write32' - different lock contexts for basic block +./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen11_fwtable_write8' - different lock contexts for basic block +./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen12_fwtable_read16' - different lock contexts for basic block +./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen12_fwtable_read32' - different lock contexts for basic block +./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen12_fwtable_read64' - different lock contexts for basic block +./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen12_fwtable_read8' - different lock contexts for basic block +./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen12_fwtable_write16' - different lock contexts for basic block +./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen12_fwtable_write32' - different lock contexts for basic block +./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen12_fwtable_write8' - different lock contexts for basic block +./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen6_read16' - different lock contexts for basic block +./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen6_read32' - different lock contexts for basic block +./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen6_read64' - different lock contexts for basic block +./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen6_read8' - different lock contexts for basic block +./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen6_write16' - different lock contexts for basic block +./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen6_write32' - different lock contexts for basic block +./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen6_write8' - different lock contexts for basic block +./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen8_write16' - different lock contexts for basic block +./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen8_write32' - different lock contexts for basic block +./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen8_write8' - different lock contexts for basic block
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI[Intel-gfx] ✗ Fi.CI.DOCS: warning for series starting with [1/9] drm/i915/display: move needs_modeset to an inline in header
In reply to Dave Airlie== Series Details ==
== Series Details ==
Series: series starting with [1/9] drm/i915/display: move needs_modeset to an inline in header
URL : https://patchwork.freedesktop.org/series/84761/
State : warning
== Summary ==
$ make htmldocs 2>&1 > /dev/null | grep i915 Error: Cannot open file ./drivers/gpu/drm/i915/gt/intel_lrc.c WARNING: kernel-doc './scripts/kernel-doc -rst -enable-lineno -sphinx-version 1.7.9 -function Logical Rings, Logical Ring Contexts and Execlists ./drivers/gpu/drm/i915/gt/intel_lrc.c' failed with return code 1
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI[Intel-gfx] ✓ Fi.CI.BAT: success for series starting with [1/9] drm/i915/display: move needs_modeset to an inline in header
In reply to Dave Airlie== Series Details ==
== Series Details ==
Series: series starting with [1/9] drm/i915/display: move needs_modeset to an inline in header
URL : https://patchwork.freedesktop.org/series/84761/
State : success
== Summary ==
CI Bug Log - changes from CI_DRM_9467 -> Patchwork_19104
====================================================
Summary
-------
**SUCCESS**
No regressions found.
External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19104/index.html
Known issues
------------
Here are the changes found in Patchwork_19104 that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@kms_force_connector_basic@force-connector-state:
- fi-icl-u2: [PASS][1] -> [DMESG-WARN][2] ([i915#1226])
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9467/fi-icl-u2/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19104/fi-icl-u2/igt@[email protected]
* igt@prime_self_import@basic-with_two_bos:
- fi-tgl-y: [PASS][3] -> [DMESG-WARN][4] ([i915#402])
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9467/fi-tgl-y/igt@prime_self_import@basic-with_two_bos.html
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19104/fi-tgl-y/igt@prime_self_import@basic-with_two_bos.html
#### Possible fixes ####
* igt@prime_vgem@basic-userptr:
- fi-tgl-y: [DMESG-WARN][5] ([i915#402]) -> [PASS][6]
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9467/fi-tgl-y/igt@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19104/fi-tgl-y/igt@[email protected]
[i915#1226]: https://gitlab.freedesktop.org/drm/intel/issues/1226
[i915#402]: https://gitlab.freedesktop.org/drm/intel/issues/402
Participating hosts (43 -> 40)
------------------------------
Missing (3): fi-ilk-m540 fi-bdw-samus fi-hsw-4200u
Build changes
-------------
* Linux: CI_DRM_9467 -> Patchwork_19104
CI-20190529: 20190529
CI_DRM_9467: 97bdde324e46e276a88de5d2d0c759b4309173c6 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_5886: c65fd1fbc26e9f65756d130d33b0ed56bc8faec7 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_19104: 6a72e6f856364a3f11c5b4be843e81acc4b7f6fe @ git://anongit.freedesktop.org/gfx-ci/linux
== Linux commits ==
6a72e6f85636 drm/i915: migrate skl planes code new file 8fd0727c2a20 drm/i915: migrate hsw fdi code to new file. 3f29deb02bb0 drm/i915: split fdi code out from intel_display.c 3a72e7ca995f drm/i915: refactor pll code out into intel_dpll_legacy.c cda39caa4c68 drm/i915: refactor some crtc code out of intel display. e673ce40272b drm/i915: refactor cursor code out of i915_display.c 89c17eeef1fa drm/i915/display: fix misused comma f7906d61c852 drm/i915/display: move to_intel_frontbuffer to header ee7dca5fec1e drm/i915/display: move needs_modeset to an inline in header
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19104/index.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Dave Airlie
maintainerThere are all in this branch
https://github.com/airlied/linux/commits/i915-display-refactor
I moved more code in the skl planes patch and move some pipe code in there as well
Will repost those tomorrow most likely.
Dave.
Quoted 8 lines · Dave Airlie
The first 3 are just moving some functions to inline and fixing a wrong comma, the next 4 are cleaned up from yesterday.
hsw fdi is definitely a WIP.
Skl planes migration is along the lines of what danvet asked for.
Quoted 7 lines
Dave.
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI[Intel-gfx] ✓ Fi.CI.IGT: success for series starting with [1/9] drm/i915/display: move needs_modeset to an inline in header
In reply to Dave Airlie== Series Details ==
== Series Details ==
Series: series starting with [1/9] drm/i915/display: move needs_modeset to an inline in header
URL : https://patchwork.freedesktop.org/series/84761/
State : success
== Summary ==
CI Bug Log - changes from CI_DRM_9467_full -> Patchwork_19104_full
====================================================
Summary
-------
**SUCCESS**
No regressions found.
Known issues
------------
Here are the changes found in Patchwork_19104_full that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@gem_userptr_blits@readonly-pwrite-unsync:
- shard-iclb: NOTRUN -> [SKIP][1] ([fdo#110426] / [i915#1704])
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19104/shard-iclb2/igt@[email protected]
* igt@i915_pm_dc@dc6-psr:
- shard-iclb: [PASS][2] -> [FAIL][3] ([i915#454])
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9467/shard-iclb7/igt@[email protected]
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19104/shard-iclb4/igt@[email protected]
* igt@kms_async_flips@alternate-sync-async-flip:
- shard-tglb: [PASS][4] -> [FAIL][5] ([i915#2521])
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9467/shard-tglb8/igt@[email protected]
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19104/shard-tglb2/igt@[email protected]
* igt@kms_big_fb@yf-tiled-64bpp-rotate-0:
- shard-iclb: NOTRUN -> [SKIP][6] ([fdo#110723])
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19104/shard-iclb2/igt@[email protected]
* igt@kms_ccs@pipe-c-crc-primary-basic:
- shard-skl: NOTRUN -> [SKIP][7] ([fdo#109271] / [fdo#111304])
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19104/shard-skl6/igt@[email protected]
* igt@kms_color_chamelium@pipe-c-gamma:
- shard-skl: NOTRUN -> [SKIP][8] ([fdo#109271] / [fdo#111827])
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19104/shard-skl8/igt@[email protected]
* igt@kms_color_chamelium@pipe-invalid-ctm-matrix-sizes:
- shard-iclb: NOTRUN -> [SKIP][9] ([fdo#109284] / [fdo#111827]) +2 similar issues
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19104/shard-iclb2/igt@[email protected]
* igt@kms_content_protection@srm:
- shard-iclb: NOTRUN -> [SKIP][10] ([fdo#109300] / [fdo#111066])
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19104/shard-iclb2/igt@[email protected]
* igt@kms_cursor_crc@pipe-a-cursor-256x256-offscreen:
- shard-skl: NOTRUN -> [FAIL][11] ([i915#54])
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19104/shard-skl6/igt@[email protected]
* igt@kms_cursor_crc@pipe-b-cursor-256x256-rapid-movement:
- shard-kbl: [PASS][12] -> [DMESG-WARN][13] ([i915#165] / [i915#180])
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9467/shard-kbl6/igt@[email protected]
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19104/shard-kbl2/igt@[email protected]
* igt@kms_cursor_crc@pipe-c-cursor-256x85-sliding:
- shard-skl: [PASS][14] -> [FAIL][15] ([i915#54])
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9467/shard-skl7/igt@[email protected]
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19104/shard-skl8/igt@[email protected]
* igt@kms_cursor_crc@pipe-c-cursor-suspend:
- shard-kbl: [PASS][16] -> [DMESG-WARN][17] ([i915#180])
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9467/shard-kbl7/igt@[email protected]
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19104/shard-kbl1/igt@[email protected]
* igt@kms_cursor_legacy@flip-vs-cursor-atomic-transitions:
- shard-skl: NOTRUN -> [FAIL][18] ([i915#2346])
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19104/shard-skl6/igt@[email protected]
* igt@kms_flip@2x-flip-vs-wf_vblank-interruptible:
- shard-iclb: NOTRUN -> [SKIP][19] ([fdo#109274]) +3 similar issues
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19104/shard-iclb2/igt@kms_flip@2x-flip-vs-wf_vblank-interruptible.html
* igt@kms_flip@2x-plain-flip-ts-check-interruptible@ab-hdmi-a1-hdmi-a2:
- shard-glk: [PASS][20] -> [FAIL][21] ([i915#2122])
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9467/shard-glk3/igt@kms_flip@[email protected]
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19104/shard-glk2/igt@kms_flip@[email protected]
* igt@kms_flip@flip-vs-suspend@c-edp1:
- shard-skl: [PASS][22] -> [INCOMPLETE][23] ([i915#198])
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9467/shard-skl7/igt@kms_flip@[email protected]
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19104/shard-skl4/igt@kms_flip@[email protected]
* igt@kms_frontbuffer_tracking@fbc-2p-primscrn-pri-indfb-draw-pwrite:
- shard-skl: NOTRUN -> [SKIP][24] ([fdo#109271]) +23 similar issues
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19104/shard-skl6/igt@kms_frontbuffer_tracking@fbc-2p-primscrn-pri-indfb-draw-pwrite.html
* igt@kms_frontbuffer_tracking@fbcpsr-2p-primscrn-spr-indfb-draw-mmap-cpu:
- shard-iclb: NOTRUN -> [SKIP][25] ([fdo#109280]) +5 similar issues
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19104/shard-iclb2/igt@kms_frontbuffer_tracking@fbcpsr-2p-primscrn-spr-indfb-draw-mmap-cpu.html
* igt@kms_hdr@bpc-switch-suspend:
- shard-skl: [PASS][26] -> [FAIL][27] ([i915#1188]) +1 similar issue
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9467/shard-skl3/igt@[email protected]
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19104/shard-skl10/igt@[email protected]
* igt@kms_plane_alpha_blend@pipe-b-alpha-basic:
- shard-skl: NOTRUN -> [FAIL][28] ([fdo#108145] / [i915#265])
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19104/shard-skl8/igt@[email protected]
* igt@kms_plane_alpha_blend@pipe-c-constant-alpha-min:
- shard-skl: [PASS][29] -> [FAIL][30] ([fdo#108145] / [i915#265])
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9467/shard-skl6/igt@[email protected]
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19104/shard-skl4/igt@[email protected]
* igt@kms_plane_cursor@pipe-d-primary-size-128:
- shard-iclb: NOTRUN -> [SKIP][31] ([fdo#109278]) +5 similar issues
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19104/shard-iclb2/igt@[email protected]
* igt@kms_psr@psr2_sprite_render:
- shard-iclb: [PASS][32] -> [SKIP][33] ([fdo#109441]) +1 similar issue
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9467/shard-iclb2/igt@kms_psr@psr2_sprite_render.html
[33]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19104/shard-iclb7/igt@kms_psr@psr2_sprite_render.html
* igt@nouveau_crc@pipe-d-source-rg:
- shard-iclb: NOTRUN -> [SKIP][34] ([fdo#109278] / [i915#2530])
[34]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19104/shard-iclb2/igt@[email protected]
* igt@perf@per-context-mode-unprivileged:
- shard-iclb: NOTRUN -> [SKIP][35] ([fdo#109289]) +1 similar issue
[35]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19104/shard-iclb2/igt@[email protected]
* igt@prime_vgem@fence-flip-hang:
- shard-iclb: NOTRUN -> [SKIP][36] ([fdo#109295])
[36]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19104/shard-iclb2/igt@[email protected]
#### Possible fixes ####
* igt@gem_exec_whisper@basic-fds-forked:
- shard-glk: [DMESG-WARN][37] ([i915#118] / [i915#95]) -> [PASS][38] +1 similar issue
[37]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9467/shard-glk9/igt@[email protected]
[38]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19104/shard-glk2/igt@[email protected]
* igt@kms_color@pipe-a-gamma:
- shard-tglb: [FAIL][39] ([i915#1149]) -> [PASS][40]
[39]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9467/shard-tglb8/igt@[email protected]
[40]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19104/shard-tglb6/igt@[email protected]
* igt@kms_cursor_crc@pipe-b-cursor-64x21-offscreen:
- shard-skl: [FAIL][41] ([i915#54]) -> [PASS][42] +4 similar issues
[41]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9467/shard-skl6/igt@[email protected]
[42]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19104/shard-skl4/igt@[email protected]
* igt@kms_flip@flip-vs-expired-vblank-interruptible@c-dp1:
- shard-kbl: [FAIL][43] ([i915#79]) -> [PASS][44]
[43]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9467/shard-kbl6/igt@kms_flip@[email protected]
[44]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19104/shard-kbl2/igt@kms_flip@[email protected]
* igt@kms_flip@flip-vs-expired-vblank@a-edp1:
- shard-tglb: [FAIL][45] ([i915#2598]) -> [PASS][46]
[45]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9467/shard-tglb1/igt@kms_flip@[email protected]
[46]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19104/shard-tglb3/igt@kms_flip@[email protected]
* igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-draw-mmap-gtt:
- shard-snb: [SKIP][47] ([fdo#109271]) -> [PASS][48] +1 similar issue
[47]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9467/shard-snb6/igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-draw-mmap-gtt.html
[48]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19104/shard-snb2/igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-draw-mmap-gtt.html
* igt@kms_hdr@bpc-switch-dpms:
- shard-skl: [FAIL][49] ([i915#1188]) -> [PASS][50]
[49]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9467/shard-skl3/igt@[email protected]
[50]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19104/shard-skl9/igt@[email protected]
* igt@kms_plane_alpha_blend@pipe-b-coverage-7efc:
- shard-skl: [FAIL][51] ([fdo#108145] / [i915#265]) -> [PASS][52]
[51]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9467/shard-skl5/igt@[email protected]
[52]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19104/shard-skl7/igt@[email protected]
* igt@kms_psr@psr2_cursor_mmap_cpu:
- shard-iclb: [SKIP][53] ([fdo#109441]) -> [PASS][54]
[53]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9467/shard-iclb3/igt@kms_psr@psr2_cursor_mmap_cpu.html
[54]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19104/shard-iclb2/igt@kms_psr@psr2_cursor_mmap_cpu.html
* igt@kms_vblank@pipe-b-ts-continuation-dpms-suspend:
- shard-iclb: [INCOMPLETE][55] ([i915#1185]) -> [PASS][56]
[55]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9467/shard-iclb3/igt@[email protected]
[56]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19104/shard-iclb2/igt@[email protected]
#### Warnings ####
* igt@i915_suspend@fence-restore-tiled2untiled:
- shard-kbl: [DMESG-WARN][57] -> [INCOMPLETE][58] ([i915#155] / [i915#794])
[57]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9467/shard-kbl7/igt@[email protected]
[58]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19104/shard-kbl6/igt@[email protected]
* igt@runner@aborted:
- shard-kbl: ([FAIL][59], [FAIL][60]) ([i915#2295] / [i915#2722] / [i915#483]) -> ([FAIL][61], [FAIL][62]) ([i915#1814] / [i915#2295] / [i915#2722] / [i915#483])
[59]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9467/shard-kbl1/igt@[email protected]
[60]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_9467/shard-kbl7/igt@[email protected]
[61]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19104/shard-kbl7/igt@[email protected]
[62]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19104/shard-kbl1/igt@[email protected]
[fdo#108145]: https://bugs.freedesktop.org/show_bug.cgi?id=108145
[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#109274]: https://bugs.freedesktop.org/show_bug.cgi?id=109274
[fdo#109278]: https://bugs.freedesktop.org/show_bug.cgi?id=109278
[fdo#109280]: https://bugs.freedesktop.org/show_bug.cgi?id=109280
[fdo#109284]: https://bugs.freedesktop.org/show_bug.cgi?id=109284
[fdo#109289]: https://bugs.freedesktop.org/show_bug.cgi?id=109289
[fdo#109295]: https://bugs.freedesktop.org/show_bug.cgi?id=109295
[fdo#109300]: https://bugs.freedesktop.org/show_bug.cgi?id=109300
[fdo#109441]: https://bugs.freedesktop.org/show_bug.cgi?id=109441
[fdo#110426]: https://bugs.freedesktop.org/show_bug.cgi?id=110426
[fdo#110723]: https://bugs.freedesktop.org/show_bug.cgi?id=110723
[fdo#111066]: https://bugs.freedesktop.org/show_bug.cgi?id=111066
[fdo#111304]: https://bugs.freedesktop.org/show_bug.cgi?id=111304
[fdo#111827]: https://bugs.freedesktop.org/show_bug.cgi?id=111827
[i915#1149]: https://gitlab.freedesktop.org/drm/intel/issues/1149
[i915#118]: https://gitlab.freedesktop.org/drm/intel/issues/118
[i915#1185]: https://gitlab.freedesktop.org/drm/intel/issues/1185
[i915#1188]: https://gitlab.freedesktop.org/drm/intel/issues/1188
[i915#155]: https://gitlab.freedesktop.org/drm/intel/issues/155
[i915#165]: https://gitlab.freedesktop.org/drm/intel/issues/165
[i915#1704]: https://gitlab.freedesktop.org/drm/intel/issues/1704
[i915#180]: https://gitlab.freedesktop.org/drm/intel/issues/180
[i915#1814]: https://gitlab.freedesktop.org/drm/intel/issues/1814
[i915#198]: https://gitlab.freedesktop.org/drm/intel/issues/198
[i915#2122]: https://gitlab.freedesktop.org/drm/intel/issues/2122
[i915#2295]: https://gitlab.freedesktop.org/drm/intel/issues/2295
[i915#2346]: https://gitlab.freedesktop.org/drm/intel/issues/2346
[i915#2521]: https://gitlab.freedesktop.org/drm/intel/issues/2521
[i915#2530]: https://gitlab.freedesktop.org/drm/intel/issues/2530
[i915#2598]: https://gitlab.freedesktop.org/drm/intel/issues/2598
[i915#265]: https://gitlab.freedesktop.org/drm/intel/issues/265
[i915#2722]: https://gitlab.freedesktop.org/drm/intel/issues/2722
[i915#454]: https://gitlab.freedesktop.org/drm/intel/issues/454
[i915#483]: https://gitlab.freedesktop.org/drm/intel/issues/483
[i915#54]: https://gitlab.freedesktop.org/drm/intel/issues/54
[i915#79]: https://gitlab.freedesktop.org/drm/intel/issues/79
[i915#794]: https://gitlab.freedesktop.org/drm/intel/issues/794
[i915#95]: https://gitlab.freedesktop.org/drm/intel/issues/95
Participating hosts (10 -> 10)
------------------------------
No changes in participating hosts
Build changes
-------------
* Linux: CI_DRM_9467 -> Patchwork_19104
CI-20190529: 20190529
CI_DRM_9467: 97bdde324e46e276a88de5d2d0c759b4309173c6 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_5886: c65fd1fbc26e9f65756d130d33b0ed56bc8faec7 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_19104: 6a72e6f856364a3f11c5b4be843e81acc4b7f6fe @ git://anongit.freedesktop.org/gfx-ci/linux
piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_19104/index.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx