Skip to content

Commit 2e4b294

Browse files
committed
Merge tag 'drm-misc-fixes-2022-11-09' of git://anongit.freedesktop.org/drm/drm-misc into drm-fixes
drm-misc-fixes for v6.1-rc5: - HDMI fixes to vc4. - Make panfrost's uapi header compile with C++. - Add rotation quirks for 2 panels. - Fix s/r in amdgpu_vram_mgr_new - Handle 1 gb boundary correctly in panfrost mmu code. Signed-off-by: Dave Airlie <[email protected]> From: Maarten Lankhorst <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2 parents 5bf06c4 + f352262 commit 2e4b294

File tree

7 files changed

+67
-15
lines changed

7 files changed

+67
-15
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ static int amdgpu_vram_mgr_new(struct ttm_resource_manager *man,
435435
if (place->flags & TTM_PL_FLAG_TOPDOWN)
436436
vres->flags |= DRM_BUDDY_TOPDOWN_ALLOCATION;
437437

438-
if (fpfn || lpfn != man->size)
438+
if (fpfn || lpfn != mgr->mm.size)
439439
/* Allocate blocks in desired range */
440440
vres->flags |= DRM_BUDDY_RANGE_ALLOCATION;
441441

drivers/gpu/drm/drm_panel_orientation_quirks.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,12 @@ static const struct dmi_system_id orientation_data[] = {
134134
DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "One S1003"),
135135
},
136136
.driver_data = (void *)&lcd800x1280_rightside_up,
137+
}, { /* Acer Switch V 10 (SW5-017) */
138+
.matches = {
139+
DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Acer"),
140+
DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "SW5-017"),
141+
},
142+
.driver_data = (void *)&lcd800x1280_rightside_up,
137143
}, { /* Anbernic Win600 */
138144
.matches = {
139145
DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "Anbernic"),
@@ -319,6 +325,12 @@ static const struct dmi_system_id orientation_data[] = {
319325
DMI_MATCH(DMI_BIOS_VERSION, "BLADE_21"),
320326
},
321327
.driver_data = (void *)&lcd1200x1920_rightside_up,
328+
}, { /* Nanote UMPC-01 */
329+
.matches = {
330+
DMI_MATCH(DMI_SYS_VENDOR, "RWC CO.,LTD"),
331+
DMI_MATCH(DMI_PRODUCT_NAME, "UMPC-01"),
332+
},
333+
.driver_data = (void *)&lcd1200x1920_rightside_up,
322334
}, { /* OneGX1 Pro */
323335
.matches = {
324336
DMI_EXACT_MATCH(DMI_SYS_VENDOR, "SYSTEM_MANUFACTURER"),

drivers/gpu/drm/panfrost/panfrost_mmu.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,13 +250,22 @@ void panfrost_mmu_reset(struct panfrost_device *pfdev)
250250

251251
static size_t get_pgsize(u64 addr, size_t size, size_t *count)
252252
{
253+
/*
254+
* io-pgtable only operates on multiple pages within a single table
255+
* entry, so we need to split at boundaries of the table size, i.e.
256+
* the next block size up. The distance from address A to the next
257+
* boundary of block size B is logically B - A % B, but in unsigned
258+
* two's complement where B is a power of two we get the equivalence
259+
* B - A % B == (B - A) % B == (n * B - A) % B, and choose n = 0 :)
260+
*/
253261
size_t blk_offset = -addr % SZ_2M;
254262

255263
if (blk_offset || size < SZ_2M) {
256264
*count = min_not_zero(blk_offset, size) / SZ_4K;
257265
return SZ_4K;
258266
}
259-
*count = size / SZ_2M;
267+
blk_offset = -addr % SZ_1G ?: SZ_1G;
268+
*count = min(blk_offset, size) / SZ_2M;
260269
return SZ_2M;
261270
}
262271

drivers/gpu/drm/vc4/vc4_drv.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,12 @@ static int __init vc4_drm_register(void)
476476
if (ret)
477477
return ret;
478478

479-
return platform_driver_register(&vc4_platform_driver);
479+
ret = platform_driver_register(&vc4_platform_driver);
480+
if (ret)
481+
platform_unregister_drivers(component_drivers,
482+
ARRAY_SIZE(component_drivers));
483+
484+
return ret;
480485
}
481486

482487
static void __exit vc4_drm_unregister(void)

drivers/gpu/drm/vc4/vc4_hdmi.c

Lines changed: 36 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -349,27 +349,40 @@ static int vc4_hdmi_reset_link(struct drm_connector *connector,
349349
if (!crtc_state->active)
350350
return 0;
351351

352-
if (!vc4_hdmi_supports_scrambling(encoder))
352+
mutex_lock(&vc4_hdmi->mutex);
353+
354+
if (!vc4_hdmi_supports_scrambling(encoder)) {
355+
mutex_unlock(&vc4_hdmi->mutex);
353356
return 0;
357+
}
354358

355359
scrambling_needed = vc4_hdmi_mode_needs_scrambling(&vc4_hdmi->saved_adjusted_mode,
356360
vc4_hdmi->output_bpc,
357361
vc4_hdmi->output_format);
358-
if (!scrambling_needed)
362+
if (!scrambling_needed) {
363+
mutex_unlock(&vc4_hdmi->mutex);
359364
return 0;
365+
}
360366

361367
if (conn_state->commit &&
362-
!try_wait_for_completion(&conn_state->commit->hw_done))
368+
!try_wait_for_completion(&conn_state->commit->hw_done)) {
369+
mutex_unlock(&vc4_hdmi->mutex);
363370
return 0;
371+
}
364372

365373
ret = drm_scdc_readb(connector->ddc, SCDC_TMDS_CONFIG, &config);
366374
if (ret < 0) {
367375
drm_err(drm, "Failed to read TMDS config: %d\n", ret);
376+
mutex_unlock(&vc4_hdmi->mutex);
368377
return 0;
369378
}
370379

371-
if (!!(config & SCDC_SCRAMBLING_ENABLE) == scrambling_needed)
380+
if (!!(config & SCDC_SCRAMBLING_ENABLE) == scrambling_needed) {
381+
mutex_unlock(&vc4_hdmi->mutex);
372382
return 0;
383+
}
384+
385+
mutex_unlock(&vc4_hdmi->mutex);
373386

374387
/*
375388
* HDMI 2.0 says that one should not send scrambled data
@@ -397,9 +410,8 @@ static void vc4_hdmi_handle_hotplug(struct vc4_hdmi *vc4_hdmi,
397410
* .adap_enable, which leads to that funtion being called with
398411
* our mutex held.
399412
*
400-
* A similar situation occurs with
401-
* drm_atomic_helper_connector_hdmi_reset_link() that will call
402-
* into our KMS hooks if the scrambling was enabled.
413+
* A similar situation occurs with vc4_hdmi_reset_link() that
414+
* will call into our KMS hooks if the scrambling was enabled.
403415
*
404416
* Concurrency isn't an issue at the moment since we don't share
405417
* any state with any of the other frameworks so we can ignore
@@ -3160,9 +3172,16 @@ static int vc4_hdmi_init_resources(struct drm_device *drm,
31603172
DRM_ERROR("Failed to get HDMI state machine clock\n");
31613173
return PTR_ERR(vc4_hdmi->hsm_clock);
31623174
}
3175+
31633176
vc4_hdmi->audio_clock = vc4_hdmi->hsm_clock;
31643177
vc4_hdmi->cec_clock = vc4_hdmi->hsm_clock;
31653178

3179+
vc4_hdmi->hsm_rpm_clock = devm_clk_get(dev, "hdmi");
3180+
if (IS_ERR(vc4_hdmi->hsm_rpm_clock)) {
3181+
DRM_ERROR("Failed to get HDMI state machine clock\n");
3182+
return PTR_ERR(vc4_hdmi->hsm_rpm_clock);
3183+
}
3184+
31663185
return 0;
31673186
}
31683187

@@ -3245,6 +3264,12 @@ static int vc5_hdmi_init_resources(struct drm_device *drm,
32453264
return PTR_ERR(vc4_hdmi->hsm_clock);
32463265
}
32473266

3267+
vc4_hdmi->hsm_rpm_clock = devm_clk_get(dev, "hdmi");
3268+
if (IS_ERR(vc4_hdmi->hsm_rpm_clock)) {
3269+
DRM_ERROR("Failed to get HDMI state machine clock\n");
3270+
return PTR_ERR(vc4_hdmi->hsm_rpm_clock);
3271+
}
3272+
32483273
vc4_hdmi->pixel_bvb_clock = devm_clk_get(dev, "bvb");
32493274
if (IS_ERR(vc4_hdmi->pixel_bvb_clock)) {
32503275
DRM_ERROR("Failed to get pixel bvb clock\n");
@@ -3308,7 +3333,7 @@ static int vc4_hdmi_runtime_suspend(struct device *dev)
33083333
{
33093334
struct vc4_hdmi *vc4_hdmi = dev_get_drvdata(dev);
33103335

3311-
clk_disable_unprepare(vc4_hdmi->hsm_clock);
3336+
clk_disable_unprepare(vc4_hdmi->hsm_rpm_clock);
33123337

33133338
return 0;
33143339
}
@@ -3326,11 +3351,11 @@ static int vc4_hdmi_runtime_resume(struct device *dev)
33263351
* its frequency while the power domain is active so that it
33273352
* keeps its rate.
33283353
*/
3329-
ret = clk_set_min_rate(vc4_hdmi->hsm_clock, HSM_MIN_CLOCK_FREQ);
3354+
ret = clk_set_min_rate(vc4_hdmi->hsm_rpm_clock, HSM_MIN_CLOCK_FREQ);
33303355
if (ret)
33313356
return ret;
33323357

3333-
ret = clk_prepare_enable(vc4_hdmi->hsm_clock);
3358+
ret = clk_prepare_enable(vc4_hdmi->hsm_rpm_clock);
33343359
if (ret)
33353360
return ret;
33363361

@@ -3343,7 +3368,7 @@ static int vc4_hdmi_runtime_resume(struct device *dev)
33433368
* case, it will lead to a silent CPU stall. Let's make sure we
33443369
* prevent such a case.
33453370
*/
3346-
rate = clk_get_rate(vc4_hdmi->hsm_clock);
3371+
rate = clk_get_rate(vc4_hdmi->hsm_rpm_clock);
33473372
if (!rate) {
33483373
ret = -EINVAL;
33493374
goto err_disable_clk;

drivers/gpu/drm/vc4/vc4_hdmi.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ struct vc4_hdmi {
172172
struct clk *cec_clock;
173173
struct clk *pixel_clock;
174174
struct clk *hsm_clock;
175+
struct clk *hsm_rpm_clock;
175176
struct clk *audio_clock;
176177
struct clk *pixel_bvb_clock;
177178

include/uapi/drm/panfrost_drm.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ struct panfrost_dump_object_header {
254254
__u64 nbos;
255255
} reghdr;
256256

257-
struct pan_bomap_hdr {
257+
struct {
258258
__u32 valid;
259259
__u64 iova;
260260
__u32 data[2];

0 commit comments

Comments
 (0)