Skip to content

Commit 28391e8

Browse files
6by9popcornmix
authored andcommitted
drm/vc4: hvs: Defer updating the enable_bg_fill until vblank
The register to enable/disable background fill was being set from atomic flush, however that will be applied immediately and can be a while before the vblank. If it was required for the current frame but not for the next one, that can result in corruption for part of the current frame. Store the state in vc4_hvs, and update it on vblank. Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
1 parent ac4119a commit 28391e8

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

drivers/gpu/drm/vc4/vc4_drv.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,8 @@ struct vc4_hvs {
366366
unsigned int enabled: 1;
367367
} eof_irq[HVS_NUM_CHANNELS];
368368

369+
bool bg_fill[HVS_NUM_CHANNELS];
370+
369371
unsigned long max_core_rate;
370372

371373
/* Memory manager for CRTCs to allocate space in the display

drivers/gpu/drm/vc4/vc4_hvs.c

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1509,14 +1509,7 @@ void vc4_hvs_atomic_flush(struct drm_crtc *crtc,
15091509
/* This sets a black background color fill, as is the case
15101510
* with other DRM drivers.
15111511
*/
1512-
if (enable_bg_fill)
1513-
HVS_WRITE(SCALER6_DISPX_CTRL1(channel),
1514-
HVS_READ(SCALER6_DISPX_CTRL1(channel)) |
1515-
SCALER6(DISPX_CTRL1_BGENB));
1516-
else
1517-
HVS_WRITE(SCALER6_DISPX_CTRL1(channel),
1518-
HVS_READ(SCALER6_DISPX_CTRL1(channel)) &
1519-
~SCALER6(DISPX_CTRL1_BGENB));
1512+
hvs->bg_fill[channel] = enable_bg_fill;
15201513
} else {
15211514
/* we can actually run with a lower core clock when background
15221515
* fill is enabled on VC4_GEN_5 so leave it enabled always.
@@ -1700,6 +1693,15 @@ static irqreturn_t vc6_hvs_eof_irq_handler(int irq, void *data)
17001693
if (hvs->eof_irq[i].desc != irq)
17011694
continue;
17021695

1696+
if (hvs->bg_fill[i])
1697+
HVS_WRITE(SCALER6_DISPX_CTRL1(i),
1698+
HVS_READ(SCALER6_DISPX_CTRL1(i)) |
1699+
SCALER6(DISPX_CTRL1_BGENB));
1700+
else
1701+
HVS_WRITE(SCALER6_DISPX_CTRL1(i),
1702+
HVS_READ(SCALER6_DISPX_CTRL1(i)) &
1703+
~SCALER6(DISPX_CTRL1_BGENB));
1704+
17031705
vc4_hvs_schedule_dlist_sweep(hvs, i);
17041706
return IRQ_HANDLED;
17051707
}

0 commit comments

Comments
 (0)