drm/exynos: atomic modesetting support
Subsystems (6)
v9 cover drm/exynos: atomic modesetting support
From: Gustavo Padovan <[email protected]>
Hi,
Here goes the full support for atomic modesetting on exynos. I've split the patches in the various phases of atomic support.
v2: fixes comments by Joonyoung
- remove unused var in patch 09
- use ->disable instead of outdated ->dpms in hdmi code
- remove WARN_ON from crtc enable/disable
v3: fixes comment by Joonyoung
- move the removal of drm_helper_disable_unused_functions() to separated patch
v4: add patches that remove unnecessary calls to disable_plane()
v5: fixes NULL CRTC crash on planes updates (reported by Inki and Tobias)
v6: rebase on latest exynos_drm_next
v7: fix comments by Joonyoung
- fix two checkpatch errors
- remove extra crtc->commit() call
- check for null fb on exynos_check_plane()
v8: fix comments by Joonyoung
- fix merge error
- move drm_crtc_vblank_get to the commit that introduces atomic pageflip
- remove .prepare() in the apropiated patch
- add a new patch to move exynos_drm_crtc_disable()
v9: * fix comments by Joonyoung
- also remove encoder .prepare()
- do not shift exynos_update_plane() parameters
- remove unused .mode_set() and .mode_set_base()
* add specific exynos .atomic_commit()
* add split of exynos_crtc->ops->dpms() into enable() and disable()
* add other atomic clean ups
Gustavo Padovan (17):
drm/exynos: atomic phase 1: use drm_plane_helper_update() drm/exynos: atomic phase 1: use drm_plane_helper_disable() drm/exynos: atomic phase 1: add .mode_set_nofb() callback drm/exynos: atomic phase 2: wire up state reset(), duplicate() and
destroy()
drm/exynos: atomic phase 2: keep track of framebuffer pointer drm/exynos: atomic phase 3: atomic updates of planes drm/exynos: atomic phase 3: use atomic .set_config helper drm/exynos: atomic phase 3: convert page flips drm/exynos: remove exported functions from exynos_drm_plane drm/exynos: don't disable unused functions at init drm/exynos: move exynos_drm_crtc_disable()
drm/exynos: add exynos specific .atomic_commit() drm/exynos: atomic dpms support
drm/exynos: remove unnecessary calls to disable_plane() drm/exynos: split exynos_crtc->dpms in enable() and disable() drm/exynos: rename win_commit/disable to atomic-like names drm/exynos: don't disable planes already disabled
Joonyoung Shim (1):
drm/exynos: fix source data argument for plane
drivers/gpu/drm/bridge/ps8622.c | 6 +- drivers/gpu/drm/bridge/ptn3460.c | 6 +- drivers/gpu/drm/exynos/exynos7_drm_decon.c | 45 +++---- drivers/gpu/drm/exynos/exynos_dp_core.c | 6 +- drivers/gpu/drm/exynos/exynos_drm_crtc.c | 201 ++++++---------------------- drivers/gpu/drm/exynos/exynos_drm_dpi.c | 6 +- drivers/gpu/drm/exynos/exynos_drm_drv.c | 2 + drivers/gpu/drm/exynos/exynos_drm_drv.h | 14 +- drivers/gpu/drm/exynos/exynos_drm_dsi.c | 6 +- drivers/gpu/drm/exynos/exynos_drm_encoder.c | 35 +---- drivers/gpu/drm/exynos/exynos_drm_fb.c | 35 +++++ drivers/gpu/drm/exynos/exynos_drm_fbdev.c | 3 - drivers/gpu/drm/exynos/exynos_drm_fimd.c | 58 +++----- drivers/gpu/drm/exynos/exynos_drm_plane.c | 128 ++++++++++-------- drivers/gpu/drm/exynos/exynos_drm_plane.h | 11 -- drivers/gpu/drm/exynos/exynos_drm_vidi.c | 71 +++++----- drivers/gpu/drm/exynos/exynos_hdmi.c | 10 +- drivers/gpu/drm/exynos/exynos_mixer.c | 44 +++--- 18 files changed, 276 insertions(+), 411 deletions(-)
Signature · 1 line
2.1.0
PATCH v9 1/18 drm/exynos: fix source data argument for plane
From: Joonyoung Shim <[email protected]>
The exynos_update_plane function needs 16.16 fixed point source data.
--- drivers/gpu/drm/exynos/exynos_drm_crtc.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_crtc.c +4 -3
@@ -127,7 +127,8 @@ static int exynos_drm_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y, crtc_h = fb->height - y;return exynos_update_plane (crtc->primary, crtc, fb,0 ,0 , - crtc_w, crtc_h, x, y, crtc_w, crtc_h); + crtc_w, crtc_h, x <<16 , y <<16 , + crtc_w <<16 , crtc_h <<16 ); }static void exynos_drm_crtc_disable (struct drm_crtc *crtc)
@@ -202,8 +203,8 @@ static int exynos_drm_crtc_page_flip(struct drm_crtc *crtc, crtc_w = fb->width - crtc->x; crtc_h = fb->height - crtc->y; ret =exynos_update_plane (crtc->primary, crtc, fb,0 ,0 , - crtc_w, crtc_h, crtc->x, crtc->y, - crtc_w, crtc_h); + crtc_w, crtc_h, crtc->x <<16 , crtc->y <<16 , + crtc_w <<16 , crtc_h <<16 );if (ret) { crtc->primary->fb = old_fb;spin_lock_irq (&dev->event_lock);
Signature · 1 line
2.1.0
PATCH v9 2/18 drm/exynos: atomic phase 1: use drm_plane_helper_update()
In reply to Gustavo PadovanFrom: Gustavo Padovan <[email protected]>
Rip out the check from exynos_update_plane() and create exynos_check_plane() for the check phase enabling use to use the atomic helpers to call our check and update phases when updating planes.
Update all users of exynos_update_plane() accordingly to call exynos_check_plane() before.
--- drivers/gpu/drm/exynos/exynos_drm_crtc.c | 31 ++++++++++++------------ drivers/gpu/drm/exynos/exynos_drm_plane.c | 40 +++++++++++++++++++++++-------- drivers/gpu/drm/exynos/exynos_drm_plane.h | 2 +- 3 files changed, 47 insertions(+), 26 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_crtc.c +16 -15
@@ -116,6 +116,7 @@ static int exynos_drm_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y,struct drm_framebuffer *fb = crtc->primary->fb;unsigned int crtc_w;unsigned int crtc_h; +int ret;/* when framebuffer changing is requested, crtc's dpms should be on */ if (exynos_crtc->dpms >DRM_MODE_DPMS_ON ) {
@@ -123,12 +124,17 @@ static int exynos_drm_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y,return -EPERM ; } + ret =exynos_check_plane (crtc->primary, fb); +if (ret) +return ret; + crtc_w = fb->width - x; crtc_h = fb->height - y; +exynos_update_plane (crtc->primary, crtc, fb,0 ,0 , + crtc_w, crtc_h, x <<16 , y <<16 , + crtc_w <<16 , crtc_h <<16 ); -return exynos_update_plane (crtc->primary, crtc, fb,0 ,0 , - crtc_w, crtc_h, x <<16 , y <<16 , - crtc_w <<16 , crtc_h <<16 ); +return 0 ; }static void exynos_drm_crtc_disable (struct drm_crtc *crtc)
@@ -165,7 +171,6 @@ static int exynos_drm_crtc_page_flip(struct drm_crtc *crtc, {struct drm_device *dev = crtc->dev;struct exynos_drm_crtc *exynos_crtc =to_exynos_crtc (crtc); -struct drm_framebuffer *old_fb = crtc->primary->fb;unsigned int crtc_w, crtc_h;int ret;
@@ -184,6 +189,10 @@ static int exynos_drm_crtc_page_flip(struct drm_crtc *crtc, goto out; } + ret =exynos_check_plane (crtc->primary, fb); +if (ret) + goto out; + ret =drm_vblank_get (dev, exynos_crtc->pipe);if (ret) {DRM_DEBUG ("failed to acquire vblank counter\n" );
@@ -202,17 +211,9 @@ static int exynos_drm_crtc_page_flip(struct drm_crtc *crtc, crtc->primary->fb = fb; crtc_w = fb->width - crtc->x; crtc_h = fb->height - crtc->y; - ret =exynos_update_plane (crtc->primary, crtc, fb,0 ,0 , - crtc_w, crtc_h, crtc->x <<16 , crtc->y <<16 , - crtc_w <<16 , crtc_h <<16 ); -if (ret) { - crtc->primary->fb = old_fb; -spin_lock_irq (&dev->event_lock); - exynos_crtc->event =NULL ; -drm_vblank_put (dev, exynos_crtc->pipe); -spin_unlock_irq (&dev->event_lock); -return ret; - } +exynos_update_plane (crtc->primary, crtc, fb,0 ,0 , + crtc_w, crtc_h, crtc->x <<16 , crtc->y <<16 , + crtc_w <<16 , crtc_h <<16 );return 0 ;
drivers/gpu/drm/exynos/exynos_drm_plane.c +30 -10
@@ -144,21 +144,15 @@ void exynos_plane_mode_set(struct drm_plane *plane, struct drm_crtc *crtc, plane->crtc = crtc; } -int +void exynos_update_plane (struct drm_plane *plane,struct drm_crtc *crtc,struct drm_framebuffer *fb,int crtc_x,int crtc_y,unsigned int crtc_w,unsigned int crtc_h,uint32_t src_x,uint32_t src_y,uint32_t src_w,uint32_t src_h) { -struct exynos_drm_crtc *exynos_crtc =to_exynos_crtc (crtc);struct exynos_drm_plane *exynos_plane =to_exynos_plane (plane); -int ret; - - ret =exynos_check_plane (plane, fb); -if (ret <0 ) -return ret; exynos_plane_mode_set(plane, crtc, fb, crtc_x, crtc_y, crtc_w, crtc_h, src_x >> 16, src_y >> 16,
@@ -166,8 +160,6 @@ exynos_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,if (exynos_crtc->ops->win_commit) exynos_crtc->ops->win_commit (exynos_crtc, exynos_plane->zpos); - -return 0 ; }static int exynos_disable_plane (struct drm_plane *plane)
@@ -183,11 +175,37 @@ static int exynos_disable_plane(struct drm_plane *plane) }static struct drm_plane_funcs exynos_plane_funcs = { - .update_plane = exynos_update_plane, + .update_plane = drm_plane_helper_update, .disable_plane = exynos_disable_plane, .destroy = drm_plane_cleanup, }; +static int exynos_plane_atomic_check (struct drm_plane *plane, +struct drm_plane_state *state) +{ +return exynos_check_plane (plane, state->fb); +} + +static void exynos_plane_atomic_update (struct drm_plane *plane, +struct drm_plane_state *old_state) +{ +struct drm_plane_state *state = plane->state; + +if (!state->crtc) +return ; + +exynos_update_plane (plane, state->crtc, state->fb, + state->crtc_x, state->crtc_y, + state->crtc_w, state->crtc_h, + state->src_x, state->src_y, + state->src_w, state->src_h); +} + +static const struct drm_plane_helper_funcs plane_helper_funcs = { + .atomic_check = exynos_plane_atomic_check, + .atomic_update = exynos_plane_atomic_update, +}; +static void exynos_plane_attach_zpos_property (struct drm_plane *plane,unsigned int zpos) {
@@ -223,6 +241,8 @@ int exynos_plane_init(struct drm_device *dev,return err; } +drm_plane_helper_add (&exynos_plane->base, &plane_helper_funcs); + exynos_plane->zpos = zpos;if (type ==DRM_PLANE_TYPE_OVERLAY )
drivers/gpu/drm/exynos/exynos_drm_plane.h +1 -1
@@ -15,7 +15,7 @@ void exynos_plane_mode_set(struct drm_plane *plane, struct drm_crtc *crtc, unsigned int crtc_w, unsigned int crtc_h, uint32_t src_x, uint32_t src_y, uint32_t src_w, uint32_t src_h); -int exynos_update_plane(struct drm_plane *plane, struct drm_crtc *crtc, +void exynos_update_plane(struct drm_plane *plane, struct drm_crtc *crtc, struct drm_framebuffer *fb, int crtc_x, int crtc_y, unsigned int crtc_w, unsigned int crtc_h, uint32_t src_x, uint32_t src_y,
Signature · 6 lines
2.1.0 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v9 3/18 drm/exynos: atomic phase 1: use drm_plane_helper_disable()
In reply to Gustavo PadovanFrom: Gustavo Padovan <[email protected]>
The atomic helper to disable planes also uses the optional .atomic_disable() helper. The unique operation it does is calling .win_disable()
--- drivers/gpu/drm/exynos/exynos_drm_plane.c | 32 ++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_plane.c +19 -13
@@ -67,6 +67,9 @@ int exynos_check_plane(struct drm_plane *plane, struct drm_framebuffer *fb)int nr;int i; +if (!fb) +return 0 ; + nr =exynos_drm_fb_get_buf_cnt (fb);for (i =0 ; i < nr; i++) {struct exynos_drm_gem_buf *buffer =exynos_drm_fb_buffer (fb, i);
@@ -162,21 +165,9 @@ exynos_update_plane(struct drm_plane *plane, struct drm_crtc *crtc, exynos_crtc->ops->win_commit (exynos_crtc, exynos_plane->zpos); } -static int exynos_disable_plane (struct drm_plane *plane) -{ -struct exynos_drm_plane *exynos_plane =to_exynos_plane (plane); -struct exynos_drm_crtc *exynos_crtc =to_exynos_crtc (plane->crtc); - -if (exynos_crtc && exynos_crtc->ops->win_disable) - exynos_crtc->ops->win_disable (exynos_crtc, - exynos_plane->zpos); - -return 0 ; -} -static struct drm_plane_funcs exynos_plane_funcs = { .update_plane = drm_plane_helper_update, - .disable_plane = exynos_disable_plane, + .disable_plane = drm_plane_helper_disable, .destroy = drm_plane_cleanup, };
@@ -201,9 +192,24 @@ static void exynos_plane_atomic_update(struct drm_plane *plane, state->src_w, state->src_h); } +static void exynos_plane_atomic_disable (struct drm_plane *plane, +struct drm_plane_state *old_state) +{ +struct exynos_drm_plane *exynos_plane =to_exynos_plane (plane); +struct exynos_drm_crtc *exynos_crtc =to_exynos_crtc (old_state->crtc); + +if (!old_state->crtc) +return ; + +if (exynos_crtc->ops->win_disable) + exynos_crtc->ops->win_disable (exynos_crtc, + exynos_plane->zpos); +} +static const struct drm_plane_helper_funcs plane_helper_funcs = { .atomic_check = exynos_plane_atomic_check, .atomic_update = exynos_plane_atomic_update, + .atomic_disable = exynos_plane_atomic_disable, }; static void exynos_plane_attach_zpos_property(struct drm_plane *plane,
Signature · 6 lines
2.1.0 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v9 4/18 drm/exynos: atomic phase 1: add .mode_set_nofb() callback
In reply to Gustavo PadovanFrom: Gustavo Padovan <[email protected]>
The new atomic infrastructure needs the .mode_set_nofb() callback to update CRTC timings before setting any plane.
v2: remove WARN_ON(!crtc->state) from mode_set_nofb
--- drivers/gpu/drm/exynos/exynos_drm_crtc.c | 63 ++++---------------------------- 1 file changed, 7 insertions(+), 56 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_crtc.c +7 -56
@@ -62,9 +62,6 @@ static void exynos_drm_crtc_commit(struct drm_crtc *crtc)if (exynos_crtc->ops->win_commit) exynos_crtc->ops->win_commit (exynos_crtc, exynos_plane->zpos); - -if (exynos_crtc->ops->commit) - exynos_crtc->ops->commit (exynos_crtc); } static bool
@@ -81,60 +78,13 @@ exynos_drm_crtc_mode_fixup(struct drm_crtc *crtc,return true; } -static int -exynos_drm_crtc_mode_set (struct drm_crtc *crtc,struct drm_display_mode *mode, -struct drm_display_mode *adjusted_mode,int x,int y, -struct drm_framebuffer *old_fb) -{ -struct drm_framebuffer *fb = crtc->primary->fb; -unsigned int crtc_w; -unsigned int crtc_h; -int ret; - -/* -* copy the mode data adjusted by mode_fixup() into crtc->mode -* so that hardware can be seet to proper mode. -*/ -memcpy (&crtc->mode, adjusted_mode,sizeof (*adjusted_mode)); - - ret =exynos_check_plane (crtc->primary, fb); -if (ret <0 ) -return ret; - - crtc_w = fb->width - x; - crtc_h = fb->height - y; -exynos_plane_mode_set (crtc->primary, crtc, fb,0 ,0 , - crtc_w, crtc_h, x, y, crtc_w, crtc_h); - -return 0 ; -} - -static int exynos_drm_crtc_mode_set_base (struct drm_crtc *crtc,int x,int y, -struct drm_framebuffer *old_fb) +static void +exynos_drm_crtc_mode_set_nofb (struct drm_crtc *crtc) {struct exynos_drm_crtc *exynos_crtc =to_exynos_crtc (crtc); -struct drm_framebuffer *fb = crtc->primary->fb; -unsigned int crtc_w; -unsigned int crtc_h; -int ret; - -/* when framebuffer changing is requested, crtc's dpms should be on */ -if (exynos_crtc->dpms >DRM_MODE_DPMS_ON ) { -DRM_ERROR ("failed framebuffer changing request.\n" ); -return -EPERM ; - } - ret =exynos_check_plane (crtc->primary, fb); -if (ret) -return ret; - - crtc_w = fb->width - x; - crtc_h = fb->height - y; -exynos_update_plane (crtc->primary, crtc, fb,0 ,0 , - crtc_w, crtc_h, x <<16 , y <<16 , - crtc_w <<16 , crtc_h <<16 ); - -return 0 ; +if (exynos_crtc->ops->commit) + exynos_crtc->ops->commit (exynos_crtc); }static void exynos_drm_crtc_disable (struct drm_crtc *crtc)
@@ -159,8 +109,9 @@ static struct drm_crtc_helper_funcs exynos_crtc_helper_funcs = { .prepare = exynos_drm_crtc_prepare, .commit = exynos_drm_crtc_commit, .mode_fixup = exynos_drm_crtc_mode_fixup, - .mode_set = exynos_drm_crtc_mode_set, - .mode_set_base = exynos_drm_crtc_mode_set_base, + .mode_set = drm_helper_crtc_mode_set, + .mode_set_nofb = exynos_drm_crtc_mode_set_nofb, + .mode_set_base = drm_helper_crtc_mode_set_base, .disable = exynos_drm_crtc_disable, };
Signature · 1 line
2.1.0
PATCH v9 5/18 drm/exynos: atomic phase 2: wire up state reset(), duplicate() and destroy()
In reply to Gustavo PadovanFrom: Gustavo Padovan <[email protected]>
Set CRTC, planes and connectors to use the default implementations from the atomic helper library. The helpers will work to keep track of state for each DRM object.
--- drivers/gpu/drm/bridge/ps8622.c | 4 ++++ drivers/gpu/drm/bridge/ptn3460.c | 4 ++++ drivers/gpu/drm/exynos/exynos_dp_core.c | 4 ++++ drivers/gpu/drm/exynos/exynos_drm_crtc.c | 5 +++++ drivers/gpu/drm/exynos/exynos_drm_dpi.c | 4 ++++ drivers/gpu/drm/exynos/exynos_drm_drv.c | 2 ++ drivers/gpu/drm/exynos/exynos_drm_dsi.c | 4 ++++ drivers/gpu/drm/exynos/exynos_drm_plane.c | 4 ++++ drivers/gpu/drm/exynos/exynos_drm_vidi.c | 4 ++++ drivers/gpu/drm/exynos/exynos_hdmi.c | 4 ++++ 10 files changed, 39 insertions(+)
drivers/gpu/drm/bridge/ps8622.c +4 -0
@@ -31,6 +31,7 @@#include "drmP.h" #include "drm_crtc.h" #include "drm_crtc_helper.h" +#include "drm_atomic_helper.h" /* Brightness scale on the Parade chip */ #define PS8622_MAX_BRIGHTNESS 0xff
@@ -502,6 +503,9 @@ static const struct drm_connector_funcs ps8622_connector_funcs = { .fill_modes = drm_helper_probe_single_connector_modes, .detect = ps8622_detect, .destroy = ps8622_connector_destroy, + .reset = drm_atomic_helper_connector_reset, + .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state, + .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, };static int ps8622_attach (struct drm_bridge *bridge)
drivers/gpu/drm/bridge/ptn3460.c +4 -0
@@ -27,6 +27,7 @@#include "drm_crtc.h" #include "drm_crtc_helper.h" +#include "drm_atomic_helper.h" #include "drm_edid.h" #include "drmP.h"
@@ -263,6 +264,9 @@ static struct drm_connector_funcs ptn3460_connector_funcs = { .fill_modes = drm_helper_probe_single_connector_modes, .detect = ptn3460_detect, .destroy = ptn3460_connector_destroy, + .reset = drm_atomic_helper_connector_reset, + .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state, + .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, };static int ptn3460_bridge_attach (struct drm_bridge *bridge)
drivers/gpu/drm/exynos/exynos_dp_core.c +4 -0
@@ -28,6 +28,7 @@#include <drm/drmP.h> #include <drm/drm_crtc.h> #include <drm/drm_crtc_helper.h> +#include <drm/drm_atomic_helper.h> #include <drm/drm_panel.h> #include <drm/bridge/ptn3460.h>
@@ -957,6 +958,9 @@ static struct drm_connector_funcs exynos_dp_connector_funcs = { .fill_modes = drm_helper_probe_single_connector_modes, .detect = exynos_dp_detect, .destroy = exynos_dp_connector_destroy, + .reset = drm_atomic_helper_connector_reset, + .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state, + .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, };static int exynos_dp_get_modes (struct drm_connector *connector)
drivers/gpu/drm/exynos/exynos_drm_crtc.c +5 -0
@@ -14,6 +14,8 @@#include <drm/drmP.h> #include <drm/drm_crtc_helper.h> +#include <drm/drm_atomic.h> +#include <drm/drm_atomic_helper.h> #include "exynos_drm_crtc.h" #include "exynos_drm_drv.h"
@@ -188,6 +190,9 @@ static struct drm_crtc_funcs exynos_crtc_funcs = { .set_config = drm_crtc_helper_set_config, .page_flip = exynos_drm_crtc_page_flip, .destroy = exynos_drm_crtc_destroy, + .reset = drm_atomic_helper_crtc_reset, + .atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state, + .atomic_destroy_state = drm_atomic_helper_crtc_destroy_state, }; struct exynos_drm_crtc *exynos_drm_crtc_create(struct drm_device *drm_dev,
drivers/gpu/drm/exynos/exynos_drm_dpi.c +4 -0
@@ -13,6 +13,7 @@#include <drm/drmP.h> #include <drm/drm_crtc_helper.h> #include <drm/drm_panel.h> +#include <drm/drm_atomic_helper.h> #include <linux/regulator/consumer.h>
@@ -63,6 +64,9 @@ static struct drm_connector_funcs exynos_dpi_connector_funcs = { .detect = exynos_dpi_detect, .fill_modes = drm_helper_probe_single_connector_modes, .destroy = exynos_dpi_connector_destroy, + .reset = drm_atomic_helper_connector_reset, + .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state, + .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, };static int exynos_dpi_get_modes (struct drm_connector *connector)
drivers/gpu/drm/exynos/exynos_drm_drv.c +2 -0
@@ -98,6 +98,8 @@ static int exynos_drm_load(struct drm_device *dev, unsigned long flags)if (ret) goto err_cleanup_vblank; +drm_mode_config_reset (dev); +/* * enable drm irq mode. * - with irq_enabled = true, we can use the vblank feature.
drivers/gpu/drm/exynos/exynos_drm_dsi.c +4 -0
@@ -14,6 +14,7 @@#include <drm/drm_crtc_helper.h> #include <drm/drm_mipi_dsi.h> #include <drm/drm_panel.h> +#include <drm/drm_atomic_helper.h> #include <linux/clk.h> #include <linux/gpio/consumer.h>
@@ -1461,6 +1462,9 @@ static struct drm_connector_funcs exynos_dsi_connector_funcs = { .detect = exynos_dsi_detect, .fill_modes = drm_helper_probe_single_connector_modes, .destroy = exynos_dsi_connector_destroy, + .reset = drm_atomic_helper_connector_reset, + .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state, + .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, };static int exynos_dsi_get_modes (struct drm_connector *connector)
drivers/gpu/drm/exynos/exynos_drm_plane.c +4 -0
@@ -13,6 +13,7 @@#include <drm/exynos_drm.h> #include <drm/drm_plane_helper.h> +#include <drm/drm_atomic_helper.h> #include "exynos_drm_drv.h" #include "exynos_drm_crtc.h" #include "exynos_drm_fb.h"
@@ -169,6 +170,9 @@ static struct drm_plane_funcs exynos_plane_funcs = { .update_plane = drm_plane_helper_update, .disable_plane = drm_plane_helper_disable, .destroy = drm_plane_cleanup, + .reset = drm_atomic_helper_plane_reset, + .atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state, + .atomic_destroy_state = drm_atomic_helper_plane_destroy_state, }; static int exynos_plane_atomic_check(struct drm_plane *plane,
drivers/gpu/drm/exynos/exynos_drm_vidi.c +4 -0
@@ -20,6 +20,7 @@#include <drm/drm_edid.h> #include <drm/drm_crtc_helper.h> +#include <drm/drm_atomic_helper.h> #include "exynos_drm_drv.h" #include "exynos_drm_crtc.h"
@@ -388,6 +389,9 @@ static struct drm_connector_funcs vidi_connector_funcs = { .fill_modes = drm_helper_probe_single_connector_modes, .detect = vidi_detect, .destroy = vidi_connector_destroy, + .reset = drm_atomic_helper_connector_reset, + .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state, + .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, };static int vidi_get_modes (struct drm_connector *connector)
drivers/gpu/drm/exynos/exynos_hdmi.c +4 -0
@@ -17,6 +17,7 @@#include <drm/drmP.h> #include <drm/drm_edid.h> #include <drm/drm_crtc_helper.h> +#include <drm/drm_atomic_helper.h> #include "regs-hdmi.h"
@@ -1054,6 +1055,9 @@ static struct drm_connector_funcs hdmi_connector_funcs = { .fill_modes = drm_helper_probe_single_connector_modes, .detect = hdmi_detect, .destroy = hdmi_connector_destroy, + .reset = drm_atomic_helper_connector_reset, + .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state, + .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, };static int hdmi_get_modes (struct drm_connector *connector)
Signature · 6 lines
2.1.0 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v9 6/18 drm/exynos: atomic phase 2: keep track of framebuffer pointer
In reply to Gustavo PadovanFrom: Gustavo Padovan <[email protected]>
Use drm_atomic_set_fb_for_plane() in the legacy page_flip path to keep track of the framebuffer pointer and reference.
--- drivers/gpu/drm/exynos/exynos_drm_crtc.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/exynos/exynos_drm_crtc.c +3 -0
@@ -168,6 +168,9 @@ static int exynos_drm_crtc_page_flip(struct drm_crtc *crtc, crtc_w, crtc_h, crtc->x <<16 , crtc->y <<16 , crtc_w << 16, crtc_h << 16); +if (crtc->primary->state) +drm_atomic_set_fb_for_plane (crtc->primary->state, fb); +return 0 ; out:
Signature · 6 lines
2.1.0 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v9 7/18 drm/exynos: atomic phase 3: atomic updates of planes
In reply to Gustavo PadovanFrom: Gustavo Padovan <[email protected]>
Now that phase 1 and 2 are complete we can switch the update/disable_plane callbacks to their atomic version.
--- drivers/gpu/drm/exynos/exynos_drm_fb.c | 3 +++ drivers/gpu/drm/exynos/exynos_drm_plane.c | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_fb.c +3 -0
@@ -16,6 +16,7 @@#include <drm/drm_crtc.h> #include <drm/drm_crtc_helper.h> #include <drm/drm_fb_helper.h> +#include <drm/drm_atomic_helper.h> #include <uapi/drm/exynos_drm.h> #include "exynos_drm_drv.h"
@@ -268,6 +269,8 @@ static void exynos_drm_output_poll_changed(struct drm_device *dev)static const struct drm_mode_config_funcs exynos_drm_mode_config_funcs = { .fb_create = exynos_user_fb_create, .output_poll_changed = exynos_drm_output_poll_changed, + .atomic_check = drm_atomic_helper_check, + .atomic_commit = drm_atomic_helper_commit, };void exynos_drm_mode_config_init (struct drm_device *dev)
drivers/gpu/drm/exynos/exynos_drm_plane.c +2 -2
@@ -167,8 +167,8 @@ exynos_update_plane(struct drm_plane *plane, struct drm_crtc *crtc, }static struct drm_plane_funcs exynos_plane_funcs = { - .update_plane = drm_plane_helper_update, - .disable_plane = drm_plane_helper_disable, + .update_plane = drm_atomic_helper_update_plane, + .disable_plane = drm_atomic_helper_disable_plane, .destroy = drm_plane_cleanup, .reset = drm_atomic_helper_plane_reset, .atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state,
Signature · 1 line
2.1.0
PATCH v9 8/18 drm/exynos: atomic phase 3: use atomic .set_config helper
In reply to Gustavo PadovanFrom: Gustavo Padovan <[email protected]>
Now that phase 1 and 2 are complete switch .set_config helper to use the atomic one.
v2: also remove .prepare() callback
v3: remove .mode_set() and .mode_set_base() and encoder's .prepare() callbacks
--- drivers/gpu/drm/exynos/exynos_drm_crtc.c | 10 +--------- drivers/gpu/drm/exynos/exynos_drm_encoder.c | 6 ------ 2 files changed, 1 insertion(+), 15 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_crtc.c +1 -9
@@ -50,11 +50,6 @@ static void exynos_drm_crtc_dpms(struct drm_crtc *crtc, int mode)drm_crtc_vblank_on (crtc); } -static void exynos_drm_crtc_prepare (struct drm_crtc *crtc) -{ -/* drm framework doesn't check NULL. */ -} -static void exynos_drm_crtc_commit (struct drm_crtc *crtc) {struct exynos_drm_crtc *exynos_crtc =to_exynos_crtc (crtc);
@@ -108,12 +103,9 @@ static void exynos_drm_crtc_disable(struct drm_crtc *crtc)static struct drm_crtc_helper_funcs exynos_crtc_helper_funcs = { .dpms = exynos_drm_crtc_dpms, - .prepare = exynos_drm_crtc_prepare, .commit = exynos_drm_crtc_commit, .mode_fixup = exynos_drm_crtc_mode_fixup, - .mode_set = drm_helper_crtc_mode_set, .mode_set_nofb = exynos_drm_crtc_mode_set_nofb, - .mode_set_base = drm_helper_crtc_mode_set_base, .disable = exynos_drm_crtc_disable, };
@@ -190,7 +182,7 @@ static void exynos_drm_crtc_destroy(struct drm_crtc *crtc) }static struct drm_crtc_funcs exynos_crtc_funcs = { - .set_config = drm_crtc_helper_set_config, + .set_config = drm_atomic_helper_set_config, .page_flip = exynos_drm_crtc_page_flip, .destroy = exynos_drm_crtc_destroy, .reset = drm_atomic_helper_crtc_reset,
drivers/gpu/drm/exynos/exynos_drm_encoder.c +0 -6
@@ -76,11 +76,6 @@ static void exynos_drm_encoder_mode_set(struct drm_encoder *encoder, display->ops->mode_set (display, adjusted_mode); } -static void exynos_drm_encoder_prepare (struct drm_encoder *encoder) -{ -/* drm framework doesn't check NULL. */ -} -static void exynos_drm_encoder_commit (struct drm_encoder *encoder) {struct exynos_drm_encoder *exynos_encoder =to_exynos_encoder (encoder);
@@ -111,7 +106,6 @@ static struct drm_encoder_helper_funcs exynos_encoder_helper_funcs = { .dpms = exynos_drm_encoder_dpms, .mode_fixup = exynos_drm_encoder_mode_fixup, .mode_set = exynos_drm_encoder_mode_set, - .prepare = exynos_drm_encoder_prepare, .commit = exynos_drm_encoder_commit, .disable = exynos_drm_encoder_disable, };
Signature · 1 line
2.1.0
PATCH v9 9/18 drm/exynos: atomic phase 3: convert page flips
In reply to Gustavo PadovanFrom: Gustavo Padovan <[email protected]>
PageFlips now use the atomic helper to work through the atomic modesetting API. Async page flips are not supported yet.
v2: Add .atomic_begin() step to handle the vblank part we removed from exynos page_flip code.
--- drivers/gpu/drm/exynos/exynos_drm_crtc.c | 79 +++++++------------------------- drivers/gpu/drm/exynos/exynos_drm_fb.c | 9 +++- 2 files changed, 25 insertions(+), 63 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_crtc.c +17 -62
@@ -101,75 +101,30 @@ static void exynos_drm_crtc_disable(struct drm_crtc *crtc) } } +static void exynos_crtc_atomic_begin (struct drm_crtc *crtc) +{ +struct exynos_drm_crtc *exynos_crtc =to_exynos_crtc (crtc); + +if (crtc->state->event) { +WARN_ON (drm_crtc_vblank_get (crtc) !=0 ); + exynos_crtc->event = crtc->state->event; + } +} + +static void exynos_crtc_atomic_flush (struct drm_crtc *crtc) +{ +} +static struct drm_crtc_helper_funcs exynos_crtc_helper_funcs = { .dpms = exynos_drm_crtc_dpms, .commit = exynos_drm_crtc_commit, .mode_fixup = exynos_drm_crtc_mode_fixup, .mode_set_nofb = exynos_drm_crtc_mode_set_nofb, .disable = exynos_drm_crtc_disable, + .atomic_begin = exynos_crtc_atomic_begin, + .atomic_flush = exynos_crtc_atomic_flush, }; -static int exynos_drm_crtc_page_flip (struct drm_crtc *crtc, -struct drm_framebuffer *fb, -struct drm_pending_vblank_event *event, -uint32_t page_flip_flags) -{ -struct drm_device *dev = crtc->dev; -struct exynos_drm_crtc *exynos_crtc =to_exynos_crtc (crtc); -unsigned int crtc_w, crtc_h; -int ret; - -/* when the page flip is requested, crtc's dpms should be on */ -if (exynos_crtc->dpms >DRM_MODE_DPMS_ON ) { -DRM_ERROR ("failed page flip request.\n" ); -return -EINVAL ; - } - -if (!event) -return -EINVAL ; - -spin_lock_irq (&dev->event_lock); -if (exynos_crtc->event) { - ret = -EBUSY ; - goto out; - } - - ret =exynos_check_plane (crtc->primary, fb); -if (ret) - goto out; - - ret =drm_vblank_get (dev, exynos_crtc->pipe); -if (ret) { -DRM_DEBUG ("failed to acquire vblank counter\n" ); - goto out; - } - - exynos_crtc->event = event; -spin_unlock_irq (&dev->event_lock); - -/* -* the pipe from user always is 0 so we can set pipe number -* of current owner to event. -*/ - event->pipe = exynos_crtc->pipe; - - crtc->primary->fb = fb; - crtc_w = fb->width - crtc->x; - crtc_h = fb->height - crtc->y; -exynos_update_plane (crtc->primary, crtc, fb,0 ,0 , - crtc_w, crtc_h, crtc->x <<16 , crtc->y <<16 , - crtc_w <<16 , crtc_h <<16 ); - -if (crtc->primary->state) -drm_atomic_set_fb_for_plane (crtc->primary->state, fb); - -return 0 ; - -out: -spin_unlock_irq (&dev->event_lock); -return ret; -} -static void exynos_drm_crtc_destroy (struct drm_crtc *crtc) {struct exynos_drm_crtc *exynos_crtc =to_exynos_crtc (crtc);
@@ -183,7 +138,7 @@ static void exynos_drm_crtc_destroy(struct drm_crtc *crtc)static struct drm_crtc_funcs exynos_crtc_funcs = { .set_config = drm_atomic_helper_set_config, - .page_flip = exynos_drm_crtc_page_flip, + .page_flip = drm_atomic_helper_page_flip, .destroy = exynos_drm_crtc_destroy, .reset = drm_atomic_helper_crtc_reset, .atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state,
drivers/gpu/drm/exynos/exynos_drm_fb.c +8 -1
@@ -266,11 +266,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) +{ +return drm_atomic_helper_commit (dev, state, false); +} +static const struct drm_mode_config_funcs exynos_drm_mode_config_funcs = { .fb_create = exynos_user_fb_create, .output_poll_changed = exynos_drm_output_poll_changed, .atomic_check = drm_atomic_helper_check, - .atomic_commit = drm_atomic_helper_commit, + .atomic_commit = exynos_atomic_commit, };void exynos_drm_mode_config_init (struct drm_device *dev)
Signature · 1 line
2.1.0
PATCH v9 10/18 drm/exynos: remove exported functions from exynos_drm_plane
In reply to Gustavo PadovanFrom: Gustavo Padovan <[email protected]>
Now that no one is using the functions exported by exynos_drm_plane due to the atomic conversion we can make remove some of the them or make them static.
v2: remove unused exynos_drm_crtc
v3: fix checkpatch error (reported by Joonyoung)
--- drivers/gpu/drm/exynos/exynos_drm_plane.c | 98 +++++++++++++------------------ drivers/gpu/drm/exynos/exynos_drm_plane.h | 11 ---- 2 files changed, 42 insertions(+), 67 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_plane.c +42 -56
@@ -62,38 +62,13 @@ static int exynos_plane_get_size(int start, unsigned length, unsigned last)return size; } -int exynos_check_plane (struct drm_plane *plane,struct drm_framebuffer *fb) -{ -struct exynos_drm_plane *exynos_plane =to_exynos_plane (plane); -int nr; -int i; - -if (!fb) -return 0 ; - - nr =exynos_drm_fb_get_buf_cnt (fb); -for (i =0 ; i < nr; i++) { -struct exynos_drm_gem_buf *buffer =exynos_drm_fb_buffer (fb, i); - -if (!buffer) { -DRM_DEBUG_KMS ("buffer is null\n" ); -return -EFAULT ; - } - - exynos_plane->dma_addr[i] = buffer->dma_addr + fb->offsets[i]; - -DRM_DEBUG_KMS ("buffer: %d, dma_addr = 0x%lx\n" , - i, (unsigned long )exynos_plane->dma_addr[i]); - } - -return 0 ; -} - -void exynos_plane_mode_set (struct drm_plane *plane,struct drm_crtc *crtc, -struct drm_framebuffer *fb,int crtc_x,int crtc_y, -unsigned int crtc_w,unsigned int crtc_h, -uint32_t src_x,uint32_t src_y, -uint32_t src_w,uint32_t src_h) +static void exynos_plane_mode_set (struct drm_plane *plane, +struct drm_crtc *crtc, +struct drm_framebuffer *fb, +int crtc_x,int crtc_y, +unsigned int crtc_w,unsigned int crtc_h, +uint32_t src_x,uint32_t src_y, +uint32_t src_w,uint32_t src_h) {struct exynos_drm_plane *exynos_plane =to_exynos_plane (plane);unsigned int actual_w;
@@ -148,24 +123,6 @@ void exynos_plane_mode_set(struct drm_plane *plane, struct drm_crtc *crtc, plane->crtc = crtc; } -void -exynos_update_plane (struct drm_plane *plane,struct drm_crtc *crtc, -struct drm_framebuffer *fb,int crtc_x,int crtc_y, -unsigned int crtc_w,unsigned int crtc_h, -uint32_t src_x,uint32_t src_y, -uint32_t src_w,uint32_t src_h) -{ -struct exynos_drm_crtc *exynos_crtc =to_exynos_crtc (crtc); -struct exynos_drm_plane *exynos_plane =to_exynos_plane (plane); - -exynos_plane_mode_set (plane, crtc, fb, crtc_x, crtc_y, - crtc_w, crtc_h, src_x >>16 , src_y >>16 , - src_w >>16 , src_h >>16 ); - -if (exynos_crtc->ops->win_commit) - exynos_crtc->ops->win_commit (exynos_crtc, exynos_plane->zpos); -} -static struct drm_plane_funcs exynos_plane_funcs = { .update_plane = drm_atomic_helper_update_plane, .disable_plane = drm_atomic_helper_disable_plane,
@@ -178,22 +135,51 @@ static struct drm_plane_funcs exynos_plane_funcs = {static int exynos_plane_atomic_check (struct drm_plane *plane,struct drm_plane_state *state) { -return exynos_check_plane (plane, state->fb); +struct exynos_drm_plane *exynos_plane =to_exynos_plane (plane); +int nr; +int i; + +if (!state->fb) +return 0 ; + + nr =exynos_drm_fb_get_buf_cnt (state->fb); +for (i =0 ; i < nr; i++) { +struct exynos_drm_gem_buf *buffer = +exynos_drm_fb_buffer (state->fb, i); + +if (!buffer) { +DRM_DEBUG_KMS ("buffer is null\n" ); +return -EFAULT ; + } + + exynos_plane->dma_addr[i] = buffer->dma_addr + + state->fb->offsets[i]; + +DRM_DEBUG_KMS ("buffer: %d, dma_addr = 0x%lx\n" , + i, (unsigned long )exynos_plane->dma_addr[i]); + } + +return 0 ; }static void exynos_plane_atomic_update (struct drm_plane *plane,struct drm_plane_state *old_state) {struct drm_plane_state *state = plane->state; +struct exynos_drm_crtc *exynos_crtc =to_exynos_crtc (state->crtc); +struct exynos_drm_plane *exynos_plane =to_exynos_plane (plane);if (!state->crtc)return ; -exynos_update_plane (plane, state->crtc, state->fb, - state->crtc_x, state->crtc_y, - state->crtc_w, state->crtc_h, - state->src_x, state->src_y, - state->src_w, state->src_h); +exynos_plane_mode_set (plane, state->crtc, state->fb, + state->crtc_x, state->crtc_y, + state->crtc_w, state->crtc_h, + 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); } static void exynos_plane_atomic_disable(struct drm_plane *plane,
drivers/gpu/drm/exynos/exynos_drm_plane.h +0 -11
@@ -9,17 +9,6 @@* */ -int exynos_check_plane (struct drm_plane *plane,struct drm_framebuffer *fb); -void exynos_plane_mode_set (struct drm_plane *plane,struct drm_crtc *crtc, -struct drm_framebuffer *fb,int crtc_x,int crtc_y, -unsigned int crtc_w,unsigned int crtc_h, -uint32_t src_x,uint32_t src_y, -uint32_t src_w,uint32_t src_h); -void exynos_update_plane (struct drm_plane *plane,struct drm_crtc *crtc, -struct drm_framebuffer *fb,int crtc_x,int crtc_y, -unsigned int crtc_w,unsigned int crtc_h, -uint32_t src_x,uint32_t src_y, -uint32_t src_w,uint32_t src_h); int exynos_plane_init(struct drm_device *dev, struct exynos_drm_plane *exynos_plane, unsigned long possible_crtcs, enum drm_plane_type type,
Signature · 1 line
2.1.0
PATCH v9 11/18 drm/exynos: don't disable unused functions at init
In reply to Gustavo PadovanFrom: Gustavo Padovan <[email protected]>
Everything starts disabled so we don't really need to disable anything.
--- drivers/gpu/drm/exynos/exynos_drm_fbdev.c | 3 --- 1 file changed, 3 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_fbdev.c +0 -3
@@ -275,9 +275,6 @@ int exynos_drm_fbdev_init(struct drm_device *dev) } -/* disable all the possible outputs/crtcs before entering KMS mode */ -drm_helper_disable_unused_functions (dev); - ret =drm_fb_helper_initial_config (helper,PREFERRED_BPP );if (ret <0 ) {DRM_ERROR ("failed to set up hw configuration.\n" );
Signature · 6 lines
2.1.0 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v9 12/18 drm/exynos: move exynos_drm_crtc_disable()
In reply to Gustavo PadovanFrom: Gustavo Padovan <[email protected]>
This is a preparation commit to move exynos_drm_crtc_disable() together with the future exynos_drm_crtc_enable() that will come from the split of exynos_drm_crtc_dpms() callback.
--- drivers/gpu/drm/exynos/exynos_drm_crtc.c | 36 ++++++++++++++++---------------- 1 file changed, 18 insertions(+), 18 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_crtc.c +18 -18
@@ -50,6 +50,23 @@ static void exynos_drm_crtc_dpms(struct drm_crtc *crtc, int mode)drm_crtc_vblank_on (crtc); } +static void exynos_drm_crtc_disable (struct drm_crtc *crtc) +{ +struct drm_plane *plane; +int ret; + +exynos_drm_crtc_dpms (crtc,DRM_MODE_DPMS_OFF ); + +drm_for_each_legacy_plane (plane, &crtc->dev->mode_config.plane_list) { +if (plane->crtc != crtc) +continue ; + + ret = plane->funcs->disable_plane (plane); +if (ret) +DRM_ERROR ("Failed to disable plane %d\n" , ret); + } +} +static void exynos_drm_crtc_commit (struct drm_crtc *crtc) {struct exynos_drm_crtc *exynos_crtc =to_exynos_crtc (crtc);
@@ -84,23 +101,6 @@ exynos_drm_crtc_mode_set_nofb(struct drm_crtc *crtc) exynos_crtc->ops->commit (exynos_crtc); } -static void exynos_drm_crtc_disable (struct drm_crtc *crtc) -{ -struct drm_plane *plane; -int ret; - -exynos_drm_crtc_dpms (crtc,DRM_MODE_DPMS_OFF ); - -drm_for_each_legacy_plane (plane, &crtc->dev->mode_config.plane_list) { -if (plane->crtc != crtc) -continue ; - - ret = plane->funcs->disable_plane (plane); -if (ret) -DRM_ERROR ("Failed to disable plane %d\n" , ret); - } -} -static void exynos_crtc_atomic_begin (struct drm_crtc *crtc) {struct exynos_drm_crtc *exynos_crtc =to_exynos_crtc (crtc);
@@ -117,10 +117,10 @@ static void exynos_crtc_atomic_flush(struct drm_crtc *crtc)static struct drm_crtc_helper_funcs exynos_crtc_helper_funcs = { .dpms = exynos_drm_crtc_dpms, + .disable = exynos_drm_crtc_disable, .commit = exynos_drm_crtc_commit, .mode_fixup = exynos_drm_crtc_mode_fixup, .mode_set_nofb = exynos_drm_crtc_mode_set_nofb, - .disable = exynos_drm_crtc_disable, .atomic_begin = exynos_crtc_atomic_begin, .atomic_flush = exynos_crtc_atomic_flush, };
Signature · 6 lines
2.1.0 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v9 13/18 drm/exynos: add exynos specific .atomic_commit()
In reply to Gustavo PadovanFrom: Gustavo Padovan <[email protected]>
exynos needs to update planes with the crtc enabled (mainly for the FIMD case) so this specific atomic commit changes the order of drm_atomic_helper_commit_modeset_enables() and drm_atomic_helper_commit_planes() to commit planes after we enable crtc and encoders.
--- drivers/gpu/drm/exynos/exynos_drm_fb.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-)
drivers/gpu/drm/exynos/exynos_drm_fb.c +26 -1
@@ -16,6 +16,7 @@#include <drm/drm_crtc.h> #include <drm/drm_crtc_helper.h> #include <drm/drm_fb_helper.h> +#include <drm/drm_atomic.h> #include <drm/drm_atomic_helper.h> #include <uapi/drm/exynos_drm.h>
@@ -270,7 +271,31 @@ static int exynos_atomic_commit(struct drm_device *dev,struct drm_atomic_state *state, bool async) { - return drm_atomic_helper_commit(dev, state, false); + 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); + +drm_atomic_helper_commit_modeset_disables (dev, state); + +drm_atomic_helper_commit_modeset_enables (dev, state); + +drm_atomic_helper_commit_planes (dev, state); + +drm_atomic_helper_wait_for_vblanks (dev, state); + +drm_atomic_helper_cleanup_planes (dev, state); + +drm_atomic_state_free (state); + +return 0 ; } static const struct drm_mode_config_funcs exynos_drm_mode_config_funcs = {
Signature · 1 line
2.1.0
Re: [PATCH v9 13/18] drm/exynos: add exynos specific .atomic_commit()
Quoted 29 lines · Gustavo Padovan
From: Gustavo Padovan <[email protected]>
exynos needs to update planes with the crtc enabled (mainly for the FIMD case) so this specific atomic commit changes the order of
drm_atomic_helper_commit_modeset_enables()anddrm_atomic_helper_commit_planes()to commit planes after we enable crtc and encoders.Signed-off-by Gustavo Padovan <[email protected]>--- drivers/gpu/drm/exynos/exynos_drm_fb.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-)drivers/gpu/drm/exynos/exynos_drm_fb.c +1
-0@@ -16,6 +16,7 @@#include <drm/drm_crtc.h> #include <drm/drm_crtc_helper.h> #include <drm/drm_fb_helper.h> +#include <drm/drm_atomic.h> #include <drm/drm_atomic_helper.h> #include <uapi/drm/exynos_drm.h> @@ -270,7 +271,31 @@ static int exynos_atomic_commit(struct drm_device *dev,struct drm_atomic_state *state, bool async) {
drivers/gpu/drm/exynos/exynos_drm_fb.c static int exynos_atomic_commit(struct drm_device *dev, · line 282
Quoted 10 lines
drivers/gpu/drm/exynos/exynos_drm_fb.c +9
-1-return drm_atomic_helper_commit (dev, state, false); +int ret; + + ret =drm_atomic_helper_prepare_planes (dev, state); +if (ret) +return ret; + +/* +* This is the point of no return +*/
Just oneline comment is enough.
drivers/gpu/drm/exynos/exynos_drm_fb.c static int exynos_atomic_commit(struct drm_device *dev, · line 288
Quoted 6 lines
drivers/gpu/drm/exynos/exynos_drm_fb.c +6
-0+ +drm_atomic_helper_swap_state (dev, state); + +drm_atomic_helper_commit_modeset_disables (dev, state); + +drm_atomic_helper_commit_modeset_enables (dev, state);
Maybe need description as comments about why need to change operation order.
Quoted 14 lines
drivers/gpu/drm/exynos/exynos_drm_fb.c +10
-0+ +drm_atomic_helper_commit_planes (dev, state); + +drm_atomic_helper_wait_for_vblanks (dev, state); + +drm_atomic_helper_cleanup_planes (dev, state); + +drm_atomic_state_free (state); + +return 0 ; }static const struct drm_mode_config_funcs exynos_drm_mode_config_funcs = {
PATCH v9 14/18 drm/exynos: atomic dpms support
In reply to Gustavo PadovanFrom: Gustavo Padovan <[email protected]>
Run dpms operations through the atomic intefaces. This basically removes the .dpms() callback from econders and crtcs and use .disable() and .enable() to turn the crtc on and off.
v2: Address comments by Joonyoung:
- make hdmi code call ->disable() instead of ->dpms()
- do not use WARN_ON on crtc enable/disable
v3: - Fix build failure after the hdmi change in v2
- Change dpms helper of ptn3460 bridge
v4: - remove win_commit() call from .enable()
v5: - move .atomic_check() to the atomic PageFlip patch, and transform it in .atomic_begin()
--- drivers/gpu/drm/bridge/ps8622.c | 2 +- drivers/gpu/drm/bridge/ptn3460.c | 2 +- drivers/gpu/drm/exynos/exynos_dp_core.c | 2 +- drivers/gpu/drm/exynos/exynos_drm_crtc.c | 58 ++++++++++++----------------- drivers/gpu/drm/exynos/exynos_drm_dpi.c | 2 +- drivers/gpu/drm/exynos/exynos_drm_drv.h | 4 +- drivers/gpu/drm/exynos/exynos_drm_dsi.c | 2 +- drivers/gpu/drm/exynos/exynos_drm_encoder.c | 21 +++-------- drivers/gpu/drm/exynos/exynos_drm_vidi.c | 2 +- drivers/gpu/drm/exynos/exynos_hdmi.c | 6 +-- 10 files changed, 40 insertions(+), 61 deletions(-)
drivers/gpu/drm/bridge/ps8622.c +1 -1
@@ -499,7 +499,7 @@ static void ps8622_connector_destroy(struct drm_connector *connector) }static const struct drm_connector_funcs ps8622_connector_funcs = { - .dpms = drm_helper_connector_dpms, + .dpms = drm_atomic_helper_connector_dpms, .fill_modes = drm_helper_probe_single_connector_modes, .detect = ps8622_detect, .destroy = ps8622_connector_destroy,
drivers/gpu/drm/bridge/ptn3460.c +1 -1
@@ -260,7 +260,7 @@ static void ptn3460_connector_destroy(struct drm_connector *connector) }static struct drm_connector_funcs ptn3460_connector_funcs = { - .dpms = drm_helper_connector_dpms, + .dpms = drm_atomic_helper_connector_dpms, .fill_modes = drm_helper_probe_single_connector_modes, .detect = ptn3460_detect, .destroy = ptn3460_connector_destroy,
drivers/gpu/drm/exynos/exynos_dp_core.c +1 -1
@@ -954,7 +954,7 @@ static void exynos_dp_connector_destroy(struct drm_connector *connector) }static struct drm_connector_funcs exynos_dp_connector_funcs = { - .dpms = drm_helper_connector_dpms, + .dpms = drm_atomic_helper_connector_dpms, .fill_modes = drm_helper_probe_single_connector_modes, .detect = exynos_dp_detect, .destroy = exynos_dp_connector_destroy,
drivers/gpu/drm/exynos/exynos_drm_crtc.c +23 -35
110 lines not on this page · raw message
drivers/gpu/drm/exynos/exynos_drm_dpi.c +1 -1
@@ -60,7 +60,7 @@ static void exynos_dpi_connector_destroy(struct drm_connector *connector) }static struct drm_connector_funcs exynos_dpi_connector_funcs = { - .dpms = drm_helper_connector_dpms, + .dpms = drm_atomic_helper_connector_dpms, .detect = exynos_dpi_detect, .fill_modes = drm_helper_probe_single_connector_modes, .destroy = exynos_dpi_connector_destroy,
drivers/gpu/drm/exynos/exynos_drm_drv.h +2 -2
@@ -201,7 +201,7 @@ struct exynos_drm_crtc_ops {* drm framework doesn't support multiple irq yet. * we can refer to the crtc to current hardware interrupt occurred through * this pipe value. -* @dpms: store the crtc dpms value +* @enabled: if the crtc is enabled or not * @event: vblank event that is currently queued for flip * @ops: pointer to callbacks for exynos drm specific functionality * @ctx: A pointer to the crtc's implementation specific context
@@ -210,7 +210,7 @@ struct exynos_drm_crtc {struct drm_crtc base;enum exynos_drm_output_type type;unsigned int pipe; -unsigned int dpms; +bool enabled;wait_queue_head_t pending_flip_queue;struct drm_pending_vblank_event *event;const struct exynos_drm_crtc_ops *ops;
drivers/gpu/drm/exynos/exynos_drm_dsi.c +1 -1
@@ -1458,7 +1458,7 @@ static void exynos_dsi_connector_destroy(struct drm_connector *connector) }static struct drm_connector_funcs exynos_dsi_connector_funcs = { - .dpms = drm_helper_connector_dpms, + .dpms = drm_atomic_helper_connector_dpms, .detect = exynos_dsi_detect, .fill_modes = drm_helper_probe_single_connector_modes, .destroy = exynos_dsi_connector_destroy,
drivers/gpu/drm/exynos/exynos_drm_encoder.c +6 -15
@@ -32,17 +32,6 @@ struct exynos_drm_encoder {struct exynos_drm_display *display; }; -static void exynos_drm_encoder_dpms (struct drm_encoder *encoder,int mode) -{ -struct exynos_drm_encoder *exynos_encoder =to_exynos_encoder (encoder); -struct exynos_drm_display *display = exynos_encoder->display; - -DRM_DEBUG_KMS ("encoder dpms: %d\n" , mode); - -if (display->ops->dpms) - display->ops->dpms (display, mode); -} - static bool exynos_drm_encoder_mode_fixup(struct drm_encoder *encoder, const struct drm_display_mode *mode,
@@ -76,7 +65,7 @@ static void exynos_drm_encoder_mode_set(struct drm_encoder *encoder, display->ops->mode_set (display, adjusted_mode); } -static void exynos_drm_encoder_commit (struct drm_encoder *encoder) +static void exynos_drm_encoder_enable (struct drm_encoder *encoder) {struct exynos_drm_encoder *exynos_encoder =to_exynos_encoder (encoder);struct exynos_drm_display *display = exynos_encoder->display;
@@ -90,10 +79,13 @@ static void exynos_drm_encoder_commit(struct drm_encoder *encoder)static void exynos_drm_encoder_disable (struct drm_encoder *encoder) { +struct exynos_drm_encoder *exynos_encoder =to_exynos_encoder (encoder); +struct exynos_drm_display *display = exynos_encoder->display;struct drm_plane *plane;struct drm_device *dev = encoder->dev; -exynos_drm_encoder_dpms (encoder,DRM_MODE_DPMS_OFF ); +if (display->ops->dpms) + display->ops->dpms (display,DRM_MODE_DPMS_OFF );/* all planes connected to this encoder should be also disabled. */ drm_for_each_legacy_plane (plane, &dev->mode_config.plane_list) {
@@ -103,10 +95,9 @@ static void exynos_drm_encoder_disable(struct drm_encoder *encoder) }static struct drm_encoder_helper_funcs exynos_encoder_helper_funcs = { - .dpms = exynos_drm_encoder_dpms, .mode_fixup = exynos_drm_encoder_mode_fixup, .mode_set = exynos_drm_encoder_mode_set, - .commit = exynos_drm_encoder_commit, + .enable = exynos_drm_encoder_enable, .disable = exynos_drm_encoder_disable, };
drivers/gpu/drm/exynos/exynos_drm_vidi.c +1 -1
@@ -385,7 +385,7 @@ static void vidi_connector_destroy(struct drm_connector *connector) }static struct drm_connector_funcs vidi_connector_funcs = { - .dpms = drm_helper_connector_dpms, + .dpms = drm_atomic_helper_connector_dpms, .fill_modes = drm_helper_probe_single_connector_modes, .detect = vidi_detect, .destroy = vidi_connector_destroy,
drivers/gpu/drm/exynos/exynos_hdmi.c +3 -3
@@ -1051,7 +1051,7 @@ static void hdmi_connector_destroy(struct drm_connector *connector) }static struct drm_connector_funcs hdmi_connector_funcs = { - .dpms = drm_helper_connector_dpms, + .dpms = drm_atomic_helper_connector_dpms, .fill_modes = drm_helper_probe_single_connector_modes, .detect = hdmi_detect, .destroy = hdmi_connector_destroy,
@@ -2127,8 +2127,8 @@ static void hdmi_dpms(struct exynos_drm_display *display, int mode)*/ if (crtc) funcs = crtc->helper_private; -if (funcs && funcs->dpms) - (*funcs->dpms)(crtc, mode); +if (funcs && funcs->disable) + (*funcs->disable)(crtc);hdmi_poweroff (hdata);break ;
Signature · 1 line
2.1.0
PATCH v9 15/18 drm/exynos: remove unnecessary calls to disable_plane()
In reply to Gustavo PadovanFrom: Gustavo Padovan <[email protected]>
The planes are already disabled by the drm_atomic_helper_commit() code so we don't need to disable the in these two places.
--- drivers/gpu/drm/exynos/exynos_drm_crtc.c | 11 ----------- drivers/gpu/drm/exynos/exynos_drm_encoder.c | 8 -------- 2 files changed, 19 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_crtc.c +0 -11
@@ -40,8 +40,6 @@ static void exynos_drm_crtc_enable(struct drm_crtc *crtc)static void exynos_drm_crtc_disable (struct drm_crtc *crtc) {struct exynos_drm_crtc *exynos_crtc =to_exynos_crtc (crtc); -struct drm_plane *plane; -int ret;if (!exynos_crtc->enabled)return ;
@@ -57,15 +55,6 @@ static void exynos_drm_crtc_disable(struct drm_crtc *crtc) exynos_crtc->ops->dpms (exynos_crtc,DRM_MODE_DPMS_OFF ); exynos_crtc->enabled = false; - -drm_for_each_legacy_plane (plane, &crtc->dev->mode_config.plane_list) { -if (plane->crtc != crtc) -continue ; - - ret = plane->funcs->disable_plane (plane); -if (ret) -DRM_ERROR ("Failed to disable plane %d\n" , ret); - } } static bool
drivers/gpu/drm/exynos/exynos_drm_encoder.c +0 -8
@@ -81,17 +81,9 @@ static void exynos_drm_encoder_disable(struct drm_encoder *encoder) {struct exynos_drm_encoder *exynos_encoder =to_exynos_encoder (encoder);struct exynos_drm_display *display = exynos_encoder->display; -struct drm_plane *plane; -struct drm_device *dev = encoder->dev;if (display->ops->dpms) display->ops->dpms (display,DRM_MODE_DPMS_OFF ); - -/* all planes connected to this encoder should be also disabled. */ -drm_for_each_legacy_plane (plane, &dev->mode_config.plane_list) { -if (plane->crtc && (plane->crtc == encoder->crtc)) - plane->funcs->disable_plane (plane); - } }static struct drm_encoder_helper_funcs exynos_encoder_helper_funcs = {
Signature · 1 line
2.1.0
PATCH v9 16/18 drm/exynos: split exynos_crtc->dpms in enable() and disable()
In reply to Gustavo PadovanFrom: Gustavo Padovan <[email protected]>
To follow more closely the new atomic API we split the dpms() helper into the enable() and disable() helper to get exactly the same semantics.
--- drivers/gpu/drm/exynos/exynos7_drm_decon.c | 31 +++++------------ drivers/gpu/drm/exynos/exynos_drm_crtc.c | 8 ++--- drivers/gpu/drm/exynos/exynos_drm_drv.h | 6 ++-- drivers/gpu/drm/exynos/exynos_drm_fimd.c | 31 +++++------------ drivers/gpu/drm/exynos/exynos_drm_vidi.c | 55 ++++++++++++------------------ drivers/gpu/drm/exynos/exynos_mixer.c | 32 ++++++----------- 6 files changed, 56 insertions(+), 107 deletions(-)
drivers/gpu/drm/exynos/exynos7_drm_decon.c +8 -23
@@ -603,8 +603,9 @@ static void decon_init(struct decon_context *ctx)writel (VIDCON1_VCLK_HOLD , ctx->regs +VIDCON1 (0 )); } -static int decon_poweron (struct decon_context *ctx) +static int decon_enable (struct exynos_drm_crtc *crtc) { +struct decon_context *ctx = crtc->ctx;int ret;if (!ctx->suspended)
@@ -668,8 +669,10 @@ pclk_err:return ret; } -static int decon_poweroff (struct decon_context *ctx) +static int decon_disable (struct exynos_drm_crtc *crtc) { +struct decon_context *ctx = crtc->ctx; +if (ctx->suspended)return 0 ;
@@ -691,27 +694,9 @@ static int decon_poweroff(struct decon_context *ctx)return 0 ; } -static void decon_dpms (struct exynos_drm_crtc *crtc,int mode) -{ -DRM_DEBUG_KMS ("%s, %d\n" , __FILE__, mode); - -switch (mode) { -case DRM_MODE_DPMS_ON : -decon_poweron (crtc->ctx); -break ; -case DRM_MODE_DPMS_STANDBY : -case DRM_MODE_DPMS_SUSPEND : -case DRM_MODE_DPMS_OFF : -decon_poweroff (crtc->ctx); -break ; -default : -DRM_DEBUG_KMS ("unspecified mode %d\n" , mode); -break ; - } -} -static const struct exynos_drm_crtc_ops decon_crtc_ops = { - .dpms = decon_dpms, + .enable = decon_enable, + .disable = decon_disable, .mode_fixup = decon_mode_fixup, .commit = decon_commit, .enable_vblank = decon_enable_vblank,
@@ -796,7 +781,7 @@ static void decon_unbind(struct device *dev, struct device *master, {struct decon_context *ctx =dev_get_drvdata (dev); -decon_dpms (ctx->crtc,DRM_MODE_DPMS_OFF ); +decon_disable (ctx->crtc);if (ctx->display)exynos_dpi_remove (ctx->display);
drivers/gpu/drm/exynos/exynos_drm_crtc.c +4 -4
@@ -29,8 +29,8 @@ static void exynos_drm_crtc_enable(struct drm_crtc *crtc)if (exynos_crtc->enabled)return ; -if (exynos_crtc->ops->dpms) - exynos_crtc->ops->dpms (exynos_crtc,DRM_MODE_DPMS_ON ); +if (exynos_crtc->ops->enable) + exynos_crtc->ops->enable (exynos_crtc); exynos_crtc->enabled = true;
@@ -51,8 +51,8 @@ static void exynos_drm_crtc_disable(struct drm_crtc *crtc)drm_crtc_vblank_off (crtc); -if (exynos_crtc->ops->dpms) - exynos_crtc->ops->dpms (exynos_crtc,DRM_MODE_DPMS_OFF ); +if (exynos_crtc->ops->disable) + exynos_crtc->ops->disable (exynos_crtc); exynos_crtc->enabled = false; }
drivers/gpu/drm/exynos/exynos_drm_drv.h +4 -2
@@ -157,7 +157,8 @@ struct exynos_drm_display {/* * Exynos drm crtc ops * -* @dpms: control device power. +* @enable: enable the device +* @disable: disable the device * @mode_fixup: fix mode data before applying it * @commit: set current hw specific display mode to hw. * @enable_vblank: specific driver callback for enabling vblank interrupt.
@@ -175,7 +176,8 @@ struct exynos_drm_display {*/ struct exynos_drm_crtc ;struct exynos_drm_crtc_ops { -void (*dpms)(struct exynos_drm_crtc *crtc,int mode); +int (*enable)(struct exynos_drm_crtc *crtc); +int (*disable)(struct exynos_drm_crtc *crtc);bool (*mode_fixup)(struct exynos_drm_crtc *crtc,const struct drm_display_mode *mode,struct drm_display_mode *adjusted_mode);
drivers/gpu/drm/exynos/exynos_drm_fimd.c +8 -23
@@ -805,8 +805,9 @@ static void fimd_apply(struct fimd_context *ctx)fimd_commit (ctx->crtc); } -static int fimd_poweron (struct fimd_context *ctx) +static int fimd_enable (struct exynos_drm_crtc *crtc) { +struct fimd_context *ctx = crtc->ctx;int ret;if (!ctx->suspended)
@@ -852,8 +853,10 @@ bus_clk_err:return ret; } -static int fimd_poweroff (struct fimd_context *ctx) +static int fimd_disable (struct exynos_drm_crtc *crtc) { +struct fimd_context *ctx = crtc->ctx; +if (ctx->suspended)return 0 ;
@@ -873,25 +876,6 @@ static int fimd_poweroff(struct fimd_context *ctx)return 0 ; } -static void fimd_dpms (struct exynos_drm_crtc *crtc,int mode) -{ -DRM_DEBUG_KMS ("%s, %d\n" , __FILE__, mode); - -switch (mode) { -case DRM_MODE_DPMS_ON : -fimd_poweron (crtc->ctx); -break ; -case DRM_MODE_DPMS_STANDBY : -case DRM_MODE_DPMS_SUSPEND : -case DRM_MODE_DPMS_OFF : -fimd_poweroff (crtc->ctx); -break ; -default : -DRM_DEBUG_KMS ("unspecified mode %d\n" , mode); -break ; - } -} -static void fimd_trigger (struct device *dev) {struct fimd_context *ctx =dev_get_drvdata (dev);
@@ -964,7 +948,8 @@ static void fimd_dp_clock_enable(struct exynos_drm_crtc *crtc, bool enable) }static const struct exynos_drm_crtc_ops fimd_crtc_ops = { - .dpms = fimd_dpms, + .enable = fimd_enable, + .disable = fimd_disable, .mode_fixup = fimd_mode_fixup, .commit = fimd_commit, .enable_vblank = fimd_enable_vblank,
@@ -1051,7 +1036,7 @@ static void fimd_unbind(struct device *dev, struct device *master, {struct fimd_context *ctx =dev_get_drvdata (dev); -fimd_dpms (ctx->crtc,DRM_MODE_DPMS_OFF ); +fimd_disable (ctx->crtc);fimd_iommu_detach_devices (ctx);
drivers/gpu/drm/exynos/exynos_drm_vidi.c +21 -34
86 lines not on this page · raw message
drivers/gpu/drm/exynos/exynos_mixer.c +11 -21
@@ -1027,14 +1027,15 @@ static void mixer_window_resume(struct mixer_context *ctx) } } -static void mixer_poweron (struct mixer_context *ctx) +static int mixer_enable (struct exynos_drm_crtc *crtc) { +struct mixer_context *ctx = crtc->ctx;struct mixer_resources *res = &ctx->mixer_res;mutex_lock (&ctx->mixer_mutex);if (ctx->powered) {mutex_unlock (&ctx->mixer_mutex); -return ; +return 0 ; }mutex_unlock (&ctx->mixer_mutex);
@@ -1059,16 +1060,19 @@ static void mixer_poweron(struct mixer_context *ctx)mixer_win_reset (ctx);mixer_window_resume (ctx); + +return 0 ; } -static void mixer_poweroff (struct mixer_context *ctx) +static int mixer_disable (struct exynos_drm_crtc *crtc) { +struct mixer_context *ctx = crtc->ctx;struct mixer_resources *res = &ctx->mixer_res;mutex_lock (&ctx->mixer_mutex);if (!ctx->powered) {mutex_unlock (&ctx->mixer_mutex); -return ; +return 0 ; }mutex_unlock (&ctx->mixer_mutex);
@@ -1091,23 +1095,8 @@ static void mixer_poweroff(struct mixer_context *ctx) }pm_runtime_put_sync (ctx->dev); -} -static void mixer_dpms (struct exynos_drm_crtc *crtc,int mode) -{ -switch (mode) { -case DRM_MODE_DPMS_ON : -mixer_poweron (crtc->ctx); -break ; -case DRM_MODE_DPMS_STANDBY : -case DRM_MODE_DPMS_SUSPEND : -case DRM_MODE_DPMS_OFF : -mixer_poweroff (crtc->ctx); -break ; -default : -DRM_DEBUG_KMS ("unknown dpms mode: %d\n" , mode); -break ; - } +return 0 ; }/* Only valid for Mixer version 16.0.33.0 */
@@ -1131,7 +1120,8 @@ int mixer_check_mode(struct drm_display_mode *mode) }static const struct exynos_drm_crtc_ops mixer_crtc_ops = { - .dpms = mixer_dpms, + .enable = mixer_enable, + .disable = mixer_disable, .enable_vblank = mixer_enable_vblank, .disable_vblank = mixer_disable_vblank, .wait_for_vblank = mixer_wait_for_vblank,
Signature · 6 lines
2.1.0 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v9 16/18] drm/exynos: split exynos_crtc->dpms in enable() and disable()
Quoted 123 lines · Gustavo Padovan
From: Gustavo Padovan <[email protected]>
To follow more closely the new atomic API we split the
dpms()helper into theenable()anddisable()helper to get exactly the same semantics.Signed-off-by Gustavo Padovan <[email protected]>--- drivers/gpu/drm/exynos/exynos7_drm_decon.c | 31 +++++------------ drivers/gpu/drm/exynos/exynos_drm_crtc.c | 8 ++--- drivers/gpu/drm/exynos/exynos_drm_drv.h | 6 ++-- drivers/gpu/drm/exynos/exynos_drm_fimd.c | 31 +++++------------ drivers/gpu/drm/exynos/exynos_drm_vidi.c | 55 ++++++++++++------------------ drivers/gpu/drm/exynos/exynos_mixer.c | 32 ++++++----------- 6 files changed, 56 insertions(+), 107 deletions(-)drivers/gpu/drm/exynos/exynos7_drm_decon.c +8
-23@@ -603,8 +603,9 @@ static void decon_init(struct decon_context *ctx)writel (VIDCON1_VCLK_HOLD , ctx->regs +VIDCON1 (0 )); } -static int decon_poweron (struct decon_context *ctx) +static int decon_enable (struct exynos_drm_crtc *crtc) { +struct decon_context *ctx = crtc->ctx;int ret;if (!ctx->suspended)@@ -668,8 +669,10 @@ pclk_err:return ret; } -static int decon_poweroff (struct decon_context *ctx) +static int decon_disable (struct exynos_drm_crtc *crtc) { +struct decon_context *ctx = crtc->ctx; +if (ctx->suspended)return 0 ;@@ -691,27 +694,9 @@ static int decon_poweroff(struct decon_context *ctx)return 0 ; } -static void decon_dpms (struct exynos_drm_crtc *crtc,int mode) -{ -DRM_DEBUG_KMS ("%s, %d\n" , __FILE__, mode); - -switch (mode) { -case DRM_MODE_DPMS_ON : -decon_poweron (crtc->ctx); -break ; -case DRM_MODE_DPMS_STANDBY : -case DRM_MODE_DPMS_SUSPEND : -case DRM_MODE_DPMS_OFF : -decon_poweroff (crtc->ctx); -break ; -default : -DRM_DEBUG_KMS ("unspecified mode %d\n" , mode); -break ; - } -} -static const struct exynos_drm_crtc_ops decon_crtc_ops = { - .dpms = decon_dpms, + .enable = decon_enable, + .disable = decon_disable, .mode_fixup = decon_mode_fixup, .commit = decon_commit, .enable_vblank = decon_enable_vblank,@@ -796,7 +781,7 @@ static void decon_unbind(struct device *dev, struct device *master, {struct decon_context *ctx =dev_get_drvdata (dev); -decon_dpms (ctx->crtc,DRM_MODE_DPMS_OFF ); +decon_disable (ctx->crtc);if (ctx->display)exynos_dpi_remove (ctx->display);drivers/gpu/drm/exynos/exynos_drm_crtc.c +4
-4@@ -29,8 +29,8 @@ static void exynos_drm_crtc_enable(struct drm_crtc *crtc)if (exynos_crtc->enabled)return ; -if (exynos_crtc->ops->dpms) - exynos_crtc->ops->dpms (exynos_crtc,DRM_MODE_DPMS_ON ); +if (exynos_crtc->ops->enable) + exynos_crtc->ops->enable (exynos_crtc); exynos_crtc->enabled = true;@@ -51,8 +51,8 @@ static void exynos_drm_crtc_disable(struct drm_crtc *crtc)drm_crtc_vblank_off (crtc); -if (exynos_crtc->ops->dpms) - exynos_crtc->ops->dpms (exynos_crtc,DRM_MODE_DPMS_OFF ); +if (exynos_crtc->ops->disable) + exynos_crtc->ops->disable (exynos_crtc); exynos_crtc->enabled = false; }drivers/gpu/drm/exynos/exynos_drm_drv.h +2
-1@@ -157,7 +157,8 @@ struct exynos_drm_display {/* * Exynos drm crtc ops * -* @dpms: control device power. +* @enable: enable the device +* @disable: disable the device * @mode_fixup: fix mode data before applying it * @commit: set current hw specific display mode to hw. * @enable_vblank: specific driver callback for enabling vblank interrupt.
drivers/gpu/drm/exynos/exynos_drm_drv.h struct exynos_drm_display { · line 180
Quoted 6 lines
drivers/gpu/drm/exynos/exynos_drm_drv.h +2
-1@@ -175,7 +176,8 @@ struct exynos_drm_display {*/ struct exynos_drm_crtc ;struct exynos_drm_crtc_ops { -void (*dpms)(struct exynos_drm_crtc *crtc,int mode); +int (*enable)(struct exynos_drm_crtc *crtc); +int (*disable)(struct exynos_drm_crtc *crtc);
Need return value for .enable and .disable? It's better to use void because there is no any care about the result. It's possible to not return .enable functions of fimd and decon driver.
Anyway, more patches including 17/18 can be difficult to merge atomic patchset. IMHO i think cleanup patches like this would be posted after atomic patches merged.
PATCH v9 17/18 drm/exynos: rename win_commit/disable to atomic-like names
In reply to Gustavo PadovanFrom: Gustavo Padovan <[email protected]>
Rename win_commit() helper to update_plane() and win_disable() to disable_plane().
--- 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(-)
drivers/gpu/drm/exynos/exynos7_drm_decon.c +7 -7
@@ -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.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);
@@ -702,8 +702,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, };
drivers/gpu/drm/exynos/exynos_drm_drv.h +2 -2
@@ -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); };
drivers/gpu/drm/exynos/exynos_drm_fimd.c +7 -7
@@ -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);
@@ -955,8 +955,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, };
drivers/gpu/drm/exynos/exynos_drm_plane.c +5 -5
@@ -178,8 +178,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,
@@ -191,9 +191,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 = {
drivers/gpu/drm/exynos/exynos_drm_vidi.c +6 -6
@@ -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 int 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);
@@ -209,8 +209,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)
drivers/gpu/drm/exynos/exynos_mixer.c +6 -6
@@ -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); } }
@@ -1125,8 +1125,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 = {
Signature · 6 lines
2.1.0 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v9 18/18 drm/exynos: don't disable planes already disabled
In reply to Gustavo PadovanFrom: Gustavo Padovan <[email protected]>
on resume (or enable()) do not call disable_plane() on planes that are already disabled.
--- drivers/gpu/drm/exynos/exynos_drm_fimd.c | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_fimd.c +1 -14
@@ -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 int fimd_enable (struct exynos_drm_crtc *crtc)
@@ -840,7 +827,7 @@ static int fimd_enable(struct exynos_drm_crtc *crtc)fimd_window_resume (ctx); -fimd_apply (ctx); +fimd_commit (ctx->crtc);return 0 ;
Signature · 1 line
2.1.0