Kuninori Morimoto | 0bbce9e | 2018-07-26 02:37:32 +0000 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
Laurent Pinchart | 6d62ef3 | 2015-09-07 17:14:58 +0300 | [diff] [blame] | 2 | /* |
| 3 | * rcar_du_vsp.h -- R-Car Display Unit VSP-Based Compositor |
| 4 | * |
| 5 | * Copyright (C) 2015 Renesas Electronics Corporation |
| 6 | * |
| 7 | * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com) |
Laurent Pinchart | 6d62ef3 | 2015-09-07 17:14:58 +0300 | [diff] [blame] | 8 | */ |
| 9 | |
| 10 | #ifndef __RCAR_DU_VSP_H__ |
| 11 | #define __RCAR_DU_VSP_H__ |
| 12 | |
Laurent Pinchart | 9a47db8 | 2018-12-27 11:26:56 +0200 | [diff] [blame^] | 13 | #include <drm/drm_plane.h> |
Laurent Pinchart | 6d62ef3 | 2015-09-07 17:14:58 +0300 | [diff] [blame] | 14 | |
| 15 | struct rcar_du_format_info; |
| 16 | struct rcar_du_vsp; |
| 17 | |
| 18 | struct rcar_du_vsp_plane { |
| 19 | struct drm_plane plane; |
| 20 | struct rcar_du_vsp *vsp; |
| 21 | unsigned int index; |
| 22 | }; |
| 23 | |
| 24 | struct rcar_du_vsp { |
| 25 | unsigned int index; |
| 26 | struct device *vsp; |
| 27 | struct rcar_du_device *dev; |
| 28 | struct rcar_du_vsp_plane *planes; |
| 29 | unsigned int num_planes; |
| 30 | }; |
| 31 | |
| 32 | static inline struct rcar_du_vsp_plane *to_rcar_vsp_plane(struct drm_plane *p) |
| 33 | { |
| 34 | return container_of(p, struct rcar_du_vsp_plane, plane); |
| 35 | } |
| 36 | |
| 37 | /** |
| 38 | * struct rcar_du_vsp_plane_state - Driver-specific plane state |
| 39 | * @state: base DRM plane state |
| 40 | * @format: information about the pixel format used by the plane |
Laurent Pinchart | fa5b411 | 2017-05-17 02:20:07 +0300 | [diff] [blame] | 41 | * @sg_tables: scatter-gather tables for the frame buffer memory |
Laurent Pinchart | 6d62ef3 | 2015-09-07 17:14:58 +0300 | [diff] [blame] | 42 | */ |
| 43 | struct rcar_du_vsp_plane_state { |
| 44 | struct drm_plane_state state; |
| 45 | |
| 46 | const struct rcar_du_format_info *format; |
Laurent Pinchart | fa5b411 | 2017-05-17 02:20:07 +0300 | [diff] [blame] | 47 | struct sg_table sg_tables[3]; |
Laurent Pinchart | 6d62ef3 | 2015-09-07 17:14:58 +0300 | [diff] [blame] | 48 | }; |
| 49 | |
| 50 | static inline struct rcar_du_vsp_plane_state * |
| 51 | to_rcar_vsp_plane_state(struct drm_plane_state *state) |
| 52 | { |
| 53 | return container_of(state, struct rcar_du_vsp_plane_state, state); |
| 54 | } |
| 55 | |
| 56 | #ifdef CONFIG_DRM_RCAR_VSP |
Laurent Pinchart | 3e81374 | 2017-06-26 13:12:01 +0300 | [diff] [blame] | 57 | int rcar_du_vsp_init(struct rcar_du_vsp *vsp, struct device_node *np, |
| 58 | unsigned int crtcs); |
Laurent Pinchart | 6d62ef3 | 2015-09-07 17:14:58 +0300 | [diff] [blame] | 59 | void rcar_du_vsp_enable(struct rcar_du_crtc *crtc); |
| 60 | void rcar_du_vsp_disable(struct rcar_du_crtc *crtc); |
| 61 | void rcar_du_vsp_atomic_begin(struct rcar_du_crtc *crtc); |
| 62 | void rcar_du_vsp_atomic_flush(struct rcar_du_crtc *crtc); |
| 63 | #else |
Laurent Pinchart | 3e81374 | 2017-06-26 13:12:01 +0300 | [diff] [blame] | 64 | static inline int rcar_du_vsp_init(struct rcar_du_vsp *vsp, |
| 65 | struct device_node *np, |
| 66 | unsigned int crtcs) |
| 67 | { |
| 68 | return -ENXIO; |
| 69 | } |
Laurent Pinchart | 6d62ef3 | 2015-09-07 17:14:58 +0300 | [diff] [blame] | 70 | static inline void rcar_du_vsp_enable(struct rcar_du_crtc *crtc) { }; |
| 71 | static inline void rcar_du_vsp_disable(struct rcar_du_crtc *crtc) { }; |
| 72 | static inline void rcar_du_vsp_atomic_begin(struct rcar_du_crtc *crtc) { }; |
| 73 | static inline void rcar_du_vsp_atomic_flush(struct rcar_du_crtc *crtc) { }; |
| 74 | #endif |
| 75 | |
| 76 | #endif /* __RCAR_DU_VSP_H__ */ |