Skip to content

drm/vc4: Fix reading of frame count on GEN5 / Pi4 #5823

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 21 additions & 2 deletions drivers/gpu/drm/vc4/vc4_hvs.c
Original file line number Diff line number Diff line change
Expand Up @@ -823,10 +823,28 @@ u8 vc4_hvs_get_fifo_frame_count(struct vc4_hvs *hvs, unsigned int fifo)
if (!drm_dev_enter(drm, &idx))
return 0;

if (vc4->gen >= VC4_GEN_6) {
switch (vc4->gen) {
case VC4_GEN_6:
field = VC4_GET_FIELD(HVS_READ(SCALER6_DISPX_STATUS(fifo)),
SCALER6_DISPX_STATUS_FRCNT);
} else {
break;
case VC4_GEN_5:
switch (fifo) {
case 0:
field = VC4_GET_FIELD(HVS_READ(SCALER_DISPSTAT1),
SCALER5_DISPSTAT1_FRCNT0);
break;
case 1:
field = VC4_GET_FIELD(HVS_READ(SCALER_DISPSTAT1),
SCALER5_DISPSTAT1_FRCNT1);
break;
case 2:
field = VC4_GET_FIELD(HVS_READ(SCALER_DISPSTAT2),
SCALER5_DISPSTAT2_FRCNT2);
break;
}
break;
case VC4_GEN_4:
switch (fifo) {
case 0:
field = VC4_GET_FIELD(HVS_READ(SCALER_DISPSTAT1),
Expand All @@ -841,6 +859,7 @@ u8 vc4_hvs_get_fifo_frame_count(struct vc4_hvs *hvs, unsigned int fifo)
SCALER_DISPSTAT2_FRCNT2);
break;
}
break;
}

drm_dev_exit(idx);
Expand Down
6 changes: 6 additions & 0 deletions drivers/gpu/drm/vc4/vc4_regs.h
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,10 @@
# define SCALER_DISPSTAT1_FRCNT0_SHIFT 18
# define SCALER_DISPSTAT1_FRCNT1_MASK VC4_MASK(17, 12)
# define SCALER_DISPSTAT1_FRCNT1_SHIFT 12
# define SCALER5_DISPSTAT1_FRCNT0_MASK VC4_MASK(25, 20)
# define SCALER5_DISPSTAT1_FRCNT0_SHIFT 20
# define SCALER5_DISPSTAT1_FRCNT1_MASK VC4_MASK(19, 14)
# define SCALER5_DISPSTAT1_FRCNT1_SHIFT 14

#define SCALER_DISPSTATX(x) (SCALER_DISPSTAT0 + \
(x) * (SCALER_DISPSTAT1 - \
Expand All @@ -442,6 +446,8 @@
#define SCALER_DISPSTAT2 0x00000068
# define SCALER_DISPSTAT2_FRCNT2_MASK VC4_MASK(17, 12)
# define SCALER_DISPSTAT2_FRCNT2_SHIFT 12
# define SCALER5_DISPSTAT2_FRCNT2_MASK VC4_MASK(19, 14)
# define SCALER5_DISPSTAT2_FRCNT2_SHIFT 14

#define SCALER_DISPBASE2 0x0000006c
#define SCALER_DISPALPHA2 0x00000070
Expand Down