Skip to content

Commit 10a6e5f

Browse files
committed
Merge tag 'drm-fixes-2023-10-13' of git://anongit.freedesktop.org/drm/drm
Pull drm fixes from Dave Airlie: "Weekly fixes, the core is msm and amdgpu with some scattered fixes across vmwgfx, panel and the core stuff. atomic-helper: - Relax checks for unregistered connectors dma-buf: - Work around race condition when retrieving fence timestamp gem: - Avoid OOB access in BO memory range panel: - boe-tv101wun-ml6: Fix flickering simpledrm: - Fix error output vwmgfx: - Fix size calculation in texture-state code - Ref GEM BOs in surfaces msm: - PHY/link training reset fix - msm8998 - correct highest bank bit - skip video mode if timing engine disabled - check irq_of_parse_and_map return code - add new lines to some prints - fail atomic check for max mdp clk test amdgpu: - Seamless boot fix - Fix TTM BO resource check - SI fix for doorbell handling" * tag 'drm-fixes-2023-10-13' of git://anongit.freedesktop.org/drm/drm: drm/tiny: correctly print `struct resource *` on error drm: Do not overrun array in drm_gem_get_pages() drm/atomic-helper: relax unregistered connector check drm/panel: boe-tv101wum-nl6: Completely pull GPW to VGL before TP term drm/amdgpu: fix SI failure due to doorbells allocation drm/amdgpu: add missing NULL check drm/amd/display: Don't set dpms_off for seamless boot drm/vmwgfx: Keep a gem reference to user bos in surfaces drm/vmwgfx: fix typo of sizeof argument drm/msm/dpu: fail dpu_plane_atomic_check() based on mdp clk limits dma-buf: add dma_fence_timestamp helper drm/msm/dp: Add newlines to debug printks drm/msm/dpu: change _dpu_plane_calc_bw() to use u64 to avoid overflow drm/msm/dsi: fix irq_of_parse_and_map() error checking drm/msm/dsi: skip the wait for video mode done if not applicable drm/msm/mdss: fix highest-bank-bit for msm8998 drm/msm/dp: do not reinitialize phy unless retry during link training
2 parents ce583d5 + 3087369 commit 10a6e5f

27 files changed

+165
-100
lines changed

drivers/dma-buf/dma-fence-unwrap.c

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -76,16 +76,11 @@ struct dma_fence *__dma_fence_unwrap_merge(unsigned int num_fences,
7676
dma_fence_unwrap_for_each(tmp, &iter[i], fences[i]) {
7777
if (!dma_fence_is_signaled(tmp)) {
7878
++count;
79-
} else if (test_bit(DMA_FENCE_FLAG_TIMESTAMP_BIT,
80-
&tmp->flags)) {
81-
if (ktime_after(tmp->timestamp, timestamp))
82-
timestamp = tmp->timestamp;
8379
} else {
84-
/*
85-
* Use the current time if the fence is
86-
* currently signaling.
87-
*/
88-
timestamp = ktime_get();
80+
ktime_t t = dma_fence_timestamp(tmp);
81+
82+
if (ktime_after(t, timestamp))
83+
timestamp = t;
8984
}
9085
}
9186
}

drivers/dma-buf/sync_file.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -268,13 +268,10 @@ static int sync_fill_fence_info(struct dma_fence *fence,
268268
sizeof(info->driver_name));
269269

270270
info->status = dma_fence_get_status(fence);
271-
while (test_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &fence->flags) &&
272-
!test_bit(DMA_FENCE_FLAG_TIMESTAMP_BIT, &fence->flags))
273-
cpu_relax();
274271
info->timestamp_ns =
275-
test_bit(DMA_FENCE_FLAG_TIMESTAMP_BIT, &fence->flags) ?
276-
ktime_to_ns(fence->timestamp) :
277-
ktime_set(0, 0);
272+
dma_fence_is_signaled(fence) ?
273+
ktime_to_ns(dma_fence_timestamp(fence)) :
274+
ktime_set(0, 0);
278275

279276
return info->status;
280277
}

drivers/gpu/drm/amd/amdgpu/amdgpu_doorbell_mgr.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,10 @@ int amdgpu_doorbell_create_kernel_doorbells(struct amdgpu_device *adev)
142142
int r;
143143
int size;
144144

145+
/* SI HW does not have doorbells, skip allocation */
146+
if (adev->doorbell.num_kernel_doorbells == 0)
147+
return 0;
148+
145149
/* Reserve first num_kernel_doorbells (page-aligned) for kernel ops */
146150
size = ALIGN(adev->doorbell.num_kernel_doorbells * sizeof(u32), PAGE_SIZE);
147151

drivers/gpu/drm/amd/amdgpu/amdgpu_object.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ static inline bool amdgpu_bo_in_cpu_visible_vram(struct amdgpu_bo *bo)
252252
struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev);
253253
struct amdgpu_res_cursor cursor;
254254

