drivers/video/fbdev/aty/mach64_cursor.c
Source file repositories/reference/linux-study-clean/drivers/video/fbdev/aty/mach64_cursor.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/video/fbdev/aty/mach64_cursor.c- Extension
.c- Size
- 6266 bytes
- Lines
- 232
- 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/fb.hlinux/init.hlinux/string.hasm/io.hasm/fbio.hvideo/mach64.hatyfb.h
Detected Declarations
function compfunction atyfb_cursorfunction patternfunction aty_init_cursor
Annotated Snippet
if (x < 0) {
xoff = -x;
x = 0;
} else {
xoff = 0;
}
y = cursor->image.dy - cursor->hot.y - info->var.yoffset;
if (y < 0) {
yoff = -y;
y = 0;
} else {
yoff = 0;
}
h = cursor->image.height;
/*
* In doublescan mode, the cursor location
* and heigh also needs to be doubled.
*/
if (par->crtc.gen_cntl & CRTC_DBL_SCAN_EN) {
y<<=1;
h<<=1;
}
wait_for_fifo(3, par);
aty_st_le32(CUR_OFFSET, (info->fix.smem_len >> 3) + (yoff << 1), par);
aty_st_le32(CUR_HORZ_VERT_OFF,
((u32) (64 - h + yoff) << 16) | xoff, par);
aty_st_le32(CUR_HORZ_VERT_POSN, ((u32) y << 16) | x, par);
}
/* Set color map */
if (cursor->set & FB_CUR_SETCMAP) {
u32 fg_idx, bg_idx, fg, bg;
fg_idx = cursor->image.fg_color;
bg_idx = cursor->image.bg_color;
fg = ((info->cmap.red[fg_idx] & 0xff) << 24) |
((info->cmap.green[fg_idx] & 0xff) << 16) |
((info->cmap.blue[fg_idx] & 0xff) << 8) | 0xff;
bg = ((info->cmap.red[bg_idx] & 0xff) << 24) |
((info->cmap.green[bg_idx] & 0xff) << 16) |
((info->cmap.blue[bg_idx] & 0xff) << 8);
wait_for_fifo(2, par);
aty_st_le32(CUR_CLR0, bg, par);
aty_st_le32(CUR_CLR1, fg, par);
}
if (cursor->set & (FB_CUR_SETSHAPE | FB_CUR_SETIMAGE)) {
u8 *src = (u8 *)cursor->image.data;
u8 *msk = (u8 *)cursor->mask;
u8 __iomem *dst = (u8 __iomem *)info->sprite.addr;
unsigned int width = (cursor->image.width + 7) >> 3;
unsigned int height = cursor->image.height;
unsigned int align = info->sprite.scan_align;
unsigned int i, j, offset;
u8 m, b;
// Clear cursor image with 1010101010...
fb_memset_io(dst, 0xaa, 1024);
offset = align - width*2;
for (i = 0; i < height; i++) {
for (j = 0; j < width; j++) {
u16 l = 0xaaaa;
b = *src++;
m = *msk++;
switch (cursor->rop) {
case ROP_XOR:
// Upper 4 bits of mask data
l = cursor_bits_lookup[(b ^ m) >> 4] |
// Lower 4 bits of mask
(cursor_bits_lookup[(b ^ m) & 0x0f] << 8);
break;
case ROP_COPY:
// Upper 4 bits of mask data
l = cursor_bits_lookup[(b & m) >> 4] |
// Lower 4 bits of mask
(cursor_bits_lookup[(b & m) & 0x0f] << 8);
break;
}
/*
* If cursor size is not a multiple of 8 characters
* we must pad it with transparent pattern (0xaaaa).
Annotation
- Immediate include surface: `linux/fb.h`, `linux/init.h`, `linux/string.h`, `asm/io.h`, `asm/fbio.h`, `video/mach64.h`, `atyfb.h`.
- Detected declarations: `function comp`, `function atyfb_cursor`, `function pattern`, `function aty_init_cursor`.
- 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.