drivers/video/fbdev/core/fb_draw.h
Source file repositories/reference/linux-study-clean/drivers/video/fbdev/core/fb_draw.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/video/fbdev/core/fb_draw.h- Extension
.h- Size
- 4744 bytes
- Lines
- 164
- 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
- No C-style include directives detected by the generator.
Detected Declarations
struct fb_reversefunction Copyrightfunction fb_address_forwardfunction fb_address_backwardfunction fb_compfunction fb_modify_offsetfunction entriesfunction fb_rightfunction fb_leftfunction fb_reverse_bits_longfunction fb_reverse_longfunction fb_pixel_maskfunction fb_reverse_init
Annotated Snippet
struct fb_reverse {
bool byte, pixel;
};
/* reverse bits of each byte in a long */
static inline unsigned long fb_reverse_bits_long(unsigned long val)
{
#if defined(CONFIG_HAVE_ARCH_BITREVERSE) && BITS_PER_LONG == 32
return bitrev8x4(val);
#else
val = fb_comp(val >> 1, val << 1, ~0UL / 3);
val = fb_comp(val >> 2, val << 2, ~0UL / 5);
return fb_comp(val >> 4, val << 4, ~0UL / 17);
#endif
}
/* apply byte and bit reversals as necessary */
static inline unsigned long fb_reverse_long(unsigned long val,
struct fb_reverse reverse)
{
if (reverse.pixel)
val = fb_reverse_bits_long(val);
return reverse.byte ? swab_long(val) : val;
}
/* calculate a pixel mask for the given reversal */
static inline unsigned long fb_pixel_mask(int index, struct fb_reverse reverse)
{
#ifdef FB_REV_PIXELS_IN_BYTE
if (reverse.byte)
return reverse.pixel ? fb_left(~0UL, index) : swab_long(fb_right(~0UL, index));
else
return reverse.pixel ? swab_long(fb_left(~0UL, index)) : fb_right(~0UL, index);
#else
return reverse.byte ? swab_long(fb_right(~0UL, index)) : fb_right(~0UL, index);
#endif
}
/*
* initialise reversals based on info
*
* Normally the first byte is the low byte on little endian and in the high
* on big endian. If it's the other way around then that's reverse byte order.
*
* Normally the first pixel is the LSB on little endian and the MSB on big
* endian. If that's not the case that's reverse pixel order.
*/
static inline struct fb_reverse fb_reverse_init(struct fb_info *info)
{
struct fb_reverse reverse;
#ifdef __LITTLE_ENDIAN
reverse.byte = fb_be_math(info) != 0;
#else
reverse.byte = fb_be_math(info) == 0;
#endif
#ifdef FB_REV_PIXELS_IN_BYTE
reverse.pixel = info->var.bits_per_pixel < BITS_PER_BYTE
&& (info->var.nonstd & FB_NONSTD_REV_PIX_IN_B);
#else
reverse.pixel = false;
#endif
return reverse;
}
#endif /* FB_DRAW_H */
Annotation
- Detected declarations: `struct fb_reverse`, `function Copyright`, `function fb_address_forward`, `function fb_address_backward`, `function fb_comp`, `function fb_modify_offset`, `function entries`, `function fb_right`, `function fb_left`, `function fb_reverse_bits_long`.
- 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.