Re: [Freedreno] [PATCH 03/13] drm: Add drm_puts() to complement drm_printf()

2018-07-24 Thread Emil Velikov
Hi Jordan,

I might be a bit late for the party, so consider the following jfyi.

On 24 July 2018 at 17:33, Jordan Crouse  wrote:

> +void drm_puts(struct drm_printer *p, const char *str)
One could easily use the compiler to detect if drm_printf or drm_puts
should be used. See the trace_printk define in include/linux/kernel.h.

> +{
> +   if (p->puts)
> +   p->puts(p, str);
> +   else
> +   drm_printf(p, "%s", str);

From a quick look from the existing three printers (seq_file, info and
debug) only the first one is updated with this series.
I would imagine that updating the other two and dropping the
drm_printf() fallback is a good move.

Otherwise one could easily assume that they have a fast path when they do not.

HTH
Emil
___
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno


Re: [Freedreno] [PATCH 03/13] drm: Add drm_puts() to complement drm_printf()

2018-07-12 Thread Daniel Vetter
On Thu, Jul 12, 2018 at 12:59:20PM -0600, Jordan Crouse wrote:
> Add drm_puts() for a much faster path to print constant strings
> into a drm_printer object with memcpy and friends. This can
> shave seconds off of really large outputs such as GPU dumps.
> 
> If the drm_printer object supports a custom puts function then
> use that otherwise fall back to the slower legacy printf call.
> 
> Signed-off-by: Jordan Crouse 
> ---
>  drivers/gpu/drm/drm_print.c | 9 +
>  include/drm/drm_print.h | 2 ++
>  2 files changed, 11 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_print.c b/drivers/gpu/drm/drm_print.c
> index 03d1f98e5ac7..8fd489248a50 100644
> --- a/drivers/gpu/drm/drm_print.c
> +++ b/drivers/gpu/drm/drm_print.c
> @@ -122,6 +122,15 @@ void __drm_printfn_debug(struct drm_printer *p, struct 
> va_format *vaf)
>  }
>  EXPORT_SYMBOL(__drm_printfn_debug);
>  

Please some small kerneldoc here, with that

Reviewed-by: Daniel Vetter 

btw want commit rights for drm-misc for stuff like this?
-Daniel

> +void drm_puts(struct drm_printer *p, const char *str)
> +{
> + if (p->puts)
> + p->puts(p, str);
> + else
> + drm_printf(p, "%s", str);
> +}
> +EXPORT_SYMBOL(drm_puts);
> +
>  /**
>   * drm_printf - print to a _printer stream
>   * @p: the _printer
> diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h
> index 0ea440fb5ec3..b16f4ecaa984 100644
> --- a/include/drm/drm_print.h
> +++ b/include/drm/drm_print.h
> @@ -69,6 +69,7 @@
>  struct drm_printer {
>   /* private: */
>   void (*printfn)(struct drm_printer *p, struct va_format *vaf);
> + void (*puts)(struct drm_printer *p, const char *str);
>   void *arg;
>   const char *prefix;
>  };
> @@ -80,6 +81,7 @@ void __drm_printfn_debug(struct drm_printer *p, struct 
> va_format *vaf);
>  
>  __printf(2, 3)
>  void drm_printf(struct drm_printer *p, const char *f, ...);
> +void drm_puts(struct drm_printer *p, const char *str);
>  
>  __printf(2, 0)
>  /**
> -- 
> 2.17.1
> 
> ___
> dri-devel mailing list
> dri-de...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
___
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno


[Freedreno] [PATCH 03/13] drm: Add drm_puts() to complement drm_printf()

2018-07-12 Thread Jordan Crouse
Add drm_puts() for a much faster path to print constant strings
into a drm_printer object with memcpy and friends. This can
shave seconds off of really large outputs such as GPU dumps.

If the drm_printer object supports a custom puts function then
use that otherwise fall back to the slower legacy printf call.

Signed-off-by: Jordan Crouse 
---
 drivers/gpu/drm/drm_print.c | 9 +
 include/drm/drm_print.h | 2 ++
 2 files changed, 11 insertions(+)

diff --git a/drivers/gpu/drm/drm_print.c b/drivers/gpu/drm/drm_print.c
index 03d1f98e5ac7..8fd489248a50 100644
--- a/drivers/gpu/drm/drm_print.c
+++ b/drivers/gpu/drm/drm_print.c
@@ -122,6 +122,15 @@ void __drm_printfn_debug(struct drm_printer *p, struct 
va_format *vaf)
 }
 EXPORT_SYMBOL(__drm_printfn_debug);
 
+void drm_puts(struct drm_printer *p, const char *str)
+{
+   if (p->puts)
+   p->puts(p, str);
+   else
+   drm_printf(p, "%s", str);
+}
+EXPORT_SYMBOL(drm_puts);
+
 /**
  * drm_printf - print to a _printer stream
  * @p: the _printer
diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h
index 0ea440fb5ec3..b16f4ecaa984 100644
--- a/include/drm/drm_print.h
+++ b/include/drm/drm_print.h
@@ -69,6 +69,7 @@
 struct drm_printer {
/* private: */
void (*printfn)(struct drm_printer *p, struct va_format *vaf);
+   void (*puts)(struct drm_printer *p, const char *str);
void *arg;
const char *prefix;
 };
