Skip to content

Commit 951a6bf

Browse files
committed
Merge tag 'drm-misc-next-fixes-2025-01-16' of https://gitlab.freedesktop.org/drm/misc/kernel into drm-next
Several fixes for the new dmem cgroup controller and the HDMI framework audio support Signed-off-by: Dave Airlie <[email protected]> From: Maxime Ripard <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/20250116-bold-furry-perch-b1ca0e@houat
2 parents 24c61d5 + f1359f4 commit 951a6bf

File tree

8 files changed

+65
-9
lines changed

8 files changed

+65
-9
lines changed

Documentation/core-api/cgroup.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Cgroup Kernel APIs
33
==================
44

55
Device Memory Cgroup API (dmemcg)
6-
=========================
6+
=================================
77
.. kernel-doc:: kernel/cgroup/dmem.c
88
:export:
99

Documentation/gpu/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ GPU Driver Developer's Guide
1313
drm-usage-stats
1414
driver-uapi
1515
drm-client
16+
drm-compute
1617
drivers
1718
backlight
1819
vga-switcheroo

drivers/gpu/drm/display/drm_hdmi_state_helper.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,9 @@ int drm_atomic_helper_connector_hdmi_check(struct drm_connector *connector,
503503
connector_state_get_mode(new_conn_state);
504504
int ret;
505505

506+
if (!new_conn_state->crtc || !new_conn_state->best_encoder)
507+
return 0;
508+
506509
new_conn_state->hdmi.is_limited_range = hdmi_is_limited_range(connector, new_conn_state);
507510

508511
ret = hdmi_compute_config(connector, new_conn_state, mode);
@@ -788,6 +791,8 @@ drm_atomic_helper_connector_hdmi_update(struct drm_connector *connector,
788791
if (status == connector_status_disconnected) {
789792
// TODO: also handle CEC and scramber, HDMI sink disconnected.
790793
drm_connector_hdmi_audio_plugged_notify(connector, false);
794+
drm_edid_connector_update(connector, NULL);
795+
return;
791796
}
792797

793798
if (connector->hdmi.funcs->read_edid)

drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1568,6 +1568,57 @@ static void drm_test_check_output_bpc_format_display_8bpc_only(struct kunit *tes
15681568
KUNIT_EXPECT_EQ(test, conn_state->hdmi.output_format, HDMI_COLORSPACE_RGB);
15691569
}
15701570

1571+
/* Test that atomic check succeeds when disabling a connector. */
1572+
static void drm_test_check_disable_connector(struct kunit *test)
1573+
{
1574+
struct drm_atomic_helper_connector_hdmi_priv *priv;
1575+
struct drm_modeset_acquire_ctx *ctx;
1576+
struct drm_connector_state *conn_state;
1577+
struct drm_crtc_state *crtc_state;
1578+
struct drm_atomic_state *state;
1579+
struct drm_display_mode *preferred;
1580+
struct drm_connector *conn;
1581+
struct drm_device *drm;
1582+
struct drm_crtc *crtc;
1583+
int ret;
1584+
1585+
priv = drm_kunit_helper_connector_hdmi_init(test,
1586+
BIT(HDMI_COLORSPACE_RGB),
1587+
8);
1588+
KUNIT_ASSERT_NOT_NULL(test, priv);
1589+
1590+
ctx = drm_kunit_helper_acquire_ctx_alloc(test);
1591+
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx);
1592+
1593+
conn = &priv->connector;
1594+
preferred = find_preferred_mode(conn);
1595+
KUNIT_ASSERT_NOT_NULL(test, preferred);
1596+
1597+
drm = &priv->drm;
1598+
crtc = priv->crtc;
1599+
ret = light_up_connector(test, drm, crtc, conn, preferred, ctx);
1600+
KUNIT_ASSERT_EQ(test, ret, 0);
1601+
1602+
state = drm_kunit_helper_atomic_state_alloc(test, drm, ctx);
1603+
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, state);
1604+
1605+
crtc_state = drm_atomic_get_crtc_state(state, crtc);
1606+
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, crtc_state);
1607+
1608+
crtc_state->active = false;
1609+
ret = drm_atomic_set_mode_for_crtc(crtc_state, NULL);
1610+
KUNIT_EXPECT_EQ(test, ret, 0);
1611+
1612+
conn_state = drm_atomic_get_connector_state(state, conn);
1613+
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, conn_state);
1614+
1615+
ret = drm_atomic_set_crtc_for_connector(conn_state, NULL);
1616+
KUNIT_EXPECT_EQ(test, ret, 0);
1617+
1618+
ret = drm_atomic_check_only(state);
1619+
KUNIT_ASSERT_EQ(test, ret, 0);
1620+
}
1621+
15711622
static struct kunit_case drm_atomic_helper_connector_hdmi_check_tests[] = {
15721623
KUNIT_CASE(drm_test_check_broadcast_rgb_auto_cea_mode),
15731624
KUNIT_CASE(drm_test_check_broadcast_rgb_auto_cea_mode_vic_1),
@@ -1582,6 +1633,7 @@ static struct kunit_case drm_atomic_helper_connector_hdmi_check_tests[] = {
15821633
*/
15831634
KUNIT_CASE(drm_test_check_broadcast_rgb_crtc_mode_changed),
15841635
KUNIT_CASE(drm_test_check_broadcast_rgb_crtc_mode_not_changed),
1636+
KUNIT_CASE(drm_test_check_disable_connector),
15851637
KUNIT_CASE(drm_test_check_hdmi_funcs_reject_rate),
15861638
KUNIT_CASE(drm_test_check_max_tmds_rate_bpc_fallback),
15871639
KUNIT_CASE(drm_test_check_max_tmds_rate_format_fallback),

include/drm/display/drm_hdmi_state_helper.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
struct drm_atomic_state;
77
struct drm_connector;
88
struct drm_connector_state;
9+
struct drm_display_mode;
910
struct hdmi_audio_infoframe;
1011

1112
enum drm_connector_status;

include/drm/drm_bridge.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -691,7 +691,7 @@ struct drm_bridge_funcs {
691691
struct drm_bridge *bridge);
692692

693693
/**
694-
* @prepare:
694+
* @hdmi_audio_prepare:
695695
* Configures HDMI-encoder for audio stream. Can be called multiple
696696
* times for each setup. Mandatory if HDMI audio is enabled in the
697697
* bridge's configuration.

init/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1139,6 +1139,7 @@ config CGROUP_RDMA
11391139

11401140
config CGROUP_DMEM
11411141
bool "Device memory controller (DMEM)"
1142+
select PAGE_COUNTER
11421143
help
11431144
The DMEM controller allows compatible devices to restrict device
11441145
memory usage based on the cgroup hierarchy.

kernel/cgroup/dmem.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -280,8 +280,6 @@ dmem_cgroup_calculate_protection(struct dmem_cgroup_pool_state *limit_pool,
280280

281281
/**
282282
* dmem_cgroup_state_evict_valuable() - Check if we should evict from test_pool
283-
* @dev: &dmem_cgroup_region
284-
* @index: The index number of the region being tested.
285283
* @limit_pool: The pool for which we hit limits
286284
* @test_pool: The pool for which to test
287285
* @ignore_low: Whether we have to respect low watermarks.
@@ -299,7 +297,7 @@ bool dmem_cgroup_state_evict_valuable(struct dmem_cgroup_pool_state *limit_pool,
299297
bool ignore_low, bool *ret_hit_low)
300298
{
301299
struct dmem_cgroup_pool_state *pool = test_pool;
302-
struct page_counter *climit, *ctest;
300+
struct page_counter *ctest;
303301
u64 used, min, low;
304302

305303
/* Can always evict from current pool, despite limits */
@@ -324,7 +322,6 @@ bool dmem_cgroup_state_evict_valuable(struct dmem_cgroup_pool_state *limit_pool,
324322
{}
325323
}
326324

327-
climit = &limit_pool->cnt;
328325
ctest = &test_pool->cnt;
329326

330327
dmem_cgroup_calculate_protection(limit_pool, test_pool);
@@ -611,13 +608,12 @@ EXPORT_SYMBOL_GPL(dmem_cgroup_uncharge);
611608

612609
/**
613610
* dmem_cgroup_try_charge() - Try charging a new allocation to a region.
614-
* @dev: Device to charge
611+
* @region: dmem region to charge
615612
* @size: Size (in bytes) to charge.
616613
* @ret_pool: On succesfull allocation, the pool that is charged.
617614
* @ret_limit_pool: On a failed allocation, the limiting pool.
618615
*
619-
* This function charges the current pool for @dev with region at @index for a
620-
* size of @size bytes.
616+
* This function charges the @region region for a size of @size bytes.
621617
*
622618
* If the function succeeds, @ret_pool is set, which must be passed to
623619
* dmem_cgroup_uncharge() when undoing the allocation.

0 commit comments

Comments
 (0)