Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1399308 > unrolled thread

[PATCH v2 0/6] drm: Add various helpers for simple drivers

Started byNoralf Trønnes <noralf@tronnes.org>
First post2016-05-11 18:20 +0200
Last post2016-05-11 18:20 +0200
Articles 9 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH v2 0/6] drm: Add various helpers for simple drivers Noralf Trønnes <noralf@tronnes.org> - 2016-05-11 18:20 +0200
    [PATCH v2 4/6] drm/atomic: Don't skip drm_bridge_*() calls if !drm_encoder_helper_funcs Noralf Trønnes <noralf@tronnes.org> - 2016-05-11 18:20 +0200
      Re: [PATCH v2 4/6] drm/atomic: Don't skip drm_bridge_*() calls if  !drm_encoder_helper_funcs Daniel Vetter <daniel@ffwll.ch> - 2016-05-11 19:00 +0200
    [PATCH v2 5/6] drm/atomic: Add drm_atomic_helper_best_encoder() Noralf Trønnes <noralf@tronnes.org> - 2016-05-11 18:20 +0200
      Re: [PATCH v2 5/6] drm/atomic: Add drm_atomic_helper_best_encoder() Daniel Vetter <daniel@ffwll.ch> - 2016-05-11 19:00 +0200
    [PATCH v2 2/6] drm/fb-cma-helper: Hook up to DocBook and fix some docs Noralf Trønnes <noralf@tronnes.org> - 2016-05-11 18:20 +0200
      Re: [PATCH v2 2/6] drm/fb-cma-helper: Hook up to DocBook and fix  some docs Daniel Vetter <daniel@ffwll.ch> - 2016-05-11 18:50 +0200
    [PATCH v2 3/6] drm/fb-cma-helper: Add function drm_fb_cma_create_with_funcs() Noralf Trønnes <noralf@tronnes.org> - 2016-05-11 18:20 +0200
    [PATCH v2 1/6] drm/fb-helper: Remove mention of CONFIG_FB_DEFERRED_IO in docs Noralf Trønnes <noralf@tronnes.org> - 2016-05-11 18:20 +0200

#1399308 — [PATCH v2 0/6] drm: Add various helpers for simple drivers

FromNoralf Trønnes <noralf@tronnes.org>
Date2016-05-11 18:20 +0200
Subject[PATCH v2 0/6] drm: Add various helpers for simple drivers
Message-ID<rxF1E-3io-7@gated-at.bofh.it>
This patchset adds various helpers that was originally part of the
tinydrm patchset.

Essentially it adds 3 functions:
- drm_fb_cma_create_with_funcs()
  CMA backed framebuffer supporting a dirty() callback.
- drm_atomic_helper_best_encoder()
  (struct drm_connector_helper_funcs *)->best_encoder callback helper.
- drm_simple_display_pipe_init()
  Plane, crtc and encoder are collapsed into one entity.

Plus it has gained a couple of documentation patches since v1.

Changes since v1:
- Drop patch: drm/panel: Add helper for simple panel connector
- Add fb-helper and fb-cma-helper doc patches
- Add drm/atomic: Don't skip drm_bridge_*() calls if !drm_encoder_helper_funcs
- Add drm_atomic_helper_best_encoder()
- drm/fb-cma-helper: Add function drm_fb_cma_create_with_funcs()
  - Expand docs
- drm: Add helper for simple display pipeline
  - Add DOC header and add to gpu.tmpl
  - Fix docs: @funcs is optional, "negative error code",
    "This hook is optional."
  - Add checks to drm_simple_kms_plane_atomic_check()

Noralf Trønnes (6):
  drm/fb-helper: Remove mention of CONFIG_FB_DEFERRED_IO in docs
  drm/fb-cma-helper: Hook up to DocBook and fix some docs
  drm/fb-cma-helper: Add function drm_fb_cma_create_with_funcs()
  drm/atomic: Don't skip drm_bridge_*() calls if
    !drm_encoder_helper_funcs
  drm/atomic: Add drm_atomic_helper_best_encoder()
  drm: Add helper for simple display pipeline

 Documentation/DocBook/gpu.tmpl          |  11 ++
 drivers/gpu/drm/Kconfig                 |   7 ++
 drivers/gpu/drm/Makefile                |   1 +
 drivers/gpu/drm/drm_atomic_helper.c     |  56 +++++----
 drivers/gpu/drm/drm_fb_cma_helper.c     |  39 +++++--
 drivers/gpu/drm/drm_fb_helper.c         |  16 +--
 drivers/gpu/drm/drm_simple_kms_helper.c | 200 ++++++++++++++++++++++++++++++++
 include/drm/drm_atomic_helper.h         |   2 +
 include/drm/drm_fb_cma_helper.h         |   3 +
 include/drm/drm_simple_kms_helper.h     |  92 +++++++++++++++
 10 files changed, 386 insertions(+), 41 deletions(-)
 create mode 100644 drivers/gpu/drm/drm_simple_kms_helper.c
 create mode 100644 include/drm/drm_simple_kms_helper.h

