History

Merge tag 'drm-fixes-2020-05-01' of git://anongit.freedesktop.org/drm/drm

Pull drm fixes from Dave Airlie: "Regular scheduled fixes for graphics. Nothing to extreme bunch of amdgpu fixes, i915 and qxl fixes, along with some misc ones. All seems to be progressing normally. core: - EDID off by one DTD fix - DP mst write return code fix dma-buf: - fix SET_NAME ioctl uapi - doc fixes amdgpu: - Fix a green screen on resume issue - PM fixes for SR-IOV SDMA fix for navi - Renoir display fixes - Cursor and pageflip stuttering fixes - Misc additional display fixes - (uapi) Add additional DCC tiling flags for navi1x i915: - Fix selftest refcnt leak (Xiyu) - Fix gem vma lock (Chris) - Fix gt's i915_request.timeline acquire by checking if cacheline is valid (Chris) - Fix IRQ postinistall fault masks (Matt) qxl: - use after gree fix - fix lost kunmap - release leak fix virtio: - context destruction fix" * tag 'drm-fixes-2020-05-01' of git://anongit.freedesktop.org/drm/drm: (26 commits) dma-buf: fix documentation build warnings drm/qxl: qxl_release use after free drm/qxl: lost qxl_bo_kunmap_atomic_page in qxl_image_init_helper() drm/i915: Use proper fault mask in interrupt postinstall too drm/amd/display: Use cursor locking to prevent flip delays drm/amd/display: Update downspread percent to match spreadsheet for DCN2.1 drm/amd/display: Defer cursor update around VUPDATE for all ASIC drm/amd/display: fix rn soc bb update drm/amd/display: check if REFCLK_CNTL register is present drm/amdgpu: bump version for invalidate L2 before SDMA IBs drm/amdgpu: invalidate L2 before SDMA IBs (v2) drm/amdgpu: add tiling flags from Mesa drm/amd/powerplay: avoid using pm_en before it is initialized revised Revert "drm/amd/powerplay: avoid using pm_en before it is initialized" drm/qxl: qxl_release leak in qxl_hw_surface_alloc() drm/qxl: qxl_release leak in qxl_draw_dirty_fb() drm/virtio: only destroy created contexts drm/dp_mst: Fix drm_dp_send_dpcd_write() return code drm/i915/gt: Check cacheline is valid before acquiring drm/i915/gem: Hold obj->vma.lock over for_each_ggtt_vma() ...

Linus Torvalds committed 6 years ago

Commit 477bfeb2 parents cebcff3 e3dcd8640 files · +290 −154Browse files

Unified · Split

40 files
  1. drivers/dma-buf/dma-buf.c +4 −3
  2. drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +2 −1
  3. drivers/gpu/drm/amd/amdgpu/navi10_sdma_pkt_open.h +16 −0
  4. drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c +13 −1
  5. drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +29 −9
  6. drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c +27 −0
  7. drivers/gpu/drm/amd/display/dc/core/dc_stream.c +4 −36
  8. drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +1 −0
  9. drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +10 −0
  10. drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.h +1 −0
  11. drivers/gpu/drm/amd/display/dc/dcn10/dcn10_init.c +1 −0
  12. drivers/gpu/drm/amd/display/dc/dcn10/dcn10_mpc.c +15 −0
  13. drivers/gpu/drm/amd/display/dc/dcn10/dcn10_mpc.h +14 −6
  14. drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c +12 −2
  15. drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c +2 −1
  16. drivers/gpu/drm/amd/display/dc/dcn20/dcn20_init.c +1 −0
  17. drivers/gpu/drm/amd/display/dc/dcn20/dcn20_mpc.c +1 −0
  18. drivers/gpu/drm/amd/display/dc/dcn20/dcn20_mpc.h +2 −1
  19. drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c +4 −0
  20. drivers/gpu/drm/amd/display/dc/dcn21/dcn21_init.c +1 −0
  21. drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c +33 −44
  22. drivers/gpu/drm/amd/display/dc/inc/hw/mpc.h +16 −0
  23. drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h +1 −0
  24. drivers/gpu/drm/amd/powerplay/amd_powerplay.c +5 −4
  25. drivers/gpu/drm/drm_dp_mst_topology.c +6 −2
  26. drivers/gpu/drm/drm_edid.c +1 −1
  27. drivers/gpu/drm/i915/gem/i915_gem_tiling.c +18 −2
  28. drivers/gpu/drm/i915/gem/selftests/huge_pages.c +8 −4
  29. drivers/gpu/drm/i915/gt/intel_timeline.c +2 −0
  30. drivers/gpu/drm/i915/i915_irq.c +2 −4
  31. drivers/gpu/drm/i915/i915_vma.c +6 −4
  32. drivers/gpu/drm/qxl/qxl_cmd.c +5 −5
  33. drivers/gpu/drm/qxl/qxl_display.c +3 −3
  34. drivers/gpu/drm/qxl/qxl_draw.c +4 −3
  35. drivers/gpu/drm/qxl/qxl_image.c +2 −1
  36. drivers/gpu/drm/qxl/qxl_ioctl.c +1 −4
  37. drivers/gpu/drm/virtio/virtgpu_kms.c +6 −11
  38. include/linux/dma-buf.h +1 −2
  39. include/uapi/drm/amdgpu_drm.h +4 −0
  40. include/uapi/linux/dma-buf.h +6 −0
