Skip to content

Commit 2d0720f

Browse files
committed
Merge tag 'drm-intel-next-fixes-2019-11-14' of git://anongit.freedesktop.org/drm/drm-intel into drm-next
- PMU "Frequency" is reported as accumulated cycles - Avoid OOPS in dumb_create IOCTL when no CRTCs - Mitigation for userptr put_pages deadlock with trylock_page - Fix to avoid freeing heartbeat request too early - Fix LRC coherency issue - Fix Bugzilla #112212: Avoid screen corruption on MST - Error path fix to unlock context on failed context VM SETPARAM - Always consider holding preemption a privileged op in perf/OA - Preload LUTs if the hw isn't currently using them to avoid color flash on VLV/CHV - Protect context while grabbing its name for the request - Don't resize aliasing ppGTT size - Smaller fixes picked by tooling Signed-off-by: Dave Airlie <[email protected]> From: Joonas Lahtinen <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2 parents dfce902 + 789c4ae commit 2d0720f

15 files changed

+181
-79
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ intel_crtc_duplicate_state(struct drm_crtc *crtc)
200200
crtc_state->update_wm_pre = false;
201201
crtc_state->update_wm_post = false;
202202
crtc_state->fifo_changed = false;
203+
crtc_state->preload_luts = false;
203204
crtc_state->wm.need_postvbl_update = false;
204205
crtc_state->fb_bits = 0;
205206
crtc_state->update_planes = 0;

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

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1022,6 +1022,55 @@ void intel_color_commit(const struct intel_crtc_state *crtc_state)
10221022
dev_priv->display.color_commit(crtc_state);
10231023
}
10241024

1025+
static bool intel_can_preload_luts(const struct intel_crtc_state *new_crtc_state)
1026+
{
1027+
struct intel_crtc *crtc = to_intel_crtc(new_crtc_state->base.crtc);
1028+
struct intel_atomic_state *state =
1029+
to_intel_atomic_state(new_crtc_state->base.state);
1030+
const struct intel_crtc_state *old_crtc_state =
1031+
intel_atomic_get_old_crtc_state(state, crtc);
1032+
1033+
return !old_crtc_state->base.gamma_lut &&
1034+
!old_crtc_state->base.degamma_lut;
1035+
}
1036+
1037+
static bool chv_can_preload_luts(const struct intel_crtc_state *new_crtc_state)
1038+
{
1039+
struct intel_crtc *crtc = to_intel_crtc(new_crtc_state->base.crtc);
1040+
struct intel_atomic_state *state =
1041+
to_intel_atomic_state(new_crtc_state->base.state);
1042+
const struct intel_crtc_state *old_crtc_state =
1043+
intel_atomic_get_old_crtc_state(state, crtc);
1044+
1045+
/*
1046+
* CGM_PIPE_MODE is itself single buffered. We'd have to
1047+
* somehow split it out from chv_load_luts() if we wanted
1048+
* the ability to preload the CGM LUTs/CSC without tearing.
1049+
*/
1050+
if (old_crtc_state->cgm_mode || new_crtc_state->cgm_mode)
1051+
return false;
1052+
1053+
return !old_crtc_state->base.gamma_lut;
1054+
}
1055+
1056+
static bool glk_can_preload_luts(const struct intel_crtc_state *new_crtc_state)
1057+
{
1058+
struct intel_crtc *crtc = to_intel_crtc(new_crtc_state->base.crtc);
1059+
struct intel_atomic_state *state =
1060+
to_intel_atomic_state(new_crtc_state->base.state);
1061+
const struct intel_crtc_state *old_crtc_state =
1062+
intel_atomic_get_old_crtc_state(state, crtc);
1063+
1064+
/*
1065+
* The hardware degamma is active whenever the pipe
1066+
* CSC is active. Thus even if the old state has no
1067+
* software degamma we need to avoid clobbering the
1068+
* linear hardware degamma mid scanout.
1069+
*/
1070+
return !old_crtc_state->csc_enable &&
1071+
!old_crtc_state->base.gamma_lut;
1072+
}
1073+
10251074
int intel_color_check(struct intel_crtc_state *crtc_state)
10261075
{
10271076
struct drm_i915_private *dev_priv = to_i915(crtc_state->base.crtc->dev);
@@ -1165,6 +1214,8 @@ static int i9xx_color_check(struct intel_crtc_state *crtc_state)
11651214
if (ret)
11661215
return ret;
11671216

1217+
crtc_state->preload_luts = intel_can_preload_luts(crtc_state);
1218+
11681219
return 0;
11691220
}
11701221

