Skip to content

Commit 818182d

Browse files
committed
Merge tag 'imx-drm-next-2018-12-03' of git://git.pengutronix.de/git/pza/linux into drm-next
drm/imx: update image-convert with fixes for multi-tiled scaling Update the ipu-v3 mem2mem image-convert code, with some fixes for race conditions, alignment issues, and visual artifacts due to tile alignment and scaling factor issues when scaling images larger than hardware limitations in multiple tiles. This will allow the V4L2 mem2mem scaler driver to write output images larger than 1024x1024 pixels. Also switch drm/imx source files to SPDX license identifiers, constify struct clk_ops in imx-tve, and add a timeout warning to the busy wait in ipu_plane_disable(). Signed-off-by: Dave Airlie <airlied@redhat.com> From: Philipp Zabel <p.zabel@pengutronix.de> Link: https://patchwork.freedesktop.org/patch/msgid/1543835266.5647.1.camel@pengutronix.de
2 parents 167bfe5 + 97c78f4 commit 818182d

11 files changed

Lines changed: 940 additions & 268 deletions

File tree

‎drivers/gpu/drm/imx/dw_hdmi-imx.c‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
1+
// SPDX-License-Identifier: GPL-2.0
12
/* Copyright (C) 2011-2013 Freescale Semiconductor, Inc.
23
*
34
* derived from imx-hdmi.c(renamed to bridge/dw_hdmi.c now)
4-
*
5-
* This program is free software; you can redistribute it and/or modify
6-
* it under the terms of the GNU General Public License version 2 as
7-
* published by the Free Software Foundation.
85
*/
96
#include <linux/module.h>
107
#include <linux/platform_device.h>

‎drivers/gpu/drm/imx/imx-drm-core.c‎

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,8 @@
1+
// SPDX-License-Identifier: GPL-2.0+
12
/*
23
* Freescale i.MX drm driver
34
*
45
* Copyright (C) 2011 Sascha Hauer, Pengutronix
5-
*
6-
* This program is free software; you can redistribute it and/or
7-
* modify it under the terms of the GNU General Public License
8-
* as published by the Free Software Foundation; either version 2
9-
* of the License, or (at your option) any later version.
10-
* This program is distributed in the hope that it will be useful,
11-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13-
* GNU General Public License for more details.
14-
*
156
*/
167
#include <linux/component.h>
178
#include <linux/device.h>

‎drivers/gpu/drm/imx/imx-ldb.c‎

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,8 @@
1+
// SPDX-License-Identifier: GPL-2.0+
12
/*
23
* i.MX drm driver - LVDS display bridge
34
*
45
* Copyright (C) 2012 Sascha Hauer, Pengutronix
5-
*
6-
* This program is free software; you can redistribute it and/or
7-
* modify it under the terms of the GNU General Public License
8-
* as published by the Free Software Foundation; either version 2
9-
* of the License, or (at your option) any later version.
10-
* This program is distributed in the hope that it will be useful,
11-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13-
* GNU General Public License for more details.
146
*/
157

168
#include <linux/module.h>

‎drivers/gpu/drm/imx/imx-tve.c‎

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,8 @@
1+
// SPDX-License-Identifier: GPL-2.0+
12
/*
23
* i.MX drm driver - Television Encoder (TVEv2)
34
*
45
* Copyright (C) 2013 Philipp Zabel, Pengutronix
5-
*
6-
* This program is free software; you can redistribute it and/or
7-
* modify it under the terms of the GNU General Public License
8-
* as published by the Free Software Foundation; either version 2
9-
* of the License, or (at your option) any later version.
10-
* This program is distributed in the hope that it will be useful,
11-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13-
* GNU General Public License for more details.
146
*/
157

168
#include <linux/clk.h>
@@ -442,7 +434,7 @@ static int clk_tve_di_set_rate(struct clk_hw *hw, unsigned long rate,
442434
return 0;
443435
}
444436

