Skip to content

Commit 38e7300

Browse files
committed
Merge tag 'drm-misc-next-fixes-2024-07-11' of https://gitlab.freedesktop.org/drm/misc/kernel into drm-next
A fix for fbdev on big endian systems, a condition fix for a sharp panel at removal, and a fix for qxl to prevent unpinned buffer access under certain conditions. Signed-off-by: Dave Airlie <[email protected]> From: Maxime Ripard <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/20240711-benign-rich-mouflon-2eeafe@houat
2 parents 62a05f4 + c537fb4 commit 38e7300

File tree

5 files changed

+23
-13
lines changed

5 files changed

+23
-13
lines changed

drivers/gpu/drm/drm_fbdev_dma.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,8 @@ static int drm_fbdev_dma_helper_fb_probe(struct drm_fb_helper *fb_helper,
101101
sizes->surface_width, sizes->surface_height,
102102
sizes->surface_bpp);
103103

104-
format = drm_mode_legacy_fb_format(sizes->surface_bpp, sizes->surface_depth);
104+
format = drm_driver_legacy_fb_format(dev, sizes->surface_bpp,
105+
sizes->surface_depth);
105106
buffer = drm_client_framebuffer_create(client, sizes->surface_width,
106107
sizes->surface_height, format);
107108
if (IS_ERR(buffer))

drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ static void sharp_panel_remove(struct mipi_dsi_device *dsi)
362362
dev_err(&dsi->dev, "failed to detach from DSI host: %d\n", err);
363363

364364
/* only detach from host for the DSI-LINK2 interface */
365-
if (!sharp)
365+
if (sharp)
366366
sharp_panel_del(sharp);
367367
}
368368

drivers/gpu/drm/qxl/qxl_display.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -584,11 +584,11 @@ static struct qxl_bo *qxl_create_cursor(struct qxl_device *qdev,
584584
if (ret)
585585
goto err;
586586

587-
ret = qxl_bo_vmap(cursor_bo, &cursor_map);
587+
ret = qxl_bo_pin_and_vmap(cursor_bo, &cursor_map);
588588
if (ret)
589589
goto err_unref;
590590

591-
ret = qxl_bo_vmap(user_bo, &user_map);
591+
ret = qxl_bo_pin_and_vmap(user_bo, &user_map);
592592
if (ret)
593593
goto err_unmap;
594594

@@ -614,12 +614,12 @@ static struct qxl_bo *qxl_create_cursor(struct qxl_device *qdev,
614614
user_map.vaddr, size);
615615
}
616616

617-
qxl_bo_vunmap(user_bo);
618-
qxl_bo_vunmap(cursor_bo);
617+
qxl_bo_vunmap_and_unpin(user_bo);
618+
qxl_bo_vunmap_and_unpin(cursor_bo);
619619
return cursor_bo;
620620

621621
err_unmap:
622-
qxl_bo_vunmap(cursor_bo);
622+
qxl_bo_vunmap_and_unpin(cursor_bo);
623623
err_unref:
624624
qxl_bo_unpin(cursor_bo);
625625
qxl_bo_unref(&cursor_bo);
@@ -1205,7 +1205,7 @@ int qxl_create_monitors_object(struct qxl_device *qdev)
12051205
}
12061206
qdev->monitors_config_bo = gem_to_qxl_bo(gobj);
12071207

1208-
ret = qxl_bo_vmap(qdev->monitors_config_bo, &map);
1208+
ret = qxl_bo_pin_and_vmap(qdev->monitors_config_bo, &map);
12091209
if (ret)
12101210
return ret;
12111211

@@ -1236,7 +1236,7 @@ int qxl_destroy_monitors_object(struct qxl_device *qdev)
12361236
qdev->monitors_config = NULL;
12371237
qdev->ram_header->monitors_config = 0;
12381238

1239-
ret = qxl_bo_vunmap(qdev->monitors_config_bo);
1239+
ret = qxl_bo_vunmap_and_unpin(qdev->monitors_config_bo);
12401240
if (ret)
12411241
return ret;
12421242

drivers/gpu/drm/qxl/qxl_object.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,15 +182,23 @@ int qxl_bo_vmap_locked(struct qxl_bo *bo, struct iosys_map *map)
182182
return 0;
183183
}
184184

185-
int qxl_bo_vmap(struct qxl_bo *bo, struct iosys_map *map)
185+
int qxl_bo_pin_and_vmap(struct qxl_bo *bo, struct iosys_map *map)
186186
{
187187
int r;
188188

189189
r = qxl_bo_reserve(bo);
190190
if (r)
191191
return r;
192192

193+
r = qxl_bo_pin_locked(bo);
194+
if (r) {
195+
qxl_bo_unreserve(bo);
196+
return r;
197+
}
198+
193199
r = qxl_bo_vmap_locked(bo, map);
200+
if (r)
201+
qxl_bo_unpin_locked(bo);
194202
qxl_bo_unreserve(bo);
195203
return r;
196204
}
@@ -241,7 +249,7 @@ void qxl_bo_vunmap_locked(struct qxl_bo *bo)
241249
ttm_bo_vunmap(&bo->tbo, &bo->map);
242250
}
243251

244-
int qxl_bo_vunmap(struct qxl_bo *bo)
252+
int qxl_bo_vunmap_and_unpin(struct qxl_bo *bo)
245253
{
246254
int r;
247255

@@ -250,6 +258,7 @@ int qxl_bo_vunmap(struct qxl_bo *bo)
250258
return r;
251259

252260
qxl_bo_vunmap_locked(bo);
261+
qxl_bo_unpin_locked(bo);
253262
qxl_bo_unreserve(bo);
254263
return 0;
255264
}

drivers/gpu/drm/qxl/qxl_object.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ extern int qxl_bo_create(struct qxl_device *qdev,
5959
u32 priority,
6060
struct qxl_surface *surf,
6161
struct qxl_bo **bo_ptr);
62-
int qxl_bo_vmap(struct qxl_bo *bo, struct iosys_map *map);
62+
int qxl_bo_pin_and_vmap(struct qxl_bo *bo, struct iosys_map *map);
6363
int qxl_bo_vmap_locked(struct qxl_bo *bo, struct iosys_map *map);
64-
int qxl_bo_vunmap(struct qxl_bo *bo);
64+
int qxl_bo_vunmap_and_unpin(struct qxl_bo *bo);
6565
void qxl_bo_vunmap_locked(struct qxl_bo *bo);
6666
void *qxl_bo_kmap_atomic_page(struct qxl_device *qdev, struct qxl_bo *bo, int page_offset);
6767
void qxl_bo_kunmap_atomic_page(struct qxl_device *qdev, struct qxl_bo *bo, void *map);

0 commit comments

Comments
 (0)