Skip to content

Commit 1d9c54c

Browse files
mripardpopcornmix
authored andcommitted
drm/vc4: plane: Use dlist offset instead of pointer
The current code passes the dlist pointer to vc4_plane_write_dlist to tell where in the dlist RAM to store the plane dlist content. In order to ease later changes, let's move that direct pointer to a base offset from the start of the dlist RAM. Signed-off-by: Maxime Ripard <[email protected]>
1 parent 2fcefff commit 1d9c54c

File tree

3 files changed

+22
-13
lines changed

3 files changed

+22
-13
lines changed

drivers/gpu/drm/vc4/vc4_drv.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -983,7 +983,10 @@ int vc4_kms_load(struct drm_device *dev);
983983
struct drm_plane *vc4_plane_init(struct drm_device *dev,
984984
enum drm_plane_type type);
985985
int vc4_plane_create_additional_planes(struct drm_device *dev);
986-
u32 vc4_plane_write_dlist(struct drm_plane *plane, u32 __iomem *dlist);
986+
u32 vc4_plane_write_dlist(struct vc4_hvs *hvs,
987+
struct vc4_crtc_state *vc4_crtc_state,
988+
struct vc4_plane_state *vc4_plane_state,
989+
unsigned dlist_offset);
987990
u32 vc4_plane_dlist_size(const struct drm_plane_state *state);
988991
void vc4_plane_async_set_fb(struct drm_plane *plane,
989992
struct drm_framebuffer *fb);

drivers/gpu/drm/vc4/vc4_hvs.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -677,14 +677,14 @@ void vc4_hvs_atomic_flush(struct drm_crtc *crtc,
677677
crtc);
678678
struct drm_device *dev = crtc->dev;
679679
struct vc4_dev *vc4 = to_vc4_dev(dev);
680+
struct vc4_hvs *hvs = vc4->hvs;
680681
struct vc4_crtc_state *vc4_state = to_vc4_crtc_state(crtc->state);
681682
unsigned int channel = vc4_state->assigned_channel;
682683
struct drm_plane *plane;
683-
struct vc4_plane_state *vc4_plane_state;
684684
bool debug_dump_regs = false;
685685
bool enable_bg_fill = false;
686-
u32 __iomem *dlist_start = vc4->hvs->dlist + vc4_state->mm.start;
687-
u32 __iomem *dlist_next = dlist_start;
686+
unsigned int dlist_start = vc4_state->mm.start;
687+
unsigned int dlist_next = dlist_start;
688688

689689
if (vc4_state->assigned_channel == VC4_HVS_CHANNEL_DISABLED)
690690
return;
@@ -696,6 +696,9 @@ void vc4_hvs_atomic_flush(struct drm_crtc *crtc,
696696

697697
/* Copy all the active planes' dlist contents to the hardware dlist. */
698698
drm_atomic_crtc_for_each_plane(plane, crtc) {
699+
struct vc4_plane_state *vc4_plane_state =
700+
to_vc4_plane_state(plane->state);
701+
699702
/* Is this the first active plane? */
700703
if (dlist_next == dlist_start) {
701704
/* We need to enable background fill when a plane
@@ -706,14 +709,14 @@ void vc4_hvs_atomic_flush(struct drm_crtc *crtc,
706709
* already needs it or all planes on top blend from
707710
* the first or a lower plane.
708711
*/
709-
vc4_plane_state = to_vc4_plane_state(plane->state);
710712
enable_bg_fill = vc4_plane_state->needs_bg_fill;
711713
}
712714

713-
dlist_next += vc4_plane_write_dlist(plane, dlist_next);
715+
dlist_next += vc4_plane_write_dlist(hvs, vc4_state,
716+
vc4_plane_state, dlist_next);
714717
}
715718

716-
writel(SCALER_CTL0_END, dlist_next);
719+
writel(SCALER_CTL0_END, vc4->hvs->dlist + dlist_next);
717720
dlist_next++;
718721

719722
WARN_ON_ONCE(dlist_next - dlist_start != vc4_state->mm.size);

drivers/gpu/drm/vc4/vc4_plane.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1181,18 +1181,21 @@ static void vc4_plane_atomic_update(struct drm_plane *plane,
11811181
*/
11821182
}
11831183

1184-
u32 vc4_plane_write_dlist(struct drm_plane *plane, u32 __iomem *dlist)
1184+
u32 vc4_plane_write_dlist(struct vc4_hvs *hvs,
1185+
struct vc4_crtc_state *vc4_crtc_state,
1186+
struct vc4_plane_state *vc4_plane_state,
1187+
unsigned dlist_offset)
11851188
{
1186-
struct vc4_plane_state *vc4_state = to_vc4_plane_state(plane->state);
1189+
u32 __iomem *dlist = hvs->dlist + dlist_offset;
11871190
int i;
11881191

1189-
vc4_state->hw_dlist = dlist;
1192+
vc4_plane_state->hw_dlist = dlist;
11901193

11911194
/* Can't memcpy_toio() because it needs to be 32-bit writes. */
1192-
for (i = 0; i < vc4_state->dlist_count; i++)
1193-
writel(vc4_state->dlist[i], &dlist[i]);
1195+
for (i = 0; i < vc4_plane_state->dlist_count; i++)
1196+
writel(vc4_plane_state->dlist[i], &dlist[i]);
11941197

1195-
return vc4_state->dlist_count;
1198+
return vc4_plane_state->dlist_count;
11961199
}
11971200

11981201
u32 vc4_plane_dlist_size(const struct drm_plane_state *state)

0 commit comments

Comments
 (0)