Skip to content

Commit 6a60920

Browse files
committed
drm/vc4: Initialize scaler DISPBKGND on modeset.
We weren't updating the interlaced bit, so we'd scan out incorrectly if the firmware had brought up the TV encoder and we were switching to HDMI. Signed-off-by: Eric Anholt <eric@anholt.net>
1 parent a7c5047 commit 6a60920

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

drivers/gpu/drm/vc4/vc4_crtc.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,8 @@ static int vc4_get_clock_select(struct drm_crtc *crtc)
183183

184184
static void vc4_crtc_mode_set_nofb(struct drm_crtc *crtc)
185185
{
186+
struct drm_device *dev = crtc->dev;
187+
struct vc4_dev *vc4 = to_vc4_dev(dev);
186188
struct vc4_crtc *vc4_crtc = to_vc4_crtc(crtc);
187189
struct drm_crtc_state *state = crtc->state;
188190
struct drm_display_mode *mode = &state->adjusted_mode;
@@ -251,6 +253,10 @@ static void vc4_crtc_mode_set_nofb(struct drm_crtc *crtc)
251253
PV_CONTROL_FIFO_CLR |
252254
PV_CONTROL_EN);
253255

256+
HVS_WRITE(SCALER_DISPBKGNDX(vc4_crtc->channel),
257+
SCALER_DISPBKGND_AUTOHS |
258+
(interlace ? SCALER_DISPBKGND_INTERLACE : 0));
259+
254260
if (debug_dump_regs) {
255261
DRM_INFO("CRTC %d regs after:\n", drm_crtc_index(crtc));
256262
vc4_crtc_dump_regs(vc4_crtc);

drivers/gpu/drm/vc4/vc4_regs.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,17 @@
350350
# define SCALER_DISPCTRLX_HEIGHT_SHIFT 0
351351

352352
#define SCALER_DISPBKGND0 0x00000044
353+
# define SCALER_DISPBKGND_AUTOHS BIT(31)
354+
# define SCALER_DISPBKGND_INTERLACE BIT(30)
355+
# define SCALER_DISPBKGND_GAMMA BIT(29)
356+
# define SCALER_DISPBKGND_TESTMODE_MASK VC4_MASK(28, 25)
357+
# define SCALER_DISPBKGND_TESTMODE_SHIFT 25
358+
/* Enables filling the scaler line with the RGB value in the low 24
359+
* bits before compositing. Costs cycles, so should be skipped if
360+
* opaque display planes will cover everything.
361+
*/
362+
# define SCALER_DISPBKGND_FILL BIT(24)
363+
353364
#define SCALER_DISPSTAT0 0x00000048
354365
#define SCALER_DISPBASE0 0x0000004c
355366
# define SCALER_DISPSTATX_MODE_MASK VC4_MASK(31, 30)
@@ -362,6 +373,9 @@
362373
# define SCALER_DISPSTATX_EMPTY BIT(28)
363374
#define SCALER_DISPCTRL1 0x00000050
364375
#define SCALER_DISPBKGND1 0x00000054
376+
#define SCALER_DISPBKGNDX(x) (SCALER_DISPBKGND0 + \
377+
(x) * (SCALER_DISPBKGND1 - \
378+
SCALER_DISPBKGND0))
365379
#define SCALER_DISPSTAT1 0x00000058
366380
#define SCALER_DISPSTATX(x) (SCALER_DISPSTAT0 + \
367381
(x) * (SCALER_DISPSTAT1 - \

0 commit comments

Comments
 (0)