@@ -1217,6 +1268,8 @@ static int chv_color_check(struct intel_crtc_state *crtc_state)
12171268
if (ret)
12181269
return ret;
12191270

1271+
crtc_state->preload_luts = chv_can_preload_luts(crtc_state);
1272+
12201273
return 0;
12211274
}
12221275

@@ -1271,6 +1324,8 @@ static int ilk_color_check(struct intel_crtc_state *crtc_state)
12711324
if (ret)
12721325
return ret;
12731326

1327+
crtc_state->preload_luts = intel_can_preload_luts(crtc_state);
1328+
12741329
return 0;
12751330
}
12761331

@@ -1328,6 +1383,8 @@ static int ivb_color_check(struct intel_crtc_state *crtc_state)
13281383
if (ret)
13291384
return ret;
13301385

1386+
crtc_state->preload_luts = intel_can_preload_luts(crtc_state);
1387+
13311388
return 0;
13321389
}
13331390

@@ -1366,6 +1423,8 @@ static int glk_color_check(struct intel_crtc_state *crtc_state)
13661423
if (ret)
13671424
return ret;
13681425

1426+
crtc_state->preload_luts = glk_can_preload_luts(crtc_state);
1427+
13691428
return 0;
13701429
}
13711430

@@ -1415,6 +1474,8 @@ static int icl_color_check(struct intel_crtc_state *crtc_state)
14151474

14161475
crtc_state->csc_mode = icl_csc_mode(crtc_state);
14171476

1477+
crtc_state->preload_luts = intel_can_preload_luts(crtc_state);
1478+
14181479
return 0;
14191480
}
14201481

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1794,10 +1794,8 @@ void intel_ddi_set_dp_msa(const struct intel_crtc_state *crtc_state,
17941794
* of Color Encoding Format and Content Color Gamut] while sending
17951795
* YCBCR 420, HDR BT.2020 signals we should program MSA MISC1 fields
17961796
* which indicate VSC SDP for the Pixel Encoding/Colorimetry Format.
1797-
*
1798-
* FIXME MST doesn't pass in the conn_state
17991797
*/
1800-
if (conn_state && intel_dp_needs_vsc_sdp(crtc_state, conn_state))
1798+
if (intel_dp_needs_vsc_sdp(crtc_state, conn_state))
18011799
temp |= DP_MSA_MISC_COLOR_VSC_SDP;
18021800

18031801
I915_WRITE(TRANS_MSA_MISC(cpu_transcoder), temp);
@@ -3605,7 +3603,11 @@ static void intel_ddi_pre_enable_dp(struct intel_encoder *encoder,
36053603
else
36063604
hsw_ddi_pre_enable_dp(encoder, crtc_state, conn_state);
36073605

3608-
intel_ddi_set_dp_msa(crtc_state, conn_state);
3606+
/* MST will call a setting of MSA after an allocating of Virtual Channel
3607+
* from MST encoder pre_enable callback.
3608+
*/
3609+
if (!intel_crtc_has_type(crtc_state, INTEL_OUTPUT_DP_MST))
3610+
intel_ddi_set_dp_msa(crtc_state, conn_state);
36093611
}
36103612

