drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c- Extension
.c- Size
- 38953 bytes
- Lines
- 1367
- 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_bo.hvmwgfx_kms.hvmwgfx_vkms.hdrm/drm_atomic.hdrm/drm_atomic_helper.hdrm/drm_damage_helper.hdrm/drm_fourcc.hdrm/drm_vblank.h
Detected Declarations
struct vmw_kms_sou_surface_dirtystruct vmw_kms_sou_readback_blitstruct vmw_kms_sou_bo_blitstruct vmw_kms_sou_dirty_cmdstruct vmw_kms_sou_define_gmrfbstruct vmw_screen_object_unitfunction vmw_sou_destroyfunction vmw_sou_crtc_destroyfunction vmw_sou_fifo_createfunction vmw_sou_fifo_destroyfunction vmw_sou_crtc_mode_set_nofbfunction vmw_sou_crtc_helper_preparefunction vmw_sou_encoder_destroyfunction vmw_sou_connector_destroyfunction vmw_sou_primary_plane_cleanup_fbfunction vmw_sou_primary_plane_prepare_fbfunction vmw_sou_bo_fifo_sizefunction vmw_sou_bo_define_gmrfbfunction vmw_sou_bo_populate_clipfunction vmw_stud_bo_post_clipfunction vmw_sou_plane_update_bofunction vmw_sou_surface_fifo_sizefunction vmw_sou_surface_post_preparefunction vmw_sou_surface_pre_clipfunction vmw_sou_surface_clip_rectfunction vmw_sou_surface_post_clipfunction vmw_sou_plane_update_surfacefunction vmw_sou_primary_plane_atomic_updatefunction vmw_sou_initfunction vmw_kms_sou_init_displayfunction do_bo_define_gmrfbfunction vmw_sou_surface_fifo_commitfunction vmw_sou_surface_clipfunction vmw_kms_sou_do_surface_dirtyfunction vmw_sou_bo_fifo_commitfunction vmw_sou_bo_clipfunction vmw_kms_sou_do_bo_dirtyfunction vmw_sou_readback_fifo_commitfunction vmw_sou_readback_clipfunction vmw_kms_sou_readback
Annotated Snippet
struct vmw_kms_sou_surface_dirty {
struct vmw_kms_dirty base;
s32 left, right, top, bottom;
s32 dst_x, dst_y;
u32 sid;
};
/*
* SVGA commands that are used by this code. Please see the device headers
* for explanation.
*/
struct vmw_kms_sou_readback_blit {
uint32 header;
SVGAFifoCmdBlitScreenToGMRFB body;
};
struct vmw_kms_sou_bo_blit {
uint32 header;
SVGAFifoCmdBlitGMRFBToScreen body;
};
struct vmw_kms_sou_dirty_cmd {
SVGA3dCmdHeader header;
SVGA3dCmdBlitSurfaceToScreen body;
};
struct vmw_kms_sou_define_gmrfb {
uint32_t header;
SVGAFifoCmdDefineGMRFB body;
};
/*
* Display unit using screen objects.
*/
struct vmw_screen_object_unit {
struct vmw_display_unit base;
struct vmw_bo *buffer; /**< Backing store buffer */
bool defined;
};
static void vmw_sou_destroy(struct vmw_screen_object_unit *sou)
{
vmw_du_cleanup(&sou->base);
kfree(sou);
}
/*
* Screen Object Display Unit CRTC functions
*/
static void vmw_sou_crtc_destroy(struct drm_crtc *crtc)
{
vmw_sou_destroy(vmw_crtc_to_sou(crtc));
}
/*
* Send the fifo command to create a screen.
*/
static int vmw_sou_fifo_create(struct vmw_private *dev_priv,
struct vmw_screen_object_unit *sou,
int x, int y,
struct drm_display_mode *mode)
{
size_t fifo_size;
struct {
struct {
uint32_t cmdType;
} header;
SVGAScreenObject obj;
} *cmd;
BUG_ON(!sou->buffer);
fifo_size = sizeof(*cmd);
cmd = VMW_CMD_RESERVE(dev_priv, fifo_size);
if (unlikely(cmd == NULL))
return -ENOMEM;
memset(cmd, 0, fifo_size);
cmd->header.cmdType = SVGA_CMD_DEFINE_SCREEN;
cmd->obj.structSize = sizeof(SVGAScreenObject);
cmd->obj.id = sou->base.unit;
cmd->obj.flags = SVGA_SCREEN_HAS_ROOT |
(sou->base.unit == 0 ? SVGA_SCREEN_IS_PRIMARY : 0);
cmd->obj.size.width = mode->hdisplay;
cmd->obj.size.height = mode->vdisplay;
Annotation
- Immediate include surface: `vmwgfx_bo.h`, `vmwgfx_kms.h`, `vmwgfx_vkms.h`, `drm/drm_atomic.h`, `drm/drm_atomic_helper.h`, `drm/drm_damage_helper.h`, `drm/drm_fourcc.h`, `drm/drm_vblank.h`.
- Detected declarations: `struct vmw_kms_sou_surface_dirty`, `struct vmw_kms_sou_readback_blit`, `struct vmw_kms_sou_bo_blit`, `struct vmw_kms_sou_dirty_cmd`, `struct vmw_kms_sou_define_gmrfb`, `struct vmw_screen_object_unit`, `function vmw_sou_destroy`, `function vmw_sou_crtc_destroy`, `function vmw_sou_fifo_create`, `function vmw_sou_fifo_destroy`.
- 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.