72
72
#define ZYNQMP_DISP_AV_BUF_NUM_VID_GFX_BUFFERS 4
73
73
#define ZYNQMP_DISP_AV_BUF_NUM_BUFFERS 6
74
74
75
- #define ZYNQMP_DISP_NUM_LAYERS 2
76
75
#define ZYNQMP_DISP_MAX_NUM_SUB_PLANES 3
77
76
78
77
/**
@@ -134,8 +133,7 @@ struct zynqmp_disp_layer_info {
134
133
};
135
134
136
135
/**
137
- * struct zynqmp_disp_layer - Display layer (DRM plane)
138
- * @plane: DRM plane
136
+ * struct zynqmp_disp_layer - Display layer
139
137
* @id: Layer ID
140
138
* @disp: Back pointer to struct zynqmp_disp
141
139
* @info: Static layer information
@@ -145,7 +143,6 @@ struct zynqmp_disp_layer_info {
145
143
* @mode: Current operation mode
146
144
*/
147
145
struct zynqmp_disp_layer {
148
- struct drm_plane plane ;
149
146
enum zynqmp_disp_layer_id id ;
150
147
struct zynqmp_disp * disp ;
151
148
const struct zynqmp_disp_layer_info * info ;
@@ -182,7 +179,7 @@ struct zynqmp_disp {
182
179
void __iomem * base ;
183
180
} audio ;
184
181
185
- struct zynqmp_disp_layer layers [ZYNQMP_DISP_NUM_LAYERS ];
182
+ struct zynqmp_disp_layer layers [ZYNQMP_DPSUB_NUM_LAYERS ];
186
183
};
187
184
188
185
/* -----------------------------------------------------------------------------
@@ -1091,11 +1088,6 @@ static int zynqmp_disp_layer_update(struct zynqmp_disp_layer *layer,
1091
1088
return 0 ;
1092
1089
}
1093
1090
1094
- static inline struct zynqmp_disp_layer * plane_to_layer (struct drm_plane * plane )
1095
- {
1096
- return container_of (plane , struct zynqmp_disp_layer , plane );
1097
- }
1098
-
1099
1091
static int
1100
1092
zynqmp_disp_plane_atomic_check (struct drm_plane * plane ,
1101
1093
struct drm_atomic_state * state )
@@ -1124,7 +1116,8 @@ zynqmp_disp_plane_atomic_disable(struct drm_plane *plane,
1124
1116
{
1125
1117
struct drm_plane_state * old_state = drm_atomic_get_old_plane_state (state ,
1126
1118
plane );
1127
- struct zynqmp_disp_layer * layer = plane_to_layer (plane );
1119
+ struct zynqmp_dpsub * dpsub = to_zynqmp_dpsub (plane -> dev );
1120
+ struct zynqmp_disp_layer * layer = & dpsub -> disp -> layers [plane -> index ];
1128
1121
1129
1122
if (!old_state -> fb )
1130
1123
return ;
@@ -1142,7 +1135,8 @@ zynqmp_disp_plane_atomic_update(struct drm_plane *plane,
1142
1135
{
1143
1136
struct drm_plane_state * old_state = drm_atomic_get_old_plane_state (state , plane );
1144
1137
struct drm_plane_state * new_state = drm_atomic_get_new_plane_state (state , plane );
1145
- struct zynqmp_disp_layer * layer = plane_to_layer (plane );
1138
+ struct zynqmp_dpsub * dpsub = to_zynqmp_dpsub (plane -> dev );
1139
+ struct zynqmp_disp_layer * layer = & dpsub -> disp -> layers [plane -> index ];
1146
1140
bool format_changed = false;
1147
1141
1148
1142
if (!old_state -> fb ||
@@ -1194,6 +1188,7 @@ static int zynqmp_disp_create_planes(struct zynqmp_disp *disp)
1194
1188
1195
1189
for (i = 0 ; i < ARRAY_SIZE (disp -> layers ); i ++ ) {
1196
1190
struct zynqmp_disp_layer * layer = & disp -> layers [i ];
1191
+ struct drm_plane * plane = & disp -> dpsub -> planes [i ];
1197
1192
enum drm_plane_type type ;
1198
1193
unsigned int num_formats ;
1199
1194
u32 * formats ;
@@ -1205,20 +1200,19 @@ static int zynqmp_disp_create_planes(struct zynqmp_disp *disp)
1205
1200
/* Graphics layer is primary, and video layer is overlay. */
1206
1201
type = zynqmp_disp_layer_is_video (layer )
1207
1202
? DRM_PLANE_TYPE_OVERLAY : DRM_PLANE_TYPE_PRIMARY ;
1208
- ret = drm_universal_plane_init (disp -> drm , & layer -> plane , 0 ,
1203
+ ret = drm_universal_plane_init (disp -> drm , plane , 0 ,
1209
1204
& zynqmp_disp_plane_funcs ,
1210
1205
formats , num_formats ,
1211
1206
NULL , type , NULL );
1212
1207
kfree (formats );
1213
1208
if (ret )
1214
1209
return ret ;
1215
1210
1216
- drm_plane_helper_add (& layer -> plane ,
1217
- & zynqmp_disp_plane_helper_funcs );
1211
+ drm_plane_helper_add (plane , & zynqmp_disp_plane_helper_funcs );
1218
1212
1219
- drm_plane_create_zpos_immutable_property (& layer -> plane , i );
1213
+ drm_plane_create_zpos_immutable_property (plane , i );
1220
1214
if (zynqmp_disp_layer_is_gfx (layer ))
1221
- drm_plane_create_alpha_property (& layer -> plane );
1215
+ drm_plane_create_alpha_property (plane );
1222
1216
}
1223
1217
1224
1218
return 0 ;
@@ -1538,7 +1532,7 @@ static const struct drm_crtc_funcs zynqmp_disp_crtc_funcs = {
1538
1532
1539
1533
static int zynqmp_disp_create_crtc (struct zynqmp_disp * disp )
1540
1534
{
1541
- struct drm_plane * plane = & disp -> layers [ZYNQMP_DISP_LAYER_GFX ]. plane ;
1535
+ struct drm_plane * plane = & disp -> dpsub -> planes [ZYNQMP_DISP_LAYER_GFX ];
1542
1536
struct drm_crtc * crtc = & disp -> dpsub -> crtc ;
1543
1537
int ret ;
1544
1538
@@ -1561,7 +1555,7 @@ static void zynqmp_disp_map_crtc_to_plane(struct zynqmp_disp *disp)
1561
1555
unsigned int i ;
1562
1556
1563
1557
for (i = 0 ; i < ARRAY_SIZE (disp -> layers ); i ++ )
1564
- disp -> layers [i ]. plane .possible_crtcs = possible_crtcs ;
1558
+ disp -> dpsub -> planes [i ].possible_crtcs = possible_crtcs ;
1565
1559
}
1566
1560
1567
1561
/* -----------------------------------------------------------------------------
0 commit comments