drivers/dma-buf/dma-buf.c+4−3
@@ -388,7 +388,8 @@ static long dma_buf_ioctl(struct file *file, · 387 unmodified lines
388388
389389 return ret;
390390
391− case DMA_BUF_SET_NAME:
391+ case DMA_BUF_SET_NAME_A:
392+ case DMA_BUF_SET_NAME_B:
392393 return dma_buf_set_name(dmabuf, (const char __user *)arg);
393394
394395 default:
@@ -655,8 +656,8 @@ EXPORT_SYMBOL_GPL(dma_buf_put); · 260 unmodified lines
655656 * calls attach() of dma_buf_ops to allow device-specific attach functionality
656657 * @dmabuf: [in] buffer to attach device to.
657658 * @dev: [in] device to be attached.
658− * @importer_ops [in] importer operations for the attachment
659− * @importer_priv [in] importer private pointer for the attachment
659+ * @importer_ops: [in] importer operations for the attachment
660+ * @importer_priv: [in] importer private pointer for the attachment
660661 *
661662 * Returns struct dma_buf_attachment pointer for this attachment. Attachments
662663 * must be cleaned up by calling dma_buf_detach().
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c+2−1
@@ -85,9 +85,10 @@ · 84 unmodified lines
8585 * - 3.34.0 - Non-DC can flip correctly between buffers with different pitches
8686 * - 3.35.0 - Add drm_amdgpu_info_device::tcc_disabled_mask
8787 * - 3.36.0 - Allow reading more status registers on si/cik
88+ * - 3.37.0 - L2 is invalidated before SDMA IBs, needed for correctness
8889 */
8990 #define KMS_DRIVER_MAJOR 3
90−#define KMS_DRIVER_MINOR 36
91+#define KMS_DRIVER_MINOR 37
9192 #define KMS_DRIVER_PATCHLEVEL 0
9293
9394 int amdgpu_vram_limit = 0;
drivers/gpu/drm/amd/amdgpu/navi10_sdma_pkt_open.h+16−0
@@ -73,6 +73,22 @@ · 72 unmodified lines
7373 #define SDMA_OP_AQL_COPY 0
7474 #define SDMA_OP_AQL_BARRIER_OR 0
7575
76+#define SDMA_GCR_RANGE_IS_PA (1 << 18)
77+#define SDMA_GCR_SEQ(x) (((x) & 0x3) << 16)
78+#define SDMA_GCR_GL2_WB (1 << 15)
79+#define SDMA_GCR_GL2_INV (1 << 14)
80+#define SDMA_GCR_GL2_DISCARD (1 << 13)
81+#define SDMA_GCR_GL2_RANGE(x) (((x) & 0x3) << 11)
82+#define SDMA_GCR_GL2_US (1 << 10)
83+#define SDMA_GCR_GL1_INV (1 << 9)
84+#define SDMA_GCR_GLV_INV (1 << 8)
85+#define SDMA_GCR_GLK_INV (1 << 7)
86+#define SDMA_GCR_GLK_WB (1 << 6)
87+#define SDMA_GCR_GLM_INV (1 << 5)
88+#define SDMA_GCR_GLM_WB (1 << 4)
89+#define SDMA_GCR_GL1_RANGE(x) (((x) & 0x3) << 2)
90+#define SDMA_GCR_GLI_INV(x) (((x) & 0x3) << 0)
91+
7692 /*define for op field*/
7793 #define SDMA_PKT_HEADER_op_offset 0
7894 #define SDMA_PKT_HEADER_op_mask 0x000000FF
drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c+13−1
@@ -382,6 +382,18 @@ static void sdma_v5_0_ring_emit_ib(struct amdgpu_ring *ring, · 381 unmodified lines
382382 unsigned vmid = AMDGPU_JOB_GET_VMID(job);
383383 uint64_t csa_mc_addr = amdgpu_sdma_get_csa_mc_addr(ring, vmid);
384384
385+ /* Invalidate L2, because if we don't do it, we might get stale cache
386+ * lines from previous IBs.
387+ */
388+ amdgpu_ring_write(ring, SDMA_PKT_HEADER_OP(SDMA_OP_GCR_REQ));
389+ amdgpu_ring_write(ring, 0);
390+ amdgpu_ring_write(ring, (SDMA_GCR_GL2_INV |
391+ SDMA_GCR_GL2_WB |
392+ SDMA_GCR_GLM_INV |
393+ SDMA_GCR_GLM_WB) << 16);
394+ amdgpu_ring_write(ring, 0xffffff80);
395+ amdgpu_ring_write(ring, 0xffff);
396+
385397 /* An IB packet must end on a 8 DW boundary--the next dword
386398 * must be on a 8-dword boundary. Our IB packet below is 6
387399 * dwords long, thus add x number of NOPs, such that, in
@@ -1595,7 +1607,7 @@ static const struct amdgpu_ring_funcs sdma_v5_0_ring_funcs = { · 1207 unmodified lines
15951607 SOC15_FLUSH_GPU_TLB_NUM_WREG * 3 +
15961608 SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT * 6 * 2 +
15971609 10 + 10 + 10, /* sdma_v5_0_ring_emit_fence x3 for user fence, vm fence */
1598− .emit_ib_size = 7 + 6, /* sdma_v5_0_ring_emit_ib */
1610+ .emit_ib_size = 5 + 7 + 6, /* sdma_v5_0_ring_emit_ib */
15991611 .emit_ib = sdma_v5_0_ring_emit_ib,
16001612 .emit_fence = sdma_v5_0_ring_emit_fence,
16011613 .emit_pipeline_sync = sdma_v5_0_ring_emit_pipeline_sync,
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c+29−9
@@ -3340,7 +3340,8 @@ fill_plane_dcc_attributes(struct amdgpu_device *adev, · 3339 unmodified lines
33403340 const union dc_tiling_info *tiling_info,
33413341 const uint64_t info,
33423342 struct dc_plane_dcc_param *dcc,
3343− struct dc_plane_address *address)
3343+ struct dc_plane_address *address,
3344+ bool force_disable_dcc)
33443345 {
33453346 struct dc *dc = adev->dm.dc;
33463347 struct dc_dcc_surface_param input;
@@ -3352,6 +3353,9 @@ fill_plane_dcc_attributes(struct amdgpu_device *adev, · 5 unmodified lines
33523353 memset(&input, 0, sizeof(input));
33533354 memset(&output, 0, sizeof(output));
33543355
3356+ if (force_disable_dcc)
3357+ return 0;
3358+
33553359 if (!offset)
33563360 return 0;
33573361
@@ -3401,7 +3405,8 @@ fill_plane_buffer_attributes(struct amdgpu_device *adev, · 43 unmodified lines
34013405 union dc_tiling_info *tiling_info,
34023406 struct plane_size *plane_size,
34033407 struct dc_plane_dcc_param *dcc,
3404− struct dc_plane_address *address)
3408+ struct dc_plane_address *address,
3409+ bool force_disable_dcc)
34053410 {
34063411 const struct drm_framebuffer *fb = &afb->base;
34073412 int ret;
@@ -3507,7 +3512,8 @@ fill_plane_buffer_attributes(struct amdgpu_device *adev, · 99 unmodified lines
35073512
35083513 ret = fill_plane_dcc_attributes(adev, afb, format, rotation,
35093514 plane_size, tiling_info,
3510− tiling_flags, dcc, address);
3515+ tiling_flags, dcc, address,
3516+ force_disable_dcc);
35113517 if (ret)
35123518 return ret;
35133519 }
@@ -3599,7 +3605,8 @@ fill_dc_plane_info_and_addr(struct amdgpu_device *adev, · 85 unmodified lines
35993605 const struct drm_plane_state *plane_state,
36003606 const uint64_t tiling_flags,
36013607 struct dc_plane_info *plane_info,
3602− struct dc_plane_address *address)
3608+ struct dc_plane_address *address,
3609+ bool force_disable_dcc)
36033610 {
36043611 const struct drm_framebuffer *fb = plane_state->fb;
36053612 const struct amdgpu_framebuffer *afb =
@@ -3681,7 +3688,8 @@ fill_dc_plane_info_and_addr(struct amdgpu_device *adev, · 75 unmodified lines
36813688 plane_info->rotation, tiling_flags,
36823689 &plane_info->tiling_info,
36833690 &plane_info->plane_size,
3684− &plane_info->dcc, address);
3691+ &plane_info->dcc, address,
3692+ force_disable_dcc);
36853693 if (ret)
36863694 return ret;
36873695
@@ -3704,6 +3712,7 @@ static int fill_dc_plane_attributes(struct amdgpu_device *adev, · 16 unmodified lines
37043712 struct dc_plane_info plane_info;
37053713 uint64_t tiling_flags;
37063714 int ret;
3715+ bool force_disable_dcc = false;
37073716
37083717 ret = fill_dc_scaling_info(plane_state, &scaling_info);
37093718 if (ret)
@@ -3718,9 +3727,11 @@ static int fill_dc_plane_attributes(struct amdgpu_device *adev, · 8 unmodified lines
37183727 if (ret)
37193728 return ret;
37203729
3730+ force_disable_dcc = adev->asic_type == CHIP_RAVEN && adev->in_suspend;
37213731 ret = fill_dc_plane_info_and_addr(adev, plane_state, tiling_flags,
37223732 &plane_info,
3723− &dc_plane_state->address);
3733+ &dc_plane_state->address,
3734+ force_disable_dcc);
37243735 if (ret)
37253736 return ret;
37263737
@@ -5342,6 +5353,7 @@ static int dm_plane_helper_prepare_fb(struct drm_plane *plane, · 1615 unmodified lines
53425353 uint64_t tiling_flags;
53435354 uint32_t domain;
53445355 int r;
5356+ bool force_disable_dcc = false;
53455357
53465358 dm_plane_state_old = to_dm_plane_state(plane->state);
53475359 dm_plane_state_new = to_dm_plane_state(new_state);
@@ -5400,11 +5412,13 @@ static int dm_plane_helper_prepare_fb(struct drm_plane *plane, · 52 unmodified lines
54005412 dm_plane_state_old->dc_state != dm_plane_state_new->dc_state) {
54015413 struct dc_plane_state *plane_state = dm_plane_state_new->dc_state;
54025414
5415+ force_disable_dcc = adev->asic_type == CHIP_RAVEN && adev->in_suspend;
54035416 fill_plane_buffer_attributes(
54045417 adev, afb, plane_state->format, plane_state->rotation,
54055418 tiling_flags, &plane_state->tiling_info,
54065419 &plane_state->plane_size, &plane_state->dcc,
5407− &plane_state->address);
5420+ &plane_state->address,
5421+ force_disable_dcc);
54085422 }
54095423
54105424 return 0;
@@ -6676,7 +6690,12 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state, · 1265 unmodified lines
66766690 fill_dc_plane_info_and_addr(
66776691 dm->adev, new_plane_state, tiling_flags,
66786692 &bundle->plane_infos[planes_count],
6679− &bundle->flip_addrs[planes_count].address);
6693+ &bundle->flip_addrs[planes_count].address,
6694+ false);
6695+
6696+ DRM_DEBUG_DRIVER("plane: id=%d dcc_en=%d\n",
6697+ new_plane_state->plane->index,
6698+ bundle->plane_infos[planes_count].dcc.enable);
66806699
66816700 bundle->surface_updates[planes_count].plane_info =
66826701 &bundle->plane_infos[planes_count];
@@ -8096,7 +8115,8 @@ dm_determine_update_type_for_commit(struct amdgpu_display_manager *dm, · 1413 unmodified lines
80968115 ret = fill_dc_plane_info_and_addr(
80978116 dm->adev, new_plane_state, tiling_flags,
80988117 plane_info,
8099− &flip_addr->address);
8118+ &flip_addr->address,
8119+ false);
81008120 if (ret)
81018121 goto cleanup;
81028122
drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c+27−0
@@ -2908,6 +2908,12 @@ bool dc_link_handle_hpd_rx_irq(struct dc_link *link, union hpd_irq_data *out_hpd · 2907 unmodified lines
29082908 sizeof(hpd_irq_dpcd_data),
29092909 "Status: ");
29102910
2911+ for (i = 0; i < MAX_PIPES; i++) {
2912+ pipe_ctx = &link->dc->current_state->res_ctx.pipe_ctx[i];
2913+ if (pipe_ctx && pipe_ctx->stream && pipe_ctx->stream->link == link)
2914+ link->dc->hwss.blank_stream(pipe_ctx);
2915+ }
2916+
29112917 for (i = 0; i < MAX_PIPES; i++) {
29122918 pipe_ctx = &link->dc->current_state->res_ctx.pipe_ctx[i];
29132919 if (pipe_ctx && pipe_ctx->stream && pipe_ctx->stream->link == link)
@@ -2927,6 +2933,12 @@ bool dc_link_handle_hpd_rx_irq(struct dc_link *link, union hpd_irq_data *out_hpd · 13 unmodified lines
29272933 if (pipe_ctx->stream->signal == SIGNAL_TYPE_DISPLAY_PORT_MST)
29282934 dc_link_reallocate_mst_payload(link);
29292935
2936+ for (i = 0; i < MAX_PIPES; i++) {
2937+ pipe_ctx = &link->dc->current_state->res_ctx.pipe_ctx[i];
2938+ if (pipe_ctx && pipe_ctx->stream && pipe_ctx->stream->link == link)
2939+ link->dc->hwss.unblank_stream(pipe_ctx, &previous_link_settings);
2940+ }
2941+
29302942 status = false;
29312943 if (out_link_loss)
29322944 *out_link_loss = true;
@@ -4227,6 +4239,21 @@ void dp_set_fec_enable(struct dc_link *link, bool enable) · 1294 unmodified lines
42274239 void dpcd_set_source_specific_data(struct dc_link *link)
42284240 {
42294241 const uint32_t post_oui_delay = 30; // 30ms
4242+ uint8_t dspc = 0;
4243+ enum dc_status ret = DC_ERROR_UNEXPECTED;
4244+
4245+ ret = core_link_read_dpcd(link, DP_DOWN_STREAM_PORT_COUNT, &dspc,
4246+ sizeof(dspc));
4247+
4248+ if (ret != DC_OK) {
4249+ DC_LOG_ERROR("Error in DP aux read transaction,"
4250+ " not writing source specific data\n");
4251+ return;
4252+ }
4253+
4254+ /* Return if OUI unsupported */
4255+ if (!(dspc & DP_OUI_SUPPORT))
4256+ return;
42304257
42314258 if (!link->dc->vendor_signature.is_valid) {
42324259 struct dpcd_amd_signature amd_signature;
drivers/gpu/drm/amd/display/dc/core/dc_stream.c+4−36
@@ -231,34 +231,6 @@ struct dc_stream_status *dc_stream_get_status( · 230 unmodified lines
231231 return dc_stream_get_status_from_state(dc->current_state, stream);
232232 }
233233
234−static void delay_cursor_until_vupdate(struct pipe_ctx *pipe_ctx, struct dc *dc)
235−{
236−#if defined(CONFIG_DRM_AMD_DC_DCN)
237− unsigned int vupdate_line;
238− unsigned int lines_to_vupdate, us_to_vupdate, vpos, nvpos;
239− struct dc_stream_state *stream = pipe_ctx->stream;
240− unsigned int us_per_line;
241−
242− if (stream->ctx->asic_id.chip_family == FAMILY_RV &&
243− ASICREV_IS_RAVEN(stream->ctx->asic_id.hw_internal_rev)) {
244−
245− vupdate_line = dc->hwss.get_vupdate_offset_from_vsync(pipe_ctx);
246− if (!dc_stream_get_crtc_position(dc, &stream, 1, &vpos, &nvpos))
247− return;
248−
249− if (vpos >= vupdate_line)
250− return;
251−
252− us_per_line = stream->timing.h_total * 10000 / stream->timing.pix_clk_100hz;
253− lines_to_vupdate = vupdate_line - vpos;
254− us_to_vupdate = lines_to_vupdate * us_per_line;
255−
256− /* 70 us is a conservative estimate of cursor update time*/
257− if (us_to_vupdate < 70)
258− udelay(us_to_vupdate);
259− }
260−#endif
261−}
262234
263235 /**
264236 * dc_stream_set_cursor_attributes() - Update cursor attributes and set cursor surface address
@@ -298,9 +270,7 @@ bool dc_stream_set_cursor_attributes( · 33 unmodified lines
298270
299271 if (!pipe_to_program) {
300272 pipe_to_program = pipe_ctx;
301−
302− delay_cursor_until_vupdate(pipe_ctx, dc);
303− dc->hwss.pipe_control_lock(dc, pipe_to_program, true);
273+ dc->hwss.cursor_lock(dc, pipe_to_program, true);
304274 }
305275
306276 dc->hwss.set_cursor_attribute(pipe_ctx);
@@ -309,7 +279,7 @@ bool dc_stream_set_cursor_attributes( · 2 unmodified lines
309279 }
310280
311281 if (pipe_to_program)
312− dc->hwss.pipe_control_lock(dc, pipe_to_program, false);
282+ dc->hwss.cursor_lock(dc, pipe_to_program, false);
313283
314284 return true;
315285 }
@@ -349,16 +319,14 @@ bool dc_stream_set_cursor_position( · 33 unmodified lines
349319
350320 if (!pipe_to_program) {
351321 pipe_to_program = pipe_ctx;
352−
353− delay_cursor_until_vupdate(pipe_ctx, dc);
354− dc->hwss.pipe_control_lock(dc, pipe_to_program, true);
322+ dc->hwss.cursor_lock(dc, pipe_to_program, true);
355323 }
356324
357325 dc->hwss.set_cursor_position(pipe_ctx);
358326 }
359327
360328 if (pipe_to_program)
361− dc->hwss.pipe_control_lock(dc, pipe_to_program, false);
329+ dc->hwss.cursor_lock(dc, pipe_to_program, false);
362330
363331 return true;
364332 }
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c+1−0
@@ -2757,6 +2757,7 @@ static const struct hw_sequencer_funcs dce110_funcs = { · 2756 unmodified lines
27572757 .disable_plane = dce110_power_down_fe,
27582758 .pipe_control_lock = dce_pipe_control_lock,
27592759 .interdependent_update_lock = NULL,
2760+ .cursor_lock = dce_pipe_control_lock,
27602761 .prepare_bandwidth = dce110_prepare_bandwidth,
27612762 .optimize_bandwidth = dce110_optimize_bandwidth,
27622763 .set_drr = set_drr,
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c+10−0
@@ -1625,6 +1625,16 @@ void dcn10_pipe_control_lock( · 1624 unmodified lines
16251625 hws->funcs.verify_allow_pstate_change_high(dc);
16261626 }
16271627
1628+void dcn10_cursor_lock(struct dc *dc, struct pipe_ctx *pipe, bool lock)
1629+{
1630+ /* cursor lock is per MPCC tree, so only need to lock one pipe per stream */
1631+ if (!pipe || pipe->top_pipe)
1632+ return;
1633+
1634+ dc->res_pool->mpc->funcs->cursor_lock(dc->res_pool->mpc,
1635+ pipe->stream_res.opp->inst, lock);
1636+}
1637+
16281638 static bool wait_for_reset_trigger_to_occur(
16291639 struct dc_context *dc_ctx,
16301640 struct timing_generator *tg)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.h+1−0
@@ -49,6 +49,7 @@ void dcn10_pipe_control_lock( · 48 unmodified lines
4949 struct dc *dc,
5050 struct pipe_ctx *pipe,
5151 bool lock);
52+void dcn10_cursor_lock(struct dc *dc, struct pipe_ctx *pipe, bool lock);
5253 void dcn10_blank_pixel_data(
5354 struct dc *dc,
5455 struct pipe_ctx *pipe_ctx,
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_init.c+1−0
@@ -50,6 +50,7 @@ static const struct hw_sequencer_funcs dcn10_funcs = { · 49 unmodified lines
5050 .disable_audio_stream = dce110_disable_audio_stream,
5151 .disable_plane = dcn10_disable_plane,
5252 .pipe_control_lock = dcn10_pipe_control_lock,
53+ .cursor_lock = dcn10_cursor_lock,
5354 .interdependent_update_lock = dcn10_lock_all_pipes,
5455 .prepare_bandwidth = dcn10_prepare_bandwidth,
5556 .optimize_bandwidth = dcn10_optimize_bandwidth,
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_mpc.c+15−0
@@ -223,6 +223,9 @@ struct mpcc *mpc1_insert_plane( · 222 unmodified lines
223223 REG_SET(MPCC_TOP_SEL[mpcc_id], 0, MPCC_TOP_SEL, dpp_id);
224224 REG_SET(MPCC_OPP_ID[mpcc_id], 0, MPCC_OPP_ID, tree->opp_id);
225225
226+ /* Configure VUPDATE lock set for this MPCC to map to the OPP */
227+ REG_SET(MPCC_UPDATE_LOCK_SEL[mpcc_id], 0, MPCC_UPDATE_LOCK_SEL, tree->opp_id);
228+
226229 /* update mpc tree mux setting */
227230 if (tree->opp_list == insert_above_mpcc) {
228231 /* insert the toppest mpcc */
@@ -318,6 +321,7 @@ void mpc1_remove_mpcc( · 89 unmodified lines
318321 REG_SET(MPCC_TOP_SEL[mpcc_id], 0, MPCC_TOP_SEL, 0xf);
319322 REG_SET(MPCC_BOT_SEL[mpcc_id], 0, MPCC_BOT_SEL, 0xf);
320323 REG_SET(MPCC_OPP_ID[mpcc_id], 0, MPCC_OPP_ID, 0xf);
324+ REG_SET(MPCC_UPDATE_LOCK_SEL[mpcc_id], 0, MPCC_UPDATE_LOCK_SEL, 0xf);
321325
322326 /* mark this mpcc as not in use */
323327 mpc10->mpcc_in_use_mask &= ~(1 << mpcc_id);
@@ -328,6 +332,7 @@ void mpc1_remove_mpcc( · 4 unmodified lines
328332 REG_SET(MPCC_TOP_SEL[mpcc_id], 0, MPCC_TOP_SEL, 0xf);
329333 REG_SET(MPCC_BOT_SEL[mpcc_id], 0, MPCC_BOT_SEL, 0xf);
330334 REG_SET(MPCC_OPP_ID[mpcc_id], 0, MPCC_OPP_ID, 0xf);
335+ REG_SET(MPCC_UPDATE_LOCK_SEL[mpcc_id], 0, MPCC_UPDATE_LOCK_SEL, 0xf);
331336 }
332337 }
333338
@@ -361,6 +366,7 @@ void mpc1_mpc_init(struct mpc *mpc) · 27 unmodified lines
361366 REG_SET(MPCC_TOP_SEL[mpcc_id], 0, MPCC_TOP_SEL, 0xf);
362367 REG_SET(MPCC_BOT_SEL[mpcc_id], 0, MPCC_BOT_SEL, 0xf);
363368 REG_SET(MPCC_OPP_ID[mpcc_id], 0, MPCC_OPP_ID, 0xf);
369+ REG_SET(MPCC_UPDATE_LOCK_SEL[mpcc_id], 0, MPCC_UPDATE_LOCK_SEL, 0xf);
364370
365371 mpc1_init_mpcc(&(mpc->mpcc_array[mpcc_id]), mpcc_id);
366372 }
@@ -381,6 +387,7 @@ void mpc1_mpc_init_single_inst(struct mpc *mpc, unsigned int mpcc_id) · 14 unmodified lines
381387 REG_SET(MPCC_TOP_SEL[mpcc_id], 0, MPCC_TOP_SEL, 0xf);
382388 REG_SET(MPCC_BOT_SEL[mpcc_id], 0, MPCC_BOT_SEL, 0xf);
383389 REG_SET(MPCC_OPP_ID[mpcc_id], 0, MPCC_OPP_ID, 0xf);
390+ REG_SET(MPCC_UPDATE_LOCK_SEL[mpcc_id], 0, MPCC_UPDATE_LOCK_SEL, 0xf);
384391
385392 mpc1_init_mpcc(&(mpc->mpcc_array[mpcc_id]), mpcc_id);
386393
@@ -453,6 +460,13 @@ void mpc1_read_mpcc_state( · 66 unmodified lines
453460 MPCC_BUSY, &s->busy);
454461 }
455462
463+void mpc1_cursor_lock(struct mpc *mpc, int opp_id, bool lock)
464+{
465+ struct dcn10_mpc *mpc10 = TO_DCN10_MPC(mpc);
466+
467+ REG_SET(CUR[opp_id], 0, CUR_VUPDATE_LOCK_SET, lock ? 1 : 0);
468+}
469+
456470 static const struct mpc_funcs dcn10_mpc_funcs = {
457471 .read_mpcc_state = mpc1_read_mpcc_state,
458472 .insert_plane = mpc1_insert_plane,
@@ -464,6 +478,7 @@ static const struct mpc_funcs dcn10_mpc_funcs = { · 5 unmodified lines
464478 .assert_mpcc_idle_before_connect = mpc1_assert_mpcc_idle_before_connect,
465479 .init_mpcc_list_from_hw = mpc1_init_mpcc_list_from_hw,
466480 .update_blending = mpc1_update_blending,
481+ .cursor_lock = mpc1_cursor_lock,
467482 .set_denorm = NULL,
468483 .set_denorm_clamp = NULL,
469484 .set_output_csc = NULL,
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_mpc.h+14−6
@@ -39,11 +39,12 @@ · 38 unmodified lines
3939 SRII(MPCC_BG_G_Y, MPCC, inst),\
4040 SRII(MPCC_BG_R_CR, MPCC, inst),\
4141 SRII(MPCC_BG_B_CB, MPCC, inst),\
42− SRII(MPCC_BG_B_CB, MPCC, inst),\
43− SRII(MPCC_SM_CONTROL, MPCC, inst)
42+ SRII(MPCC_SM_CONTROL, MPCC, inst),\
43+ SRII(MPCC_UPDATE_LOCK_SEL, MPCC, inst)
4444
4545 #define MPC_OUT_MUX_COMMON_REG_LIST_DCN1_0(inst) \
46− SRII(MUX, MPC_OUT, inst)
46+ SRII(MUX, MPC_OUT, inst),\
47+ VUPDATE_SRII(CUR, VUPDATE_LOCK_SET, inst)
4748
4849 #define MPC_COMMON_REG_VARIABLE_LIST \
4950 uint32_t MPCC_TOP_SEL[MAX_MPCC]; \
@@ -55,7 +56,9 @@ · 5 unmodified lines
5556 uint32_t MPCC_BG_R_CR[MAX_MPCC]; \
5657 uint32_t MPCC_BG_B_CB[MAX_MPCC]; \
5758 uint32_t MPCC_SM_CONTROL[MAX_MPCC]; \
58− uint32_t MUX[MAX_OPP];
59+ uint32_t MUX[MAX_OPP]; \
60+ uint32_t MPCC_UPDATE_LOCK_SEL[MAX_MPCC]; \
61+ uint32_t CUR[MAX_OPP];
5962
6063 #define MPC_COMMON_MASK_SH_LIST_DCN1_0(mask_sh)\
6164 SF(MPCC0_MPCC_TOP_SEL, MPCC_TOP_SEL, mask_sh),\
@@ -78,7 +81,8 @@ · 16 unmodified lines
7881 SF(MPCC0_MPCC_SM_CONTROL, MPCC_SM_FIELD_ALT, mask_sh),\
7982 SF(MPCC0_MPCC_SM_CONTROL, MPCC_SM_FORCE_NEXT_FRAME_POL, mask_sh),\
8083 SF(MPCC0_MPCC_SM_CONTROL, MPCC_SM_FORCE_NEXT_TOP_POL, mask_sh),\
81− SF(MPC_OUT0_MUX, MPC_OUT_MUX, mask_sh)
84+ SF(MPC_OUT0_MUX, MPC_OUT_MUX, mask_sh),\
85+ SF(MPCC0_MPCC_UPDATE_LOCK_SEL, MPCC_UPDATE_LOCK_SEL, mask_sh)
8286
8387 #define MPC_REG_FIELD_LIST(type) \
8488 type MPCC_TOP_SEL;\
@@ -101,7 +105,9 @@ · 16 unmodified lines
101105 type MPCC_SM_FIELD_ALT;\
102106 type MPCC_SM_FORCE_NEXT_FRAME_POL;\
103107 type MPCC_SM_FORCE_NEXT_TOP_POL;\
104− type MPC_OUT_MUX;
108+ type MPC_OUT_MUX;\
109+ type MPCC_UPDATE_LOCK_SEL;\
110+ type CUR_VUPDATE_LOCK_SET;
105111
106112 struct dcn_mpc_registers {
107113 MPC_COMMON_REG_VARIABLE_LIST
@@ -192,4 +198,6 @@ void mpc1_read_mpcc_state( · 84 unmodified lines
192198 int mpcc_inst,
193199 struct mpcc_state *s);
194200
201+void mpc1_cursor_lock(struct mpc *mpc, int opp_id, bool lock);
202+
195203 #endif
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c+12−2
@@ -181,6 +181,14 @@ enum dcn10_clk_src_array_id { · 180 unmodified lines
181181 .reg_name[id] = BASE(mm ## block ## id ## _ ## reg_name ## _BASE_IDX) + \
182182 mm ## block ## id ## _ ## reg_name
183183
184+#define VUPDATE_SRII(reg_name, block, id)\
185+ .reg_name[id] = BASE(mm ## reg_name ## 0 ## _ ## block ## id ## _BASE_IDX) + \
186+ mm ## reg_name ## 0 ## _ ## block ## id
187+
188+/* set field/register/bitfield name */
189+#define SFRB(field_name, reg_name, bitfield, post_fix)\
190+ .field_name = reg_name ## __ ## bitfield ## post_fix
191+
184192 /* NBIO */
185193 #define NBIO_BASE_INNER(seg) \
186194 NBIF_BASE__INST0_SEG ## seg
@@ -419,11 +427,13 @@ static const struct dcn_mpc_registers mpc_regs = { · 232 unmodified lines
419427 };
420428
421429 static const struct dcn_mpc_shift mpc_shift = {
422− MPC_COMMON_MASK_SH_LIST_DCN1_0(__SHIFT)
430+ MPC_COMMON_MASK_SH_LIST_DCN1_0(__SHIFT),\
431+ SFRB(CUR_VUPDATE_LOCK_SET, CUR0_VUPDATE_LOCK_SET0, CUR0_VUPDATE_LOCK_SET, __SHIFT)
423432 };
424433
425434 static const struct dcn_mpc_mask mpc_mask = {
426− MPC_COMMON_MASK_SH_LIST_DCN1_0(_MASK),
435+ MPC_COMMON_MASK_SH_LIST_DCN1_0(_MASK),\
436+ SFRB(CUR_VUPDATE_LOCK_SET, CUR0_VUPDATE_LOCK_SET0, CUR0_VUPDATE_LOCK_SET, _MASK)
427437 };
428438
429439 #define tg_regs(id)\
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c+2−1
@@ -2294,7 +2294,8 @@ void dcn20_fpga_init_hw(struct dc *dc) · 2293 unmodified lines
22942294
22952295 REG_UPDATE(DCHUBBUB_GLOBAL_TIMER_CNTL, DCHUBBUB_GLOBAL_TIMER_REFDIV, 2);
22962296 REG_UPDATE(DCHUBBUB_GLOBAL_TIMER_CNTL, DCHUBBUB_GLOBAL_TIMER_ENABLE, 1);
2297− REG_WRITE(REFCLK_CNTL, 0);
2297+ if (REG(REFCLK_CNTL))
2298+ REG_WRITE(REFCLK_CNTL, 0);
22982299 //
22992300
23002301
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_init.c+1−0
@@ -52,6 +52,7 @@ static const struct hw_sequencer_funcs dcn20_funcs = { · 51 unmodified lines
5252 .disable_plane = dcn20_disable_plane,
5353 .pipe_control_lock = dcn20_pipe_control_lock,
5454 .interdependent_update_lock = dcn10_lock_all_pipes,
55+ .cursor_lock = dcn10_cursor_lock,
5556 .prepare_bandwidth = dcn20_prepare_bandwidth,
5657 .optimize_bandwidth = dcn20_optimize_bandwidth,
5758 .update_bandwidth = dcn20_update_bandwidth,
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_mpc.c+1−0
@@ -545,6 +545,7 @@ const struct mpc_funcs dcn20_mpc_funcs = { · 544 unmodified lines
545545 .mpc_init = mpc1_mpc_init,
546546 .mpc_init_single_inst = mpc1_mpc_init_single_inst,
547547 .update_blending = mpc2_update_blending,
548+ .cursor_lock = mpc1_cursor_lock,
548549 .get_mpcc_for_dpp = mpc2_get_mpcc_for_dpp,
549550 .wait_for_idle = mpc2_assert_idle_mpcc,
550551 .assert_mpcc_idle_before_connect = mpc2_assert_mpcc_idle_before_connect,
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_mpc.h+2−1
@@ -179,7 +179,8 @@ · 178 unmodified lines
179179 SF(MPC_OUT0_DENORM_CLAMP_G_Y, MPC_OUT_DENORM_CLAMP_MAX_G_Y, mask_sh),\
180180 SF(MPC_OUT0_DENORM_CLAMP_G_Y, MPC_OUT_DENORM_CLAMP_MIN_G_Y, mask_sh),\
181181 SF(MPC_OUT0_DENORM_CLAMP_B_CB, MPC_OUT_DENORM_CLAMP_MAX_B_CB, mask_sh),\
182− SF(MPC_OUT0_DENORM_CLAMP_B_CB, MPC_OUT_DENORM_CLAMP_MIN_B_CB, mask_sh)
182+ SF(MPC_OUT0_DENORM_CLAMP_B_CB, MPC_OUT_DENORM_CLAMP_MIN_B_CB, mask_sh),\
183+ SF(CUR_VUPDATE_LOCK_SET0, CUR_VUPDATE_LOCK_SET, mask_sh)
183184
184185 /*
185186 * DCN2 MPC_OCSC debug status register:
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c+4−0
@@ -508,6 +508,10 @@ enum dcn20_clk_src_array_id { · 507 unmodified lines
508508 .block ## _ ## reg_name[id] = BASE(mm ## block ## id ## _ ## reg_name ## _BASE_IDX) + \
509509 mm ## block ## id ## _ ## reg_name
510510
511+#define VUPDATE_SRII(reg_name, block, id)\
512+ .reg_name[id] = BASE(mm ## reg_name ## _ ## block ## id ## _BASE_IDX) + \
513+ mm ## reg_name ## _ ## block ## id
514+
511515 /* NBIO */
512516 #define NBIO_BASE_INNER(seg) \
513517 NBIO_BASE__INST0_SEG ## seg
drivers/gpu/drm/amd/display/dc/dcn21/dcn21_init.c+1−0
@@ -53,6 +53,7 @@ static const struct hw_sequencer_funcs dcn21_funcs = { · 52 unmodified lines
5353 .disable_plane = dcn20_disable_plane,
5454 .pipe_control_lock = dcn20_pipe_control_lock,
5555 .interdependent_update_lock = dcn10_lock_all_pipes,
56+ .cursor_lock = dcn10_cursor_lock,
5657 .prepare_bandwidth = dcn20_prepare_bandwidth,
5758 .optimize_bandwidth = dcn20_optimize_bandwidth,
5859 .update_bandwidth = dcn20_update_bandwidth,
drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c+33−44
@@ -284,7 +284,7 @@ struct _vcs_dpi_soc_bounding_box_st dcn2_1_soc = { · 283 unmodified lines
284284 .dram_channel_width_bytes = 4,
285285 .fabric_datapath_to_dcn_data_return_bytes = 32,
286286 .dcn_downspread_percent = 0.5,
287− .downspread_percent = 0.5,
287+ .downspread_percent = 0.38,
288288 .dram_page_open_time_ns = 50.0,
289289 .dram_rw_turnaround_time_ns = 17.5,
290290 .dram_return_buffer_per_channel_bytes = 8192,
@@ -340,6 +340,10 @@ struct _vcs_dpi_soc_bounding_box_st dcn2_1_soc = { · 49 unmodified lines
340340 .block ## _ ## reg_name[id] = BASE(mm ## block ## id ## _ ## reg_name ## _BASE_IDX) + \
341341 mm ## block ## id ## _ ## reg_name
342342
343+#define VUPDATE_SRII(reg_name, block, id)\
344+ .reg_name[id] = BASE(mm ## reg_name ## _ ## block ## id ## _BASE_IDX) + \
345+ mm ## reg_name ## _ ## block ## id
346+
343347 /* NBIO */
344348 #define NBIO_BASE_INNER(seg) \
345349 NBIF0_BASE__INST0_SEG ## seg
@@ -1374,64 +1378,49 @@ static void update_bw_bounding_box(struct dc *dc, struct clk_bw_params *bw_param · 1028 unmodified lines
13741378 {
13751379 struct dcn21_resource_pool *pool = TO_DCN21_RES_POOL(dc->res_pool);
13761380 struct clk_limit_table *clk_table = &bw_params->clk_table;
1377− unsigned int i, j, k;
1378− int closest_clk_lvl;
1381+ struct _vcs_dpi_voltage_scaling_st clock_limits[DC__VOLTAGE_STATES];
1382+ unsigned int i, j, closest_clk_lvl;
13791383
13801384 // Default clock levels are used for diags, which may lead to overclocking.
1381− if (!IS_FPGA_MAXIMUS_DC(dc->ctx->dce_environment) && !IS_DIAG_DC(dc->ctx->dce_environment)) {
1385+ if (!IS_DIAG_DC(dc->ctx->dce_environment)) {
13821386 dcn2_1_ip.max_num_otg = pool->base.res_cap->num_timing_generator;
13831387 dcn2_1_ip.max_num_dpp = pool->base.pipe_count;
13841388 dcn2_1_soc.num_chans = bw_params->num_channels;
13851389
1386− /* Vmin: leave lowest DCN clocks, override with dcfclk, fclk, memclk from fuse */
1387− dcn2_1_soc.clock_limits[0].state = 0;
1388− dcn2_1_soc.clock_limits[0].dcfclk_mhz = clk_table->entries[0].dcfclk_mhz;
1389− dcn2_1_soc.clock_limits[0].fabricclk_mhz = clk_table->entries[0].fclk_mhz;
1390− dcn2_1_soc.clock_limits[0].socclk_mhz = clk_table->entries[0].socclk_mhz;
1391− dcn2_1_soc.clock_limits[0].dram_speed_mts = clk_table->entries[0].memclk_mhz * 2;
1392−
1393− /*
1394− * Other levels: find closest DCN clocks that fit the given clock limit using dcfclk
1395− * as indicator
1396− */
1397−
1398− closest_clk_lvl = -1;
1399− /* index currently being filled */
1400− k = 1;
1401− for (i = 1; i < clk_table->num_entries; i++) {
1402− /* loop backwards, skip duplicate state*/
1403− for (j = dcn2_1_soc.num_states - 1; j >= k; j--) {
1390+ ASSERT(clk_table->num_entries);
1391+ for (i = 0; i < clk_table->num_entries; i++) {
1392+ /* loop backwards*/
1393+ for (closest_clk_lvl = 0, j = dcn2_1_soc.num_states - 1; j >= 0; j--) {
14041394 if ((unsigned int) dcn2_1_soc.clock_limits[j].dcfclk_mhz <= clk_table->entries[i].dcfclk_mhz) {
14051395 closest_clk_lvl = j;
14061396 break;
14071397 }
14081398 }
14091399
1410− /* if found a lvl that fits, use the DCN clks from it, if not, go to next clk limit*/
1411− if (closest_clk_lvl != -1) {
1412− dcn2_1_soc.clock_limits[k].state = i;
1413− dcn2_1_soc.clock_limits[k].dcfclk_mhz = clk_table->entries[i].dcfclk_mhz;
1414− dcn2_1_soc.clock_limits[k].fabricclk_mhz = clk_table->entries[i].fclk_mhz;
1415− dcn2_1_soc.clock_limits[k].socclk_mhz = clk_table->entries[i].socclk_mhz;
1416− dcn2_1_soc.clock_limits[k].dram_speed_mts = clk_table->entries[i].memclk_mhz * 2;
1417−
1418− dcn2_1_soc.clock_limits[k].dispclk_mhz = dcn2_1_soc.clock_limits[closest_clk_lvl].dispclk_mhz;
1419− dcn2_1_soc.clock_limits[k].dppclk_mhz = dcn2_1_soc.clock_limits[closest_clk_lvl].dppclk_mhz;
1420− dcn2_1_soc.clock_limits[k].dram_bw_per_chan_gbps = dcn2_1_soc.clock_limits[closest_clk_lvl].dram_bw_per_chan_gbps;
1421− dcn2_1_soc.clock_limits[k].dscclk_mhz = dcn2_1_soc.clock_limits[closest_clk_lvl].dscclk_mhz;
1422− dcn2_1_soc.clock_limits[k].dtbclk_mhz = dcn2_1_soc.clock_limits[closest_clk_lvl].dtbclk_mhz;
1423− dcn2_1_soc.clock_limits[k].phyclk_d18_mhz = dcn2_1_soc.clock_limits[closest_clk_lvl].phyclk_d18_mhz;
1424− dcn2_1_soc.clock_limits[k].phyclk_mhz = dcn2_1_soc.clock_limits[closest_clk_lvl].phyclk_mhz;
1425− k++;
1426− }
1400+ clock_limits[i].state = i;
1401+ clock_limits[i].dcfclk_mhz = clk_table->entries[i].dcfclk_mhz;
1402+ clock_limits[i].fabricclk_mhz = clk_table->entries[i].fclk_mhz;
1403+ clock_limits[i].socclk_mhz = clk_table->entries[i].socclk_mhz;
1404+ clock_limits[i].dram_speed_mts = clk_table->entries[i].memclk_mhz * 2;
1405+
1406+ clock_limits[i].dispclk_mhz = dcn2_1_soc.clock_limits[closest_clk_lvl].dispclk_mhz;
1407+ clock_limits[i].dppclk_mhz = dcn2_1_soc.clock_limits[closest_clk_lvl].dppclk_mhz;
1408+ clock_limits[i].dram_bw_per_chan_gbps = dcn2_1_soc.clock_limits[closest_clk_lvl].dram_bw_per_chan_gbps;
1409+ clock_limits[i].dscclk_mhz = dcn2_1_soc.clock_limits[closest_clk_lvl].dscclk_mhz;
1410+ clock_limits[i].dtbclk_mhz = dcn2_1_soc.clock_limits[closest_clk_lvl].dtbclk_mhz;
1411+ clock_limits[i].phyclk_d18_mhz = dcn2_1_soc.clock_limits[closest_clk_lvl].phyclk_d18_mhz;
1412+ clock_limits[i].phyclk_mhz = dcn2_1_soc.clock_limits[closest_clk_lvl].phyclk_mhz;
1413+ }
1414+ for (i = 0; i < clk_table->num_entries; i++)
1415+ dcn2_1_soc.clock_limits[i] = clock_limits[i];
1416+ if (clk_table->num_entries) {
1417+ dcn2_1_soc.num_states = clk_table->num_entries;
1418+ /* duplicate last level */
1419+ dcn2_1_soc.clock_limits[dcn2_1_soc.num_states] = dcn2_1_soc.clock_limits[dcn2_1_soc.num_states - 1];
1420+ dcn2_1_soc.clock_limits[dcn2_1_soc.num_states].state = dcn2_1_soc.num_states;
14271421 }
1428− dcn2_1_soc.num_states = k;
14291422 }
14301423
1431− /* duplicate last level */
1432− dcn2_1_soc.clock_limits[dcn2_1_soc.num_states] = dcn2_1_soc.clock_limits[dcn2_1_soc.num_states - 1];
1433− dcn2_1_soc.clock_limits[dcn2_1_soc.num_states].state = dcn2_1_soc.num_states;
1434−
14351424 dml_init_instance(&dc->dml, &dcn2_1_soc, &dcn2_1_ip, DML_PROJECT_DCN21);
14361425 }
14371426
drivers/gpu/drm/amd/display/dc/inc/hw/mpc.h+16−0
@@ -210,6 +210,22 @@ struct mpc_funcs { · 209 unmodified lines
210210 struct mpcc_blnd_cfg *blnd_cfg,
211211 int mpcc_id);
212212
213+ /*
214+ * Lock cursor updates for the specified OPP.
215+ * OPP defines the set of MPCC that are locked together for cursor.
216+ *
217+ * Parameters:
218+ * [in] mpc - MPC context.
219+ * [in] opp_id - The OPP to lock cursor updates on
220+ * [in] lock - lock/unlock the OPP
221+ *
222+ * Return: void
223+ */
224+ void (*cursor_lock)(
225+ struct mpc *mpc,
226+ int opp_id,
227+ bool lock);
228+
213229 struct mpcc* (*get_mpcc_for_dpp)(
214230 struct mpc_tree *tree,
215231 int dpp_id);
drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h+1−0
@@ -86,6 +86,7 @@ struct hw_sequencer_funcs { · 85 unmodified lines
8686 struct dc_state *context, bool lock);
8787 void (*set_flip_control_gsl)(struct pipe_ctx *pipe_ctx,
8888 bool flip_immediate);
89+ void (*cursor_lock)(struct dc *dc, struct pipe_ctx *pipe, bool lock);
8990
9091 /* Timing Related */
9192 void (*get_position)(struct pipe_ctx **pipe_ctx, int num_pipes,
drivers/gpu/drm/amd/powerplay/amd_powerplay.c+5−4
@@ -1435,7 +1435,8 @@ static int pp_get_asic_baco_capability(void *handle, bool *cap) · 1434 unmodified lines
14351435 if (!hwmgr)
14361436 return -EINVAL;
14371437
1438− if (!hwmgr->pm_en || !hwmgr->hwmgr_func->get_asic_baco_capability)
1438+ if (!(hwmgr->not_vf && amdgpu_dpm) ||
1439+ !hwmgr->hwmgr_func->get_asic_baco_capability)
14391440 return 0;
14401441
14411442 mutex_lock(&hwmgr->smu_lock);
@@ -1452,8 +1453,7 @@ static int pp_get_asic_baco_state(void *handle, int *state) · 10 unmodified lines
14521453 if (!hwmgr)
14531454 return -EINVAL;
14541455
1455− if (!(hwmgr->not_vf && amdgpu_dpm) ||
1456− !hwmgr->hwmgr_func->get_asic_baco_state)
1456+ if (!hwmgr->pm_en || !hwmgr->hwmgr_func->get_asic_baco_state)
14571457 return 0;
14581458
14591459 mutex_lock(&hwmgr->smu_lock);
@@ -1470,7 +1470,8 @@ static int pp_set_asic_baco_state(void *handle, int state) · 10 unmodified lines
14701470 if (!hwmgr)
14711471 return -EINVAL;
14721472
1473− if (!hwmgr->pm_en || !hwmgr->hwmgr_func->set_asic_baco_state)
1473+ if (!(hwmgr->not_vf && amdgpu_dpm) ||
1474+ !hwmgr->hwmgr_func->set_asic_baco_state)
14741475 return 0;
14751476
14761477 mutex_lock(&hwmgr->smu_lock);
drivers/gpu/drm/drm_dp_mst_topology.c+6−2
@@ -3442,8 +3442,12 @@ static int drm_dp_send_dpcd_write(struct drm_dp_mst_topology_mgr *mgr, · 3441 unmodified lines
34423442 drm_dp_queue_down_tx(mgr, txmsg);
34433443
34443444 ret = drm_dp_mst_wait_tx_reply(mstb, txmsg);
3445− if (ret > 0 && txmsg->reply.reply_type == DP_SIDEBAND_REPLY_NAK)
3446− ret = -EIO;
3445+ if (ret > 0) {
3446+ if (txmsg->reply.reply_type == DP_SIDEBAND_REPLY_NAK)
3447+ ret = -EIO;
3448+ else
3449+ ret = size;
3450+ }
34473451
34483452 kfree(txmsg);
34493453 fail_put:
drivers/gpu/drm/drm_edid.c+1−1
@@ -5111,7 +5111,7 @@ static struct drm_display_mode *drm_mode_displayid_detailed(struct drm_device *d · 5110 unmodified lines
51115111 struct drm_display_mode *mode;
51125112 unsigned pixel_clock = (timings->pixel_clock[0] |
51135113 (timings->pixel_clock[1] << 8) |
5114− (timings->pixel_clock[2] << 16));
5114+ (timings->pixel_clock[2] << 16)) + 1;
51155115 unsigned hactive = (timings->hactive[0] | timings->hactive[1] << 8) + 1;
51165116 unsigned hblank = (timings->hblank[0] | timings->hblank[1] << 8) + 1;
51175117 unsigned hsync = (timings->hsync[0] | (timings->hsync[1] & 0x7f) << 8) + 1;
drivers/gpu/drm/i915/gem/i915_gem_tiling.c+18−2
@@ -182,21 +182,35 @@ i915_gem_object_fence_prepare(struct drm_i915_gem_object *obj, · 181 unmodified lines
182182 int tiling_mode, unsigned int stride)
183183 {
184184 struct i915_ggtt *ggtt = &to_i915(obj->base.dev)->ggtt;
185− struct i915_vma *vma;
185+ struct i915_vma *vma, *vn;
186+ LIST_HEAD(unbind);
186187 int ret = 0;
187188
188189 if (tiling_mode == I915_TILING_NONE)
189190 return 0;
190191
191192 mutex_lock(&ggtt->vm.mutex);
193+
194+ spin_lock(&obj->vma.lock);
192195 for_each_ggtt_vma(vma, obj) {
196+ GEM_BUG_ON(vma->vm != &ggtt->vm);
197+
193198 if (i915_vma_fence_prepare(vma, tiling_mode, stride))
194199 continue;
195200
201+ list_move(&vma->vm_link, &unbind);
202+ }
203+ spin_unlock(&obj->vma.lock);
204+
205+ list_for_each_entry_safe(vma, vn, &unbind, vm_link) {
196206 ret = __i915_vma_unbind(vma);
197− if (ret)
207+ if (ret) {
208+ /* Restore the remaining vma on an error */
209+ list_splice(&unbind, &ggtt->vm.bound_list);
198210 break;
211+ }
199212 }
213+
200214 mutex_unlock(&ggtt->vm.mutex);
201215
202216 return ret;
@@ -268,6 +282,7 @@ i915_gem_object_set_tiling(struct drm_i915_gem_object *obj, · 65 unmodified lines
268282 }
269283 mutex_unlock(&obj->mm.lock);
270284
285+ spin_lock(&obj->vma.lock);
271286 for_each_ggtt_vma(vma, obj) {
272287 vma->fence_size =
273288 i915_gem_fence_size(i915, vma->size, tiling, stride);
@@ -278,6 +293,7 @@ i915_gem_object_set_tiling(struct drm_i915_gem_object *obj, · 4 unmodified lines
278293 if (vma->fence)
279294 vma->fence->dirty = true;
280295 }
296+ spin_unlock(&obj->vma.lock);
281297
282298 obj->tiling_and_stride = tiling | stride;
283299 i915_gem_object_unlock(obj);
drivers/gpu/drm/i915/gem/selftests/huge_pages.c+8−4
@@ -1477,8 +1477,10 @@ static int igt_ppgtt_pin_update(void *arg) · 1476 unmodified lines
14771477 unsigned int page_size = BIT(first);
14781478
14791479 obj = i915_gem_object_create_internal(dev_priv, page_size);
1480− if (IS_ERR(obj))
1481− return PTR_ERR(obj);
1480+ if (IS_ERR(obj)) {
1481+ err = PTR_ERR(obj);
1482+ goto out_vm;
1483+ }
14821484
14831485 vma = i915_vma_instance(obj, vm, NULL);
14841486 if (IS_ERR(vma)) {
@@ -1531,8 +1533,10 @@ static int igt_ppgtt_pin_update(void *arg) · 46 unmodified lines
15311533 }
15321534
15331535 obj = i915_gem_object_create_internal(dev_priv, PAGE_SIZE);
1534− if (IS_ERR(obj))
1535− return PTR_ERR(obj);
1536+ if (IS_ERR(obj)) {
1537+ err = PTR_ERR(obj);
1538+ goto out_vm;
1539+ }
15361540
15371541 vma = i915_vma_instance(obj, vm, NULL);
15381542 if (IS_ERR(vma)) {
drivers/gpu/drm/i915/gt/intel_timeline.c+2−0
@@ -521,6 +521,8 @@ int intel_timeline_read_hwsp(struct i915_request *from, · 520 unmodified lines
521521
522522 rcu_read_lock();
523523 cl = rcu_dereference(from->hwsp_cacheline);
524+ if (i915_request_completed(from)) /* confirm cacheline is valid */
525+ goto unlock;
524526 if (unlikely(!i915_active_acquire_if_busy(&cl->active)))
525527 goto unlock; /* seqno wrapped and completed! */
526528 if (unlikely(i915_request_completed(from)))
drivers/gpu/drm/i915/i915_irq.c+2−4
@@ -3358,7 +3358,8 @@ static void gen8_de_irq_postinstall(struct drm_i915_private *dev_priv) · 3357 unmodified lines
33583358 {
33593359 struct intel_uncore *uncore = &dev_priv->uncore;
33603360
3361− u32 de_pipe_masked = GEN8_PIPE_CDCLK_CRC_DONE;
3361+ u32 de_pipe_masked = gen8_de_pipe_fault_mask(dev_priv) |
3362+ GEN8_PIPE_CDCLK_CRC_DONE;
33623363 u32 de_pipe_enables;
33633364 u32 de_port_masked = GEN8_AUX_CHANNEL_A;
33643365 u32 de_port_enables;
@@ -3369,13 +3370,10 @@ static void gen8_de_irq_postinstall(struct drm_i915_private *dev_priv) · 4 unmodified lines
33693370 de_misc_masked |= GEN8_DE_MISC_GSE;
33703371
33713372 if (INTEL_GEN(dev_priv) >= 9) {
3372− de_pipe_masked |= GEN9_DE_PIPE_IRQ_FAULT_ERRORS;
33733373 de_port_masked |= GEN9_AUX_CHANNEL_B | GEN9_AUX_CHANNEL_C |
33743374 GEN9_AUX_CHANNEL_D;
33753375 if (IS_GEN9_LP(dev_priv))
33763376 de_port_masked |= BXT_DE_PORT_GMBUS;
3377− } else {
3378− de_pipe_masked |= GEN8_DE_PIPE_IRQ_FAULT_ERRORS;
33793377 }
33803378
33813379 if (INTEL_GEN(dev_priv) >= 11)
drivers/gpu/drm/i915/i915_vma.c+6−4
@@ -158,16 +158,18 @@ vma_create(struct drm_i915_gem_object *obj, · 157 unmodified lines
158158
159159 GEM_BUG_ON(!IS_ALIGNED(vma->size, I915_GTT_PAGE_SIZE));
160160
161+ spin_lock(&obj->vma.lock);
162+
161163 if (i915_is_ggtt(vm)) {
162164 if (unlikely(overflows_type(vma->size, u32)))
163− goto err_vma;
165+ goto err_unlock;
164166
165167 vma->fence_size = i915_gem_fence_size(vm->i915, vma->size,
166168 i915_gem_object_get_tiling(obj),
167169 i915_gem_object_get_stride(obj));
168170 if (unlikely(vma->fence_size < vma->size || /* overflow */
169171 vma->fence_size > vm->total))
170− goto err_vma;
172+ goto err_unlock;
171173
172174 GEM_BUG_ON(!IS_ALIGNED(vma->fence_size, I915_GTT_MIN_ALIGNMENT));
173175
@@ -179,8 +181,6 @@ vma_create(struct drm_i915_gem_object *obj, · 5 unmodified lines
179181 __set_bit(I915_VMA_GGTT_BIT, __i915_vma_flags(vma));
180182 }
181183
182− spin_lock(&obj->vma.lock);
183−
184184 rb = NULL;
185185 p = &obj->vma.tree.rb_node;
186186 while (*p) {
@@ -225,6 +225,8 @@ vma_create(struct drm_i915_gem_object *obj, · 38 unmodified lines
225225
226226 return vma;
227227
228+err_unlock:
229+ spin_unlock(&obj->vma.lock);
228230 err_vma:
229231 i915_vma_free(vma);
230232 return ERR_PTR(-E2BIG);
drivers/gpu/drm/qxl/qxl_cmd.c+5−5
@@ -480,9 +480,10 @@ int qxl_hw_surface_alloc(struct qxl_device *qdev, · 479 unmodified lines
480480 return ret;
481481
482482 ret = qxl_release_reserve_list(release, true);
483− if (ret)
483+ if (ret) {
484+ qxl_release_free(qdev, release);
484485 return ret;
485−
486+ }
486487 cmd = (struct qxl_surface_cmd *)qxl_release_map(qdev, release);
487488 cmd->type = QXL_SURFACE_CMD_CREATE;
488489 cmd->flags = QXL_SURF_FLAG_KEEP_DATA;
@@ -499,8 +500,8 @@ int qxl_hw_surface_alloc(struct qxl_device *qdev, · 10 unmodified lines
499500 /* no need to add a release to the fence for this surface bo,
500501 since it is only released when we ask to destroy the surface
501502 and it would never signal otherwise */
502− qxl_push_command_ring_release(qdev, release, QXL_CMD_SURFACE, false);
503503 qxl_release_fence_buffer_objects(release);
504+ qxl_push_command_ring_release(qdev, release, QXL_CMD_SURFACE, false);
504505
505506 surf->hw_surf_alloc = true;
506507 spin_lock(&qdev->surf_id_idr_lock);
@@ -542,9 +543,8 @@ int qxl_hw_surface_dealloc(struct qxl_device *qdev, · 35 unmodified lines
542543 cmd->surface_id = id;
543544 qxl_release_unmap(qdev, release, &cmd->release_info);
544545
545− qxl_push_command_ring_release(qdev, release, QXL_CMD_SURFACE, false);
546−
547546 qxl_release_fence_buffer_objects(release);
547+ qxl_push_command_ring_release(qdev, release, QXL_CMD_SURFACE, false);
548548
549549 return 0;
550550 }
drivers/gpu/drm/qxl/qxl_display.c+3−3
@@ -510,8 +510,8 @@ static int qxl_primary_apply_cursor(struct drm_plane *plane) · 509 unmodified lines
510510 cmd->u.set.visible = 1;
511511 qxl_release_unmap(qdev, release, &cmd->release_info);
512512
513− qxl_push_cursor_ring_release(qdev, release, QXL_CMD_CURSOR, false);
514513 qxl_release_fence_buffer_objects(release);
514+ qxl_push_cursor_ring_release(qdev, release, QXL_CMD_CURSOR, false);
515515
516516 return ret;
517517
@@ -652,8 +652,8 @@ static void qxl_cursor_atomic_update(struct drm_plane *plane, · 134 unmodified lines
652652 cmd->u.position.y = plane->state->crtc_y + fb->hot_y;
653653
654654 qxl_release_unmap(qdev, release, &cmd->release_info);
655− qxl_push_cursor_ring_release(qdev, release, QXL_CMD_CURSOR, false);
656655 qxl_release_fence_buffer_objects(release);
656+ qxl_push_cursor_ring_release(qdev, release, QXL_CMD_CURSOR, false);
657657
658658 if (old_cursor_bo != NULL)
659659 qxl_bo_unpin(old_cursor_bo);
@@ -700,8 +700,8 @@ static void qxl_cursor_atomic_disable(struct drm_plane *plane, · 40 unmodified lines
700700 cmd->type = QXL_CURSOR_HIDE;
701701 qxl_release_unmap(qdev, release, &cmd->release_info);
702702
703− qxl_push_cursor_ring_release(qdev, release, QXL_CMD_CURSOR, false);
704703 qxl_release_fence_buffer_objects(release);
704+ qxl_push_cursor_ring_release(qdev, release, QXL_CMD_CURSOR, false);
705705 }
706706
707707 static void qxl_update_dumb_head(struct qxl_device *qdev,
drivers/gpu/drm/qxl/qxl_draw.c+4−3
@@ -209,9 +209,10 @@ void qxl_draw_dirty_fb(struct qxl_device *qdev, · 208 unmodified lines
209209 goto out_release_backoff;
210210
211211 rects = drawable_set_clipping(qdev, num_clips, clips_bo);
212− if (!rects)
212+ if (!rects) {
213+ ret = -EINVAL;
213214 goto out_release_backoff;
214−
215+ }
215216 drawable = (struct qxl_drawable *)qxl_release_map(qdev, release);
216217
217218 drawable->clip.type = SPICE_CLIP_TYPE_RECTS;
@@ -242,8 +243,8 @@ void qxl_draw_dirty_fb(struct qxl_device *qdev, · 24 unmodified lines
242243 }
243244 qxl_bo_kunmap(clips_bo);
244245
245− qxl_push_command_ring_release(qdev, release, QXL_CMD_DRAW, false);
246246 qxl_release_fence_buffer_objects(release);
247+ qxl_push_command_ring_release(qdev, release, QXL_CMD_DRAW, false);
247248
248249 out_release_backoff:
249250 if (ret)
drivers/gpu/drm/qxl/qxl_image.c+2−1
@@ -212,7 +212,8 @@ qxl_image_init_helper(struct qxl_device *qdev, · 211 unmodified lines
212212 break;
213213 default:
214214 DRM_ERROR("unsupported image bit depth\n");
215− return -EINVAL; /* TODO: cleanup */
215+ qxl_bo_kunmap_atomic_page(qdev, image_bo, ptr);
216+ return -EINVAL;
216217 }
217218 image->u.bitmap.flags = QXL_BITMAP_TOP_DOWN;
218219 image->u.bitmap.x = width;
drivers/gpu/drm/qxl/qxl_ioctl.c+1−4
@@ -261,11 +261,8 @@ static int qxl_process_single_command(struct qxl_device *qdev, · 260 unmodified lines
261261 apply_surf_reloc(qdev, &reloc_info[i]);
262262 }
263263
264+ qxl_release_fence_buffer_objects(release);
264265 ret = qxl_push_command_ring_release(qdev, release, cmd->type, true);
265− if (ret)
266− qxl_release_backoff_reserve_list(release);
267− else
268− qxl_release_fence_buffer_objects(release);
269266
270267 out_free_bos:
271268 out_free_release:
drivers/gpu/drm/virtio/virtgpu_kms.c+6−11
@@ -53,14 +53,6 @@ static void virtio_gpu_config_changed_work_func(struct work_struct *work) · 52 unmodified lines
5353 events_clear, &events_clear);
5454 }
5555
56−static void virtio_gpu_context_destroy(struct virtio_gpu_device *vgdev,
57− uint32_t ctx_id)
58−{
59− virtio_gpu_cmd_context_destroy(vgdev, ctx_id);
60− virtio_gpu_notify(vgdev);
61− ida_free(&vgdev->ctx_id_ida, ctx_id - 1);
62−}
63−
6456 static void virtio_gpu_init_vq(struct virtio_gpu_queue *vgvq,
6557 void (*work_func)(struct work_struct *work))
6658 {
@@ -275,14 +267,17 @@ int virtio_gpu_driver_open(struct drm_device *dev, struct drm_file *file) · 208 unmodified lines
275267 void virtio_gpu_driver_postclose(struct drm_device *dev, struct drm_file *file)
276268 {
277269 struct virtio_gpu_device *vgdev = dev->dev_private;
278− struct virtio_gpu_fpriv *vfpriv;
270+ struct virtio_gpu_fpriv *vfpriv = file->driver_priv;
279271
280272 if (!vgdev->has_virgl_3d)
281273 return;
282274
283− vfpriv = file->driver_priv;
275+ if (vfpriv->context_created) {
276+ virtio_gpu_cmd_context_destroy(vgdev, vfpriv->ctx_id);
277+ virtio_gpu_notify(vgdev);
278+ }
284279
285− virtio_gpu_context_destroy(vgdev, vfpriv->ctx_id);
280+ ida_free(&vgdev->ctx_id_ida, vfpriv->ctx_id - 1);
286281 mutex_destroy(&vfpriv->context_lock);
287282 kfree(vfpriv);
288283 file->driver_priv = NULL;
include/linux/dma-buf.h+1−2
@@ -329,13 +329,12 @@ struct dma_buf { · 328 unmodified lines
329329
330330 /**
331331 * struct dma_buf_attach_ops - importer operations for an attachment
332− * @move_notify: [optional] notification that the DMA-buf is moving
333332 *
334333 * Attachment operations implemented by the importer.
335334 */
336335 struct dma_buf_attach_ops {
337336 /**
338− * @move_notify
337+ * @move_notify: [optional] notification that the DMA-buf is moving
339338 *
340339 * If this callback is provided the framework can avoid pinning the
341340 * backing store while mappings exists.
include/uapi/drm/amdgpu_drm.h+4−0
@@ -346,6 +346,10 @@ struct drm_amdgpu_gem_userptr { · 345 unmodified lines
346346 #define AMDGPU_TILING_DCC_PITCH_MAX_MASK 0x3FFF
347347 #define AMDGPU_TILING_DCC_INDEPENDENT_64B_SHIFT 43
348348 #define AMDGPU_TILING_DCC_INDEPENDENT_64B_MASK 0x1
349+#define AMDGPU_TILING_DCC_INDEPENDENT_128B_SHIFT 44
350+#define AMDGPU_TILING_DCC_INDEPENDENT_128B_MASK 0x1
351+#define AMDGPU_TILING_SCANOUT_SHIFT 63
352+#define AMDGPU_TILING_SCANOUT_MASK 0x1
349353
350354 /* Set/Get helpers for tiling flags. */
351355 #define AMDGPU_TILING_SET(field, value) \
include/uapi/linux/dma-buf.h+6−0
@@ -39,6 +39,12 @@ struct dma_buf_sync { · 38 unmodified lines
3939
4040 #define DMA_BUF_BASE 'b'
4141 #define DMA_BUF_IOCTL_SYNC _IOW(DMA_BUF_BASE, 0, struct dma_buf_sync)
42+
43+/* 32/64bitness of this uapi was botched in android, there's no difference
44+ * between them in actual uapi, they're just different numbers.
45+ */
4246 #define DMA_BUF_SET_NAME _IOW(DMA_BUF_BASE, 1, const char *)
47+#define DMA_BUF_SET_NAME_A _IOW(DMA_BUF_BASE, 1, u32)
48+#define DMA_BUF_SET_NAME_B _IOW(DMA_BUF_BASE, 1, u64)
4349
4450 #endif