1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * (C) COPYRIGHT 2018 ARM Limited. All rights reserved.
4  * Author: James.Qian.Wang <james.qian.wang@arm.com>
5  *
6  */
7 #ifndef _KOMEDA_FRAMEBUFFER_H_
8 #define _KOMEDA_FRAMEBUFFER_H_
9 
10 #include <drm/drm_framebuffer.h>
11 #include "komeda_format_caps.h"
12 
13 /** struct komeda_fb - entend drm_framebuffer with komeda attribute */
14 struct komeda_fb {
15 	/** @base: &drm_framebuffer */
16 	struct drm_framebuffer base;
17 	/* @format_caps: &komeda_format_caps */
18 	const struct komeda_format_caps *format_caps;
19 	/** @aligned_w: aligned frame buffer width */
20 	u32 aligned_w;
21 	/** @aligned_h: aligned frame buffer height */
22 	u32 aligned_h;
23 };
24 
25 #define to_kfb(dfb)	container_of(dfb, struct komeda_fb, base)
26 
27 struct drm_framebuffer *
28 komeda_fb_create(struct drm_device *dev, struct drm_file *file,
29 		 const struct drm_mode_fb_cmd2 *mode_cmd);
30 dma_addr_t
31 komeda_fb_get_pixel_addr(struct komeda_fb *kfb, int x, int y, int plane);
32 bool komeda_fb_is_layer_supported(struct komeda_fb *kfb, u32 layer_type);
33 
34 #endif
35