@@ -170,6 +170,7 @@ struct vop_win_phy {
170
170
171
171
struct vop_reg enable ;
172
172
struct vop_reg format ;
173
+ struct vop_reg rb_swap ;
173
174
struct vop_reg act_info ;
174
175
struct vop_reg dsp_info ;
175
176
struct vop_reg dsp_st ;
@@ -199,8 +200,12 @@ struct vop_data {
199
200
static const uint32_t formats_01 [] = {
200
201
DRM_FORMAT_XRGB8888 ,
201
202
DRM_FORMAT_ARGB8888 ,
203
+ DRM_FORMAT_XBGR8888 ,
204
+ DRM_FORMAT_ABGR8888 ,
202
205
DRM_FORMAT_RGB888 ,
206
+ DRM_FORMAT_BGR888 ,
203
207
DRM_FORMAT_RGB565 ,
208
+ DRM_FORMAT_BGR565 ,
204
209
DRM_FORMAT_NV12 ,
205
210
DRM_FORMAT_NV16 ,
206
211
DRM_FORMAT_NV24 ,
@@ -209,15 +214,20 @@ static const uint32_t formats_01[] = {
209
214
static const uint32_t formats_234 [] = {
210
215
DRM_FORMAT_XRGB8888 ,
211
216
DRM_FORMAT_ARGB8888 ,
217
+ DRM_FORMAT_XBGR8888 ,
218
+ DRM_FORMAT_ABGR8888 ,
212
219
DRM_FORMAT_RGB888 ,
220
+ DRM_FORMAT_BGR888 ,
213
221
DRM_FORMAT_RGB565 ,
222
+ DRM_FORMAT_BGR565 ,
214
223
};
215
224
216
225
static const struct vop_win_phy win01_data = {
217
226
.data_formats = formats_01 ,
218
227
.nformats = ARRAY_SIZE (formats_01 ),
219
228
.enable = VOP_REG (WIN0_CTRL0 , 0x1 , 0 ),
220
229
.format = VOP_REG (WIN0_CTRL0 , 0x7 , 1 ),
230
+ .rb_swap = VOP_REG (WIN0_CTRL0 , 0x1 , 12 ),
221
231
.act_info = VOP_REG (WIN0_ACT_INFO , 0x1fff1fff , 0 ),
222
232
.dsp_info = VOP_REG (WIN0_DSP_INFO , 0x0fff0fff , 0 ),
223
233
.dsp_st = VOP_REG (WIN0_DSP_ST , 0x1fff1fff , 0 ),
@@ -234,6 +244,7 @@ static const struct vop_win_phy win23_data = {
234
244
.nformats = ARRAY_SIZE (formats_234 ),
235
245
.enable = VOP_REG (WIN2_CTRL0 , 0x1 , 0 ),
236
246
.format = VOP_REG (WIN2_CTRL0 , 0x7 , 1 ),
247
+ .rb_swap = VOP_REG (WIN2_CTRL0 , 0x1 , 12 ),
237
248
.dsp_info = VOP_REG (WIN2_DSP_INFO0 , 0x0fff0fff , 0 ),
238
249
.dsp_st = VOP_REG (WIN2_DSP_ST0 , 0x1fff1fff , 0 ),
239
250
.yrgb_mst = VOP_REG (WIN2_MST0 , 0xffffffff , 0 ),
@@ -242,15 +253,6 @@ static const struct vop_win_phy win23_data = {
242
253
.dst_alpha_ctl = VOP_REG (WIN2_DST_ALPHA_CTRL , 0xff , 0 ),
243
254
};
244
255
245
- static const struct vop_win_phy cursor_data = {
246
- .data_formats = formats_234 ,
247
- .nformats = ARRAY_SIZE (formats_234 ),
248
- .enable = VOP_REG (HWC_CTRL0 , 0x1 , 0 ),
249
- .format = VOP_REG (HWC_CTRL0 , 0x7 , 1 ),
250
- .dsp_st = VOP_REG (HWC_DSP_ST , 0x1fff1fff , 0 ),
251
- .yrgb_mst = VOP_REG (HWC_MST , 0xffffffff , 0 ),
252
- };
253
-
254
256
static const struct vop_ctrl ctrl_data = {
255
257
.standby = VOP_REG (SYS_CTRL , 0x1 , 22 ),
256
258
.gate_en = VOP_REG (SYS_CTRL , 0x1 , 23 ),
@@ -282,14 +284,14 @@ static const struct vop_reg_data vop_init_reg_table[] = {
282
284
/*
283
285
* Note: rk3288 has a dedicated 'cursor' window, however, that window requires
284
286
* special support to get alpha blending working. For now, just use overlay
285
- * window 1 for the drm cursor.
287
+ * window 3 for the drm cursor.
288
+ *
286
289
*/
287
290
static const struct vop_win_data rk3288_vop_win_data [] = {
288
291
{ .base = 0x00 , .phy = & win01_data , .type = DRM_PLANE_TYPE_PRIMARY },
289
- { .base = 0x40 , .phy = & win01_data , .type = DRM_PLANE_TYPE_CURSOR },
292
+ { .base = 0x40 , .phy = & win01_data , .type = DRM_PLANE_TYPE_OVERLAY },
290
293
{ .base = 0x00 , .phy = & win23_data , .type = DRM_PLANE_TYPE_OVERLAY },
291
- { .base = 0x50 , .phy = & win23_data , .type = DRM_PLANE_TYPE_OVERLAY },
292
- { .base = 0x00 , .phy = & cursor_data , .type = DRM_PLANE_TYPE_OVERLAY },
294
+ { .base = 0x50 , .phy = & win23_data , .type = DRM_PLANE_TYPE_CURSOR },
293
295
};
294
296
295
297
static const struct vop_data rk3288_vop = {
@@ -352,15 +354,32 @@ static inline void vop_mask_write_relaxed(struct vop *vop, uint32_t offset,
352
354
}
353
355
}
354
356
357
+ static bool has_rb_swapped (uint32_t format )
358
+ {
359
+ switch (format ) {
360
+ case DRM_FORMAT_XBGR8888 :
361
+ case DRM_FORMAT_ABGR8888 :
362
+ case DRM_FORMAT_BGR888 :
363
+ case DRM_FORMAT_BGR565 :
364
+ return true;
365
+ default :
366
+ return false;
367
+ }
368
+ }
369
+
355
370
static enum vop_data_format vop_convert_format (uint32_t format )
356
371
{
357
372
switch (format ) {
358
373
case DRM_FORMAT_XRGB8888 :
359
374
case DRM_FORMAT_ARGB8888 :
375
+ case DRM_FORMAT_XBGR8888 :
376
+ case DRM_FORMAT_ABGR8888 :
360
377
return VOP_FMT_ARGB8888 ;
361
378
case DRM_FORMAT_RGB888 :
379
+ case DRM_FORMAT_BGR888 :
362
380
return VOP_FMT_RGB888 ;
363
381
case DRM_FORMAT_RGB565 :
382
+ case DRM_FORMAT_BGR565 :
364
383
return VOP_FMT_RGB565 ;
365
384
case DRM_FORMAT_NV12 :
366
385
return VOP_FMT_YUV420SP ;
@@ -378,6 +397,7 @@ static bool is_alpha_support(uint32_t format)
378
397
{
379
398
switch (format ) {
380
399
case DRM_FORMAT_ARGB8888 :
400
+ case DRM_FORMAT_ABGR8888 :
381
401
return true;
382
402
default :
383
403
return false;
@@ -588,6 +608,7 @@ static int vop_update_plane_event(struct drm_plane *plane,
588
608
enum vop_data_format format ;
589
609
uint32_t val ;
590
610
bool is_alpha ;
611
+ bool rb_swap ;
591
612
bool visible ;
592
613
int ret ;
593
614
struct drm_rect dest = {
@@ -621,6 +642,7 @@ static int vop_update_plane_event(struct drm_plane *plane,
621
642
return 0 ;
622
643
623
644
is_alpha = is_alpha_support (fb -> pixel_format );
645
+ rb_swap = has_rb_swapped (fb -> pixel_format );
624
646
format = vop_convert_format (fb -> pixel_format );
625
647
if (format < 0 )
626
648
return format ;
@@ -689,6 +711,7 @@ static int vop_update_plane_event(struct drm_plane *plane,
689
711
val = (dsp_sty - 1 ) << 16 ;
690
712
val |= (dsp_stx - 1 ) & 0xffff ;
691
713
VOP_WIN_SET (vop , win , dsp_st , val );
714
+ VOP_WIN_SET (vop , win , rb_swap , rb_swap );
692
715
693
716
if (is_alpha ) {
694
717
VOP_WIN_SET (vop , win , dst_alpha_ctl ,
0 commit comments