blob: 8861661590ff905fd6e3d315ec1434e3323b6e95 [file] [log] [blame]
Laurent Pinchart6d62ef32015-09-07 17:14:58 +03001/*
2 * rcar_du_vsp.h -- R-Car Display Unit VSP-Based Compositor
3 *
4 * Copyright (C) 2015 Renesas Electronics Corporation
5 *
6 * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com)
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 */
13
14#ifndef __RCAR_DU_VSP_H__
15#define __RCAR_DU_VSP_H__
16
17#include <drm/drmP.h>
18#include <drm/drm_crtc.h>
19
20struct rcar_du_format_info;
21struct rcar_du_vsp;
22
23struct rcar_du_vsp_plane {
24 struct drm_plane plane;
25 struct rcar_du_vsp *vsp;
26 unsigned int index;
27};
28
29struct rcar_du_vsp {
30 unsigned int index;
31 struct device *vsp;
32 struct rcar_du_device *dev;
33 struct rcar_du_vsp_plane *planes;
34 unsigned int num_planes;
35};
36
37static inline struct rcar_du_vsp_plane *to_rcar_vsp_plane(struct drm_plane *p)
38{
39 return container_of(p, struct rcar_du_vsp_plane, plane);
40}
41
42/**
43 * struct rcar_du_vsp_plane_state - Driver-specific plane state
44 * @state: base DRM plane state
45 * @format: information about the pixel format used by the plane
Laurent Pinchartfa5b4112017-05-17 02:20:07 +030046 * @sg_tables: scatter-gather tables for the frame buffer memory
Laurent Pinchart6d62ef32015-09-07 17:14:58 +030047 * @alpha: value of the plane alpha property
Laurent Pinchart85e0a162016-03-24 05:15:59 -030048 * @zpos: value of the plane zpos property
Laurent Pinchart6d62ef32015-09-07 17:14:58 +030049 */
50struct rcar_du_vsp_plane_state {
51 struct drm_plane_state state;
52
53 const struct rcar_du_format_info *format;
Laurent Pinchartfa5b4112017-05-17 02:20:07 +030054 struct sg_table sg_tables[3];
Laurent Pinchart6d62ef32015-09-07 17:14:58 +030055
56 unsigned int alpha;
Laurent Pinchart85e0a162016-03-24 05:15:59 -030057 unsigned int zpos;
Laurent Pinchart6d62ef32015-09-07 17:14:58 +030058};
59
60static inline struct rcar_du_vsp_plane_state *
61to_rcar_vsp_plane_state(struct drm_plane_state *state)
62{
63 return container_of(state, struct rcar_du_vsp_plane_state, state);
64}
65
66#ifdef CONFIG_DRM_RCAR_VSP
67int rcar_du_vsp_init(struct rcar_du_vsp *vsp);
68void rcar_du_vsp_enable(struct rcar_du_crtc *crtc);
69void rcar_du_vsp_disable(struct rcar_du_crtc *crtc);
70void rcar_du_vsp_atomic_begin(struct rcar_du_crtc *crtc);
71void rcar_du_vsp_atomic_flush(struct rcar_du_crtc *crtc);
72#else
Jacopo Mondi31153452017-03-03 13:58:56 +010073static inline int rcar_du_vsp_init(struct rcar_du_vsp *vsp) { return -ENXIO; };
Laurent Pinchart6d62ef32015-09-07 17:14:58 +030074static inline void rcar_du_vsp_enable(struct rcar_du_crtc *crtc) { };
75static inline void rcar_du_vsp_disable(struct rcar_du_crtc *crtc) { };
76static inline void rcar_du_vsp_atomic_begin(struct rcar_du_crtc *crtc) { };
77static inline void rcar_du_vsp_atomic_flush(struct rcar_du_crtc *crtc) { };
78#endif
79
80#endif /* __RCAR_DU_VSP_H__ */