Skip to content

Commit 38624d2

Browse files
committed
Merge tag 'drm-intel-next-fixes-2022-12-15' of git://anongit.freedesktop.org/drm/drm-intel into drm-next
- Documentation fixe (Matt, Miaoqian) - OA-perf related fix (Umesh) - VLV/CHV HDMI/DP audio fix (Ville) - Display DDI/Transcoder fix (Khaled) - Migrate fixes (Chris, Matt) Signed-off-by: Dave Airlie <[email protected]> From: Rodrigo Vivi <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/Y5uFYOJ/[email protected]
2 parents 5504eb1 + ad0fca2 commit 38624d2

File tree

10 files changed

+96
-88
lines changed

10 files changed

+96
-88
lines changed

drivers/gpu/drm/i915/display/g4x_dp.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -673,8 +673,6 @@ static void intel_enable_dp(struct intel_atomic_state *state,
673673
intel_dp_pcon_dsc_configure(intel_dp, pipe_config);
674674
intel_dp_start_link_train(intel_dp, pipe_config);
675675
intel_dp_stop_link_train(intel_dp, pipe_config);
676-
677-
intel_audio_codec_enable(encoder, pipe_config, conn_state);
678676
}
679677

680678
static void g4x_enable_dp(struct intel_atomic_state *state,
@@ -683,6 +681,7 @@ static void g4x_enable_dp(struct intel_atomic_state *state,
683681
const struct drm_connector_state *conn_state)
684682
{
685683
intel_enable_dp(state, encoder, pipe_config, conn_state);
684+
intel_audio_codec_enable(encoder, pipe_config, conn_state);
686685
intel_edp_backlight_on(pipe_config, conn_state);
687686
}
688687

@@ -691,6 +690,7 @@ static void vlv_enable_dp(struct intel_atomic_state *state,
691690
const struct intel_crtc_state *pipe_config,
692691
const struct drm_connector_state *conn_state)
693692
{
693+
intel_audio_codec_enable(encoder, pipe_config, conn_state);
694694
intel_edp_backlight_on(pipe_config, conn_state);
695695
}
696696

drivers/gpu/drm/i915/display/g4x_hdmi.c

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -157,10 +157,8 @@ static void intel_hdmi_get_config(struct intel_encoder *encoder,
157157
&pipe_config->infoframes.hdmi);
158158
}
159159

