Commit 2e4b2945 authored by Dave Airlie's avatar Dave Airlie

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: default avatarDave Airlie <airlied@redhat.com>
From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/e02de501-4b85-28a0-3f6e-751ca13f5f9d@linux.intel.com
parents 5bf06c4c f352262f
...@@ -435,7 +435,7 @@ static int amdgpu_vram_mgr_new(struct ttm_resource_manager *man, ...@@ -435,7 +435,7 @@ static int amdgpu_vram_mgr_new(struct ttm_resource_manager *man,
if (place->flags & TTM_PL_FLAG_TOPDOWN) if (place->flags & TTM_PL_FLAG_TOPDOWN)
vres->flags |= DRM_BUDDY_TOPDOWN_ALLOCATION; vres->flags |= DRM_BUDDY_TOPDOWN_ALLOCATION;
if (fpfn || lpfn != man->size) if (fpfn || lpfn != mgr->mm.size)
/* Allocate blocks in desired range */ /* Allocate blocks in desired range */
vres->flags |= DRM_BUDDY_RANGE_ALLOCATION; vres->flags |= DRM_BUDDY_RANGE_ALLOCATION;
......
...@@ -134,6 +134,12 @@ static const struct dmi_system_id orientation_data[] = { ...@@ -134,6 +134,12 @@ static const struct dmi_system_id orientation_data[] = {
DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "One S1003"), DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "One S1003"),
}, },
.driver_data = (void *)&lcd800x1280_rightside_up, .driver_data = (void *)&lcd800x1280_rightside_up,
}, { /* Acer Switch V 10 (SW5-017) */
.matches = {
DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Acer"),
DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "SW5-017"),
},
.driver_data = (void *)&lcd800x1280_rightside_up,
}, { /* Anbernic Win600 */ }, { /* Anbernic Win600 */
.matches = { .matches = {
DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "Anbernic"), DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "Anbernic"),
...@@ -319,6 +325,12 @@ static const struct dmi_system_id orientation_data[] = { ...@@ -319,6 +325,12 @@ static const struct dmi_system_id orientation_data[] = {
DMI_MATCH(DMI_BIOS_VERSION, "BLADE_21"), DMI_MATCH(DMI_BIOS_VERSION, "BLADE_21"),
}, },
.driver_data = (void *)&lcd1200x1920_rightside_up, .driver_data = (void *)&lcd1200x1920_rightside_up,
}, { /* Nanote UMPC-01 */
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "RWC CO.,LTD"),
DMI_MATCH(DMI_PRODUCT_NAME, "UMPC-01"),
},
.driver_data = (void *)&lcd1200x1920_rightside_up,
}, { /* OneGX1 Pro */ }, { /* OneGX1 Pro */
.matches = { .matches = {
DMI_EXACT_MATCH(DMI_SYS_VENDOR, "SYSTEM_MANUFACTURER"), DMI_EXACT_MATCH(DMI_SYS_VENDOR, "SYSTEM_MANUFACTURER"),
......
...@@ -250,13 +250,22 @@ void panfrost_mmu_reset(struct panfrost_device *pfdev) ...@@ -250,13 +250,22 @@ void panfrost_mmu_reset(struct panfrost_device *pfdev)
static size_t get_pgsize(u64 addr, size_t size, size_t *count) static size_t get_pgsize(u64 addr, size_t size, size_t *count)
{ {
/*
* io-pgtable only operates on multiple pages within a single table
* entry, so we need to split at boundaries of the table size, i.e.
* the next block size up. The distance from address A to the next
* boundary of block size B is logically B - A % B, but in unsigned
* two's complement where B is a power of two we get the equivalence
* B - A % B == (B - A) % B == (n * B - A) % B, and choose n = 0 :)
*/
size_t blk_offset = -addr % SZ_2M; size_t blk_offset = -addr % SZ_2M;
if (blk_offset || size < SZ_2M) { if (blk_offset || size < SZ_2M) {
*count = min_not_zero(blk_offset, size) / SZ_4K; *count = min_not_zero(blk_offset, size) / SZ_4K;
return SZ_4K; return SZ_4K;
} }
*count = size / SZ_2M; blk_offset = -addr % SZ_1G ?: SZ_1G;
*count = min(blk_offset, size) / SZ_2M;
return SZ_2M; return SZ_2M;
} }
......
...@@ -476,7 +476,12 @@ static int __init vc4_drm_register(void) ...@@ -476,7 +476,12 @@ static int __init vc4_drm_register(void)
if (ret) if (ret)
return ret; return ret;
return platform_driver_register(&vc4_platform_driver); ret = platform_driver_register(&vc4_platform_driver);
if (ret)
platform_unregister_drivers(component_drivers,
ARRAY_SIZE(component_drivers));
return ret;
} }
static void __exit vc4_drm_unregister(void) static void __exit vc4_drm_unregister(void)
......
...@@ -349,27 +349,40 @@ static int vc4_hdmi_reset_link(struct drm_connector *connector, ...@@ -349,27 +349,40 @@ static int vc4_hdmi_reset_link(struct drm_connector *connector,
if (!crtc_state->active) if (!crtc_state->active)
return 0; return 0;
if (!vc4_hdmi_supports_scrambling(encoder)) mutex_lock(&vc4_hdmi->mutex);
if (!vc4_hdmi_supports_scrambling(encoder)) {
mutex_unlock(&vc4_hdmi->mutex);
return 0; return 0;
}
scrambling_needed = vc4_hdmi_mode_needs_scrambling(&vc4_hdmi->saved_adjusted_mode, scrambling_needed = vc4_hdmi_mode_needs_scrambling(&vc4_hdmi->saved_adjusted_mode,
vc4_hdmi->output_bpc, vc4_hdmi->output_bpc,
vc4_hdmi->output_format); vc4_hdmi->output_format);
if (!scrambling_needed) if (!scrambling_needed) {
mutex_unlock(&vc4_hdmi->mutex);
return 0; return 0;
}
if (conn_state->commit && if (conn_state->commit &&
!try_wait_for_completion(&conn_state->commit->hw_done)) !try_wait_for_completion(&conn_state->commit->hw_done)) {
mutex_unlock(&vc4_hdmi->mutex);
return 0; return 0;
}
ret = drm_scdc_readb(connector->ddc, SCDC_TMDS_CONFIG, &config); ret = drm_scdc_readb(connector->ddc, SCDC_TMDS_CONFIG, &config);
if (ret < 0) { if (ret < 0) {
drm_err(drm, "Failed to read TMDS config: %d\n", ret); drm_err(drm, "Failed to read TMDS config: %d\n", ret);
mutex_unlock(&vc4_hdmi->mutex);
return 0; return 0;
} }
if (!!(config & SCDC_SCRAMBLING_ENABLE) == scrambling_needed) if (!!(config & SCDC_SCRAMBLING_ENABLE) == scrambling_needed) {
mutex_unlock(&vc4_hdmi->mutex);
return 0; return 0;
}
mutex_unlock(&vc4_hdmi->mutex);
/* /*
* HDMI 2.0 says that one should not send scrambled data * 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, ...@@ -397,9 +410,8 @@ static void vc4_hdmi_handle_hotplug(struct vc4_hdmi *vc4_hdmi,
* .adap_enable, which leads to that funtion being called with * .adap_enable, which leads to that funtion being called with
* our mutex held. * our mutex held.
* *
* A similar situation occurs with * A similar situation occurs with vc4_hdmi_reset_link() that
* drm_atomic_helper_connector_hdmi_reset_link() that will call * will call into our KMS hooks if the scrambling was enabled.
* into our KMS hooks if the scrambling was enabled.
* *
* Concurrency isn't an issue at the moment since we don't share * Concurrency isn't an issue at the moment since we don't share
* any state with any of the other frameworks so we can ignore * 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, ...@@ -3160,9 +3172,16 @@ static int vc4_hdmi_init_resources(struct drm_device *drm,
DRM_ERROR("Failed to get HDMI state machine clock\n"); DRM_ERROR("Failed to get HDMI state machine clock\n");
return PTR_ERR(vc4_hdmi->hsm_clock); return PTR_ERR(vc4_hdmi->hsm_clock);
} }
vc4_hdmi->audio_clock = vc4_hdmi->hsm_clock; vc4_hdmi->audio_clock = vc4_hdmi->hsm_clock;
vc4_hdmi->cec_clock = vc4_hdmi->hsm_clock; vc4_hdmi->cec_clock = vc4_hdmi->hsm_clock;
vc4_hdmi->hsm_rpm_clock = devm_clk_get(dev, "hdmi");
if (IS_ERR(vc4_hdmi->hsm_rpm_clock)) {
DRM_ERROR("Failed to get HDMI state machine clock\n");
return PTR_ERR(vc4_hdmi->hsm_rpm_clock);
}
return 0; return 0;
} }
...@@ -3245,6 +3264,12 @@ static int vc5_hdmi_init_resources(struct drm_device *drm, ...@@ -3245,6 +3264,12 @@ static int vc5_hdmi_init_resources(struct drm_device *drm,
return PTR_ERR(vc4_hdmi->hsm_clock); return PTR_ERR(vc4_hdmi->hsm_clock);
} }
vc4_hdmi->hsm_rpm_clock = devm_clk_get(dev, "hdmi");
if (IS_ERR(vc4_hdmi->hsm_rpm_clock)) {
DRM_ERROR("Failed to get HDMI state machine clock\n");
return PTR_ERR(vc4_hdmi->hsm_rpm_clock);
}
vc4_hdmi->pixel_bvb_clock = devm_clk_get(dev, "bvb"); vc4_hdmi->pixel_bvb_clock = devm_clk_get(dev, "bvb");
if (IS_ERR(vc4_hdmi->pixel_bvb_clock)) { if (IS_ERR(vc4_hdmi->pixel_bvb_clock)) {
DRM_ERROR("Failed to get pixel bvb clock\n"); DRM_ERROR("Failed to get pixel bvb clock\n");
...@@ -3308,7 +3333,7 @@ static int vc4_hdmi_runtime_suspend(struct device *dev) ...@@ -3308,7 +3333,7 @@ static int vc4_hdmi_runtime_suspend(struct device *dev)
{ {
struct vc4_hdmi *vc4_hdmi = dev_get_drvdata(dev); struct vc4_hdmi *vc4_hdmi = dev_get_drvdata(dev);
clk_disable_unprepare(vc4_hdmi->hsm_clock); clk_disable_unprepare(vc4_hdmi->hsm_rpm_clock);
return 0; return 0;
} }
...@@ -3326,11 +3351,11 @@ static int vc4_hdmi_runtime_resume(struct device *dev) ...@@ -3326,11 +3351,11 @@ static int vc4_hdmi_runtime_resume(struct device *dev)
* its frequency while the power domain is active so that it * its frequency while the power domain is active so that it
* keeps its rate. * keeps its rate.
*/ */
ret = clk_set_min_rate(vc4_hdmi->hsm_clock, HSM_MIN_CLOCK_FREQ); ret = clk_set_min_rate(vc4_hdmi->hsm_rpm_clock, HSM_MIN_CLOCK_FREQ);
if (ret) if (ret)
return ret; return ret;
ret = clk_prepare_enable(vc4_hdmi->hsm_clock); ret = clk_prepare_enable(vc4_hdmi->hsm_rpm_clock);
if (ret) if (ret)
return ret; return ret;
...@@ -3343,7 +3368,7 @@ static int vc4_hdmi_runtime_resume(struct device *dev) ...@@ -3343,7 +3368,7 @@ static int vc4_hdmi_runtime_resume(struct device *dev)
* case, it will lead to a silent CPU stall. Let's make sure we * case, it will lead to a silent CPU stall. Let's make sure we
* prevent such a case. * prevent such a case.
*/ */
rate = clk_get_rate(vc4_hdmi->hsm_clock); rate = clk_get_rate(vc4_hdmi->hsm_rpm_clock);
if (!rate) { if (!rate) {
ret = -EINVAL; ret = -EINVAL;
goto err_disable_clk; goto err_disable_clk;
......
...@@ -172,6 +172,7 @@ struct vc4_hdmi { ...@@ -172,6 +172,7 @@ struct vc4_hdmi {
struct clk *cec_clock; struct clk *cec_clock;
struct clk *pixel_clock; struct clk *pixel_clock;
struct clk *hsm_clock; struct clk *hsm_clock;
struct clk *hsm_rpm_clock;
struct clk *audio_clock; struct clk *audio_clock;
struct clk *pixel_bvb_clock; struct clk *pixel_bvb_clock;
......
...@@ -254,7 +254,7 @@ struct panfrost_dump_object_header { ...@@ -254,7 +254,7 @@ struct panfrost_dump_object_header {
__u64 nbos; __u64 nbos;
} reghdr; } reghdr;
struct pan_bomap_hdr { struct {
__u32 valid; __u32 valid;
__u64 iova; __u64 iova;
__u32 data[2]; __u32 data[2];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment