drivers/gpu/drm/vmwgfx/vmwgfx_va.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/vmwgfx/vmwgfx_va.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/vmwgfx/vmwgfx_va.c- Extension
.c- Size
- 5386 bytes
- Lines
- 171
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
vmwgfx_bo.hvmwgfx_drv.hvmwgfx_resource_priv.h
Detected Declarations
struct vmw_streamfunction vmw_streamfunction vmw_stream_hw_destroyfunction vmw_stream_initfunction vmw_stream_set_arg_handlefunction vmw_stream_unref_ioctlfunction vmw_stream_claim_ioctlfunction vmw_user_stream_lookup
Annotated Snippet
struct vmw_stream {
struct vmw_simple_resource sres;
u32 stream_id;
};
/**
* vmw_stream - Typecast a struct vmw_resource to a struct vmw_stream.
* @res: Pointer to the struct vmw_resource.
*
* Returns: Returns a pointer to the struct vmw_stream.
*/
static struct vmw_stream *
vmw_stream(struct vmw_resource *res)
{
return container_of(res, struct vmw_stream, sres.res);
}
/***************************************************************************
* Simple resource callbacks for struct vmw_stream
**************************************************************************/
static void vmw_stream_hw_destroy(struct vmw_resource *res)
{
struct vmw_private *dev_priv = res->dev_priv;
struct vmw_stream *stream = vmw_stream(res);
int ret;
ret = vmw_overlay_unref(dev_priv, stream->stream_id);
WARN_ON_ONCE(ret != 0);
}
static int vmw_stream_init(struct vmw_resource *res, void *data)
{
struct vmw_stream *stream = vmw_stream(res);
return vmw_overlay_claim(res->dev_priv, &stream->stream_id);
}
static void vmw_stream_set_arg_handle(void *data, u32 handle)
{
struct drm_vmw_stream_arg *arg = (struct drm_vmw_stream_arg *)data;
arg->stream_id = handle;
}
static const struct vmw_simple_resource_func va_stream_func = {
.res_func = {
.res_type = vmw_res_stream,
.needs_guest_memory = false,
.may_evict = false,
.type_name = "overlay stream",
.domain = VMW_BO_DOMAIN_SYS,
.busy_domain = VMW_BO_DOMAIN_SYS,
.create = NULL,
.destroy = NULL,
.bind = NULL,
.unbind = NULL
},
.ttm_res_type = VMW_RES_STREAM,
.size = sizeof(struct vmw_stream),
.init = vmw_stream_init,
.hw_destroy = vmw_stream_hw_destroy,
.set_arg_handle = vmw_stream_set_arg_handle,
};
/***************************************************************************
* End simple resource callbacks for struct vmw_stream
**************************************************************************/
/**
* vmw_stream_unref_ioctl - Ioctl to unreference a user-space handle to
* a struct vmw_stream.
* @dev: Pointer to the drm device.
* @data: The ioctl argument
* @file_priv: Pointer to a struct drm_file identifying the caller.
*
* Return:
* 0 if successful.
* Negative error value on failure.
*/
int vmw_stream_unref_ioctl(struct drm_device *dev, void *data,
struct drm_file *file_priv)
{
struct drm_vmw_stream_arg *arg = (struct drm_vmw_stream_arg *)data;
return ttm_ref_object_base_unref(vmw_fpriv(file_priv)->tfile,
arg->stream_id);
}
/**
* vmw_stream_claim_ioctl - Ioctl to claim a struct vmw_stream overlay.
Annotation
- Immediate include surface: `vmwgfx_bo.h`, `vmwgfx_drv.h`, `vmwgfx_resource_priv.h`.
- Detected declarations: `struct vmw_stream`, `function vmw_stream`, `function vmw_stream_hw_destroy`, `function vmw_stream_init`, `function vmw_stream_set_arg_handle`, `function vmw_stream_unref_ioctl`, `function vmw_stream_claim_ioctl`, `function vmw_user_stream_lookup`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: source implementation candidate.
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.