160-
static void g4x_enable_hdmi(struct intel_atomic_state *state,
161-
struct intel_encoder *encoder,
162-
const struct intel_crtc_state *pipe_config,
163-
const struct drm_connector_state *conn_state)
160+
static void g4x_hdmi_enable_port(struct intel_encoder *encoder,
161+
const struct intel_crtc_state *pipe_config)
164162
{
165163
struct drm_device *dev = encoder->base.dev;
166164
struct drm_i915_private *dev_priv = to_i915(dev);
@@ -175,6 +173,16 @@ static void g4x_enable_hdmi(struct intel_atomic_state *state,
175173

176174
intel_de_write(dev_priv, intel_hdmi->hdmi_reg, temp);
177175
intel_de_posting_read(dev_priv, intel_hdmi->hdmi_reg);
176+
}
177+
178+
static void g4x_enable_hdmi(struct intel_atomic_state *state,
179+
struct intel_encoder *encoder,
180+
const struct intel_crtc_state *pipe_config,
181+
const struct drm_connector_state *conn_state)
182+
{
183+
struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
184+
185+
g4x_hdmi_enable_port(encoder, pipe_config);
178186

179187
drm_WARN_ON(&dev_priv->drm, pipe_config->has_audio &&
180188
!pipe_config->has_hdmi_sink);
@@ -294,6 +302,11 @@ static void vlv_enable_hdmi(struct intel_atomic_state *state,
294302
const struct intel_crtc_state *pipe_config,
295303
const struct drm_connector_state *conn_state)
296304
{
305+
struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
306+
307+
drm_WARN_ON(&dev_priv->drm, pipe_config->has_audio &&
308+
!pipe_config->has_hdmi_sink);
309+
intel_audio_codec_enable(encoder, pipe_config, conn_state);
297310
}
298311

299312
static void intel_disable_hdmi(struct intel_atomic_state *state,
@@ -415,7 +428,7 @@ static void vlv_hdmi_pre_enable(struct intel_atomic_state *state,
415428
pipe_config->has_infoframe,
416429
pipe_config, conn_state);
417430

418-
g4x_enable_hdmi(state, encoder, pipe_config, conn_state);
431+
g4x_hdmi_enable_port(encoder, pipe_config);
419432

420433
vlv_wait_port_ready(dev_priv, dig_port, 0x0);
421434
}
@@ -492,7 +505,7 @@ static void chv_hdmi_pre_enable(struct intel_atomic_state *state,
492505
pipe_config->has_infoframe,
493506
pipe_config, conn_state);
494507

495-
g4x_enable_hdmi(state, encoder, pipe_config, conn_state);
508+
g4x_hdmi_enable_port(encoder, pipe_config);
496509

497510
vlv_wait_port_ready(dev_priv, dig_port, 0x0);
498511

drivers/gpu/drm/i915/display/intel_dp.c

Lines changed: 0 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -3679,61 +3679,6 @@ static void intel_dp_phy_pattern_update(struct intel_dp *intel_dp,
36793679
}
36803680
}
36813681

3682-
static void
3683-
intel_dp_autotest_phy_ddi_disable(struct intel_dp *intel_dp,
3684-
const struct intel_crtc_state *crtc_state)
3685-
{
3686-
struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
3687-
struct drm_device *dev = dig_port->base.base.dev;
3688-
struct drm_i915_private *dev_priv = to_i915(dev);
3689-
struct intel_crtc *crtc = to_intel_crtc(dig_port->base.base.crtc);
3690-
enum pipe pipe = crtc->pipe;
3691-
u32 trans_ddi_func_ctl_value, trans_conf_value, dp_tp_ctl_value;
3692-
3693-
trans_ddi_func_ctl_value = intel_de_read(dev_priv,
3694-
TRANS_DDI_FUNC_CTL(pipe));
3695-
trans_conf_value = intel_de_read(dev_priv, PIPECONF(pipe));
3696-
dp_tp_ctl_value = intel_de_read(dev_priv, TGL_DP_TP_CTL(pipe));
3697-
3698-
trans_ddi_func_ctl_value &= ~(TRANS_DDI_FUNC_ENABLE |
3699-
TGL_TRANS_DDI_PORT_MASK);
3700-
trans_conf_value &= ~PIPECONF_ENABLE;
3701-
dp_tp_ctl_value &= ~DP_TP_CTL_ENABLE;
3702-
3703-
intel_de_write(dev_priv, PIPECONF(pipe), trans_conf_value);
3704-
intel_de_write(dev_priv, TRANS_DDI_FUNC_CTL(pipe),
3705-
trans_ddi_func_ctl_value);
3706-
intel_de_write(dev_priv, TGL_DP_TP_CTL(pipe), dp_tp_ctl_value);
3707-
}
3708-
3709-
static void
3710-
intel_dp_autotest_phy_ddi_enable(struct intel_dp *intel_dp,
3711-
const struct intel_crtc_state *crtc_state)
3712-
{
3713-
struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
3714-
struct drm_device *dev = dig_port->base.base.dev;
3715-
struct drm_i915_private *dev_priv = to_i915(dev);
3716-
enum port port = dig_port->base.port;
3717-
struct intel_crtc *crtc = to_intel_crtc(dig_port->base.base.crtc);
3718-
enum pipe pipe = crtc->pipe;
3719-
u32 trans_ddi_func_ctl_value, trans_conf_value, dp_tp_ctl_value;
3720-
3721-
trans_ddi_func_ctl_value = intel_de_read(dev_priv,
3722-
TRANS_DDI_FUNC_CTL(pipe));
3723-
trans_conf_value = intel_de_read(dev_priv, PIPECONF(pipe));
3724-
dp_tp_ctl_value = intel_de_read(dev_priv, TGL_DP_TP_CTL(pipe));
3725-
3726-
trans_ddi_func_ctl_value |= TRANS_DDI_FUNC_ENABLE |
3727-
TGL_TRANS_DDI_SELECT_PORT(port);
3728-
trans_conf_value |= PIPECONF_ENABLE;
3729-
dp_tp_ctl_value |= DP_TP_CTL_ENABLE;
3730-
3731-
intel_de_write(dev_priv, PIPECONF(pipe), trans_conf_value);
3732-
intel_de_write(dev_priv, TGL_DP_TP_CTL(pipe), dp_tp_ctl_value);
3733-
intel_de_write(dev_priv, TRANS_DDI_FUNC_CTL(pipe),
3734-
trans_ddi_func_ctl_value);
3735-
}
3736-
37373682
static void intel_dp_process_phy_request(struct intel_dp *intel_dp,
37383683
const struct intel_crtc_state *crtc_state)
37393684
{
@@ -3752,14 +3697,10 @@ static void intel_dp_process_phy_request(struct intel_dp *intel_dp,
37523697
intel_dp_get_adjust_train(intel_dp, crtc_state, DP_PHY_DPRX,
37533698
link_status);
37543699

3755-
intel_dp_autotest_phy_ddi_disable(intel_dp, crtc_state);
3756-
37573700
intel_dp_set_signal_levels(intel_dp, crtc_state, DP_PHY_DPRX);
37583701

37593702
intel_dp_phy_pattern_update(intel_dp, crtc_state);
37603703

3761-
intel_dp_autotest_phy_ddi_enable(intel_dp, crtc_state);
3762-
37633704
drm_dp_dpcd_write(&intel_dp->aux, DP_TRAINING_LANE0_SET,
37643705
intel_dp->train_set, crtc_state->lane_count);
37653706

drivers/gpu/drm/i915/gem/i915_gem_object.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -785,6 +785,9 @@ bool i915_gem_object_needs_ccs_pages(struct drm_i915_gem_object *obj)
785785
if (!HAS_FLAT_CCS(to_i915(obj->base.dev)))
786786
return false;
787787

788+
if (obj->flags & I915_BO_ALLOC_CCS_AUX)
789+
return true;
790+
788791
for (i = 0; i < obj->mm.n_placements; i++) {
789792
/* Compression is not allowed for the objects with smem placement */
790793
if (obj->mm.placements[i]->type == INTEL_MEMORY_SYSTEM)

drivers/gpu/drm/i915/gem/i915_gem_object_types.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -327,16 +327,18 @@ struct drm_i915_gem_object {
327327
* dealing with userspace objects the CPU fault handler is free to ignore this.
328328
*/
329329
#define I915_BO_ALLOC_GPU_ONLY BIT(6)
330+
#define I915_BO_ALLOC_CCS_AUX BIT(7)
330331
#define I915_BO_ALLOC_FLAGS (I915_BO_ALLOC_CONTIGUOUS | \
331332
I915_BO_ALLOC_VOLATILE | \
332333
I915_BO_ALLOC_CPU_CLEAR | \
333334
I915_BO_ALLOC_USER | \
334335
I915_BO_ALLOC_PM_VOLATILE | \
335336
I915_BO_ALLOC_PM_EARLY | \
336-
I915_BO_ALLOC_GPU_ONLY)
337-
#define I915_BO_READONLY BIT(7)
338-
#define I915_TILING_QUIRK_BIT 8 /* unknown swizzling; do not release! */
339-
#define I915_BO_PROTECTED BIT(9)
337+
I915_BO_ALLOC_GPU_ONLY | \
338+
I915_BO_ALLOC_CCS_AUX)
339+
#define I915_BO_READONLY BIT(8)
340+
#define I915_TILING_QUIRK_BIT 9 /* unknown swizzling; do not release! */
341+
#define I915_BO_PROTECTED BIT(10)
340342
/**
341343
* @mem_flags - Mutable placement-related flags
342344
*

drivers/gpu/drm/i915/gem/i915_gem_ttm_pm.c

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ static int i915_ttm_backup(struct i915_gem_apply_to_region *apply,
5050
container_of(bo->bdev, typeof(*i915), bdev);
5151
struct drm_i915_gem_object *backup;
5252
struct ttm_operation_ctx ctx = {};
53+
unsigned int flags;
5354
int err = 0;
5455

5556
if (bo->resource->mem_type == I915_PL_SYSTEM || obj->ttm.backup)
@@ -65,7 +66,22 @@ static int i915_ttm_backup(struct i915_gem_apply_to_region *apply,
6566
if (obj->flags & I915_BO_ALLOC_PM_VOLATILE)
6667
return 0;
6768

68-
backup = i915_gem_object_create_shmem(i915, obj->base.size);
69+
/*
70+
* It seems that we might have some framebuffers still pinned at this
71+
* stage, but for such objects we might also need to deal with the CCS
72+
* aux state. Make sure we force the save/restore of the CCS state,
73+
* otherwise we might observe display corruption, when returning from
74+
* suspend.
75+
*/
76+
flags = 0;
77+
if (i915_gem_object_needs_ccs_pages(obj)) {
78+
WARN_ON_ONCE(!i915_gem_object_is_framebuffer(obj));
79+
WARN_ON_ONCE(!pm_apply->allow_gpu);
80+
81+
flags = I915_BO_ALLOC_CCS_AUX;
82+
}
83+
backup = i915_gem_object_create_region(i915->mm.regions[INTEL_REGION_SMEM],
84+
obj->base.size, 0, flags);
6985
if (IS_ERR(backup))
7086
return PTR_ERR(backup);
7187

drivers/gpu/drm/i915/gt/intel_gt_mcr.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -702,7 +702,7 @@ void intel_gt_mcr_get_ss_steering(struct intel_gt *gt, unsigned int dss,
702702
}
703703

704704
/**
705-
* intel_gt_mcr_wait_for_reg_fw - wait until MCR register matches expected state
705+
* intel_gt_mcr_wait_for_reg - wait until MCR register matches expected state
706706
* @gt: GT structure
707707
* @reg: the register to read
708708
* @mask: mask to apply to register value

drivers/gpu/drm/i915/gt/intel_migrate.c

Lines changed: 41 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,16 @@ static int emit_no_arbitration(struct i915_request *rq)
342342
return 0;
343343
}
344344

345+
static int max_pte_pkt_size(struct i915_request *rq, int pkt)
346+
{
347+
struct intel_ring *ring = rq->ring;
348+
349+
pkt = min_t(int, pkt, (ring->space - rq->reserved_space) / sizeof(u32) + 5);
350+
pkt = min_t(int, pkt, (ring->size - ring->emit) / sizeof(u32) + 5);
351+
352+
return pkt;
353+
}
354+
345355
static int emit_pte(struct i915_request *rq,
346356
struct sgt_dma *it,
347357
enum i915_cache_level cache_level,
@@ -388,8 +398,7 @@ static int emit_pte(struct i915_request *rq,
388398
return PTR_ERR(cs);
389399

390400
/* Pack as many PTE updates as possible into a single MI command */
391-
pkt = min_t(int, dword_length, ring->space / sizeof(u32) + 5);
392-
pkt = min_t(int, pkt, (ring->size - ring->emit) / sizeof(u32) + 5);
401+
pkt = max_pte_pkt_size(rq, dword_length);
393402

394403
hdr = cs;
395404
*cs++ = MI_STORE_DATA_IMM | REG_BIT(21); /* as qword elements */
@@ -422,8 +431,7 @@ static int emit_pte(struct i915_request *rq,
422431
}
423432
}
424433

425-
pkt = min_t(int, dword_rem, ring->space / sizeof(u32) + 5);
426-
pkt = min_t(int, pkt, (ring->size - ring->emit) / sizeof(u32) + 5);
434+
pkt = max_pte_pkt_size(rq, dword_rem);
427435

428436
hdr = cs;
429437
*cs++ = MI_STORE_DATA_IMM | REG_BIT(21);
@@ -829,14 +837,35 @@ intel_context_migrate_copy(struct intel_context *ce,
829837
if (err)
830838
goto out_rq;
831839

832-
/*
833-
* While we can't always restore/manage the CCS state,
834-
* we still need to ensure we don't leak the CCS state
835-
* from the previous user, so make sure we overwrite it
836-
* with something.
837-
*/
838-
err = emit_copy_ccs(rq, dst_offset, INDIRECT_ACCESS,
839-
dst_offset, DIRECT_ACCESS, len);
840+
if (src_is_lmem) {
841+
/*
842+
* If the src is already in lmem, then we must
843+
* be doing an lmem -> lmem transfer, and so
844+
* should be safe to directly copy the CCS
845+
* state. In this case we have either
846+
* initialised the CCS aux state when first
847+
* clearing the pages (since it is already
848+
* allocated in lmem), or the user has
849+
* potentially populated it, in which case we
850+
* need to copy the CCS state as-is.
851+
*/
852+
err = emit_copy_ccs(rq,
853+
dst_offset, INDIRECT_ACCESS,
854+
src_offset, INDIRECT_ACCESS,
855+
len);
856+
} else {
857+
/*
858+
* While we can't always restore/manage the CCS
859+
* state, we still need to ensure we don't leak
860+
* the CCS state from the previous user, so make
861+
* sure we overwrite it with something.
862+
*/
863+
err = emit_copy_ccs(rq,
864+
dst_offset, INDIRECT_ACCESS,
865+
dst_offset, DIRECT_ACCESS,
866+
len);
867+
}
868+
840869
if (err)
841870
goto out_rq;
842871

drivers/gpu/drm/i915/i915_perf.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1383,6 +1383,9 @@ static u32 oa_context_image_offset(struct intel_context *ce, u32 reg)
13831383
u32 offset, len = (ce->engine->context_size - PAGE_SIZE) / 4;
13841384
u32 *state = ce->lrc_reg_state;
13851385

1386+
if (drm_WARN_ON(&ce->engine->i915->drm, !state))
1387+
return U32_MAX;
1388+
13861389
for (offset = 0; offset < len; ) {
13871390
if (IS_MI_LRI_CMD(state[offset])) {
13881391
/*
@@ -1447,7 +1450,8 @@ static int oa_get_render_ctx_id(struct i915_perf_stream *stream)
14471450
if (IS_ERR(ce))
14481451
return PTR_ERR(ce);
14491452

1450-
if (engine_supports_mi_query(stream->engine)) {
1453+
if (engine_supports_mi_query(stream->engine) &&
1454+
HAS_LOGICAL_RING_CONTEXTS(stream->perf->i915)) {
14511455
/*
14521456
* We are enabling perf query here. If we don't find the context
14531457
* offset here, just return an error.

drivers/gpu/drm/i915/intel_uncore.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -824,9 +824,9 @@ void intel_uncore_forcewake_flush(struct intel_uncore *uncore,
824824
}
825825

826826
/**
827-
* intel_uncore_forcewake_put__locked - grab forcewake domain references
827+
* intel_uncore_forcewake_put__locked - release forcewake domain references
828828
* @uncore: the intel_uncore structure
829-
* @fw_domains: forcewake domains to get reference on
829+
* @fw_domains: forcewake domains to put references
830830
*
831831
* See intel_uncore_forcewake_put(). This variant places the onus
832832
* on the caller to explicitly handle the dev_priv->uncore.lock spinlock.

0 commit comments

Comments
 (0)