Re: [PATCH 2/9] drm: Move simple_display_pipe prepare_fb helper into gem fb helpers

2018-04-09 Thread Oleksandr Andrushchenko

On 04/05/2018 06:44 PM, Daniel Vetter wrote:

There's nothing tinydrm specific to this, and there's a few more
copies of the same in various other drivers.

Signed-off-by: Daniel Vetter 
Cc: Gustavo Padovan 
Cc: Maarten Lankhorst 
Cc: Sean Paul 
Cc: David Airlie 
Cc: David Lechner 
Cc: "Noralf Trønnes" 
Cc: Daniel Vetter 
Cc: Shawn Guo 
Cc: Neil Armstrong 
Cc: Daniel Stone 
Cc: Haneen Mohammed 
Cc: Ben Widawsky 
Cc: "Ville Syrjälä" 
---
  drivers/gpu/drm/drm_gem_framebuffer_helper.c | 19 +++
  drivers/gpu/drm/tinydrm/core/tinydrm-pipe.c  | 17 -
  drivers/gpu/drm/tinydrm/ili9225.c|  2 +-
  drivers/gpu/drm/tinydrm/mi0283qt.c   |  3 ++-
  drivers/gpu/drm/tinydrm/repaper.c|  2 +-
  drivers/gpu/drm/tinydrm/st7586.c |  2 +-
  drivers/gpu/drm/tinydrm/st7735r.c|  2 +-
  include/drm/drm_gem_framebuffer_helper.h |  3 +++
  include/drm/drm_simple_kms_helper.h  |  3 +++
  include/drm/tinydrm/tinydrm.h|  2 --
  10 files changed, 31 insertions(+), 24 deletions(-)

Reviewed-by: Oleksandr Andrushchenko 

diff --git a/drivers/gpu/drm/drm_gem_framebuffer_helper.c 
b/drivers/gpu/drm/drm_gem_framebuffer_helper.c
index 4d682a6e8bcb..acfbc0641a06 100644
--- a/drivers/gpu/drm/drm_gem_framebuffer_helper.c
+++ b/drivers/gpu/drm/drm_gem_framebuffer_helper.c
@@ -22,6 +22,7 @@
  #include 
  #include 
  #include 