@@ -80,6 +81,7 @@ void __drm_printfn_debug(struct drm_printer *p, struct 
va_format *vaf);
 
 __printf(2, 3)
 void drm_printf(struct drm_printer *p, const char *f, ...);
+void drm_puts(struct drm_printer *p, const char *str);
 
 __printf(2, 0)
 /**
-- 
2.17.1

___
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno


[Freedreno] [PATCH 03/13] drm: Add drm_puts() to complement drm_printf()

2018-06-29 Thread Jordan Crouse
Add drm_puts() for a much faster path to print constant strings
into a drm_printer object with memcpy and friends. This can
shave seconds off of really large outputs such as GPU dumps.

If the drm_printer object supports a custom puts function then
use that otherwise fall back to the slower legacy printf call.

Signed-off-by: Jordan Crouse 
---
 drivers/gpu/drm/drm_print.c | 9 +
 include/drm/drm_print.h | 2 ++
 2 files changed, 11 insertions(+)

diff --git a/drivers/gpu/drm/drm_print.c b/drivers/gpu/drm/drm_print.c
index 03d1f98e5ac7..8fd489248a50 100644
--- a/drivers/gpu/drm/drm_print.c
+++ b/drivers/gpu/drm/drm_print.c
@@ -122,6 +122,15 @@ void __drm_printfn_debug(struct drm_printer *p, struct 
va_format *vaf)
 }
 EXPORT_SYMBOL(__drm_printfn_debug);
 
+void drm_puts(struct drm_printer *p, const char *str)
+{
+   if (p->puts)
+   p->puts(p, str);
+   else
+   drm_printf(p, "%s", str);
+}
+EXPORT_SYMBOL(drm_puts);
+
 /**
  * drm_printf - print to a _printer stream
  * @p: the _printer
diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h
index 0ea440fb5ec3..b16f4ecaa984 100644
--- a/include/drm/drm_print.h
+++ b/include/drm/drm_print.h
@@ -69,6 +69,7 @@
 struct drm_printer {
/* private: */
void (*printfn)(struct drm_printer *p, struct va_format *vaf);
+   void (*puts)(struct drm_printer *p, const char *str);
void *arg;
const char *prefix;
 };
@@ -80,6 +81,7 @@ void __drm_printfn_debug(struct drm_printer *p, struct 
va_format *vaf);
 
 __printf(2, 3)
 void drm_printf(struct drm_printer *p, const char *f, ...);
+void drm_puts(struct drm_printer *p, const char *str);
 
 __printf(2, 0)
 /**
-- 
2.17.1

___
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno