• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2019 Allwinnertech Co.Ltd
3  * Authors: zhengwanyu
4  *
5  * This program is free software; you can redistribute  it and/or modify it
6  * under  the terms of  the GNU General  Public License as published by the
7  * Free Software Foundation;  either version 2 of the  License, or (at your
8  * option) any later version.
9  *
10  */
11 #ifndef _SUNXI_DRM_FB_H_
12 #define _SUNXI_DRM_FB_H_
13 
14 #include <drm/drm_atomic.h>
15 #include <drm/drm_crtc.h>
16 #include <drm/drm_fb_helper.h>
17 #include <drm/drm_crtc_helper.h>
18 #include <linux/dma-buf.h>
19 #include <linux/dma-mapping.h>
20 #include <linux/module.h>
21 
22 enum sunxi_fb_type {
23 	DRM_CREATE_FB = 0,
24 	FBDEV_CREATE_FB = 1,
25 };
26 
27 struct sunxi_drm_fb {
28 	/*sunxi_fb_type*/
29 	int				flag;
30 	struct drm_framebuffer		fb;
31 	struct sunxi_drm_gem_object	*obj[4];
32 };
33 
to_sunxi_fb(struct drm_framebuffer * fb)34 static inline struct sunxi_drm_fb *to_sunxi_fb(struct drm_framebuffer *fb)
35 {
36 	return container_of(fb, struct sunxi_drm_fb, fb);
37 }
38 
39 void sunxi_fb_dump(struct drm_framebuffer *fb);
40 ssize_t sunxi_drm_fb_show(char *buf, struct drm_framebuffer *fb);
41 
42 void sunxi_drm_fb_destroy(struct drm_framebuffer *fb);
43 struct drm_framebuffer_funcs *sunxi_drm_fb_get_funcs(void);
44 int sunxi_drm_fb_prepare_fb(struct drm_plane *plane,
45 			  struct drm_plane_state *state);
46 
47 struct sunxi_drm_fb *sunxi_drm_fb_alloc(struct drm_device *dev,
48 			const struct drm_mode_fb_cmd2 *mode_cmd,
49 				struct sunxi_drm_gem_object **obj,
50 				unsigned int num_planes, int flag,
51 			const struct drm_framebuffer_funcs *funcs);
52 
53 struct drm_framebuffer *sunxi_drm_fb_create(struct drm_device *dev,
54 	struct drm_file *file_priv, const struct drm_mode_fb_cmd2 *mode_cmd);
55 #endif
56