+#include 
  
  /**

   * DOC: overview
@@ -265,6 +266,24 @@ int drm_gem_fb_prepare_fb(struct drm_plane *plane,
  }
  EXPORT_SYMBOL_GPL(drm_gem_fb_prepare_fb);
  
+/**

+ * drm_gem_fb_simple_display_pipe_prepare_fb - prepare_fb helper for
+ * &drm_simple_display_pipe
+ * @pipe: Simple display pipe
+ * @plane_state: Plane state
+ *
+ * This function uses drm_gem_fb_prepare_fb() to check if the plane FB has a
+ * &dma_buf attached, extracts the exclusive fence and attaches it to plane
+ * state for the atomic helper to wait on. Drivers can use this as their
+ * &drm_simple_display_pipe_funcs.prepare_fb callback.
+ */
+int drm_gem_fb_simple_display_pipe_prepare_fb(struct drm_simple_display_pipe 
*pipe,
+ struct drm_plane_state 
*plane_state)
+{
+   return drm_gem_fb_prepare_fb(&pipe->plane, plane_state);
+}
+EXPORT_SYMBOL(drm_gem_fb_simple_display_pipe_prepare_fb);
+
  /**
   * drm_gem_fbdev_fb_create - Create a GEM backed &drm_framebuffer for fbdev
   *   emulation
diff --git a/drivers/gpu/drm/tinydrm/core/tinydrm-pipe.c 
b/drivers/gpu/drm/tinydrm/core/tinydrm-pipe.c
index e68b528ae64d..7e8e24d0b7a7 100644
--- a/drivers/gpu/drm/tinydrm/core/tinydrm-pipe.c
+++ b/drivers/gpu/drm/tinydrm/core/tinydrm-pipe.c
@@ -138,23 +138,6 @@ void tinydrm_display_pipe_update(struct 
drm_simple_display_pipe *pipe,
  }
  EXPORT_SYMBOL(tinydrm_display_pipe_update);
  
-/**

- * tinydrm_display_pipe_prepare_fb - Display pipe prepare_fb helper
- * @pipe: Simple display pipe
- * @plane_state: Plane state
- *
- * This function uses drm_gem_fb_prepare_fb() to check if the plane FB has an
- * dma-buf attached, extracts the exclusive fence and attaches it to plane
- * state for the atomic helper to wait on. Drivers can use this as their
- * &drm_simple_display_pipe_funcs->prepare_fb callback.
- */
-int tinydrm_display_pipe_prepare_fb(struct drm_simple_display_pipe *pipe,
-   struct drm_plane_state *plane_state)
-{
-   return drm_gem_fb_prepare_fb(&pipe->plane, plane_state);
-}
-EXPORT_SYMBOL(tinydrm_display_pipe_prepare_fb);
-
  static int tinydrm_rotate_mode(struct drm_display_mode *mode,
   unsigned int rotation)
  {
diff --git a/drivers/gpu/drm/tinydrm/ili9225.c 
b/drivers/gpu/drm/tinydrm/ili9225.c
index 0874e877b111..841c69aba059 100644
--- a/drivers/gpu/drm/tinydrm/ili9225.c
+++ b/drivers/gpu/drm/tinydrm/ili9225.c
@@ -354,7 +354,7 @@ static const struct drm_simple_display_pipe_funcs 
ili9225_pipe_funcs = {
.enable = ili9225_pipe_enable,
.disable= ili9225_pipe_disable,
.update = tinydrm_display_pipe_update,
-   .prepare_fb = tinydrm_display_pipe_prepare_fb,
+   .prepare_fb = drm_gem_fb_simple_display_pipe_prepare_fb,
  };
  
  static const struct drm_display_mode ili9225_mode = {

diff --git a/drivers/gpu/drm/tinydrm/mi0283qt.c 
b/drivers/gpu/drm/tinydrm/mi0283qt.c
index 4e6d2ee94e55..d5ef65179c16 100644
--- a/drivers/gpu/drm/tinydrm/mi0283qt.c
+++ b/drivers/gpu/drm/tinydrm/mi0283qt.c
@@ -19,6 +19,7 @@
  
  #include 

  #include 
+#include 
  #include 
  #include 
  #include 
@@ -134,7 +135,7 @@ static const struct drm_simple_display_pipe_funcs 
mi0283qt_pipe_funcs = {
.enable = mi0283qt_enable,
.disable = mipi_dbi_pipe_disable,
.update = tinydrm_display_pipe_update,
-   .prepare_fb = tinydrm_display_pipe_prepare_fb,
+   .prepare_fb = drm_gem_fb_simple_display_pipe_prepare_fb,
  };
  
  static const struc

Re: [PATCH 2/9] drm: Move simple_display_pipe prepare_fb helper into gem fb helpers

2018-04-09 Thread David Lechner

On 04/05/2018 10:44 AM, Daniel Vetter wrote:

There's nothing tinydrm specific to this, and there's a few more
copies of the same in various other drivers.

Signed-off-by: Daniel Vetter 
Cc: Gustavo Padovan 
Cc: Maarten Lankhorst 
Cc: Sean Paul 
Cc: David Airlie 
Cc: David Lechner 
Cc: "Noralf Trønnes" 
Cc: Daniel Vetter 
Cc: Shawn Guo 
Cc: Neil Armstrong 
Cc: Daniel Stone 
Cc: Haneen Mohammed 
Cc: Ben Widawsky 
Cc: "Ville Syrjälä" 
---


Acked-by: David Lechner 


___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 2/9] drm: Move simple_display_pipe prepare_fb helper into gem fb helpers

2018-04-09 Thread Daniel Vetter
On Fri, Apr 06, 2018 at 11:42:42AM +0200, Noralf Trønnes wrote:
> 
> Den 05.04.2018 17.44, skrev Daniel Vetter:
> > There's nothing tinydrm specific to this, and there's a few more
> > copies of the same in various other drivers.
> > 
> > Signed-off-by: Daniel Vetter 
> > Cc: Gustavo Padovan 
> > Cc: Maarten Lankhorst 
> > Cc: Sean Paul 
> > Cc: David Airlie 
> > Cc: David Lechner 
> > Cc: "Noralf Trønnes" 
> > Cc: Daniel Vetter 
> > Cc: Shawn Guo 
> > Cc: Neil Armstrong 
> > Cc: Daniel Stone 
> > Cc: Haneen Mohammed 
> > Cc: Ben Widawsky 
> > Cc: "Ville Syrjälä" 
> > ---
> >   drivers/gpu/drm/drm_gem_framebuffer_helper.c | 19 +++
> >   drivers/gpu/drm/tinydrm/core/tinydrm-pipe.c  | 17 -
> >   drivers/gpu/drm/tinydrm/ili9225.c|  2 +-
> >   drivers/gpu/drm/tinydrm/mi0283qt.c   |  3 ++-
> >   drivers/gpu/drm/tinydrm/repaper.c|  2 +-
> >   drivers/gpu/drm/tinydrm/st7586.c |  2 +-
> >   drivers/gpu/drm/tinydrm/st7735r.c|  2 +-
> >   include/drm/drm_gem_framebuffer_helper.h |  3 +++
> >   include/drm/drm_simple_kms_helper.h  |  3 +++
> >   include/drm/tinydrm/tinydrm.h|  2 --
> >   10 files changed, 31 insertions(+), 24 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/drm_gem_framebuffer_helper.c 
> > b/drivers/gpu/drm/drm_gem_framebuffer_helper.c
> > index 4d682a6e8bcb..acfbc0641a06 100644
> > --- a/drivers/gpu/drm/drm_gem_framebuffer_helper.c
> > +++ b/drivers/gpu/drm/drm_gem_framebuffer_helper.c
> > @@ -22,6 +22,7 @@
> >   #include 
> >   #include 
> >   #include 
> > +#include 
> >   /**
> >* DOC: overview
> > @@ -265,6 +266,24 @@ int drm_gem_fb_prepare_fb(struct drm_plane *plane,
> >   }
> >   EXPORT_SYMBOL_GPL(drm_gem_fb_prepare_fb);
> > +/**
> > + * drm_gem_fb_simple_display_pipe_prepare_fb - prepare_fb helper for
> > + * &drm_simple_display_pipe
> > + * @pipe: Simple display pipe
> > + * @plane_state: Plane state
> > + *
> > + * This function uses drm_gem_fb_prepare_fb() to check if the plane FB has 
> > a
> > + * &dma_buf attached, extracts the exclusive fence and attaches it to plane
> > + * state for the atomic helper to wait on. Drivers can use this as their
> > + * &drm_simple_display_pipe_funcs.prepare_fb callback.
> > + */
> > +int drm_gem_fb_simple_display_pipe_prepare_fb(struct 
> > drm_simple_display_pipe *pipe,
> > + struct drm_plane_state 
> > *plane_state)
> > +{
> > +   return drm_gem_fb_prepare_fb(&pipe->plane, plane_state);
> > +}
> > +EXPORT_SYMBOL(drm_gem_fb_simple_display_pipe_prepare_fb);
> > +
> 
> I was suprised that you didn't put this function in drm_simple_kms_helper.c.
> Anyways, thanks for slimming down tinydrm.

It was a coin toss between that and the gem helpers. I tossed for gem :-)