36113613
static void intel_ddi_pre_enable_hdmi(struct intel_encoder *encoder,

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
#include "intel_cdclk.h"
6767
#include "intel_color.h"
6868
#include "intel_display_types.h"
69+
#include "intel_dp_link_training.h"
6970
#include "intel_fbc.h"
7071
#include "intel_fbdev.h"
7172
#include "intel_fifo_underrun.h"
@@ -2528,6 +2529,9 @@ u32 intel_plane_fb_max_stride(struct drm_i915_private *dev_priv,
25282529
* the highest stride limits of them all.
25292530
*/
25302531
crtc = intel_get_crtc_for_pipe(dev_priv, PIPE_A);
2532+
if (!crtc)
2533+
return 0;
2534+
25312535
plane = to_intel_plane(crtc->base.primary);
25322536

25332537
return plane->max_stride(plane, pixel_format, modifier,
@@ -14201,6 +14205,11 @@ static void intel_update_crtc(struct intel_crtc *crtc,
1420114205
/* vblanks work again, re-enable pipe CRC. */
1420214206
intel_crtc_enable_pipe_crc(crtc);
1420314207
} else {
14208+
if (new_crtc_state->preload_luts &&
14209+
(new_crtc_state->base.color_mgmt_changed ||
14210+
new_crtc_state->update_pipe))
14211+
intel_color_load_luts(new_crtc_state);
14212+
1420414213
intel_pre_plane_update(old_crtc_state, new_crtc_state);
1420514214

1420614215
if (new_crtc_state->update_pipe)
@@ -14713,6 +14722,7 @@ static void intel_atomic_commit_tail(struct intel_atomic_state *state)
1471314722
for_each_new_intel_crtc_in_state(state, crtc, new_crtc_state, i) {
1471414723
if (new_crtc_state->base.active &&
1471514724
!needs_modeset(new_crtc_state) &&
14725+
!new_crtc_state->preload_luts &&
1471614726
(new_crtc_state->base.color_mgmt_changed ||
1471714727
new_crtc_state->update_pipe))
1471814728
intel_color_load_luts(new_crtc_state);

drivers/gpu/drm/i915/display/intel_display.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727

2828
#include <drm/drm_util.h>
2929
#include <drm/i915_drm.h>
30-
#include "intel_dp_link_training.h"
3130

3231
enum link_m_n_set;
3332
struct dpll;

drivers/gpu/drm/i915/display/intel_display_types.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -775,6 +775,7 @@ struct intel_crtc_state {
775775
bool disable_cxsr;
776776
bool update_wm_pre, update_wm_post; /* watermarks are updated */
777777
bool fifo_changed; /* FIFO split is changed */
778+
bool preload_luts;
778779

779780
/* Pipe source size (ie. panel fitter input size)
780781
* All planes will be positioned inside this space,

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,8 @@ static void intel_mst_pre_enable_dp(struct intel_encoder *encoder,
331331
ret = drm_dp_update_payload_part1(&intel_dp->mst_mgr);
332332

333333
intel_ddi_enable_pipe_clock(pipe_config);
334+
335+
intel_ddi_set_dp_msa(pipe_config, conn_state);
334336
}
335337

336338
static void intel_mst_enable_dp(struct intel_encoder *encoder,

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1141,7 +1141,7 @@ static int set_ppgtt(struct drm_i915_file_private *file_priv,
11411141

11421142
if (i915_gem_context_is_closed(ctx)) {
11431143
err = -ENOENT;
1144-
goto out;
1144+
goto unlock;
11451145
}
11461146

11471147
if (vm == rcu_access_pointer(ctx->vm))

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

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -646,8 +646,28 @@ i915_gem_userptr_put_pages(struct drm_i915_gem_object *obj,
646646
obj->mm.dirty = false;
647647

648648
for_each_sgt_page(page, sgt_iter, pages) {
649-
if (obj->mm.dirty)
649+
if (obj->mm.dirty && trylock_page(page)) {
650+
/*
651+
* As this may not be anonymous memory (e.g. shmem)
652+
* but exist on a real mapping, we have to lock
653+
* the page in order to dirty it -- holding
654+
* the page reference is not sufficient to
655+
* prevent the inode from being truncated.
656+
* Play safe and take the lock.
657+
*
658+
* However...!
659+
*
660+
* The mmu-notifier can be invalidated for a
661+
* migrate_page, that is alreadying holding the lock
662+
* on the page. Such a try_to_unmap() will result
663+
* in us calling put_pages() and so recursively try
664+
* to lock the page. We avoid that deadlock with
665+
* a trylock_page() and in exchange we risk missing
666+
* some page dirtying.
667+
*/
650668
set_page_dirty(page);
669+
unlock_page(page);
670+
}
651671

652672
mark_page_accessed(page);
653673
put_page(page);

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1372,6 +1372,7 @@ static void intel_engine_print_registers(struct intel_engine_cs *engine,
13721372
}
13731373

13741374
execlists_active_lock_bh(execlists);
1375+
rcu_read_lock();
13751376
for (port = execlists->active; (rq = *port); port++) {
13761377
char hdr[80];
13771378
int len;
@@ -1409,6 +1410,7 @@ static void intel_engine_print_registers(struct intel_engine_cs *engine,
14091410
if (tl)
14101411
intel_timeline_put(tl);
14111412
}
1413+
rcu_read_unlock();
14121414
execlists_active_unlock_bh(execlists);
14131415
} else if (INTEL_GEN(dev_priv) > 6) {
14141416
drm_printf(m, "\tPP_DIR_BASE: 0x%08x\n",

0 commit comments

Comments
 (0)