drivers/video/fbdev/kyro/STG4000OverlayDevice.c
Source file repositories/reference/linux-study-clean/drivers/video/fbdev/kyro/STG4000OverlayDevice.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/video/fbdev/kyro/STG4000OverlayDevice.c- Extension
.c- Size
- 15608 bytes
- Lines
- 601
- Domain
- Driver Families
- Bucket
- drivers/video
- 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/kernel.hlinux/errno.hlinux/types.hSTG4000Reg.hSTG4000Interface.h
Detected Declarations
function ResetOverlayRegistersfunction CreateOverlaySurfacefunction SetOverlayBlendModefunction EnableOverlayPlanefunction Overlapfunction SetOverlayViewPort
Annotated Snippet
if ((inWidth & 0x7) == 0) { /* inWidth % 8 */
ulStride = (inWidth / 8);
} else {
/* Round up to next 16byte boundary */
ulStride = ((inWidth + 8) / 8);
}
} else {
/* Y component is 8bits so num 16 byte words is width/16 */
if ((inWidth & 0xf) == 0) { /* inWidth % 16 */
ulStride = (inWidth / 16);
} else {
/* Round up to next 16byte boundary */
ulStride = ((inWidth + 16) / 16);
}
}
/* Set Overlay address and Format mode */
tmp = STG_READ_REG(DACOverlayAddr);
CLEAR_BITS_FRM_TO(0, 20);
if (bLinear) {
CLEAR_BIT(31); /* Overlay format to Linear */
} else {
tmp |= SET_BIT(31); /* Overlay format to Planer */
}
/* Only bits 24:4 of the Overlay address */
tmp |= (ulOverlayOffset >> 4);
STG_WRITE_REG(DACOverlayAddr, tmp);
if (!bLinear) {
u32 uvSize =
(inWidth & 0x1) ? (inWidth + 1 / 2) : (inWidth / 2);
u32 uvStride;
u32 ulOffset;
/* Y component is 8bits so num 32 byte words is width/32 */
if ((uvSize & 0xf) == 0) { /* inWidth % 16 */
uvStride = (uvSize / 16);
} else {
/* Round up to next 32byte boundary */
uvStride = ((uvSize + 16) / 16);
}
ulOffset = ulOverlayOffset + (inHeight * (ulStride * 16));
/* Align U,V data to 32byte boundary */
if ((ulOffset & 0x1f) != 0)
ulOffset = (ulOffset + 32L) & 0xffffffE0L;
tmp = STG_READ_REG(DACOverlayUAddr);
CLEAR_BITS_FRM_TO(0, 20);
tmp |= (ulOffset >> 4);
STG_WRITE_REG(DACOverlayUAddr, tmp);
ulOffset += (inHeight / 2) * (uvStride * 16);
/* Align U,V data to 32byte boundary */
if ((ulOffset & 0x1f) != 0)
ulOffset = (ulOffset + 32L) & 0xffffffE0L;
tmp = STG_READ_REG(DACOverlayVAddr);
CLEAR_BITS_FRM_TO(0, 20);
tmp |= (ulOffset >> 4);
STG_WRITE_REG(DACOverlayVAddr, tmp);
*retUVStride = uvStride * 16;
}
/* Set Overlay YUV pixel format
* Make sure that LUT not used - ??????
*/
tmp = STG_READ_REG(DACPixelFormat);
/* Only support Planer or UYVY linear formats */
CLEAR_BITS_FRM_TO(4, 9);
STG_WRITE_REG(DACPixelFormat, tmp);
ovlWidth = inWidth;
ovlHeight = inHeight;
ovlStride = ulStride;
ovlLinear = bLinear;
*retStride = ulStride << 4; /* In bytes */
return 0;
}
int SetOverlayBlendMode(volatile STG4000REG __iomem *pSTGReg,
OVRL_BLEND_MODE mode,
u32 ulAlpha, u32 ulColorKey)
{
u32 tmp;
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/errno.h`, `linux/types.h`, `STG4000Reg.h`, `STG4000Interface.h`.
- Detected declarations: `function ResetOverlayRegisters`, `function CreateOverlaySurface`, `function SetOverlayBlendMode`, `function EnableOverlayPlane`, `function Overlap`, `function SetOverlayViewPort`.
- Atlas domain: Driver Families / drivers/video.
- 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.