drm/core: Add drm_afbc_framebuffer and a corresponding helper

The new struct contains afbc-specific data.

The new function can be used by drivers which support afbc to complete
the preparation of struct drm_afbc_framebuffer. It must be called after
allocating the said struct and calling drm_gem_fb_init_with_funcs().

Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: James Qian Wang <james.qian.wang@arm.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20200311145541.29186-3-andrzej.p@collabora.com
This commit is contained in:
Andrzej Pietrasiewicz 2020-03-11 15:55:37 +01:00
parent f2b816d78a
commit 55f7f72753
4 changed files with 178 additions and 0 deletions

View file

@ -297,4 +297,49 @@ int drm_framebuffer_plane_width(int width,
int drm_framebuffer_plane_height(int height,
const struct drm_framebuffer *fb, int plane);
/**
* struct drm_afbc_framebuffer - a special afbc frame buffer object
*
* A derived class of struct drm_framebuffer, dedicated for afbc use cases.
*/
struct drm_afbc_framebuffer {
/**
* @base: base framebuffer structure.
*/
struct drm_framebuffer base;
/**
* @block_widht: width of a single afbc block
*/
u32 block_width;
/**
* @block_widht: height of a single afbc block
*/
u32 block_height;
/**
* @aligned_width: aligned frame buffer width
*/
u32 aligned_width;
/**
* @aligned_height: aligned frame buffer height
*/
u32 aligned_height;
/**
* @offset: offset of the first afbc header
*/
u32 offset;
/**
* @afbc_size: minimum size of afbc buffer
*/
u32 afbc_size;
/**
* @bpp: bpp value for this afbc buffer
* To be removed when users such as malidp
* properly store the cpp in drm_format_info.
* New users should not start using this field.
*/
u32 bpp;
};
#define fb_to_afbc_fb(x) container_of(x, struct drm_afbc_framebuffer, base)
#endif