drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/vmwgfx/vmwgfx_drv.c- Extension
.c- Size
- 47904 bytes
- Lines
- 1673
- Domain
- Driver Families
- Bucket
- drivers/gpu
- Inferred role
- Driver Families: operation-table or driver-model contract
- Status
- pattern 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.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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_drv.hvmwgfx_bo.hvmwgfx_binding.hvmwgfx_devcaps.hvmwgfx_mksstat.hvmwgfx_vkms.httm_object.hdrm/clients/drm_client_setup.hdrm/drm_drv.hdrm/drm_fbdev_ttm.hdrm/drm_gem_ttm_helper.hdrm/drm_ioctl.hdrm/drm_module.hdrm/drm_sysfs.hdrm/ttm/ttm_range_manager.hdrm/ttm/ttm_placement.hgenerated/utsrelease.hasm/hypervisor.hlinux/aperture.hlinux/cc_platform.hlinux/dma-mapping.hlinux/module.hlinux/pci.hlinux/version.hlinux/vmalloc.h
Detected Declarations
struct bitmap_namefunction vmw_print_bitmapfunction vmw_print_sm_typefunction vmw_dummy_query_bo_createfunction vmw_device_initfunction vmw_device_finifunction vmw_request_device_latefunction vmw_request_devicefunction vmw_release_device_earlyfunction vmw_release_device_latefunction vmw_get_initial_sizefunction vmw_dma_select_modefunction vmw_dma_masksfunction vmw_vram_manager_initfunction vmw_vram_manager_finifunction vmw_setup_pci_resourcesfunction vmw_detect_versionfunction vmw_write_driver_idfunction vmw_sw_context_initfunction vmw_sw_context_finifunction vmw_driver_loadfunction vmw_gmrid_man_initfunction vmw_driver_unloadfunction vmw_postclosefunction vmw_driver_openfunction vmw_generic_ioctlfunction vmw_unlocked_ioctlfunction vmw_compat_ioctlfunction vmw_master_setfunction vmw_master_dropfunction __vmw_svga_enablefunction vmw_svga_enablefunction __vmw_svga_disablefunction vmw_svga_disablefunction vmw_removefunction vmw_debugfs_resource_managers_initfunction vmwgfx_pm_notifierfunction vmw_pci_suspendfunction vmw_pci_resumefunction vmw_pm_suspendfunction vmw_pm_resumefunction vmw_pm_freezefunction vmw_pm_restorefunction vmw_probe
Annotated Snippet
static const struct file_operations vmwgfx_driver_fops = {
.owner = THIS_MODULE,
.open = drm_open,
.release = drm_release,
.unlocked_ioctl = vmw_unlocked_ioctl,
.mmap = drm_gem_mmap,
.poll = drm_poll,
.read = drm_read,
#if defined(CONFIG_COMPAT)
.compat_ioctl = vmw_compat_ioctl,
#endif
.llseek = noop_llseek,
.fop_flags = FOP_UNSIGNED_OFFSET,
};
static const struct drm_driver driver = {
.driver_features =
DRIVER_MODESET | DRIVER_RENDER | DRIVER_ATOMIC | DRIVER_GEM | DRIVER_CURSOR_HOTSPOT,
.ioctls = vmw_ioctls,
.num_ioctls = ARRAY_SIZE(vmw_ioctls),
.master_set = vmw_master_set,
.master_drop = vmw_master_drop,
.open = vmw_driver_open,
.postclose = vmw_postclose,
.dumb_create = vmw_dumb_create,
.dumb_map_offset = drm_gem_ttm_dumb_map_offset,
.prime_fd_to_handle = vmw_prime_fd_to_handle,
.prime_handle_to_fd = vmw_prime_handle_to_fd,
.gem_prime_import_sg_table = vmw_prime_import_sg_table,
DRM_FBDEV_TTM_DRIVER_OPS,
.fops = &vmwgfx_driver_fops,
.name = VMWGFX_DRIVER_NAME,
.desc = VMWGFX_DRIVER_DESC,
.major = VMWGFX_DRIVER_MAJOR,
.minor = VMWGFX_DRIVER_MINOR,
.patchlevel = VMWGFX_DRIVER_PATCHLEVEL
};
static struct pci_driver vmw_pci_driver = {
.name = VMWGFX_DRIVER_NAME,
.id_table = vmw_pci_id_list,
.probe = vmw_probe,
.remove = vmw_remove,
.driver = {
.pm = &vmw_pm_ops
}
};
static int vmw_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
{
struct vmw_private *vmw;
int ret;
ret = aperture_remove_conflicting_pci_devices(pdev, driver.name);
if (ret)
goto out_error;
ret = pcim_enable_device(pdev);
if (ret)
goto out_error;
vmw = devm_drm_dev_alloc(&pdev->dev, &driver,
struct vmw_private, drm);
if (IS_ERR(vmw)) {
ret = PTR_ERR(vmw);
goto out_error;
}
pci_set_drvdata(pdev, &vmw->drm);
ret = vmw_driver_load(vmw, ent->device);
if (ret)
goto out_error;
ret = drm_dev_register(&vmw->drm, 0);
if (ret)
goto out_unload;
vmw_fifo_resource_inc(vmw);
vmw_svga_enable(vmw);
drm_client_setup(&vmw->drm, NULL);
vmw_debugfs_gem_init(vmw);
vmw_debugfs_resource_managers_init(vmw);
return 0;
Annotation
- Immediate include surface: `vmwgfx_drv.h`, `vmwgfx_bo.h`, `vmwgfx_binding.h`, `vmwgfx_devcaps.h`, `vmwgfx_mksstat.h`, `vmwgfx_vkms.h`, `ttm_object.h`, `drm/clients/drm_client_setup.h`.
- Detected declarations: `struct bitmap_name`, `function vmw_print_bitmap`, `function vmw_print_sm_type`, `function vmw_dummy_query_bo_create`, `function vmw_device_init`, `function vmw_device_fini`, `function vmw_request_device_late`, `function vmw_request_device`, `function vmw_release_device_early`, `function vmw_release_device_late`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: pattern implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.