Skip to content

Commit d703575

Browse files
committed
Merge tag 'drm-misc-fixes-2025-03-13' of https://gitlab.freedesktop.org/drm/misc/kernel into drm-fixes
A null pointer check for gma500, two clippy fixes for panic, a fix for an interaction between DPMS and atomic leading to dropped frames, and a locking fix for dp_mst Signed-off-by: Dave Airlie <airlied@redhat.com> From: Maxime Ripard <mripard@redhat.com> Link: https://patchwork.freedesktop.org/patch/msgid/20250313-holistic-clay-moose-fead28@houat
2 parents 385b643 + 12d8f31 commit d703575

File tree

5 files changed

+45
-24
lines changed

5 files changed

+45
-24
lines changed

drivers/gpu/drm/display/drm_dp_mst_topology.c

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4025,6 +4025,22 @@ static int drm_dp_mst_handle_down_rep(struct drm_dp_mst_topology_mgr *mgr)
40254025
return 0;
40264026
}
40274027

4028+
static bool primary_mstb_probing_is_done(struct drm_dp_mst_topology_mgr *mgr)
4029+
{
4030+
bool probing_done = false;
4031+
4032+
mutex_lock(&mgr->lock);
4033+
4034+
if (mgr->mst_primary && drm_dp_mst_topology_try_get_mstb(mgr->mst_primary)) {
4035+
probing_done = mgr->mst_primary->link_address_sent;
4036+
drm_dp_mst_topology_put_mstb(mgr->mst_primary);
4037+
}
4038+
4039+
mutex_unlock(&mgr->lock);
4040+
4041+
return probing_done;
4042+
}
4043+
40284044
static inline bool
40294045
drm_dp_mst_process_up_req(struct drm_dp_mst_topology_mgr *mgr,
40304046
struct drm_dp_pending_up_req *up_req)
@@ -4055,8 +4071,12 @@ drm_dp_mst_process_up_req(struct drm_dp_mst_topology_mgr *mgr,
40554071

40564072
/* TODO: Add missing handler for DP_RESOURCE_STATUS_NOTIFY events */
40574073
if (msg->req_type == DP_CONNECTION_STATUS_NOTIFY) {
4058-
dowork = drm_dp_mst_handle_conn_stat(mstb, &msg->u.conn_stat);
4059-
hotplug = true;
4074+
if (!primary_mstb_probing_is_done(mgr)) {
4075+
drm_dbg_kms(mgr->dev, "Got CSN before finish topology probing. Skip it.\n");
4076+
} else {
4077+
dowork = drm_dp_mst_handle_conn_stat(mstb, &msg->u.conn_stat);
4078+
hotplug = true;
4079+
}
40604080
}
40614081

40624082
drm_dp_mst_topology_put_mstb(mstb);
@@ -4138,10 +4158,11 @@ static int drm_dp_mst_handle_up_req(struct drm_dp_mst_topology_mgr *mgr)
41384158
drm_dp_send_up_ack_reply(mgr, mst_primary, up_req->msg.req_type,
41394159
false);
41404160

4161+
drm_dp_mst_topology_put_mstb(mst_primary);
4162+
41414163
if (up_req->msg.req_type == DP_CONNECTION_STATUS_NOTIFY) {
41424164
const struct drm_dp_connection_status_notify *conn_stat =
41434165
&up_req->msg.u.conn_stat;
4144-
bool handle_csn;
41454166

41464167
drm_dbg_kms(mgr->dev, "Got CSN: pn: %d ldps:%d ddps: %d mcs: %d ip: %d pdt: %d\n",
41474168
conn_stat->port_number,
@@ -4150,16 +4171,6 @@ static int drm_dp_mst_handle_up_req(struct drm_dp_mst_topology_mgr *mgr)
41504171
conn_stat->message_capability_status,
41514172
conn_stat->input_port,
41524173
conn_stat->peer_device_type);
4153-
4154-
mutex_lock(&mgr->probe_lock);
4155-
handle_csn = mst_primary->link_address_sent;
4156-
mutex_unlock(&mgr->probe_lock);
4157-
4158-
if (!handle_csn) {
4159-
drm_dbg_kms(mgr->dev, "Got CSN before finish topology probing. Skip it.");
4160-
kfree(up_req);
4161-
goto out_put_primary;
4162-
}
41634174
} else if (up_req->msg.req_type == DP_RESOURCE_STATUS_NOTIFY) {
41644175
const struct drm_dp_resource_status_notify *res_stat =
41654176
&up_req->msg.u.resource_stat;
@@ -4174,9 +4185,6 @@ static int drm_dp_mst_handle_up_req(struct drm_dp_mst_topology_mgr *mgr)
41744185
list_add_tail(&up_req->next, &mgr->up_req_list);
41754186
mutex_unlock(&mgr->up_req_lock);
41764187
queue_work(system_long_wq, &mgr->up_req_work);
4177-
4178-
out_put_primary:
4179-
drm_dp_mst_topology_put_mstb(mst_primary);
41804188
out_clear_reply:
41814189
reset_msg_rx_state(&mgr->up_req_recv);
41824190
return ret;

drivers/gpu/drm/drm_atomic_uapi.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -956,6 +956,10 @@ int drm_atomic_connector_commit_dpms(struct drm_atomic_state *state,
956956

957957
if (mode != DRM_MODE_DPMS_ON)
958958
mode = DRM_MODE_DPMS_OFF;
959+
960+
if (connector->dpms == mode)
961+
goto out;
962+
959963
connector->dpms = mode;
960964

961965
crtc = connector->state->crtc;

drivers/gpu/drm/drm_connector.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1427,6 +1427,10 @@ EXPORT_SYMBOL(drm_hdmi_connector_get_output_format_name);
14271427
* callback. For atomic drivers the remapping to the "ACTIVE" property is
14281428
* implemented in the DRM core.
14291429
*
1430+
* On atomic drivers any DPMS setproperty ioctl where the value does not
1431+
* change is completely skipped, otherwise a full atomic commit will occur.
1432+
* On legacy drivers the exact behavior is driver specific.
1433+
*
14301434
* Note that this property cannot be set through the MODE_ATOMIC ioctl,
14311435
* userspace must use "ACTIVE" on the CRTC instead.
14321436
*

drivers/gpu/drm/drm_panic_qr.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,7 @@ impl EncodedMsg<'_> {
545545
}
546546
self.push(&mut offset, (MODE_STOP, 4));
547547

548-
let pad_offset = (offset + 7) / 8;
548+
let pad_offset = offset.div_ceil(8);
549549
for i in pad_offset..self.version.max_data() {
550550
self.data[i] = PADDING[(i & 1) ^ (pad_offset & 1)];
551551
}
@@ -659,7 +659,7 @@ struct QrImage<'a> {
659659
impl QrImage<'_> {
660660
fn new<'a, 'b>(em: &'b EncodedMsg<'b>, qrdata: &'a mut [u8]) -> QrImage<'a> {
661661
let width = em.version.width();
662-
let stride = (width + 7) / 8;
662+
let stride = width.div_ceil(8);
663663
let data = qrdata;
664664

665665
let mut qr_image = QrImage {
@@ -911,16 +911,16 @@ impl QrImage<'_> {
911911
///
912912
/// * `url`: The base URL of the QR code. It will be encoded as Binary segment.
913913
/// * `data`: A pointer to the binary data, to be encoded. if URL is NULL, it
914-
/// will be encoded as binary segment, otherwise it will be encoded
915-
/// efficiently as a numeric segment, and appended to the URL.
914+
/// will be encoded as binary segment, otherwise it will be encoded
915+
/// efficiently as a numeric segment, and appended to the URL.
916916
/// * `data_len`: Length of the data, that needs to be encoded, must be less
917-
/// than data_size.
917+
/// than data_size.
918918
/// * `data_size`: Size of data buffer, it should be at least 4071 bytes to hold
919-
/// a V40 QR code. It will then be overwritten with the QR code image.
919+
/// a V40 QR code. It will then be overwritten with the QR code image.
920920
/// * `tmp`: A temporary buffer that the QR code encoder will use, to write the
921-
/// segments and ECC.
921+
/// segments and ECC.
922922
/// * `tmp_size`: Size of the temporary buffer, it must be at least 3706 bytes
923-
/// long for V40.
923+
/// long for V40.
924924
///
925925
/// # Safety
926926
///

drivers/gpu/drm/gma500/mid_bios.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,11 @@ static void mid_get_vbt_data(struct drm_psb_private *dev_priv)
279279
0, PCI_DEVFN(2, 0));
280280
int ret = -1;
281281

282+
if (pci_gfx_root == NULL) {
283+
WARN_ON(1);
284+
return;
285+
}
286+
282287
/* Get the address of the platform config vbt */
283288
pci_read_config_dword(pci_gfx_root, 0xFC, &addr);
284289
pci_dev_put(pci_gfx_root);

0 commit comments

Comments
 (0)