2018-02-12 08:57:27

by Oleksandr Andrushchenko

[permalink] [raw]
Subject: [PATCH 0/4] drm/simple_kms_helper: Add {enable|disable}_vblank callback support

From: Oleksandr Andrushchenko <[email protected]>

If simple_kms_helper based driver needs to work with vblanks,
then it has to provide drm_driver.{enable|disable}_vblank callbacks,
because drm_simple_kms_helper.drm_crtc_funcs does not provide any.
At the same time drm_driver.{enable|disable}_vblank callbacks
are marked as deprecated and shouldn't be used by new drivers.

Fix this by extending drm_simple_kms_helper.drm_crtc_funcs
to provide the missing callbacks.

Please note, that patch for the DRM core (drm_simple_kms_helper.*)
is checked at run-time (I use this patch for my own driver), but patches
0002-0004 are compile only checked.

Thank you,
Oleksandr Andrushchenko

Oleksandr Andrushchenko (4):
drm/simple_kms_helper: Add {enable|disable}_vblank callback support
drm/mxsfb: Do not use deprecated drm_driver.{enable|disable)_vblank
drm/tve200: Do not use deprecated drm_driver.{enable|disable)_vblank
drm/pl111: Do not use deprecated drm_driver.{enable|disable)_vblank

drivers/gpu/drm/drm_simple_kms_helper.c | 24 +++++++++++++++
drivers/gpu/drm/mxsfb/mxsfb_drv.c | 54 +++++++++++++++++----------------
drivers/gpu/drm/pl111/pl111_display.c | 15 +++++++--
drivers/gpu/drm/pl111/pl111_drm.h | 2 --
drivers/gpu/drm/pl111/pl111_drv.c | 5 ---
drivers/gpu/drm/tve200/tve200_display.c | 10 ++++--
drivers/gpu/drm/tve200/tve200_drm.h | 2 --
drivers/gpu/drm/tve200/tve200_drv.c | 3 --
include/drm/drm_simple_kms_helper.h | 18 +++++++++++
9 files changed, 90 insertions(+), 43 deletions(-)

--
2.7.4



2018-02-12 08:57:41

by Oleksandr Andrushchenko

[permalink] [raw]
Subject: [PATCH 3/4] drm/tve200: Do not use deprecated drm_driver.{enable|disable)_vblank

From: Oleksandr Andrushchenko <[email protected]>

Do not use deprecated drm_driver.{enable|disable)_vblank callbacks,
but use drm_simple_kms_helpe's pipe callbacks instead.

Signed-off-by: Oleksandr Andrushchenko <[email protected]>
Cc: Linus Walleij <[email protected]>
---
drivers/gpu/drm/tve200/tve200_display.c | 10 ++++++++--
drivers/gpu/drm/tve200/tve200_drm.h | 2 --
drivers/gpu/drm/tve200/tve200_drv.c | 3 ---
3 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/tve200/tve200_display.c b/drivers/gpu/drm/tve200/tve200_display.c
index 2c668bd6d997..db397fcb345a 100644
--- a/drivers/gpu/drm/tve200/tve200_display.c
+++ b/drivers/gpu/drm/tve200/tve200_display.c
@@ -273,16 +273,20 @@ static void tve200_display_update(struct drm_simple_display_pipe *pipe,
}
}

-int tve200_enable_vblank(struct drm_device *drm, unsigned int crtc)
+static int tve200_display_enable_vblank(struct drm_simple_display_pipe *pipe)
{
+ struct drm_crtc *crtc = &pipe->crtc;
+ struct drm_device *drm = crtc->dev;
struct tve200_drm_dev_private *priv = drm->dev_private;

writel(TVE200_INT_V_STATUS, priv->regs + TVE200_INT_EN);
return 0;
}

