WIP FPC-III support
[linux/fpc-iii.git] / drivers / gpu / drm / rcar-du / rcar_du_vsp.h
blob9b4724159378b7d38a3f79d4a464417eb750c42f
1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3 * rcar_du_vsp.h -- R-Car Display Unit VSP-Based Compositor
5 * Copyright (C) 2015 Renesas Electronics Corporation
7 * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com)
8 */
10 #ifndef __RCAR_DU_VSP_H__
11 #define __RCAR_DU_VSP_H__
13 #include <drm/drm_plane.h>
15 struct drm_framebuffer;
16 struct rcar_du_format_info;
17 struct rcar_du_vsp;
18 struct sg_table;
20 struct rcar_du_vsp_plane {
21 struct drm_plane plane;
22 struct rcar_du_vsp *vsp;
23 unsigned int index;
26 struct rcar_du_vsp {
27 unsigned int index;
28 struct device *vsp;
29 struct rcar_du_device *dev;
30 struct rcar_du_vsp_plane *planes;
31 unsigned int num_planes;
34 static inline struct rcar_du_vsp_plane *to_rcar_vsp_plane(struct drm_plane *p)
36 return container_of(p, struct rcar_du_vsp_plane, plane);
39 /**
40 * struct rcar_du_vsp_plane_state - Driver-specific plane state
41 * @state: base DRM plane state
42 * @format: information about the pixel format used by the plane
43 * @sg_tables: scatter-gather tables for the frame buffer memory
45 struct rcar_du_vsp_plane_state {
46 struct drm_plane_state state;
48 const struct rcar_du_format_info *format;
49 struct sg_table sg_tables[3];
52 static inline struct rcar_du_vsp_plane_state *
53 to_rcar_vsp_plane_state(struct drm_plane_state *state)
55 return container_of(state, struct rcar_du_vsp_plane_state, state);
58 #ifdef CONFIG_DRM_RCAR_VSP
59 int rcar_du_vsp_init(struct rcar_du_vsp *vsp, struct device_node *np,
60 unsigned int crtcs);
61 void rcar_du_vsp_enable(struct rcar_du_crtc *crtc);
62 void rcar_du_vsp_disable(struct rcar_du_crtc *crtc);
63 void rcar_du_vsp_atomic_begin(struct rcar_du_crtc *crtc);
64 void rcar_du_vsp_atomic_flush(struct rcar_du_crtc *crtc);
65 int rcar_du_vsp_map_fb(struct rcar_du_vsp *vsp, struct drm_framebuffer *fb,
66 struct sg_table sg_tables[3]);
67 void rcar_du_vsp_unmap_fb(struct rcar_du_vsp *vsp, struct drm_framebuffer *fb,
68 struct sg_table sg_tables[3]);
69 #else
70 static inline int rcar_du_vsp_init(struct rcar_du_vsp *vsp,
71 struct device_node *np,
72 unsigned int crtcs)
74 return -ENXIO;
76 static inline void rcar_du_vsp_enable(struct rcar_du_crtc *crtc) { };
77 static inline void rcar_du_vsp_disable(struct rcar_du_crtc *crtc) { };
78 static inline void rcar_du_vsp_atomic_begin(struct rcar_du_crtc *crtc) { };
79 static inline void rcar_du_vsp_atomic_flush(struct rcar_du_crtc *crtc) { };
80 static inline int rcar_du_vsp_map_fb(struct rcar_du_vsp *vsp,
81 struct drm_framebuffer *fb,
82 struct sg_table sg_tables[3])
84 return -ENXIO;
86 static inline void rcar_du_vsp_unmap_fb(struct rcar_du_vsp *vsp,
87 struct drm_framebuffer *fb,
88 struct sg_table sg_tables[3])
91 #endif
93 #endif /* __RCAR_DU_VSP_H__ */