255-
if (bo->tbo.resource->mem_type != TTM_PL_VRAM)
255+
if (!bo->tbo.resource || bo->tbo.resource->mem_type != TTM_PL_VRAM)
256256
return false;
257257

258258
amdgpu_res_first(bo->tbo.resource, 0, amdgpu_bo_size(bo), &cursor);

drivers/gpu/drm/amd/display/dc/core/dc.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1262,6 +1262,9 @@ static void disable_vbios_mode_if_required(
12621262
if (stream == NULL)
12631263
continue;
12641264

1265+
if (stream->apply_seamless_boot_optimization)
1266+
continue;
1267+
12651268
// only looking for first odm pipe
12661269
if (pipe->prev_odm_pipe)
12671270
continue;

drivers/gpu/drm/drm_atomic_helper.c

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,8 @@ static int
290290
update_connector_routing(struct drm_atomic_state *state,
291291
struct drm_connector *connector,
292292
struct drm_connector_state *old_connector_state,
293-
struct drm_connector_state *new_connector_state)
293+
struct drm_connector_state *new_connector_state,
294+
bool added_by_user)
294295
{
295296
const struct drm_connector_helper_funcs *funcs;
296297
struct drm_encoder *new_encoder;
@@ -339,9 +340,13 @@ update_connector_routing(struct drm_atomic_state *state,
339340
* there's a chance the connector may have been destroyed during the
340341
* process, but it's better to ignore that then cause
341342
* drm_atomic_helper_resume() to fail.
343+
*
344+
* Last, we want to ignore connector registration when the connector
345+
* was not pulled in the atomic state by user-space (ie, was pulled
346+
* in by the driver, e.g. when updating a DP-MST stream).
342347
*/
343348
if (!state->duplicated && drm_connector_is_unregistered(connector) &&
344-
crtc_state->active) {
349+
added_by_user && crtc_state->active) {
345350
drm_dbg_atomic(connector->dev,
346351
"[CONNECTOR:%d:%s] is not registered\n",
347352
connector->base.id, connector->name);
@@ -620,7 +625,10 @@ drm_atomic_helper_check_modeset(struct drm_device *dev,
620625
struct drm_connector *connector;
621626
struct drm_connector_state *old_connector_state, *new_connector_state;
622627
int i, ret;
623-
unsigned int connectors_mask = 0;
628+
unsigned int connectors_mask = 0, user_connectors_mask = 0;
629+
630+
for_each_oldnew_connector_in_state(state, connector, old_connector_state, new_connector_state, i)
631+
user_connectors_mask |= BIT(i);
624632

625633
for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) {
626634
bool has_connectors =
@@ -685,7 +693,8 @@ drm_atomic_helper_check_modeset(struct drm_device *dev,
685693
*/
686694
ret = update_connector_routing(state, connector,
687695
old_connector_state,
688-
new_connector_state);
696+
new_connector_state,
697+
BIT(i) & user_connectors_mask);
689698
if (ret)
690699
return ret;
691700
if (old_connector_state->crtc) {

drivers/gpu/drm/drm_gem.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,7 @@ struct page **drm_gem_get_pages(struct drm_gem_object *obj)
540540
struct page **pages;
541541
struct folio *folio;
542542
struct folio_batch fbatch;
543-
int i, j, npages;
543+
long i, j, npages;
544544

545545
if (WARN_ON(!obj->filp))
546546
return ERR_PTR(-EINVAL);
@@ -564,11 +564,13 @@ struct page **drm_gem_get_pages(struct drm_gem_object *obj)
564564

565565
i = 0;
566566
while (i < npages) {
567+
long nr;
567568
folio = shmem_read_folio_gfp(mapping, i,
568569
mapping_gfp_mask(mapping));
569570
if (IS_ERR(folio))
570571
goto fail;
571-
for (j = 0; j < folio_nr_pages(folio); j++, i++)
572+
nr = min(npages - i, folio_nr_pages(folio));
573+
for (j = 0; j < nr; j++, i++)
572574
pages[i] = folio_file_page(folio, i);
573575

574576
/* Make sure shmem keeps __GFP_DMA32 allocated pages in the

drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ static u64 _dpu_plane_calc_bw(const struct dpu_mdss_cfg *catalog,
119119
struct dpu_sw_pipe_cfg *pipe_cfg)
120120
{
121121
int src_width, src_height, dst_height, fps;
122+
u64 plane_pixel_rate, plane_bit_rate;
122123
u64 plane_prefill_bw;
123124
u64 plane_bw;
124125
u32 hw_latency_lines;
@@ -136,13 +137,12 @@ static u64 _dpu_plane_calc_bw(const struct dpu_mdss_cfg *catalog,
136137
scale_factor = src_height > dst_height ?
137138
mult_frac(src_height, 1, dst_height) : 1;
138139

139-
plane_bw =
140-
src_width * mode->vtotal * fps * fmt->bpp *
141-
scale_factor;
140+
plane_pixel_rate = src_width * mode->vtotal * fps;
141+
plane_bit_rate = plane_pixel_rate * fmt->bpp;
142142

143-
plane_prefill_bw =
144-
src_width * hw_latency_lines * fps * fmt->bpp *
145-
scale_factor * mode->vtotal;
143+
plane_bw = plane_bit_rate * scale_factor;
144+
145+
plane_prefill_bw = plane_bw * hw_latency_lines;
146146

147147
if ((vbp+vpw) > hw_latency_lines)
148148
do_div(plane_prefill_bw, (vbp+vpw));
@@ -733,9 +733,11 @@ static int dpu_plane_check_inline_rotation(struct dpu_plane *pdpu,
733733
static int dpu_plane_atomic_check_pipe(struct dpu_plane *pdpu,
734734
struct dpu_sw_pipe *pipe,
735735
struct dpu_sw_pipe_cfg *pipe_cfg,
736-
const struct dpu_format *fmt)
736+
const struct dpu_format *fmt,
737+
const struct drm_display_mode *mode)
737738
{
738739
uint32_t min_src_size;
740+
struct dpu_kms *kms = _dpu_plane_get_kms(&pdpu->base);
739741

740742
min_src_size = DPU_FORMAT_IS_YUV(fmt) ? 2 : 1;
741743

@@ -774,6 +776,12 @@ static int dpu_plane_atomic_check_pipe(struct dpu_plane *pdpu,
774776
return -EINVAL;
775777
}
776778

779+
/* max clk check */
780+
if (_dpu_plane_calc_clk(mode, pipe_cfg) > kms->perf.max_core_clk_rate) {
781+
DPU_DEBUG_PLANE(pdpu, "plane exceeds max mdp core clk limits\n");
782+
return -E2BIG;
783+
}
784+
777785
return 0;
778786
}
779787

@@ -899,12 +907,13 @@ static int dpu_plane_atomic_check(struct drm_plane *plane,
899907
r_pipe_cfg->dst_rect.x1 = pipe_cfg->dst_rect.x2;
900908
}
901909

902-
ret = dpu_plane_atomic_check_pipe(pdpu, pipe, pipe_cfg, fmt);
910+
ret = dpu_plane_atomic_check_pipe(pdpu, pipe, pipe_cfg, fmt, &crtc_state->adjusted_mode);
903911
if (ret)
904912
return ret;
905913

906914
if (r_pipe->sspp) {
907-
ret = dpu_plane_atomic_check_pipe(pdpu, r_pipe, r_pipe_cfg, fmt);
915+
ret = dpu_plane_atomic_check_pipe(pdpu, r_pipe, r_pipe_cfg, fmt,
916+
&crtc_state->adjusted_mode);
908917
if (ret)
909918
return ret;
910919
}

drivers/gpu/drm/msm/dp/dp_ctrl.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1774,13 +1774,6 @@ int dp_ctrl_on_link(struct dp_ctrl *dp_ctrl)
17741774
return rc;
17751775

17761776
while (--link_train_max_retries) {
1777-
rc = dp_ctrl_reinitialize_mainlink(ctrl);
1778-
if (rc) {
1779-
DRM_ERROR("Failed to reinitialize mainlink. rc=%d\n",
1780-
rc);
1781-
break;
1782-
}
1783-
17841777
training_step = DP_TRAINING_NONE;
17851778
rc = dp_ctrl_setup_main_link(ctrl, &training_step);
17861779
if (rc == 0) {
@@ -1832,6 +1825,12 @@ int dp_ctrl_on_link(struct dp_ctrl *dp_ctrl)
18321825
/* stop link training before start re training */
18331826
dp_ctrl_clear_training_pattern(ctrl);
18341827
}
1828+
1829+
rc = dp_ctrl_reinitialize_mainlink(ctrl);
1830+
if (rc) {
1831+
DRM_ERROR("Failed to reinitialize mainlink. rc=%d\n", rc);
1832+
break;
1833+
}
18351834
}
18361835

18371836
if (ctrl->link->sink_request & DP_TEST_LINK_PHY_TEST_PATTERN)

drivers/gpu/drm/msm/dp/dp_link.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1090,7 +1090,7 @@ int dp_link_process_request(struct dp_link *dp_link)
10901090
} else if (dp_link_read_psr_error_status(link)) {
10911091
DRM_ERROR("PSR IRQ_HPD received\n");
10921092
} else if (dp_link_psr_capability_changed(link)) {
1093-
drm_dbg_dp(link->drm_dev, "PSR Capability changed");
1093+
drm_dbg_dp(link->drm_dev, "PSR Capability changed\n");
10941094
} else {
10951095
ret = dp_link_process_link_status_update(link);
10961096
if (!ret) {
@@ -1107,7 +1107,7 @@ int dp_link_process_request(struct dp_link *dp_link)
11071107
}
11081108
}
11091109

1110-
drm_dbg_dp(link->drm_dev, "sink request=%#x",
1110+
drm_dbg_dp(link->drm_dev, "sink request=%#x\n",
11111111
dp_link->sink_request);
11121112
return ret;
11131113
}

0 commit comments

Comments
 (0)