Skip to content

Commit f09e5b5

Browse files
author
Laurent Pinchart
committed
drm: rcar-du: Update framebuffer pitch and alignment limits for Gen3
The framebuffer pitch and alignment constraints reflect the limitations of the Gen2 DU hardware. On Gen3, the DU has no memory interface and thus doesn't impose any constraint. The limitations come instead from the VSP that has a limit of 65535 bytes for the pitch and no alignment constraint. Update the checks accordingly. Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
1 parent 0f35b25 commit f09e5b5

File tree

1 file changed

+23
-12
lines changed

1 file changed

+23
-12
lines changed

drivers/gpu/drm/rcar-du/rcar_du_kms.c

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,6 @@ rcar_du_fb_create(struct drm_device *dev, struct drm_file *file_priv,
204204
const struct rcar_du_format_info *format;
205205
unsigned int max_pitch;
206206
unsigned int align;
207-
unsigned int bpp;
208207
unsigned int i;
209208

210209
format = rcar_du_format_info(mode_cmd->pixel_format);
@@ -214,20 +213,32 @@ rcar_du_fb_create(struct drm_device *dev, struct drm_file *file_priv,
214213
return ERR_PTR(-EINVAL);
215214
}
216215

217-
/*
218-
* The pitch and alignment constraints are expressed in pixels on the
219-
* hardware side and in bytes in the DRM API.
220-
*/
221-
bpp = format->planes == 1 ? format->bpp / 8 : 1;
222-
max_pitch = 4096 * bpp;
216+
if (rcdu->info->gen < 3) {
217+
/*
218+
* On Gen2 the DU limits the pitch to 4095 pixels and requires
219+
* buffers to be aligned to a 16 pixels boundary (or 128 bytes
220+
* on some platforms).
221+
*/
222+
unsigned int bpp = format->planes == 1 ? format->bpp / 8 : 1;
223223

224-
if (rcar_du_needs(rcdu, RCAR_DU_QUIRK_ALIGN_128B))
225-
align = 128;
226-
else
227-
align = 16 * bpp;
224+
max_pitch = 4095 * bpp;
225+
226+
if (rcar_du_needs(rcdu, RCAR_DU_QUIRK_ALIGN_128B))
227+
align = 128;
228+
else
229+
align = 16 * bpp;
230+
} else {
231+
/*
232+
* On Gen3 the memory interface is handled by the VSP that
233+
* limits the pitch to 65535 bytes and has no alignment
234+
* constraint.
235+
*/
236+
max_pitch = 65535;
237+
align = 1;
238+
}
228239

229240
if (mode_cmd->pitches[0] & (align - 1) ||
230-
mode_cmd->pitches[0] >= max_pitch) {
241+
mode_cmd->pitches[0] > max_pitch) {
231242
dev_dbg(dev->dev, "invalid pitch value %u\n",
232243
mode_cmd->pitches[0]);
233244
return ERR_PTR(-EINVAL);

0 commit comments

Comments
 (0)