Skip to content

Commit 15ebea1

Browse files
committed
Merge tag 'drm-misc-fixes-2025-11-13' of https://gitlab.freedesktop.org/drm/misc/kernel into drm-fixes
Short summary of fixes pull: client: - Fix description of module parameter panthor: - Flush writes before mapping buffers vmwgfx: - Improve command validation - Improve ref counting - Fix cursor-plane support Signed-off-by: Dave Airlie <airlied@redhat.com> From: Thomas Zimmermann <tzimmermann@suse.de> Link: https://patch.msgid.link/20251113132317.GA451885@linux.fritz.box
2 parents 63444b4 + 0a4a18e commit 15ebea1

6 files changed

Lines changed: 46 additions & 10 deletions

File tree

drivers/gpu/drm/clients/drm_client_setup.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
static char drm_client_default[16] = CONFIG_DRM_CLIENT_DEFAULT;
1414
module_param_string(active, drm_client_default, sizeof(drm_client_default), 0444);
1515
MODULE_PARM_DESC(active,
16-
"Choose which drm client to start, default is"
17-
CONFIG_DRM_CLIENT_DEFAULT "]");
16+
"Choose which drm client to start, default is "
17+
CONFIG_DRM_CLIENT_DEFAULT);
1818

1919
/**
2020
* drm_client_setup() - Setup in-kernel DRM clients

drivers/gpu/drm/panthor/panthor_gem.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,23 @@ panthor_gem_create_with_handle(struct drm_file *file,
288288

289289
panthor_gem_debugfs_set_usage_flags(bo, 0);
290290

291+
/* If this is a write-combine mapping, we query the sgt to force a CPU
292+
* cache flush (dma_map_sgtable() is called when the sgt is created).
293+
* This ensures the zero-ing is visible to any uncached mapping created
294+
* by vmap/mmap.
295+
* FIXME: Ideally this should be done when pages are allocated, not at
296+
* BO creation time.
297+
*/
298+
if (shmem->map_wc) {
299+
struct sg_table *sgt;
300+
301+
sgt = drm_gem_shmem_get_pages_sgt(shmem);
302+
if (IS_ERR(sgt)) {
303+
ret = PTR_ERR(sgt);
304+
goto out_put_gem;
305+
}
306+
}
307+
291308
/*
292309
* Allocate an id of idr table where the obj is registered
293310
* and handle has the id what user can see.
@@ -296,6 +313,7 @@ panthor_gem_create_with_handle(struct drm_file *file,
296313
if (!ret)
297314
*size = bo->base.base.size;
298315

316+
out_put_gem:
299317
/* drop reference from allocate - handle holds it now. */
300318
drm_gem_object_put(&shmem->base);
301319

drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,10 @@ vmw_cursor_update_type(struct vmw_private *vmw, struct vmw_plane_state *vps)
100100
if (vmw->has_mob) {
101101
if ((vmw->capabilities2 & SVGA_CAP2_CURSOR_MOB) != 0)
102102
return VMW_CURSOR_UPDATE_MOB;
103+
else
104+
return VMW_CURSOR_UPDATE_GB_ONLY;
103105
}
104-
106+
drm_warn_once(&vmw->drm, "Unknown Cursor Type!\n");
105107
return VMW_CURSOR_UPDATE_NONE;
106108
}
107109