--
2.8.2

[toc] | [next] | [standalone]


#1399309 — [PATCH v2 4/6] drm/atomic: Don't skip drm_bridge_*() calls if !drm_encoder_helper_funcs

FromNoralf Trønnes <noralf@tronnes.org>
Date2016-05-11 18:20 +0200
Subject[PATCH v2 4/6] drm/atomic: Don't skip drm_bridge_*() calls if !drm_encoder_helper_funcs
Message-ID<rxF1E-3io-21@gated-at.bofh.it>
In reply to#1399308
Don't skip drm_bridge_*() calls if encoder->helper_private is NULL.

Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
---
 drivers/gpu/drm/drm_atomic_helper.c | 39 ++++++++++++++++---------------------
 1 file changed, 17 insertions(+), 22 deletions(-)

diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
index 027b227..46a3201 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -384,8 +384,6 @@ mode_fixup(struct drm_atomic_state *state)
 		 */
 		encoder = conn_state->best_encoder;
 		funcs = encoder->helper_private;
-		if (!funcs)
-			continue;
 
 		ret = drm_bridge_mode_fixup(encoder->bridge, &crtc_state->mode,
 				&crtc_state->adjusted_mode);
@@ -394,7 +392,7 @@ mode_fixup(struct drm_atomic_state *state)
 			return -EINVAL;
 		}
 
