drivers/gpu/drm/qxl/qxl_object.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/qxl/qxl_object.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/qxl/qxl_object.c- Extension
.c- Size
- 9470 bytes
- Lines
- 419
- 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
linux/iosys-map.hlinux/io-mapping.hqxl_drv.hqxl_object.h
Detected Declarations
function filesfunction qxl_ttm_bo_is_qxl_bofunction qxl_ttm_placement_from_domainfunction qxl_bo_createfunction qxl_bo_vmap_lockedfunction qxl_bo_pin_and_vmapfunction qxl_bo_vunmap_lockedfunction qxl_bo_vunmap_and_unpinfunction qxl_bo_kunmap_atomic_pagefunction qxl_bo_unreffunction qxl_bo_pin_lockedfunction qxl_bo_unpin_lockedfunction qxl_bo_pinfunction qxl_bo_unpinfunction qxl_bo_force_deletefunction qxl_bo_initfunction qxl_bo_finifunction qxl_bo_check_idfunction qxl_surf_evictfunction qxl_vram_evict
Annotated Snippet
#include <linux/iosys-map.h>
#include <linux/io-mapping.h>
#include "qxl_drv.h"
#include "qxl_object.h"
static void qxl_ttm_bo_destroy(struct ttm_buffer_object *tbo)
{
struct qxl_bo *bo;
struct qxl_device *qdev;
bo = to_qxl_bo(tbo);
qdev = to_qxl(bo->tbo.base.dev);
qxl_surface_evict(qdev, bo, false);
WARN_ON_ONCE(bo->map_count > 0);
mutex_lock(&qdev->gem.mutex);
list_del_init(&bo->list);
mutex_unlock(&qdev->gem.mutex);
drm_gem_object_release(&bo->tbo.base);
kfree(bo);
}
bool qxl_ttm_bo_is_qxl_bo(struct ttm_buffer_object *bo)
{
if (bo->destroy == &qxl_ttm_bo_destroy)
return true;
return false;
}
void qxl_ttm_placement_from_domain(struct qxl_bo *qbo, u32 domain)
{
u32 c = 0;
u32 pflag = 0;
unsigned int i;
if (qbo->tbo.base.size <= PAGE_SIZE)
pflag |= TTM_PL_FLAG_TOPDOWN;
qbo->placement.placement = qbo->placements;
if (domain == QXL_GEM_DOMAIN_VRAM) {
qbo->placements[c].mem_type = TTM_PL_VRAM;
qbo->placements[c++].flags = pflag;
}
if (domain == QXL_GEM_DOMAIN_SURFACE) {
qbo->placements[c].mem_type = TTM_PL_PRIV;
qbo->placements[c++].flags = pflag;
qbo->placements[c].mem_type = TTM_PL_VRAM;
qbo->placements[c++].flags = pflag;
}
if (domain == QXL_GEM_DOMAIN_CPU) {
qbo->placements[c].mem_type = TTM_PL_SYSTEM;
qbo->placements[c++].flags = pflag;
}
if (!c) {
qbo->placements[c].mem_type = TTM_PL_SYSTEM;
qbo->placements[c++].flags = 0;
}
qbo->placement.num_placement = c;
for (i = 0; i < c; ++i) {
qbo->placements[i].fpfn = 0;
qbo->placements[i].lpfn = 0;
}
}
static const struct drm_gem_object_funcs qxl_object_funcs = {
.free = qxl_gem_object_free,
.open = qxl_gem_object_open,
.close = qxl_gem_object_close,
.pin = qxl_gem_prime_pin,
.unpin = qxl_gem_prime_unpin,
.get_sg_table = qxl_gem_prime_get_sg_table,
.vmap = qxl_gem_prime_vmap,
.vunmap = qxl_gem_prime_vunmap,
.mmap = drm_gem_ttm_mmap,
.print_info = drm_gem_ttm_print_info,
};
int qxl_bo_create(struct qxl_device *qdev, unsigned long size,
bool kernel, bool pinned, u32 domain, u32 priority,
struct qxl_surface *surf,
struct qxl_bo **bo_ptr)
{
struct ttm_operation_ctx ctx = { !kernel, false };
struct qxl_bo *bo;
enum ttm_bo_type type;
int r;
if (kernel)
type = ttm_bo_type_kernel;
Annotation
- Immediate include surface: `linux/iosys-map.h`, `linux/io-mapping.h`, `qxl_drv.h`, `qxl_object.h`.
- Detected declarations: `function files`, `function qxl_ttm_bo_is_qxl_bo`, `function qxl_ttm_placement_from_domain`, `function qxl_bo_create`, `function qxl_bo_vmap_locked`, `function qxl_bo_pin_and_vmap`, `function qxl_bo_vunmap_locked`, `function qxl_bo_vunmap_and_unpin`, `function qxl_bo_kunmap_atomic_page`, `function qxl_bo_unref`.
- 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.