From: Gustavo Padovan gustavo.padovan@collabora.co.uk
Check error and call DRM_ERROR if clk_prepare_enable() fails.
Signed-off-by: Gustavo Padovan gustavo.padovan@collabora.co.uk --- drivers/gpu/drm/exynos/exynos7_drm_decon.c | 29 ++++++++++++++++++++++++---- drivers/gpu/drm/exynos/exynos_drm_fimd.c | 14 ++++++++++++-- drivers/gpu/drm/exynos/exynos_mixer.c | 31 +++++++++++++++++++++++++----- 3 files changed, 63 insertions(+), 11 deletions(-)
diff --git a/drivers/gpu/drm/exynos/exynos7_drm_decon.c b/drivers/gpu/drm/exynos/exynos7_drm_decon.c index d659ba2..ffd7c3b 100644 --- a/drivers/gpu/drm/exynos/exynos7_drm_decon.c +++ b/drivers/gpu/drm/exynos/exynos7_drm_decon.c @@ -606,6 +606,7 @@ static void decon_init(struct decon_context *ctx) static void decon_enable(struct exynos_drm_crtc *crtc) { struct decon_context *ctx = crtc->ctx; + int ret;
if (!ctx->suspended) return; @@ -614,10 +615,30 @@ static void decon_enable(struct exynos_drm_crtc *crtc)
pm_runtime_get_sync(ctx->dev);
- clk_prepare_enable(ctx->pclk); - clk_prepare_enable(ctx->aclk); - clk_prepare_enable(ctx->eclk); - clk_prepare_enable(ctx->vclk); + ret = clk_prepare_enable(ctx->pclk); + if (ret < 0) { + DRM_ERROR("Failed to prepare_enable the pclk [%d]\n", ret); + return; + goto pclk_err; + } + + ret = clk_prepare_enable(ctx->aclk); + if (ret < 0) { + DRM_ERROR("Failed to prepare_enable the aclk [%d]\n", ret); + return; + } + + ret = clk_prepare_enable(ctx->eclk); + if (ret < 0) { + DRM_ERROR("Failed to prepare_enable the eclk [%d]\n", ret); + return; + } + + ret = clk_prepare_enable(ctx->vclk); + if (ret < 0) { + DRM_ERROR("Failed to prepare_enable the vclk [%d]\n", ret); + return; + }
decon_init(ctx);
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c index 9661853..7c8ba61 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c @@ -808,6 +808,7 @@ static void fimd_apply(struct fimd_context *ctx) static void fimd_enable(struct exynos_drm_crtc *crtc) { struct fimd_context *ctx = crtc->ctx; + int ret;
if (!ctx->suspended) return; @@ -816,8 +817,17 @@ static void fimd_enable(struct exynos_drm_crtc *crtc)
pm_runtime_get_sync(ctx->dev);
- clk_prepare_enable(ctx->bus_clk); - clk_prepare_enable(ctx->lcd_clk); + ret = clk_prepare_enable(ctx->bus_clk); + if (ret < 0) { + DRM_ERROR("Failed to prepare_enable the bus clk [%d]\n", ret); + return; + } + + ret = clk_prepare_enable(ctx->lcd_clk); + if (ret < 0) { + DRM_ERROR("Failed to prepare_enable the lcd clk [%d]\n", ret); + return; + }
/* if vblank was enabled status, enable it again. */ if (test_and_clear_bit(0, &ctx->irq_flags)) diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c index 6bab717..1b77fc7 100644 --- a/drivers/gpu/drm/exynos/exynos_mixer.c +++ b/drivers/gpu/drm/exynos/exynos_mixer.c @@ -1031,6 +1031,7 @@ static void mixer_enable(struct exynos_drm_crtc *crtc) { struct mixer_context *ctx = crtc->ctx; struct mixer_resources *res = &ctx->mixer_res; + int ret;
mutex_lock(&ctx->mixer_mutex); if (ctx->powered) { @@ -1042,12 +1043,32 @@ static void mixer_enable(struct exynos_drm_crtc *crtc)
pm_runtime_get_sync(ctx->dev);
- clk_prepare_enable(res->mixer); - clk_prepare_enable(res->hdmi); + ret = clk_prepare_enable(res->mixer); + if (ret < 0) { + DRM_ERROR("Failed to prepare_enable the mixer clk [%d]\n", ret); + return; + } + ret = clk_prepare_enable(res->hdmi); + if (ret < 0) { + DRM_ERROR("Failed to prepare_enable the hdmi clk [%d]\n", ret); + return; + } if (ctx->vp_enabled) { - clk_prepare_enable(res->vp); - if (ctx->has_sclk) - clk_prepare_enable(res->sclk_mixer); + ret = clk_prepare_enable(res->vp); + if (ret < 0) { + DRM_ERROR("Failed to prepare_enable the vp clk [%d]\n", + ret); + return; + } + if (ctx->has_sclk) { + ret = clk_prepare_enable(res->sclk_mixer); + if (ret < 0) { + DRM_ERROR("Failed to prepare_enable the " \ + "sclk_mixer clk [%d]\n", + ret); + return; + } + } }
mutex_lock(&ctx->mixer_mutex);
From: Gustavo Padovan gustavo.padovan@collabora.co.uk
The atomic modesetting interfaces supports async commits that should be implemented by the drivers. If drm core requests an async commit exynos_atomic_commit() will schedule a work task to run the update later. It also waits to an update to finishes to schedule a new one.
Signed-off-by: Gustavo Padovan gustavo.padovan@collabora.co.uk --- drivers/gpu/drm/exynos/exynos_drm_drv.c | 6 ++++ drivers/gpu/drm/exynos/exynos_drm_drv.h | 6 ++++ drivers/gpu/drm/exynos/exynos_drm_fb.c | 51 ++++++++++++++++++++++++++------- 3 files changed, 52 insertions(+), 11 deletions(-)
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c index 08b9a8c..8ccff36 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c @@ -60,6 +60,9 @@ static int exynos_drm_load(struct drm_device *dev, unsigned long flags) if (!private) return -ENOMEM;
+ INIT_WORK(&private->work, exynos_drm_atomic_work); + private->dev = dev; + dev_set_drvdata(dev->dev, dev); dev->dev_private = (void *)private;
@@ -140,6 +143,8 @@ err_free_private:
static int exynos_drm_unload(struct drm_device *dev) { + struct exynos_drm_private *private = dev->dev_private; + exynos_drm_device_subdrv_remove(dev);
exynos_drm_fbdev_fini(dev); @@ -150,6 +155,7 @@ static int exynos_drm_unload(struct drm_device *dev) drm_mode_config_cleanup(dev); drm_release_iommu_mapping(dev);
+ flush_work(&private->work); kfree(dev->dev_private); dev->dev_private = NULL;
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h index 1c66f65..552ca4a 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.h +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h @@ -255,6 +255,10 @@ struct exynos_drm_private { unsigned long da_space_size;
unsigned int pipe; + + struct drm_device *dev; + struct work_struct work; + struct drm_atomic_state *state; };
/* @@ -324,6 +328,8 @@ static inline int exynos_drm_probe_vidi(void) { return 0; } static inline void exynos_drm_remove_vidi(void) {} #endif
+void exynos_drm_atomic_work(struct work_struct *work); + /* This function creates a encoder and a connector, and initializes them. */ int exynos_drm_create_enc_conn(struct drm_device *dev, struct exynos_drm_display *display); diff --git a/drivers/gpu/drm/exynos/exynos_drm_fb.c b/drivers/gpu/drm/exynos/exynos_drm_fb.c index 789db6f..28626db 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fb.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fb.c @@ -267,20 +267,18 @@ static void exynos_drm_output_poll_changed(struct drm_device *dev) exynos_drm_fbdev_init(dev); }
-static int exynos_atomic_commit(struct drm_device *dev, - struct drm_atomic_state *state, - bool async) +static void exynos_atomic_commit_schedule(struct drm_device *dev, + struct drm_atomic_state *state) { - int ret; - - ret = drm_atomic_helper_prepare_planes(dev, state); - if (ret) - return ret; - - /* This is the point of no return */ + struct exynos_drm_private *private = dev->dev_private;
- drm_atomic_helper_swap_state(dev, state); + private->state = state; + schedule_work(&private->work); +}
+static void exynos_atomic_commit_complete(struct drm_device *dev, + struct drm_atomic_state *state) +{ drm_atomic_helper_commit_modeset_disables(dev, state);
drm_atomic_helper_commit_modeset_enables(dev, state); @@ -300,6 +298,37 @@ static int exynos_atomic_commit(struct drm_device *dev, drm_atomic_helper_cleanup_planes(dev, state);
drm_atomic_state_free(state); +} + +void exynos_drm_atomic_work(struct work_struct *work) +{ + struct exynos_drm_private *private = container_of(work, + struct exynos_drm_private, work); + + exynos_atomic_commit_complete(private->dev, private->state); +} + +static int exynos_atomic_commit(struct drm_device *dev, + struct drm_atomic_state *state, + bool async) +{ + struct exynos_drm_private *private = dev->dev_private; + int ret; + + ret = drm_atomic_helper_prepare_planes(dev, state); + if (ret) + return ret; + + /* This is the point of no return */ + + drm_atomic_helper_swap_state(dev, state); + + flush_work(&private->work); + + if (async) + exynos_atomic_commit_schedule(dev, state); + else + exynos_atomic_commit_complete(dev, state);
return 0; }
On 06/03/2015 11:30 PM, Gustavo Padovan wrote:
From: Gustavo Padovan gustavo.padovan@collabora.co.uk
The atomic modesetting interfaces supports async commits that should be implemented by the drivers. If drm core requests an async commit exynos_atomic_commit() will schedule a work task to run the update later. It also waits to an update to finishes to schedule a new one.
Signed-off-by: Gustavo Padovan gustavo.padovan@collabora.co.uk
drivers/gpu/drm/exynos/exynos_drm_drv.c | 6 ++++ drivers/gpu/drm/exynos/exynos_drm_drv.h | 6 ++++ drivers/gpu/drm/exynos/exynos_drm_fb.c | 51 ++++++++++++++++++++++++++------- 3 files changed, 52 insertions(+), 11 deletions(-)
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c index 08b9a8c..8ccff36 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c @@ -60,6 +60,9 @@ static int exynos_drm_load(struct drm_device *dev, unsigned long flags) if (!private) return -ENOMEM;
- INIT_WORK(&private->work, exynos_drm_atomic_work);
- private->dev = dev;
- dev_set_drvdata(dev->dev, dev); dev->dev_private = (void *)private;
@@ -140,6 +143,8 @@ err_free_private:
static int exynos_drm_unload(struct drm_device *dev) {
struct exynos_drm_private *private = dev->dev_private;
exynos_drm_device_subdrv_remove(dev);
exynos_drm_fbdev_fini(dev);
@@ -150,6 +155,7 @@ static int exynos_drm_unload(struct drm_device *dev) drm_mode_config_cleanup(dev); drm_release_iommu_mapping(dev);
- flush_work(&private->work); kfree(dev->dev_private); dev->dev_private = NULL;
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h index 1c66f65..552ca4a 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.h +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h @@ -255,6 +255,10 @@ struct exynos_drm_private { unsigned long da_space_size;
unsigned int pipe;
- struct drm_device *dev;
- struct work_struct work;
- struct drm_atomic_state *state;
};
/* @@ -324,6 +328,8 @@ static inline int exynos_drm_probe_vidi(void) { return 0; } static inline void exynos_drm_remove_vidi(void) {} #endif
+void exynos_drm_atomic_work(struct work_struct *work);
/* This function creates a encoder and a connector, and initializes them. */ int exynos_drm_create_enc_conn(struct drm_device *dev, struct exynos_drm_display *display); diff --git a/drivers/gpu/drm/exynos/exynos_drm_fb.c b/drivers/gpu/drm/exynos/exynos_drm_fb.c index 789db6f..28626db 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fb.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fb.c @@ -267,20 +267,18 @@ static void exynos_drm_output_poll_changed(struct drm_device *dev) exynos_drm_fbdev_init(dev); }
-static int exynos_atomic_commit(struct drm_device *dev,
struct drm_atomic_state *state,
bool async)
+static void exynos_atomic_commit_schedule(struct drm_device *dev,
struct drm_atomic_state *state)
{
- int ret;
- ret = drm_atomic_helper_prepare_planes(dev, state);
- if (ret)
return ret;
- /* This is the point of no return */
- struct exynos_drm_private *private = dev->dev_private;
- drm_atomic_helper_swap_state(dev, state);
- private->state = state;
- schedule_work(&private->work);
+}
+static void exynos_atomic_commit_complete(struct drm_device *dev,
struct drm_atomic_state *state)
+{ drm_atomic_helper_commit_modeset_disables(dev, state);
drm_atomic_helper_commit_modeset_enables(dev, state); @@ -300,6 +298,37 @@ static int exynos_atomic_commit(struct drm_device *dev, drm_atomic_helper_cleanup_planes(dev, state);
drm_atomic_state_free(state); +}
+void exynos_drm_atomic_work(struct work_struct *work) +{
- struct exynos_drm_private *private = container_of(work,
struct exynos_drm_private, work);
- exynos_atomic_commit_complete(private->dev, private->state);
+}
+static int exynos_atomic_commit(struct drm_device *dev,
struct drm_atomic_state *state,
bool async)
+{
- struct exynos_drm_private *private = dev->dev_private;
- int ret;
- ret = drm_atomic_helper_prepare_planes(dev, state);
- if (ret)
return ret;
- /* This is the point of no return */
- drm_atomic_helper_swap_state(dev, state);
- flush_work(&private->work);
It seems be wrong to swap state before flush work.
I'm not sure whether need locking but other drivers changed to atomic modeset feature use locking here.
if (async)
exynos_atomic_commit_schedule(dev, state);
else
exynos_atomic_commit_complete(dev, state);
return 0;
}
From: Gustavo Padovan gustavo.padovan@collabora.co.uk
Rename win_commit() helper to update_plane() and win_disable() to disable_plane().
Signed-off-by: Gustavo Padovan gustavo.padovan@collabora.co.uk --- drivers/gpu/drm/exynos/exynos7_drm_decon.c | 14 +++++++------- drivers/gpu/drm/exynos/exynos_drm_drv.h | 4 ++-- drivers/gpu/drm/exynos/exynos_drm_fimd.c | 14 +++++++------- drivers/gpu/drm/exynos/exynos_drm_plane.c | 10 +++++----- drivers/gpu/drm/exynos/exynos_drm_vidi.c | 12 ++++++------ drivers/gpu/drm/exynos/exynos_mixer.c | 12 ++++++------ 6 files changed, 33 insertions(+), 33 deletions(-)
diff --git a/drivers/gpu/drm/exynos/exynos7_drm_decon.c b/drivers/gpu/drm/exynos/exynos7_drm_decon.c index ffd7c3b..f2b2139 100644 --- a/drivers/gpu/drm/exynos/exynos7_drm_decon.c +++ b/drivers/gpu/drm/exynos/exynos7_drm_decon.c @@ -392,7 +392,7 @@ static void decon_shadow_protect_win(struct decon_context *ctx, writel(val, ctx->regs + SHADOWCON); }
-static void decon_win_commit(struct exynos_drm_crtc *crtc, unsigned int win) +static void decon_update_plane(struct exynos_drm_crtc *crtc, unsigned int win) { struct decon_context *ctx = crtc->ctx; struct drm_display_mode *mode = &crtc->base.state->adjusted_mode; @@ -510,7 +510,7 @@ static void decon_win_commit(struct exynos_drm_crtc *crtc, unsigned int win) plane->enabled = true; }
-static void decon_win_disable(struct exynos_drm_crtc *crtc, unsigned int win) +static void decon_disable_plane(struct exynos_drm_crtc *crtc, unsigned int win) { struct decon_context *ctx = crtc->ctx; struct exynos_drm_plane *plane; @@ -554,7 +554,7 @@ static void decon_window_suspend(struct decon_context *ctx) plane = &ctx->planes[i]; plane->resume = plane->enabled; if (plane->enabled) - decon_win_disable(ctx->crtc, i); + decon_disable_plane(ctx->crtc, i); } }
@@ -578,9 +578,9 @@ static void decon_apply(struct decon_context *ctx) for (i = 0; i < WINDOWS_NR; i++) { plane = &ctx->planes[i]; if (plane->enabled) - decon_win_commit(ctx->crtc, i); + decon_update_plane(ctx->crtc, i); else - decon_win_disable(ctx->crtc, i); + decon_disable_plane(ctx->crtc, i); }
decon_commit(ctx->crtc); @@ -683,8 +683,8 @@ static const struct exynos_drm_crtc_ops decon_crtc_ops = { .enable_vblank = decon_enable_vblank, .disable_vblank = decon_disable_vblank, .wait_for_vblank = decon_wait_for_vblank, - .win_commit = decon_win_commit, - .win_disable = decon_win_disable, + .update_plane = decon_update_plane, + .disable_plane = decon_disable_plane, };
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h index 552ca4a..1858dae 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.h +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h @@ -185,8 +185,8 @@ struct exynos_drm_crtc_ops { int (*enable_vblank)(struct exynos_drm_crtc *crtc); void (*disable_vblank)(struct exynos_drm_crtc *crtc); void (*wait_for_vblank)(struct exynos_drm_crtc *crtc); - void (*win_commit)(struct exynos_drm_crtc *crtc, unsigned int zpos); - void (*win_disable)(struct exynos_drm_crtc *crtc, unsigned int zpos); + void (*update_plane)(struct exynos_drm_crtc *crtc, unsigned int zpos); + void (*disable_plane)(struct exynos_drm_crtc *crtc, unsigned int zpos); void (*te_handler)(struct exynos_drm_crtc *crtc); void (*clock_enable)(struct exynos_drm_crtc *crtc, bool enable); }; diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c index 7c8ba61..2b0080d 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c @@ -618,7 +618,7 @@ static void fimd_shadow_protect_win(struct fimd_context *ctx, writel(val, ctx->regs + reg); }
-static void fimd_win_commit(struct exynos_drm_crtc *crtc, unsigned int win) +static void fimd_update_plane(struct exynos_drm_crtc *crtc, unsigned int win) { struct fimd_context *ctx = crtc->ctx; struct exynos_drm_plane *plane; @@ -734,7 +734,7 @@ static void fimd_win_commit(struct exynos_drm_crtc *crtc, unsigned int win) atomic_set(&ctx->win_updated, 1); }
-static void fimd_win_disable(struct exynos_drm_crtc *crtc, unsigned int win) +static void fimd_disable_plane(struct exynos_drm_crtc *crtc, unsigned int win) { struct fimd_context *ctx = crtc->ctx; struct exynos_drm_plane *plane; @@ -773,7 +773,7 @@ static void fimd_window_suspend(struct fimd_context *ctx) plane = &ctx->planes[i]; plane->resume = plane->enabled; if (plane->enabled) - fimd_win_disable(ctx->crtc, i); + fimd_disable_plane(ctx->crtc, i); } }
@@ -797,9 +797,9 @@ static void fimd_apply(struct fimd_context *ctx) for (i = 0; i < WINDOWS_NR; i++) { plane = &ctx->planes[i]; if (plane->enabled) - fimd_win_commit(ctx->crtc, i); + fimd_update_plane(ctx->crtc, i); else - fimd_win_disable(ctx->crtc, i); + fimd_disable_plane(ctx->crtc, i); }
fimd_commit(ctx->crtc); @@ -939,8 +939,8 @@ static const struct exynos_drm_crtc_ops fimd_crtc_ops = { .enable_vblank = fimd_enable_vblank, .disable_vblank = fimd_disable_vblank, .wait_for_vblank = fimd_wait_for_vblank, - .win_commit = fimd_win_commit, - .win_disable = fimd_win_disable, + .update_plane = fimd_update_plane, + .disable_plane = fimd_disable_plane, .te_handler = fimd_te_handler, .clock_enable = fimd_dp_clock_enable, }; diff --git a/drivers/gpu/drm/exynos/exynos_drm_plane.c b/drivers/gpu/drm/exynos/exynos_drm_plane.c index a729980..eb9eec9 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_plane.c +++ b/drivers/gpu/drm/exynos/exynos_drm_plane.c @@ -179,8 +179,8 @@ static void exynos_plane_atomic_update(struct drm_plane *plane, state->src_x >> 16, state->src_y >> 16, state->src_w >> 16, state->src_h >> 16);
- if (exynos_crtc->ops->win_commit) - exynos_crtc->ops->win_commit(exynos_crtc, exynos_plane->zpos); + if (exynos_crtc->ops->update_plane) + exynos_crtc->ops->update_plane(exynos_crtc, exynos_plane->zpos); }
static void exynos_plane_atomic_disable(struct drm_plane *plane, @@ -192,9 +192,9 @@ static void exynos_plane_atomic_disable(struct drm_plane *plane, if (!old_state->crtc) return;
- if (exynos_crtc->ops->win_disable) - exynos_crtc->ops->win_disable(exynos_crtc, - exynos_plane->zpos); + if (exynos_crtc->ops->disable_plane) + exynos_crtc->ops->disable_plane(exynos_crtc, + exynos_plane->zpos); }
static const struct drm_plane_helper_funcs plane_helper_funcs = { diff --git a/drivers/gpu/drm/exynos/exynos_drm_vidi.c b/drivers/gpu/drm/exynos/exynos_drm_vidi.c index abe4ee0..ac9348b 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_vidi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_vidi.c @@ -100,7 +100,7 @@ static int vidi_enable_vblank(struct exynos_drm_crtc *crtc) /* * in case of page flip request, vidi_finish_pageflip function * will not be called because direct_vblank is true and then - * that function will be called by crtc_ops->win_commit callback + * that function will be called by crtc_ops->update_plane callback */ schedule_work(&ctx->work);
@@ -118,7 +118,7 @@ static void vidi_disable_vblank(struct exynos_drm_crtc *crtc) ctx->vblank_on = false; }
-static void vidi_win_commit(struct exynos_drm_crtc *crtc, unsigned int win) +static void vidi_update_plane(struct exynos_drm_crtc *crtc, unsigned int win) { struct vidi_context *ctx = crtc->ctx; struct exynos_drm_plane *plane; @@ -139,7 +139,7 @@ static void vidi_win_commit(struct exynos_drm_crtc *crtc, unsigned int win) schedule_work(&ctx->work); }
-static void vidi_win_disable(struct exynos_drm_crtc *crtc, unsigned int win) +static void vidi_disable_plane(struct exynos_drm_crtc *crtc, unsigned int win) { struct vidi_context *ctx = crtc->ctx; struct exynos_drm_plane *plane; @@ -170,7 +170,7 @@ static void vidi_enable(struct exynos_drm_crtc *crtc) for (i = 0; i < WINDOWS_NR; i++) { plane = &ctx->planes[i]; if (plane->enabled) - vidi_win_commit(ctx->crtc, i); + vidi_update_plane(ctx->crtc, i); }
mutex_unlock(&ctx->lock); @@ -205,8 +205,8 @@ static const struct exynos_drm_crtc_ops vidi_crtc_ops = { .disable = vidi_disable, .enable_vblank = vidi_enable_vblank, .disable_vblank = vidi_disable_vblank, - .win_commit = vidi_win_commit, - .win_disable = vidi_win_disable, + .update_plane = vidi_update_plane, + .disable_plane = vidi_disable_plane, };
static void vidi_fake_vblank_handler(struct work_struct *work) diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c index 1b77fc7..3521359 100644 --- a/drivers/gpu/drm/exynos/exynos_mixer.c +++ b/drivers/gpu/drm/exynos/exynos_mixer.c @@ -920,7 +920,7 @@ static void mixer_disable_vblank(struct exynos_drm_crtc *crtc) mixer_reg_writemask(res, MXR_INT_EN, 0, MXR_INT_EN_VSYNC); }
-static void mixer_win_commit(struct exynos_drm_crtc *crtc, unsigned int win) +static void mixer_update_plane(struct exynos_drm_crtc *crtc, unsigned int win) { struct mixer_context *mixer_ctx = crtc->ctx;
@@ -941,7 +941,7 @@ static void mixer_win_commit(struct exynos_drm_crtc *crtc, unsigned int win) mixer_ctx->planes[win].enabled = true; }
-static void mixer_win_disable(struct exynos_drm_crtc *crtc, unsigned int win) +static void mixer_disable_plane(struct exynos_drm_crtc *crtc, unsigned int win) { struct mixer_context *mixer_ctx = crtc->ctx; struct mixer_resources *res = &mixer_ctx->mixer_res; @@ -1008,7 +1008,7 @@ static void mixer_window_suspend(struct mixer_context *ctx) for (i = 0; i < MIXER_WIN_NR; i++) { plane = &ctx->planes[i]; plane->resume = plane->enabled; - mixer_win_disable(ctx->crtc, i); + mixer_disable_plane(ctx->crtc, i); } mixer_wait_for_vblank(ctx->crtc); } @@ -1023,7 +1023,7 @@ static void mixer_window_resume(struct mixer_context *ctx) plane->enabled = plane->resume; plane->resume = false; if (plane->enabled) - mixer_win_commit(ctx->crtc, i); + mixer_update_plane(ctx->crtc, i); } }
@@ -1142,8 +1142,8 @@ static const struct exynos_drm_crtc_ops mixer_crtc_ops = { .enable_vblank = mixer_enable_vblank, .disable_vblank = mixer_disable_vblank, .wait_for_vblank = mixer_wait_for_vblank, - .win_commit = mixer_win_commit, - .win_disable = mixer_win_disable, + .update_plane = mixer_update_plane, + .disable_plane = mixer_disable_plane, };
static struct mixer_drv_data exynos5420_mxr_drv_data = {
From: Gustavo Padovan gustavo.padovan@collabora.co.uk
on resume (or enable()) do not call disable_plane() on planes that are already disabled.
Signed-off-by: Gustavo Padovan gustavo.padovan@collabora.co.uk --- drivers/gpu/drm/exynos/exynos_drm_fimd.c | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-)
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c index 2b0080d..9c8522b 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c @@ -786,23 +786,10 @@ static void fimd_window_resume(struct fimd_context *ctx) plane = &ctx->planes[i]; plane->enabled = plane->resume; plane->resume = false; - } -}
-static void fimd_apply(struct fimd_context *ctx) -{ - struct exynos_drm_plane *plane; - int i; - - for (i = 0; i < WINDOWS_NR; i++) { - plane = &ctx->planes[i]; if (plane->enabled) fimd_update_plane(ctx->crtc, i); - else - fimd_disable_plane(ctx->crtc, i); } - - fimd_commit(ctx->crtc); }
static void fimd_enable(struct exynos_drm_crtc *crtc) @@ -835,7 +822,7 @@ static void fimd_enable(struct exynos_drm_crtc *crtc)
fimd_window_resume(ctx);
- fimd_apply(ctx); + fimd_commit(ctx->crtc); }
static void fimd_disable(struct exynos_drm_crtc *crtc)
From: Gustavo Padovan gustavo.padovan@collabora.co.uk
We already have the plane pointer in before calling .update_plane() or disable_plane() so pass it directly to those calls avoiding a new conversion from zpos to struct exynos_drm_plane.
Signed-off-by: Gustavo Padovan gustavo.padovan@collabora.co.uk --- drivers/gpu/drm/exynos/exynos7_drm_decon.c | 26 +++++++++----------------- drivers/gpu/drm/exynos/exynos_drm_drv.h | 6 ++++-- drivers/gpu/drm/exynos/exynos_drm_fimd.c | 24 ++++++++---------------- drivers/gpu/drm/exynos/exynos_drm_plane.c | 4 ++-- drivers/gpu/drm/exynos/exynos_drm_vidi.c | 22 +++++----------------- drivers/gpu/drm/exynos/exynos_mixer.c | 28 +++++++++++++++------------- 6 files changed, 43 insertions(+), 67 deletions(-)
diff --git a/drivers/gpu/drm/exynos/exynos7_drm_decon.c b/drivers/gpu/drm/exynos/exynos7_drm_decon.c index f2b2139..acbb712 100644 --- a/drivers/gpu/drm/exynos/exynos7_drm_decon.c +++ b/drivers/gpu/drm/exynos/exynos7_drm_decon.c @@ -392,24 +392,20 @@ static void decon_shadow_protect_win(struct decon_context *ctx, writel(val, ctx->regs + SHADOWCON); }
-static void decon_update_plane(struct exynos_drm_crtc *crtc, unsigned int win) +static void decon_update_plane(struct exynos_drm_crtc *crtc, + struct exynos_drm_plane *plane) { struct decon_context *ctx = crtc->ctx; struct drm_display_mode *mode = &crtc->base.state->adjusted_mode; - struct exynos_drm_plane *plane; int padding; unsigned long val, alpha; unsigned int last_x; unsigned int last_y; + unsigned int win = plane->zpos;
if (ctx->suspended) return;
- if (win < 0 || win >= WINDOWS_NR) - return; - - plane = &ctx->planes[win]; - /* If suspended, enable this on resume */ if (ctx->suspended) { plane->resume = true; @@ -510,17 +506,13 @@ static void decon_update_plane(struct exynos_drm_crtc *crtc, unsigned int win) plane->enabled = true; }
-static void decon_disable_plane(struct exynos_drm_crtc *crtc, unsigned int win) +static void decon_disable_plane(struct exynos_drm_crtc *crtc, + struct exynos_drm_plane *plane) { struct decon_context *ctx = crtc->ctx; - struct exynos_drm_plane *plane; + unsigned int win = plane->zpos; u32 val;
- if (win < 0 || win >= WINDOWS_NR) - return; - - plane = &ctx->planes[win]; - if (ctx->suspended) { /* do not resume this window*/ plane->resume = false; @@ -554,7 +546,7 @@ static void decon_window_suspend(struct decon_context *ctx) plane = &ctx->planes[i]; plane->resume = plane->enabled; if (plane->enabled) - decon_disable_plane(ctx->crtc, i); + decon_disable_plane(ctx->crtc, plane); } }
@@ -578,9 +570,9 @@ static void decon_apply(struct decon_context *ctx) for (i = 0; i < WINDOWS_NR; i++) { plane = &ctx->planes[i]; if (plane->enabled) - decon_update_plane(ctx->crtc, i); + decon_update_plane(ctx->crtc, plane); else - decon_disable_plane(ctx->crtc, i); + decon_disable_plane(ctx->crtc, plane); }
decon_commit(ctx->crtc); diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h index 1858dae..0d19aaf 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.h +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h @@ -185,8 +185,10 @@ struct exynos_drm_crtc_ops { int (*enable_vblank)(struct exynos_drm_crtc *crtc); void (*disable_vblank)(struct exynos_drm_crtc *crtc); void (*wait_for_vblank)(struct exynos_drm_crtc *crtc); - void (*update_plane)(struct exynos_drm_crtc *crtc, unsigned int zpos); - void (*disable_plane)(struct exynos_drm_crtc *crtc, unsigned int zpos); + void (*update_plane)(struct exynos_drm_crtc *crtc, + struct exynos_drm_plane *plane); + void (*disable_plane)(struct exynos_drm_crtc *crtc, + struct exynos_drm_plane *plane); void (*te_handler)(struct exynos_drm_crtc *crtc); void (*clock_enable)(struct exynos_drm_crtc *crtc, bool enable); }; diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c index 9c8522b..5a3f9f2 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c @@ -618,22 +618,18 @@ static void fimd_shadow_protect_win(struct fimd_context *ctx, writel(val, ctx->regs + reg); }
-static void fimd_update_plane(struct exynos_drm_crtc *crtc, unsigned int win) +static void fimd_update_plane(struct exynos_drm_crtc *crtc, + struct exynos_drm_plane *plane) { struct fimd_context *ctx = crtc->ctx; - struct exynos_drm_plane *plane; dma_addr_t dma_addr; unsigned long val, size, offset; unsigned int last_x, last_y, buf_offsize, line_size; + unsigned int win = plane->zpos;
if (ctx->suspended) return;
- if (win < 0 || win >= WINDOWS_NR) - return; - - plane = &ctx->planes[win]; - /* If suspended, enable this on resume */ if (ctx->suspended) { plane->resume = true; @@ -734,15 +730,11 @@ static void fimd_update_plane(struct exynos_drm_crtc *crtc, unsigned int win) atomic_set(&ctx->win_updated, 1); }
-static void fimd_disable_plane(struct exynos_drm_crtc *crtc, unsigned int win) +static void fimd_disable_plane(struct exynos_drm_crtc *crtc, + struct exynos_drm_plane *plane) { struct fimd_context *ctx = crtc->ctx; - struct exynos_drm_plane *plane; - - if (win < 0 || win >= WINDOWS_NR) - return; - - plane = &ctx->planes[win]; + unsigned int win = plane->zpos;
if (ctx->suspended) { /* do not resume this window*/ @@ -773,7 +765,7 @@ static void fimd_window_suspend(struct fimd_context *ctx) plane = &ctx->planes[i]; plane->resume = plane->enabled; if (plane->enabled) - fimd_disable_plane(ctx->crtc, i); + fimd_disable_plane(ctx->crtc, plane); } }
@@ -788,7 +780,7 @@ static void fimd_window_resume(struct fimd_context *ctx) plane->resume = false;
if (plane->enabled) - fimd_update_plane(ctx->crtc, i); + fimd_update_plane(ctx->crtc, plane); } }
diff --git a/drivers/gpu/drm/exynos/exynos_drm_plane.c b/drivers/gpu/drm/exynos/exynos_drm_plane.c index eb9eec9..b5aa5b7 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_plane.c +++ b/drivers/gpu/drm/exynos/exynos_drm_plane.c @@ -180,7 +180,7 @@ static void exynos_plane_atomic_update(struct drm_plane *plane, state->src_w >> 16, state->src_h >> 16);
if (exynos_crtc->ops->update_plane) - exynos_crtc->ops->update_plane(exynos_crtc, exynos_plane->zpos); + exynos_crtc->ops->update_plane(exynos_crtc, exynos_plane); }
static void exynos_plane_atomic_disable(struct drm_plane *plane, @@ -194,7 +194,7 @@ static void exynos_plane_atomic_disable(struct drm_plane *plane,
if (exynos_crtc->ops->disable_plane) exynos_crtc->ops->disable_plane(exynos_crtc, - exynos_plane->zpos); + exynos_plane); }
static const struct drm_plane_helper_funcs plane_helper_funcs = { diff --git a/drivers/gpu/drm/exynos/exynos_drm_vidi.c b/drivers/gpu/drm/exynos/exynos_drm_vidi.c index ac9348b..e5089f2 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_vidi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_vidi.c @@ -118,19 +118,14 @@ static void vidi_disable_vblank(struct exynos_drm_crtc *crtc) ctx->vblank_on = false; }
-static void vidi_update_plane(struct exynos_drm_crtc *crtc, unsigned int win) +static void vidi_update_plane(struct exynos_drm_crtc *crtc, + struct exynos_drm_plane *plane) { struct vidi_context *ctx = crtc->ctx; - struct exynos_drm_plane *plane;
if (ctx->suspended) return;
- if (win < 0 || win >= WINDOWS_NR) - return; - - plane = &ctx->planes[win]; - plane->enabled = true;
DRM_DEBUG_KMS("dma_addr = %pad\n", plane->dma_addr); @@ -139,17 +134,10 @@ static void vidi_update_plane(struct exynos_drm_crtc *crtc, unsigned int win) schedule_work(&ctx->work); }
-static void vidi_disable_plane(struct exynos_drm_crtc *crtc, unsigned int win) +static void vidi_disable_plane(struct exynos_drm_crtc *crtc, + struct exynos_drm_plane *plane) { - struct vidi_context *ctx = crtc->ctx; - struct exynos_drm_plane *plane; - - if (win < 0 || win >= WINDOWS_NR) - return; - - plane = &ctx->planes[win]; plane->enabled = false; - /* TODO. */ }
@@ -170,7 +158,7 @@ static void vidi_enable(struct exynos_drm_crtc *crtc) for (i = 0; i < WINDOWS_NR; i++) { plane = &ctx->planes[i]; if (plane->enabled) - vidi_update_plane(ctx->crtc, i); + vidi_update_plane(ctx->crtc, plane); }
mutex_unlock(&ctx->lock); diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c index 3521359..bf71b43 100644 --- a/drivers/gpu/drm/exynos/exynos_mixer.c +++ b/drivers/gpu/drm/exynos/exynos_mixer.c @@ -920,11 +920,12 @@ static void mixer_disable_vblank(struct exynos_drm_crtc *crtc) mixer_reg_writemask(res, MXR_INT_EN, 0, MXR_INT_EN_VSYNC); }
-static void mixer_update_plane(struct exynos_drm_crtc *crtc, unsigned int win) +static void mixer_update_plane(struct exynos_drm_crtc *crtc, + struct exynos_drm_plane *plane) { struct mixer_context *mixer_ctx = crtc->ctx;
- DRM_DEBUG_KMS("win: %d\n", win); + DRM_DEBUG_KMS("win: %d\n", plane->zpos);
mutex_lock(&mixer_ctx->mixer_mutex); if (!mixer_ctx->powered) { @@ -933,26 +934,27 @@ static void mixer_update_plane(struct exynos_drm_crtc *crtc, unsigned int win) } mutex_unlock(&mixer_ctx->mixer_mutex);
- if (win > 1 && mixer_ctx->vp_enabled) - vp_video_buffer(mixer_ctx, win); + if (plane->zpos > 1 && mixer_ctx->vp_enabled) + vp_video_buffer(mixer_ctx, plane->zpos); else - mixer_graph_buffer(mixer_ctx, win); + mixer_graph_buffer(mixer_ctx, plane->zpos);
- mixer_ctx->planes[win].enabled = true; + plane->enabled = true; }
-static void mixer_disable_plane(struct exynos_drm_crtc *crtc, unsigned int win) +static void mixer_disable_plane(struct exynos_drm_crtc *crtc, + struct exynos_drm_plane *plane) { struct mixer_context *mixer_ctx = crtc->ctx; struct mixer_resources *res = &mixer_ctx->mixer_res; unsigned long flags;
- DRM_DEBUG_KMS("win: %d\n", win); + DRM_DEBUG_KMS("win: %d\n", plane->zpos);
mutex_lock(&mixer_ctx->mixer_mutex); if (!mixer_ctx->powered) { mutex_unlock(&mixer_ctx->mixer_mutex); - mixer_ctx->planes[win].resume = false; + plane->resume = false; return; } mutex_unlock(&mixer_ctx->mixer_mutex); @@ -960,12 +962,12 @@ static void mixer_disable_plane(struct exynos_drm_crtc *crtc, unsigned int win) spin_lock_irqsave(&res->reg_slock, flags); mixer_vsync_set_update(mixer_ctx, false);
- mixer_cfg_layer(mixer_ctx, win, false); + mixer_cfg_layer(mixer_ctx, plane->zpos, false);
mixer_vsync_set_update(mixer_ctx, true); spin_unlock_irqrestore(&res->reg_slock, flags);
- mixer_ctx->planes[win].enabled = false; + plane->enabled = false; }
static void mixer_wait_for_vblank(struct exynos_drm_crtc *crtc) @@ -1008,7 +1010,7 @@ static void mixer_window_suspend(struct mixer_context *ctx) for (i = 0; i < MIXER_WIN_NR; i++) { plane = &ctx->planes[i]; plane->resume = plane->enabled; - mixer_disable_plane(ctx->crtc, i); + mixer_disable_plane(ctx->crtc, plane); } mixer_wait_for_vblank(ctx->crtc); } @@ -1023,7 +1025,7 @@ static void mixer_window_resume(struct mixer_context *ctx) plane->enabled = plane->resume; plane->resume = false; if (plane->enabled) - mixer_update_plane(ctx->crtc, i); + mixer_update_plane(ctx->crtc, plane); } }
From: Gustavo Padovan gustavo.padovan@collabora.co.uk
The same check is place twice in fimd/decon_update_plane(), remove one of them.
Signed-off-by: Gustavo Padovan gustavo.padovan@collabora.co.uk --- drivers/gpu/drm/exynos/exynos7_drm_decon.c | 3 --- drivers/gpu/drm/exynos/exynos_drm_fimd.c | 3 --- 2 files changed, 6 deletions(-)
diff --git a/drivers/gpu/drm/exynos/exynos7_drm_decon.c b/drivers/gpu/drm/exynos/exynos7_drm_decon.c index acbb712..b773a48 100644 --- a/drivers/gpu/drm/exynos/exynos7_drm_decon.c +++ b/drivers/gpu/drm/exynos/exynos7_drm_decon.c @@ -403,9 +403,6 @@ static void decon_update_plane(struct exynos_drm_crtc *crtc, unsigned int last_y; unsigned int win = plane->zpos;
- if (ctx->suspended) - return; - /* If suspended, enable this on resume */ if (ctx->suspended) { plane->resume = true; diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c index 5a3f9f2..f586002 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c @@ -627,9 +627,6 @@ static void fimd_update_plane(struct exynos_drm_crtc *crtc, unsigned int last_x, last_y, buf_offsize, line_size; unsigned int win = plane->zpos;
- if (ctx->suspended) - return; - /* If suspended, enable this on resume */ if (ctx->suspended) { plane->resume = true;
From: Gustavo Padovan gustavo.padovan@collabora.co.uk
For some fields the use struct exynos_drm_plane filled with data from the plane state just creates a source of duplicated information and overhead. Here we change the crtc drivers to access the plane state directly simplifying the code by not relying on a exynos internal struct.
Signed-off-by: Gustavo Padovan gustavo.padovan@collabora.co.uk --- drivers/gpu/drm/exynos/exynos7_drm_decon.c | 23 ++++++----- drivers/gpu/drm/exynos/exynos_drm_fimd.c | 29 +++++++------ drivers/gpu/drm/exynos/exynos_drm_plane.c | 12 ------ drivers/gpu/drm/exynos/exynos_mixer.c | 65 ++++++++++++++++-------------- 4 files changed, 63 insertions(+), 66 deletions(-)
diff --git a/drivers/gpu/drm/exynos/exynos7_drm_decon.c b/drivers/gpu/drm/exynos/exynos7_drm_decon.c index b773a48..7a99237 100644 --- a/drivers/gpu/drm/exynos/exynos7_drm_decon.c +++ b/drivers/gpu/drm/exynos/exynos7_drm_decon.c @@ -281,16 +281,16 @@ static void decon_disable_vblank(struct exynos_drm_crtc *crtc) } }
-static void decon_win_set_pixfmt(struct decon_context *ctx, unsigned int win) +static void decon_win_set_pixfmt(struct decon_context *ctx, unsigned int win, + struct drm_framebuffer *fb) { - struct exynos_drm_plane *plane = &ctx->planes[win]; unsigned long val; int padding;
val = readl(ctx->regs + WINCON(win)); val &= ~WINCONx_BPPMODE_MASK;
- switch (plane->pixel_format) { + switch (fb->pixel_format) { case DRM_FORMAT_RGB565: val |= WINCONx_BPPMODE_16BPP_565; val |= WINCONx_BURSTLEN_16WORD; @@ -339,7 +339,7 @@ static void decon_win_set_pixfmt(struct decon_context *ctx, unsigned int win) break; }
- DRM_DEBUG_KMS("bpp = %d\n", plane->bpp); + DRM_DEBUG_KMS("bpp = %d\n", fb->bits_per_pixel);
/* * In case of exynos, setting dma-burst to 16Word causes permanent @@ -349,8 +349,8 @@ static void decon_win_set_pixfmt(struct decon_context *ctx, unsigned int win) * movement causes unstable DMA which results into iommu crash/tear. */
- padding = (plane->pitch / (plane->bpp >> 3)) - plane->fb_width; - if (plane->fb_width + padding < MIN_FB_WIDTH_FOR_16WORD_BURST) { + padding = (fb->pitches[0] / (fb->bits_per_pixel >> 3)) - fb->width; + if (fb->width + padding < MIN_FB_WIDTH_FOR_16WORD_BURST) { val &= ~WINCONx_BURSTLEN_MASK; val |= WINCONx_BURSTLEN_8WORD; } @@ -397,11 +397,14 @@ static void decon_update_plane(struct exynos_drm_crtc *crtc, { struct decon_context *ctx = crtc->ctx; struct drm_display_mode *mode = &crtc->base.state->adjusted_mode; + struct drm_plane_state *state = plane->base.state; int padding; unsigned long val, alpha; unsigned int last_x; unsigned int last_y; unsigned int win = plane->zpos; + unsigned int bpp = state->fb->bits_per_pixel >> 3; + unsigned int pitch = state->fb->pitches[0];
/* If suspended, enable this on resume */ if (ctx->suspended) { @@ -426,11 +429,11 @@ static void decon_update_plane(struct exynos_drm_crtc *crtc, val = (unsigned long)plane->dma_addr[0]; writel(val, ctx->regs + VIDW_BUF_START(win));
- padding = (plane->pitch / (plane->bpp >> 3)) - plane->fb_width; + padding = (pitch / bpp) - state->fb->width;
/* buffer size */ - writel(plane->fb_width + padding, ctx->regs + VIDW_WHOLE_X(win)); - writel(plane->fb_height, ctx->regs + VIDW_WHOLE_Y(win)); + writel(state->fb->width + padding, ctx->regs + VIDW_WHOLE_X(win)); + writel(state->fb->height, ctx->regs + VIDW_WHOLE_Y(win));
/* offset from the start of the buffer to read */ writel(plane->src_x, ctx->regs + VIDW_OFFSET_X(win)); @@ -481,7 +484,7 @@ static void decon_update_plane(struct exynos_drm_crtc *crtc,
writel(alpha, ctx->regs + VIDOSD_D(win));
- decon_win_set_pixfmt(ctx, win); + decon_win_set_pixfmt(ctx, win, state->fb);
/* hardware window 0 doesn't support color key. */ if (win != 0) diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c index f586002..2ece83b 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c @@ -490,9 +490,9 @@ static void fimd_disable_vblank(struct exynos_drm_crtc *crtc) } }
-static void fimd_win_set_pixfmt(struct fimd_context *ctx, unsigned int win) +static void fimd_win_set_pixfmt(struct fimd_context *ctx, unsigned int win, + struct drm_framebuffer *fb) { - struct exynos_drm_plane *plane = &ctx->planes[win]; unsigned long val;
val = WINCONx_ENWIN; @@ -502,11 +502,11 @@ static void fimd_win_set_pixfmt(struct fimd_context *ctx, unsigned int win) * So the request format is ARGB8888 then change it to XRGB8888. */ if (ctx->driver_data->has_limited_fmt && !win) { - if (plane->pixel_format == DRM_FORMAT_ARGB8888) - plane->pixel_format = DRM_FORMAT_XRGB8888; + if (fb->pixel_format == DRM_FORMAT_ARGB8888) + fb->pixel_format = DRM_FORMAT_XRGB8888; }
- switch (plane->pixel_format) { + switch (fb->pixel_format) { case DRM_FORMAT_C8: val |= WINCON0_BPPMODE_8BPP_PALETTE; val |= WINCONx_BURSTLEN_8WORD; @@ -542,7 +542,7 @@ static void fimd_win_set_pixfmt(struct fimd_context *ctx, unsigned int win) break; }
- DRM_DEBUG_KMS("bpp = %d\n", plane->bpp); + DRM_DEBUG_KMS("bpp = %d\n", fb->bits_per_pixel);
/* * In case of exynos, setting dma-burst to 16Word causes permanent @@ -552,7 +552,7 @@ static void fimd_win_set_pixfmt(struct fimd_context *ctx, unsigned int win) * movement causes unstable DMA which results into iommu crash/tear. */
- if (plane->fb_width < MIN_FB_WIDTH_FOR_16WORD_BURST) { + if (fb->width < MIN_FB_WIDTH_FOR_16WORD_BURST) { val &= ~WINCONx_BURSTLEN_MASK; val |= WINCONx_BURSTLEN_4WORD; } @@ -622,10 +622,13 @@ static void fimd_update_plane(struct exynos_drm_crtc *crtc, struct exynos_drm_plane *plane) { struct fimd_context *ctx = crtc->ctx; + struct drm_plane_state *state = plane->base.state; dma_addr_t dma_addr; unsigned long val, size, offset; unsigned int last_x, last_y, buf_offsize, line_size; unsigned int win = plane->zpos; + unsigned int bpp = state->fb->bits_per_pixel >> 3; + unsigned int pitch = state->fb->pitches[0];
/* If suspended, enable this on resume */ if (ctx->suspended) { @@ -647,8 +650,8 @@ static void fimd_update_plane(struct exynos_drm_crtc *crtc, fimd_shadow_protect_win(ctx, win, true);
- offset = plane->src_x * (plane->bpp >> 3); - offset += plane->src_y * plane->pitch; + offset = plane->src_x * bpp; + offset += plane->src_y * pitch;
/* buffer start address */ dma_addr = plane->dma_addr[0] + offset; @@ -656,7 +659,7 @@ static void fimd_update_plane(struct exynos_drm_crtc *crtc, writel(val, ctx->regs + VIDWx_BUF_START(win, 0));
/* buffer end address */ - size = plane->pitch * plane->crtc_height; + size = pitch * plane->crtc_height; val = (unsigned long)(dma_addr + size); writel(val, ctx->regs + VIDWx_BUF_END(win, 0));
@@ -666,8 +669,8 @@ static void fimd_update_plane(struct exynos_drm_crtc *crtc, plane->crtc_width, plane->crtc_height);
/* buffer size */ - buf_offsize = plane->pitch - (plane->crtc_width * (plane->bpp >> 3)); - line_size = plane->crtc_width * (plane->bpp >> 3); + buf_offsize = pitch - (plane->crtc_width * bpp); + line_size = plane->crtc_width * bpp; val = VIDW_BUF_SIZE_OFFSET(buf_offsize) | VIDW_BUF_SIZE_PAGEWIDTH(line_size) | VIDW_BUF_SIZE_OFFSET_E(buf_offsize) | @@ -707,7 +710,7 @@ static void fimd_update_plane(struct exynos_drm_crtc *crtc, DRM_DEBUG_KMS("osd size = 0x%x\n", (unsigned int)val); }
- fimd_win_set_pixfmt(ctx, win); + fimd_win_set_pixfmt(ctx, win, state->fb);
/* hardware window 0 doesn't support color key. */ if (win != 0) diff --git a/drivers/gpu/drm/exynos/exynos_drm_plane.c b/drivers/gpu/drm/exynos/exynos_drm_plane.c index b5aa5b7..9602797 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_plane.c +++ b/drivers/gpu/drm/exynos/exynos_drm_plane.c @@ -99,24 +99,12 @@ static void exynos_plane_mode_set(struct drm_plane *plane, exynos_plane->src_y = src_y; exynos_plane->src_width = (actual_w * exynos_plane->h_ratio) >> 16; exynos_plane->src_height = (actual_h * exynos_plane->v_ratio) >> 16; - exynos_plane->fb_width = fb->width; - exynos_plane->fb_height = fb->height; - exynos_plane->bpp = fb->bits_per_pixel; - exynos_plane->pitch = fb->pitches[0]; - exynos_plane->pixel_format = fb->pixel_format;
/* set plane range to be displayed. */ exynos_plane->crtc_x = crtc_x; exynos_plane->crtc_y = crtc_y; exynos_plane->crtc_width = actual_w; exynos_plane->crtc_height = actual_h; - - /* set drm mode data. */ - exynos_plane->mode_width = mode->hdisplay; - exynos_plane->mode_height = mode->vdisplay; - exynos_plane->refresh = mode->vrefresh; - exynos_plane->scan_flag = mode->flags; - DRM_DEBUG_KMS("plane : offset_x/y(%d,%d), width/height(%d,%d)", exynos_plane->crtc_x, exynos_plane->crtc_y, exynos_plane->crtc_width, exynos_plane->crtc_height); diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c index bf71b43..4fbafc9 100644 --- a/drivers/gpu/drm/exynos/exynos_mixer.c +++ b/drivers/gpu/drm/exynos/exynos_mixer.c @@ -380,19 +380,20 @@ static void mixer_stop(struct mixer_context *ctx) usleep_range(10000, 12000); }
-static void vp_video_buffer(struct mixer_context *ctx, unsigned int win) +static void vp_video_buffer(struct mixer_context *ctx, + struct exynos_drm_plane *plane) { struct mixer_resources *res = &ctx->mixer_res; + struct drm_plane_state *state = plane->base.state; + struct drm_framebuffer *fb = state->fb; + struct drm_display_mode *mode = &state->crtc->mode; unsigned long flags; - struct exynos_drm_plane *plane; dma_addr_t luma_addr[2], chroma_addr[2]; bool tiled_mode = false; bool crcb_mode = false; u32 val;
- plane = &ctx->planes[win]; - - switch (plane->pixel_format) { + switch (fb->pixel_format) { case DRM_FORMAT_NV12: crcb_mode = false; break; @@ -401,21 +402,21 @@ static void vp_video_buffer(struct mixer_context *ctx, unsigned int win) break; default: DRM_ERROR("pixel format for vp is wrong [%d].\n", - plane->pixel_format); + fb->pixel_format); return; }
luma_addr[0] = plane->dma_addr[0]; chroma_addr[0] = plane->dma_addr[1];
- if (plane->scan_flag & DRM_MODE_FLAG_INTERLACE) { + if (mode->flags & DRM_MODE_FLAG_INTERLACE) { ctx->interlace = true; if (tiled_mode) { luma_addr[1] = luma_addr[0] + 0x40; chroma_addr[1] = chroma_addr[0] + 0x40; } else { - luma_addr[1] = luma_addr[0] + plane->pitch; - chroma_addr[1] = chroma_addr[0] + plane->pitch; + luma_addr[1] = luma_addr[0] + fb->pitches[0]; + chroma_addr[1] = chroma_addr[0] + fb->pitches[0]; } } else { ctx->interlace = false; @@ -436,11 +437,11 @@ static void vp_video_buffer(struct mixer_context *ctx, unsigned int win) vp_reg_writemask(res, VP_MODE, val, VP_MODE_FMT_MASK);
/* setting size of input image */ - vp_reg_write(res, VP_IMG_SIZE_Y, VP_IMG_HSIZE(plane->pitch) | - VP_IMG_VSIZE(plane->fb_height)); + vp_reg_write(res, VP_IMG_SIZE_Y, VP_IMG_HSIZE(fb->pitches[0]) | + VP_IMG_VSIZE(fb->height)); /* chroma height has to reduced by 2 to avoid chroma distorions */ - vp_reg_write(res, VP_IMG_SIZE_C, VP_IMG_HSIZE(plane->pitch) | - VP_IMG_VSIZE(plane->fb_height / 2)); + vp_reg_write(res, VP_IMG_SIZE_C, VP_IMG_HSIZE(fb->pitches[0]) | + VP_IMG_VSIZE(fb->height / 2));
vp_reg_write(res, VP_SRC_WIDTH, plane->src_width); vp_reg_write(res, VP_SRC_HEIGHT, plane->src_height); @@ -469,9 +470,9 @@ static void vp_video_buffer(struct mixer_context *ctx, unsigned int win) vp_reg_write(res, VP_TOP_C_PTR, chroma_addr[0]); vp_reg_write(res, VP_BOT_C_PTR, chroma_addr[1]);
- mixer_cfg_scan(ctx, plane->mode_height); - mixer_cfg_rgb_fmt(ctx, plane->mode_height); - mixer_cfg_layer(ctx, win, true); + mixer_cfg_scan(ctx, mode->vdisplay); + mixer_cfg_rgb_fmt(ctx, mode->vdisplay); + mixer_cfg_layer(ctx, plane->zpos, true); mixer_run(ctx);
mixer_vsync_set_update(ctx, true); @@ -512,20 +513,22 @@ fail: return -ENOTSUPP; }
-static void mixer_graph_buffer(struct mixer_context *ctx, unsigned int win) +static void mixer_graph_buffer(struct mixer_context *ctx, + struct exynos_drm_plane *plane) { struct mixer_resources *res = &ctx->mixer_res; + struct drm_plane_state *state = plane->base.state; + struct drm_framebuffer *fb = state->fb; + struct drm_display_mode *mode = &state->crtc->mode; unsigned long flags; - struct exynos_drm_plane *plane; + unsigned int win = plane->zpos; unsigned int x_ratio = 0, y_ratio = 0; unsigned int src_x_offset, src_y_offset, dst_x_offset, dst_y_offset; dma_addr_t dma_addr; unsigned int fmt; u32 val;
- plane = &ctx->planes[win]; - - switch (plane->pixel_format) { + switch (fb->pixel_format) { case DRM_FORMAT_XRGB4444: fmt = MXR_FORMAT_ARGB4444; break; @@ -557,12 +560,12 @@ static void mixer_graph_buffer(struct mixer_context *ctx, unsigned int win)
/* converting dma address base and source offset */ dma_addr = plane->dma_addr[0] - + (plane->src_x * plane->bpp >> 3) - + (plane->src_y * plane->pitch); + + (plane->src_x * fb->bits_per_pixel >> 3) + + (plane->src_y * fb->pitches[0]); src_x_offset = 0; src_y_offset = 0;
- if (plane->scan_flag & DRM_MODE_FLAG_INTERLACE) + if (mode->flags & DRM_MODE_FLAG_INTERLACE) ctx->interlace = true; else ctx->interlace = false; @@ -576,13 +579,13 @@ static void mixer_graph_buffer(struct mixer_context *ctx, unsigned int win)
/* setup geometry */ mixer_reg_write(res, MXR_GRAPHIC_SPAN(win), - plane->pitch / (plane->bpp >> 3)); + fb->pitches[0] / (fb->bits_per_pixel >> 3));
/* setup display size */ if (ctx->mxr_ver == MXR_VER_128_0_0_184 && win == MIXER_DEFAULT_WIN) { - val = MXR_MXR_RES_HEIGHT(plane->mode_height); - val |= MXR_MXR_RES_WIDTH(plane->mode_width); + val = MXR_MXR_RES_HEIGHT(mode->vdisplay); + val |= MXR_MXR_RES_WIDTH(mode->hdisplay); mixer_reg_write(res, MXR_RESOLUTION, val); }
@@ -605,8 +608,8 @@ static void mixer_graph_buffer(struct mixer_context *ctx, unsigned int win) /* set buffer address to mixer */ mixer_reg_write(res, MXR_GRAPHIC_BASE(win), dma_addr);
- mixer_cfg_scan(ctx, plane->mode_height); - mixer_cfg_rgb_fmt(ctx, plane->mode_height); + mixer_cfg_scan(ctx, mode->vdisplay); + mixer_cfg_rgb_fmt(ctx, mode->vdisplay); mixer_cfg_layer(ctx, win, true);
/* layer update mandatory for mixer 16.0.33.0 */ @@ -935,9 +938,9 @@ static void mixer_update_plane(struct exynos_drm_crtc *crtc, mutex_unlock(&mixer_ctx->mixer_mutex);
if (plane->zpos > 1 && mixer_ctx->vp_enabled) - vp_video_buffer(mixer_ctx, plane->zpos); + vp_video_buffer(mixer_ctx, plane); else - mixer_graph_buffer(mixer_ctx, plane->zpos); + mixer_graph_buffer(mixer_ctx, plane);
plane->enabled = true; }
From: Gustavo Padovan gustavo.padovan@collabora.co.uk
Now after the mode to use drm_plane_state directly struct drm_plane_state has many unused fields, along with others that weren't used before the plane state change. Thus remove them all.
Signed-off-by: Gustavo Padovan gustavo.padovan@collabora.co.uk --- drivers/gpu/drm/exynos/exynos_drm_drv.h | 18 ------------------ 1 file changed, 18 deletions(-)
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h index 0d19aaf..b83d487 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.h +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h @@ -53,21 +53,12 @@ enum exynos_drm_output_type { * - the unit is screen coordinates. * @src_width: width of a partial image to be displayed from framebuffer. * @src_height: height of a partial image to be displayed from framebuffer. - * @fb_width: width of a framebuffer. - * @fb_height: height of a framebuffer. * @crtc_x: offset x on hardware screen. * @crtc_y: offset y on hardware screen. * @crtc_width: window width to be displayed (hardware screen). * @crtc_height: window height to be displayed (hardware screen). - * @mode_width: width of screen mode. - * @mode_height: height of screen mode. * @h_ratio: horizontal scaling ratio, 16.16 fixed point * @v_ratio: vertical scaling ratio, 16.16 fixed point - * @refresh: refresh rate. - * @scan_flag: interlace or progressive way. - * (it could be DRM_MODE_FLAG_*) - * @bpp: pixel size.(in bit) - * @pixel_format: fourcc pixel format of this overlay * @dma_addr: array of bus(accessed by dma) address to the memory region * allocated for a overlay. * @zpos: order of overlay layer(z position). @@ -84,21 +75,12 @@ struct exynos_drm_plane { unsigned int src_y; unsigned int src_width; unsigned int src_height; - unsigned int fb_width; - unsigned int fb_height; unsigned int crtc_x; unsigned int crtc_y; unsigned int crtc_width; unsigned int crtc_height; - unsigned int mode_width; - unsigned int mode_height; unsigned int h_ratio; unsigned int v_ratio; - unsigned int refresh; - unsigned int scan_flag; - unsigned int bpp; - unsigned int pitch; - uint32_t pixel_format; dma_addr_t dma_addr[MAX_FB_BUFFER]; unsigned int zpos;
From: Gustavo Padovan gustavo.padovan@collabora.co.uk
Rename crtc_{widht,height} to crtc_{w,h} and src_{width,height} to src_{w,h} to make it similar to the atomic state names.
Signed-off-by: Gustavo Padovan gustavo.padovan@collabora.co.uk --- drivers/gpu/drm/exynos/exynos7_drm_decon.c | 14 +++++++------- drivers/gpu/drm/exynos/exynos_drm_drv.h | 16 ++++++++-------- drivers/gpu/drm/exynos/exynos_drm_fimd.c | 14 +++++++------- drivers/gpu/drm/exynos/exynos_drm_plane.c | 11 ++++++----- drivers/gpu/drm/exynos/exynos_mixer.c | 22 +++++++++++----------- 5 files changed, 39 insertions(+), 38 deletions(-)
diff --git a/drivers/gpu/drm/exynos/exynos7_drm_decon.c b/drivers/gpu/drm/exynos/exynos7_drm_decon.c index 7a99237..4e63a9c 100644 --- a/drivers/gpu/drm/exynos/exynos7_drm_decon.c +++ b/drivers/gpu/drm/exynos/exynos7_drm_decon.c @@ -442,25 +442,25 @@ static void decon_update_plane(struct exynos_drm_crtc *crtc, DRM_DEBUG_KMS("start addr = 0x%lx\n", (unsigned long)val); DRM_DEBUG_KMS("ovl_width = %d, ovl_height = %d\n", - plane->crtc_width, plane->crtc_height); + plane->crtc_w, plane->crtc_h);
/* * OSD position. * In case the window layout goes of LCD layout, DECON fails. */ - if ((plane->crtc_x + plane->crtc_width) > mode->hdisplay) - plane->crtc_x = mode->hdisplay - plane->crtc_width; - if ((plane->crtc_y + plane->crtc_height) > mode->vdisplay) - plane->crtc_y = mode->vdisplay - plane->crtc_height; + if ((plane->crtc_x + plane->crtc_w) > mode->hdisplay) + plane->crtc_x = mode->hdisplay - plane->crtc_w; + if ((plane->crtc_y + plane->crtc_h) > mode->vdisplay) + plane->crtc_y = mode->vdisplay - plane->crtc_h;
val = VIDOSDxA_TOPLEFT_X(plane->crtc_x) | VIDOSDxA_TOPLEFT_Y(plane->crtc_y); writel(val, ctx->regs + VIDOSD_A(win));
- last_x = plane->crtc_x + plane->crtc_width; + last_x = plane->crtc_x + plane->crtc_w; if (last_x) last_x--; - last_y = plane->crtc_y + plane->crtc_height; + last_y = plane->crtc_y + plane->crtc_h; if (last_y) last_y--;
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h index b83d487..7c6196e 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.h +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h @@ -51,12 +51,12 @@ enum exynos_drm_output_type { * - the unit is screen coordinates. * @src_y: offset y on a framebuffer to be displayed. * - the unit is screen coordinates. - * @src_width: width of a partial image to be displayed from framebuffer. - * @src_height: height of a partial image to be displayed from framebuffer. + * @src_w: width of a partial image to be displayed from framebuffer. + * @src_h: height of a partial image to be displayed from framebuffer. * @crtc_x: offset x on hardware screen. * @crtc_y: offset y on hardware screen. - * @crtc_width: window width to be displayed (hardware screen). - * @crtc_height: window height to be displayed (hardware screen). + * @crtc_w: window width to be displayed (hardware screen). + * @crtc_h: window height to be displayed (hardware screen). * @h_ratio: horizontal scaling ratio, 16.16 fixed point * @v_ratio: vertical scaling ratio, 16.16 fixed point * @dma_addr: array of bus(accessed by dma) address to the memory region @@ -73,12 +73,12 @@ struct exynos_drm_plane { struct drm_plane base; unsigned int src_x; unsigned int src_y; - unsigned int src_width; - unsigned int src_height; + unsigned int src_w; + unsigned int src_h; unsigned int crtc_x; unsigned int crtc_y; - unsigned int crtc_width; - unsigned int crtc_height; + unsigned int crtc_w; + unsigned int crtc_h; unsigned int h_ratio; unsigned int v_ratio; dma_addr_t dma_addr[MAX_FB_BUFFER]; diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c index 2ece83b..920727b 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c @@ -659,18 +659,18 @@ static void fimd_update_plane(struct exynos_drm_crtc *crtc, writel(val, ctx->regs + VIDWx_BUF_START(win, 0));
/* buffer end address */ - size = pitch * plane->crtc_height; + size = pitch * plane->crtc_h; val = (unsigned long)(dma_addr + size); writel(val, ctx->regs + VIDWx_BUF_END(win, 0));
DRM_DEBUG_KMS("start addr = 0x%lx, end addr = 0x%lx, size = 0x%lx\n", (unsigned long)dma_addr, val, size); DRM_DEBUG_KMS("ovl_width = %d, ovl_height = %d\n", - plane->crtc_width, plane->crtc_height); + plane->crtc_w, plane->crtc_h);
/* buffer size */ - buf_offsize = pitch - (plane->crtc_width * bpp); - line_size = plane->crtc_width * bpp; + buf_offsize = pitch - (plane->crtc_w * bpp); + line_size = plane->crtc_w * bpp; val = VIDW_BUF_SIZE_OFFSET(buf_offsize) | VIDW_BUF_SIZE_PAGEWIDTH(line_size) | VIDW_BUF_SIZE_OFFSET_E(buf_offsize) | @@ -684,10 +684,10 @@ static void fimd_update_plane(struct exynos_drm_crtc *crtc, VIDOSDxA_TOPLEFT_Y_E(plane->crtc_y); writel(val, ctx->regs + VIDOSD_A(win));
- last_x = plane->crtc_x + plane->crtc_width; + last_x = plane->crtc_x + plane->crtc_w; if (last_x) last_x--; - last_y = plane->crtc_y + plane->crtc_height; + last_y = plane->crtc_y + plane->crtc_h; if (last_y) last_y--;
@@ -704,7 +704,7 @@ static void fimd_update_plane(struct exynos_drm_crtc *crtc, u32 offset = VIDOSD_D(win); if (win == 0) offset = VIDOSD_C(win); - val = plane->crtc_width * plane->crtc_height; + val = plane->crtc_w * plane->crtc_h; writel(val, ctx->regs + offset);
DRM_DEBUG_KMS("osd size = 0x%x\n", (unsigned int)val); diff --git a/drivers/gpu/drm/exynos/exynos_drm_plane.c b/drivers/gpu/drm/exynos/exynos_drm_plane.c index 9602797..bebc957 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_plane.c +++ b/drivers/gpu/drm/exynos/exynos_drm_plane.c @@ -97,17 +97,18 @@ static void exynos_plane_mode_set(struct drm_plane *plane, /* set drm framebuffer data. */ exynos_plane->src_x = src_x; exynos_plane->src_y = src_y; - exynos_plane->src_width = (actual_w * exynos_plane->h_ratio) >> 16; - exynos_plane->src_height = (actual_h * exynos_plane->v_ratio) >> 16; + exynos_plane->src_w = (actual_w * exynos_plane->h_ratio) >> 16; + exynos_plane->src_h = (actual_h * exynos_plane->v_ratio) >> 16;
/* set plane range to be displayed. */ exynos_plane->crtc_x = crtc_x; exynos_plane->crtc_y = crtc_y; - exynos_plane->crtc_width = actual_w; - exynos_plane->crtc_height = actual_h; + exynos_plane->crtc_w = actual_w; + exynos_plane->crtc_h = actual_h; + DRM_DEBUG_KMS("plane : offset_x/y(%d,%d), width/height(%d,%d)", exynos_plane->crtc_x, exynos_plane->crtc_y, - exynos_plane->crtc_width, exynos_plane->crtc_height); + exynos_plane->crtc_w, exynos_plane->crtc_h);
plane->crtc = crtc; } diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c index 4fbafc9..f8ef8c6 100644 --- a/drivers/gpu/drm/exynos/exynos_mixer.c +++ b/drivers/gpu/drm/exynos/exynos_mixer.c @@ -443,19 +443,19 @@ static void vp_video_buffer(struct mixer_context *ctx, vp_reg_write(res, VP_IMG_SIZE_C, VP_IMG_HSIZE(fb->pitches[0]) | VP_IMG_VSIZE(fb->height / 2));
- vp_reg_write(res, VP_SRC_WIDTH, plane->src_width); - vp_reg_write(res, VP_SRC_HEIGHT, plane->src_height); + vp_reg_write(res, VP_SRC_WIDTH, plane->src_w); + vp_reg_write(res, VP_SRC_HEIGHT, plane->src_h); vp_reg_write(res, VP_SRC_H_POSITION, VP_SRC_H_POSITION_VAL(plane->src_x)); vp_reg_write(res, VP_SRC_V_POSITION, plane->src_y);
- vp_reg_write(res, VP_DST_WIDTH, plane->crtc_width); + vp_reg_write(res, VP_DST_WIDTH, plane->crtc_w); vp_reg_write(res, VP_DST_H_POSITION, plane->crtc_x); if (ctx->interlace) { - vp_reg_write(res, VP_DST_HEIGHT, plane->crtc_height / 2); + vp_reg_write(res, VP_DST_HEIGHT, plane->crtc_h / 2); vp_reg_write(res, VP_DST_V_POSITION, plane->crtc_y / 2); } else { - vp_reg_write(res, VP_DST_HEIGHT, plane->crtc_height); + vp_reg_write(res, VP_DST_HEIGHT, plane->crtc_h); vp_reg_write(res, VP_DST_V_POSITION, plane->crtc_y); }
@@ -492,15 +492,15 @@ static void mixer_layer_update(struct mixer_context *ctx) static int mixer_setup_scale(const struct exynos_drm_plane *plane, unsigned int *x_ratio, unsigned int *y_ratio) { - if (plane->crtc_width != plane->src_width) { - if (plane->crtc_width == 2 * plane->src_width) + if (plane->crtc_w != plane->src_w) { + if (plane->crtc_w == 2 * plane->src_w) *x_ratio = 1; else goto fail; }
- if (plane->crtc_height != plane->src_height) { - if (plane->crtc_height == 2 * plane->src_height) + if (plane->crtc_h != plane->src_h) { + if (plane->crtc_h == 2 * plane->src_h) *y_ratio = 1; else goto fail; @@ -589,8 +589,8 @@ static void mixer_graph_buffer(struct mixer_context *ctx, mixer_reg_write(res, MXR_RESOLUTION, val); }
- val = MXR_GRP_WH_WIDTH(plane->src_width); - val |= MXR_GRP_WH_HEIGHT(plane->src_height); + val = MXR_GRP_WH_WIDTH(plane->src_w); + val |= MXR_GRP_WH_HEIGHT(plane->src_h); val |= MXR_GRP_WH_H_SCALE(x_ratio); val |= MXR_GRP_WH_V_SCALE(y_ratio); mixer_reg_write(res, MXR_GRAPHIC_WH(win), val);
Hi Inki and Joonyoung,
Any comments on this series?
2015-06-03 Gustavo Padovan gustavo@padovan.org:
From: Gustavo Padovan gustavo.padovan@collabora.co.uk
Rename crtc_{widht,height} to crtc_{w,h} and src_{width,height} to src_{w,h} to make it similar to the atomic state names.
Signed-off-by: Gustavo Padovan gustavo.padovan@collabora.co.uk
drivers/gpu/drm/exynos/exynos7_drm_decon.c | 14 +++++++------- drivers/gpu/drm/exynos/exynos_drm_drv.h | 16 ++++++++-------- drivers/gpu/drm/exynos/exynos_drm_fimd.c | 14 +++++++------- drivers/gpu/drm/exynos/exynos_drm_plane.c | 11 ++++++----- drivers/gpu/drm/exynos/exynos_mixer.c | 22 +++++++++++----------- 5 files changed, 39 insertions(+), 38 deletions(-)
diff --git a/drivers/gpu/drm/exynos/exynos7_drm_decon.c b/drivers/gpu/drm/exynos/exynos7_drm_decon.c index 7a99237..4e63a9c 100644 --- a/drivers/gpu/drm/exynos/exynos7_drm_decon.c +++ b/drivers/gpu/drm/exynos/exynos7_drm_decon.c @@ -442,25 +442,25 @@ static void decon_update_plane(struct exynos_drm_crtc *crtc, DRM_DEBUG_KMS("start addr = 0x%lx\n", (unsigned long)val); DRM_DEBUG_KMS("ovl_width = %d, ovl_height = %d\n",
plane->crtc_width, plane->crtc_height);
plane->crtc_w, plane->crtc_h);
/*
- OSD position.
- In case the window layout goes of LCD layout, DECON fails.
*/
- if ((plane->crtc_x + plane->crtc_width) > mode->hdisplay)
plane->crtc_x = mode->hdisplay - plane->crtc_width;
- if ((plane->crtc_y + plane->crtc_height) > mode->vdisplay)
plane->crtc_y = mode->vdisplay - plane->crtc_height;
if ((plane->crtc_x + plane->crtc_w) > mode->hdisplay)
plane->crtc_x = mode->hdisplay - plane->crtc_w;
if ((plane->crtc_y + plane->crtc_h) > mode->vdisplay)
plane->crtc_y = mode->vdisplay - plane->crtc_h;
val = VIDOSDxA_TOPLEFT_X(plane->crtc_x) | VIDOSDxA_TOPLEFT_Y(plane->crtc_y); writel(val, ctx->regs + VIDOSD_A(win));
- last_x = plane->crtc_x + plane->crtc_width;
- last_x = plane->crtc_x + plane->crtc_w; if (last_x) last_x--;
- last_y = plane->crtc_y + plane->crtc_height;
- last_y = plane->crtc_y + plane->crtc_h; if (last_y) last_y--;
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h index b83d487..7c6196e 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.h +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h @@ -51,12 +51,12 @@ enum exynos_drm_output_type {
- the unit is screen coordinates.
- @src_y: offset y on a framebuffer to be displayed.
- the unit is screen coordinates.
- @src_width: width of a partial image to be displayed from framebuffer.
- @src_height: height of a partial image to be displayed from framebuffer.
- @src_w: width of a partial image to be displayed from framebuffer.
- @src_h: height of a partial image to be displayed from framebuffer.
- @crtc_x: offset x on hardware screen.
- @crtc_y: offset y on hardware screen.
- @crtc_width: window width to be displayed (hardware screen).
- @crtc_height: window height to be displayed (hardware screen).
- @crtc_w: window width to be displayed (hardware screen).
- @crtc_h: window height to be displayed (hardware screen).
- @h_ratio: horizontal scaling ratio, 16.16 fixed point
- @v_ratio: vertical scaling ratio, 16.16 fixed point
- @dma_addr: array of bus(accessed by dma) address to the memory region
@@ -73,12 +73,12 @@ struct exynos_drm_plane { struct drm_plane base; unsigned int src_x; unsigned int src_y;
- unsigned int src_width;
- unsigned int src_height;
- unsigned int src_w;
- unsigned int src_h; unsigned int crtc_x; unsigned int crtc_y;
- unsigned int crtc_width;
- unsigned int crtc_height;
- unsigned int crtc_w;
- unsigned int crtc_h; unsigned int h_ratio; unsigned int v_ratio; dma_addr_t dma_addr[MAX_FB_BUFFER];
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c index 2ece83b..920727b 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c @@ -659,18 +659,18 @@ static void fimd_update_plane(struct exynos_drm_crtc *crtc, writel(val, ctx->regs + VIDWx_BUF_START(win, 0));
/* buffer end address */
- size = pitch * plane->crtc_height;
size = pitch * plane->crtc_h; val = (unsigned long)(dma_addr + size); writel(val, ctx->regs + VIDWx_BUF_END(win, 0));
DRM_DEBUG_KMS("start addr = 0x%lx, end addr = 0x%lx, size = 0x%lx\n", (unsigned long)dma_addr, val, size); DRM_DEBUG_KMS("ovl_width = %d, ovl_height = %d\n",
plane->crtc_width, plane->crtc_height);
plane->crtc_w, plane->crtc_h);
/* buffer size */
- buf_offsize = pitch - (plane->crtc_width * bpp);
- line_size = plane->crtc_width * bpp;
- buf_offsize = pitch - (plane->crtc_w * bpp);
- line_size = plane->crtc_w * bpp; val = VIDW_BUF_SIZE_OFFSET(buf_offsize) | VIDW_BUF_SIZE_PAGEWIDTH(line_size) | VIDW_BUF_SIZE_OFFSET_E(buf_offsize) |
@@ -684,10 +684,10 @@ static void fimd_update_plane(struct exynos_drm_crtc *crtc, VIDOSDxA_TOPLEFT_Y_E(plane->crtc_y); writel(val, ctx->regs + VIDOSD_A(win));
- last_x = plane->crtc_x + plane->crtc_width;
- last_x = plane->crtc_x + plane->crtc_w; if (last_x) last_x--;
- last_y = plane->crtc_y + plane->crtc_height;
- last_y = plane->crtc_y + plane->crtc_h; if (last_y) last_y--;
@@ -704,7 +704,7 @@ static void fimd_update_plane(struct exynos_drm_crtc *crtc, u32 offset = VIDOSD_D(win); if (win == 0) offset = VIDOSD_C(win);
val = plane->crtc_width * plane->crtc_height;
val = plane->crtc_w * plane->crtc_h;
writel(val, ctx->regs + offset);
DRM_DEBUG_KMS("osd size = 0x%x\n", (unsigned int)val);
diff --git a/drivers/gpu/drm/exynos/exynos_drm_plane.c b/drivers/gpu/drm/exynos/exynos_drm_plane.c index 9602797..bebc957 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_plane.c +++ b/drivers/gpu/drm/exynos/exynos_drm_plane.c @@ -97,17 +97,18 @@ static void exynos_plane_mode_set(struct drm_plane *plane, /* set drm framebuffer data. */ exynos_plane->src_x = src_x; exynos_plane->src_y = src_y;
- exynos_plane->src_width = (actual_w * exynos_plane->h_ratio) >> 16;
- exynos_plane->src_height = (actual_h * exynos_plane->v_ratio) >> 16;
exynos_plane->src_w = (actual_w * exynos_plane->h_ratio) >> 16;
exynos_plane->src_h = (actual_h * exynos_plane->v_ratio) >> 16;
/* set plane range to be displayed. */ exynos_plane->crtc_x = crtc_x; exynos_plane->crtc_y = crtc_y;
- exynos_plane->crtc_width = actual_w;
- exynos_plane->crtc_height = actual_h;
- exynos_plane->crtc_w = actual_w;
- exynos_plane->crtc_h = actual_h;
- DRM_DEBUG_KMS("plane : offset_x/y(%d,%d), width/height(%d,%d)", exynos_plane->crtc_x, exynos_plane->crtc_y,
exynos_plane->crtc_width, exynos_plane->crtc_height);
exynos_plane->crtc_w, exynos_plane->crtc_h);
plane->crtc = crtc;
} diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c index 4fbafc9..f8ef8c6 100644 --- a/drivers/gpu/drm/exynos/exynos_mixer.c +++ b/drivers/gpu/drm/exynos/exynos_mixer.c @@ -443,19 +443,19 @@ static void vp_video_buffer(struct mixer_context *ctx, vp_reg_write(res, VP_IMG_SIZE_C, VP_IMG_HSIZE(fb->pitches[0]) | VP_IMG_VSIZE(fb->height / 2));
- vp_reg_write(res, VP_SRC_WIDTH, plane->src_width);
- vp_reg_write(res, VP_SRC_HEIGHT, plane->src_height);
- vp_reg_write(res, VP_SRC_WIDTH, plane->src_w);
- vp_reg_write(res, VP_SRC_HEIGHT, plane->src_h); vp_reg_write(res, VP_SRC_H_POSITION, VP_SRC_H_POSITION_VAL(plane->src_x)); vp_reg_write(res, VP_SRC_V_POSITION, plane->src_y);
- vp_reg_write(res, VP_DST_WIDTH, plane->crtc_width);
- vp_reg_write(res, VP_DST_WIDTH, plane->crtc_w); vp_reg_write(res, VP_DST_H_POSITION, plane->crtc_x); if (ctx->interlace) {
vp_reg_write(res, VP_DST_HEIGHT, plane->crtc_height / 2);
vp_reg_write(res, VP_DST_V_POSITION, plane->crtc_y / 2); } else {vp_reg_write(res, VP_DST_HEIGHT, plane->crtc_h / 2);
vp_reg_write(res, VP_DST_HEIGHT, plane->crtc_height);
vp_reg_write(res, VP_DST_V_POSITION, plane->crtc_y); }vp_reg_write(res, VP_DST_HEIGHT, plane->crtc_h);
@@ -492,15 +492,15 @@ static void mixer_layer_update(struct mixer_context *ctx) static int mixer_setup_scale(const struct exynos_drm_plane *plane, unsigned int *x_ratio, unsigned int *y_ratio) {
- if (plane->crtc_width != plane->src_width) {
if (plane->crtc_width == 2 * plane->src_width)
- if (plane->crtc_w != plane->src_w) {
else goto fail; }if (plane->crtc_w == 2 * plane->src_w) *x_ratio = 1;
- if (plane->crtc_height != plane->src_height) {
if (plane->crtc_height == 2 * plane->src_height)
- if (plane->crtc_h != plane->src_h) {
else goto fail;if (plane->crtc_h == 2 * plane->src_h) *y_ratio = 1;
@@ -589,8 +589,8 @@ static void mixer_graph_buffer(struct mixer_context *ctx, mixer_reg_write(res, MXR_RESOLUTION, val); }
- val = MXR_GRP_WH_WIDTH(plane->src_width);
- val |= MXR_GRP_WH_HEIGHT(plane->src_height);
- val = MXR_GRP_WH_WIDTH(plane->src_w);
- val |= MXR_GRP_WH_HEIGHT(plane->src_h); val |= MXR_GRP_WH_H_SCALE(x_ratio); val |= MXR_GRP_WH_V_SCALE(y_ratio); mixer_reg_write(res, MXR_GRAPHIC_WH(win), val);
-- 2.1.0
Gustavo
On 06/09/2015 11:27 PM, Gustavo Padovan wrote:
Hi Inki and Joonyoung,
Any comments on this series?
I saw this series in brief and good mostly. I feel it can be better to split a atomic patch and cleanup patches, it can make to merge easier.
It's problem to give late any feedback about patches posted, i will try to review them but i have no time. Sorry about that again.
Thanks.
2015-06-03 Gustavo Padovan gustavo@padovan.org:
From: Gustavo Padovan gustavo.padovan@collabora.co.uk
Rename crtc_{widht,height} to crtc_{w,h} and src_{width,height} to src_{w,h} to make it similar to the atomic state names.
Signed-off-by: Gustavo Padovan gustavo.padovan@collabora.co.uk
drivers/gpu/drm/exynos/exynos7_drm_decon.c | 14 +++++++------- drivers/gpu/drm/exynos/exynos_drm_drv.h | 16 ++++++++-------- drivers/gpu/drm/exynos/exynos_drm_fimd.c | 14 +++++++------- drivers/gpu/drm/exynos/exynos_drm_plane.c | 11 ++++++----- drivers/gpu/drm/exynos/exynos_mixer.c | 22 +++++++++++----------- 5 files changed, 39 insertions(+), 38 deletions(-)
diff --git a/drivers/gpu/drm/exynos/exynos7_drm_decon.c b/drivers/gpu/drm/exynos/exynos7_drm_decon.c index 7a99237..4e63a9c 100644 --- a/drivers/gpu/drm/exynos/exynos7_drm_decon.c +++ b/drivers/gpu/drm/exynos/exynos7_drm_decon.c @@ -442,25 +442,25 @@ static void decon_update_plane(struct exynos_drm_crtc *crtc, DRM_DEBUG_KMS("start addr = 0x%lx\n", (unsigned long)val); DRM_DEBUG_KMS("ovl_width = %d, ovl_height = %d\n",
plane->crtc_width, plane->crtc_height);
plane->crtc_w, plane->crtc_h);
/*
- OSD position.
- In case the window layout goes of LCD layout, DECON fails.
*/
- if ((plane->crtc_x + plane->crtc_width) > mode->hdisplay)
plane->crtc_x = mode->hdisplay - plane->crtc_width;
- if ((plane->crtc_y + plane->crtc_height) > mode->vdisplay)
plane->crtc_y = mode->vdisplay - plane->crtc_height;
if ((plane->crtc_x + plane->crtc_w) > mode->hdisplay)
plane->crtc_x = mode->hdisplay - plane->crtc_w;
if ((plane->crtc_y + plane->crtc_h) > mode->vdisplay)
plane->crtc_y = mode->vdisplay - plane->crtc_h;
val = VIDOSDxA_TOPLEFT_X(plane->crtc_x) | VIDOSDxA_TOPLEFT_Y(plane->crtc_y); writel(val, ctx->regs + VIDOSD_A(win));
- last_x = plane->crtc_x + plane->crtc_width;
- last_x = plane->crtc_x + plane->crtc_w; if (last_x) last_x--;
- last_y = plane->crtc_y + plane->crtc_height;
- last_y = plane->crtc_y + plane->crtc_h; if (last_y) last_y--;
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h index b83d487..7c6196e 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.h +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h @@ -51,12 +51,12 @@ enum exynos_drm_output_type {
- the unit is screen coordinates.
- @src_y: offset y on a framebuffer to be displayed.
- the unit is screen coordinates.
- @src_width: width of a partial image to be displayed from framebuffer.
- @src_height: height of a partial image to be displayed from framebuffer.
- @src_w: width of a partial image to be displayed from framebuffer.
- @src_h: height of a partial image to be displayed from framebuffer.
- @crtc_x: offset x on hardware screen.
- @crtc_y: offset y on hardware screen.
- @crtc_width: window width to be displayed (hardware screen).
- @crtc_height: window height to be displayed (hardware screen).
- @crtc_w: window width to be displayed (hardware screen).
- @crtc_h: window height to be displayed (hardware screen).
- @h_ratio: horizontal scaling ratio, 16.16 fixed point
- @v_ratio: vertical scaling ratio, 16.16 fixed point
- @dma_addr: array of bus(accessed by dma) address to the memory region
@@ -73,12 +73,12 @@ struct exynos_drm_plane { struct drm_plane base; unsigned int src_x; unsigned int src_y;
- unsigned int src_width;
- unsigned int src_height;
- unsigned int src_w;
- unsigned int src_h; unsigned int crtc_x; unsigned int crtc_y;
- unsigned int crtc_width;
- unsigned int crtc_height;
- unsigned int crtc_w;
- unsigned int crtc_h; unsigned int h_ratio; unsigned int v_ratio; dma_addr_t dma_addr[MAX_FB_BUFFER];
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c index 2ece83b..920727b 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c @@ -659,18 +659,18 @@ static void fimd_update_plane(struct exynos_drm_crtc *crtc, writel(val, ctx->regs + VIDWx_BUF_START(win, 0));
/* buffer end address */
- size = pitch * plane->crtc_height;
size = pitch * plane->crtc_h; val = (unsigned long)(dma_addr + size); writel(val, ctx->regs + VIDWx_BUF_END(win, 0));
DRM_DEBUG_KMS("start addr = 0x%lx, end addr = 0x%lx, size = 0x%lx\n", (unsigned long)dma_addr, val, size); DRM_DEBUG_KMS("ovl_width = %d, ovl_height = %d\n",
plane->crtc_width, plane->crtc_height);
plane->crtc_w, plane->crtc_h);
/* buffer size */
- buf_offsize = pitch - (plane->crtc_width * bpp);
- line_size = plane->crtc_width * bpp;
- buf_offsize = pitch - (plane->crtc_w * bpp);
- line_size = plane->crtc_w * bpp; val = VIDW_BUF_SIZE_OFFSET(buf_offsize) | VIDW_BUF_SIZE_PAGEWIDTH(line_size) | VIDW_BUF_SIZE_OFFSET_E(buf_offsize) |
@@ -684,10 +684,10 @@ static void fimd_update_plane(struct exynos_drm_crtc *crtc, VIDOSDxA_TOPLEFT_Y_E(plane->crtc_y); writel(val, ctx->regs + VIDOSD_A(win));
- last_x = plane->crtc_x + plane->crtc_width;
- last_x = plane->crtc_x + plane->crtc_w; if (last_x) last_x--;
- last_y = plane->crtc_y + plane->crtc_height;
- last_y = plane->crtc_y + plane->crtc_h; if (last_y) last_y--;
@@ -704,7 +704,7 @@ static void fimd_update_plane(struct exynos_drm_crtc *crtc, u32 offset = VIDOSD_D(win); if (win == 0) offset = VIDOSD_C(win);
val = plane->crtc_width * plane->crtc_height;
val = plane->crtc_w * plane->crtc_h;
writel(val, ctx->regs + offset);
DRM_DEBUG_KMS("osd size = 0x%x\n", (unsigned int)val);
diff --git a/drivers/gpu/drm/exynos/exynos_drm_plane.c b/drivers/gpu/drm/exynos/exynos_drm_plane.c index 9602797..bebc957 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_plane.c +++ b/drivers/gpu/drm/exynos/exynos_drm_plane.c @@ -97,17 +97,18 @@ static void exynos_plane_mode_set(struct drm_plane *plane, /* set drm framebuffer data. */ exynos_plane->src_x = src_x; exynos_plane->src_y = src_y;
- exynos_plane->src_width = (actual_w * exynos_plane->h_ratio) >> 16;
- exynos_plane->src_height = (actual_h * exynos_plane->v_ratio) >> 16;
exynos_plane->src_w = (actual_w * exynos_plane->h_ratio) >> 16;
exynos_plane->src_h = (actual_h * exynos_plane->v_ratio) >> 16;
/* set plane range to be displayed. */ exynos_plane->crtc_x = crtc_x; exynos_plane->crtc_y = crtc_y;
- exynos_plane->crtc_width = actual_w;
- exynos_plane->crtc_height = actual_h;
- exynos_plane->crtc_w = actual_w;
- exynos_plane->crtc_h = actual_h;
- DRM_DEBUG_KMS("plane : offset_x/y(%d,%d), width/height(%d,%d)", exynos_plane->crtc_x, exynos_plane->crtc_y,
exynos_plane->crtc_width, exynos_plane->crtc_height);
exynos_plane->crtc_w, exynos_plane->crtc_h);
plane->crtc = crtc;
} diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c index 4fbafc9..f8ef8c6 100644 --- a/drivers/gpu/drm/exynos/exynos_mixer.c +++ b/drivers/gpu/drm/exynos/exynos_mixer.c @@ -443,19 +443,19 @@ static void vp_video_buffer(struct mixer_context *ctx, vp_reg_write(res, VP_IMG_SIZE_C, VP_IMG_HSIZE(fb->pitches[0]) | VP_IMG_VSIZE(fb->height / 2));
- vp_reg_write(res, VP_SRC_WIDTH, plane->src_width);
- vp_reg_write(res, VP_SRC_HEIGHT, plane->src_height);
- vp_reg_write(res, VP_SRC_WIDTH, plane->src_w);
- vp_reg_write(res, VP_SRC_HEIGHT, plane->src_h); vp_reg_write(res, VP_SRC_H_POSITION, VP_SRC_H_POSITION_VAL(plane->src_x)); vp_reg_write(res, VP_SRC_V_POSITION, plane->src_y);
- vp_reg_write(res, VP_DST_WIDTH, plane->crtc_width);
- vp_reg_write(res, VP_DST_WIDTH, plane->crtc_w); vp_reg_write(res, VP_DST_H_POSITION, plane->crtc_x); if (ctx->interlace) {
vp_reg_write(res, VP_DST_HEIGHT, plane->crtc_height / 2);
vp_reg_write(res, VP_DST_V_POSITION, plane->crtc_y / 2); } else {vp_reg_write(res, VP_DST_HEIGHT, plane->crtc_h / 2);
vp_reg_write(res, VP_DST_HEIGHT, plane->crtc_height);
vp_reg_write(res, VP_DST_V_POSITION, plane->crtc_y); }vp_reg_write(res, VP_DST_HEIGHT, plane->crtc_h);
@@ -492,15 +492,15 @@ static void mixer_layer_update(struct mixer_context *ctx) static int mixer_setup_scale(const struct exynos_drm_plane *plane, unsigned int *x_ratio, unsigned int *y_ratio) {
- if (plane->crtc_width != plane->src_width) {
if (plane->crtc_width == 2 * plane->src_width)
- if (plane->crtc_w != plane->src_w) {
else goto fail; }if (plane->crtc_w == 2 * plane->src_w) *x_ratio = 1;
- if (plane->crtc_height != plane->src_height) {
if (plane->crtc_height == 2 * plane->src_height)
- if (plane->crtc_h != plane->src_h) {
else goto fail;if (plane->crtc_h == 2 * plane->src_h) *y_ratio = 1;
@@ -589,8 +589,8 @@ static void mixer_graph_buffer(struct mixer_context *ctx, mixer_reg_write(res, MXR_RESOLUTION, val); }
- val = MXR_GRP_WH_WIDTH(plane->src_width);
- val |= MXR_GRP_WH_HEIGHT(plane->src_height);
- val = MXR_GRP_WH_WIDTH(plane->src_w);
- val |= MXR_GRP_WH_HEIGHT(plane->src_h); val |= MXR_GRP_WH_H_SCALE(x_ratio); val |= MXR_GRP_WH_V_SCALE(y_ratio); mixer_reg_write(res, MXR_GRAPHIC_WH(win), val);
-- 2.1.0
Gustavo
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi Gustavo,
On 2015년 06월 09일 23:27, Gustavo Padovan wrote:
Hi Inki and Joonyoung,
Any comments on this series?
As you may know, I'm reviewing and testing iommu support patch series posted by Marek. With the patch series, I faced with page fault issue while booting like below,
[ 1.161282] [drm] Initialized drm 1.1.0 20060810 [ 1.168972] exynos-drm exynos-drm: bound exynos-drm-vidi (ops vidi_component_ops) [ 1.178462] ------------[ cut here ]------------ [ 1.181610] WARNING: CPU: 0 PID: 0 at drivers/gpu/drm/drm_irq.c:1718 drm_handle_vblank+0x2a0/0x308() [ 1.190710] Modules linked in: [ 1.193754] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.1.0-rc4-00564-g9acf8e2-dirty #1385 [ 1.201995] Hardware name: SAMSUNG EXYNOS (Flattened Device Tree) [ 1.208094] [<c0015388>] (unwind_backtrace) from [<c0012440>] (show_stack+0x10/0x14) [ 1.215810] [<c0012440>] (show_stack) from [<c04a35b8>] (dump_stack+0x84/0xc4) [ 1.223014] [<c04a35b8>] (dump_stack) from [<c00245cc>] (warn_slowpath_common+0x80/0xb0) [ 1.223059] exynos-drm exynos-drm: bound 11c00000.fimd (ops fimd_component_ops) [ 1.223403] exynos-drm exynos-drm: bound 11c80000.dsi (ops exynos_dsi_component_ops) [ 1.223408] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013). [ 1.223411] [drm] No driver support for vblank timestamp query. [ 1.223455] [drm] Initialized exynos 1.0.0 20110530 on minor 0 [ 1.264427] [<c00245cc>] (warn_slowpath_common) from [<c0024698>] (warn_slowpath_null+0x1c/0x24) [ 1.273184] [<c0024698>] (warn_slowpath_null) from [<c027c394>] (drm_handle_vblank+0x2a0/0x308) [ 1.281872] [<c027c394>] (drm_handle_vblank) from [<c0298964>] (fimd_irq_handler+0x78/0xcc) [ 1.290201] [<c0298964>] (fimd_irq_handler) from [<c0060708>] (handle_irq_event_percpu+0x78/0x134) [ 1.299134] [<c0060708>] (handle_irq_event_percpu) from [<c0060800>] (handle_irq_event+0x3c/0x5c) [ 1.307994] [<c0060800>] (handle_irq_event) from [<c00634a8>] (handle_level_irq+0xc4/0x13c) [ 1.308007] [<c00634a8>] (handle_level_irq) from [<c005fd8c>] (generic_handle_irq+0x2c/0x3c) [ 1.308021] [<c005fd8c>] (generic_handle_irq) from [<c02010cc>] (combiner_handle_cascade_irq+0x94/0x100) [ 1.308032] [<c02010cc>] (combiner_handle_cascade_irq) from [<c005fd8c>] (generic_handle_irq+0x2c/0x3c) [ 1.308042] [<c005fd8c>] (generic_handle_irq) from [<c0060058>] (__handle_domain_irq+0x7c/0xec) [ 1.308052] [<c0060058>] (__handle_domain_irq) from [<c0009434>] (gic_handle_irq+0x30/0x68) [ 1.308060] [<c0009434>] (gic_handle_irq) from [<c0012f40>] (__irq_svc+0x40/0x74) [ 1.308065] Exception stack(0xc06dbf68 to 0xc06dbfb0) [ 1.308072] bf60: 00000000 00000000 00001298 c001cc80 c06da000 c06dc4f8 [ 1.308080] bf80: c04abf50 c06d62c4 c06dbfb8 c070c121 00000001 00000000 01000000 c06dbfb0 [ 1.308085] bfa0: c0010064 c0010068 60000113 ffffffff [ 1.308099] [<c0012f40>] (__irq_svc) from [<c0010068>] (arch_cpu_idle+0x38/0x3c) [ 1.308113] [<c0010068>] (arch_cpu_idle) from [<c0054358>] (cpu_startup_entry+0x12c/0x1c4) [ 1.308129] [<c0054358>] (cpu_startup_entry) from [<c0688c54>] (start_kernel+0x398/0x3a4) [ 1.308140] [<c0688c54>] (start_kernel) from [<4000807c>] (0x4000807c) [ 1.308157] ---[ end trace 489a69b2a98f6c1d ]--- [ 1.341264] random: nonblocking pool is initialized [ 4.235177] panel_s6e8aa0 11c80000.dsi.0: ID: 0xa2, 0x60, 0x90 [ 4.436180] Console: switching to colour frame buffer device 102x91 [ 4.592094] exynos-drm exynos-drm: fb0: frame buffer device [ 4.597734] exynos-drm exynos-drm: registered panic notifier
Enabling IOMMU makes DMA device more sensitive so it seems that hided issues happen with iommu support. In this time, let's have more reviews. Look like that now atomic features aren't safe yet.
Thanks, Inki Dae
2015-06-03 Gustavo Padovan gustavo@padovan.org:
From: Gustavo Padovan gustavo.padovan@collabora.co.uk
Rename crtc_{widht,height} to crtc_{w,h} and src_{width,height} to src_{w,h} to make it similar to the atomic state names.
Signed-off-by: Gustavo Padovan gustavo.padovan@collabora.co.uk
drivers/gpu/drm/exynos/exynos7_drm_decon.c | 14 +++++++------- drivers/gpu/drm/exynos/exynos_drm_drv.h | 16 ++++++++-------- drivers/gpu/drm/exynos/exynos_drm_fimd.c | 14 +++++++------- drivers/gpu/drm/exynos/exynos_drm_plane.c | 11 ++++++----- drivers/gpu/drm/exynos/exynos_mixer.c | 22 +++++++++++----------- 5 files changed, 39 insertions(+), 38 deletions(-)
diff --git a/drivers/gpu/drm/exynos/exynos7_drm_decon.c b/drivers/gpu/drm/exynos/exynos7_drm_decon.c index 7a99237..4e63a9c 100644 --- a/drivers/gpu/drm/exynos/exynos7_drm_decon.c +++ b/drivers/gpu/drm/exynos/exynos7_drm_decon.c @@ -442,25 +442,25 @@ static void decon_update_plane(struct exynos_drm_crtc *crtc, DRM_DEBUG_KMS("start addr = 0x%lx\n", (unsigned long)val); DRM_DEBUG_KMS("ovl_width = %d, ovl_height = %d\n",
plane->crtc_width, plane->crtc_height);
plane->crtc_w, plane->crtc_h);
/*
- OSD position.
- In case the window layout goes of LCD layout, DECON fails.
*/
- if ((plane->crtc_x + plane->crtc_width) > mode->hdisplay)
plane->crtc_x = mode->hdisplay - plane->crtc_width;
- if ((plane->crtc_y + plane->crtc_height) > mode->vdisplay)
plane->crtc_y = mode->vdisplay - plane->crtc_height;
if ((plane->crtc_x + plane->crtc_w) > mode->hdisplay)
plane->crtc_x = mode->hdisplay - plane->crtc_w;
if ((plane->crtc_y + plane->crtc_h) > mode->vdisplay)
plane->crtc_y = mode->vdisplay - plane->crtc_h;
val = VIDOSDxA_TOPLEFT_X(plane->crtc_x) | VIDOSDxA_TOPLEFT_Y(plane->crtc_y); writel(val, ctx->regs + VIDOSD_A(win));
- last_x = plane->crtc_x + plane->crtc_width;
- last_x = plane->crtc_x + plane->crtc_w; if (last_x) last_x--;
- last_y = plane->crtc_y + plane->crtc_height;
- last_y = plane->crtc_y + plane->crtc_h; if (last_y) last_y--;
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h index b83d487..7c6196e 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.h +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h @@ -51,12 +51,12 @@ enum exynos_drm_output_type {
- the unit is screen coordinates.
- @src_y: offset y on a framebuffer to be displayed.
- the unit is screen coordinates.
- @src_width: width of a partial image to be displayed from framebuffer.
- @src_height: height of a partial image to be displayed from framebuffer.
- @src_w: width of a partial image to be displayed from framebuffer.
- @src_h: height of a partial image to be displayed from framebuffer.
- @crtc_x: offset x on hardware screen.
- @crtc_y: offset y on hardware screen.
- @crtc_width: window width to be displayed (hardware screen).
- @crtc_height: window height to be displayed (hardware screen).
- @crtc_w: window width to be displayed (hardware screen).
- @crtc_h: window height to be displayed (hardware screen).
- @h_ratio: horizontal scaling ratio, 16.16 fixed point
- @v_ratio: vertical scaling ratio, 16.16 fixed point
- @dma_addr: array of bus(accessed by dma) address to the memory region
@@ -73,12 +73,12 @@ struct exynos_drm_plane { struct drm_plane base; unsigned int src_x; unsigned int src_y;
- unsigned int src_width;
- unsigned int src_height;
- unsigned int src_w;
- unsigned int src_h; unsigned int crtc_x; unsigned int crtc_y;
- unsigned int crtc_width;
- unsigned int crtc_height;
- unsigned int crtc_w;
- unsigned int crtc_h; unsigned int h_ratio; unsigned int v_ratio; dma_addr_t dma_addr[MAX_FB_BUFFER];
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c index 2ece83b..920727b 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c @@ -659,18 +659,18 @@ static void fimd_update_plane(struct exynos_drm_crtc *crtc, writel(val, ctx->regs + VIDWx_BUF_START(win, 0));
/* buffer end address */
- size = pitch * plane->crtc_height;
size = pitch * plane->crtc_h; val = (unsigned long)(dma_addr + size); writel(val, ctx->regs + VIDWx_BUF_END(win, 0));
DRM_DEBUG_KMS("start addr = 0x%lx, end addr = 0x%lx, size = 0x%lx\n", (unsigned long)dma_addr, val, size); DRM_DEBUG_KMS("ovl_width = %d, ovl_height = %d\n",
plane->crtc_width, plane->crtc_height);
plane->crtc_w, plane->crtc_h);
/* buffer size */
- buf_offsize = pitch - (plane->crtc_width * bpp);
- line_size = plane->crtc_width * bpp;
- buf_offsize = pitch - (plane->crtc_w * bpp);
- line_size = plane->crtc_w * bpp; val = VIDW_BUF_SIZE_OFFSET(buf_offsize) | VIDW_BUF_SIZE_PAGEWIDTH(line_size) | VIDW_BUF_SIZE_OFFSET_E(buf_offsize) |
@@ -684,10 +684,10 @@ static void fimd_update_plane(struct exynos_drm_crtc *crtc, VIDOSDxA_TOPLEFT_Y_E(plane->crtc_y); writel(val, ctx->regs + VIDOSD_A(win));
- last_x = plane->crtc_x + plane->crtc_width;
- last_x = plane->crtc_x + plane->crtc_w; if (last_x) last_x--;
- last_y = plane->crtc_y + plane->crtc_height;
- last_y = plane->crtc_y + plane->crtc_h; if (last_y) last_y--;
@@ -704,7 +704,7 @@ static void fimd_update_plane(struct exynos_drm_crtc *crtc, u32 offset = VIDOSD_D(win); if (win == 0) offset = VIDOSD_C(win);
val = plane->crtc_width * plane->crtc_height;
val = plane->crtc_w * plane->crtc_h;
writel(val, ctx->regs + offset);
DRM_DEBUG_KMS("osd size = 0x%x\n", (unsigned int)val);
diff --git a/drivers/gpu/drm/exynos/exynos_drm_plane.c b/drivers/gpu/drm/exynos/exynos_drm_plane.c index 9602797..bebc957 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_plane.c +++ b/drivers/gpu/drm/exynos/exynos_drm_plane.c @@ -97,17 +97,18 @@ static void exynos_plane_mode_set(struct drm_plane *plane, /* set drm framebuffer data. */ exynos_plane->src_x = src_x; exynos_plane->src_y = src_y;
- exynos_plane->src_width = (actual_w * exynos_plane->h_ratio) >> 16;
- exynos_plane->src_height = (actual_h * exynos_plane->v_ratio) >> 16;
exynos_plane->src_w = (actual_w * exynos_plane->h_ratio) >> 16;
exynos_plane->src_h = (actual_h * exynos_plane->v_ratio) >> 16;
/* set plane range to be displayed. */ exynos_plane->crtc_x = crtc_x; exynos_plane->crtc_y = crtc_y;
- exynos_plane->crtc_width = actual_w;
- exynos_plane->crtc_height = actual_h;
- exynos_plane->crtc_w = actual_w;
- exynos_plane->crtc_h = actual_h;
- DRM_DEBUG_KMS("plane : offset_x/y(%d,%d), width/height(%d,%d)", exynos_plane->crtc_x, exynos_plane->crtc_y,
exynos_plane->crtc_width, exynos_plane->crtc_height);
exynos_plane->crtc_w, exynos_plane->crtc_h);
plane->crtc = crtc;
} diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c index 4fbafc9..f8ef8c6 100644 --- a/drivers/gpu/drm/exynos/exynos_mixer.c +++ b/drivers/gpu/drm/exynos/exynos_mixer.c @@ -443,19 +443,19 @@ static void vp_video_buffer(struct mixer_context *ctx, vp_reg_write(res, VP_IMG_SIZE_C, VP_IMG_HSIZE(fb->pitches[0]) | VP_IMG_VSIZE(fb->height / 2));
- vp_reg_write(res, VP_SRC_WIDTH, plane->src_width);
- vp_reg_write(res, VP_SRC_HEIGHT, plane->src_height);
- vp_reg_write(res, VP_SRC_WIDTH, plane->src_w);
- vp_reg_write(res, VP_SRC_HEIGHT, plane->src_h); vp_reg_write(res, VP_SRC_H_POSITION, VP_SRC_H_POSITION_VAL(plane->src_x)); vp_reg_write(res, VP_SRC_V_POSITION, plane->src_y);
- vp_reg_write(res, VP_DST_WIDTH, plane->crtc_width);
- vp_reg_write(res, VP_DST_WIDTH, plane->crtc_w); vp_reg_write(res, VP_DST_H_POSITION, plane->crtc_x); if (ctx->interlace) {
vp_reg_write(res, VP_DST_HEIGHT, plane->crtc_height / 2);
vp_reg_write(res, VP_DST_V_POSITION, plane->crtc_y / 2); } else {vp_reg_write(res, VP_DST_HEIGHT, plane->crtc_h / 2);
vp_reg_write(res, VP_DST_HEIGHT, plane->crtc_height);
vp_reg_write(res, VP_DST_V_POSITION, plane->crtc_y); }vp_reg_write(res, VP_DST_HEIGHT, plane->crtc_h);
@@ -492,15 +492,15 @@ static void mixer_layer_update(struct mixer_context *ctx) static int mixer_setup_scale(const struct exynos_drm_plane *plane, unsigned int *x_ratio, unsigned int *y_ratio) {
- if (plane->crtc_width != plane->src_width) {
if (plane->crtc_width == 2 * plane->src_width)
- if (plane->crtc_w != plane->src_w) {
else goto fail; }if (plane->crtc_w == 2 * plane->src_w) *x_ratio = 1;
- if (plane->crtc_height != plane->src_height) {
if (plane->crtc_height == 2 * plane->src_height)
- if (plane->crtc_h != plane->src_h) {
else goto fail;if (plane->crtc_h == 2 * plane->src_h) *y_ratio = 1;
@@ -589,8 +589,8 @@ static void mixer_graph_buffer(struct mixer_context *ctx, mixer_reg_write(res, MXR_RESOLUTION, val); }
- val = MXR_GRP_WH_WIDTH(plane->src_width);
- val |= MXR_GRP_WH_HEIGHT(plane->src_height);
- val = MXR_GRP_WH_WIDTH(plane->src_w);
- val |= MXR_GRP_WH_HEIGHT(plane->src_h); val |= MXR_GRP_WH_H_SCALE(x_ratio); val |= MXR_GRP_WH_V_SCALE(y_ratio); mixer_reg_write(res, MXR_GRAPHIC_WH(win), val);
-- 2.1.0
Gustavo
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On 2015년 06월 10일 19:42, Inki Dae wrote:
Hi Gustavo,
On 2015년 06월 09일 23:27, Gustavo Padovan wrote:
Hi Inki and Joonyoung,
Any comments on this series?
As you may know, I'm reviewing and testing iommu support patch series posted by Marek. With the patch series, I faced with page fault issue while booting like below,
[ 1.161282] [drm] Initialized drm 1.1.0 20060810 [ 1.168972] exynos-drm exynos-drm: bound exynos-drm-vidi (ops vidi_component_ops) [ 1.178462] ------------[ cut here ]------------ [ 1.181610] WARNING: CPU: 0 PID: 0 at drivers/gpu/drm/drm_irq.c:1718 drm_handle_vblank+0x2a0/0x308() [ 1.190710] Modules linked in: [ 1.193754] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.1.0-rc4-00564-g9acf8e2-dirty #1385 [ 1.201995] Hardware name: SAMSUNG EXYNOS (Flattened Device Tree) [ 1.208094] [<c0015388>] (unwind_backtrace) from [<c0012440>] (show_stack+0x10/0x14) [ 1.215810] [<c0012440>] (show_stack) from [<c04a35b8>] (dump_stack+0x84/0xc4) [ 1.223014] [<c04a35b8>] (dump_stack) from [<c00245cc>] (warn_slowpath_common+0x80/0xb0) [ 1.223059] exynos-drm exynos-drm: bound 11c00000.fimd (ops fimd_component_ops) [ 1.223403] exynos-drm exynos-drm: bound 11c80000.dsi (ops exynos_dsi_component_ops) [ 1.223408] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013). [ 1.223411] [drm] No driver support for vblank timestamp query. [ 1.223455] [drm] Initialized exynos 1.0.0 20110530 on minor 0 [ 1.264427] [<c00245cc>] (warn_slowpath_common) from [<c0024698>] (warn_slowpath_null+0x1c/0x24) [ 1.273184] [<c0024698>] (warn_slowpath_null) from [<c027c394>] (drm_handle_vblank+0x2a0/0x308) [ 1.281872] [<c027c394>] (drm_handle_vblank) from [<c0298964>] (fimd_irq_handler+0x78/0xcc) [ 1.290201] [<c0298964>] (fimd_irq_handler) from [<c0060708>] (handle_irq_event_percpu+0x78/0x134) [ 1.299134] [<c0060708>] (handle_irq_event_percpu) from [<c0060800>] (handle_irq_event+0x3c/0x5c) [ 1.307994] [<c0060800>] (handle_irq_event) from [<c00634a8>] (handle_level_irq+0xc4/0x13c) [ 1.308007] [<c00634a8>] (handle_level_irq) from [<c005fd8c>] (generic_handle_irq+0x2c/0x3c) [ 1.308021] [<c005fd8c>] (generic_handle_irq) from [<c02010cc>] (combiner_handle_cascade_irq+0x94/0x100) [ 1.308032] [<c02010cc>] (combiner_handle_cascade_irq) from [<c005fd8c>] (generic_handle_irq+0x2c/0x3c) [ 1.308042] [<c005fd8c>] (generic_handle_irq) from [<c0060058>] (__handle_domain_irq+0x7c/0xec) [ 1.308052] [<c0060058>] (__handle_domain_irq) from [<c0009434>] (gic_handle_irq+0x30/0x68) [ 1.308060] [<c0009434>] (gic_handle_irq) from [<c0012f40>] (__irq_svc+0x40/0x74) [ 1.308065] Exception stack(0xc06dbf68 to 0xc06dbfb0) [ 1.308072] bf60: 00000000 00000000 00001298 c001cc80 c06da000 c06dc4f8 [ 1.308080] bf80: c04abf50 c06d62c4 c06dbfb8 c070c121 00000001 00000000 01000000 c06dbfb0 [ 1.308085] bfa0: c0010064 c0010068 60000113 ffffffff [ 1.308099] [<c0012f40>] (__irq_svc) from [<c0010068>] (arch_cpu_idle+0x38/0x3c) [ 1.308113] [<c0010068>] (arch_cpu_idle) from [<c0054358>] (cpu_startup_entry+0x12c/0x1c4) [ 1.308129] [<c0054358>] (cpu_startup_entry) from [<c0688c54>] (start_kernel+0x398/0x3a4) [ 1.308140] [<c0688c54>] (start_kernel) from [<4000807c>] (0x4000807c) [ 1.308157] ---[ end trace 489a69b2a98f6c1d ]--- [ 1.341264] random: nonblocking pool is initialized [ 4.235177] panel_s6e8aa0 11c80000.dsi.0: ID: 0xa2, 0x60, 0x90 [ 4.436180] Console: switching to colour frame buffer device 102x91 [ 4.592094] exynos-drm exynos-drm: fb0: frame buffer device [ 4.597734] exynos-drm exynos-drm: registered panic notifier
Oops, sorry. My mistake. Above log is warning message happened while booting. See the below log, page fault issue which happened when modetest is released.
# modetest -s 31@29:720x1280 trying to open device 'i915'...failed. trying to open device 'radeon'...failed. trying to open device 'nouveau'...failed. trying to open device 'vmwgfx'...failed. trying to open device 'omapdrm'...failed. trying to open device 'exynos'...success. setting mode 720x1280-60Hz@XR24 on connectors 31, crtc 29
[ 37.782766] PAGE FAULT occurred at 0x2055d200 by 11e20000.sysmmu(Page table base: 0x6ebe0000) [ 37.789807] Lv1 entry: 0x6e92dc01 [ 37.793225] ------------[ cut here ]------------ [ 37.797793] kernel BUG at drivers/iommu/exynos-iommu.c:364! [ 37.803349] Internal error: Oops - BUG: 0 [#1] PREEMPT SMP ARM [ 37.809163] Modules linked in: [ 37.812207] CPU: 0 PID: 1475 Comm: modetest Tainted: G W 4.1.0-rc4-00564-g9acf8e2-dirty #1385 [ 37.821836] Hardware name: SAMSUNG EXYNOS (Flattened Device Tree) [ 37.827914] task: ee3c9100 ti: ee342000 task.ti: ee342000 [ 37.833304] PC is at exynos_sysmmu_irq+0x184/0x208 [ 37.838070] LR is at exynos_sysmmu_irq+0xd4/0x208 [ 37.842758] pc : [<c0267bcc>] lr : [<c0267b1c>] psr: 60000193 [ 37.842758] sp : ee343cc8 ip : 00000000 fp : 00000000 [ 37.854214] r10: c070c123 r9 : 00000205 r8 : 2055d200 [ 37.859421] r7 : eebe0000 r6 : ee9b3428 r5 : ee9b3410 r4 : 00000000 [ 37.865931] r3 : 6e92dc01 r2 : 6e92dc01 r1 : eea55810 r0 : ee314480 [ 37.872443] Flags: nZCv IRQs off FIQs on Mode SVC_32 ISA ARM Segment user [ 37.879646] Control: 10c5387d Table: 6e1cc04a DAC: 00000015 [ 37.885375] Process modetest (pid: 1475, stack limit = 0xee342210) [ 37.891538] Stack: (0xee343cc8 to 0xee344000) [ 37.895881] 3cc0: ee343cd4 eea2e480 eea58294 6ebe0000 00000001 ee9b4280 [ 37.904040] 3ce0: ee84ad20 00000000 00000000 00000026 ee84acc0 c0060708 00000002 c04a8aec [ 37.912199] 3d00: ee84acc0 ee84ad20 ee9b4280 00000015 ee804450 ee343da0 ee808000 c0060800 [ 37.920358] 3d20: ee84acc0 ee84ad20 ee807000 c00634a8 00000026 c06e9db8 ee807000 c005fd8c [ 37.928517] 3d40: 0000000a c02010cc 00000015 00000000 00000015 00000000 00000001 c005fd8c [ 37.936676] 3d60: c06d7aac c0060058 f002000c 00000015 c06dc7a0 ee343da0 f0020000 00000000 [ 37.944836] 3d80: 00000002 c0009434 c0298df8 20000013 ffffffff ee343dd4 c06f44a8 c0012f40 [ 37.952995] 3da0: ee03fa78 00000000 00000000 04000400 00000000 ee03fa78 00000000 ee03fa78 [ 37.961154] 3dc0: c06f44a8 00000000 00000002 00000000 f0180000 ee343de8 c0298f54 c0298df8 [ 37.969313] 3de0: 20000013 ffffffff 00000000 ee03f010 00000000 c0298f54 ee03f010 00000000 [ 37.977472] 3e00: ee334400 c074adb4 c06f44a8 c0299b9c ee334400 00000001 ee334400 c0295550 [ 37.985632] 3e20: ee14cd40 c0270684 ee14cd40 edc68000 00000000 ee14cd40 edc23428 c029604c [ 37.993791] 3e40: 00000002 ee334400 00000000 c027187c c02716dc ee25a540 ee334400 00000050 [ 38.001950] 3e60: edc23380 00000002 00000000 ee30ec00 edc6814c c0282a74 edc23428 00000000 [ 38.010109] 3e80: 00000050 edc23380 00000002 c02732d4 edc681b4 c0291c8c edc23380 edc23380 [ 38.018269] 3ea0: edc68000 edc68058 edc68000 edc68034 ee1df6a4 c02751a8 edc68000 c074adb4 [ 38.026428] 3ec0: edc68058 c027874c ee1df6a8 ee1df600 edc68058 c0278b50 ee66b980 00000001 [ 38.034587] 3ee0: ee314300 edc68154 60000013 00000000 ee66b980 ee1df300 ee2a05b0 00000000 [ 38.042746] 3f00: ee8ef010 ee6f1e40 00000008 ee1df308 00000000 c00d33c4 00000000 00000000 [ 38.050905] 3f20: ee3c947c 00000000 c0710c40 ee3c9100 ee3c948c ee342000 00000000 c003b24c [ 38.059065] 3f40: ee3c9100 edd4a1c0 00000001 ee343f60 ee3c948c c0025994 0001d008 c00d2364 [ 38.067224] 3f60: 00000000 00000000 0001d008 ee3a1400 00000000 b6f63750 000000f8 c000f704 [ 38.075383] 3f80: ee342000 00000000 00000000 c0026e38 0006560a 00000000 b6f63750 c0026ec0 [ 38.083542] 3fa0: 0006560a c000f580 0006560a 00000000 00000000 000655f0 00000000 b6fbe4c0 [ 38.091701] 3fc0: 0006560a 00000000 b6f63750 000000f8 00000000 00000000 b6fc2000 00000000 [ 38.099860] 3fe0: 000000f8 beb8aa9c b6effaf7 b6eb2946 60000030 00000000 6f7fd821 6f7fdc21 [ 38.108034] [<c0267bcc>] (exynos_sysmmu_irq) from [<c0060708>] (handle_irq_event_percpu+0x78/0x134) [ 38.117053] [<c0060708>] (handle_irq_event_percpu) from [<c0060800>] (handle_irq_event+0x3c/0x5c) [ 38.125906] [<c0060800>] (handle_irq_event) from [<c00634a8>] (handle_level_irq+0xc4/0x13c) [ 38.134239] [<c00634a8>] (handle_level_irq) from [<c005fd8c>] (generic_handle_irq+0x2c/0x3c) [ 38.142660] [<c005fd8c>] (generic_handle_irq) from [<c02010cc>] (combiner_handle_cascade_irq+0x94/0x100) [ 38.152119] [<c02010cc>] (combiner_handle_cascade_irq) from [<c005fd8c>] (generic_handle_irq+0x2c/0x3c) [ 38.161491] [<c005fd8c>] (generic_handle_irq) from [<c0060058>] (__handle_domain_irq+0x7c/0xec) [ 38.170172] [<c0060058>] (__handle_domain_irq) from [<c0009434>] (gic_handle_irq+0x30/0x68) [ 38.178504] [<c0009434>] (gic_handle_irq) from [<c0012f40>] (__irq_svc+0x40/0x74) [ 38.185963] Exception stack(0xee343da0 to 0xee343de8) [ 38.191001] 3da0: ee03fa78 00000000 00000000 04000400 00000000 ee03fa78 00000000 ee03fa78 [ 38.199160] 3dc0: c06f44a8 00000000 00000002 00000000 f0180000 ee343de8 c0298f54 c0298df8 [ 38.207316] 3de0: 20000013 ffffffff [ 38.210802] [<c0012f40>] (__irq_svc) from [<c0298df8>] (fimd_enable_shadow_channel_path.isra.4+0x14/0x4c) [ 38.220345] [<c0298df8>] (fimd_enable_shadow_channel_path.isra.4) from [<c0298f54>] (fimd_win_disable+0xb4/0xbc) [ 38.230498] [<c0298f54>] (fimd_win_disable) from [<c0299b9c>] (fimd_enable+0xe4/0x12c) [ 38.238397] [<c0299b9c>] (fimd_enable) from [<c0295550>] (exynos_drm_crtc_enable+0x28/0x3c) [ 38.246735] [<c0295550>] (exynos_drm_crtc_enable) from [<c0270684>] (drm_atomic_helper_commit_modeset_enables+0x90/0x1c4) [ 38.257669] [<c0270684>] (drm_atomic_helper_commit_modeset_enables) from [<c029604c>] (exynos_atomic_commit+0x3c/0x70) [ 38.268344] [<c029604c>] (exynos_atomic_commit) from [<c027187c>] (drm_atomic_helper_set_config+0x1a0/0x3f4) [ 38.278153] [<c027187c>] (drm_atomic_helper_set_config) from [<c0282a74>] (drm_mode_set_config_internal+0x58/0xd4) [ 38.288482] [<c0282a74>] (drm_mode_set_config_internal) from [<c02732d4>] (restore_fbdev_mode+0xd4/0xf4) [ 38.297942] [<c02732d4>] (restore_fbdev_mode) from [<c02751a8>] (drm_fb_helper_restore_fbdev_mode_unlocked+0x1c/0x5c) [ 38.308531] [<c02751a8>] (drm_fb_helper_restore_fbdev_mode_unlocked) from [<c027874c>] (drm_lastclose+0x34/0x118) [ 38.318772] [<c027874c>] (drm_lastclose) from [<c0278b50>] (drm_release+0x320/0x4cc) [ 38.326502] [<c0278b50>] (drm_release) from [<c00d33c4>] (__fput+0x80/0x1c8) [ 38.333531] [<c00d33c4>] (__fput) from [<c003b24c>] (task_work_run+0xac/0xe4) [ 38.340649] [<c003b24c>] (task_work_run) from [<c0025994>] (do_exit+0x2e8/0x970) [ 38.348024] [<c0025994>] (do_exit) from [<c0026e38>] (do_group_exit+0x4c/0xc4) [ 38.355228] [<c0026e38>] (do_group_exit) from [<c0026ec0>] (__wake_up_parent+0x0/0x1
Thanks, Inki Dae
Enabling IOMMU makes DMA device more sensitive so it seems that hided issues happen with iommu support. In this time, let's have more reviews. Look like that now atomic features aren't safe yet.
Thanks, Inki Dae
2015-06-03 Gustavo Padovan gustavo@padovan.org:
From: Gustavo Padovan gustavo.padovan@collabora.co.uk
Rename crtc_{widht,height} to crtc_{w,h} and src_{width,height} to src_{w,h} to make it similar to the atomic state names.
Signed-off-by: Gustavo Padovan gustavo.padovan@collabora.co.uk
drivers/gpu/drm/exynos/exynos7_drm_decon.c | 14 +++++++------- drivers/gpu/drm/exynos/exynos_drm_drv.h | 16 ++++++++-------- drivers/gpu/drm/exynos/exynos_drm_fimd.c | 14 +++++++------- drivers/gpu/drm/exynos/exynos_drm_plane.c | 11 ++++++----- drivers/gpu/drm/exynos/exynos_mixer.c | 22 +++++++++++----------- 5 files changed, 39 insertions(+), 38 deletions(-)
diff --git a/drivers/gpu/drm/exynos/exynos7_drm_decon.c b/drivers/gpu/drm/exynos/exynos7_drm_decon.c index 7a99237..4e63a9c 100644 --- a/drivers/gpu/drm/exynos/exynos7_drm_decon.c +++ b/drivers/gpu/drm/exynos/exynos7_drm_decon.c @@ -442,25 +442,25 @@ static void decon_update_plane(struct exynos_drm_crtc *crtc, DRM_DEBUG_KMS("start addr = 0x%lx\n", (unsigned long)val); DRM_DEBUG_KMS("ovl_width = %d, ovl_height = %d\n",
plane->crtc_width, plane->crtc_height);
plane->crtc_w, plane->crtc_h);
/*
- OSD position.
- In case the window layout goes of LCD layout, DECON fails.
*/
- if ((plane->crtc_x + plane->crtc_width) > mode->hdisplay)
plane->crtc_x = mode->hdisplay - plane->crtc_width;
- if ((plane->crtc_y + plane->crtc_height) > mode->vdisplay)
plane->crtc_y = mode->vdisplay - plane->crtc_height;
if ((plane->crtc_x + plane->crtc_w) > mode->hdisplay)
plane->crtc_x = mode->hdisplay - plane->crtc_w;
if ((plane->crtc_y + plane->crtc_h) > mode->vdisplay)
plane->crtc_y = mode->vdisplay - plane->crtc_h;
val = VIDOSDxA_TOPLEFT_X(plane->crtc_x) | VIDOSDxA_TOPLEFT_Y(plane->crtc_y); writel(val, ctx->regs + VIDOSD_A(win));
- last_x = plane->crtc_x + plane->crtc_width;
- last_x = plane->crtc_x + plane->crtc_w; if (last_x) last_x--;
- last_y = plane->crtc_y + plane->crtc_height;
- last_y = plane->crtc_y + plane->crtc_h; if (last_y) last_y--;
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h index b83d487..7c6196e 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.h +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h @@ -51,12 +51,12 @@ enum exynos_drm_output_type {
- the unit is screen coordinates.
- @src_y: offset y on a framebuffer to be displayed.
- the unit is screen coordinates.
- @src_width: width of a partial image to be displayed from framebuffer.
- @src_height: height of a partial image to be displayed from framebuffer.
- @src_w: width of a partial image to be displayed from framebuffer.
- @src_h: height of a partial image to be displayed from framebuffer.
- @crtc_x: offset x on hardware screen.
- @crtc_y: offset y on hardware screen.
- @crtc_width: window width to be displayed (hardware screen).
- @crtc_height: window height to be displayed (hardware screen).
- @crtc_w: window width to be displayed (hardware screen).
- @crtc_h: window height to be displayed (hardware screen).
- @h_ratio: horizontal scaling ratio, 16.16 fixed point
- @v_ratio: vertical scaling ratio, 16.16 fixed point
- @dma_addr: array of bus(accessed by dma) address to the memory region
@@ -73,12 +73,12 @@ struct exynos_drm_plane { struct drm_plane base; unsigned int src_x; unsigned int src_y;
- unsigned int src_width;
- unsigned int src_height;
- unsigned int src_w;
- unsigned int src_h; unsigned int crtc_x; unsigned int crtc_y;
- unsigned int crtc_width;
- unsigned int crtc_height;
- unsigned int crtc_w;
- unsigned int crtc_h; unsigned int h_ratio; unsigned int v_ratio; dma_addr_t dma_addr[MAX_FB_BUFFER];
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c index 2ece83b..920727b 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c @@ -659,18 +659,18 @@ static void fimd_update_plane(struct exynos_drm_crtc *crtc, writel(val, ctx->regs + VIDWx_BUF_START(win, 0));
/* buffer end address */
- size = pitch * plane->crtc_height;
size = pitch * plane->crtc_h; val = (unsigned long)(dma_addr + size); writel(val, ctx->regs + VIDWx_BUF_END(win, 0));
DRM_DEBUG_KMS("start addr = 0x%lx, end addr = 0x%lx, size = 0x%lx\n", (unsigned long)dma_addr, val, size); DRM_DEBUG_KMS("ovl_width = %d, ovl_height = %d\n",
plane->crtc_width, plane->crtc_height);
plane->crtc_w, plane->crtc_h);
/* buffer size */
- buf_offsize = pitch - (plane->crtc_width * bpp);
- line_size = plane->crtc_width * bpp;
- buf_offsize = pitch - (plane->crtc_w * bpp);
- line_size = plane->crtc_w * bpp; val = VIDW_BUF_SIZE_OFFSET(buf_offsize) | VIDW_BUF_SIZE_PAGEWIDTH(line_size) | VIDW_BUF_SIZE_OFFSET_E(buf_offsize) |
@@ -684,10 +684,10 @@ static void fimd_update_plane(struct exynos_drm_crtc *crtc, VIDOSDxA_TOPLEFT_Y_E(plane->crtc_y); writel(val, ctx->regs + VIDOSD_A(win));
- last_x = plane->crtc_x + plane->crtc_width;
- last_x = plane->crtc_x + plane->crtc_w; if (last_x) last_x--;
- last_y = plane->crtc_y + plane->crtc_height;
- last_y = plane->crtc_y + plane->crtc_h; if (last_y) last_y--;
@@ -704,7 +704,7 @@ static void fimd_update_plane(struct exynos_drm_crtc *crtc, u32 offset = VIDOSD_D(win); if (win == 0) offset = VIDOSD_C(win);
val = plane->crtc_width * plane->crtc_height;
val = plane->crtc_w * plane->crtc_h;
writel(val, ctx->regs + offset);
DRM_DEBUG_KMS("osd size = 0x%x\n", (unsigned int)val);
diff --git a/drivers/gpu/drm/exynos/exynos_drm_plane.c b/drivers/gpu/drm/exynos/exynos_drm_plane.c index 9602797..bebc957 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_plane.c +++ b/drivers/gpu/drm/exynos/exynos_drm_plane.c @@ -97,17 +97,18 @@ static void exynos_plane_mode_set(struct drm_plane *plane, /* set drm framebuffer data. */ exynos_plane->src_x = src_x; exynos_plane->src_y = src_y;
- exynos_plane->src_width = (actual_w * exynos_plane->h_ratio) >> 16;
- exynos_plane->src_height = (actual_h * exynos_plane->v_ratio) >> 16;
exynos_plane->src_w = (actual_w * exynos_plane->h_ratio) >> 16;
exynos_plane->src_h = (actual_h * exynos_plane->v_ratio) >> 16;
/* set plane range to be displayed. */ exynos_plane->crtc_x = crtc_x; exynos_plane->crtc_y = crtc_y;
- exynos_plane->crtc_width = actual_w;
- exynos_plane->crtc_height = actual_h;
- exynos_plane->crtc_w = actual_w;
- exynos_plane->crtc_h = actual_h;
- DRM_DEBUG_KMS("plane : offset_x/y(%d,%d), width/height(%d,%d)", exynos_plane->crtc_x, exynos_plane->crtc_y,
exynos_plane->crtc_width, exynos_plane->crtc_height);
exynos_plane->crtc_w, exynos_plane->crtc_h);
plane->crtc = crtc;
} diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c index 4fbafc9..f8ef8c6 100644 --- a/drivers/gpu/drm/exynos/exynos_mixer.c +++ b/drivers/gpu/drm/exynos/exynos_mixer.c @@ -443,19 +443,19 @@ static void vp_video_buffer(struct mixer_context *ctx, vp_reg_write(res, VP_IMG_SIZE_C, VP_IMG_HSIZE(fb->pitches[0]) | VP_IMG_VSIZE(fb->height / 2));
- vp_reg_write(res, VP_SRC_WIDTH, plane->src_width);
- vp_reg_write(res, VP_SRC_HEIGHT, plane->src_height);
- vp_reg_write(res, VP_SRC_WIDTH, plane->src_w);
- vp_reg_write(res, VP_SRC_HEIGHT, plane->src_h); vp_reg_write(res, VP_SRC_H_POSITION, VP_SRC_H_POSITION_VAL(plane->src_x)); vp_reg_write(res, VP_SRC_V_POSITION, plane->src_y);
- vp_reg_write(res, VP_DST_WIDTH, plane->crtc_width);
- vp_reg_write(res, VP_DST_WIDTH, plane->crtc_w); vp_reg_write(res, VP_DST_H_POSITION, plane->crtc_x); if (ctx->interlace) {
vp_reg_write(res, VP_DST_HEIGHT, plane->crtc_height / 2);
vp_reg_write(res, VP_DST_V_POSITION, plane->crtc_y / 2); } else {vp_reg_write(res, VP_DST_HEIGHT, plane->crtc_h / 2);
vp_reg_write(res, VP_DST_HEIGHT, plane->crtc_height);
vp_reg_write(res, VP_DST_V_POSITION, plane->crtc_y); }vp_reg_write(res, VP_DST_HEIGHT, plane->crtc_h);
@@ -492,15 +492,15 @@ static void mixer_layer_update(struct mixer_context *ctx) static int mixer_setup_scale(const struct exynos_drm_plane *plane, unsigned int *x_ratio, unsigned int *y_ratio) {
- if (plane->crtc_width != plane->src_width) {
if (plane->crtc_width == 2 * plane->src_width)
- if (plane->crtc_w != plane->src_w) {
else goto fail; }if (plane->crtc_w == 2 * plane->src_w) *x_ratio = 1;
- if (plane->crtc_height != plane->src_height) {
if (plane->crtc_height == 2 * plane->src_height)
- if (plane->crtc_h != plane->src_h) {
else goto fail;if (plane->crtc_h == 2 * plane->src_h) *y_ratio = 1;
@@ -589,8 +589,8 @@ static void mixer_graph_buffer(struct mixer_context *ctx, mixer_reg_write(res, MXR_RESOLUTION, val); }
- val = MXR_GRP_WH_WIDTH(plane->src_width);
- val |= MXR_GRP_WH_HEIGHT(plane->src_height);
- val = MXR_GRP_WH_WIDTH(plane->src_w);
- val |= MXR_GRP_WH_HEIGHT(plane->src_h); val |= MXR_GRP_WH_H_SCALE(x_ratio); val |= MXR_GRP_WH_V_SCALE(y_ratio); mixer_reg_write(res, MXR_GRAPHIC_WH(win), val);
-- 2.1.0
Gustavo
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi Gustavo,
On Wed, Jun 3, 2015 at 5:30 PM, Gustavo Padovan gustavo@padovan.org wrote:
From: Gustavo Padovan gustavo.padovan@collabora.co.uk
Check error and call DRM_ERROR if clk_prepare_enable() fails.
Signed-off-by: Gustavo Padovan gustavo.padovan@collabora.co.uk
drivers/gpu/drm/exynos/exynos7_drm_decon.c | 29 ++++++++++++++++++++++++---- drivers/gpu/drm/exynos/exynos_drm_fimd.c | 14 ++++++++++++-- drivers/gpu/drm/exynos/exynos_mixer.c | 31 +++++++++++++++++++++++++----- 3 files changed, 63 insertions(+), 11 deletions(-)
diff --git a/drivers/gpu/drm/exynos/exynos7_drm_decon.c b/drivers/gpu/drm/exynos/exynos7_drm_decon.c index d659ba2..ffd7c3b 100644 --- a/drivers/gpu/drm/exynos/exynos7_drm_decon.c +++ b/drivers/gpu/drm/exynos/exynos7_drm_decon.c @@ -606,6 +606,7 @@ static void decon_init(struct decon_context *ctx) static void decon_enable(struct exynos_drm_crtc *crtc) { struct decon_context *ctx = crtc->ctx;
int ret; if (!ctx->suspended) return;
@@ -614,10 +615,30 @@ static void decon_enable(struct exynos_drm_crtc *crtc)
pm_runtime_get_sync(ctx->dev);
clk_prepare_enable(ctx->pclk);
clk_prepare_enable(ctx->aclk);
clk_prepare_enable(ctx->eclk);
clk_prepare_enable(ctx->vclk);
ret = clk_prepare_enable(ctx->pclk);
if (ret < 0) {
DRM_ERROR("Failed to prepare_enable the pclk [%d]\n", ret);
return;
goto pclk_err;
This goto after return probably got here by mistake. Debug/rebase leftover?
<..snip..>
By the way, are you using some branch to prepare this patch? Could you please check if you're able to apple it? In current master branch that i see similar DRM_ERROR() messages are already in place in similar functions. For example, in master branch i see decon_poweron() instead of decon_enable() and fimd_poweron() instead of fimd_enable() in your patch. Is there any chance that it's slightly outdated?
Best regards, Alexey Klimov
On Wed, Jun 3, 2015 at 7:59 PM, Alexey Klimov klimov.linux@gmail.com wrote:
Hi Gustavo,
On Wed, Jun 3, 2015 at 5:30 PM, Gustavo Padovan gustavo@padovan.org wrote:
From: Gustavo Padovan gustavo.padovan@collabora.co.uk
Check error and call DRM_ERROR if clk_prepare_enable() fails.
Signed-off-by: Gustavo Padovan gustavo.padovan@collabora.co.uk
drivers/gpu/drm/exynos/exynos7_drm_decon.c | 29 ++++++++++++++++++++++++---- drivers/gpu/drm/exynos/exynos_drm_fimd.c | 14 ++++++++++++-- drivers/gpu/drm/exynos/exynos_mixer.c | 31 +++++++++++++++++++++++++----- 3 files changed, 63 insertions(+), 11 deletions(-)
diff --git a/drivers/gpu/drm/exynos/exynos7_drm_decon.c b/drivers/gpu/drm/exynos/exynos7_drm_decon.c index d659ba2..ffd7c3b 100644 --- a/drivers/gpu/drm/exynos/exynos7_drm_decon.c +++ b/drivers/gpu/drm/exynos/exynos7_drm_decon.c @@ -606,6 +606,7 @@ static void decon_init(struct decon_context *ctx) static void decon_enable(struct exynos_drm_crtc *crtc) { struct decon_context *ctx = crtc->ctx;
int ret; if (!ctx->suspended) return;
@@ -614,10 +615,30 @@ static void decon_enable(struct exynos_drm_crtc *crtc)
pm_runtime_get_sync(ctx->dev);
clk_prepare_enable(ctx->pclk);
clk_prepare_enable(ctx->aclk);
clk_prepare_enable(ctx->eclk);
clk_prepare_enable(ctx->vclk);
ret = clk_prepare_enable(ctx->pclk);
if (ret < 0) {
DRM_ERROR("Failed to prepare_enable the pclk [%d]\n", ret);
return;
goto pclk_err;
This goto after return probably got here by mistake. Debug/rebase leftover?
<..snip..>
By the way, are you using some branch to prepare this patch? Could you please check if you're able to apple it? In current master branch that i see similar DRM_ERROR() messages are already in place in similar functions. For example, in master branch i see decon_poweron() instead of decon_enable() and fimd_poweron() instead of fimd_enable() in your patch. Is there any chance that it's slightly outdated?
Ah, now i see. It depends on "[PATCH v10 17/17] drm/exynos: split exynos_crtc->dpms in enable() and disable()" and partially reverts it and restores messages back.
2015-06-03 Alexey Klimov klimov.linux@gmail.com:
Hi Gustavo,
On Wed, Jun 3, 2015 at 5:30 PM, Gustavo Padovan gustavo@padovan.org wrote:
From: Gustavo Padovan gustavo.padovan@collabora.co.uk
Check error and call DRM_ERROR if clk_prepare_enable() fails.
Signed-off-by: Gustavo Padovan gustavo.padovan@collabora.co.uk
drivers/gpu/drm/exynos/exynos7_drm_decon.c | 29 ++++++++++++++++++++++++---- drivers/gpu/drm/exynos/exynos_drm_fimd.c | 14 ++++++++++++-- drivers/gpu/drm/exynos/exynos_mixer.c | 31 +++++++++++++++++++++++++----- 3 files changed, 63 insertions(+), 11 deletions(-)
diff --git a/drivers/gpu/drm/exynos/exynos7_drm_decon.c b/drivers/gpu/drm/exynos/exynos7_drm_decon.c index d659ba2..ffd7c3b 100644 --- a/drivers/gpu/drm/exynos/exynos7_drm_decon.c +++ b/drivers/gpu/drm/exynos/exynos7_drm_decon.c @@ -606,6 +606,7 @@ static void decon_init(struct decon_context *ctx) static void decon_enable(struct exynos_drm_crtc *crtc) { struct decon_context *ctx = crtc->ctx;
int ret; if (!ctx->suspended) return;
@@ -614,10 +615,30 @@ static void decon_enable(struct exynos_drm_crtc *crtc)
pm_runtime_get_sync(ctx->dev);
clk_prepare_enable(ctx->pclk);
clk_prepare_enable(ctx->aclk);
clk_prepare_enable(ctx->eclk);
clk_prepare_enable(ctx->vclk);
ret = clk_prepare_enable(ctx->pclk);
if (ret < 0) {
DRM_ERROR("Failed to prepare_enable the pclk [%d]\n", ret);
return;
goto pclk_err;
This goto after return probably got here by mistake. Debug/rebase leftover?
Yes. Thanks for pointing it out. I'll send an updated patch fixing this.
<..snip..>
By the way, are you using some branch to prepare this patch? Could you please check if you're able to apple it? In current master branch that i see similar DRM_ERROR() messages are already in place in similar functions. For example, in master branch i see decon_poweron() instead of decon_enable() and fimd_poweron() instead of fimd_enable() in your patch. Is there any chance that it's slightly outdated?
This is based on tree of today, with the atomic modesetting patches applied.
Gustavo
From: Gustavo Padovan gustavo.padovan@collabora.co.uk
Check error and call DRM_ERROR if clk_prepare_enable() fails.
Signed-off-by: Gustavo Padovan gustavo.padovan@collabora.co.uk --- drivers/gpu/drm/exynos/exynos7_drm_decon.c | 28 +++++++++++++++++++++++---- drivers/gpu/drm/exynos/exynos_drm_fimd.c | 14 ++++++++++++-- drivers/gpu/drm/exynos/exynos_mixer.c | 31 +++++++++++++++++++++++++----- 3 files changed, 62 insertions(+), 11 deletions(-)
diff --git a/drivers/gpu/drm/exynos/exynos7_drm_decon.c b/drivers/gpu/drm/exynos/exynos7_drm_decon.c index d659ba2..d9798e2 100644 --- a/drivers/gpu/drm/exynos/exynos7_drm_decon.c +++ b/drivers/gpu/drm/exynos/exynos7_drm_decon.c @@ -606,6 +606,7 @@ static void decon_init(struct decon_context *ctx) static void decon_enable(struct exynos_drm_crtc *crtc) { struct decon_context *ctx = crtc->ctx; + int ret;
if (!ctx->suspended) return; @@ -614,10 +615,29 @@ static void decon_enable(struct exynos_drm_crtc *crtc)
pm_runtime_get_sync(ctx->dev);
- clk_prepare_enable(ctx->pclk); - clk_prepare_enable(ctx->aclk); - clk_prepare_enable(ctx->eclk); - clk_prepare_enable(ctx->vclk); + ret = clk_prepare_enable(ctx->pclk); + if (ret < 0) { + DRM_ERROR("Failed to prepare_enable the pclk [%d]\n", ret); + return; + } + + ret = clk_prepare_enable(ctx->aclk); + if (ret < 0) { + DRM_ERROR("Failed to prepare_enable the aclk [%d]\n", ret); + return; + } + + ret = clk_prepare_enable(ctx->eclk); + if (ret < 0) { + DRM_ERROR("Failed to prepare_enable the eclk [%d]\n", ret); + return; + } + + ret = clk_prepare_enable(ctx->vclk); + if (ret < 0) { + DRM_ERROR("Failed to prepare_enable the vclk [%d]\n", ret); + return; + }
decon_init(ctx);
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c index 9661853..7c8ba61 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c @@ -808,6 +808,7 @@ static void fimd_apply(struct fimd_context *ctx) static void fimd_enable(struct exynos_drm_crtc *crtc) { struct fimd_context *ctx = crtc->ctx; + int ret;
if (!ctx->suspended) return; @@ -816,8 +817,17 @@ static void fimd_enable(struct exynos_drm_crtc *crtc)
pm_runtime_get_sync(ctx->dev);
- clk_prepare_enable(ctx->bus_clk); - clk_prepare_enable(ctx->lcd_clk); + ret = clk_prepare_enable(ctx->bus_clk); + if (ret < 0) { + DRM_ERROR("Failed to prepare_enable the bus clk [%d]\n", ret); + return; + } + + ret = clk_prepare_enable(ctx->lcd_clk); + if (ret < 0) { + DRM_ERROR("Failed to prepare_enable the lcd clk [%d]\n", ret); + return; + }
/* if vblank was enabled status, enable it again. */ if (test_and_clear_bit(0, &ctx->irq_flags)) diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c index 6bab717..1b77fc7 100644 --- a/drivers/gpu/drm/exynos/exynos_mixer.c +++ b/drivers/gpu/drm/exynos/exynos_mixer.c @@ -1031,6 +1031,7 @@ static void mixer_enable(struct exynos_drm_crtc *crtc) { struct mixer_context *ctx = crtc->ctx; struct mixer_resources *res = &ctx->mixer_res; + int ret;
mutex_lock(&ctx->mixer_mutex); if (ctx->powered) { @@ -1042,12 +1043,32 @@ static void mixer_enable(struct exynos_drm_crtc *crtc)
pm_runtime_get_sync(ctx->dev);
- clk_prepare_enable(res->mixer); - clk_prepare_enable(res->hdmi); + ret = clk_prepare_enable(res->mixer); + if (ret < 0) { + DRM_ERROR("Failed to prepare_enable the mixer clk [%d]\n", ret); + return; + } + ret = clk_prepare_enable(res->hdmi); + if (ret < 0) { + DRM_ERROR("Failed to prepare_enable the hdmi clk [%d]\n", ret); + return; + } if (ctx->vp_enabled) { - clk_prepare_enable(res->vp); - if (ctx->has_sclk) - clk_prepare_enable(res->sclk_mixer); + ret = clk_prepare_enable(res->vp); + if (ret < 0) { + DRM_ERROR("Failed to prepare_enable the vp clk [%d]\n", + ret); + return; + } + if (ctx->has_sclk) { + ret = clk_prepare_enable(res->sclk_mixer); + if (ret < 0) { + DRM_ERROR("Failed to prepare_enable the " \ + "sclk_mixer clk [%d]\n", + ret); + return; + } + } }
mutex_lock(&ctx->mixer_mutex);
On 2015년 06월 04일 05:17, Gustavo Padovan wrote:
From: Gustavo Padovan gustavo.padovan@collabora.co.uk
Check error and call DRM_ERROR if clk_prepare_enable() fails.
Applied.
Thanks, Inki Dae
Signed-off-by: Gustavo Padovan gustavo.padovan@collabora.co.uk
drivers/gpu/drm/exynos/exynos7_drm_decon.c | 28 +++++++++++++++++++++++---- drivers/gpu/drm/exynos/exynos_drm_fimd.c | 14 ++++++++++++-- drivers/gpu/drm/exynos/exynos_mixer.c | 31 +++++++++++++++++++++++++----- 3 files changed, 62 insertions(+), 11 deletions(-)
diff --git a/drivers/gpu/drm/exynos/exynos7_drm_decon.c b/drivers/gpu/drm/exynos/exynos7_drm_decon.c index d659ba2..d9798e2 100644 --- a/drivers/gpu/drm/exynos/exynos7_drm_decon.c +++ b/drivers/gpu/drm/exynos/exynos7_drm_decon.c @@ -606,6 +606,7 @@ static void decon_init(struct decon_context *ctx) static void decon_enable(struct exynos_drm_crtc *crtc) { struct decon_context *ctx = crtc->ctx;
int ret;
if (!ctx->suspended) return;
@@ -614,10 +615,29 @@ static void decon_enable(struct exynos_drm_crtc *crtc)
pm_runtime_get_sync(ctx->dev);
- clk_prepare_enable(ctx->pclk);
- clk_prepare_enable(ctx->aclk);
- clk_prepare_enable(ctx->eclk);
- clk_prepare_enable(ctx->vclk);
ret = clk_prepare_enable(ctx->pclk);
if (ret < 0) {
DRM_ERROR("Failed to prepare_enable the pclk [%d]\n", ret);
return;
}
ret = clk_prepare_enable(ctx->aclk);
if (ret < 0) {
DRM_ERROR("Failed to prepare_enable the aclk [%d]\n", ret);
return;
}
ret = clk_prepare_enable(ctx->eclk);
if (ret < 0) {
DRM_ERROR("Failed to prepare_enable the eclk [%d]\n", ret);
return;
}
ret = clk_prepare_enable(ctx->vclk);
if (ret < 0) {
DRM_ERROR("Failed to prepare_enable the vclk [%d]\n", ret);
return;
}
decon_init(ctx);
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c index 9661853..7c8ba61 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c @@ -808,6 +808,7 @@ static void fimd_apply(struct fimd_context *ctx) static void fimd_enable(struct exynos_drm_crtc *crtc) { struct fimd_context *ctx = crtc->ctx;
int ret;
if (!ctx->suspended) return;
@@ -816,8 +817,17 @@ static void fimd_enable(struct exynos_drm_crtc *crtc)
pm_runtime_get_sync(ctx->dev);
- clk_prepare_enable(ctx->bus_clk);
- clk_prepare_enable(ctx->lcd_clk);
ret = clk_prepare_enable(ctx->bus_clk);
if (ret < 0) {
DRM_ERROR("Failed to prepare_enable the bus clk [%d]\n", ret);
return;
}
ret = clk_prepare_enable(ctx->lcd_clk);
if (ret < 0) {
DRM_ERROR("Failed to prepare_enable the lcd clk [%d]\n", ret);
return;
}
/* if vblank was enabled status, enable it again. */ if (test_and_clear_bit(0, &ctx->irq_flags))
diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c index 6bab717..1b77fc7 100644 --- a/drivers/gpu/drm/exynos/exynos_mixer.c +++ b/drivers/gpu/drm/exynos/exynos_mixer.c @@ -1031,6 +1031,7 @@ static void mixer_enable(struct exynos_drm_crtc *crtc) { struct mixer_context *ctx = crtc->ctx; struct mixer_resources *res = &ctx->mixer_res;
int ret;
mutex_lock(&ctx->mixer_mutex); if (ctx->powered) {
@@ -1042,12 +1043,32 @@ static void mixer_enable(struct exynos_drm_crtc *crtc)
pm_runtime_get_sync(ctx->dev);
- clk_prepare_enable(res->mixer);
- clk_prepare_enable(res->hdmi);
- ret = clk_prepare_enable(res->mixer);
- if (ret < 0) {
DRM_ERROR("Failed to prepare_enable the mixer clk [%d]\n", ret);
return;
- }
- ret = clk_prepare_enable(res->hdmi);
- if (ret < 0) {
DRM_ERROR("Failed to prepare_enable the hdmi clk [%d]\n", ret);
return;
- } if (ctx->vp_enabled) {
clk_prepare_enable(res->vp);
if (ctx->has_sclk)
clk_prepare_enable(res->sclk_mixer);
ret = clk_prepare_enable(res->vp);
if (ret < 0) {
DRM_ERROR("Failed to prepare_enable the vp clk [%d]\n",
ret);
return;
}
if (ctx->has_sclk) {
ret = clk_prepare_enable(res->sclk_mixer);
if (ret < 0) {
DRM_ERROR("Failed to prepare_enable the " \
"sclk_mixer clk [%d]\n",
ret);
return;
}
}
}
mutex_lock(&ctx->mixer_mutex);
dri-devel@lists.freedesktop.org