-		if (funcs->atomic_check) {
+		if (funcs && funcs->atomic_check) {
 			ret = funcs->atomic_check(encoder, crtc_state,
 						  conn_state);
 			if (ret) {
@@ -402,7 +400,7 @@ mode_fixup(struct drm_atomic_state *state)
 						 encoder->base.id, encoder->name);
 				return ret;
 			}
-		} else if (funcs->mode_fixup) {
+		} else if (funcs && funcs->mode_fixup) {
 			ret = funcs->mode_fixup(encoder, &crtc_state->mode,
 						&crtc_state->adjusted_mode);
 			if (!ret) {
@@ -696,8 +694,6 @@ disable_outputs(struct drm_device *dev, struct drm_atomic_state *old_state)
 			continue;
 
 		funcs = encoder->helper_private;
-		if (!funcs)
-			continue;
 
 		DRM_DEBUG_ATOMIC("disabling [ENCODER:%d:%s]\n",
 				 encoder->base.id, encoder->name);
@@ -709,12 +705,14 @@ disable_outputs(struct drm_device *dev, struct drm_atomic_state *old_state)
 		drm_bridge_disable(encoder->bridge);
 
 		/* Right function depends upon target state. */
-		if (connector->state->crtc && funcs->prepare)
-			funcs->prepare(encoder);
-		else if (funcs->disable)
-			funcs->disable(encoder);
-		else if (funcs->dpms)
-			funcs->dpms(encoder, DRM_MODE_DPMS_OFF);
+		if (funcs) {
+			if (connector->state->crtc && funcs->prepare)
+				funcs->prepare(encoder);
+			else if (funcs->disable)
+				funcs->disable(encoder);
+			else if (funcs->dpms)
+				funcs->dpms(encoder, DRM_MODE_DPMS_OFF);
+		}
 
 		drm_bridge_post_disable(encoder->bridge);
 	}
@@ -861,9 +859,6 @@ crtc_set_mode(struct drm_device *dev, struct drm_atomic_state *old_state)
 
 		encoder = connector->state->best_encoder;
 		funcs = encoder->helper_private;
-		if (!funcs)
-			continue;
-
 		new_crtc_state = connector->state->crtc->state;
 		mode = &new_crtc_state->mode;
 		adjusted_mode = &new_crtc_state->adjusted_mode;
@@ -878,7 +873,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 mode_set hooks twice.
 		 */
-		if (funcs->mode_set)
+		if (funcs && funcs->mode_set)
 			funcs->mode_set(encoder, mode, adjusted_mode);
 
 		drm_bridge_mode_set(encoder->bridge, mode, adjusted_mode);
@@ -969,8 +964,6 @@ void drm_atomic_helper_commit_modeset_enables(struct drm_device *dev,
 
 		encoder = connector->state->best_encoder;
 		funcs = encoder->helper_private;
-		if (!funcs)
-			continue;
 
 		DRM_DEBUG_ATOMIC("enabling [ENCODER:%d:%s]\n",
 				 encoder->base.id, encoder->name);
@@ -981,10 +974,12 @@ void drm_atomic_helper_commit_modeset_enables(struct drm_device *dev,
 		 */
 		drm_bridge_pre_enable(encoder->bridge);
 
-		if (funcs->enable)
-			funcs->enable(encoder);
-		else if (funcs->commit)
-			funcs->commit(encoder);
+		if (funcs) {
+			if (funcs->enable)
+				funcs->enable(encoder);
+			else if (funcs->commit)
+				funcs->commit(encoder);
+		}
 
 		drm_bridge_enable(encoder->bridge);
 	}
-- 
2.8.2

[toc] | [prev] | [next] | [standalone]


#1399365 — Re: [PATCH v2 4/6] drm/atomic: Don't skip drm_bridge_*() calls if !drm_encoder_helper_funcs

FromDaniel Vetter <daniel@ffwll.ch>
Date2016-05-11 19:00 +0200
SubjectRe: [PATCH v2 4/6] drm/atomic: Don't skip drm_bridge_*() calls if !drm_encoder_helper_funcs
Message-ID<rxFEm-3D1-21@gated-at.bofh.it>
In reply to#1399309
On Wed, May 11, 2016 at 06:09:20PM +0200, Noralf Trønnes wrote:
> Don't skip drm_bridge_*() calls if encoder->helper_private is NULL.
> 
> Signed-off-by: Noralf Trønnes <noralf@tronnes.org>

Applied to drm-misc, thanks.
-Daniel

> ---
>  drivers/gpu/drm/drm_atomic_helper.c | 39 ++++++++++++++++---------------------
>  1 file changed, 17 insertions(+), 22 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
> index 027b227..46a3201 100644
> --- a/drivers/gpu/drm/drm_atomic_helper.c
> +++ b/drivers/gpu/drm/drm_atomic_helper.c
> @@ -384,8 +384,6 @@ mode_fixup(struct drm_atomic_state *state)
>  		 */
>  		encoder = conn_state->best_encoder;
>  		funcs = encoder->helper_private;
> -		if (!funcs)
> -			continue;
>  
>  		ret = drm_bridge_mode_fixup(encoder->bridge, &crtc_state->mode,
>  				&crtc_state->adjusted_mode);
> @@ -394,7 +392,7 @@ mode_fixup(struct drm_atomic_state *state)
>  			return -EINVAL;
>  		}
>  
> -		if (funcs->atomic_check) {
> +		if (funcs && funcs->atomic_check) {
>  			ret = funcs->atomic_check(encoder, crtc_state,
>  						  conn_state);
>  			if (ret) {
> @@ -402,7 +400,7 @@ mode_fixup(struct drm_atomic_state *state)
>  						 encoder->base.id, encoder->name);
>  				return ret;
>  			}
> -		} else if (funcs->mode_fixup) {
> +		} else if (funcs && funcs->mode_fixup) {
>  			ret = funcs->mode_fixup(encoder, &crtc_state->mode,
>  						&crtc_state->adjusted_mode);
>  			if (!ret) {
> @@ -696,8 +694,6 @@ disable_outputs(struct drm_device *dev, struct drm_atomic_state *old_state)
>  			continue;
>  
>  		funcs = encoder->helper_private;
> -		if (!funcs)
> -			continue;
>  
>  		DRM_DEBUG_ATOMIC("disabling [ENCODER:%d:%s]\n",
>  				 encoder->base.id, encoder->name);
> @@ -709,12 +705,14 @@ disable_outputs(struct drm_device *dev, struct drm_atomic_state *old_state)
>  		drm_bridge_disable(encoder->bridge);
>  
>  		/* Right function depends upon target state. */
> -		if (connector->state->crtc && funcs->prepare)
> -			funcs->prepare(encoder);
> -		else if (funcs->disable)
> -			funcs->disable(encoder);
> -		else if (funcs->dpms)
> -			funcs->dpms(encoder, DRM_MODE_DPMS_OFF);
> +		if (funcs) {
> +			if (connector->state->crtc && funcs->prepare)
> +				funcs->prepare(encoder);
> +			else if (funcs->disable)
> +				funcs->disable(encoder);
> +			else if (funcs->dpms)
> +				funcs->dpms(encoder, DRM_MODE_DPMS_OFF);
> +		}
>  
>  		drm_bridge_post_disable(encoder->bridge);
>  	}
> @@ -861,9 +859,6 @@ crtc_set_mode(struct drm_device *dev, struct drm_atomic_state *old_state)
>  
>  		encoder = connector->state->best_encoder;
>  		funcs = encoder->helper_private;
> -		if (!funcs)
> -			continue;
> -
>  		new_crtc_state = connector->state->crtc->state;
>  		mode = &new_crtc_state->mode;
>  		adjusted_mode = &new_crtc_state->adjusted_mode;
> @@ -878,7 +873,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 mode_set hooks twice.
>  		 */
> -		if (funcs->mode_set)
> +		if (funcs && funcs->mode_set)
>  			funcs->mode_set(encoder, mode, adjusted_mode);
>  
>  		drm_bridge_mode_set(encoder->bridge, mode, adjusted_mode);
> @@ -969,8 +964,6 @@ void drm_atomic_helper_commit_modeset_enables(struct drm_device *dev,
>  
>  		encoder = connector->state->best_encoder;
>  		funcs = encoder->helper_private;
> -		if (!funcs)
> -			continue;
>  
>  		DRM_DEBUG_ATOMIC("enabling [ENCODER:%d:%s]\n",
>  				 encoder->base.id, encoder->name);
> @@ -981,10 +974,12 @@ void drm_atomic_helper_commit_modeset_enables(struct drm_device *dev,
>  		 */
>  		drm_bridge_pre_enable(encoder->bridge);
>  
> -		if (funcs->enable)
> -			funcs->enable(encoder);
> -		else if (funcs->commit)
> -			funcs->commit(encoder);
> +		if (funcs) {
> +			if (funcs->enable)
> +				funcs->enable(encoder);
> +			else if (funcs->commit)
> +				funcs->commit(encoder);
> +		}
>  
>  		drm_bridge_enable(encoder->bridge);
>  	}
> -- 
> 2.8.2
> 

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

[toc] | [prev] | [next] | [standalone]


#1399311 — [PATCH v2 5/6] drm/atomic: Add drm_atomic_helper_best_encoder()

FromNoralf Trønnes <noralf@tronnes.org>
Date2016-05-11 18:20 +0200
Subject[PATCH v2 5/6] drm/atomic: Add drm_atomic_helper_best_encoder()
Message-ID<rxF1E-3io-19@gated-at.bofh.it>
In reply to#1399308
Add (struct drm_connector_helper_funcs *)->best_encoder callback helper
for connectors that support exactly 1 encoder, statically determined at
driver init time.

Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
---
 drivers/gpu/drm/drm_atomic_helper.c | 17 +++++++++++++++++
 include/drm/drm_atomic_helper.h     |  2 ++
 2 files changed, 19 insertions(+)

diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
index 46a3201..43a0b3d 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -2483,6 +2483,23 @@ backoff:
 EXPORT_SYMBOL(drm_atomic_helper_connector_dpms);
 
 /**
+ * drm_atomic_helper_best_encoder - Helper for &drm_connector_helper_funcs
+ *                                  ->best_encoder callback
+ * @connector: Connector control structure
+ *
+ * This is a &drm_connector_helper_funcs ->best_encoder callback helper for
+ * connectors that support exactly 1 encoder, statically determined at driver
+ * init time.
+ */
+struct drm_encoder *
+drm_atomic_helper_best_encoder(struct drm_connector *connector)
+{
+	WARN_ON(connector->encoder_ids[1]);
+	return drm_encoder_find(connector->dev, connector->encoder_ids[0]);
+}
+EXPORT_SYMBOL(drm_atomic_helper_best_encoder);
+
+/**
  * DOC: atomic state reset and initialization
  *
  * Both the drm core and the atomic helpers assume that there is always the full
diff --git a/include/drm/drm_atomic_helper.h b/include/drm/drm_atomic_helper.h
index 0364287..ccca709 100644
--- a/include/drm/drm_atomic_helper.h
+++ b/include/drm/drm_atomic_helper.h
@@ -110,6 +110,8 @@ int drm_atomic_helper_page_flip(struct drm_crtc *crtc,
 				uint32_t flags);
 int drm_atomic_helper_connector_dpms(struct drm_connector *connector,
 				     int mode);
+struct drm_encoder *
+drm_atomic_helper_best_encoder(struct drm_connector *connector);
 
 /* default implementations for state handling */
 void drm_atomic_helper_crtc_reset(struct drm_crtc *crtc);
-- 
2.8.2

[toc] | [prev] | [next] | [standalone]


#1399361 — Re: [PATCH v2 5/6] drm/atomic: Add drm_atomic_helper_best_encoder()

FromDaniel Vetter <daniel@ffwll.ch>
Date2016-05-11 19:00 +0200
SubjectRe: [PATCH v2 5/6] drm/atomic: Add drm_atomic_helper_best_encoder()
Message-ID<rxFEm-3D1-11@gated-at.bofh.it>
In reply to#1399311
On Wed, May 11, 2016 at 06:09:21PM +0200, Noralf Trønnes wrote:
> Add (struct drm_connector_helper_funcs *)->best_encoder callback helper
> for connectors that support exactly 1 encoder, statically determined at
> driver init time.
> 
> Signed-off-by: Noralf Trønnes <noralf@tronnes.org>

Applied to drm-misc, thanks.
-Daniel

> ---
>  drivers/gpu/drm/drm_atomic_helper.c | 17 +++++++++++++++++
>  include/drm/drm_atomic_helper.h     |  2 ++
>  2 files changed, 19 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
> index 46a3201..43a0b3d 100644
> --- a/drivers/gpu/drm/drm_atomic_helper.c
> +++ b/drivers/gpu/drm/drm_atomic_helper.c
> @@ -2483,6 +2483,23 @@ backoff:
>  EXPORT_SYMBOL(drm_atomic_helper_connector_dpms);
>  
>  /**
> + * drm_atomic_helper_best_encoder - Helper for &drm_connector_helper_funcs
> + *                                  ->best_encoder callback
> + * @connector: Connector control structure
> + *
> + * This is a &drm_connector_helper_funcs ->best_encoder callback helper for
> + * connectors that support exactly 1 encoder, statically determined at driver
> + * init time.
> + */
> +struct drm_encoder *
> +drm_atomic_helper_best_encoder(struct drm_connector *connector)
> +{
> +	WARN_ON(connector->encoder_ids[1]);
> +	return drm_encoder_find(connector->dev, connector->encoder_ids[0]);
> +}
> +EXPORT_SYMBOL(drm_atomic_helper_best_encoder);
> +
> +/**
>   * DOC: atomic state reset and initialization
>   *
>   * Both the drm core and the atomic helpers assume that there is always the full
> diff --git a/include/drm/drm_atomic_helper.h b/include/drm/drm_atomic_helper.h
> index 0364287..ccca709 100644
> --- a/include/drm/drm_atomic_helper.h
> +++ b/include/drm/drm_atomic_helper.h
> @@ -110,6 +110,8 @@ int drm_atomic_helper_page_flip(struct drm_crtc *crtc,
>  				uint32_t flags);
>  int drm_atomic_helper_connector_dpms(struct drm_connector *connector,
>  				     int mode);
> +struct drm_encoder *
> +drm_atomic_helper_best_encoder(struct drm_connector *connector);
>  
>  /* default implementations for state handling */
>  void drm_atomic_helper_crtc_reset(struct drm_crtc *crtc);
> -- 
> 2.8.2
> 

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

[toc] | [prev] | [next] | [standalone]


#1399312 — [PATCH v2 2/6] drm/fb-cma-helper: Hook up to DocBook and fix some docs

FromNoralf Trønnes <noralf@tronnes.org>
Date2016-05-11 18:20 +0200
Subject[PATCH v2 2/6] drm/fb-cma-helper: Hook up to DocBook and fix some docs
Message-ID<rxF1E-3io-15@gated-at.bofh.it>
In reply to#1399308
Hook up fb_cma_helper to DocBook. Remove mention of
CONFIG_FB_DEFERRED_IO in the docs, which was forgotten in the latest
version of the deferred_io patch.
Use & when referencing drm_mode_config_funcs in docs.

Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
---
 Documentation/DocBook/gpu.tmpl      | 5 +++++
 drivers/gpu/drm/drm_fb_cma_helper.c | 8 +++-----
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/Documentation/DocBook/gpu.tmpl b/Documentation/DocBook/gpu.tmpl
index 9dd48f7..4a0c599 100644
--- a/Documentation/DocBook/gpu.tmpl
+++ b/Documentation/DocBook/gpu.tmpl
@@ -1617,6 +1617,11 @@ void intel_crt_init(struct drm_device *dev)
 !Iinclude/drm/drm_fb_helper.h
     </sect2>
     <sect2>
+      <title>Framebuffer CMA Helper Functions Reference</title>
+!Pdrivers/gpu/drm/drm_fb_cma_helper.c framebuffer cma helper functions
+!Edrivers/gpu/drm/drm_fb_cma_helper.c
+    </sect2>
+    <sect2>
       <title>Display Port Helper Functions Reference</title>
 !Pdrivers/gpu/drm/drm_dp_helper.c dp helpers
 !Iinclude/drm/drm_dp_helper.h
diff --git a/drivers/gpu/drm/drm_fb_cma_helper.c b/drivers/gpu/drm/drm_fb_cma_helper.c
index 086f600..3165ac0 100644
--- a/drivers/gpu/drm/drm_fb_cma_helper.c
+++ b/drivers/gpu/drm/drm_fb_cma_helper.c
@@ -43,14 +43,12 @@ struct drm_fbdev_cma {
  * Provides helper functions for creating a cma (contiguous memory allocator)
  * backed framebuffer.
  *
- * drm_fb_cma_create() is used in the
- * (struct drm_mode_config_funcs *)->fb_create callback function to create the
- * cma backed framebuffer.
+ * drm_fb_cma_create() is used in the &drm_mode_config_funcs ->fb_create
+ * callback function to create a cma backed framebuffer.
  *
  * An fbdev framebuffer backed by cma is also available by calling
  * drm_fbdev_cma_init(). drm_fbdev_cma_fini() tears it down.
- * If CONFIG_FB_DEFERRED_IO is enabled and the callback
- * (struct drm_framebuffer_funcs)->dirty is set, fb_deferred_io
+ * If the &drm_framebuffer_funcs ->dirty callback is set, fb_deferred_io
  * will be set up automatically. dirty() is called by
  * drm_fb_helper_deferred_io() in process context (struct delayed_work).
  *
-- 
2.8.2

[toc] | [prev] | [next] | [standalone]


#1399351 — Re: [PATCH v2 2/6] drm/fb-cma-helper: Hook up to DocBook and fix some docs

FromDaniel Vetter <daniel@ffwll.ch>
Date2016-05-11 18:50 +0200
SubjectRe: [PATCH v2 2/6] drm/fb-cma-helper: Hook up to DocBook and fix some docs
Message-ID<rxFuG-3yH-1@gated-at.bofh.it>
In reply to#1399312
On Wed, May 11, 2016 at 06:09:18PM +0200, Noralf Trønnes wrote:
> Hook up fb_cma_helper to DocBook. Remove mention of
> CONFIG_FB_DEFERRED_IO in the docs, which was forgotten in the latest
> version of the deferred_io patch.
> Use & when referencing drm_mode_config_funcs in docs.
> 
> Signed-off-by: Noralf Trønnes <noralf@tronnes.org>

First two patches applied to drm-misc, thanks.
-Daniel

> ---
>  Documentation/DocBook/gpu.tmpl      | 5 +++++
>  drivers/gpu/drm/drm_fb_cma_helper.c | 8 +++-----
>  2 files changed, 8 insertions(+), 5 deletions(-)
> 
> diff --git a/Documentation/DocBook/gpu.tmpl b/Documentation/DocBook/gpu.tmpl
> index 9dd48f7..4a0c599 100644
> --- a/Documentation/DocBook/gpu.tmpl
> +++ b/Documentation/DocBook/gpu.tmpl
> @@ -1617,6 +1617,11 @@ void intel_crt_init(struct drm_device *dev)
>  !Iinclude/drm/drm_fb_helper.h
>      </sect2>
>      <sect2>
> +      <title>Framebuffer CMA Helper Functions Reference</title>
> +!Pdrivers/gpu/drm/drm_fb_cma_helper.c framebuffer cma helper functions
> +!Edrivers/gpu/drm/drm_fb_cma_helper.c
> +    </sect2>
> +    <sect2>
>        <title>Display Port Helper Functions Reference</title>
>  !Pdrivers/gpu/drm/drm_dp_helper.c dp helpers
>  !Iinclude/drm/drm_dp_helper.h
> diff --git a/drivers/gpu/drm/drm_fb_cma_helper.c b/drivers/gpu/drm/drm_fb_cma_helper.c
> index 086f600..3165ac0 100644
> --- a/drivers/gpu/drm/drm_fb_cma_helper.c
> +++ b/drivers/gpu/drm/drm_fb_cma_helper.c
> @@ -43,14 +43,12 @@ struct drm_fbdev_cma {
>   * Provides helper functions for creating a cma (contiguous memory allocator)
>   * backed framebuffer.
>   *
> - * drm_fb_cma_create() is used in the
> - * (struct drm_mode_config_funcs *)->fb_create callback function to create the
> - * cma backed framebuffer.
> + * drm_fb_cma_create() is used in the &drm_mode_config_funcs ->fb_create
> + * callback function to create a cma backed framebuffer.
>   *
>   * An fbdev framebuffer backed by cma is also available by calling
>   * drm_fbdev_cma_init(). drm_fbdev_cma_fini() tears it down.
> - * If CONFIG_FB_DEFERRED_IO is enabled and the callback
> - * (struct drm_framebuffer_funcs)->dirty is set, fb_deferred_io
> + * If the &drm_framebuffer_funcs ->dirty callback is set, fb_deferred_io
>   * will be set up automatically. dirty() is called by
>   * drm_fb_helper_deferred_io() in process context (struct delayed_work).
>   *
> -- 
> 2.8.2
> 

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

[toc] | [prev] | [next] | [standalone]


#1399315 — [PATCH v2 3/6] drm/fb-cma-helper: Add function drm_fb_cma_create_with_funcs()

FromNoralf Trønnes <noralf@tronnes.org>
Date2016-05-11 18:20 +0200
Subject[PATCH v2 3/6] drm/fb-cma-helper: Add function drm_fb_cma_create_with_funcs()
Message-ID<rxF1F-3io-29@gated-at.bofh.it>
In reply to#1399308
Add drm_fb_cma_create_with_funcs() for drivers that need to set the
dirty() callback.

Cc: laurent.pinchart@ideasonboard.com
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
---

Changes since v1:
- Expand docs

 drivers/gpu/drm/drm_fb_cma_helper.c | 31 +++++++++++++++++++++++++------
 include/drm/drm_fb_cma_helper.h     |  3 +++
 2 files changed, 28 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/drm_fb_cma_helper.c b/drivers/gpu/drm/drm_fb_cma_helper.c
index 3165ac0..ede77c9 100644
--- a/drivers/gpu/drm/drm_fb_cma_helper.c
+++ b/drivers/gpu/drm/drm_fb_cma_helper.c
@@ -159,13 +159,17 @@ static struct drm_fb_cma *drm_fb_cma_alloc(struct drm_device *dev,
 }

 /**
- * drm_fb_cma_create() - (struct drm_mode_config_funcs *)->fb_create callback function
+ * drm_fb_cma_create_with_funcs() - helper function for the
+ *                                  &drm_mode_config_funcs ->fb_create
+ *                                  callback function
  *
- * If your hardware has special alignment or pitch requirements these should be
- * checked before calling this function.
+ * This can be used to set &drm_framebuffer_funcs for drivers that need the
+ * dirty() callback. Use drm_fb_cma_create() if you don't need to change
+ * &drm_framebuffer_funcs.
  */
-struct drm_framebuffer *drm_fb_cma_create(struct drm_device *dev,
-	struct drm_file *file_priv, const struct drm_mode_fb_cmd2 *mode_cmd)
+struct drm_framebuffer *drm_fb_cma_create_with_funcs(struct drm_device *dev,
+	struct drm_file *file_priv, const struct drm_mode_fb_cmd2 *mode_cmd,
+	struct drm_framebuffer_funcs *funcs)
 {
 	struct drm_fb_cma *fb_cma;
 	struct drm_gem_cma_object *objs[4];
@@ -202,7 +206,7 @@ struct drm_framebuffer *drm_fb_cma_create(struct drm_device *dev,
 		objs[i] = to_drm_gem_cma_obj(obj);
 	}

-	fb_cma = drm_fb_cma_alloc(dev, mode_cmd, objs, i, &drm_fb_cma_funcs);
+	fb_cma = drm_fb_cma_alloc(dev, mode_cmd, objs, i, funcs);
 	if (IS_ERR(fb_cma)) {
 		ret = PTR_ERR(fb_cma);
 		goto err_gem_object_unreference;
@@ -215,6 +219,21 @@ err_gem_object_unreference:
 		drm_gem_object_unreference_unlocked(&objs[i]->base);
 	return ERR_PTR(ret);
 }
+EXPORT_SYMBOL_GPL(drm_fb_cma_create_with_funcs);
+
+/**
+ * drm_fb_cma_create() - &drm_mode_config_funcs ->fb_create callback function
+ *
+ * If your hardware has special alignment or pitch requirements these should be
+ * checked before calling this function. Use drm_fb_cma_create_with_funcs() if
+ * you need to set &drm_framebuffer_funcs ->dirty.
+ */
+struct drm_framebuffer *drm_fb_cma_create(struct drm_device *dev,
+	struct drm_file *file_priv, const struct drm_mode_fb_cmd2 *mode_cmd)
+{
+	return drm_fb_cma_create_with_funcs(dev, file_priv, mode_cmd,
+					    &drm_fb_cma_funcs);
+}
 EXPORT_SYMBOL_GPL(drm_fb_cma_create);

 /**
diff --git a/include/drm/drm_fb_cma_helper.h b/include/drm/drm_fb_cma_helper.h
index c6d9c9c..1f9a8bc 100644
--- a/include/drm/drm_fb_cma_helper.h
+++ b/include/drm/drm_fb_cma_helper.h
@@ -31,6 +31,9 @@ void drm_fb_cma_destroy(struct drm_framebuffer *fb);
 int drm_fb_cma_create_handle(struct drm_framebuffer *fb,
 	struct drm_file *file_priv, unsigned int *handle);

+struct drm_framebuffer *drm_fb_cma_create_with_funcs(struct drm_device *dev,
+	struct drm_file *file_priv, const struct drm_mode_fb_cmd2 *mode_cmd,
+	struct drm_framebuffer_funcs *funcs);
 struct drm_framebuffer *drm_fb_cma_create(struct drm_device *dev,
 	struct drm_file *file_priv, const struct drm_mode_fb_cmd2 *mode_cmd);

--
2.8.2

[toc] | [prev] | [next] | [standalone]


#1399317 — [PATCH v2 1/6] drm/fb-helper: Remove mention of CONFIG_FB_DEFERRED_IO in docs

FromNoralf Trønnes <noralf@tronnes.org>
Date2016-05-11 18:20 +0200
Subject[PATCH v2 1/6] drm/fb-helper: Remove mention of CONFIG_FB_DEFERRED_IO in docs
Message-ID<rxF1F-3io-37@gated-at.bofh.it>
In reply to#1399308
This was forgotten to fixup in the latest version of the deferred_io
patch which made FB_DEFERRED_IO mandatory.

Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
---
 drivers/gpu/drm/drm_fb_helper.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 385284b..e03f8ad 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -85,14 +85,14 @@ static LIST_HEAD(kernel_fb_helper_list);
  * should call drm_fb_helper_single_add_all_connectors() followed by
  * drm_fb_helper_initial_config().
  *
- * If CONFIG_FB_DEFERRED_IO is enabled and &drm_framebuffer_funcs ->dirty is
- * set, the drm_fb_helper_{cfb,sys}_{write,fillrect,copyarea,imageblit}
- * functions will accumulate changes and schedule &fb_helper .dirty_work to run
- * right away. This worker then calls the dirty() function ensuring that it
- * will always run in process context since the fb_*() function could be
- * running in atomic context. If drm_fb_helper_deferred_io() is used as the
- * deferred_io callback it will also schedule dirty_work with the damage
- * collected from the mmap page writes.
+ * If &drm_framebuffer_funcs ->dirty is set, the
+ * drm_fb_helper_{cfb,sys}_{write,fillrect,copyarea,imageblit} functions will
+ * accumulate changes and schedule &drm_fb_helper ->dirty_work to run right
+ * away. This worker then calls the dirty() function ensuring that it will
+ * always run in process context since the fb_*() function could be running in
+ * atomic context. If drm_fb_helper_deferred_io() is used as the deferred_io
+ * callback it will also schedule dirty_work with the damage collected from the
+ * mmap page writes.
  */
 
 /**
-- 
2.8.2

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web