@@ -169,6 +169,7 @@ struct vop_win_phy {
169
169
170
170
struct vop_reg enable ;
171
171
struct vop_reg format ;
172
+ struct vop_reg rb_swap ;
172
173
struct vop_reg act_info ;
173
174
struct vop_reg dsp_info ;
174
175
struct vop_reg dsp_st ;
@@ -198,8 +199,12 @@ struct vop_data {
198
199
static const uint32_t formats_01 [] = {
199
200
DRM_FORMAT_XRGB8888 ,
200
201
DRM_FORMAT_ARGB8888 ,
202
+ DRM_FORMAT_XBGR8888 ,
203
+ DRM_FORMAT_ABGR8888 ,
201
204
DRM_FORMAT_RGB888 ,
205
+ DRM_FORMAT_BGR888 ,
202
206
DRM_FORMAT_RGB565 ,
207
+ DRM_FORMAT_BGR565 ,
203
208
DRM_FORMAT_NV12 ,
204
209
DRM_FORMAT_NV16 ,
205
210
DRM_FORMAT_NV24 ,
@@ -208,15 +213,20 @@ static const uint32_t formats_01[] = {
208
213
static const uint32_t formats_234 [] = {
209
214
DRM_FORMAT_XRGB8888 ,
210
215
DRM_FORMAT_ARGB8888 ,
216
+ DRM_FORMAT_XBGR8888 ,
217
+ DRM_FORMAT_ABGR8888 ,
211
218
DRM_FORMAT_RGB888 ,
219
+ DRM_FORMAT_BGR888 ,
212
220
DRM_FORMAT_RGB565 ,
221
+ DRM_FORMAT_BGR565 ,
213
222
};
214
223
215
224
static const struct vop_win_phy win01_data = {
216
225
.data_formats = formats_01 ,
217
226
.nformats = ARRAY_SIZE (formats_01 ),
218
227
.enable = VOP_REG (WIN0_CTRL0 , 0x1 , 0 ),
219
228
.format = VOP_REG (WIN0_CTRL0 , 0x7 , 1 ),
229
+ .rb_swap = VOP_REG (WIN0_CTRL0 , 0x1 , 12 ),
220
230
.act_info = VOP_REG (WIN0_ACT_INFO , 0x1fff1fff , 0 ),
221
231
.dsp_info = VOP_REG (WIN0_DSP_INFO , 0x0fff0fff , 0 ),
222
232
.dsp_st = VOP_REG (WIN0_DSP_ST , 0x1fff1fff , 0 ),
@@ -233,6 +243,7 @@ static const struct vop_win_phy win23_data = {
233
243
.nformats = ARRAY_SIZE (formats_234 ),
234
244
.enable = VOP_REG (WIN2_CTRL0 , 0x1 , 0 ),
235
245
.format = VOP_REG (WIN2_CTRL0 , 0x7 , 1 ),
246
+ .rb_swap = VOP_REG (WIN2_CTRL0 , 0x1 , 12 ),
236
247
.dsp_info = VOP_REG (WIN2_DSP_INFO0 , 0x0fff0fff , 0 ),
237
248
.dsp_st = VOP_REG (WIN2_DSP_ST0 , 0x1fff1fff , 0 ),
238
249
.yrgb_mst = VOP_REG (WIN2_MST0 , 0xffffffff , 0 ),
@@ -246,6 +257,7 @@ static const struct vop_win_phy cursor_data = {
246
257
.nformats = ARRAY_SIZE (formats_234 ),
247
258
.enable = VOP_REG (HWC_CTRL0 , 0x1 , 0 ),
248
259
.format = VOP_REG (HWC_CTRL0 , 0x7 , 1 ),
260
+ .rb_swap = VOP_REG (HWC_CTRL0 , 0x1 , 12 ),
249
261
.dsp_st = VOP_REG (HWC_DSP_ST , 0x1fff1fff , 0 ),
250
262
.yrgb_mst = VOP_REG (HWC_MST , 0xffffffff , 0 ),
251
263
};
@@ -351,15 +363,32 @@ static inline void vop_mask_write_relaxed(struct vop *vop, uint32_t offset,
351
363
}
352
364
}
353
365
366
+ static bool has_rb_swapped (uint32_t format )
367
+ {
368
+ switch (format ) {
369
+ case DRM_FORMAT_XBGR8888 :
370
+ case DRM_FORMAT_ABGR8888 :
371
+ case DRM_FORMAT_BGR888 :
372
+ case DRM_FORMAT_BGR565 :
373
+ return true;
374
+ default :
375
+ return false;
376
+ }
377
+ }
378
+
354
379
static enum vop_data_format vop_convert_format (uint32_t format )
355
380
{
356
381
switch (format ) {
357
382
case DRM_FORMAT_XRGB8888 :
358
383
case DRM_FORMAT_ARGB8888 :
384
+ case DRM_FORMAT_XBGR8888 :
385
+ case DRM_FORMAT_ABGR8888 :
359
386
return VOP_FMT_ARGB8888 ;
360
387
case DRM_FORMAT_RGB888 :
388
+ case DRM_FORMAT_BGR888 :
361
389
return VOP_FMT_RGB888 ;
362
390
case DRM_FORMAT_RGB565 :
391
+ case DRM_FORMAT_BGR565 :
363
392
return VOP_FMT_RGB565 ;
364
393
case DRM_FORMAT_NV12 :
365
394
return VOP_FMT_YUV420SP ;
@@ -377,6 +406,7 @@ static bool is_alpha_support(uint32_t format)
377
406
{
378
407
switch (format ) {
379
408
case DRM_FORMAT_ARGB8888 :
409
+ case DRM_FORMAT_ABGR8888 :
380
410
return true;
381
411
default :
382
412
return false;
@@ -587,6 +617,7 @@ static int vop_update_plane_event(struct drm_plane *plane,
587
617
enum vop_data_format format ;
588
618
uint32_t val ;
589
619
bool is_alpha ;
620
+ bool rb_swap ;
590
621
bool visible ;
591
622
int ret ;
592
623
struct drm_rect dest = {
@@ -620,6 +651,7 @@ static int vop_update_plane_event(struct drm_plane *plane,
620
651
return 0 ;
621
652
622
653
is_alpha = is_alpha_support (fb -> pixel_format );
654
+ rb_swap = has_rb_swapped (fb -> pixel_format );
623
655
format = vop_convert_format (fb -> pixel_format );
624
656
if (format < 0 )
625
657
return format ;
@@ -688,6 +720,7 @@ static int vop_update_plane_event(struct drm_plane *plane,
688
720
val = (dsp_sty - 1 ) << 16 ;
689
721
val |= (dsp_stx - 1 ) & 0xffff ;
690
722
VOP_WIN_SET (vop , win , dsp_st , val );
723
+ VOP_WIN_SET (vop , win , rb_swap , rb_swap );
691
724
692
725
if (is_alpha ) {
693
726
VOP_WIN_SET (vop , win , dst_alpha_ctl ,
0 commit comments