接前一篇文章:DRM全解析 —— framebuffer详解(1)
本文继续对DRM中framebuffer的核心结构struct drm_framebuffer的成员进行释义。
3. drm_framebuffer结构释义
(8)unsigned int offsets[DRM_FORMAT_MAX_PLANES]
/**
* @offsets: Offset from buffer start to the actual pixel data in bytes,
* per buffer. For userspace created object this is copied from
* drm_mode_fb_cmd2.
*
* Note that this is a linear offset and does not take into account
* tiling or buffer layout per @modifier. It is meant to be used when
* the actual pixel data for this framebuffer plane starts at an offset,
* e.g. when multiple planes are allocated within the same backing
* storage buffer object. For tiled layouts this generally means its
* @offsets must at least be tile-size aligned, but hardware often has
* stricter requirements.
*
* This should not be used to specifiy x/y pixel offsets into the buffer
* data (even for linear buffers). Specifying an x/y pixel offset is
* instead done through the source rectangle in &struct drm_plane_state.
*/
unsigned int offsets[DRM_FORMAT_MAX_PLANES];
每个缓冲区从缓冲区开始到实际像素数据的偏移量(以字节为单位)。对于用户空间创建的对象,这是从drm_mode_fb_cmd2拷贝的。注意,这是一个线性偏移,未考虑每个@modifier的平铺及缓冲区布局。它意味着当该帧缓冲区平面的实际像素数据在偏移处开始时被使用,例如,当在同一后备存储缓冲区对象内分配多个planes时。对于平铺布局,这通常意味着其@offsets必须至少与平铺大小对齐,但硬件通常有更严格的要求。
这不应用于在缓冲区数据中指定x/y像素偏移(即使对于线性缓冲区也是如此)。而应通过&struct drm_plane_state中的源矩形来指定x/y像素偏移量。
(9)uint64_t modifier
/**
* @modifier: Data layout modifier. This is used to describe
* tiling, or also special layouts (like compression) of auxiliary
* buffers. For userspace created object this is copied from
* drm_mode_fb_cmd2.
*/
uint64_t modifier;
数据布局modifier。此项用于描述平铺、或辅助缓冲区的特殊布局(如压缩)。对于用户空间创建的对象,这是从drm_mode_fb_cmd2拷贝的。
(10)unsigned int width
/**
* @width: Logical width of the visible area of the framebuffer, in
* pixels.
*/
unsigned int width;
framebuffer可见区域的逻辑宽度,以像素为单位。
(11)unsigned int height
/**
* @height: Logical height of the visible area of the framebuffer, in
* pixels.
*/
unsigned int height;
framebuffer可见区域的逻辑高度,以像素为单位。
(12)int flags
/**
* @flags: Framebuffer flags like DRM_MODE_FB_INTERLACED or
* DRM_MODE_FB_MODIFIERS.
*/
int flags;
framebuffer标志,如DRM_MODE_FB_INTERLACED或DRM_MODE_FB_MODIFIERS。
(13)int hot_x
/**
* @hot_x: X coordinate of the cursor hotspot. Used by the legacy cursor
* IOCTL when the driver supports cursor through a DRM_PLANE_TYPE_CURSOR
* universal plane.
*/
int hot_x;
光标热点的X坐标。当驱动程序通过DRM_PLANE_TYPE_cursor通用plane支持光标时,由传统光标IOCTL使用。
(14)int hot_y
/**
* @hot_y: Y coordinate of the cursor hotspot. Used by the legacy cursor
* IOCTL when the driver supports cursor through a DRM_PLANE_TYPE_CURSOR
* universal plane.
*/
int hot_y;
光标热点的Y坐标。当驱动程序通过DRM_PLANE_TYPE_cursor通用plane支持光标时,由传统光标IOCTL使用。
(15)struct list_head filp_head
/**
* @filp_head: Placed on &drm_file.fbs, protected by &drm_file.fbs_lock.
*/
struct list_head filp_head;
放置于&drm_file.fbs上,受&drm_file.fbs_lock保护。
(16)struct drm_gem_object *obj[DRM_FORMAT_MAX_PLANES]
/**
* @obj: GEM objects backing the framebuffer, one per plane (optional).
*
* This is used by the GEM framebuffer helpers, see e.g.
* drm_gem_fb_create().
*/
struct drm_gem_object *obj[DRM_FORMAT_MAX_PLANES];
支持framebuffer的GEM对象,每个plane一个(可选)。
此项由GEM framebuffer helpers使用。示例参见drm_gem_fb_create。
至此,DRM framebuffer的核心结构struct drm_framebuffer就释义完成了。后续会对此结构中涉及到的结构进行深入讲解。