> Reviewed-by: Noralf Trønnes 

Thanks for the review, I'll pull these all in once more acks/reviews have
shown up.
-Daniel

> 
> >   /**
> >* drm_gem_fbdev_fb_create - Create a GEM backed &drm_framebuffer for 
> > fbdev
> >*   emulation
> > diff --git a/drivers/gpu/drm/tinydrm/core/tinydrm-pipe.c 
> > b/drivers/gpu/drm/tinydrm/core/tinydrm-pipe.c
> > index e68b528ae64d..7e8e24d0b7a7 100644
> > --- a/drivers/gpu/drm/tinydrm/core/tinydrm-pipe.c
> > +++ b/drivers/gpu/drm/tinydrm/core/tinydrm-pipe.c
> > @@ -138,23 +138,6 @@ void tinydrm_display_pipe_update(struct 
> > drm_simple_display_pipe *pipe,
> >   }
> >   EXPORT_SYMBOL(tinydrm_display_pipe_update);
> > -/**
> > - * tinydrm_display_pipe_prepare_fb - Display pipe prepare_fb helper
> > - * @pipe: Simple display pipe
> > - * @plane_state: Plane state
> > - *
> > - * This function uses drm_gem_fb_prepare_fb() to check if the plane FB has 
> > an
> > - * dma-buf attached, extracts the exclusive fence and attaches it to plane
> > - * state for the atomic helper to wait on. Drivers can use this as their
> > - * &drm_simple_display_pipe_funcs->prepare_fb callback.
> > - */
> > -int tinydrm_display_pipe_prepare_fb(struct drm_simple_display_pipe *pipe,
> > -   struct drm_plane_state *plane_state)
> > -{
> > -   return drm_gem_fb_prepare_fb(&pipe->plane, plane_state);
> > -}
> > -EXPORT_SYMBOL(tinydrm_display_pipe_prepare_fb);
> > -
> >   static int tinydrm_rotate_mode(struct drm_display_mode *mode,
> >unsigned int rotation)
> >   {
> > diff --git a/drivers/gpu/drm/tinydrm/ili9225.c 
> > b/drivers/gpu/drm/tinydrm/ili9225.c
> > index 0874e877b111..841c69aba059 100644
> > --- a/drivers/gpu/drm/tinydrm/ili9225.c
> > +++ b/drivers/gpu/drm/tinydrm/ili9225.c
> > @@ -354,7 +354,7 @@ static const struct drm_simple_display_pipe_funcs 
> > ili9225_pipe_funcs = {
> > .enable = ili9225_pipe_enable,
> > .disable= ili9225_pipe_disable,
> > .update = tinydrm_display_pipe_update,
> > -   .prepare_fb = tinydrm_display_pipe_prepare_fb,
> > +   .prepare_fb = drm_gem_fb_simple_di

Re: [PATCH 2/9] drm: Move simple_display_pipe prepare_fb helper into gem fb helpers

2018-04-06 Thread Noralf Trønnes


Den 05.04.2018 17.44, skrev Daniel Vetter:

There's nothing tinydrm specific to this, and there's a few more
copies of the same in various other drivers.

Signed-off-by: Daniel Vetter 
Cc: Gustavo Padovan 
Cc: Maarten Lankhorst 
Cc: Sean Paul 
Cc: David Airlie 
Cc: David Lechner 
Cc: "Noralf Trønnes" 
Cc: Daniel Vetter 
Cc: Shawn Guo 
Cc: Neil Armstrong 
Cc: Daniel Stone 
Cc: Haneen Mohammed 
Cc: Ben Widawsky 
Cc: "Ville Syrjälä" 
---
  drivers/gpu/drm/drm_gem_framebuffer_helper.c | 19 +++
  drivers/gpu/drm/tinydrm/core/tinydrm-pipe.c  | 17 -
  drivers/gpu/drm/tinydrm/ili9225.c|  2 +-
  drivers/gpu/drm/tinydrm/mi0283qt.c   |  3 ++-
  drivers/gpu/drm/tinydrm/repaper.c|  2 +-
  drivers/gpu/drm/tinydrm/st7586.c |  2 +-
  drivers/gpu/drm/tinydrm/st7735r.c|  2 +-
  include/drm/drm_gem_framebuffer_helper.h |  3 +++
  include/drm/drm_simple_kms_helper.h  |  3 +++
  include/drm/tinydrm/tinydrm.h|  2 --
  10 files changed, 31 insertions(+), 24 deletions(-)

diff --git a/drivers/gpu/drm/drm_gem_framebuffer_helper.c 
b/drivers/gpu/drm/drm_gem_framebuffer_helper.c
index 4d682a6e8bcb..acfbc0641a06 100644
--- a/drivers/gpu/drm/drm_gem_framebuffer_helper.c
+++ b/drivers/gpu/drm/drm_gem_framebuffer_helper.c
@@ -22,6 +22,7 @@
  #include 
  #include 
  #include 
+#include 
  
  /**

   * DOC: overview
@@ -265,6 +266,24 @@ int drm_gem_fb_prepare_fb(struct drm_plane *plane,
  }
  EXPORT_SYMBOL_GPL(drm_gem_fb_prepare_fb);
  
+/**

+ * drm_gem_fb_simple_display_pipe_prepare_fb - prepare_fb helper for
+ * &drm_simple_display_pipe
+ * @pipe: Simple display pipe
+ * @plane_state: Plane state
+ *
+ * This function uses drm_gem_fb_prepare_fb() to check if the plane FB has a
+ * &dma_buf attached, extracts the exclusive fence and attaches it to plane
+ * state for the atomic helper to wait on. Drivers can use this as their
+ * &drm_simple_display_pipe_funcs.prepare_fb callback.
+ */
+int drm_gem_fb_simple_display_pipe_prepare_fb(struct drm_simple_display_pipe 
*pipe,
+ struct drm_plane_state 
*plane_state)
+{
+   return drm_gem_fb_prepare_fb(&pipe->plane, plane_state);
+}
+EXPORT_SYMBOL(drm_gem_fb_simple_display_pipe_prepare_fb);
+


I was suprised that you didn't put this function in drm_simple_kms_helper.c.
Anyways, thanks for slimming down tinydrm.

Reviewed-by: Noralf Trønnes 


  /**
   * drm_gem_fbdev_fb_create - Create a GEM backed &drm_framebuffer for fbdev
   *   emulation
diff --git a/drivers/gpu/drm/tinydrm/core/tinydrm-pipe.c 
b/drivers/gpu/drm/tinydrm/core/tinydrm-pipe.c
index e68b528ae64d..7e8e24d0b7a7 100644
--- a/drivers/gpu/drm/tinydrm/core/tinydrm-pipe.c
+++ b/drivers/gpu/drm/tinydrm/core/tinydrm-pipe.c
@@ -138,23 +138,6 @@ void tinydrm_display_pipe_update(struct 
drm_simple_display_pipe *pipe,
  }
  EXPORT_SYMBOL(tinydrm_display_pipe_update);
  
-/**

- * tinydrm_display_pipe_prepare_fb - Display pipe prepare_fb helper
- * @pipe: Simple display pipe
- * @plane_state: Plane state
- *
- * This function uses drm_gem_fb_prepare_fb() to check if the plane FB has an
- * dma-buf attached, extracts the exclusive fence and attaches it to plane
- * state for the atomic helper to wait on. Drivers can use this as their
- * &drm_simple_display_pipe_funcs->prepare_fb callback.
- */
-int tinydrm_display_pipe_prepare_fb(struct drm_simple_display_pipe *pipe,
-   struct drm_plane_state *plane_state)
-{
-   return drm_gem_fb_prepare_fb(&pipe->plane, plane_state);
-}
-EXPORT_SYMBOL(tinydrm_display_pipe_prepare_fb);
-
  static int tinydrm_rotate_mode(struct drm_display_mode *mode,
   unsigned int rotation)
  {
diff --git a/drivers/gpu/drm/tinydrm/ili9225.c 
b/drivers/gpu/drm/tinydrm/ili9225.c
index 0874e877b111..841c69aba059 100644
--- a/drivers/gpu/drm/tinydrm/ili9225.c
+++ b/drivers/gpu/drm/tinydrm/ili9225.c
@@ -354,7 +354,7 @@ static const struct drm_simple_display_pipe_funcs 
ili9225_pipe_funcs = {
.enable = ili9225_pipe_enable,
.disable= ili9225_pipe_disable,
.update = tinydrm_display_pipe_update,
-   .prepare_fb = tinydrm_display_pipe_prepare_fb,
+   .prepare_fb = drm_gem_fb_simple_display_pipe_prepare_fb,
  };
  
  static const struct drm_display_mode ili9225_mode = {

diff --git a/drivers/gpu/drm/tinydrm/mi0283qt.c 
b/drivers/gpu/drm/tinydrm/mi0283qt.c
index 4e6d2ee94e55..d5ef65179c16 100644
--- a/drivers/gpu/drm/tinydrm/mi0283qt.c
+++ b/drivers/gpu/drm/tinydrm/mi0283qt.c
@@ -19,6 +19,7 @@
  
  #include 

  #include 
+#include 
  #include 
  #include 
  #include 
@@ -134,7 +135,7 @@ static const struct drm_simple_display_pipe_funcs 
mi0283qt_pipe_funcs = {
.enable = mi0283qt_enable,
.disable = mipi_dbi_pipe_disable,
.update = tinydrm_display_pipe_update,
-   .prepare_fb = tinydrm_disp