445-
static struct clk_ops clk_tve_di_ops = {
437+
static const struct clk_ops clk_tve_di_ops = {
446438
.round_rate = clk_tve_di_round_rate,
447439
.set_rate = clk_tve_di_set_rate,
448440
.recalc_rate = clk_tve_di_recalc_rate,

‎drivers/gpu/drm/imx/ipuv3-crtc.c‎

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,8 @@
1+
// SPDX-License-Identifier: GPL-2.0+
12
/*
23
* i.MX IPUv3 Graphics driver
34
*
45
* Copyright (C) 2011 Sascha Hauer, Pengutronix
5-
*
6-
* This program is free software; you can redistribute it and/or
7-
* modify it under the terms of the GNU General Public License
8-
* as published by the Free Software Foundation; either version 2
9-
* of the License, or (at your option) any later version.
10-
* This program is distributed in the hope that it will be useful,
11-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13-
* GNU General Public License for more details.
146
*/
157
#include <linux/component.h>
168
#include <linux/module.h>

‎drivers/gpu/drm/imx/ipuv3-plane.c‎

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,8 @@
1+
// SPDX-License-Identifier: GPL-2.0+
12
/*
23
* i.MX IPUv3 DP Overlay Planes
34
*
45
* Copyright (C) 2013 Philipp Zabel, Pengutronix
5-
*
6-
* This program is free software; you can redistribute it and/or
7-
* modify it under the terms of the GNU General Public License
8-
* as published by the Free Software Foundation; either version 2
9-
* of the License, or (at your option) any later version.
10-
* This program is distributed in the hope that it will be useful,
11-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13-
* GNU General Public License for more details.
146
*/
157

168
#include <drm/drmP.h>
@@ -236,9 +228,15 @@ static void ipu_plane_enable(struct ipu_plane *ipu_plane)
236228

237229
void ipu_plane_disable(struct ipu_plane *ipu_plane, bool disable_dp_channel)
238230
{
231+
int ret;
232+
239233
DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__);
240234

241-
ipu_idmac_wait_busy(ipu_plane->ipu_ch, 50);
235+
ret = ipu_idmac_wait_busy(ipu_plane->ipu_ch, 50);
236+
if (ret == -ETIMEDOUT) {
237+
DRM_ERROR("[PLANE:%d] IDMAC timeout\n",
238+
ipu_plane->base.base.id);
239+
}
242240

243241
if (ipu_plane->dp && disable_dp_channel)
244242
ipu_dp_disable_channel(ipu_plane->dp, false);

‎drivers/gpu/drm/imx/parallel-display.c‎

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,8 @@
1+
// SPDX-License-Identifier: GPL-2.0+
12
/*
23
* i.MX drm driver - parallel display implementation
34
*
45
* Copyright (C) 2012 Sascha Hauer, Pengutronix
5-
*
6-
* This program is free software; you can redistribute it and/or
7-
* modify it under the terms of the GNU General Public License
8-
* as published by the Free Software Foundation; either version 2
9-
* of the License, or (at your option) any later version.
10-
* This program is distributed in the hope that it will be useful,
11-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13-
* GNU General Public License for more details.
146
*/
157

168
#include <linux/component.h>

‎drivers/gpu/ipu-v3/ipu-cpmem.c‎

Lines changed: 33 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,8 @@ EXPORT_SYMBOL_GPL(ipu_cpmem_set_high_priority);
259259

260260
void ipu_cpmem_set_buffer(struct ipuv3_channel *ch, int bufnum, dma_addr_t buf)
261261
{
262+
WARN_ON_ONCE(buf & 0x7);
263+
262264
if (bufnum)
263265
ipu_ch_param_write_field(ch, IPU_FIELD_EBA1, buf >> 3);
264266
else
@@ -268,6 +270,8 @@ EXPORT_SYMBOL_GPL(ipu_cpmem_set_buffer);
268270

269271
void ipu_cpmem_set_uv_offset(struct ipuv3_channel *ch, u32 u_off, u32 v_off)
270272
{
273+
WARN_ON_ONCE((u_off & 0x7) || (v_off & 0x7));
274+
271275
ipu_ch_param_write_field(ch, IPU_FIELD_UBO, u_off / 8);
272276
ipu_ch_param_write_field(ch, IPU_FIELD_VBO, v_off / 8);
273277
}
@@ -435,6 +439,8 @@ void ipu_cpmem_set_yuv_planar_full(struct ipuv3_channel *ch,
435439
unsigned int uv_stride,
436440
unsigned int u_offset, unsigned int v_offset)
437441
{
442+
WARN_ON_ONCE((u_offset & 0x7) || (v_offset & 0x7));
443+
438444
ipu_ch_param_write_field(ch, IPU_FIELD_SLUV, uv_stride - 1);
439445
ipu_ch_param_write_field(ch, IPU_FIELD_UBO, u_offset / 8);
440446
ipu_ch_param_write_field(ch, IPU_FIELD_VBO, v_offset / 8);
@@ -739,48 +745,56 @@ int ipu_cpmem_set_image(struct ipuv3_channel *ch, struct ipu_image *image)
739745
switch (pix->pixelformat) {
740746
case V4L2_PIX_FMT_YUV420:
741747
offset = Y_OFFSET(pix, image->rect.left, image->rect.top);
742-
u_offset = U_OFFSET(pix, image->rect.left,
743-
image->rect.top) - offset;
744-
v_offset = V_OFFSET(pix, image->rect.left,
745-
image->rect.top) - offset;
748+
u_offset = image->u_offset ?
749+
image->u_offset : U_OFFSET(pix, image->rect.left,
750+
image->rect.top) - offset;
751+
v_offset = image->v_offset ?
752+
image->v_offset : V_OFFSET(pix, image->rect.left,
753+
image->rect.top) - offset;
746754

747755
ipu_cpmem_set_yuv_planar_full(ch, pix->bytesperline / 2,
748756
u_offset, v_offset);
749757
break;
750758
case V4L2_PIX_FMT_YVU420:
751759
offset = Y_OFFSET(pix, image->rect.left, image->rect.top);
752-
u_offset = U_OFFSET(pix, image->rect.left,
753-
image->rect.top) - offset;
754-
v_offset = V_OFFSET(pix, image->rect.left,
755-
image->rect.top) - offset;
760+
u_offset = image->u_offset ?
761+
image->u_offset : V_OFFSET(pix, image->rect.left,
762+
image->rect.top) - offset;
763+
v_offset = image->v_offset ?
764+
image->v_offset : U_OFFSET(pix, image->rect.left,
765+
image->rect.top) - offset;
756766

757767
ipu_cpmem_set_yuv_planar_full(ch, pix->bytesperline / 2,
758-
v_offset, u_offset);
768+
u_offset, v_offset);
759769
break;
760770
case V4L2_PIX_FMT_YUV422P:
761771
offset = Y_OFFSET(pix, image->rect.left, image->rect.top);
762-
u_offset = U2_OFFSET(pix, image->rect.left,
763-
image->rect.top) - offset;
764-
v_offset = V2_OFFSET(pix, image->rect.left,
765-
image->rect.top) - offset;
772+
u_offset = image->u_offset ?
773+
image->u_offset : U2_OFFSET(pix, image->rect.left,
774+
image->rect.top) - offset;
775+
v_offset = image->v_offset ?
776+
image->v_offset : V2_OFFSET(pix, image->rect.left,
777+
image->rect.top) - offset;
766778

767779
ipu_cpmem_set_yuv_planar_full(ch, pix->bytesperline / 2,
768780
u_offset, v_offset);
769781
break;
770782
case V4L2_PIX_FMT_NV12:
771783
offset = Y_OFFSET(pix, image->rect.left, image->rect.top);
772-
u_offset = UV_OFFSET(pix, image->rect.left,
773-
image->rect.top) - offset;
774-
v_offset = 0;
784+
u_offset = image->u_offset ?
785+
image->u_offset : UV_OFFSET(pix, image->rect.left,
786+
image->rect.top) - offset;
787+
v_offset = image->v_offset ? image->v_offset : 0;
775788

776789
ipu_cpmem_set_yuv_planar_full(ch, pix->bytesperline,
777790
u_offset, v_offset);
778791
break;
779792
case V4L2_PIX_FMT_NV16:
780793
offset = Y_OFFSET(pix, image->rect.left, image->rect.top);
781-
u_offset = UV2_OFFSET(pix, image->rect.left,
782-
image->rect.top) - offset;
783-
v_offset = 0;
794+
u_offset = image->u_offset ?
795+
image->u_offset : UV2_OFFSET(pix, image->rect.left,
796+
image->rect.top) - offset;
797+
v_offset = image->v_offset ? image->v_offset : 0;
784798

785799
ipu_cpmem_set_yuv_planar_full(ch, pix->bytesperline,
786800
u_offset, v_offset);

‎drivers/gpu/ipu-v3/ipu-ic.c‎

Lines changed: 33 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -442,36 +442,40 @@ int ipu_ic_task_graphics_init(struct ipu_ic *ic,
442442
}
443443
EXPORT_SYMBOL_GPL(ipu_ic_task_graphics_init);
444444

445-
int ipu_ic_task_init(struct ipu_ic *ic,
446-
int in_width, int in_height,
447-
int out_width, int out_height,
448-
enum ipu_color_space in_cs,
449-
enum ipu_color_space out_cs)
445+
int ipu_ic_task_init_rsc(struct ipu_ic *ic,
446+
int in_width, int in_height,
447+
int out_width, int out_height,
448+
enum ipu_color_space in_cs,
449+
enum ipu_color_space out_cs,
450+
u32 rsc)
450451
{
451452
struct ipu_ic_priv *priv = ic->priv;
452-
u32 reg, downsize_coeff, resize_coeff;
453+
u32 downsize_coeff, resize_coeff;
453454
unsigned long flags;
454455
int ret = 0;
455456

456-
/* Setup vertical resizing */
457-
ret = calc_resize_coeffs(ic, in_height, out_height,
458-
&resize_coeff, &downsize_coeff);
459-
if (ret)
460-
return ret;
457+
if (!rsc) {
458+
/* Setup vertical resizing */
461459

462-
reg = (downsize_coeff << 30) | (resize_coeff << 16);
460+
ret = calc_resize_coeffs(ic, in_height, out_height,
461+
&resize_coeff, &downsize_coeff);
462+
if (ret)
463+
return ret;
464+
465+
rsc = (downsize_coeff << 30) | (resize_coeff << 16);
463466

464-
/* Setup horizontal resizing */
465-
ret = calc_resize_coeffs(ic, in_width, out_width,
466-
&resize_coeff, &downsize_coeff);
467-
if (ret)
468-
return ret;
467+
/* Setup horizontal resizing */
468+
ret = calc_resize_coeffs(ic, in_width, out_width,
469+
&resize_coeff, &downsize_coeff);
470+
if (ret)
471+
return ret;
469472

470-
reg |= (downsize_coeff << 14) | resize_coeff;
473+
rsc |= (downsize_coeff << 14) | resize_coeff;
474+
}
471475

472476
spin_lock_irqsave(&priv->lock, flags);
473477

474-
ipu_ic_write(ic, reg, ic->reg->rsc);
478+
ipu_ic_write(ic, rsc, ic->reg->rsc);
475479

476480
/* Setup color space conversion */
477481
ic->in_cs = in_cs;
@@ -487,6 +491,16 @@ int ipu_ic_task_init(struct ipu_ic *ic,
487491
spin_unlock_irqrestore(&priv->lock, flags);
488492
return ret;
489493
}
494+
495+
int ipu_ic_task_init(struct ipu_ic *ic,
496+
int in_width, int in_height,
497+
int out_width, int out_height,
498+
enum ipu_color_space in_cs,
499+
enum ipu_color_space out_cs)
500+
{
501+
return ipu_ic_task_init_rsc(ic, in_width, in_height, out_width,
502+
out_height, in_cs, out_cs, 0);
503+
}
490504
EXPORT_SYMBOL_GPL(ipu_ic_task_init);
491505

492506
int ipu_ic_task_idma_init(struct ipu_ic *ic, struct ipuv3_channel *channel,

0 commit comments

Comments
 (0)