drivers/gpu/drm/vboxvideo/vbva_base.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/vboxvideo/vbva_base.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/vboxvideo/vbva_base.c- Extension
.c- Size
- 5366 bytes
- Lines
- 215
- 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
linux/vbox_err.hvbox_drv.hvboxvideo_guest.hhgsmi_channels.h
Detected Declarations
function vbva_buffer_availablefunction vbva_buffer_place_data_atfunction vbva_buffer_flushfunction vbva_writefunction vbva_inform_hostfunction vbva_enablefunction vbva_disablefunction vbva_buffer_begin_updatefunction vbva_buffer_end_updatefunction vbva_setup_buffer_context
Annotated Snippet
if (chunk >= available) {
vbva_buffer_flush(ctx);
available = vbva_buffer_available(vbva);
}
if (chunk >= available) {
if (WARN_ON(available <= vbva->partial_write_tresh)) {
vbva_ctx->buffer_overflow = true;
return false;
}
chunk = available - vbva->partial_write_tresh;
}
vbva_buffer_place_data_at(vbva_ctx, p, chunk,
vbva->free_offset);
vbva->free_offset = (vbva->free_offset + chunk) %
vbva->data_len;
record->len_and_flags += chunk;
available -= chunk;
len -= chunk;
p += chunk;
}
return true;
}
static bool vbva_inform_host(struct vbva_buf_ctx *vbva_ctx,
struct gen_pool *ctx, s32 screen, bool enable)
{
struct vbva_enable_ex *p;
bool ret;
p = hgsmi_buffer_alloc(ctx, sizeof(*p), HGSMI_CH_VBVA, VBVA_ENABLE);
if (!p)
return false;
p->base.flags = enable ? VBVA_F_ENABLE : VBVA_F_DISABLE;
p->base.offset = vbva_ctx->buffer_offset;
p->base.result = VERR_NOT_SUPPORTED;
if (screen >= 0) {
p->base.flags |= VBVA_F_EXTENDED | VBVA_F_ABSOFFSET;
p->screen_id = screen;
}
hgsmi_buffer_submit(ctx, p);
if (enable)
ret = p->base.result >= 0;
else
ret = true;
hgsmi_buffer_free(ctx, p);
return ret;
}
bool vbva_enable(struct vbva_buf_ctx *vbva_ctx, struct gen_pool *ctx,
struct vbva_buffer *vbva, s32 screen)
{
bool ret = false;
memset(vbva, 0, sizeof(*vbva));
vbva->partial_write_tresh = 256;
vbva->data_len = vbva_ctx->buffer_length - sizeof(struct vbva_buffer);
vbva_ctx->vbva = vbva;
ret = vbva_inform_host(vbva_ctx, ctx, screen, true);
if (!ret)
vbva_disable(vbva_ctx, ctx, screen);
return ret;
}
void vbva_disable(struct vbva_buf_ctx *vbva_ctx, struct gen_pool *ctx,
s32 screen)
{
vbva_ctx->buffer_overflow = false;
vbva_ctx->record = NULL;
vbva_ctx->vbva = NULL;
vbva_inform_host(vbva_ctx, ctx, screen, false);
}
bool vbva_buffer_begin_update(struct vbva_buf_ctx *vbva_ctx,
struct gen_pool *ctx)
{
struct vbva_record *record;
u32 next;
Annotation
- Immediate include surface: `linux/vbox_err.h`, `vbox_drv.h`, `vboxvideo_guest.h`, `hgsmi_channels.h`.
- Detected declarations: `function vbva_buffer_available`, `function vbva_buffer_place_data_at`, `function vbva_buffer_flush`, `function vbva_write`, `function vbva_inform_host`, `function vbva_enable`, `function vbva_disable`, `function vbva_buffer_begin_update`, `function vbva_buffer_end_update`, `function vbva_setup_buffer_context`.
- 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.