@@ -139,6 +141,7 @@ static u32 vmw_cursor_mob_size(enum vmw_cursor_update_type update_type,
139141
{
140142
switch (update_type) {
141143
case VMW_CURSOR_UPDATE_LEGACY:
144+
case VMW_CURSOR_UPDATE_GB_ONLY:
142145
case VMW_CURSOR_UPDATE_NONE:
143146
return 0;
144147
case VMW_CURSOR_UPDATE_MOB:
@@ -623,6 +626,7 @@ int vmw_cursor_plane_prepare_fb(struct drm_plane *plane,
623626
if (!surface || vps->cursor.legacy.id == surface->snooper.id)
624627
vps->cursor.update_type = VMW_CURSOR_UPDATE_NONE;
625628
break;
629+
case VMW_CURSOR_UPDATE_GB_ONLY:
626630
case VMW_CURSOR_UPDATE_MOB: {
627631
bo = vmw_user_object_buffer(&vps->uo);
628632
if (bo) {
@@ -737,6 +741,7 @@ void
737741
vmw_cursor_plane_atomic_update(struct drm_plane *plane,
738742
struct drm_atomic_state *state)
739743
{
744+
struct vmw_bo *bo;
740745
struct drm_plane_state *new_state =
741746
drm_atomic_get_new_plane_state(state, plane);
742747
struct drm_plane_state *old_state =
@@ -762,6 +767,15 @@ vmw_cursor_plane_atomic_update(struct drm_plane *plane,
762767
case VMW_CURSOR_UPDATE_MOB:
763768
vmw_cursor_update_mob(dev_priv, vps);
764769
break;
770+
case VMW_CURSOR_UPDATE_GB_ONLY:
771+
bo = vmw_user_object_buffer(&vps->uo);
772+
if (bo)
773+
vmw_send_define_cursor_cmd(dev_priv, bo->map.virtual,
774+
vps->base.crtc_w,
775+
vps->base.crtc_h,
776+
vps->base.hotspot_x,
777+
vps->base.hotspot_y);
778+
break;
765779
case VMW_CURSOR_UPDATE_NONE:
766780
/* do nothing */
767781
break;

drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ static const u32 __maybe_unused vmw_cursor_plane_formats[] = {
3333
enum vmw_cursor_update_type {
3434
VMW_CURSOR_UPDATE_NONE = 0,
3535
VMW_CURSOR_UPDATE_LEGACY,
36+
VMW_CURSOR_UPDATE_GB_ONLY,
3637
VMW_CURSOR_UPDATE_MOB,
3738
};
3839

drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3668,6 +3668,11 @@ static int vmw_cmd_check(struct vmw_private *dev_priv,
36683668

36693669

36703670
cmd_id = header->id;
3671+
if (header->size > SVGA_CMD_MAX_DATASIZE) {
3672+
VMW_DEBUG_USER("SVGA3D command: %d is too big.\n",
3673+
cmd_id + SVGA_3D_CMD_BASE);
3674+
return -E2BIG;
3675+
}
36713676
*size = header->size + sizeof(SVGA3dCmdHeader);
36723677

36733678
cmd_id -= SVGA_3D_CMD_BASE;

drivers/gpu/drm/vmwgfx/vmwgfx_page_dirty.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,22 +32,22 @@ enum vmw_bo_dirty_method {
3232

3333
/**
3434
* struct vmw_bo_dirty - Dirty information for buffer objects
35+
* @ref_count: Reference count for this structure. Must be first member!
3536
* @start: First currently dirty bit
3637
* @end: Last currently dirty bit + 1
3738
* @method: The currently used dirty method
3839
* @change_count: Number of consecutive method change triggers
39-
* @ref_count: Reference count for this structure
4040
* @bitmap_size: The size of the bitmap in bits. Typically equal to the
4141
* nuber of pages in the bo.
4242
* @bitmap: A bitmap where each bit represents a page. A set bit means a
4343
* dirty page.
4444
*/
4545
struct vmw_bo_dirty {
46+
struct kref ref_count;
4647
unsigned long start;
4748
unsigned long end;
4849
enum vmw_bo_dirty_method method;
4950
unsigned int change_count;
50-
unsigned int ref_count;
5151
unsigned long bitmap_size;
5252
unsigned long bitmap[];
5353
};
@@ -221,7 +221,7 @@ int vmw_bo_dirty_add(struct vmw_bo *vbo)
221221
int ret;
222222

223223
if (dirty) {
224-
dirty->ref_count++;
224+
kref_get(&dirty->ref_count);
225225
return 0;
226226
}
227227

@@ -235,7 +235,7 @@ int vmw_bo_dirty_add(struct vmw_bo *vbo)
235235
dirty->bitmap_size = num_pages;
236236
dirty->start = dirty->bitmap_size;
237237
dirty->end = 0;
238-
dirty->ref_count = 1;
238+
kref_init(&dirty->ref_count);
239239
if (num_pages < PAGE_SIZE / sizeof(pte_t)) {
240240
dirty->method = VMW_BO_DIRTY_PAGETABLE;
241241
} else {
@@ -274,10 +274,8 @@ void vmw_bo_dirty_release(struct vmw_bo *vbo)
274274
{
275275
struct vmw_bo_dirty *dirty = vbo->dirty;
276276

277-
if (dirty && --dirty->ref_count == 0) {
278-
kvfree(dirty);
277+
if (dirty && kref_put(&dirty->ref_count, (void *)kvfree))
279278
vbo->dirty = NULL;
280-
}
281279
}
282280

283281
/**

0 commit comments

Comments
 (0)