drivers/gpu/drm/vmwgfx/vmwgfx_blit.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/vmwgfx/vmwgfx_blit.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/vmwgfx/vmwgfx_blit.c- Extension
.c- Size
- 18791 bytes
- Lines
- 641
- 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_drv.hvmwgfx_bo.hlinux/highmem.h
Detected Declarations
struct vmw_bo_blit_line_datafunction find_last_difffunction vmw_find_first_difffunction vmw_find_last_difffunction vmw_memcpyfunction vmw_adjust_rectfunction vmw_diff_memcpyfunction vmw_bo_cpu_blit_linefunction unmap_externalfunction vmw_external_bo_copyfunction architectures
Annotated Snippet
struct vmw_bo_blit_line_data {
u32 mapped_dst;
u8 *dst_addr;
struct page **dst_pages;
u32 dst_num_pages;
pgprot_t dst_prot;
u32 mapped_src;
u8 *src_addr;
struct page **src_pages;
u32 src_num_pages;
pgprot_t src_prot;
struct vmw_diff_cpy *diff;
};
/**
* vmw_bo_cpu_blit_line - Blit part of a line from one bo to another.
*
* @d: Blit data as described above.
* @dst_offset: Destination copy start offset from start of bo.
* @src_offset: Source copy start offset from start of bo.
* @bytes_to_copy: Number of bytes to copy in this line.
*/
static int vmw_bo_cpu_blit_line(struct vmw_bo_blit_line_data *d,
u32 dst_offset,
u32 src_offset,
u32 bytes_to_copy)
{
struct vmw_diff_cpy *diff = d->diff;
while (bytes_to_copy) {
u32 copy_size = bytes_to_copy;
u32 dst_page = dst_offset >> PAGE_SHIFT;
u32 src_page = src_offset >> PAGE_SHIFT;
u32 dst_page_offset = dst_offset & ~PAGE_MASK;
u32 src_page_offset = src_offset & ~PAGE_MASK;
bool unmap_dst = d->dst_addr && dst_page != d->mapped_dst;
bool unmap_src = d->src_addr && (src_page != d->mapped_src ||
unmap_dst);
copy_size = min_t(u32, copy_size, PAGE_SIZE - dst_page_offset);
copy_size = min_t(u32, copy_size, PAGE_SIZE - src_page_offset);
if (unmap_src) {
kunmap_atomic(d->src_addr);
d->src_addr = NULL;
}
if (unmap_dst) {
kunmap_atomic(d->dst_addr);
d->dst_addr = NULL;
}
if (!d->dst_addr) {
if (WARN_ON_ONCE(dst_page >= d->dst_num_pages))
return -EINVAL;
d->dst_addr =
kmap_atomic_prot(d->dst_pages[dst_page],
d->dst_prot);
if (!d->dst_addr)
return -ENOMEM;
d->mapped_dst = dst_page;
}
if (!d->src_addr) {
if (WARN_ON_ONCE(src_page >= d->src_num_pages))
return -EINVAL;
d->src_addr =
kmap_atomic_prot(d->src_pages[src_page],
d->src_prot);
if (!d->src_addr)
return -ENOMEM;
d->mapped_src = src_page;
}
diff->do_cpy(diff, d->dst_addr + dst_page_offset,
d->src_addr + src_page_offset, copy_size);
bytes_to_copy -= copy_size;
dst_offset += copy_size;
src_offset += copy_size;
}
return 0;
}
static void *map_external(struct vmw_bo *bo, struct iosys_map *map)
{
Annotation
- Immediate include surface: `vmwgfx_drv.h`, `vmwgfx_bo.h`, `linux/highmem.h`.
- Detected declarations: `struct vmw_bo_blit_line_data`, `function find_last_diff`, `function vmw_find_first_diff`, `function vmw_find_last_diff`, `function vmw_memcpy`, `function vmw_adjust_rect`, `function vmw_diff_memcpy`, `function vmw_bo_cpu_blit_line`, `function unmap_external`, `function vmw_external_bo_copy`.
- 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.