drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.c- Extension
.c- Size
- 23263 bytes
- Lines
- 859
- Domain
- Driver Families
- Bucket
- drivers/gpu
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
vmwgfx_cursor_plane.hvmwgfx_bo.hvmwgfx_drv.hvmwgfx_kms.hvmwgfx_resource_priv.hvmw_surface_cache.hdrm/drm_atomic.hdrm/drm_atomic_helper.hdrm/drm_plane.hasm/page.h
Detected Declarations
struct vmw_svga_fifo_cmd_define_cursorstruct vmw_dma_cmdfunction vmw_send_define_cursor_cmdfunction vmw_cursor_plane_update_legacyfunction vmw_cursor_update_typefunction vmw_cursor_update_mobfunction vmw_cursor_mob_sizefunction vmw_cursor_mob_destroyfunction vmw_cursor_mob_unmapfunction vmw_cursor_mob_putfunction vmw_cursor_mob_getfunction vmw_cursor_update_positionfunction vmw_kms_cursor_snoopfunction vmw_cursor_plane_destroyfunction vmw_cursor_mob_mapfunction vmw_cursor_plane_cleanup_fbfunction vmw_cursor_buffer_changedfunction vmw_cursor_plane_changedfunction vmw_cursor_plane_prepare_fbfunction vmw_cursor_plane_atomic_checkfunction vmw_cursor_plane_atomic_updatefunction vmw_kms_cursor_bypass_ioctlfunction list_for_each_entry
Annotated Snippet
struct vmw_svga_fifo_cmd_define_cursor {
u32 cmd;
SVGAFifoCmdDefineAlphaCursor cursor;
};
/**
* vmw_send_define_cursor_cmd - queue a define cursor command
* @dev_priv: the private driver struct
* @image: buffer which holds the cursor image
* @width: width of the mouse cursor image
* @height: height of the mouse cursor image
* @hotspotX: the horizontal position of mouse hotspot
* @hotspotY: the vertical position of mouse hotspot
*/
static void vmw_send_define_cursor_cmd(struct vmw_private *dev_priv,
u32 *image, u32 width, u32 height,
u32 hotspotX, u32 hotspotY)
{
struct vmw_svga_fifo_cmd_define_cursor *cmd;
const u32 image_size = width * height * sizeof(*image);
const u32 cmd_size = sizeof(*cmd) + image_size;
/*
* Try to reserve fifocmd space and swallow any failures;
* such reservations cannot be left unconsumed for long
* under the risk of clogging other fifocmd users, so
* we treat reservations separtely from the way we treat
* other fallible KMS-atomic resources at prepare_fb
*/
cmd = VMW_CMD_RESERVE(dev_priv, cmd_size);
if (unlikely(!cmd))
return;
memset(cmd, 0, sizeof(*cmd));
memcpy(&cmd[1], image, image_size);
cmd->cmd = SVGA_CMD_DEFINE_ALPHA_CURSOR;
cmd->cursor.id = 0;
cmd->cursor.width = width;
cmd->cursor.height = height;
cmd->cursor.hotspotX = hotspotX;
cmd->cursor.hotspotY = hotspotY;
vmw_cmd_commit_flush(dev_priv, cmd_size);
}
static void
vmw_cursor_plane_update_legacy(struct vmw_private *vmw,
struct vmw_plane_state *vps)
{
struct vmw_surface *surface = vmw_user_object_surface(&vps->uo);
s32 hotspot_x = vps->cursor.legacy.hotspot_x + vps->base.hotspot_x;
s32 hotspot_y = vps->cursor.legacy.hotspot_y + vps->base.hotspot_y;
if (WARN_ON(!surface || !surface->snooper.image))
return;
if (vps->cursor.legacy.id != surface->snooper.id) {
vmw_send_define_cursor_cmd(vmw, surface->snooper.image,
vps->base.crtc_w, vps->base.crtc_h,
hotspot_x, hotspot_y);
vps->cursor.legacy.id = surface->snooper.id;
}
}
static enum vmw_cursor_update_type
vmw_cursor_update_type(struct vmw_private *vmw, struct vmw_plane_state *vps)
{
struct vmw_surface *surface = vmw_user_object_surface(&vps->uo);
if (surface && surface->snooper.image)
return VMW_CURSOR_UPDATE_LEGACY;
if (vmw->has_mob) {
if ((vmw->capabilities2 & SVGA_CAP2_CURSOR_MOB) != 0)
return VMW_CURSOR_UPDATE_MOB;
else
return VMW_CURSOR_UPDATE_GB_ONLY;
}
drm_warn_once(&vmw->drm, "Unknown Cursor Type!\n");
return VMW_CURSOR_UPDATE_NONE;
}
static void vmw_cursor_update_mob(struct vmw_private *vmw,
struct vmw_plane_state *vps)
{
SVGAGBCursorHeader *header;
SVGAGBAlphaCursorHeader *alpha_header;
Annotation
- Immediate include surface: `vmwgfx_cursor_plane.h`, `vmwgfx_bo.h`, `vmwgfx_drv.h`, `vmwgfx_kms.h`, `vmwgfx_resource_priv.h`, `vmw_surface_cache.h`, `drm/drm_atomic.h`, `drm/drm_atomic_helper.h`.
- Detected declarations: `struct vmw_svga_fifo_cmd_define_cursor`, `struct vmw_dma_cmd`, `function vmw_send_define_cursor_cmd`, `function vmw_cursor_plane_update_legacy`, `function vmw_cursor_update_type`, `function vmw_cursor_update_mob`, `function vmw_cursor_mob_size`, `function vmw_cursor_mob_destroy`, `function vmw_cursor_mob_unmap`, `function vmw_cursor_mob_put`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.