drivers/media/platform/ti/omap/omap_vout_vrfb.c
Source file repositories/reference/linux-study-clean/drivers/media/platform/ti/omap/omap_vout_vrfb.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/platform/ti/omap/omap_vout_vrfb.c- Extension
.c- Size
- 11387 bytes
- Lines
- 420
- Domain
- Driver Families
- Bucket
- drivers/media
- 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.
- 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/sched.hlinux/platform_device.hlinux/videodev2.hlinux/slab.hmedia/v4l2-device.hvideo/omapvrfb.homap_voutdef.homap_voutlib.homap_vout_vrfb.h
Detected Declarations
function Copyrightfunction omap_vout_vrfb_dma_tx_callbackfunction omap_vout_free_vrfb_buffersfunction omap_vout_setup_vrfb_bufsfunction omap_vout_release_vrfbfunction omap_vout_vrfb_buffer_setupfunction omap_vout_prepare_vrfbfunction omap_vout_calculate_vrfb_offset
Annotated Snippet
if (!vout->smsshado_virt_addr[i]) {
vout->smsshado_virt_addr[i] =
omap_vout_alloc_buffer(vout->smsshado_size,
&vout->smsshado_phy_addr[i]);
}
if (!vout->smsshado_virt_addr[i] && startindex != -1) {
if (vout->vq.memory == V4L2_MEMORY_MMAP && i >= startindex)
break;
}
if (!vout->smsshado_virt_addr[i]) {
for (j = 0; j < i; j++) {
omap_vout_free_buffer(
vout->smsshado_virt_addr[j],
vout->smsshado_size);
vout->smsshado_virt_addr[j] = 0;
vout->smsshado_phy_addr[j] = 0;
}
*count = 0;
return -ENOMEM;
}
memset((void *)(long)vout->smsshado_virt_addr[i], 0,
vout->smsshado_size);
}
return 0;
}
/*
* Wakes up the application once the DMA transfer to VRFB space is completed.
*/
static void omap_vout_vrfb_dma_tx_callback(void *data)
{
struct vid_vrfb_dma *t = (struct vid_vrfb_dma *) data;
t->tx_status = 1;
wake_up_interruptible(&t->wait);
}
/*
* Free VRFB buffers
*/
void omap_vout_free_vrfb_buffers(struct omap_vout_device *vout)
{
int j;
for (j = 0; j < VRFB_NUM_BUFS; j++) {
if (vout->smsshado_virt_addr[j]) {
omap_vout_free_buffer(vout->smsshado_virt_addr[j],
vout->smsshado_size);
vout->smsshado_virt_addr[j] = 0;
vout->smsshado_phy_addr[j] = 0;
}
}
}
int omap_vout_setup_vrfb_bufs(struct platform_device *pdev, int vid_num,
bool static_vrfb_allocation)
{
int ret = 0, i, j;
struct omap_vout_device *vout;
struct video_device *vfd;
dma_cap_mask_t mask;
int image_width, image_height;
int vrfb_num_bufs = VRFB_NUM_BUFS;
struct v4l2_device *v4l2_dev = platform_get_drvdata(pdev);
struct omap2video_device *vid_dev =
container_of(v4l2_dev, struct omap2video_device, v4l2_dev);
vout = vid_dev->vouts[vid_num];
vfd = vout->vfd;
for (i = 0; i < VRFB_NUM_BUFS; i++) {
if (omap_vrfb_request_ctx(&vout->vrfb_context[i])) {
dev_info(&pdev->dev, ": VRFB allocation failed\n");
for (j = 0; j < i; j++)
omap_vrfb_release_ctx(&vout->vrfb_context[j]);
return -ENOMEM;
}
}
/* Calculate VRFB memory size */
/* allocate for worst case size */
image_width = VID_MAX_WIDTH / TILE_SIZE;
if (VID_MAX_WIDTH % TILE_SIZE)
image_width++;
image_width = image_width * TILE_SIZE;
image_height = VID_MAX_HEIGHT / TILE_SIZE;
if (VID_MAX_HEIGHT % TILE_SIZE)
image_height++;
Annotation
- Immediate include surface: `linux/sched.h`, `linux/platform_device.h`, `linux/videodev2.h`, `linux/slab.h`, `media/v4l2-device.h`, `video/omapvrfb.h`, `omap_voutdef.h`, `omap_voutlib.h`.
- Detected declarations: `function Copyright`, `function omap_vout_vrfb_dma_tx_callback`, `function omap_vout_free_vrfb_buffers`, `function omap_vout_setup_vrfb_bufs`, `function omap_vout_release_vrfb`, `function omap_vout_vrfb_buffer_setup`, `function omap_vout_prepare_vrfb`, `function omap_vout_calculate_vrfb_offset`.
- Atlas domain: Driver Families / drivers/media.
- 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.