* [PATCH 1/2] drm_atomic_helper.c: cosmetic: fix some typos and add some empty line
@ 2015-03-15 12:59 John Hunter
2015-03-15 12:59 ` [PATCH 2/2] drm_atomic_helper.c: connector => tmp_connector John Hunter
2015-03-16 8:17 ` [PATCH 1/2] drm_atomic_helper.c: cosmetic: fix some typos and add some empty line Daniel Vetter
0 siblings, 2 replies; 6+ messages in thread
From: John Hunter @ 2015-03-15 12:59 UTC (permalink / raw)
To: dri-devel
there are some duplication in the annotations
add some empty line to make it easier to read
---
drivers/gpu/drm/drm_atomic_helper.c | 48 +++++++++++++++++++++++++++++--------
1 file changed, 38 insertions(+), 10 deletions(-)
diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
index a745881..bc17019 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -346,7 +346,7 @@ needs_modeset(struct drm_crtc_state *state)
}
/**
- * drm_atomic_helper_check - validate state object for modeset changes
+ * drm_atomic_helper_check_modeset - validate state object for modeset changes
* @dev: DRM device
* @state: the driver state object
*
@@ -461,7 +461,7 @@ drm_atomic_helper_check_modeset(struct drm_device *dev,
EXPORT_SYMBOL(drm_atomic_helper_check_modeset);
/**
- * drm_atomic_helper_check - validate state object for modeset changes
+ * drm_atomic_helper_check_planes - validate state object for planes changes
* @dev: DRM device
* @state: the driver state object
*
@@ -605,7 +605,7 @@ disable_outputs(struct drm_device *dev, struct drm_atomic_state *old_state)
/*
* Each encoder has at most one connector (since we always steal
- * it away), so we won't call call disable hooks twice.
+ * it away), so we won't call disable hooks twice.
*/
if (encoder->bridge)
encoder->bridge->funcs->disable(encoder->bridge);
@@ -757,7 +757,7 @@ crtc_set_mode(struct drm_device *dev, struct drm_atomic_state *old_state)
/*
* Each encoder has at most one connector (since we always steal
- * it away), so we won't call call mode_set hooks twice.
+ * it away), so we won't call mode_set hooks twice.
*/
if (funcs->mode_set)
funcs->mode_set(encoder, mode, adjusted_mode);
@@ -858,7 +858,7 @@ void drm_atomic_helper_commit_modeset_enables(struct drm_device *dev,
/*
* Each encoder has at most one connector (since we always steal
- * it away), so we won't call call enable hooks twice.
+ * it away), so we won't call enable hooks twice.
*/
if (encoder->bridge)
encoder->bridge->funcs->pre_enable(encoder->bridge);
@@ -1025,7 +1025,7 @@ int drm_atomic_helper_commit(struct drm_device *dev,
/*
* Everything below can be run asynchronously without the need to grab
- * any modeset locks at all under one conditions: It must be guaranteed
+ * any modeset locks at all under one condition: It must be guaranteed
* that the asynchronous work has either been cancelled (if the driver
* supports it, which at least requires that the framebuffers get
* cleaned up with drm_atomic_helper_cleanup_planes()) or completed
@@ -1151,7 +1151,6 @@ fail:
if (fb && funcs->cleanup_fb)
funcs->cleanup_fb(plane, fb, plane_state);
-
}
return ret;
@@ -1301,8 +1300,11 @@ void drm_atomic_helper_swap_state(struct drm_device *dev,
struct drm_atomic_state *state)
{
int i;
+ int nconnectors = dev->mode_config.num_connector;
+ int ncrtcs = dev->mode_config.num_crtc;
+ int nplanes = dev->mode_config.num_total_plane;
- for (i = 0; i < dev->mode_config.num_connector; i++) {
+ for (i = 0; i < nconnectors; i++) {
struct drm_connector *connector = state->connectors[i];
if (!connector)
@@ -1313,7 +1315,7 @@ void drm_atomic_helper_swap_state(struct drm_device *dev,
connector->state->state = NULL;
}
- for (i = 0; i < dev->mode_config.num_crtc; i++) {
+ for (i = 0; i < ncrtcs; i++) {
struct drm_crtc *crtc = state->crtcs[i];
if (!crtc)
@@ -1324,7 +1326,7 @@ void drm_atomic_helper_swap_state(struct drm_device *dev,
crtc->state->state = NULL;
}
- for (i = 0; i < dev->mode_config.num_total_plane; i++) {
+ for (i = 0; i < nplanes; i++) {
struct drm_plane *plane = state->planes[i];
if (!plane)
@@ -1373,6 +1375,7 @@ int drm_atomic_helper_update_plane(struct drm_plane *plane,
return -ENOMEM;
state->acquire_ctx = drm_modeset_legacy_acquire_ctx(crtc);
+
retry:
plane_state = drm_atomic_get_plane_state(state, plane);
if (IS_ERR(plane_state)) {
@@ -1402,6 +1405,7 @@ retry:
/* Driver takes ownership of state on successful commit. */
return 0;
+
fail:
if (ret == -EDEADLK)
goto backoff;
@@ -1409,6 +1413,7 @@ fail:
drm_atomic_state_free(state);
return ret;
+
backoff:
drm_atomic_state_clear(state);
drm_atomic_legacy_backoff(state);
@@ -1455,6 +1460,7 @@ int drm_atomic_helper_disable_plane(struct drm_plane *plane)
return -ENOMEM;
state->acquire_ctx = drm_modeset_legacy_acquire_ctx(plane->crtc);
+
retry:
plane_state = drm_atomic_get_plane_state(state, plane);
if (IS_ERR(plane_state)) {
@@ -1465,6 +1471,7 @@ retry:
ret = drm_atomic_set_crtc_for_plane(plane_state, NULL);
if (ret != 0)
goto fail;
+
drm_atomic_set_fb_for_plane(plane_state, NULL);
plane_state->crtc_x = 0;
plane_state->crtc_y = 0;
@@ -1484,6 +1491,7 @@ retry:
/* Driver takes ownership of state on successful commit. */
return 0;
+
fail:
if (ret == -EDEADLK)
goto backoff;
@@ -1491,6 +1499,7 @@ fail:
drm_atomic_state_free(state);
return ret;
+
backoff:
drm_atomic_state_clear(state);
drm_atomic_legacy_backoff(state);
@@ -1609,6 +1618,7 @@ int drm_atomic_helper_set_config(struct drm_mode_set *set)
return -ENOMEM;
state->acquire_ctx = drm_modeset_legacy_acquire_ctx(crtc);
+
retry:
crtc_state = drm_atomic_get_crtc_state(state, crtc);
if (IS_ERR(crtc_state)) {
@@ -1648,6 +1658,7 @@ retry:
ret = drm_atomic_set_crtc_for_plane(primary_state, crtc);
if (ret != 0)
goto fail;
+
drm_atomic_set_fb_for_plane(primary_state, set->fb);
primary_state->crtc_x = 0;
primary_state->crtc_y = 0;
@@ -1669,6 +1680,7 @@ commit:
/* Driver takes ownership of state on successful commit. */
return 0;
+
fail:
if (ret == -EDEADLK)
goto backoff;
@@ -1676,6 +1688,7 @@ fail:
drm_atomic_state_free(state);
return ret;
+
backoff:
drm_atomic_state_clear(state);
drm_atomic_legacy_backoff(state);
@@ -1718,6 +1731,7 @@ drm_atomic_helper_crtc_set_property(struct drm_crtc *crtc,
/* ->set_property is always called with all locks held. */
state->acquire_ctx = crtc->dev->mode_config.acquire_ctx;
+
retry:
crtc_state = drm_atomic_get_crtc_state(state, crtc);
if (IS_ERR(crtc_state)) {
@@ -1736,6 +1750,7 @@ retry:
/* Driver takes ownership of state on successful commit. */
return 0;
+
fail:
if (ret == -EDEADLK)
goto backoff;
@@ -1743,6 +1758,7 @@ fail:
drm_atomic_state_free(state);
return ret;
+
backoff:
drm_atomic_state_clear(state);
drm_atomic_legacy_backoff(state);
@@ -1778,6 +1794,7 @@ drm_atomic_helper_plane_set_property(struct drm_plane *plane,
/* ->set_property is always called with all locks held. */
state->acquire_ctx = plane->dev->mode_config.acquire_ctx;
+
retry:
plane_state = drm_atomic_get_plane_state(state, plane);
if (IS_ERR(plane_state)) {
@@ -1796,6 +1813,7 @@ retry:
/* Driver takes ownership of state on successful commit. */
return 0;
+
fail:
if (ret == -EDEADLK)
goto backoff;
@@ -1803,6 +1821,7 @@ fail:
drm_atomic_state_free(state);
return ret;
+
backoff:
drm_atomic_state_clear(state);
drm_atomic_legacy_backoff(state);
@@ -1838,6 +1857,7 @@ drm_atomic_helper_connector_set_property(struct drm_connector *connector,
/* ->set_property is always called with all locks held. */
state->acquire_ctx = connector->dev->mode_config.acquire_ctx;
+
retry:
connector_state = drm_atomic_get_connector_state(state, connector);
if (IS_ERR(connector_state)) {
@@ -1856,6 +1876,7 @@ retry:
/* Driver takes ownership of state on successful commit. */
return 0;
+
fail:
if (ret == -EDEADLK)
goto backoff;
@@ -1863,6 +1884,7 @@ fail:
drm_atomic_state_free(state);
return ret;
+
backoff:
drm_atomic_state_clear(state);
drm_atomic_legacy_backoff(state);
@@ -1906,6 +1928,7 @@ int drm_atomic_helper_page_flip(struct drm_crtc *crtc,
return -ENOMEM;
state->acquire_ctx = drm_modeset_legacy_acquire_ctx(crtc);
+
retry:
crtc_state = drm_atomic_get_crtc_state(state, crtc);
if (IS_ERR(crtc_state)) {
@@ -1935,6 +1958,7 @@ retry:
/* Driver takes ownership of state on successful async commit. */
return 0;
+
fail:
if (ret == -EDEADLK)
goto backoff;
@@ -1942,6 +1966,7 @@ fail:
drm_atomic_state_free(state);
return ret;
+
backoff:
drm_atomic_state_clear(state);
drm_atomic_legacy_backoff(state);
@@ -1993,6 +2018,7 @@ void drm_atomic_helper_connector_dpms(struct drm_connector *connector,
return;
state->acquire_ctx = drm_modeset_legacy_acquire_ctx(crtc);
+
retry:
crtc_state = drm_atomic_get_crtc_state(state, crtc);
if (IS_ERR(crtc_state))
@@ -2017,6 +2043,7 @@ retry:
/* Driver takes ownership of state on successful async commit. */
return;
+
fail:
if (ret == -EDEADLK)
goto backoff;
@@ -2026,6 +2053,7 @@ fail:
WARN(1, "Driver bug: Changing ->active failed with ret=%i\n", ret);
return;
+
backoff:
drm_atomic_state_clear(state);
drm_atomic_legacy_backoff(state);
--
1.9.1
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/2] drm_atomic_helper.c: connector => tmp_connector
2015-03-15 12:59 [PATCH 1/2] drm_atomic_helper.c: cosmetic: fix some typos and add some empty line John Hunter
@ 2015-03-15 12:59 ` John Hunter
2015-03-16 8:21 ` Daniel Vetter
2015-03-16 8:17 ` [PATCH 1/2] drm_atomic_helper.c: cosmetic: fix some typos and add some empty line Daniel Vetter
1 sibling, 1 reply; 6+ messages in thread
From: John Hunter @ 2015-03-15 12:59 UTC (permalink / raw)
To: dri-devel
I'm not sure whether this is right, as far as I can see, for the
macro 'list_for_each_entry', if not use the tmp_connector, it does
make sense.
Hope I am right with that.
---
drivers/gpu/drm/drm_atomic_helper.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
index bc17019..2abded1 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -2027,10 +2027,10 @@ retry:
WARN_ON(!drm_modeset_is_locked(&config->connection_mutex));
list_for_each_entry(tmp_connector, &config->connector_list, head) {
- if (connector->state->crtc != crtc)
+ if (tmp_connector->state->crtc != crtc)
continue;
- if (connector->dpms == DRM_MODE_DPMS_ON) {
+ if (tmp_connector->dpms == DRM_MODE_DPMS_ON) {
active = true;
break;
}
--
1.9.1
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] drm_atomic_helper.c: cosmetic: fix some typos and add some empty line
2015-03-15 12:59 [PATCH 1/2] drm_atomic_helper.c: cosmetic: fix some typos and add some empty line John Hunter
2015-03-15 12:59 ` [PATCH 2/2] drm_atomic_helper.c: connector => tmp_connector John Hunter
@ 2015-03-16 8:17 ` Daniel Vetter
2015-03-16 8:25 ` John Hunter
1 sibling, 1 reply; 6+ messages in thread
From: Daniel Vetter @ 2015-03-16 8:17 UTC (permalink / raw)
To: John Hunter; +Cc: dri-devel
On Sun, Mar 15, 2015 at 08:59:10PM +0800, John Hunter wrote:
> there are some duplication in the annotations
> add some empty line to make it easier to read
sob line missing. Also please split this up into individual parts, since I
don't agree with the additional empty lines bikeshed. See
Documentation/SubmittingPatches.
-Daniel
> ---
> drivers/gpu/drm/drm_atomic_helper.c | 48 +++++++++++++++++++++++++++++--------
> 1 file changed, 38 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
> index a745881..bc17019 100644
> --- a/drivers/gpu/drm/drm_atomic_helper.c
> +++ b/drivers/gpu/drm/drm_atomic_helper.c
> @@ -346,7 +346,7 @@ needs_modeset(struct drm_crtc_state *state)
> }
>
> /**
> - * drm_atomic_helper_check - validate state object for modeset changes
> + * drm_atomic_helper_check_modeset - validate state object for modeset changes
> * @dev: DRM device
> * @state: the driver state object
> *
> @@ -461,7 +461,7 @@ drm_atomic_helper_check_modeset(struct drm_device *dev,
> EXPORT_SYMBOL(drm_atomic_helper_check_modeset);
>
> /**
> - * drm_atomic_helper_check - validate state object for modeset changes
> + * drm_atomic_helper_check_planes - validate state object for planes changes
> * @dev: DRM device
> * @state: the driver state object
> *
> @@ -605,7 +605,7 @@ disable_outputs(struct drm_device *dev, struct drm_atomic_state *old_state)
>
> /*
> * Each encoder has at most one connector (since we always steal
> - * it away), so we won't call call disable hooks twice.
> + * it away), so we won't call disable hooks twice.
> */
> if (encoder->bridge)
> encoder->bridge->funcs->disable(encoder->bridge);
> @@ -757,7 +757,7 @@ crtc_set_mode(struct drm_device *dev, struct drm_atomic_state *old_state)
>
> /*
> * Each encoder has at most one connector (since we always steal
> - * it away), so we won't call call mode_set hooks twice.
> + * it away), so we won't call mode_set hooks twice.
> */
> if (funcs->mode_set)
> funcs->mode_set(encoder, mode, adjusted_mode);
> @@ -858,7 +858,7 @@ void drm_atomic_helper_commit_modeset_enables(struct drm_device *dev,
>
> /*
> * Each encoder has at most one connector (since we always steal
> - * it away), so we won't call call enable hooks twice.
> + * it away), so we won't call enable hooks twice.
> */
> if (encoder->bridge)
> encoder->bridge->funcs->pre_enable(encoder->bridge);
> @@ -1025,7 +1025,7 @@ int drm_atomic_helper_commit(struct drm_device *dev,
>
> /*
> * Everything below can be run asynchronously without the need to grab
> - * any modeset locks at all under one conditions: It must be guaranteed
> + * any modeset locks at all under one condition: It must be guaranteed
> * that the asynchronous work has either been cancelled (if the driver
> * supports it, which at least requires that the framebuffers get
> * cleaned up with drm_atomic_helper_cleanup_planes()) or completed
> @@ -1151,7 +1151,6 @@ fail:
>
> if (fb && funcs->cleanup_fb)
> funcs->cleanup_fb(plane, fb, plane_state);
> -
> }
>
> return ret;
> @@ -1301,8 +1300,11 @@ void drm_atomic_helper_swap_state(struct drm_device *dev,
> struct drm_atomic_state *state)
> {
> int i;
> + int nconnectors = dev->mode_config.num_connector;
> + int ncrtcs = dev->mode_config.num_crtc;
> + int nplanes = dev->mode_config.num_total_plane;
>
> - for (i = 0; i < dev->mode_config.num_connector; i++) {
> + for (i = 0; i < nconnectors; i++) {
> struct drm_connector *connector = state->connectors[i];
>
> if (!connector)
> @@ -1313,7 +1315,7 @@ void drm_atomic_helper_swap_state(struct drm_device *dev,
> connector->state->state = NULL;
> }
>
> - for (i = 0; i < dev->mode_config.num_crtc; i++) {
> + for (i = 0; i < ncrtcs; i++) {
> struct drm_crtc *crtc = state->crtcs[i];
>
> if (!crtc)
> @@ -1324,7 +1326,7 @@ void drm_atomic_helper_swap_state(struct drm_device *dev,
> crtc->state->state = NULL;
> }
>
> - for (i = 0; i < dev->mode_config.num_total_plane; i++) {
> + for (i = 0; i < nplanes; i++) {
> struct drm_plane *plane = state->planes[i];
>
> if (!plane)
> @@ -1373,6 +1375,7 @@ int drm_atomic_helper_update_plane(struct drm_plane *plane,
> return -ENOMEM;
>
> state->acquire_ctx = drm_modeset_legacy_acquire_ctx(crtc);
> +
> retry:
> plane_state = drm_atomic_get_plane_state(state, plane);
> if (IS_ERR(plane_state)) {
> @@ -1402,6 +1405,7 @@ retry:
>
> /* Driver takes ownership of state on successful commit. */
> return 0;
> +
> fail:
> if (ret == -EDEADLK)
> goto backoff;
> @@ -1409,6 +1413,7 @@ fail:
> drm_atomic_state_free(state);
>
> return ret;
> +
> backoff:
> drm_atomic_state_clear(state);
> drm_atomic_legacy_backoff(state);
> @@ -1455,6 +1460,7 @@ int drm_atomic_helper_disable_plane(struct drm_plane *plane)
> return -ENOMEM;
>
> state->acquire_ctx = drm_modeset_legacy_acquire_ctx(plane->crtc);
> +
> retry:
> plane_state = drm_atomic_get_plane_state(state, plane);
> if (IS_ERR(plane_state)) {
> @@ -1465,6 +1471,7 @@ retry:
> ret = drm_atomic_set_crtc_for_plane(plane_state, NULL);
> if (ret != 0)
> goto fail;
> +
> drm_atomic_set_fb_for_plane(plane_state, NULL);
> plane_state->crtc_x = 0;
> plane_state->crtc_y = 0;
> @@ -1484,6 +1491,7 @@ retry:
>
> /* Driver takes ownership of state on successful commit. */
> return 0;
> +
> fail:
> if (ret == -EDEADLK)
> goto backoff;
> @@ -1491,6 +1499,7 @@ fail:
> drm_atomic_state_free(state);
>
> return ret;
> +
> backoff:
> drm_atomic_state_clear(state);
> drm_atomic_legacy_backoff(state);
> @@ -1609,6 +1618,7 @@ int drm_atomic_helper_set_config(struct drm_mode_set *set)
> return -ENOMEM;
>
> state->acquire_ctx = drm_modeset_legacy_acquire_ctx(crtc);
> +
> retry:
> crtc_state = drm_atomic_get_crtc_state(state, crtc);
> if (IS_ERR(crtc_state)) {
> @@ -1648,6 +1658,7 @@ retry:
> ret = drm_atomic_set_crtc_for_plane(primary_state, crtc);
> if (ret != 0)
> goto fail;
> +
> drm_atomic_set_fb_for_plane(primary_state, set->fb);
> primary_state->crtc_x = 0;
> primary_state->crtc_y = 0;
> @@ -1669,6 +1680,7 @@ commit:
>
> /* Driver takes ownership of state on successful commit. */
> return 0;
> +
> fail:
> if (ret == -EDEADLK)
> goto backoff;
> @@ -1676,6 +1688,7 @@ fail:
> drm_atomic_state_free(state);
>
> return ret;
> +
> backoff:
> drm_atomic_state_clear(state);
> drm_atomic_legacy_backoff(state);
> @@ -1718,6 +1731,7 @@ drm_atomic_helper_crtc_set_property(struct drm_crtc *crtc,
>
> /* ->set_property is always called with all locks held. */
> state->acquire_ctx = crtc->dev->mode_config.acquire_ctx;
> +
> retry:
> crtc_state = drm_atomic_get_crtc_state(state, crtc);
> if (IS_ERR(crtc_state)) {
> @@ -1736,6 +1750,7 @@ retry:
>
> /* Driver takes ownership of state on successful commit. */
> return 0;
> +
> fail:
> if (ret == -EDEADLK)
> goto backoff;
> @@ -1743,6 +1758,7 @@ fail:
> drm_atomic_state_free(state);
>
> return ret;
> +
> backoff:
> drm_atomic_state_clear(state);
> drm_atomic_legacy_backoff(state);
> @@ -1778,6 +1794,7 @@ drm_atomic_helper_plane_set_property(struct drm_plane *plane,
>
> /* ->set_property is always called with all locks held. */
> state->acquire_ctx = plane->dev->mode_config.acquire_ctx;
> +
> retry:
> plane_state = drm_atomic_get_plane_state(state, plane);
> if (IS_ERR(plane_state)) {
> @@ -1796,6 +1813,7 @@ retry:
>
> /* Driver takes ownership of state on successful commit. */
> return 0;
> +
> fail:
> if (ret == -EDEADLK)
> goto backoff;
> @@ -1803,6 +1821,7 @@ fail:
> drm_atomic_state_free(state);
>
> return ret;
> +
> backoff:
> drm_atomic_state_clear(state);
> drm_atomic_legacy_backoff(state);
> @@ -1838,6 +1857,7 @@ drm_atomic_helper_connector_set_property(struct drm_connector *connector,
>
> /* ->set_property is always called with all locks held. */
> state->acquire_ctx = connector->dev->mode_config.acquire_ctx;
> +
> retry:
> connector_state = drm_atomic_get_connector_state(state, connector);
> if (IS_ERR(connector_state)) {
> @@ -1856,6 +1876,7 @@ retry:
>
> /* Driver takes ownership of state on successful commit. */
> return 0;
> +
> fail:
> if (ret == -EDEADLK)
> goto backoff;
> @@ -1863,6 +1884,7 @@ fail:
> drm_atomic_state_free(state);
>
> return ret;
> +
> backoff:
> drm_atomic_state_clear(state);
> drm_atomic_legacy_backoff(state);
> @@ -1906,6 +1928,7 @@ int drm_atomic_helper_page_flip(struct drm_crtc *crtc,
> return -ENOMEM;
>
> state->acquire_ctx = drm_modeset_legacy_acquire_ctx(crtc);
> +
> retry:
> crtc_state = drm_atomic_get_crtc_state(state, crtc);
> if (IS_ERR(crtc_state)) {
> @@ -1935,6 +1958,7 @@ retry:
>
> /* Driver takes ownership of state on successful async commit. */
> return 0;
> +
> fail:
> if (ret == -EDEADLK)
> goto backoff;
> @@ -1942,6 +1966,7 @@ fail:
> drm_atomic_state_free(state);
>
> return ret;
> +
> backoff:
> drm_atomic_state_clear(state);
> drm_atomic_legacy_backoff(state);
> @@ -1993,6 +2018,7 @@ void drm_atomic_helper_connector_dpms(struct drm_connector *connector,
> return;
>
> state->acquire_ctx = drm_modeset_legacy_acquire_ctx(crtc);
> +
> retry:
> crtc_state = drm_atomic_get_crtc_state(state, crtc);
> if (IS_ERR(crtc_state))
> @@ -2017,6 +2043,7 @@ retry:
>
> /* Driver takes ownership of state on successful async commit. */
> return;
> +
> fail:
> if (ret == -EDEADLK)
> goto backoff;
> @@ -2026,6 +2053,7 @@ fail:
> WARN(1, "Driver bug: Changing ->active failed with ret=%i\n", ret);
>
> return;
> +
> backoff:
> drm_atomic_state_clear(state);
> drm_atomic_legacy_backoff(state);
> --
> 1.9.1
>
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] drm_atomic_helper.c: connector => tmp_connector
2015-03-15 12:59 ` [PATCH 2/2] drm_atomic_helper.c: connector => tmp_connector John Hunter
@ 2015-03-16 8:21 ` Daniel Vetter
2015-03-17 3:05 ` John Hunter
0 siblings, 1 reply; 6+ messages in thread
From: Daniel Vetter @ 2015-03-16 8:21 UTC (permalink / raw)
To: John Hunter; +Cc: dri-devel
On Sun, Mar 15, 2015 at 08:59:11PM +0800, John Hunter wrote:
> I'm not sure whether this is right, as far as I can see, for the
> macro 'list_for_each_entry', if not use the tmp_connector, it does
> make sense.
>
> Hope I am right with that.
Nice catch and looks correct. But please follow patch submission
guidelines from Documentation/SubmittingPatches. Here specifically:
- sob line missing
- Additional comments/questions should be below a line with just '---' so
that git apply-mbox drops it.
- Polish the commit message a bit. This wasn't too harmful since we
already look at connector, which has the same effect as the loop for any
non-cloned configs. Only when we have a cloned configuration is it
important to look at other connectors. Furthermore existing userspace
always changes dpms on all of them anyway.
Thanks, Daniel
> ---
> drivers/gpu/drm/drm_atomic_helper.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
> index bc17019..2abded1 100644
> --- a/drivers/gpu/drm/drm_atomic_helper.c
> +++ b/drivers/gpu/drm/drm_atomic_helper.c
> @@ -2027,10 +2027,10 @@ retry:
> WARN_ON(!drm_modeset_is_locked(&config->connection_mutex));
>
> list_for_each_entry(tmp_connector, &config->connector_list, head) {
> - if (connector->state->crtc != crtc)
> + if (tmp_connector->state->crtc != crtc)
> continue;
>
> - if (connector->dpms == DRM_MODE_DPMS_ON) {
> + if (tmp_connector->dpms == DRM_MODE_DPMS_ON) {
> active = true;
> break;
> }
> --
> 1.9.1
>
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] drm_atomic_helper.c: cosmetic: fix some typos and add some empty line
2015-03-16 8:17 ` [PATCH 1/2] drm_atomic_helper.c: cosmetic: fix some typos and add some empty line Daniel Vetter
@ 2015-03-16 8:25 ` John Hunter
0 siblings, 0 replies; 6+ messages in thread
From: John Hunter @ 2015-03-16 8:25 UTC (permalink / raw)
To: Daniel Vetter; +Cc: dri-devel
[-- Attachment #1.1: Type: text/plain, Size: 12267 bytes --]
I will read the Documentation/SubmittingPatches,
sorry about my mistake.
On Mon, Mar 16, 2015 at 4:17 PM, Daniel Vetter <daniel@ffwll.ch> wrote:
> On Sun, Mar 15, 2015 at 08:59:10PM +0800, John Hunter wrote:
> > there are some duplication in the annotations
> > add some empty line to make it easier to read
>
> sob line missing. Also please split this up into individual parts, since I
> don't agree with the additional empty lines bikeshed. See
> Documentation/SubmittingPatches.
> -Daniel
>
> > ---
> > drivers/gpu/drm/drm_atomic_helper.c | 48
> +++++++++++++++++++++++++++++--------
> > 1 file changed, 38 insertions(+), 10 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/drm_atomic_helper.c
> b/drivers/gpu/drm/drm_atomic_helper.c
> > index a745881..bc17019 100644
> > --- a/drivers/gpu/drm/drm_atomic_helper.c
> > +++ b/drivers/gpu/drm/drm_atomic_helper.c
> > @@ -346,7 +346,7 @@ needs_modeset(struct drm_crtc_state *state)
> > }
> >
> > /**
> > - * drm_atomic_helper_check - validate state object for modeset changes
> > + * drm_atomic_helper_check_modeset - validate state object for modeset
> changes
> > * @dev: DRM device
> > * @state: the driver state object
> > *
> > @@ -461,7 +461,7 @@ drm_atomic_helper_check_modeset(struct drm_device
> *dev,
> > EXPORT_SYMBOL(drm_atomic_helper_check_modeset);
> >
> > /**
> > - * drm_atomic_helper_check - validate state object for modeset changes
> > + * drm_atomic_helper_check_planes - validate state object for planes
> changes
> > * @dev: DRM device
> > * @state: the driver state object
> > *
> > @@ -605,7 +605,7 @@ disable_outputs(struct drm_device *dev, struct
> drm_atomic_state *old_state)
> >
> > /*
> > * Each encoder has at most one connector (since we always
> steal
> > - * it away), so we won't call call disable hooks twice.
> > + * it away), so we won't call disable hooks twice.
> > */
> > if (encoder->bridge)
> > encoder->bridge->funcs->disable(encoder->bridge);
> > @@ -757,7 +757,7 @@ crtc_set_mode(struct drm_device *dev, struct
> drm_atomic_state *old_state)
> >
> > /*
> > * Each encoder has at most one connector (since we always
> steal
> > - * it away), so we won't call call mode_set hooks twice.
> > + * it away), so we won't call mode_set hooks twice.
> > */
> > if (funcs->mode_set)
> > funcs->mode_set(encoder, mode, adjusted_mode);
> > @@ -858,7 +858,7 @@ void drm_atomic_helper_commit_modeset_enables(struct
> drm_device *dev,
> >
> > /*
> > * Each encoder has at most one connector (since we always
> steal
> > - * it away), so we won't call call enable hooks twice.
> > + * it away), so we won't call enable hooks twice.
> > */
> > if (encoder->bridge)
> >
> encoder->bridge->funcs->pre_enable(encoder->bridge);
> > @@ -1025,7 +1025,7 @@ int drm_atomic_helper_commit(struct drm_device
> *dev,
> >
> > /*
> > * Everything below can be run asynchronously without the need to
> grab
> > - * any modeset locks at all under one conditions: It must be
> guaranteed
> > + * any modeset locks at all under one condition: It must be
> guaranteed
> > * that the asynchronous work has either been cancelled (if the
> driver
> > * supports it, which at least requires that the framebuffers get
> > * cleaned up with drm_atomic_helper_cleanup_planes()) or completed
> > @@ -1151,7 +1151,6 @@ fail:
> >
> > if (fb && funcs->cleanup_fb)
> > funcs->cleanup_fb(plane, fb, plane_state);
> > -
> > }
> >
> > return ret;
> > @@ -1301,8 +1300,11 @@ void drm_atomic_helper_swap_state(struct
> drm_device *dev,
> > struct drm_atomic_state *state)
> > {
> > int i;
> > + int nconnectors = dev->mode_config.num_connector;
> > + int ncrtcs = dev->mode_config.num_crtc;
> > + int nplanes = dev->mode_config.num_total_plane;
> >
> > - for (i = 0; i < dev->mode_config.num_connector; i++) {
> > + for (i = 0; i < nconnectors; i++) {
> > struct drm_connector *connector = state->connectors[i];
> >
> > if (!connector)
> > @@ -1313,7 +1315,7 @@ void drm_atomic_helper_swap_state(struct
> drm_device *dev,
> > connector->state->state = NULL;
> > }
> >
> > - for (i = 0; i < dev->mode_config.num_crtc; i++) {
> > + for (i = 0; i < ncrtcs; i++) {
> > struct drm_crtc *crtc = state->crtcs[i];
> >
> > if (!crtc)
> > @@ -1324,7 +1326,7 @@ void drm_atomic_helper_swap_state(struct
> drm_device *dev,
> > crtc->state->state = NULL;
> > }
> >
> > - for (i = 0; i < dev->mode_config.num_total_plane; i++) {
> > + for (i = 0; i < nplanes; i++) {
> > struct drm_plane *plane = state->planes[i];
> >
> > if (!plane)
> > @@ -1373,6 +1375,7 @@ int drm_atomic_helper_update_plane(struct
> drm_plane *plane,
> > return -ENOMEM;
> >
> > state->acquire_ctx = drm_modeset_legacy_acquire_ctx(crtc);
> > +
> > retry:
> > plane_state = drm_atomic_get_plane_state(state, plane);
> > if (IS_ERR(plane_state)) {
> > @@ -1402,6 +1405,7 @@ retry:
> >
> > /* Driver takes ownership of state on successful commit. */
> > return 0;
> > +
> > fail:
> > if (ret == -EDEADLK)
> > goto backoff;
> > @@ -1409,6 +1413,7 @@ fail:
> > drm_atomic_state_free(state);
> >
> > return ret;
> > +
> > backoff:
> > drm_atomic_state_clear(state);
> > drm_atomic_legacy_backoff(state);
> > @@ -1455,6 +1460,7 @@ int drm_atomic_helper_disable_plane(struct
> drm_plane *plane)
> > return -ENOMEM;
> >
> > state->acquire_ctx = drm_modeset_legacy_acquire_ctx(plane->crtc);
> > +
> > retry:
> > plane_state = drm_atomic_get_plane_state(state, plane);
> > if (IS_ERR(plane_state)) {
> > @@ -1465,6 +1471,7 @@ retry:
> > ret = drm_atomic_set_crtc_for_plane(plane_state, NULL);
> > if (ret != 0)
> > goto fail;
> > +
> > drm_atomic_set_fb_for_plane(plane_state, NULL);
> > plane_state->crtc_x = 0;
> > plane_state->crtc_y = 0;
> > @@ -1484,6 +1491,7 @@ retry:
> >
> > /* Driver takes ownership of state on successful commit. */
> > return 0;
> > +
> > fail:
> > if (ret == -EDEADLK)
> > goto backoff;
> > @@ -1491,6 +1499,7 @@ fail:
> > drm_atomic_state_free(state);
> >
> > return ret;
> > +
> > backoff:
> > drm_atomic_state_clear(state);
> > drm_atomic_legacy_backoff(state);
> > @@ -1609,6 +1618,7 @@ int drm_atomic_helper_set_config(struct
> drm_mode_set *set)
> > return -ENOMEM;
> >
> > state->acquire_ctx = drm_modeset_legacy_acquire_ctx(crtc);
> > +
> > retry:
> > crtc_state = drm_atomic_get_crtc_state(state, crtc);
> > if (IS_ERR(crtc_state)) {
> > @@ -1648,6 +1658,7 @@ retry:
> > ret = drm_atomic_set_crtc_for_plane(primary_state, crtc);
> > if (ret != 0)
> > goto fail;
> > +
> > drm_atomic_set_fb_for_plane(primary_state, set->fb);
> > primary_state->crtc_x = 0;
> > primary_state->crtc_y = 0;
> > @@ -1669,6 +1680,7 @@ commit:
> >
> > /* Driver takes ownership of state on successful commit. */
> > return 0;
> > +
> > fail:
> > if (ret == -EDEADLK)
> > goto backoff;
> > @@ -1676,6 +1688,7 @@ fail:
> > drm_atomic_state_free(state);
> >
> > return ret;
> > +
> > backoff:
> > drm_atomic_state_clear(state);
> > drm_atomic_legacy_backoff(state);
> > @@ -1718,6 +1731,7 @@ drm_atomic_helper_crtc_set_property(struct
> drm_crtc *crtc,
> >
> > /* ->set_property is always called with all locks held. */
> > state->acquire_ctx = crtc->dev->mode_config.acquire_ctx;
> > +
> > retry:
> > crtc_state = drm_atomic_get_crtc_state(state, crtc);
> > if (IS_ERR(crtc_state)) {
> > @@ -1736,6 +1750,7 @@ retry:
> >
> > /* Driver takes ownership of state on successful commit. */
> > return 0;
> > +
> > fail:
> > if (ret == -EDEADLK)
> > goto backoff;
> > @@ -1743,6 +1758,7 @@ fail:
> > drm_atomic_state_free(state);
> >
> > return ret;
> > +
> > backoff:
> > drm_atomic_state_clear(state);
> > drm_atomic_legacy_backoff(state);
> > @@ -1778,6 +1794,7 @@ drm_atomic_helper_plane_set_property(struct
> drm_plane *plane,
> >
> > /* ->set_property is always called with all locks held. */
> > state->acquire_ctx = plane->dev->mode_config.acquire_ctx;
> > +
> > retry:
> > plane_state = drm_atomic_get_plane_state(state, plane);
> > if (IS_ERR(plane_state)) {
> > @@ -1796,6 +1813,7 @@ retry:
> >
> > /* Driver takes ownership of state on successful commit. */
> > return 0;
> > +
> > fail:
> > if (ret == -EDEADLK)
> > goto backoff;
> > @@ -1803,6 +1821,7 @@ fail:
> > drm_atomic_state_free(state);
> >
> > return ret;
> > +
> > backoff:
> > drm_atomic_state_clear(state);
> > drm_atomic_legacy_backoff(state);
> > @@ -1838,6 +1857,7 @@ drm_atomic_helper_connector_set_property(struct
> drm_connector *connector,
> >
> > /* ->set_property is always called with all locks held. */
> > state->acquire_ctx = connector->dev->mode_config.acquire_ctx;
> > +
> > retry:
> > connector_state = drm_atomic_get_connector_state(state, connector);
> > if (IS_ERR(connector_state)) {
> > @@ -1856,6 +1876,7 @@ retry:
> >
> > /* Driver takes ownership of state on successful commit. */
> > return 0;
> > +
> > fail:
> > if (ret == -EDEADLK)
> > goto backoff;
> > @@ -1863,6 +1884,7 @@ fail:
> > drm_atomic_state_free(state);
> >
> > return ret;
> > +
> > backoff:
> > drm_atomic_state_clear(state);
> > drm_atomic_legacy_backoff(state);
> > @@ -1906,6 +1928,7 @@ int drm_atomic_helper_page_flip(struct drm_crtc
> *crtc,
> > return -ENOMEM;
> >
> > state->acquire_ctx = drm_modeset_legacy_acquire_ctx(crtc);
> > +
> > retry:
> > crtc_state = drm_atomic_get_crtc_state(state, crtc);
> > if (IS_ERR(crtc_state)) {
> > @@ -1935,6 +1958,7 @@ retry:
> >
> > /* Driver takes ownership of state on successful async commit. */
> > return 0;
> > +
> > fail:
> > if (ret == -EDEADLK)
> > goto backoff;
> > @@ -1942,6 +1966,7 @@ fail:
> > drm_atomic_state_free(state);
> >
> > return ret;
> > +
> > backoff:
> > drm_atomic_state_clear(state);
> > drm_atomic_legacy_backoff(state);
> > @@ -1993,6 +2018,7 @@ void drm_atomic_helper_connector_dpms(struct
> drm_connector *connector,
> > return;
> >
> > state->acquire_ctx = drm_modeset_legacy_acquire_ctx(crtc);
> > +
> > retry:
> > crtc_state = drm_atomic_get_crtc_state(state, crtc);
> > if (IS_ERR(crtc_state))
> > @@ -2017,6 +2043,7 @@ retry:
> >
> > /* Driver takes ownership of state on successful async commit. */
> > return;
> > +
> > fail:
> > if (ret == -EDEADLK)
> > goto backoff;
> > @@ -2026,6 +2053,7 @@ fail:
> > WARN(1, "Driver bug: Changing ->active failed with ret=%i\n", ret);
> >
> > return;
> > +
> > backoff:
> > drm_atomic_state_clear(state);
> > drm_atomic_legacy_backoff(state);
> > --
> > 1.9.1
> >
> >
> > _______________________________________________
> > dri-devel mailing list
> > dri-devel@lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/dri-devel
>
> --
> Daniel Vetter
> Software Engineer, Intel Corporation
> +41 (0) 79 365 57 48 - http://blog.ffwll.ch
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
>
--
Best regards
Junwang Zhao
Microprocessor Research and Develop Center
Department of Computer Science &Technology
Peking University
Beijing, 100871, PRC
[-- Attachment #1.2: Type: text/html, Size: 16256 bytes --]
[-- Attachment #2: Type: text/plain, Size: 159 bytes --]
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] drm_atomic_helper.c: connector => tmp_connector
2015-03-16 8:21 ` Daniel Vetter
@ 2015-03-17 3:05 ` John Hunter
0 siblings, 0 replies; 6+ messages in thread
From: John Hunter @ 2015-03-17 3:05 UTC (permalink / raw)
To: Daniel Vetter; +Cc: dri-devel
[-- Attachment #1.1: Type: text/plain, Size: 2863 bytes --]
Hi Daniel,
I've modified my patches and resend them, hope I do the right work flow
this time.
I am not good at english, so please forgive my dull :-(
I spent about two hours to figure out what does the "sob line missing"
means.
sob means Signed-off-by in case some others don't know. :-)
Please don't hesitate to criticize if I think I didn't do the right thing.
Thanks, John
On Mon, Mar 16, 2015 at 4:21 PM, Daniel Vetter <daniel@ffwll.ch> wrote:
> On Sun, Mar 15, 2015 at 08:59:11PM +0800, John Hunter wrote:
> > I'm not sure whether this is right, as far as I can see, for the
> > macro 'list_for_each_entry', if not use the tmp_connector, it does
> > make sense.
> >
> > Hope I am right with that.
>
> Nice catch and looks correct. But please follow patch submission
> guidelines from Documentation/SubmittingPatches. Here specifically:
> - sob line missing
> - Additional comments/questions should be below a line with just '---' so
> that git apply-mbox drops it.
> - Polish the commit message a bit. This wasn't too harmful since we
> already look at connector, which has the same effect as the loop for any
> non-cloned configs. Only when we have a cloned configuration is it
> important to look at other connectors. Furthermore existing userspace
> always changes dpms on all of them anyway.
>
> Thanks, Daniel
> > ---
> > drivers/gpu/drm/drm_atomic_helper.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/drm_atomic_helper.c
> b/drivers/gpu/drm/drm_atomic_helper.c
> > index bc17019..2abded1 100644
> > --- a/drivers/gpu/drm/drm_atomic_helper.c
> > +++ b/drivers/gpu/drm/drm_atomic_helper.c
> > @@ -2027,10 +2027,10 @@ retry:
> > WARN_ON(!drm_modeset_is_locked(&config->connection_mutex));
> >
> > list_for_each_entry(tmp_connector, &config->connector_list, head) {
> > - if (connector->state->crtc != crtc)
> > + if (tmp_connector->state->crtc != crtc)
> > continue;
> >
> > - if (connector->dpms == DRM_MODE_DPMS_ON) {
> > + if (tmp_connector->dpms == DRM_MODE_DPMS_ON) {
> > active = true;
> > break;
> > }
> > --
> > 1.9.1
> >
> >
> > _______________________________________________
> > dri-devel mailing list
> > dri-devel@lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/dri-devel
>
> --
> Daniel Vetter
> Software Engineer, Intel Corporation
> +41 (0) 79 365 57 48 - http://blog.ffwll.ch
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
>
--
Best regards
Junwang Zhao
Microprocessor Research and Develop Center
Department of Computer Science &Technology
Peking University
Beijing, 100871, PRC
[-- Attachment #1.2: Type: text/html, Size: 4340 bytes --]
[-- Attachment #2: Type: text/plain, Size: 159 bytes --]
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-03-17 3:05 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-15 12:59 [PATCH 1/2] drm_atomic_helper.c: cosmetic: fix some typos and add some empty line John Hunter
2015-03-15 12:59 ` [PATCH 2/2] drm_atomic_helper.c: connector => tmp_connector John Hunter
2015-03-16 8:21 ` Daniel Vetter
2015-03-17 3:05 ` John Hunter
2015-03-16 8:17 ` [PATCH 1/2] drm_atomic_helper.c: cosmetic: fix some typos and add some empty line Daniel Vetter
2015-03-16 8:25 ` John Hunter
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.