Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0+ */
0002 /*
0003  * R-Car Display Unit Planes
0004  *
0005  * Copyright (C) 2013-2014 Renesas Electronics Corporation
0006  *
0007  * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com)
0008  */
0009 
0010 #ifndef __RCAR_DU_PLANE_H__
0011 #define __RCAR_DU_PLANE_H__
0012 
0013 #include <drm/drm_plane.h>
0014 
0015 struct rcar_du_format_info;
0016 struct rcar_du_group;
0017 
0018 /*
0019  * The RCAR DU has 8 hardware planes, shared between primary and overlay planes.
0020  * As using overlay planes requires at least one of the CRTCs being enabled, no
0021  * more than 7 overlay planes can be available. We thus create 1 primary plane
0022  * per CRTC and 7 overlay planes, for a total of up to 9 KMS planes.
0023  */
0024 #define RCAR_DU_NUM_KMS_PLANES      9
0025 #define RCAR_DU_NUM_HW_PLANES       8
0026 
0027 enum rcar_du_plane_source {
0028     RCAR_DU_PLANE_MEMORY,
0029     RCAR_DU_PLANE_VSPD0,
0030     RCAR_DU_PLANE_VSPD1,
0031 };
0032 
0033 struct rcar_du_plane {
0034     struct drm_plane plane;
0035     struct rcar_du_group *group;
0036 };
0037 
0038 static inline struct rcar_du_plane *to_rcar_plane(struct drm_plane *plane)
0039 {
0040     return container_of(plane, struct rcar_du_plane, plane);
0041 }
0042 
0043 /**
0044  * struct rcar_du_plane_state - Driver-specific plane state
0045  * @state: base DRM plane state
0046  * @format: information about the pixel format used by the plane
0047  * @hwindex: 0-based hardware plane index, -1 means unused
0048  * @colorkey: value of the plane colorkey property
0049  */
0050 struct rcar_du_plane_state {
0051     struct drm_plane_state state;
0052 
0053     const struct rcar_du_format_info *format;
0054     int hwindex;
0055     enum rcar_du_plane_source source;
0056 
0057     unsigned int colorkey;
0058 };
0059 
0060 static inline struct rcar_du_plane_state *
0061 to_rcar_plane_state(struct drm_plane_state *state)
0062 {
0063     return container_of(state, struct rcar_du_plane_state, state);
0064 }
0065 
0066 int rcar_du_atomic_check_planes(struct drm_device *dev,
0067                 struct drm_atomic_state *state);
0068 
0069 int __rcar_du_plane_atomic_check(struct drm_plane *plane,
0070                  struct drm_plane_state *state,
0071                  const struct rcar_du_format_info **format);
0072 
0073 int rcar_du_planes_init(struct rcar_du_group *rgrp);
0074 
0075 void __rcar_du_plane_setup(struct rcar_du_group *rgrp,
0076                const struct rcar_du_plane_state *state);
0077 
0078 static inline void rcar_du_plane_setup(struct rcar_du_plane *plane)
0079 {
0080     struct rcar_du_plane_state *state =
0081         to_rcar_plane_state(plane->plane.state);
0082 
0083     return __rcar_du_plane_setup(plane->group, state);
0084 }
0085 
0086 #endif /* __RCAR_DU_PLANE_H__ */