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 /**
14  * struct komeda_fb - Entending drm_framebuffer with komeda attribute
15  */
16 struct komeda_fb {
17 	/** @base: &drm_framebuffer */
18 	struct drm_framebuffer base;
19 	/**
20 	 * @format_caps:
21 	 * extends drm_format_info for komeda specific information
22 	 */
23 	const struct komeda_format_caps *format_caps;
24 	/** @aligned_w: aligned frame buffer width */
25 	u32 aligned_w;
26 	/** @aligned_h: aligned frame buffer height */
27 	u32 aligned_h;
28 };
29 
30 #define to_kfb(dfb)	container_of(dfb, struct komeda_fb, base)
31 
32 struct drm_framebuffer *
33 komeda_fb_create(struct drm_device *dev, struct drm_file *file,
34 		 const struct drm_mode_fb_cmd2 *mode_cmd);
35 dma_addr_t
36 komeda_fb_get_pixel_addr(struct komeda_fb *kfb, int x, int y, int plane);
37 bool komeda_fb_is_layer_supported(struct komeda_fb *kfb, u32 layer_type);
38 
39 #endif
40