-void tve200_disable_vblank(struct drm_device *drm, unsigned int crtc)
+static void tve200_display_disable_vblank(struct drm_simple_display_pipe *pipe)
{
+ struct drm_crtc *crtc = &pipe->crtc;
+ struct drm_device *drm = crtc->dev;
struct tve200_drm_dev_private *priv = drm->dev_private;

writel(0, priv->regs + TVE200_INT_EN);
@@ -300,6 +304,8 @@ static const struct drm_simple_display_pipe_funcs tve200_display_funcs = {
.disable = tve200_display_disable,
.update = tve200_display_update,
.prepare_fb = tve200_display_prepare_fb,
+ .enable_vblank = tve200_display_enable_vblank,
+ .disable_vblank = tve200_display_disable_vblank,
};

int tve200_display_init(struct drm_device *drm)
diff --git a/drivers/gpu/drm/tve200/tve200_drm.h b/drivers/gpu/drm/tve200/tve200_drm.h
index 5c270055bd58..1ba4380f489b 100644
--- a/drivers/gpu/drm/tve200/tve200_drm.h
+++ b/drivers/gpu/drm/tve200/tve200_drm.h
@@ -113,8 +113,6 @@ struct tve200_drm_dev_private {
container_of(x, struct tve200_drm_connector, connector)

int tve200_display_init(struct drm_device *dev);
-int tve200_enable_vblank(struct drm_device *drm, unsigned int crtc);
-void tve200_disable_vblank(struct drm_device *drm, unsigned int crtc);
irqreturn_t tve200_irq(int irq, void *data);
int tve200_connector_init(struct drm_device *dev);
int tve200_encoder_init(struct drm_device *dev);
diff --git a/drivers/gpu/drm/tve200/tve200_drv.c b/drivers/gpu/drm/tve200/tve200_drv.c
index 44911d921864..ac344ddb23bc 100644
--- a/drivers/gpu/drm/tve200/tve200_drv.c
+++ b/drivers/gpu/drm/tve200/tve200_drv.c
@@ -162,9 +162,6 @@ static struct drm_driver tve200_drm_driver = {
.gem_free_object_unlocked = drm_gem_cma_free_object,
.gem_vm_ops = &drm_gem_cma_vm_ops,

- .enable_vblank = tve200_enable_vblank,
- .disable_vblank = tve200_disable_vblank,
-
.prime_handle_to_fd = drm_gem_prime_handle_to_fd,
.prime_fd_to_handle = drm_gem_prime_fd_to_handle,
.gem_prime_import = drm_gem_prime_import,
--
2.7.4


2018-02-12 08:58:50

by Oleksandr Andrushchenko

[permalink] [raw]
Subject: [PATCH 1/4] drm/simple_kms_helper: Add {enable|disable}_vblank callback support

From: Oleksandr Andrushchenko <[email protected]>

If simple_kms_helper based driver needs to work with vblanks,
then it has to provide drm_driver.{enable|disable}_vblank callbacks,
because drm_simple_kms_helper.drm_crtc_funcs does not provide any.
At the same time drm_driver.{enable|disable}_vblank callbacks
are marked as deprecated and shouldn't be used by new drivers.

Fix this by extending drm_simple_kms_helper.drm_crtc_funcs
to provide the missing callbacks.

Signed-off-by: Oleksandr Andrushchenko <[email protected]>
---
drivers/gpu/drm/drm_simple_kms_helper.c | 24 ++++++++++++++++++++++++
include/drm/drm_simple_kms_helper.h | 18 ++++++++++++++++++
2 files changed, 42 insertions(+)

diff --git a/drivers/gpu/drm/drm_simple_kms_helper.c b/drivers/gpu/drm/drm_simple_kms_helper.c
index 9d3f6b70812c..9ca8a4a59b74 100644
--- a/drivers/gpu/drm/drm_simple_kms_helper.c
+++ b/drivers/gpu/drm/drm_simple_kms_helper.c
@@ -77,6 +77,28 @@ static const struct drm_crtc_helper_funcs drm_simple_kms_crtc_helper_funcs = {
.atomic_disable = drm_simple_kms_crtc_disable,
};

+static int drm_simple_kms_crtc_enable_vblank(struct drm_crtc *crtc)
+{
+ struct drm_simple_display_pipe *pipe;
+
+ pipe = container_of(crtc, struct drm_simple_display_pipe, crtc);
+ if (!pipe->funcs || !pipe->funcs->enable_vblank)
+ return 0;
+
+ return pipe->funcs->enable_vblank(pipe);
+}
+
+static void drm_simple_kms_crtc_disable_vblank(struct drm_crtc *crtc)
+{
+ struct drm_simple_display_pipe *pipe;
+
+ pipe = container_of(crtc, struct drm_simple_display_pipe, crtc);
+ if (!pipe->funcs || !pipe->funcs->disable_vblank)
+ return;
+
+ pipe->funcs->disable_vblank(pipe);
+}
+
static const struct drm_crtc_funcs drm_simple_kms_crtc_funcs = {
.reset = drm_atomic_helper_crtc_reset,
.destroy = drm_crtc_cleanup,
@@ -84,6 +106,8 @@ static const struct drm_crtc_funcs drm_simple_kms_crtc_funcs = {
.page_flip = drm_atomic_helper_page_flip,
.atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state,
.atomic_destroy_state = drm_atomic_helper_crtc_destroy_state,
+ .enable_vblank = drm_simple_kms_crtc_enable_vblank,
+ .disable_vblank = drm_simple_kms_crtc_disable_vblank,
};

static int drm_simple_kms_plane_atomic_check(struct drm_plane *plane,
diff --git a/include/drm/drm_simple_kms_helper.h b/include/drm/drm_simple_kms_helper.h
index 6d9adbb46293..79567826b099 100644
--- a/include/drm/drm_simple_kms_helper.h
+++ b/include/drm/drm_simple_kms_helper.h
@@ -93,6 +93,24 @@ struct drm_simple_display_pipe_funcs {
*/
void (*cleanup_fb)(struct drm_simple_display_pipe *pipe,
struct drm_plane_state *plane_state);
+
+ /**
+ * @enable_vblank:
+ *
+ * Optional, called by &drm_crtc_funcs.enable_vblank. Please read
+ * the documentation for the &drm_crtc_funcs.enable_vblank hook for
+ * more details.
+ */
+ int (*enable_vblank)(struct drm_simple_display_pipe *pipe);
+
+ /**
+ * @disable_vblank:
+ *
+ * Optional, called by &drm_crtc_funcs.disable_vblank. Please read
+ * the documentation for the &drm_crtc_funcs.disable_vblank hook for
+ * more details.
+ */
+ void (*disable_vblank)(struct drm_simple_display_pipe *pipe);
};

/**
--
2.7.4


2018-02-12 10:01:24

by Oleksandr Andrushchenko

[permalink] [raw]
Subject: [PATCH 2/4] drm/mxsfb: Do not use deprecated drm_driver.{enable|disable)_vblank

From: Oleksandr Andrushchenko <[email protected]>

Do not use deprecated drm_driver.{enable|disable)_vblank callbacks,
but use drm_simple_kms_helpe's pipe callbacks instead.

Signed-off-by: Oleksandr Andrushchenko <[email protected]>
Cc: Marek Vasut <[email protected]>
---
drivers/gpu/drm/mxsfb/mxsfb_drv.c | 54 ++++++++++++++++++++-------------------
1 file changed, 28 insertions(+), 26 deletions(-)

diff --git a/drivers/gpu/drm/mxsfb/mxsfb_drv.c b/drivers/gpu/drm/mxsfb/mxsfb_drv.c
index 1207ffe36250..5cae8db9dcd4 100644
--- a/drivers/gpu/drm/mxsfb/mxsfb_drv.c
+++ b/drivers/gpu/drm/mxsfb/mxsfb_drv.c
@@ -131,11 +131,37 @@ static int mxsfb_pipe_prepare_fb(struct drm_simple_display_pipe *pipe,
return drm_gem_fb_prepare_fb(&pipe->plane, plane_state);
}

+static int mxsfb_pipe_enable_vblank(struct drm_simple_display_pipe *pipe)
+{
+ struct mxsfb_drm_private *mxsfb = drm_pipe_to_mxsfb_drm_private(pipe);
+
+ /* Clear and enable VBLANK IRQ */
+ mxsfb_enable_axi_clk(mxsfb);
+ writel(CTRL1_CUR_FRAME_DONE_IRQ, mxsfb->base + LCDC_CTRL1 + REG_CLR);
+ writel(CTRL1_CUR_FRAME_DONE_IRQ_EN, mxsfb->base + LCDC_CTRL1 + REG_SET);
+ mxsfb_disable_axi_clk(mxsfb);
+
+ return 0;
+}
+
+static void mxsfb_pipe_disable_vblank(struct drm_simple_display_pipe *pipe)
+{
+ struct mxsfb_drm_private *mxsfb = drm_pipe_to_mxsfb_drm_private(pipe);
+
+ /* Disable and clear VBLANK IRQ */
+ mxsfb_enable_axi_clk(mxsfb);
+ writel(CTRL1_CUR_FRAME_DONE_IRQ_EN, mxsfb->base + LCDC_CTRL1 + REG_CLR);
+ writel(CTRL1_CUR_FRAME_DONE_IRQ, mxsfb->base + LCDC_CTRL1 + REG_CLR);
+ mxsfb_disable_axi_clk(mxsfb);
+}
+
static struct drm_simple_display_pipe_funcs mxsfb_funcs = {
.enable = mxsfb_pipe_enable,
.disable = mxsfb_pipe_disable,
.update = mxsfb_pipe_update,
.prepare_fb = mxsfb_pipe_prepare_fb,
+ .enable_vblank = mxsfb_pipe_enable_vblank,
+ .disable_vblank = mxsfb_pipe_disable_vblank,
};

static int mxsfb_load(struct drm_device *drm, unsigned long flags)
@@ -274,33 +300,11 @@ static void mxsfb_lastclose(struct drm_device *drm)
drm_fbdev_cma_restore_mode(mxsfb->fbdev);
}

-static int mxsfb_enable_vblank(struct drm_device *drm, unsigned int crtc)
-{
- struct mxsfb_drm_private *mxsfb = drm->dev_private;
-
- /* Clear and enable VBLANK IRQ */
- mxsfb_enable_axi_clk(mxsfb);
- writel(CTRL1_CUR_FRAME_DONE_IRQ, mxsfb->base + LCDC_CTRL1 + REG_CLR);
- writel(CTRL1_CUR_FRAME_DONE_IRQ_EN, mxsfb->base + LCDC_CTRL1 + REG_SET);
- mxsfb_disable_axi_clk(mxsfb);
-
- return 0;
-}
-
-static void mxsfb_disable_vblank(struct drm_device *drm, unsigned int crtc)
+static void mxsfb_irq_preinstall(struct drm_device *drm)
{
struct mxsfb_drm_private *mxsfb = drm->dev_private;

- /* Disable and clear VBLANK IRQ */
- mxsfb_enable_axi_clk(mxsfb);
- writel(CTRL1_CUR_FRAME_DONE_IRQ_EN, mxsfb->base + LCDC_CTRL1 + REG_CLR);
- writel(CTRL1_CUR_FRAME_DONE_IRQ, mxsfb->base + LCDC_CTRL1 + REG_CLR);
- mxsfb_disable_axi_clk(mxsfb);
-}
-
-static void mxsfb_irq_preinstall(struct drm_device *drm)
-{
- mxsfb_disable_vblank(drm, 0);
+ mxsfb_pipe_disable_vblank(&mxsfb->pipe);
}

static irqreturn_t mxsfb_irq_handler(int irq, void *data)
@@ -333,8 +337,6 @@ static struct drm_driver mxsfb_driver = {
.irq_handler = mxsfb_irq_handler,
.irq_preinstall = mxsfb_irq_preinstall,
.irq_uninstall = mxsfb_irq_preinstall,
- .enable_vblank = mxsfb_enable_vblank,
- .disable_vblank = mxsfb_disable_vblank,
.gem_free_object_unlocked = drm_gem_cma_free_object,
.gem_vm_ops = &drm_gem_cma_vm_ops,
.dumb_create = drm_gem_cma_dumb_create,
--
2.7.4


2018-02-12 10:01:25

by Oleksandr Andrushchenko

[permalink] [raw]
Subject: [PATCH 4/4] drm/pl111: Do not use deprecated drm_driver.{enable|disable)_vblank

From: Oleksandr Andrushchenko <[email protected]>

Do not use deprecated drm_driver.{enable|disable)_vblank callbacks,
but use drm_simple_kms_helpe's pipe callbacks instead.

Signed-off-by: Oleksandr Andrushchenko <[email protected]>
Cc: Eric Anholt <[email protected]>
---
drivers/gpu/drm/pl111/pl111_display.c | 15 ++++++++++++---
drivers/gpu/drm/pl111/pl111_drm.h | 2 --
drivers/gpu/drm/pl111/pl111_drv.c | 5 -----
3 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/pl111/pl111_display.c b/drivers/gpu/drm/pl111/pl111_display.c
index d75923896609..5b8368c76734 100644
--- a/drivers/gpu/drm/pl111/pl111_display.c
+++ b/drivers/gpu/drm/pl111/pl111_display.c
@@ -321,8 +321,10 @@ static void pl111_display_update(struct drm_simple_display_pipe *pipe,
}
}

-int pl111_enable_vblank(struct drm_device *drm, unsigned int crtc)
+static int pl111_display_enable_vblank(struct drm_simple_display_pipe *pipe)
{
+ struct drm_crtc *crtc = &pipe->crtc;
+ struct drm_device *drm = crtc->dev;
struct pl111_drm_dev_private *priv = drm->dev_private;

writel(CLCD_IRQ_NEXTBASE_UPDATE, priv->regs + priv->ienb);
@@ -330,8 +332,10 @@ int pl111_enable_vblank(struct drm_device *drm, unsigned int crtc)
return 0;
}

-void pl111_disable_vblank(struct drm_device *drm, unsigned int crtc)
+static void pl111_display_disable_vblank(struct drm_simple_display_pipe *pipe)
{
+ struct drm_crtc *crtc = &pipe->crtc;
+ struct drm_device *drm = crtc->dev;
struct pl111_drm_dev_private *priv = drm->dev_private;

writel(0, priv->regs + priv->ienb);
@@ -343,7 +347,7 @@ static int pl111_display_prepare_fb(struct drm_simple_display_pipe *pipe,
return drm_gem_fb_prepare_fb(&pipe->plane, plane_state);
}

-static const struct drm_simple_display_pipe_funcs pl111_display_funcs = {
+static struct drm_simple_display_pipe_funcs pl111_display_funcs = {
.check = pl111_display_check,
.enable = pl111_display_enable,
.disable = pl111_display_disable,
@@ -502,6 +506,11 @@ int pl111_display_init(struct drm_device *drm)
if (ret)
return ret;

+ if (!priv->variant->broken_vblank) {
+ pl111_display_funcs.enable_vblank = pl111_display_enable_vblank;
+ pl111_display_funcs.disable_vblank = pl111_display_disable_vblank;
+ }
+
ret = drm_simple_display_pipe_init(drm, &priv->pipe,
&pl111_display_funcs,
priv->variant->formats,
diff --git a/drivers/gpu/drm/pl111/pl111_drm.h b/drivers/gpu/drm/pl111/pl111_drm.h
index 6d0e450e51b1..8e252b561e2c 100644
--- a/drivers/gpu/drm/pl111/pl111_drm.h
+++ b/drivers/gpu/drm/pl111/pl111_drm.h
@@ -79,8 +79,6 @@ struct pl111_drm_dev_private {
};

int pl111_display_init(struct drm_device *dev);
-int pl111_enable_vblank(struct drm_device *drm, unsigned int crtc);
-void pl111_disable_vblank(struct drm_device *drm, unsigned int crtc);
irqreturn_t pl111_irq(int irq, void *data);
int pl111_debugfs_init(struct drm_minor *minor);

diff --git a/drivers/gpu/drm/pl111/pl111_drv.c b/drivers/gpu/drm/pl111/pl111_drv.c
index 1231905150d0..a7a3a49956c5 100644
--- a/drivers/gpu/drm/pl111/pl111_drv.c
+++ b/drivers/gpu/drm/pl111/pl111_drv.c
@@ -249,11 +249,6 @@ static int pl111_amba_probe(struct amba_device *amba_dev,
if (!priv)
return -ENOMEM;

- if (!variant->broken_vblank) {
- pl111_drm_driver.enable_vblank = pl111_enable_vblank;
- pl111_drm_driver.disable_vblank = pl111_disable_vblank;
- }
-
drm = drm_dev_alloc(&pl111_drm_driver, dev);
if (IS_ERR(drm))
return PTR_ERR(drm);
--
2.7.4


2018-02-12 11:58:08

by Marek Vasut

[permalink] [raw]
Subject: Re: [PATCH 2/4] drm/mxsfb: Do not use deprecated drm_driver.{enable|disable)_vblank

On 02/12/2018 09:52 AM, Oleksandr Andrushchenko wrote:
> From: Oleksandr Andrushchenko <[email protected]>
>
> Do not use deprecated drm_driver.{enable|disable)_vblank callbacks,
> but use drm_simple_kms_helpe's pipe callbacks instead.
>
> Signed-off-by: Oleksandr Andrushchenko <[email protected]>
> Cc: Marek Vasut <[email protected]>

Reviewed-by: Marek Vasut <[email protected]>

> ---
> drivers/gpu/drm/mxsfb/mxsfb_drv.c | 54 ++++++++++++++++++++-------------------
> 1 file changed, 28 insertions(+), 26 deletions(-)
>
> diff --git a/drivers/gpu/drm/mxsfb/mxsfb_drv.c b/drivers/gpu/drm/mxsfb/mxsfb_drv.c
> index 1207ffe36250..5cae8db9dcd4 100644
> --- a/drivers/gpu/drm/mxsfb/mxsfb_drv.c
> +++ b/drivers/gpu/drm/mxsfb/mxsfb_drv.c
> @@ -131,11 +131,37 @@ static int mxsfb_pipe_prepare_fb(struct drm_simple_display_pipe *pipe,
> return drm_gem_fb_prepare_fb(&pipe->plane, plane_state);
> }
>
> +static int mxsfb_pipe_enable_vblank(struct drm_simple_display_pipe *pipe)
> +{
> + struct mxsfb_drm_private *mxsfb = drm_pipe_to_mxsfb_drm_private(pipe);
> +
> + /* Clear and enable VBLANK IRQ */
> + mxsfb_enable_axi_clk(mxsfb);
> + writel(CTRL1_CUR_FRAME_DONE_IRQ, mxsfb->base + LCDC_CTRL1 + REG_CLR);
> + writel(CTRL1_CUR_FRAME_DONE_IRQ_EN, mxsfb->base + LCDC_CTRL1 + REG_SET);
> + mxsfb_disable_axi_clk(mxsfb);
> +
> + return 0;
> +}
> +
> +static void mxsfb_pipe_disable_vblank(struct drm_simple_display_pipe *pipe)
> +{
> + struct mxsfb_drm_private *mxsfb = drm_pipe_to_mxsfb_drm_private(pipe);
> +
> + /* Disable and clear VBLANK IRQ */
> + mxsfb_enable_axi_clk(mxsfb);
> + writel(CTRL1_CUR_FRAME_DONE_IRQ_EN, mxsfb->base + LCDC_CTRL1 + REG_CLR);
> + writel(CTRL1_CUR_FRAME_DONE_IRQ, mxsfb->base + LCDC_CTRL1 + REG_CLR);
> + mxsfb_disable_axi_clk(mxsfb);
> +}
> +
> static struct drm_simple_display_pipe_funcs mxsfb_funcs = {
> .enable = mxsfb_pipe_enable,
> .disable = mxsfb_pipe_disable,
> .update = mxsfb_pipe_update,
> .prepare_fb = mxsfb_pipe_prepare_fb,
> + .enable_vblank = mxsfb_pipe_enable_vblank,
> + .disable_vblank = mxsfb_pipe_disable_vblank,
> };
>
> static int mxsfb_load(struct drm_device *drm, unsigned long flags)
> @@ -274,33 +300,11 @@ static void mxsfb_lastclose(struct drm_device *drm)
> drm_fbdev_cma_restore_mode(mxsfb->fbdev);
> }
>
> -static int mxsfb_enable_vblank(struct drm_device *drm, unsigned int crtc)
> -{
> - struct mxsfb_drm_private *mxsfb = drm->dev_private;
> -
> - /* Clear and enable VBLANK IRQ */
> - mxsfb_enable_axi_clk(mxsfb);
> - writel(CTRL1_CUR_FRAME_DONE_IRQ, mxsfb->base + LCDC_CTRL1 + REG_CLR);
> - writel(CTRL1_CUR_FRAME_DONE_IRQ_EN, mxsfb->base + LCDC_CTRL1 + REG_SET);
> - mxsfb_disable_axi_clk(mxsfb);
> -
> - return 0;
> -}
> -
> -static void mxsfb_disable_vblank(struct drm_device *drm, unsigned int crtc)
> +static void mxsfb_irq_preinstall(struct drm_device *drm)
> {
> struct mxsfb_drm_private *mxsfb = drm->dev_private;
>
> - /* Disable and clear VBLANK IRQ */
> - mxsfb_enable_axi_clk(mxsfb);
> - writel(CTRL1_CUR_FRAME_DONE_IRQ_EN, mxsfb->base + LCDC_CTRL1 + REG_CLR);
> - writel(CTRL1_CUR_FRAME_DONE_IRQ, mxsfb->base + LCDC_CTRL1 + REG_CLR);
> - mxsfb_disable_axi_clk(mxsfb);
> -}
> -
> -static void mxsfb_irq_preinstall(struct drm_device *drm)
> -{
> - mxsfb_disable_vblank(drm, 0);
> + mxsfb_pipe_disable_vblank(&mxsfb->pipe);
> }
>
> static irqreturn_t mxsfb_irq_handler(int irq, void *data)
> @@ -333,8 +337,6 @@ static struct drm_driver mxsfb_driver = {
> .irq_handler = mxsfb_irq_handler,
> .irq_preinstall = mxsfb_irq_preinstall,
> .irq_uninstall = mxsfb_irq_preinstall,
> - .enable_vblank = mxsfb_enable_vblank,
> - .disable_vblank = mxsfb_disable_vblank,
> .gem_free_object_unlocked = drm_gem_cma_free_object,
> .gem_vm_ops = &drm_gem_cma_vm_ops,
> .dumb_create = drm_gem_cma_dumb_create,
>


--
Best regards,
Marek Vasut

2018-02-13 13:54:02

by Linus Walleij

[permalink] [raw]
Subject: Re: [PATCH 3/4] drm/tve200: Do not use deprecated drm_driver.{enable|disable)_vblank

On Mon, Feb 12, 2018 at 9:52 AM, Oleksandr Andrushchenko
<[email protected]> wrote:

> From: Oleksandr Andrushchenko <[email protected]>
>
> Do not use deprecated drm_driver.{enable|disable)_vblank callbacks,
> but use drm_simple_kms_helpe's pipe callbacks instead.
>
> Signed-off-by: Oleksandr Andrushchenko <[email protected]>
> Cc: Linus Walleij <[email protected]>

The new way of doing these abstractions seem good, so if people
agree on the general subject (other patches in the series I guess)
Reviewed-by: Linus Walleij <[email protected]>

Yours,
Linus Walleij

2018-02-13 13:55:45

by Oleksandr Andrushchenko

[permalink] [raw]
Subject: Re: [PATCH 3/4] drm/tve200: Do not use deprecated drm_driver.{enable|disable)_vblank

On 02/13/2018 03:51 PM, Linus Walleij wrote:
> On Mon, Feb 12, 2018 at 9:52 AM, Oleksandr Andrushchenko
> <[email protected]> wrote:
>
>> From: Oleksandr Andrushchenko <[email protected]>
>>
>> Do not use deprecated drm_driver.{enable|disable)_vblank callbacks,
>> but use drm_simple_kms_helpe's pipe callbacks instead.
>>
>> Signed-off-by: Oleksandr Andrushchenko <[email protected]>
>> Cc: Linus Walleij <[email protected]>
> The new way of doing these abstractions seem good, so if people
> agree on the general subject (other patches in the series I guess)
fair enough, thank you
> Reviewed-by: Linus Walleij <[email protected]>
>
> Yours,
> Linus Walleij


2018-02-19 09:12:32

by Oleksandr Andrushchenko

[permalink] [raw]
Subject: Re: [PATCH 1/4] drm/simple_kms_helper: Add {enable|disable}_vblank callback support

ping
On 02/12/2018 10:52 AM, Oleksandr Andrushchenko wrote:
> From: Oleksandr Andrushchenko <[email protected]>
>
> If simple_kms_helper based driver needs to work with vblanks,
> then it has to provide drm_driver.{enable|disable}_vblank callbacks,
> because drm_simple_kms_helper.drm_crtc_funcs does not provide any.
> At the same time drm_driver.{enable|disable}_vblank callbacks
> are marked as deprecated and shouldn't be used by new drivers.
>
> Fix this by extending drm_simple_kms_helper.drm_crtc_funcs
> to provide the missing callbacks.
>
> Signed-off-by: Oleksandr Andrushchenko <[email protected]>
> ---
> drivers/gpu/drm/drm_simple_kms_helper.c | 24 ++++++++++++++++++++++++
> include/drm/drm_simple_kms_helper.h | 18 ++++++++++++++++++
> 2 files changed, 42 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_simple_kms_helper.c b/drivers/gpu/drm/drm_simple_kms_helper.c
> index 9d3f6b70812c..9ca8a4a59b74 100644
> --- a/drivers/gpu/drm/drm_simple_kms_helper.c
> +++ b/drivers/gpu/drm/drm_simple_kms_helper.c
> @@ -77,6 +77,28 @@ static const struct drm_crtc_helper_funcs drm_simple_kms_crtc_helper_funcs = {
> .atomic_disable = drm_simple_kms_crtc_disable,
> };
>
> +static int drm_simple_kms_crtc_enable_vblank(struct drm_crtc *crtc)
> +{
> + struct drm_simple_display_pipe *pipe;
> +
> + pipe = container_of(crtc, struct drm_simple_display_pipe, crtc);
> + if (!pipe->funcs || !pipe->funcs->enable_vblank)
> + return 0;
> +
> + return pipe->funcs->enable_vblank(pipe);
> +}
> +
> +static void drm_simple_kms_crtc_disable_vblank(struct drm_crtc *crtc)
> +{
> + struct drm_simple_display_pipe *pipe;
> +
> + pipe = container_of(crtc, struct drm_simple_display_pipe, crtc);
> + if (!pipe->funcs || !pipe->funcs->disable_vblank)
> + return;
> +
> + pipe->funcs->disable_vblank(pipe);
> +}
> +
> static const struct drm_crtc_funcs drm_simple_kms_crtc_funcs = {
> .reset = drm_atomic_helper_crtc_reset,
> .destroy = drm_crtc_cleanup,
> @@ -84,6 +106,8 @@ static const struct drm_crtc_funcs drm_simple_kms_crtc_funcs = {
> .page_flip = drm_atomic_helper_page_flip,
> .atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state,
> .atomic_destroy_state = drm_atomic_helper_crtc_destroy_state,
> + .enable_vblank = drm_simple_kms_crtc_enable_vblank,
> + .disable_vblank = drm_simple_kms_crtc_disable_vblank,
> };
>
> static int drm_simple_kms_plane_atomic_check(struct drm_plane *plane,
> diff --git a/include/drm/drm_simple_kms_helper.h b/include/drm/drm_simple_kms_helper.h
> index 6d9adbb46293..79567826b099 100644
> --- a/include/drm/drm_simple_kms_helper.h
> +++ b/include/drm/drm_simple_kms_helper.h
> @@ -93,6 +93,24 @@ struct drm_simple_display_pipe_funcs {
> */
> void (*cleanup_fb)(struct drm_simple_display_pipe *pipe,
> struct drm_plane_state *plane_state);
> +
> + /**
> + * @enable_vblank:
> + *
> + * Optional, called by &drm_crtc_funcs.enable_vblank. Please read
> + * the documentation for the &drm_crtc_funcs.enable_vblank hook for
> + * more details.
> + */
> + int (*enable_vblank)(struct drm_simple_display_pipe *pipe);
> +
> + /**
> + * @disable_vblank:
> + *
> + * Optional, called by &drm_crtc_funcs.disable_vblank. Please read
> + * the documentation for the &drm_crtc_funcs.disable_vblank hook for
> + * more details.
> + */
> + void (*disable_vblank)(struct drm_simple_display_pipe *pipe);
> };
>
> /**


2018-02-21 22:46:28

by Eric Anholt

[permalink] [raw]
Subject: Re: [PATCH 4/4] drm/pl111: Do not use deprecated drm_driver.{enable|disable)_vblank

Oleksandr Andrushchenko <[email protected]> writes:

> From: Oleksandr Andrushchenko <[email protected]>
>
> Do not use deprecated drm_driver.{enable|disable)_vblank callbacks,
> but use drm_simple_kms_helpe's pipe callbacks instead.
>
> Signed-off-by: Oleksandr Andrushchenko <[email protected]>
> Cc: Eric Anholt <[email protected]>

Just got back from vacation today and got a chance to try it.

Reviewed-by: Eric Anholt <[email protected]>
Tested-by: Eric Anholt <[email protected]>


Attachments:
signature.asc (847.00 B)

2018-02-22 17:00:39

by Daniel Vetter

[permalink] [raw]
Subject: Re: [PATCH 1/4] drm/simple_kms_helper: Add {enable|disable}_vblank callback support

On Mon, Feb 19, 2018 at 11:11:23AM +0200, Oleksandr Andrushchenko wrote:
> ping
> On 02/12/2018 10:52 AM, Oleksandr Andrushchenko wrote:
> > From: Oleksandr Andrushchenko <[email protected]>
> >
> > If simple_kms_helper based driver needs to work with vblanks,
> > then it has to provide drm_driver.{enable|disable}_vblank callbacks,
> > because drm_simple_kms_helper.drm_crtc_funcs does not provide any.
> > At the same time drm_driver.{enable|disable}_vblank callbacks
> > are marked as deprecated and shouldn't be used by new drivers.
> >
> > Fix this by extending drm_simple_kms_helper.drm_crtc_funcs
> > to provide the missing callbacks.
> >
> > Signed-off-by: Oleksandr Andrushchenko <[email protected]>

lgtm, all 4 applied, thanks for your patches.
-Daniel

> > ---
> > drivers/gpu/drm/drm_simple_kms_helper.c | 24 ++++++++++++++++++++++++
> > include/drm/drm_simple_kms_helper.h | 18 ++++++++++++++++++
> > 2 files changed, 42 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/drm_simple_kms_helper.c b/drivers/gpu/drm/drm_simple_kms_helper.c
> > index 9d3f6b70812c..9ca8a4a59b74 100644
> > --- a/drivers/gpu/drm/drm_simple_kms_helper.c
> > +++ b/drivers/gpu/drm/drm_simple_kms_helper.c
> > @@ -77,6 +77,28 @@ static const struct drm_crtc_helper_funcs drm_simple_kms_crtc_helper_funcs = {
> > .atomic_disable = drm_simple_kms_crtc_disable,
> > };
> > +static int drm_simple_kms_crtc_enable_vblank(struct drm_crtc *crtc)
> > +{
> > + struct drm_simple_display_pipe *pipe;
> > +
> > + pipe = container_of(crtc, struct drm_simple_display_pipe, crtc);
> > + if (!pipe->funcs || !pipe->funcs->enable_vblank)
> > + return 0;
> > +
> > + return pipe->funcs->enable_vblank(pipe);
> > +}
> > +
> > +static void drm_simple_kms_crtc_disable_vblank(struct drm_crtc *crtc)
> > +{
> > + struct drm_simple_display_pipe *pipe;
> > +
> > + pipe = container_of(crtc, struct drm_simple_display_pipe, crtc);
> > + if (!pipe->funcs || !pipe->funcs->disable_vblank)
> > + return;
> > +
> > + pipe->funcs->disable_vblank(pipe);
> > +}
> > +
> > static const struct drm_crtc_funcs drm_simple_kms_crtc_funcs = {
> > .reset = drm_atomic_helper_crtc_reset,
> > .destroy = drm_crtc_cleanup,
> > @@ -84,6 +106,8 @@ static const struct drm_crtc_funcs drm_simple_kms_crtc_funcs = {
> > .page_flip = drm_atomic_helper_page_flip,
> > .atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state,
> > .atomic_destroy_state = drm_atomic_helper_crtc_destroy_state,
> > + .enable_vblank = drm_simple_kms_crtc_enable_vblank,
> > + .disable_vblank = drm_simple_kms_crtc_disable_vblank,
> > };
> > static int drm_simple_kms_plane_atomic_check(struct drm_plane *plane,
> > diff --git a/include/drm/drm_simple_kms_helper.h b/include/drm/drm_simple_kms_helper.h
> > index 6d9adbb46293..79567826b099 100644
> > --- a/include/drm/drm_simple_kms_helper.h
> > +++ b/include/drm/drm_simple_kms_helper.h
> > @@ -93,6 +93,24 @@ struct drm_simple_display_pipe_funcs {
> > */
> > void (*cleanup_fb)(struct drm_simple_display_pipe *pipe,
> > struct drm_plane_state *plane_state);
> > +
> > + /**
> > + * @enable_vblank:
> > + *
> > + * Optional, called by &drm_crtc_funcs.enable_vblank. Please read
> > + * the documentation for the &drm_crtc_funcs.enable_vblank hook for
> > + * more details.
> > + */
> > + int (*enable_vblank)(struct drm_simple_display_pipe *pipe);
> > +
> > + /**
> > + * @disable_vblank:
> > + *
> > + * Optional, called by &drm_crtc_funcs.disable_vblank. Please read
> > + * the documentation for the &drm_crtc_funcs.disable_vblank hook for
> > + * more details.
> > + */
> > + void (*disable_vblank)(struct drm_simple_display_pipe *pipe);
> > };
> > /**
>
> _______________________________________________
> dri-devel mailing list
> [email protected]
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

2018-02-22 17:16:46

by Oleksandr Andrushchenko

[permalink] [raw]
Subject: Re: [PATCH 1/4] drm/simple_kms_helper: Add {enable|disable}_vblank callback support

On 02/22/2018 06:59 PM, Daniel Vetter wrote:
> On Mon, Feb 19, 2018 at 11:11:23AM +0200, Oleksandr Andrushchenko wrote:
>> ping
>> On 02/12/2018 10:52 AM, Oleksandr Andrushchenko wrote:
>>> From: Oleksandr Andrushchenko <[email protected]>
>>>
>>> If simple_kms_helper based driver needs to work with vblanks,
>>> then it has to provide drm_driver.{enable|disable}_vblank callbacks,
>>> because drm_simple_kms_helper.drm_crtc_funcs does not provide any.
>>> At the same time drm_driver.{enable|disable}_vblank callbacks
>>> are marked as deprecated and shouldn't be used by new drivers.
>>>
>>> Fix this by extending drm_simple_kms_helper.drm_crtc_funcs
>>> to provide the missing callbacks.
>>>
>>> Signed-off-by: Oleksandr Andrushchenko <[email protected]>
> lgtm, all 4 applied, thanks for your patches.
Thank you, my pleasure
> -Daniel
>
>>> ---
>>> drivers/gpu/drm/drm_simple_kms_helper.c | 24 ++++++++++++++++++++++++
>>> include/drm/drm_simple_kms_helper.h | 18 ++++++++++++++++++
>>> 2 files changed, 42 insertions(+)
>>>
>>> diff --git a/drivers/gpu/drm/drm_simple_kms_helper.c b/drivers/gpu/drm/drm_simple_kms_helper.c
>>> index 9d3f6b70812c..9ca8a4a59b74 100644
>>> --- a/drivers/gpu/drm/drm_simple_kms_helper.c
>>> +++ b/drivers/gpu/drm/drm_simple_kms_helper.c
>>> @@ -77,6 +77,28 @@ static const struct drm_crtc_helper_funcs drm_simple_kms_crtc_helper_funcs = {
>>> .atomic_disable = drm_simple_kms_crtc_disable,
>>> };
>>> +static int drm_simple_kms_crtc_enable_vblank(struct drm_crtc *crtc)
>>> +{
>>> + struct drm_simple_display_pipe *pipe;
>>> +
>>> + pipe = container_of(crtc, struct drm_simple_display_pipe, crtc);
>>> + if (!pipe->funcs || !pipe->funcs->enable_vblank)
>>> + return 0;
>>> +
>>> + return pipe->funcs->enable_vblank(pipe);
>>> +}
>>> +
>>> +static void drm_simple_kms_crtc_disable_vblank(struct drm_crtc *crtc)
>>> +{
>>> + struct drm_simple_display_pipe *pipe;
>>> +
>>> + pipe = container_of(crtc, struct drm_simple_display_pipe, crtc);
>>> + if (!pipe->funcs || !pipe->funcs->disable_vblank)
>>> + return;
>>> +
>>> + pipe->funcs->disable_vblank(pipe);
>>> +}
>>> +
>>> static const struct drm_crtc_funcs drm_simple_kms_crtc_funcs = {
>>> .reset = drm_atomic_helper_crtc_reset,
>>> .destroy = drm_crtc_cleanup,
>>> @@ -84,6 +106,8 @@ static const struct drm_crtc_funcs drm_simple_kms_crtc_funcs = {
>>> .page_flip = drm_atomic_helper_page_flip,
>>> .atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state,
>>> .atomic_destroy_state = drm_atomic_helper_crtc_destroy_state,
>>> + .enable_vblank = drm_simple_kms_crtc_enable_vblank,
>>> + .disable_vblank = drm_simple_kms_crtc_disable_vblank,
>>> };
>>> static int drm_simple_kms_plane_atomic_check(struct drm_plane *plane,
>>> diff --git a/include/drm/drm_simple_kms_helper.h b/include/drm/drm_simple_kms_helper.h
>>> index 6d9adbb46293..79567826b099 100644
>>> --- a/include/drm/drm_simple_kms_helper.h
>>> +++ b/include/drm/drm_simple_kms_helper.h
>>> @@ -93,6 +93,24 @@ struct drm_simple_display_pipe_funcs {
>>> */
>>> void (*cleanup_fb)(struct drm_simple_display_pipe *pipe,
>>> struct drm_plane_state *plane_state);
>>> +
>>> + /**
>>> + * @enable_vblank:
>>> + *
>>> + * Optional, called by &drm_crtc_funcs.enable_vblank. Please read
>>> + * the documentation for the &drm_crtc_funcs.enable_vblank hook for
>>> + * more details.
>>> + */
>>> + int (*enable_vblank)(struct drm_simple_display_pipe *pipe);
>>> +
>>> + /**
>>> + * @disable_vblank:
>>> + *
>>> + * Optional, called by &drm_crtc_funcs.disable_vblank. Please read
>>> + * the documentation for the &drm_crtc_funcs.disable_vblank hook for
>>> + * more details.
>>> + */
>>> + void (*disable_vblank)(struct drm_simple_display_pipe *pipe);
>>> };
>>> /**
>> _______________________________________________
>> dri-devel mailing list
>> [email protected]
>> https://lists.freedesktop.org/mailman/listinfo/dri-devel