drm/i915: refactor intel display
Subsystems (3)
v4 cover drm/i915: refactor intel display
This is Dave's intel_display.c refactoring series [1] with some minor issues addressed, to get CI results among other things.
I've reviewed and fixed any remaining minor issues I spotted in patches 1-8. I'm aware there may be things to improve, but I think this is overall forward progress and cleanup that's long overdue. I'm prepared to merge patches 1-8 unless there are strong objections.
I ran out of steam a little with patches 9-11, and haven't reviewed them. They're included here just for completeness.
BR,
Jani.
[1] https://patchwork.freedesktop.org/series/84812/
Dave Airlie (11):
drm/i915/display: move needs_modeset to an inline in header drm/i915/display: move to_intel_frontbuffer to header drm/i915/display: fix misused comma
drm/i915: refactor cursor code out of i915_display.c drm/i915: refactor some crtc code out of intel display. drm/i915: refactor pll code out into intel_dpll.c drm/i915: split fdi code out from intel_display.c drm/i915: migrate hsw fdi code to new file. drm/i915: migrate skl planes code new file drm/i915: move pipe update code into crtc. drm/i915: split fb scalable checks into g4x and skl versions
drivers/gpu/drm/i915/Makefile | 5 + .../gpu/drm/i915/display/intel_atomic_plane.c | 76 - drivers/gpu/drm/i915/display/intel_crt.c | 1 + drivers/gpu/drm/i915/display/intel_crtc.c | 1187 + drivers/gpu/drm/i915/display/intel_crtc.h | 22 + drivers/gpu/drm/i915/display/intel_cursor.c | 806 + drivers/gpu/drm/i915/display/intel_cursor.h | 17 + drivers/gpu/drm/i915/display/intel_ddi.c | 197 +- drivers/gpu/drm/i915/display/intel_ddi.h | 14 +- drivers/gpu/drm/i915/display/intel_display.c | 20019 ++++++---------- drivers/gpu/drm/i915/display/intel_display.h | 46 +- .../drm/i915/display/intel_display_types.h | 55 + drivers/gpu/drm/i915/display/intel_dpll.c | 1363 ++ drivers/gpu/drm/i915/display/intel_dpll.h | 23 + drivers/gpu/drm/i915/display/intel_fdi.c | 857 + drivers/gpu/drm/i915/display/intel_fdi.h | 29 + .../gpu/drm/i915/display/intel_gen9_plane.c | 2832 +++ drivers/gpu/drm/i915/display/intel_sprite.c | 1712 +- 18 files changed, 14739 insertions(+), 14522 deletions(-) create mode 100644 drivers/gpu/drm/i915/display/intel_crtc.c create mode 100644 drivers/gpu/drm/i915/display/intel_crtc.h create mode 100644 drivers/gpu/drm/i915/display/intel_cursor.c create mode 100644 drivers/gpu/drm/i915/display/intel_cursor.h create mode 100644 drivers/gpu/drm/i915/display/intel_dpll.c create mode 100644 drivers/gpu/drm/i915/display/intel_dpll.h create mode 100644 drivers/gpu/drm/i915/display/intel_fdi.c create mode 100644 drivers/gpu/drm/i915/display/intel_fdi.h create mode 100644 drivers/gpu/drm/i915/display/intel_gen9_plane.c
Signature · 6 lines
2.20.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v4 1/11 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 *crtc_state) +{ +return drm_atomic_crtc_needs_modeset (&crtc_state->uapi); +} +static inline void intel_wait_for_vblank (struct drm_i915_private *dev_priv,enum pipe pipe) {
Signature · 6 lines
2.20.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v4 2/11 drm/i915/display: move to_intel_frontbuffer to header
In reply to Jani NikulaFrom: 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.20.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v4 3/11 drm/i915/display: fix misused comma
In reply to Jani NikulaFrom: 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.20.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v4 4/11 drm/i915: refactor cursor code out of i915_display.c
In reply to Jani NikulaFrom: 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 | 806 +++++++++++++++++++ drivers/gpu/drm/i915/display/intel_cursor.h | 17 + drivers/gpu/drm/i915/display/intel_display.c | 797 +----------------- drivers/gpu/drm/i915/display/intel_display.h | 7 + 5 files changed, 838 insertions(+), 790 deletions(-) create mode 100644 drivers/gpu/drm/i915/display/intel_cursor.c create mode 100644 drivers/gpu/drm/i915/display/intel_cursor.h
drivers/gpu/drm/i915/Makefile +1 -0
@@ -198,6 +198,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 +806 -0
806 lines not on this page · raw message
drivers/gpu/drm/i915/display/intel_cursor.h new file +17 -0
@@ -0,0 +1,17 @@ +/* SPDX-License-Identifier: MIT */ +/* +* Copyright © 2020 Intel Corporation +*/ + +#ifndef _INTEL_CURSOR_H_ +#define _INTEL_CURSOR_H_ + +enum pipe ; +struct drm_i915_private ; +struct intel_plane ; + +struct intel_plane * +intel_cursor_plane_create (struct drm_i915_private *dev_priv, +enum pipe pipe); + +#endif
drivers/gpu/drm/i915/display/intel_display.c +7 -790
857 lines not on this page · raw message
drivers/gpu/drm/i915/display/intel_display.h +7 -0
@@ -647,6 +647,13 @@ 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); +/* 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.20.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v4 5/11 drm/i915: refactor some crtc code out of intel display.
In reply to Jani NikulaFrom: Dave Airlie <[email protected]>
There may be more crtc code that can be pulled out, but this is a good start.
--- drivers/gpu/drm/i915/Makefile | 1 + drivers/gpu/drm/i915/display/intel_crtc.c | 953 +++++++++++++++++++ drivers/gpu/drm/i915/display/intel_crtc.h | 22 + drivers/gpu/drm/i915/display/intel_display.c | 934 +----------------- 4 files changed, 977 insertions(+), 933 deletions(-) create mode 100644 drivers/gpu/drm/i915/display/intel_crtc.c create mode 100644 drivers/gpu/drm/i915/display/intel_crtc.h
drivers/gpu/drm/i915/Makefile +1 -0
@@ -197,6 +197,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 +953 -0
953 lines not on this page · raw message
drivers/gpu/drm/i915/display/intel_crtc.h new file +22 -0
@@ -0,0 +1,22 @@ +/* SPDX-License-Identifier: MIT */ +/* +* Copyright © 2020 Intel Corporation +*/ + +#ifndef _INTEL_CRTC_H_ +#define _INTEL_CRTC_H_ + +#include <linux/types.h> + +enum pipe ; +struct drm_i915_private ; +struct intel_crtc ; +struct intel_crtc_state ; + +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); + +#endif
drivers/gpu/drm/i915/display/intel_display.c +1 -933
1,007 lines not on this page · raw message
Signature · 6 lines
2.20.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v4 6/11 drm/i915: refactor pll code out into intel_dpll.c
In reply to Jani NikulaFrom: 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 makes 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 | 1402 +---------------- drivers/gpu/drm/i915/display/intel_display.h | 3 + .../drm/i915/display/intel_display_types.h | 13 + drivers/gpu/drm/i915/display/intel_dpll.c | 1363 ++++++++++++++++ drivers/gpu/drm/i915/display/intel_dpll.h | 23 + 6 files changed, 1414 insertions(+), 1391 deletions(-) create mode 100644 drivers/gpu/drm/i915/display/intel_dpll.c create mode 100644 drivers/gpu/drm/i915/display/intel_dpll.h
drivers/gpu/drm/i915/Makefile +1 -0
@@ -203,6 +203,7 @@ i915-y += \ display/intel_display.o \ display/intel_display_power.o \ display/intel_dpio_phy.o \ + display/intel_dpll.o \ display/intel_dpll_mgr.o \ display/intel_dsb.o \ display/intel_fbc.o \
drivers/gpu/drm/i915/display/intel_display.c +11 -1391
1,500 lines not on this page · raw message
drivers/gpu/drm/i915/display/intel_display.h +3 -0
@@ -653,6 +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);/* modesetting */ void intel_modeset_init_hw (struct drm_i915_private *i915);
drivers/gpu/drm/i915/display/intel_display_types.h +13 -0
@@ -1811,4 +1811,17 @@ to_intel_frontbuffer(struct drm_framebuffer *fb) return fb ? to_intel_framebuffer(fb)->frontbuffer : NULL; } +static inline bool intel_panel_use_ssc (struct drm_i915_private *dev_priv) +{ +if (dev_priv->params.panel_use_ssc >=0 ) +return dev_priv->params.panel_use_ssc !=0 ; +return dev_priv->vbt.lvds_use_ssc + && !(dev_priv->quirks &QUIRK_LVDS_SSC_DISABLE ); +} + +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.c new file +1363 -0
1,363 lines not on this page · raw message
drivers/gpu/drm/i915/display/intel_dpll.h new file +23 -0
@@ -0,0 +1,23 @@ +/* SPDX-License-Identifier: MIT */ +/* +* Copyright © 2020 Intel Corporation +*/ + +#ifndef _INTEL_DPLL_H_ +#define _INTEL_DPLL_H_ + +struct dpll ; +struct drm_i915_private ; +struct intel_crtc ; +struct intel_crtc_state ; + +void intel_dpll_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); + +#endif
Signature · 6 lines
2.20.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v4 7/11 drm/i915: split fdi code out from intel_display.c
In reply to Jani NikulaFrom: 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 | 685 +----------------- .../drm/i915/display/intel_display_types.h | 9 + drivers/gpu/drm/i915/display/intel_fdi.c | 683 +++++++++++++++++ drivers/gpu/drm/i915/display/intel_fdi.h | 22 + 5 files changed, 718 insertions(+), 682 deletions(-) create mode 100644 drivers/gpu/drm/i915/display/intel_fdi.c create mode 100644 drivers/gpu/drm/i915/display/intel_fdi.h
drivers/gpu/drm/i915/Makefile +1 -0
@@ -207,6 +207,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 +3 -682
721 lines not on this page · raw message
drivers/gpu/drm/i915/display/intel_display_types.h +9 -0
@@ -1824,4 +1824,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 +683 -0
683 lines not on this page · raw message
drivers/gpu/drm/i915/display/intel_fdi.h new file +22 -0
@@ -0,0 +1,22 @@ +/* SPDX-License-Identifier: MIT */ +/* +* Copyright © 2020 Intel Corporation +*/ + +#ifndef _INTEL_FDI_H_ +#define _INTEL_FDI_H_ + +struct drm_i915_private ; +struct intel_crtc ; +struct intel_crtc_state ; + +#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_fdi_init_hook (struct drm_i915_private *dev_priv); + +#endif
Signature · 6 lines
2.20.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v4 8/11 drm/i915: migrate hsw fdi code to new file.
In reply to Jani NikulaFrom: 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_crt.c | 1 + drivers/gpu/drm/i915/display/intel_ddi.c | 197 +---------------------- drivers/gpu/drm/i915/display/intel_ddi.h | 14 +- drivers/gpu/drm/i915/display/intel_fdi.c | 174 ++++++++++++++++++++ drivers/gpu/drm/i915/display/intel_fdi.h | 7 + 5 files changed, 202 insertions(+), 191 deletions(-)
drivers/gpu/drm/i915/display/intel_crt.c +1 -0
@@ -38,6 +38,7 @@#include "intel_crt.h" #include "intel_ddi.h" #include "intel_display_types.h" +#include "intel_fdi.h" #include "intel_fifo_underrun.h" #include "intel_gmbus.h" #include "intel_hotplug.h"
drivers/gpu/drm/i915/display/intel_ddi.c +8 -189
260 lines not on this page · raw message
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_fdi.c +174 -0
189 lines not on this page · raw message
drivers/gpu/drm/i915/display/intel_fdi.h +7 -0
@@ -9,6 +9,11 @@struct drm_i915_private ;struct intel_crtc ;struct intel_crtc_state ; +struct intel_encoder ; +struct ddi_buf_trans ; + +const struct ddi_buf_trans * +intel_fdi_get_buf_trans (struct drm_i915_private *dev_priv,int *n_entries);#define I915_DISPLAY_CONFIG_RETRY 1 int ilk_fdi_compute_config(struct intel_crtc *intel_crtc,
@@ -18,5 +23,7 @@ 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_fdi_init_hook (struct drm_i915_private *dev_priv); +void hsw_fdi_link_train (struct intel_encoder *encoder, +const struct intel_crtc_state *crtc_state);#endif
Signature · 6 lines
2.20.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v4 9/11 drm/i915: migrate skl planes code new file
In reply to Jani NikulaFrom: Dave Airlie <[email protected]>
Rework the plane init calls to do the gen test one level higher.
--- drivers/gpu/drm/i915/Makefile | 1 + .../gpu/drm/i915/display/intel_atomic_plane.c | 76 - drivers/gpu/drm/i915/display/intel_crtc.c | 16 +- drivers/gpu/drm/i915/display/intel_display.c | 1410 +------- drivers/gpu/drm/i915/display/intel_display.h | 36 +- .../drm/i915/display/intel_display_types.h | 21 + .../gpu/drm/i915/display/intel_gen9_plane.c | 2832 +++++++++++++++++ drivers/gpu/drm/i915/display/intel_sprite.c | 1417 +-------- 8 files changed, 2931 insertions(+), 2878 deletions(-) create mode 100644 drivers/gpu/drm/i915/display/intel_gen9_plane.c
drivers/gpu/drm/i915/Makefile +1 -0
@@ -211,6 +211,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_atomic_plane.c +0 -76
88 lines not on this page · raw message
drivers/gpu/drm/i915/display/intel_crtc.c +10 -6
@@ -617,10 +617,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;
@@ -871,7 +867,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;
@@ -881,7 +881,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_display.c +33 -1377
1,504 lines not on this page · raw message
drivers/gpu/drm/i915/display/intel_display.h +23 -13
@@ -52,6 +52,7 @@ struct intel_crtc_state;struct intel_digital_port ;struct intel_dp ;struct intel_encoder ; +struct intel_initial_plane_config ;struct intel_load_detect_pipe ;struct intel_plane ;struct intel_plane_state ;
@@ -615,23 +616,12 @@ intel_legacy_aux_to_power_domain(enum aux_ch aux_ch);void intel_crtc_arm_fifo_underrun (struct intel_crtc *crtc,struct intel_crtc_state *crtc_state); -u16 skl_scaler_calc_phase (int sub,int scale,bool chroma_center);void skl_scaler_disable (const struct intel_crtc_state *old_crtc_state); -u32 skl_scaler_get_filter_select (enum drm_scaling_filter filter,int set); -void skl_scaler_setup_filter (struct drm_i915_private *dev_priv,enum pipe pipe, -int id,int set,enum drm_scaling_filter filter);void ilk_pfit_disable (const struct intel_crtc_state *old_crtc_state); -u32 glk_plane_color_ctl (const struct intel_crtc_state *crtc_state, -const struct intel_plane_state *plane_state); -u32 glk_plane_color_ctl_crtc (const struct intel_crtc_state *crtc_state); -u32 skl_plane_ctl (const struct intel_crtc_state *crtc_state, -const struct intel_plane_state *plane_state); -u32 skl_plane_ctl_crtc (const struct intel_crtc_state *crtc_state); -u32 skl_plane_stride (const struct intel_plane_state *plane_state, -int plane); -int skl_check_plane_surface (struct intel_plane_state *plane_state); +void skl_detach_scalers (const struct intel_crtc_state *crtc_state);int i9xx_check_plane_surface (struct intel_plane_state *plane_state);int skl_format_to_fourcc (int format,bool rgb_order,bool alpha); +void skl_pfit_enable (const struct intel_crtc_state *crtc_state);unsigned int i9xx_plane_max_stride (struct intel_plane *plane,u32 pixel_format,u64 modifier,unsigned int rotation);
@@ -657,6 +647,26 @@ struct intel_encoder * intel_get_crtc_new_encoder(const struct intel_atomic_state *state, const struct intel_crtc_state *crtc_state); +unsigned int intel_surf_alignment (const struct drm_framebuffer *fb, +int color_plane); +void intel_fb_plane_get_subsampling (int *hsub,int *vsub, +const struct drm_framebuffer *fb, +int color_plane); +u32 intel_plane_adjust_aligned_offset (int *x,int *y, +const struct intel_plane_state *state, +int color_plane, +u32 old_offset,u32 new_offset); +int main_to_ccs_plane (const struct drm_framebuffer *fb,int main_plane); +int ccs_to_main_plane (const struct drm_framebuffer *fb,int ccs_plane); +unsigned int intel_tile_width_bytes (const struct drm_framebuffer *fb,int color_plane); +unsigned int intel_tile_height (const struct drm_framebuffer *fb,int color_plane); +int skl_update_scaler_crtc (struct intel_crtc_state *crtc_state); +int skl_update_scaler_plane (struct intel_crtc_state *crtc_state, +struct intel_plane_state *plane_state); +void +skl_get_initial_plane_config (struct intel_crtc *crtc, +struct intel_initial_plane_config *plane_config); +/* 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 +21 -0
@@ -37,6 +37,7 @@#include <drm/drm_dp_mst_helper.h> #include <drm/drm_encoder.h> #include <drm/drm_fb_helper.h> +#include <drm/drm_fourcc.h> #include <drm/drm_probe_helper.h> #include <drm/drm_rect.h> #include <drm/drm_vblank.h>
@@ -1833,4 +1834,24 @@ static inline u32 intel_fdi_link_freq(struct drm_i915_private *dev_priv, return dev_priv->fdi_pll_freq; } +static inline bool is_ccs_plane (const struct drm_framebuffer *fb,int plane) +{ +if (!is_ccs_modifier (fb->modifier)) +return false; + +return plane >= fb->format->num_planes /2 ; +} + +static inline bool is_gen12_ccs_modifier (u64 modifier) +{ +return modifier ==I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS || + modifier ==I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS ; + +} + +static inline bool is_gen12_ccs_plane (const struct drm_framebuffer *fb,int plane) +{ +return is_gen12_ccs_modifier (fb->modifier) &&is_ccs_plane (fb, plane); +} +#endif /* __INTEL_DISPLAY_TYPES_H__ */
drivers/gpu/drm/i915/display/intel_gen9_plane.c new file +2832 -0
1,278 lines not on this page · raw message
drivers/gpu/drm/i915/display/intel_sprite.c +11 -1406
1,417 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 6 lines
2.20.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Part of the diff is not shown here. View the raw message.
PATCH v4 10/11 drm/i915: move pipe update code into crtc.
In reply to Jani NikulaFrom: Dave Airlie <[email protected]>
Daniel suggested this should move here.
--- drivers/gpu/drm/i915/display/intel_crtc.c | 230 ++++++++++++++++++++ drivers/gpu/drm/i915/display/intel_sprite.c | 228 ------------------- 2 files changed, 230 insertions(+), 228 deletions(-)
drivers/gpu/drm/i915/display/intel_crtc.c +230 -0
@@ -10,6 +10,9 @@#include <drm/drm_plane.h> #include <drm/drm_plane_helper.h> +#include "i915_trace.h" +#include "i915_vgpu.h" +#include "intel_atomic.h" #include "intel_atomic_plane.h" #include "intel_color.h"
@@ -17,7 +20,9 @@#include "intel_cursor.h" #include "intel_display_debugfs.h" #include "intel_display_types.h" +#include "intel_dsi.h" #include "intel_pipe_crc.h" +#include "intel_psr.h" #include "intel_sprite.h" /* Primary plane formats for gen <= 3 */
@@ -955,3 +960,228 @@ int intel_crtc_init(struct drm_i915_private *dev_priv, enum pipe pipe)return ret; } + +int intel_usecs_to_scanlines (const struct drm_display_mode *adjusted_mode, +int usecs) +{ +/* paranoia */ +if (!adjusted_mode->crtc_htotal) +return 1 ; + +return DIV_ROUND_UP (usecs * adjusted_mode->crtc_clock, +1000 * adjusted_mode->crtc_htotal); +} + +/** +* intel_pipe_update_start() - start update of a set of display registers +* @new_crtc_state: the new crtc state +* +* Mark the start of an update to pipe registers that should be updated +* atomically regarding vblank. If the next vblank will happens within +* the next 100 us, this function waits until the vblank passes. +* +* After a successful call to this function, interrupts will be disabled +* until a subsequent call to intel_pipe_update_end(). That is done to +* avoid random delays. +*/ +void intel_pipe_update_start (const struct intel_crtc_state *new_crtc_state) +{ +struct intel_crtc *crtc =to_intel_crtc (new_crtc_state->uapi.crtc); +struct drm_i915_private *dev_priv =to_i915 (crtc->base.dev); +const struct drm_display_mode *adjusted_mode = &new_crtc_state->hw.adjusted_mode; +long timeout =msecs_to_jiffies_timeout (1 ); +int scanline, min, max, vblank_start; +wait_queue_head_t *wq =drm_crtc_vblank_waitqueue (&crtc->base); +bool need_vlv_dsi_wa = (IS_VALLEYVIEW (dev_priv) ||IS_CHERRYVIEW (dev_priv)) && +intel_crtc_has_type (new_crtc_state,INTEL_OUTPUT_DSI ); +DEFINE_WAIT (wait); +u32 psr_status; + +if (new_crtc_state->uapi.async_flip) +return ; + + vblank_start = adjusted_mode->crtc_vblank_start; +if (adjusted_mode->flags &DRM_MODE_FLAG_INTERLACE ) + vblank_start =DIV_ROUND_UP (vblank_start,2 ); + +/* FIXME needs to be calibrated sensibly */ + min = vblank_start -intel_usecs_to_scanlines (adjusted_mode, +VBLANK_EVASION_TIME_US ); + max = vblank_start -1 ; + +if (min <=0 || max <=0 ) + goto irq_disable; + +if (drm_WARN_ON (&dev_priv->drm,drm_crtc_vblank_get (&crtc->base))) + goto irq_disable; + +/* +* Wait for psr to idle out after enabling the VBL interrupts +* VBL interrupts will start the PSR exit and prevent a PSR +* re-entry as well. +*/ +if (intel_psr_wait_for_idle (new_crtc_state, &psr_status)) +drm_err (&dev_priv->drm, +"PSR idle timed out 0x%x, atomic update may fail\n" , + psr_status); + +local_irq_disable (); + + crtc->debug.min_vbl = min; + crtc->debug.max_vbl = max; +trace_intel_pipe_update_start (crtc); + +for (;;) { +/* +* prepare_to_wait() has a memory barrier, which guarantees +* other CPUs can see the task state update by the time we +* read the scanline. +*/ +prepare_to_wait (wq, &wait,TASK_UNINTERRUPTIBLE ); + + scanline =intel_get_crtc_scanline (crtc); +if (scanline < min || scanline > max) +break ; + +if (!timeout) { +drm_err (&dev_priv->drm, +"Potential atomic update failure on pipe %c\n" , +pipe_name (crtc->pipe)); +break ; + } + +local_irq_enable (); + + timeout =schedule_timeout (timeout); + +local_irq_disable (); + } + +finish_wait (wq, &wait); + +drm_crtc_vblank_put (&crtc->base); + +/* +* On VLV/CHV DSI the scanline counter would appear to +* increment approx. 1/3 of a scanline before start of vblank. +* The registers still get latched at start of vblank however. +* This means we must not write any registers on the first +* line of vblank (since not the whole line is actually in +* vblank). And unfortunately we can't use the interrupt to +* wait here since it will fire too soon. We could use the +* frame start interrupt instead since it will fire after the +* critical scanline, but that would require more changes +* in the interrupt code. So for now we'll just do the nasty +* thing and poll for the bad scanline to pass us by. +* +* FIXME figure out if BXT+ DSI suffers from this as well +*/ +while (need_vlv_dsi_wa && scanline == vblank_start) + scanline =intel_get_crtc_scanline (crtc); + + crtc->debug.scanline_start = scanline; + crtc->debug.start_vbl_time =ktime_get (); + crtc->debug.start_vbl_count =intel_crtc_get_vblank_counter (crtc); + +trace_intel_pipe_update_vblank_evaded (crtc); +return ; + +irq_disable: +local_irq_disable (); +} + +#if IS_ENABLED (CONFIG_DRM_I915_DEBUG_VBLANK_EVADE ) +static void dbg_vblank_evade (struct intel_crtc *crtc,ktime_t end) +{ +u64 delta =ktime_to_ns (ktime_sub (end, crtc->debug.start_vbl_time)); +unsigned int h; + + h =ilog2 (delta >>9 ); +if (h >=ARRAY_SIZE (crtc->debug.vbl.times)) + h =ARRAY_SIZE (crtc->debug.vbl.times) -1 ; + crtc->debug.vbl.times[h]++; + + crtc->debug.vbl.sum += delta; +if (!crtc->debug.vbl.min || delta < crtc->debug.vbl.min) + crtc->debug.vbl.min = delta; +if (delta > crtc->debug.vbl.max) + crtc->debug.vbl.max = delta; + +if (delta >1000 *VBLANK_EVASION_TIME_US ) { +drm_dbg_kms (crtc->base.dev, +"Atomic update on pipe (%c) took %lld us, max time under evasion is %u us\n" , +pipe_name (crtc->pipe), +div_u64 (delta,1000 ), +VBLANK_EVASION_TIME_US ); + crtc->debug.vbl.over++; + } +} +#else +static void dbg_vblank_evade (struct intel_crtc *crtc,ktime_t end) {} +#endif + +/** +* intel_pipe_update_end() - end update of a set of display registers +* @new_crtc_state: the new crtc state +* +* Mark the end of an update started with intel_pipe_update_start(). This +* re-enables interrupts and verifies the update was actually completed +* before a vblank. +*/ +void intel_pipe_update_end (struct intel_crtc_state *new_crtc_state) +{ +struct intel_crtc *crtc =to_intel_crtc (new_crtc_state->uapi.crtc); +enum pipe pipe = crtc->pipe; +int scanline_end =intel_get_crtc_scanline (crtc); +u32 end_vbl_count =intel_crtc_get_vblank_counter (crtc); +ktime_t end_vbl_time =ktime_get (); +struct drm_i915_private *dev_priv =to_i915 (crtc->base.dev); + +if (new_crtc_state->uapi.async_flip) +return ; + +trace_intel_pipe_update_end (crtc, end_vbl_count, scanline_end); + +/* +* Incase of mipi dsi command mode, we need to set frame update +* request for every commit. +*/ +if (INTEL_GEN (dev_priv) >=11 && +intel_crtc_has_type (new_crtc_state,INTEL_OUTPUT_DSI )) +icl_dsi_frame_update (new_crtc_state); + +/* We're still in the vblank-evade critical section, this can't race. +* Would be slightly nice to just grab the vblank count and arm the +* event outside of the critical section - the spinlock might spin for a +* while ... */ +if (new_crtc_state->uapi.event) { +drm_WARN_ON (&dev_priv->drm, +drm_crtc_vblank_get (&crtc->base) !=0 ); + +spin_lock (&crtc->base.dev->event_lock); +drm_crtc_arm_vblank_event (&crtc->base, + new_crtc_state->uapi.event); +spin_unlock (&crtc->base.dev->event_lock); + + new_crtc_state->uapi.event =NULL ; + } + +local_irq_enable (); + +if (intel_vgpu_active (dev_priv)) +return ; + +if (crtc->debug.start_vbl_count && + crtc->debug.start_vbl_count != end_vbl_count) { +drm_err (&dev_priv->drm, +"Atomic update failure on pipe %c (start=%u end=%u) time %lld us, min %d, max %d, scanline start %d, end %d\n" , +pipe_name (pipe), crtc->debug.start_vbl_count, + end_vbl_count, +ktime_us_delta (end_vbl_time, + crtc->debug.start_vbl_time), + crtc->debug.min_vbl, crtc->debug.max_vbl, + crtc->debug.scanline_start, scanline_end); + } + +dbg_vblank_evade (crtc, end_vbl_time); +}
drivers/gpu/drm/i915/display/intel_sprite.c +0 -228
236 lines not on this page · raw message
Signature · 6 lines
2.20.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v4 11/11 drm/i915: split fb scalable checks into g4x and skl versions
In reply to Jani NikulaFrom: Dave Airlie <[email protected]>
This just cleans these up a bit.
--- drivers/gpu/drm/i915/display/intel_gen9_plane.c | 4 ++-- drivers/gpu/drm/i915/display/intel_sprite.c | 7 +++---- 2 files changed, 5 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/display/intel_gen9_plane.c +2 -2
@@ -2139,7 +2139,7 @@ static int skl_check_plane_surface(struct intel_plane_state *plane_state)return 0 ; } -static bool intel_fb_scalable (const struct drm_framebuffer *fb) +static bool skl_fb_scalable (const struct drm_framebuffer *fb) {if (!fb)return false;
@@ -2172,7 +2172,7 @@ static int skl_plane_check(struct intel_crtc_state *crtc_state,return ret;/* use scaler when colorkey is not required */ -if (!plane_state->ckey.flags &&intel_fb_scalable (fb)) { +if (!plane_state->ckey.flags &&skl_fb_scalable (fb)) { min_scale =1 ; max_scale =skl_plane_max_scale (dev_priv, fb); }
drivers/gpu/drm/i915/display/intel_sprite.c +3 -4
@@ -1282,19 +1282,18 @@ g4x_plane_get_hw_state(struct intel_plane *plane,return ret; } -static bool intel_fb_scalable (const struct drm_framebuffer *fb) +static bool g4x_fb_scalable (const struct drm_framebuffer *fb) {if (!fb)return false;switch (fb->format->format) {case DRM_FORMAT_C8 : -return false;case DRM_FORMAT_XRGB16161616F :case DRM_FORMAT_ARGB16161616F :case DRM_FORMAT_XBGR16161616F :case DRM_FORMAT_ABGR16161616F : -return INTEL_GEN (to_i915 (fb->dev)) >=11 ; +return false;default :return true; }
@@ -1371,7 +1370,7 @@ g4x_sprite_check(struct intel_crtc_state *crtc_state,int max_scale =DRM_PLANE_HELPER_NO_SCALING ;int ret; -if (intel_fb_scalable (plane_state->hw.fb)) { +if (g4x_fb_scalable (plane_state->hw.fb)) {if (INTEL_GEN (dev_priv) <7 ) { min_scale =1 ; max_scale =16 <<16 ;
Signature · 6 lines
2.20.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH v4 06/11] drm/i915: refactor pll code out into intel_dpll.c
In reply to Jani NikulaOn Wed, Dec 16, 2020 at 01:29:13PM +0200, Jani Nikula wrote:
<snip>
Quoted 10 lines
drivers/gpu/drm/i915/display/intel_display_types.h +2
-0@@ -1811,4 +1811,17 @@ to_intel_frontbuffer(struct drm_framebuffer *fb)return fb ?to_intel_framebuffer (fb)->frontbuffer :NULL ; } +static inline bool intel_panel_use_ssc (struct drm_i915_private *dev_priv) +{
drivers/gpu/drm/i915/display/intel_display_types.h to_intel_frontbuffer(struct drm_framebuffer *fb) · line 1825
Quoted 10 lines
drivers/gpu/drm/i915/display/intel_display_types.h +10
-0+if (dev_priv->params.panel_use_ssc >=0 ) +return dev_priv->params.panel_use_ssc !=0 ; +return dev_priv->vbt.lvds_use_ssc + && !(dev_priv->quirks &QUIRK_LVDS_SSC_DISABLE ); +} + +static inline u32 i9xx_dpll_compute_fp (struct dpll *dpll) +{ +return dpll->n <<16 | dpll->m1 <<8 | dpll->m2; +}
Was wondering why this is here, but looks like it's the i830 pipe power well thing that needs it.
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 v4 09/11] drm/i915: migrate skl planes code new file
In reply to Jani NikulaQuoted 24 lines · Jani Nikula
From: Dave Airlie <[email protected]>
Rework the plane init calls to do the gen test one level higher.
Signed-off-by Dave Airlie <[email protected]>[Jani: fixed up sparse warnings.]Signed-off-by Jani Nikula <[email protected]>--- drivers/gpu/drm/i915/Makefile | 1 + .../gpu/drm/i915/display/intel_atomic_plane.c | 76 - drivers/gpu/drm/i915/display/intel_crtc.c | 16 +- drivers/gpu/drm/i915/display/intel_display.c | 1410 +------- drivers/gpu/drm/i915/display/intel_display.h | 36 +- .../drm/i915/display/intel_display_types.h | 21 + .../gpu/drm/i915/display/intel_gen9_plane.c | 2832 +++++++++++++++++ drivers/gpu/drm/i915/display/intel_sprite.c | 1417 +-------- 8 files changed, 2931 insertions(+), 2878 deletions(-) create mode 100644 drivers/gpu/drm/i915/display/intel_gen9_plane.cdrivers/gpu/drm/i915/Makefile +0
-0
drivers/gpu/drm/i915/Makefile i915-y += \ · line 214
Quoted 4 lines
drivers/gpu/drm/i915/Makefile +1
-0@@ -211,6 +211,7 @@ i915-y += \ display/intel_fifo_underrun.o \ display/intel_frontbuffer.o \ display/intel_global_state.o \ + display/intel_gen9_plane.o \
skl_universal_plane.c is what I'd call it.
No corresponding header?
Quoted 45 lines
drivers/gpu/drm/i915/Makefile +0
-0display/intel_hdcp.o \ display/intel_hotplug.o \ display/intel_lpe_audio.o \drivers/gpu/drm/i915/display/intel_atomic_plane.c +0
-34@@ -399,50 +399,6 @@ int intel_plane_atomic_check(struct intel_atomic_state *state, new_plane_state); } -static struct intel_plane * -skl_next_plane_to_commit (struct intel_atomic_state *state, -struct intel_crtc *crtc, -struct skl_ddb_entry entries_y[I915_MAX_PLANES ], -struct skl_ddb_entry entries_uv[I915_MAX_PLANES ], -unsigned int *update_mask) -{ -struct intel_crtc_state *crtc_state = -intel_atomic_get_new_crtc_state (state, crtc); -struct intel_plane_state *plane_state; -struct intel_plane *plane; -int i; - -if (*update_mask ==0 ) -return NULL ; - -for_each_new_intel_plane_in_state (state, plane, plane_state, i) { -enum plane_id plane_id = plane->id; - -if (crtc->pipe != plane->pipe || - !(*update_mask &BIT (plane_id))) -continue ; - -if (skl_ddb_allocation_overlaps (&crtc_state->wm.skl.plane_ddb_y[plane_id], - entries_y, -I915_MAX_PLANES , plane_id) || -skl_ddb_allocation_overlaps (&crtc_state->wm.skl.plane_ddb_uv[plane_id], - entries_uv, -I915_MAX_PLANES , plane_id)) -continue ; - - *update_mask &= ~BIT (plane_id); - entries_y[plane_id] = crtc_state->wm.skl.plane_ddb_y[plane_id]; - entries_uv[plane_id] = crtc_state->wm.skl.plane_ddb_uv[plane_id];
drivers/gpu/drm/i915/display/intel_atomic_plane.c int intel_plane_atomic_check(struct intel_atomic_state *state, · line 445
Quoted 10 lines
drivers/gpu/drm/i915/display/intel_atomic_plane.c +0
-10- -return plane; - } - -/* should never happen */ -drm_WARN_ON (state->base.dev,1 ); - -return NULL ; -} -
I wouldn't bother moving the stuff from intel_atomic_plane.c. They're much higher level stuff than the rest of the moved code.
<snip>
Quoted 24 lines
drivers/gpu/drm/i915/display/intel_display.h +1
-6@@ -52,6 +52,7 @@ struct intel_crtc_state;struct intel_digital_port ;struct intel_dp ;struct intel_encoder ; +struct intel_initial_plane_config ;struct intel_load_detect_pipe ;struct intel_plane ;struct intel_plane_state ;@@ -615,23 +616,12 @@ intel_legacy_aux_to_power_domain(enum aux_ch aux_ch);void intel_crtc_arm_fifo_underrun (struct intel_crtc *crtc,struct intel_crtc_state *crtc_state); -u16 skl_scaler_calc_phase (int sub,int scale,bool chroma_center);void skl_scaler_disable (const struct intel_crtc_state *old_crtc_state); -u32 skl_scaler_get_filter_select (enum drm_scaling_filter filter,int set); -void skl_scaler_setup_filter (struct drm_i915_private *dev_priv,enum pipe pipe, -int id,int set,enum drm_scaling_filter filter);void ilk_pfit_disable (const struct intel_crtc_state *old_crtc_state); -u32 glk_plane_color_ctl (const struct intel_crtc_state *crtc_state, -const struct intel_plane_state *plane_state);
drivers/gpu/drm/i915/display/intel_display.h intel_legacy_aux_to_power_domain(enum aux_ch aux_ch); · line 623
Quoted 10 lines
drivers/gpu/drm/i915/display/intel_display.h +1
-7-u32 glk_plane_color_ctl_crtc (const struct intel_crtc_state *crtc_state); -u32 skl_plane_ctl (const struct intel_crtc_state *crtc_state, -const struct intel_plane_state *plane_state); -u32 skl_plane_ctl_crtc (const struct intel_crtc_state *crtc_state); -u32 skl_plane_stride (const struct intel_plane_state *plane_state, -int plane); -int skl_check_plane_surface (struct intel_plane_state *plane_state); +void skl_detach_scalers (const struct intel_crtc_state *crtc_state);int i9xx_check_plane_surface (struct intel_plane_state *plane_state);int skl_format_to_fourcc (int format,bool rgb_order,bool alpha);
We seem to have left a lot of functions as non-static that don't need t be.
<snip>
Quoted 4 lines
drivers/gpu/drm/i915/display/intel_sprite.c +0
-0
<snip>
drivers/gpu/drm/i915/display/intel_sprite.c static const u32 g4x_plane_formats[] = { · line 1823
Quoted 10 lines
drivers/gpu/drm/i915/display/intel_sprite.c +7
-3-static const u32 icl_sdr_y_plane_formats[] = { -DRM_FORMAT_C8 , -DRM_FORMAT_RGB565 , +static const u64 i9xx_plane_format_modifiers[] = { +I915_FORMAT_MOD_X_TILED , +DRM_FORMAT_MOD_LINEAR , +DRM_FORMAT_MOD_INVALID +}; + +static const u32 snb_plane_formats[] = {
Have we tried --patience to make this part of the diff legible?
Quoted 117 lines
drivers/gpu/drm/i915/display/intel_sprite.c +4
-76DRM_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_XRGB16161616F , +DRM_FORMAT_XBGR16161616F ,DRM_FORMAT_YUYV ,DRM_FORMAT_YVYU ,DRM_FORMAT_UYVY , DRM_FORMAT_VYUY, -DRM_FORMAT_Y210 , -DRM_FORMAT_Y212 , -DRM_FORMAT_Y216 , -DRM_FORMAT_XYUV8888 , -DRM_FORMAT_XVYU2101010 , -DRM_FORMAT_XVYU12_16161616 , - DRM_FORMAT_XVYU16161616, }; -static const u32 icl_sdr_uv_plane_formats[] = { +static const u32 vlv_plane_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_YUYV ,DRM_FORMAT_YVYU ,DRM_FORMAT_UYVY ,DRM_FORMAT_VYUY , -DRM_FORMAT_NV12 , -DRM_FORMAT_P010 , -DRM_FORMAT_P012 , -DRM_FORMAT_P016 , -DRM_FORMAT_Y210 , -DRM_FORMAT_Y212 , -DRM_FORMAT_Y216 , -DRM_FORMAT_XYUV8888 , -DRM_FORMAT_XVYU2101010 , -DRM_FORMAT_XVYU12_16161616 , -DRM_FORMAT_XVYU16161616 , }; -static const u32 icl_hdr_plane_formats[] = { +static const u32 chv_pipe_b_sprite_formats[] = {DRM_FORMAT_C8 ,DRM_FORMAT_RGB565 , DRM_FORMAT_XRGB8888,@@ -2813,60 +1859,10 @@ static const u32 icl_hdr_plane_formats[] = {DRM_FORMAT_XBGR2101010 ,DRM_FORMAT_ARGB2101010 ,DRM_FORMAT_ABGR2101010 , -DRM_FORMAT_XRGB16161616F , -DRM_FORMAT_XBGR16161616F , -DRM_FORMAT_ARGB16161616F , -DRM_FORMAT_ABGR16161616F ,DRM_FORMAT_YUYV ,DRM_FORMAT_YVYU ,DRM_FORMAT_UYVY , DRM_FORMAT_VYUY, -DRM_FORMAT_NV12 , -DRM_FORMAT_P010 , -DRM_FORMAT_P012 , -DRM_FORMAT_P016 , -DRM_FORMAT_Y210 , -DRM_FORMAT_Y212 , -DRM_FORMAT_Y216 , -DRM_FORMAT_XYUV8888 , -DRM_FORMAT_XVYU2101010 , -DRM_FORMAT_XVYU12_16161616 , - DRM_FORMAT_XVYU16161616, -}; - -static const u64 skl_plane_format_modifiers_noccs[] = { - I915_FORMAT_MOD_Yf_TILED, -I915_FORMAT_MOD_Y_TILED , -I915_FORMAT_MOD_X_TILED , -DRM_FORMAT_MOD_LINEAR , -DRM_FORMAT_MOD_INVALID -}; - -static const u64 skl_plane_format_modifiers_ccs[] = { - I915_FORMAT_MOD_Yf_TILED_CCS, -I915_FORMAT_MOD_Y_TILED_CCS , - I915_FORMAT_MOD_Yf_TILED, -I915_FORMAT_MOD_Y_TILED , -I915_FORMAT_MOD_X_TILED , -DRM_FORMAT_MOD_LINEAR , -DRM_FORMAT_MOD_INVALID -}; - -static const u64 gen12_plane_format_modifiers_mc_ccs[] = { -I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS , -I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS , -I915_FORMAT_MOD_Y_TILED , -I915_FORMAT_MOD_X_TILED , -DRM_FORMAT_MOD_LINEAR , -DRM_FORMAT_MOD_INVALID -}; - -static const u64 gen12_plane_format_modifiers_rc_ccs[] = { -I915_FORMAT_MOD_Y_TILED_GEN12_RC_CCS , -I915_FORMAT_MOD_Y_TILED , -I915_FORMAT_MOD_X_TILED , -DRM_FORMAT_MOD_LINEAR , -DRM_FORMAT_MOD_INVALID };
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 v4 10/11] drm/i915: move pipe update code into crtc.
In reply to Jani NikulaQuoted 3 lines · Jani Nikula
From: Dave Airlie <[email protected]>
Daniel suggested this should move here.
Slightly better than where it is now I guess. I'd kinda like to put it next to its callers but not sure that wouldn't end up in a mess.
Quoted 504 lines
Signed-off-by Dave Airlie <[email protected]>Signed-off-by Jani Nikula <[email protected]>--- drivers/gpu/drm/i915/display/intel_crtc.c | 230 ++++++++++++++++++++ drivers/gpu/drm/i915/display/intel_sprite.c | 228 ------------------- 2 files changed, 230 insertions(+), 228 deletions(-)drivers/gpu/drm/i915/display/intel_crtc.c +230
-0@@ -10,6 +10,9 @@#include <drm/drm_plane.h> #include <drm/drm_plane_helper.h> +#include "i915_trace.h" +#include "i915_vgpu.h" +#include "intel_atomic.h" #include "intel_atomic_plane.h" #include "intel_color.h" @@ -17,7 +20,9 @@#include "intel_cursor.h" #include "intel_display_debugfs.h" #include "intel_display_types.h" +#include "intel_dsi.h" #include "intel_pipe_crc.h" +#include "intel_psr.h" #include "intel_sprite.h" /* Primary plane formats for gen <= 3 */ @@ -955,3 +960,228 @@ int intel_crtc_init(struct drm_i915_private *dev_priv, enum pipe pipe)return ret; } + +int intel_usecs_to_scanlines (const struct drm_display_mode *adjusted_mode, +int usecs) +{ +/* paranoia */ +if (!adjusted_mode->crtc_htotal) +return 1 ; + +return DIV_ROUND_UP (usecs * adjusted_mode->crtc_clock, +1000 * adjusted_mode->crtc_htotal); +} + +/** +* intel_pipe_update_start() - start update of a set of display registers +* @new_crtc_state: the new crtc state +* +* Mark the start of an update to pipe registers that should be updated +* atomically regarding vblank. If the next vblank will happens within +* the next 100 us, this function waits until the vblank passes. +* +* After a successful call to this function, interrupts will be disabled +* until a subsequent call to intel_pipe_update_end(). That is done to +* avoid random delays. +*/ +void intel_pipe_update_start (const struct intel_crtc_state *new_crtc_state) +{ +struct intel_crtc *crtc =to_intel_crtc (new_crtc_state->uapi.crtc); +struct drm_i915_private *dev_priv =to_i915 (crtc->base.dev); +const struct drm_display_mode *adjusted_mode = &new_crtc_state->hw.adjusted_mode; +long timeout =msecs_to_jiffies_timeout (1 ); +int scanline, min, max, vblank_start; +wait_queue_head_t *wq =drm_crtc_vblank_waitqueue (&crtc->base); +bool need_vlv_dsi_wa = (IS_VALLEYVIEW (dev_priv) ||IS_CHERRYVIEW (dev_priv)) && +intel_crtc_has_type (new_crtc_state,INTEL_OUTPUT_DSI ); +DEFINE_WAIT (wait); +u32 psr_status; + +if (new_crtc_state->uapi.async_flip) +return ; + + vblank_start = adjusted_mode->crtc_vblank_start; +if (adjusted_mode->flags &DRM_MODE_FLAG_INTERLACE ) + vblank_start =DIV_ROUND_UP (vblank_start,2 ); + +/* FIXME needs to be calibrated sensibly */ + min = vblank_start -intel_usecs_to_scanlines (adjusted_mode, +VBLANK_EVASION_TIME_US ); + max = vblank_start -1 ; + +if (min <=0 || max <=0 ) + goto irq_disable; + +if (drm_WARN_ON (&dev_priv->drm,drm_crtc_vblank_get (&crtc->base))) + goto irq_disable; + +/* +* Wait for psr to idle out after enabling the VBL interrupts +* VBL interrupts will start the PSR exit and prevent a PSR +* re-entry as well. +*/ +if (intel_psr_wait_for_idle (new_crtc_state, &psr_status)) +drm_err (&dev_priv->drm, +"PSR idle timed out 0x%x, atomic update may fail\n" , + psr_status); + +local_irq_disable (); + + crtc->debug.min_vbl = min; + crtc->debug.max_vbl = max; +trace_intel_pipe_update_start (crtc); + +for (;;) { +/* +* prepare_to_wait() has a memory barrier, which guarantees +* other CPUs can see the task state update by the time we +* read the scanline. +*/ +prepare_to_wait (wq, &wait,TASK_UNINTERRUPTIBLE ); + + scanline =intel_get_crtc_scanline (crtc); +if (scanline < min || scanline > max) +break ; + +if (!timeout) { +drm_err (&dev_priv->drm, +"Potential atomic update failure on pipe %c\n" , +pipe_name (crtc->pipe)); +break ; + } + +local_irq_enable (); + + timeout =schedule_timeout (timeout); + +local_irq_disable (); + } + +finish_wait (wq, &wait); + +drm_crtc_vblank_put (&crtc->base); + +/* +* On VLV/CHV DSI the scanline counter would appear to +* increment approx. 1/3 of a scanline before start of vblank. +* The registers still get latched at start of vblank however. +* This means we must not write any registers on the first +* line of vblank (since not the whole line is actually in +* vblank). And unfortunately we can't use the interrupt to +* wait here since it will fire too soon. We could use the +* frame start interrupt instead since it will fire after the +* critical scanline, but that would require more changes +* in the interrupt code. So for now we'll just do the nasty +* thing and poll for the bad scanline to pass us by. +* +* FIXME figure out if BXT+ DSI suffers from this as well +*/ +while (need_vlv_dsi_wa && scanline == vblank_start) + scanline =intel_get_crtc_scanline (crtc); + + crtc->debug.scanline_start = scanline; + crtc->debug.start_vbl_time =ktime_get (); + crtc->debug.start_vbl_count =intel_crtc_get_vblank_counter (crtc); + +trace_intel_pipe_update_vblank_evaded (crtc); +return ; + +irq_disable: +local_irq_disable (); +} + +#if IS_ENABLED (CONFIG_DRM_I915_DEBUG_VBLANK_EVADE ) +static void dbg_vblank_evade (struct intel_crtc *crtc,ktime_t end) +{ +u64 delta =ktime_to_ns (ktime_sub (end, crtc->debug.start_vbl_time)); +unsigned int h; + + h =ilog2 (delta >>9 ); +if (h >=ARRAY_SIZE (crtc->debug.vbl.times)) + h =ARRAY_SIZE (crtc->debug.vbl.times) -1 ; + crtc->debug.vbl.times[h]++; + + crtc->debug.vbl.sum += delta; +if (!crtc->debug.vbl.min || delta < crtc->debug.vbl.min) + crtc->debug.vbl.min = delta; +if (delta > crtc->debug.vbl.max) + crtc->debug.vbl.max = delta; + +if (delta >1000 *VBLANK_EVASION_TIME_US ) { +drm_dbg_kms (crtc->base.dev, +"Atomic update on pipe (%c) took %lld us, max time under evasion is %u us\n" , +pipe_name (crtc->pipe), +div_u64 (delta,1000 ), +VBLANK_EVASION_TIME_US ); + crtc->debug.vbl.over++; + } +} +#else +static void dbg_vblank_evade (struct intel_crtc *crtc,ktime_t end) {} +#endif + +/** +* intel_pipe_update_end() - end update of a set of display registers +* @new_crtc_state: the new crtc state +* +* Mark the end of an update started with intel_pipe_update_start(). This +* re-enables interrupts and verifies the update was actually completed +* before a vblank. +*/ +void intel_pipe_update_end (struct intel_crtc_state *new_crtc_state) +{ +struct intel_crtc *crtc =to_intel_crtc (new_crtc_state->uapi.crtc); +enum pipe pipe = crtc->pipe; +int scanline_end =intel_get_crtc_scanline (crtc); +u32 end_vbl_count =intel_crtc_get_vblank_counter (crtc); +ktime_t end_vbl_time =ktime_get (); +struct drm_i915_private *dev_priv =to_i915 (crtc->base.dev); + +if (new_crtc_state->uapi.async_flip) +return ; + +trace_intel_pipe_update_end (crtc, end_vbl_count, scanline_end); + +/* +* Incase of mipi dsi command mode, we need to set frame update +* request for every commit. +*/ +if (INTEL_GEN (dev_priv) >=11 && +intel_crtc_has_type (new_crtc_state,INTEL_OUTPUT_DSI )) +icl_dsi_frame_update (new_crtc_state); + +/* We're still in the vblank-evade critical section, this can't race. +* Would be slightly nice to just grab the vblank count and arm the +* event outside of the critical section - the spinlock might spin for a +* while ... */ +if (new_crtc_state->uapi.event) { +drm_WARN_ON (&dev_priv->drm, +drm_crtc_vblank_get (&crtc->base) !=0 ); + +spin_lock (&crtc->base.dev->event_lock); +drm_crtc_arm_vblank_event (&crtc->base, + new_crtc_state->uapi.event); +spin_unlock (&crtc->base.dev->event_lock); + + new_crtc_state->uapi.event =NULL ; + } + +local_irq_enable (); + +if (intel_vgpu_active (dev_priv)) +return ; + +if (crtc->debug.start_vbl_count && + crtc->debug.start_vbl_count != end_vbl_count) { +drm_err (&dev_priv->drm, +"Atomic update failure on pipe %c (start=%u end=%u) time %lld us, min %d, max %d, scanline start %d, end %d\n" , +pipe_name (pipe), crtc->debug.start_vbl_count, + end_vbl_count, +ktime_us_delta (end_vbl_time, + crtc->debug.start_vbl_time), + crtc->debug.min_vbl, crtc->debug.max_vbl, + crtc->debug.scanline_start, scanline_end); + } + +dbg_vblank_evade (crtc, end_vbl_time); +}drivers/gpu/drm/i915/display/intel_sprite.c +0
-228@@ -45,236 +45,8 @@#include "intel_atomic_plane.h" #include "intel_display_types.h" #include "intel_frontbuffer.h" -#include "intel_pm.h" -#include "intel_psr.h" -#include "intel_dsi.h" #include "intel_sprite.h" -int intel_usecs_to_scanlines (const struct drm_display_mode *adjusted_mode, -int usecs) -{ -/* paranoia */ -if (!adjusted_mode->crtc_htotal) -return 1 ; - -return DIV_ROUND_UP (usecs * adjusted_mode->crtc_clock, -1000 * adjusted_mode->crtc_htotal); -} - -/** -* intel_pipe_update_start() - start update of a set of display registers -* @new_crtc_state: the new crtc state -* -* Mark the start of an update to pipe registers that should be updated -* atomically regarding vblank. If the next vblank will happens within -* the next 100 us, this function waits until the vblank passes. -* -* After a successful call to this function, interrupts will be disabled -* until a subsequent call to intel_pipe_update_end(). That is done to -* avoid random delays. -*/ -void intel_pipe_update_start (const struct intel_crtc_state *new_crtc_state) -{ -struct intel_crtc *crtc =to_intel_crtc (new_crtc_state->uapi.crtc); -struct drm_i915_private *dev_priv =to_i915 (crtc->base.dev); -const struct drm_display_mode *adjusted_mode = &new_crtc_state->hw.adjusted_mode; -long timeout =msecs_to_jiffies_timeout (1 ); -int scanline, min, max, vblank_start; -wait_queue_head_t *wq =drm_crtc_vblank_waitqueue (&crtc->base); -bool need_vlv_dsi_wa = (IS_VALLEYVIEW (dev_priv) ||IS_CHERRYVIEW (dev_priv)) && -intel_crtc_has_type (new_crtc_state,INTEL_OUTPUT_DSI ); -DEFINE_WAIT (wait); -u32 psr_status; - -if (new_crtc_state->uapi.async_flip) -return ; - - vblank_start = adjusted_mode->crtc_vblank_start; -if (adjusted_mode->flags &DRM_MODE_FLAG_INTERLACE ) - vblank_start =DIV_ROUND_UP (vblank_start,2 ); - -/* FIXME needs to be calibrated sensibly */ - min = vblank_start -intel_usecs_to_scanlines (adjusted_mode, -VBLANK_EVASION_TIME_US ); - max = vblank_start -1 ; - -if (min <=0 || max <=0 ) - goto irq_disable; - -if (drm_WARN_ON (&dev_priv->drm,drm_crtc_vblank_get (&crtc->base))) - goto irq_disable; - -/* -* Wait for psr to idle out after enabling the VBL interrupts -* VBL interrupts will start the PSR exit and prevent a PSR -* re-entry as well. -*/ -if (intel_psr_wait_for_idle (new_crtc_state, &psr_status)) -drm_err (&dev_priv->drm, -"PSR idle timed out 0x%x, atomic update may fail\n" , - psr_status); - -local_irq_disable (); - - crtc->debug.min_vbl = min; - crtc->debug.max_vbl = max; -trace_intel_pipe_update_start (crtc); - -for (;;) { -/* -* prepare_to_wait() has a memory barrier, which guarantees -* other CPUs can see the task state update by the time we -* read the scanline. -*/ -prepare_to_wait (wq, &wait,TASK_UNINTERRUPTIBLE ); - - scanline =intel_get_crtc_scanline (crtc); -if (scanline < min || scanline > max) -break ; - -if (!timeout) { -drm_err (&dev_priv->drm, -"Potential atomic update failure on pipe %c\n" , -pipe_name (crtc->pipe)); -break ; - } - -local_irq_enable (); - - timeout =schedule_timeout (timeout); - -local_irq_disable (); - } - -finish_wait (wq, &wait); - -drm_crtc_vblank_put (&crtc->base); - -/* -* On VLV/CHV DSI the scanline counter would appear to -* increment approx. 1/3 of a scanline before start of vblank. -* The registers still get latched at start of vblank however. -* This means we must not write any registers on the first -* line of vblank (since not the whole line is actually in -* vblank). And unfortunately we can't use the interrupt to -* wait here since it will fire too soon. We could use the -* frame start interrupt instead since it will fire after the -* critical scanline, but that would require more changes -* in the interrupt code. So for now we'll just do the nasty -* thing and poll for the bad scanline to pass us by. -* -* FIXME figure out if BXT+ DSI suffers from this as well -*/ -while (need_vlv_dsi_wa && scanline == vblank_start) - scanline =intel_get_crtc_scanline (crtc); - - crtc->debug.scanline_start = scanline; - crtc->debug.start_vbl_time =ktime_get (); - crtc->debug.start_vbl_count =intel_crtc_get_vblank_counter (crtc); - -trace_intel_pipe_update_vblank_evaded (crtc); -return ; - -irq_disable: -local_irq_disable (); -} - -#if IS_ENABLED (CONFIG_DRM_I915_DEBUG_VBLANK_EVADE ) -static void dbg_vblank_evade (struct intel_crtc *crtc,ktime_t end) -{ -u64 delta =ktime_to_ns (ktime_sub (end, crtc->debug.start_vbl_time)); -unsigned int h; - - h =ilog2 (delta >>9 ); -if (h >=ARRAY_SIZE (crtc->debug.vbl.times)) - h =ARRAY_SIZE (crtc->debug.vbl.times) -1 ; - crtc->debug.vbl.times[h]++; - - crtc->debug.vbl.sum += delta; -if (!crtc->debug.vbl.min || delta < crtc->debug.vbl.min) - crtc->debug.vbl.min = delta; -if (delta > crtc->debug.vbl.max) - crtc->debug.vbl.max = delta; - -if (delta >1000 *VBLANK_EVASION_TIME_US ) { -drm_dbg_kms (crtc->base.dev, -"Atomic update on pipe (%c) took %lld us, max time under evasion is %u us\n" , -pipe_name (crtc->pipe), -div_u64 (delta,1000 ), -VBLANK_EVASION_TIME_US ); - crtc->debug.vbl.over++; - } -} -#else -static void dbg_vblank_evade (struct intel_crtc *crtc,ktime_t end) {} -#endif - -/** -* intel_pipe_update_end() - end update of a set of display registers -* @new_crtc_state: the new crtc state -* -* Mark the end of an update started with intel_pipe_update_start(). This -* re-enables interrupts and verifies the update was actually completed -* before a vblank. -*/ -void intel_pipe_update_end (struct intel_crtc_state *new_crtc_state) -{ -struct intel_crtc *crtc =to_intel_crtc (new_crtc_state->uapi.crtc); -enum pipe pipe = crtc->pipe; -int scanline_end =intel_get_crtc_scanline (crtc); -u32 end_vbl_count =intel_crtc_get_vblank_counter (crtc); -ktime_t end_vbl_time =ktime_get (); -struct drm_i915_private *dev_priv =to_i915 (crtc->base.dev); - -if (new_crtc_state->uapi.async_flip) -return ; - -trace_intel_pipe_update_end (crtc, end_vbl_count, scanline_end); - -/* -* Incase of mipi dsi command mode, we need to set frame update -* request for every commit. -*/ -if (INTEL_GEN (dev_priv) >=11 && -intel_crtc_has_type (new_crtc_state,INTEL_OUTPUT_DSI )) -icl_dsi_frame_update (new_crtc_state); - -/* We're still in the vblank-evade critical section, this can't race. -* Would be slightly nice to just grab the vblank count and arm the -* event outside of the critical section - the spinlock might spin for a -* while ... */ -if (new_crtc_state->uapi.event) { -drm_WARN_ON (&dev_priv->drm, -drm_crtc_vblank_get (&crtc->base) !=0 ); - -spin_lock (&crtc->base.dev->event_lock); -drm_crtc_arm_vblank_event (&crtc->base, - new_crtc_state->uapi.event); -spin_unlock (&crtc->base.dev->event_lock); - - new_crtc_state->uapi.event =NULL ; - } - -local_irq_enable (); - -if (intel_vgpu_active (dev_priv)) -return ; - -if (crtc->debug.start_vbl_count && - crtc->debug.start_vbl_count != end_vbl_count) { -drm_err (&dev_priv->drm, -"Atomic update failure on pipe %c (start=%u end=%u) time %lld us, min %d, max %d, scanline start %d, end %d\n" , -pipe_name (pipe), crtc->debug.start_vbl_count, - end_vbl_count, -ktime_us_delta (end_vbl_time, - crtc->debug.start_vbl_time), - crtc->debug.min_vbl, crtc->debug.max_vbl, - crtc->debug.scanline_start, scanline_end); - } - -dbg_vblank_evade (crtc, end_vbl_time); -} -int intel_plane_check_stride (const struct intel_plane_state *plane_state) {struct intel_plane *plane =to_intel_plane (plane_state->uapi.plane);Signature · 1 line
2.20.1
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 v4 11/11] drm/i915: split fb scalable checks into g4x and skl versions
In reply to Jani NikulaQuoted 46 lines · Jani Nikula
From: Dave Airlie <[email protected]>
This just cleans these up a bit.
Signed-off-by Dave Airlie <[email protected]>Signed-off-by Jani Nikula <[email protected]>--- drivers/gpu/drm/i915/display/intel_gen9_plane.c | 4 ++-- drivers/gpu/drm/i915/display/intel_sprite.c | 7 +++---- 2 files changed, 5 insertions(+), 6 deletions(-)drivers/gpu/drm/i915/display/intel_gen9_plane.c +2
-2@@ -2139,7 +2139,7 @@ static int skl_check_plane_surface(struct intel_plane_state *plane_state)return 0 ; } -static bool intel_fb_scalable (const struct drm_framebuffer *fb) +static bool skl_fb_scalable (const struct drm_framebuffer *fb) {if (!fb)return false;@@ -2172,7 +2172,7 @@ static int skl_plane_check(struct intel_crtc_state *crtc_state,return ret;/* use scaler when colorkey is not required */ -if (!plane_state->ckey.flags &&intel_fb_scalable (fb)) { +if (!plane_state->ckey.flags &&skl_fb_scalable (fb)) { min_scale =1 ; max_scale =skl_plane_max_scale (dev_priv, fb); }drivers/gpu/drm/i915/display/intel_sprite.c +1
-1@@ -1282,19 +1282,18 @@ g4x_plane_get_hw_state(struct intel_plane *plane,return ret; } -static bool intel_fb_scalable (const struct drm_framebuffer *fb) +static bool g4x_fb_scalable (const struct drm_framebuffer *fb) {if (!fb)return false;
drivers/gpu/drm/i915/display/intel_sprite.c g4x_plane_get_hw_state(struct intel_plane *plane, · line 1296
Quoted 10 lines
drivers/gpu/drm/i915/display/intel_sprite.c +1
-2switch (fb->format->format) {case DRM_FORMAT_C8 : -return false;case DRM_FORMAT_XRGB16161616F :case DRM_FORMAT_ARGB16161616F :case DRM_FORMAT_XBGR16161616F :case DRM_FORMAT_ABGR16161616F : -return INTEL_GEN (to_i915 (fb->dev)) >=11 ; +return false;
We could drop a bunch of the formats here since they're not supported by the g4x+ sprites anyway. But that could be a followup.
Quoted 14 lines
drivers/gpu/drm/i915/display/intel_sprite.c +1
-1default :return true; }@@ -1371,7 +1370,7 @@ g4x_sprite_check(struct intel_crtc_state *crtc_state,int max_scale =DRM_PLANE_HELPER_NO_SCALING ;int ret; -if (intel_fb_scalable (plane_state->hw.fb)) { +if (g4x_fb_scalable (plane_state->hw.fb)) {if (INTEL_GEN (dev_priv) <7 ) { min_scale =1 ; max_scale =16 <<16 ;Signature · 1 line
2.20.1
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 v4 08/11] drm/i915: migrate hsw fdi code to new file.
In reply to Jani NikulaQuoted 46 lines · Jani Nikula
From: 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.
Signed-off-by Dave Airlie <[email protected]>[Jani: also moved fdi buf trans to intel_fdi.c.]Signed-off-by Jani Nikula <[email protected]>--- drivers/gpu/drm/i915/display/intel_crt.c | 1 + drivers/gpu/drm/i915/display/intel_ddi.c | 197 +---------------------- drivers/gpu/drm/i915/display/intel_ddi.h | 14 +- drivers/gpu/drm/i915/display/intel_fdi.c | 174 ++++++++++++++++++++ drivers/gpu/drm/i915/display/intel_fdi.h | 7 + 5 files changed, 202 insertions(+), 191 deletions(-)drivers/gpu/drm/i915/display/intel_crt.c +1
-0@@ -38,6 +38,7 @@#include "intel_crt.h" #include "intel_ddi.h" #include "intel_display_types.h" +#include "intel_fdi.h" #include "intel_fifo_underrun.h" #include "intel_gmbus.h" #include "intel_hotplug.h" drivers/gpu/drm/i915/display/intel_ddi.c +2
-1@@ -35,10 +35,11 @@#include "intel_ddi.h" #include "intel_display_types.h" #include "intel_dp.h" -#include "intel_dp_mst.h" #include "intel_dp_link_training.h" +#include "intel_dp_mst.h" #include "intel_dpio_phy.h" #include "intel_dsi.h" +#include "intel_fdi.h" #include "intel_fifo_underrun.h" #include "intel_gmbus.h" #include "intel_hdcp.h"
drivers/gpu/drm/i915/display/intel_ddi.c line 58
Quoted 8 lines
drivers/gpu/drm/i915/display/intel_ddi.c +0
-5@@ -51,12 +52,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 */ -};
I'd suggest not moving any buf_trans stuff into intel_fdi.c. Rather we want something like intel_ddi_buf_trans.c to house all of it.
Quoted 508 lines
drivers/gpu/drm/i915/display/intel_ddi.c +6
-183-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 ,@@ -86,18 +81,6 @@ static const struct ddi_buf_trans hsw_ddi_translations_dp[] = { { 0x80D75FFF, 0x000B0000, 0x0 }, }; -static const struct ddi_buf_trans hsw_ddi_translations_fdi[] = { - {0x00FFFFFF ,0x0007000E ,0x0 }, - {0x00D75FFF ,0x000F000A ,0x0 }, - {0x00C30FFF ,0x00060006 ,0x0 }, - {0x00AAAFFF ,0x001E0000 ,0x0 }, - {0x00FFFFFF ,0x000F000A ,0x0 }, - {0x00D75FFF ,0x00160004 ,0x0 }, - {0x00C30FFF ,0x001E0000 ,0x0 }, - {0x00FFFFFF ,0x00060006 ,0x0 }, - {0x00D75FFF ,0x001E0000 ,0x0 }, -}; -static const struct ddi_buf_trans hsw_ddi_translations_hdmi[] = {/* Idx NT mV d T mV d db */ { 0x00FFFFFF, 0x0006000E, 0x0 },/* 0: 400 400 0 */@@ -138,18 +121,6 @@ static const struct ddi_buf_trans bdw_ddi_translations_dp[] = { { 0x80D75FFF, 0x001B0002, 0x0 }, }; -static const struct ddi_buf_trans bdw_ddi_translations_fdi[] = { - {0x00FFFFFF ,0x0001000E ,0x0 }, - {0x00D75FFF ,0x0004000A ,0x0 }, - {0x00C30FFF ,0x00070006 ,0x0 }, - {0x00AAAFFF ,0x000C0000 ,0x0 }, - {0x00FFFFFF ,0x0004000A ,0x0 }, - {0x00D75FFF ,0x00090004 ,0x0 }, - {0x00C30FFF ,0x000C0000 ,0x0 }, - {0x00FFFFFF ,0x00070006 ,0x0 }, - {0x00D75FFF ,0x000C0000 ,0x0 }, -}; -static const struct ddi_buf_trans bdw_ddi_translations_hdmi[] = {/* Idx NT mV d T mV df db */ { 0x00FFFFFF, 0x0007000E, 0x0 },/* 0: 400 400 0 */@@ -929,22 +900,6 @@ intel_ddi_get_buf_trans_edp(struct intel_encoder *encoder, int *n_entries)return NULL ; } -static const struct ddi_buf_trans * -intel_ddi_get_buf_trans_fdi (struct drm_i915_private *dev_priv, -int *n_entries) -{ -if (IS_BROADWELL (dev_priv)) { - *n_entries =ARRAY_SIZE (bdw_ddi_translations_fdi); -return bdw_ddi_translations_fdi; - }else if (IS_HASWELL (dev_priv)) { - *n_entries =ARRAY_SIZE (hsw_ddi_translations_fdi); -return hsw_ddi_translations_fdi; - } - - *n_entries =0 ; -return NULL ; -} -static const struct ddi_buf_trans *intel_ddi_get_buf_trans_hdmi (struct intel_encoder *encoder,int *n_entries)@@ -1398,8 +1353,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 ;@@ -1408,8 +1363,7 @@ static void intel_prepare_dp_ddi_buffers(struct intel_encoder *encoder,const struct ddi_buf_trans *ddi_translations;if (intel_crtc_has_type (crtc_state,INTEL_OUTPUT_ANALOG )) - ddi_translations =intel_ddi_get_buf_trans_fdi (dev_priv, - &n_entries); + ddi_translations =intel_fdi_get_buf_trans (dev_priv, &n_entries);else if (intel_crtc_has_type (crtc_state,INTEL_OUTPUT_EDP )) ddi_translations =intel_ddi_get_buf_trans_edp (encoder, &n_entries);@@ -1461,8 +1415,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 +1444,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 +1504,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_fdi.c +174
-0@@ -3,9 +3,49 @@* Copyright © 2020 Intel Corporation */ #include "intel_atomic.h" +#include "intel_ddi.h" #include "intel_display_types.h" #include "intel_fdi.h" +static const struct ddi_buf_trans bdw_ddi_translations_fdi[] = { + {0x00FFFFFF ,0x0001000E ,0x0 }, + {0x00D75FFF ,0x0004000A ,0x0 }, + {0x00C30FFF ,0x00070006 ,0x0 }, + {0x00AAAFFF ,0x000C0000 ,0x0 }, + {0x00FFFFFF ,0x0004000A ,0x0 }, + {0x00D75FFF ,0x00090004 ,0x0 }, + {0x00C30FFF ,0x000C0000 ,0x0 }, + {0x00FFFFFF ,0x00070006 ,0x0 }, + {0x00D75FFF ,0x000C0000 ,0x0 }, +}; + +static const struct ddi_buf_trans hsw_ddi_translations_fdi[] = { + {0x00FFFFFF ,0x0007000E ,0x0 }, + {0x00D75FFF ,0x000F000A ,0x0 }, + {0x00C30FFF ,0x00060006 ,0x0 }, + {0x00AAAFFF ,0x001E0000 ,0x0 }, + {0x00FFFFFF ,0x000F000A ,0x0 }, + {0x00D75FFF ,0x00160004 ,0x0 }, + {0x00C30FFF ,0x001E0000 ,0x0 }, + {0x00FFFFFF ,0x00060006 ,0x0 }, + {0x00D75FFF ,0x001E0000 ,0x0 }, +}; + +const struct ddi_buf_trans * +intel_fdi_get_buf_trans (struct drm_i915_private *dev_priv,int *n_entries) +{ +if (IS_BROADWELL (dev_priv)) { + *n_entries =ARRAY_SIZE (bdw_ddi_translations_fdi); +return bdw_ddi_translations_fdi; + }else if (IS_HASWELL (dev_priv)) { + *n_entries =ARRAY_SIZE (hsw_ddi_translations_fdi); +return hsw_ddi_translations_fdi; + } + + *n_entries =0 ; +return NULL ; +} +/* units of 100MHz */ static int pipe_required_fdi_lanes (struct intel_crtc_state *crtc_state) {@@ -550,6 +590,140 @@ static void ivb_manual_fdi_link_train(struct intel_crtc *crtc,drm_dbg_kms (&dev_priv->drm,"FDI train done.\n" ); } +/* 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 ); +} +void ilk_fdi_pll_enable (const struct intel_crtc_state *crtc_state) {struct intel_crtc *intel_crtc =to_intel_crtc (crtc_state->uapi.crtc);drivers/gpu/drm/i915/display/intel_fdi.h +7
-0@@ -9,6 +9,11 @@struct drm_i915_private ;struct intel_crtc ;struct intel_crtc_state ; +struct intel_encoder ; +struct ddi_buf_trans ; + +const struct ddi_buf_trans * +intel_fdi_get_buf_trans (struct drm_i915_private *dev_priv,int *n_entries);#define I915_DISPLAY_CONFIG_RETRY 1 int ilk_fdi_compute_config(struct intel_crtc *intel_crtc,@@ -18,5 +23,7 @@ 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_fdi_init_hook (struct drm_i915_private *dev_priv); +void hsw_fdi_link_train (struct intel_encoder *encoder, +const struct intel_crtc_state *crtc_state);#endif Signature · 1 line
2.20.1
Signature · 6 lines
Ville Syrjälä Intel _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI[Intel-gfx] ✗ Fi.CI.BUILD: failure for drm/i915: refactor intel display
In reply to Jani Nikula== Series Details ==
== Series Details ==
Series: drm/i915: refactor intel display
URL : https://patchwork.freedesktop.org/series/84998/
State : failure
== Summary ==
Applying: drm/i915/display: move needs_modeset to an inline in header
Applying: drm/i915/display: move to_intel_frontbuffer to header
Applying: drm/i915/display: fix misused comma
Applying: drm/i915: refactor cursor code out of i915_display.c
Applying: drm/i915: refactor some crtc code out of intel display. Using index info to reconstruct a base tree...
M drivers/gpu/drm/i915/display/intel_display.c
Falling back to patching base and 3-way merge...
Auto-merging drivers/gpu/drm/i915/display/intel_display.c
CONFLICT (content): Merge conflict in drivers/gpu/drm/i915/display/intel_display.c
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch Patch failed at 0005 drm/i915: refactor some crtc code out of intel display. When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
[Intel-gfx] [kbuild] Re: [PATCH v4 09/11] drm/i915: migrate skl planes code new file
In reply to Jani NikulaHi Jani,
url: https://github.com/0day-ci/linux/commits/Jani-Nikula/drm-i915-refactor-intel-display/20201216-194754 base: git://anongit.freedesktop.org/drm-intel for-linux-next config: x86_64-randconfig-m001-20201216 (attached as .config) compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
If you fix the issue, kindly add following tag as appropriate
smatch warnings:drivers/gpu/drm/i915/display/intel_gen9_plane.c:712 skl_update_scaler_plane() error: we previously assumed 'fb' could be null (see line 696)
vim +/fb +712 drivers/gpu/drm/i915/display/intel_gen9_plane.c
44f5af76b2fd05e Dave Airlie 2020-12-16 672 int skl_update_scaler_plane(struct intel_crtc_state *crtc_state,
44f5af76b2fd05e Dave Airlie 2020-12-16 673 struct intel_plane_state *plane_state)
44f5af76b2fd05e Dave Airlie 2020-12-16 674 {
44f5af76b2fd05e Dave Airlie 2020-12-16 675 struct intel_plane *intel_plane =
44f5af76b2fd05e Dave Airlie 2020-12-16 676 to_intel_plane(plane_state->uapi.plane);
44f5af76b2fd05e Dave Airlie 2020-12-16 677 struct drm_i915_private *dev_priv = to_i915(intel_plane->base.dev);
44f5af76b2fd05e Dave Airlie 2020-12-16 678 struct drm_framebuffer *fb = plane_state->hw.fb;
44f5af76b2fd05e Dave Airlie 2020-12-16 679 int ret;
44f5af76b2fd05e Dave Airlie 2020-12-16 680 bool force_detach = !fb || !plane_state->uapi.visible;
44f5af76b2fd05e Dave Airlie 2020-12-16 681 bool need_scaler = false;
44f5af76b2fd05e Dave Airlie 2020-12-16 682
44f5af76b2fd05e Dave Airlie 2020-12-16 683 /* Pre-gen11 and SDR planes always need a scaler for planar formats. */
44f5af76b2fd05e Dave Airlie 2020-12-16 684 if (!icl_is_hdr_plane(dev_priv, intel_plane->id) &&
44f5af76b2fd05e Dave Airlie 2020-12-16 685 fb && intel_format_info_is_yuv_semiplanar(fb->format, fb->modifier))
44f5af76b2fd05e Dave Airlie 2020-12-16 686 need_scaler = true;
44f5af76b2fd05e Dave Airlie 2020-12-16 687
44f5af76b2fd05e Dave Airlie 2020-12-16 688 ret = skl_update_scaler(crtc_state, force_detach,
44f5af76b2fd05e Dave Airlie 2020-12-16 689 drm_plane_index(&intel_plane->base),
44f5af76b2fd05e Dave Airlie 2020-12-16 690 &plane_state->scaler_id,
44f5af76b2fd05e Dave Airlie 2020-12-16 691 drm_rect_width(&plane_state->uapi.src) >> 16,
44f5af76b2fd05e Dave Airlie 2020-12-16 692 drm_rect_height(&plane_state->uapi.src) >> 16,
44f5af76b2fd05e Dave Airlie 2020-12-16 693 drm_rect_width(&plane_state->uapi.dst),
44f5af76b2fd05e Dave Airlie 2020-12-16 694 drm_rect_height(&plane_state->uapi.dst),
44f5af76b2fd05e Dave Airlie 2020-12-16 695 fb ? fb->format : NULL,
44f5af76b2fd05e Dave Airlie 2020-12-16 @696 fb ? fb->modifier : 0,
^^^^^^^^^^^^^^^^^This code and all previous code assumes that "fb" can be NULL.
44f5af76b2fd05e Dave Airlie 2020-12-16 697 need_scaler);
44f5af76b2fd05e Dave Airlie 2020-12-16 698
44f5af76b2fd05e Dave Airlie 2020-12-16 699 if (ret || plane_state->scaler_id < 0)
^^^^^^^^^^^^^^^^^^^^^^^^^^Is this an error path? Should we set "ret = -EINVAL;" for this?
44f5af76b2fd05e Dave Airlie 2020-12-16 700 return ret;
44f5af76b2fd05e Dave Airlie 2020-12-16 701
44f5af76b2fd05e Dave Airlie 2020-12-16 702 /* check colorkey */
44f5af76b2fd05e Dave Airlie 2020-12-16 703 if (plane_state->ckey.flags) {
44f5af76b2fd05e Dave Airlie 2020-12-16 704 drm_dbg_kms(&dev_priv->drm,
44f5af76b2fd05e Dave Airlie 2020-12-16 705 "[PLANE:%d:%s] scaling with color key not allowed",
44f5af76b2fd05e Dave Airlie 2020-12-16 706 intel_plane->base.base.id,
44f5af76b2fd05e Dave Airlie 2020-12-16 707 intel_plane->base.name);
44f5af76b2fd05e Dave Airlie 2020-12-16 708 return -EINVAL;
44f5af76b2fd05e Dave Airlie 2020-12-16 709 }
44f5af76b2fd05e Dave Airlie 2020-12-16 710
44f5af76b2fd05e Dave Airlie 2020-12-16 711 /* Check src format */
44f5af76b2fd05e Dave Airlie 2020-12-16 @712 switch (fb->format->format) {
^^^^^^^^^^Unchecked dereference.
44f5af76b2fd05e Dave Airlie 2020-12-16 713 case DRM_FORMAT_RGB565: 44f5af76b2fd05e Dave Airlie 2020-12-16 714 case DRM_FORMAT_XBGR8888: 44f5af76b2fd05e Dave Airlie 2020-12-16 715 case DRM_FORMAT_XRGB8888: 44f5af76b2fd05e Dave Airlie 2020-12-16 716 case DRM_FORMAT_ABGR8888: 44f5af76b2fd05e Dave Airlie 2020-12-16 717 case DRM_FORMAT_ARGB8888: 44f5af76b2fd05e Dave Airlie 2020-12-16 718 case DRM_FORMAT_XRGB2101010:
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
_______________________________________________
kbuild mailing list -- kbuild(a)lists.01.org
To unsubscribe send an email to kbuild-leave(a)lists.01.org