rcar_du_vsp.h (2708B)
1/* SPDX-License-Identifier: GPL-2.0+ */ 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) 8 */ 9 10#ifndef __RCAR_DU_VSP_H__ 11#define __RCAR_DU_VSP_H__ 12 13#include <drm/drm_plane.h> 14 15struct drm_framebuffer; 16struct rcar_du_format_info; 17struct rcar_du_vsp; 18struct sg_table; 19 20struct rcar_du_vsp_plane { 21 struct drm_plane plane; 22 struct rcar_du_vsp *vsp; 23 unsigned int index; 24}; 25 26struct 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; 32}; 33 34static inline struct rcar_du_vsp_plane *to_rcar_vsp_plane(struct drm_plane *p) 35{ 36 return container_of(p, struct rcar_du_vsp_plane, plane); 37} 38 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 44 */ 45struct rcar_du_vsp_plane_state { 46 struct drm_plane_state state; 47 48 const struct rcar_du_format_info *format; 49 struct sg_table sg_tables[3]; 50}; 51 52static inline struct rcar_du_vsp_plane_state * 53to_rcar_vsp_plane_state(struct drm_plane_state *state) 54{ 55 return container_of(state, struct rcar_du_vsp_plane_state, state); 56} 57 58#ifdef CONFIG_DRM_RCAR_VSP 59int rcar_du_vsp_init(struct rcar_du_vsp *vsp, struct device_node *np, 60 unsigned int crtcs); 61void rcar_du_vsp_enable(struct rcar_du_crtc *crtc); 62void rcar_du_vsp_disable(struct rcar_du_crtc *crtc); 63void rcar_du_vsp_atomic_begin(struct rcar_du_crtc *crtc); 64void rcar_du_vsp_atomic_flush(struct rcar_du_crtc *crtc); 65int rcar_du_vsp_map_fb(struct rcar_du_vsp *vsp, struct drm_framebuffer *fb, 66 struct sg_table sg_tables[3]); 67void rcar_du_vsp_unmap_fb(struct rcar_du_vsp *vsp, struct drm_framebuffer *fb, 68 struct sg_table sg_tables[3]); 69#else 70static inline int rcar_du_vsp_init(struct rcar_du_vsp *vsp, 71 struct device_node *np, 72 unsigned int crtcs) 73{ 74 return -ENXIO; 75} 76static inline void rcar_du_vsp_enable(struct rcar_du_crtc *crtc) { }; 77static inline void rcar_du_vsp_disable(struct rcar_du_crtc *crtc) { }; 78static inline void rcar_du_vsp_atomic_begin(struct rcar_du_crtc *crtc) { }; 79static inline void rcar_du_vsp_atomic_flush(struct rcar_du_crtc *crtc) { }; 80static inline int rcar_du_vsp_map_fb(struct rcar_du_vsp *vsp, 81 struct drm_framebuffer *fb, 82 struct sg_table sg_tables[3]) 83{ 84 return -ENXIO; 85} 86static inline void rcar_du_vsp_unmap_fb(struct rcar_du_vsp *vsp, 87 struct drm_framebuffer *fb, 88 struct sg_table sg_tables[3]) 89{ 90} 91#endif 92 93#endif /* __RCAR_DU_VSP_H__ */