drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c- Extension
.c- Size
- 53848 bytes
- Lines
- 2029
- 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.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- 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_kms.hvmwgfx_bo.hvmwgfx_resource_priv.hvmwgfx_vkms.hvmw_surface_cache.hdrm/drm_atomic.hdrm/drm_atomic_helper.hdrm/drm_damage_helper.hdrm/drm_fourcc.hdrm/drm_rect.hdrm/drm_sysfs.hdrm/drm_edid.h
Detected Declarations
function Copyrightfunction vmw_du_cleanupfunction vmw_du_primary_plane_destroyfunction vmw_du_plane_unpin_surffunction vmw_du_plane_cleanup_fbfunction vmw_du_primary_plane_atomic_checkfunction vmw_du_crtc_atomic_checkfunction vmw_du_crtc_atomic_beginfunction statefunction vmw_du_crtc_resetfunction statefunction statefunction vmw_du_plane_resetfunction statefunction statefunction vmw_du_connector_resetfunction statefunction vmw_framebuffer_surface_destroyfunction vmw_kms_readbackfunction vmw_framebuffer_surface_create_handlefunction vmw_kms_new_framebuffer_surfacefunction vmw_framebuffer_bo_create_handlefunction vmw_framebuffer_bo_destroyfunction vmw_kms_new_framebuffer_bofunction vmw_kms_srf_okfunction vmw_kms_new_framebufferfunction vmw_kms_check_display_memoryfunction screenfunction vmw_crtc_state_and_lockfunction vmw_kms_check_implicitfunction drm_for_each_crtcfunction vmw_kms_check_topologyfunction drm_for_each_crtcfunction drm_atomic_helper_check_modesetfunction for_each_new_crtc_in_statefunction vmw_kms_generic_presentfunction vmw_kms_presentfunction vmw_kms_create_hotplug_mode_update_propertyfunction vmw_atomic_commit_tailfunction vmw_kms_initfunction vmw_kms_closefunction vmw_kms_write_svgafunction vmw_kms_validate_mode_vramfunction vmw_du_update_layoutfunction list_for_each_entryfunction vmw_du_crtc_gamma_setfunction vmw_du_connector_dpmsfunction vmw_du_connector_detect
Annotated Snippet
if (vps->pinned) {
vmw_resource_unpin(&surf->res);
vps->pinned--;
}
}
}
/**
* vmw_du_plane_cleanup_fb - Unpins the plane surface
*
* @plane: display plane
* @old_state: Contains the FB to clean up
*
* Unpins the framebuffer surface
*
* Returns 0 on success
*/
void
vmw_du_plane_cleanup_fb(struct drm_plane *plane,
struct drm_plane_state *old_state)
{
struct vmw_plane_state *vps = vmw_plane_state_to_vps(old_state);
vmw_du_plane_unpin_surf(vps);
}
/**
* vmw_du_primary_plane_atomic_check - check if the new state is okay
*
* @plane: display plane
* @state: info on the new plane state, including the FB
*
* Check if the new state is settable given the current state. Other
* than what the atomic helper checks, we care about crtc fitting
* the FB and maintaining one active framebuffer.
*
* Returns 0 on success
*/
int vmw_du_primary_plane_atomic_check(struct drm_plane *plane,
struct drm_atomic_commit *state)
{
struct drm_plane_state *new_state = drm_atomic_get_new_plane_state(state,
plane);
struct drm_plane_state *old_state = drm_atomic_get_old_plane_state(state,
plane);
struct drm_crtc_state *crtc_state = NULL;
struct drm_framebuffer *new_fb = new_state->fb;
struct drm_framebuffer *old_fb = old_state->fb;
int ret;
/*
* Ignore damage clips if the framebuffer attached to the plane's state
* has changed since the last plane update (page-flip). In this case, a
* full plane update should happen because uploads are done per-buffer.
*/
if (old_fb != new_fb)
new_state->ignore_damage_clips = true;
if (new_state->crtc)
crtc_state = drm_atomic_get_new_crtc_state(state,
new_state->crtc);
ret = drm_atomic_helper_check_plane_state(new_state, crtc_state,
DRM_PLANE_NO_SCALING,
DRM_PLANE_NO_SCALING,
false, true);
return ret;
}
int vmw_du_crtc_atomic_check(struct drm_crtc *crtc,
struct drm_atomic_commit *state)
{
struct vmw_private *vmw = vmw_priv(crtc->dev);
struct drm_crtc_state *new_state = drm_atomic_get_new_crtc_state(state,
crtc);
struct vmw_display_unit *du = vmw_crtc_to_du(new_state->crtc);
int connector_mask = drm_connector_mask(&du->connector);
bool has_primary = new_state->plane_mask &
drm_plane_mask(crtc->primary);
/*
* This is fine in general, but broken userspace might expect
* some actual rendering so give a clue as why it's blank.
*/
if (new_state->enable && !has_primary)
drm_dbg_driver(&vmw->drm,
"CRTC without a primary plane will be blank.\n");
Annotation
- Immediate include surface: `vmwgfx_kms.h`, `vmwgfx_bo.h`, `vmwgfx_resource_priv.h`, `vmwgfx_vkms.h`, `vmw_surface_cache.h`, `drm/drm_atomic.h`, `drm/drm_atomic_helper.h`, `drm/drm_damage_helper.h`.
- Detected declarations: `function Copyright`, `function vmw_du_cleanup`, `function vmw_du_primary_plane_destroy`, `function vmw_du_plane_unpin_surf`, `function vmw_du_plane_cleanup_fb`, `function vmw_du_primary_plane_atomic_check`, `function vmw_du_crtc_atomic_check`, `function vmw_du_crtc_atomic_begin`, `function state`, `function vmw_du_crtc_reset`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: source implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
- 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.