include/drm/drm_rect.h
Source file repositories/reference/linux-study-clean/include/drm/drm_rect.h
File Facts
- System
- Linux kernel
- Corpus path
include/drm/drm_rect.h- Extension
.h- Size
- 7697 bytes
- Lines
- 275
- Domain
- Repository Root And Misc
- Bucket
- include
- Inferred role
- Repository Root And Misc: implementation source
- Status
- source implementation candidate
Why This File Exists
Top-level or miscellaneous repository surface. Use this as map coverage unless a later manual pass promotes the file into a deeper subsystem dossier.
- Top-level or miscellaneous repository surface. Use this as map coverage unless a later manual pass promotes the file into a deeper subsystem dossier.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/types.h
Detected Declarations
struct drm_rectfunction drm_rect_widthfunction drm_rect_adjust_sizefunction drm_rect_translatefunction drm_rect_translate_tofunction drm_rect_downscalefunction drm_rect_widthfunction drm_rect_heightfunction drm_rect_visiblefunction drm_rect_equalsfunction drm_rect_fp_to_intfunction drm_rect_overlap
Annotated Snippet
struct drm_rect {
int x1, y1, x2, y2;
};
/**
* DRM_RECT_INIT - initialize a rectangle from x/y/w/h
* @x: x coordinate
* @y: y coordinate
* @w: width
* @h: height
*
* RETURNS:
* A new rectangle of the specified size.
*/
#define DRM_RECT_INIT(x, y, w, h) ((struct drm_rect){ \
.x1 = (x), \
.y1 = (y), \
.x2 = (x) + (w), \
.y2 = (y) + (h) })
/**
* DRM_RECT_FMT - printf string for &struct drm_rect
*/
#define DRM_RECT_FMT "%dx%d%+d%+d"
/**
* DRM_RECT_ARG - printf arguments for &struct drm_rect
* @r: rectangle struct
*/
#define DRM_RECT_ARG(r) drm_rect_width(r), drm_rect_height(r), (r)->x1, (r)->y1
/**
* DRM_RECT_FP_FMT - printf string for &struct drm_rect in 16.16 fixed point
*/
#define DRM_RECT_FP_FMT "%d.%06ux%d.%06u%+d.%06u%+d.%06u"
/**
* DRM_RECT_FP_ARG - printf arguments for &struct drm_rect in 16.16 fixed point
* @r: rectangle struct
*
* This is useful for e.g. printing plane source rectangles, which are in 16.16
* fixed point.
*/
#define DRM_RECT_FP_ARG(r) \
drm_rect_width(r) >> 16, ((drm_rect_width(r) & 0xffff) * 15625) >> 10, \
drm_rect_height(r) >> 16, ((drm_rect_height(r) & 0xffff) * 15625) >> 10, \
(r)->x1 >> 16, (((r)->x1 & 0xffff) * 15625) >> 10, \
(r)->y1 >> 16, (((r)->y1 & 0xffff) * 15625) >> 10
/**
* drm_rect_init - initialize the rectangle from x/y/w/h
* @r: rectangle
* @x: x coordinate
* @y: y coordinate
* @width: width
* @height: height
*/
static inline void drm_rect_init(struct drm_rect *r, int x, int y,
int width, int height)
{
r->x1 = x;
r->y1 = y;
r->x2 = x + width;
r->y2 = y + height;
}
/**
* drm_rect_adjust_size - adjust the size of the rectangle
* @r: rectangle to be adjusted
* @dw: horizontal adjustment
* @dh: vertical adjustment
*
* Change the size of rectangle @r by @dw in the horizontal direction,
* and by @dh in the vertical direction, while keeping the center
* of @r stationary.
*
* Positive @dw and @dh increase the size, negative values decrease it.
*/
static inline void drm_rect_adjust_size(struct drm_rect *r, int dw, int dh)
{
r->x1 -= dw >> 1;
r->y1 -= dh >> 1;
r->x2 += (dw + 1) >> 1;
r->y2 += (dh + 1) >> 1;
}
/**
* drm_rect_translate - translate the rectangle
* @r: rectangle to be translated
* @dx: horizontal translation
* @dy: vertical translation
*
Annotation
- Immediate include surface: `linux/types.h`.
- Detected declarations: `struct drm_rect`, `function drm_rect_width`, `function drm_rect_adjust_size`, `function drm_rect_translate`, `function drm_rect_translate_to`, `function drm_rect_downscale`, `function drm_rect_width`, `function drm_rect_height`, `function drm_rect_visible`, `function drm_rect_equals`.
- Atlas domain: Repository Root And Misc / include.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.