dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] drm: Finally retire struct drm_format_name_buf
@ 2021-05-16 12:13 Thomas Zimmermann
  2021-05-16 12:13 ` [PATCH 1/4] drm/amdgpu: Use %p4cc to print 4CC format Thomas Zimmermann
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Thomas Zimmermann @ 2021-05-16 12:13 UTC (permalink / raw)
  To: airlied, daniel, maarten.lankhorst, mripard, alexander.deucher,
	christian.koenig, sakari.ailus
  Cc: Thomas Zimmermann, dri-devel, amd-gfx

This is a cleanup patchset to remove drm_format_name_buf et al. There
are two instances in drivers that need to be replaced with the %4cc
printk format modifier. Patch 3 was left over back from an earlier
patchset. [1] Patch 4 removes struct drm_format_name_buf.

I built-tested with drm-tip. The patchsetcan be mered through drm-misc.

[1] https://lore.kernel.org/dri-devel/20210216155723.17109-1-sakari.ailus@linux.intel.com/

Sakari Ailus (1):
  drm: Remove drm_get_format_name()

Thomas Zimmermann (3):
  drm/amdgpu: Use %p4cc to print 4CC format
  drm/simpledrm: Use %p4cc to print 4CC format
  drm/fourcc: Remove struct drm_format_buf_name

 drivers/gpu/drm/amd/amdgpu/amdgpu_display.c |  7 ++----
 drivers/gpu/drm/drm_fourcc.c                | 25 ---------------------
 drivers/gpu/drm/tiny/simpledrm.c            |  6 ++---
 include/drm/drm_fourcc.h                    |  9 --------
 4 files changed, 4 insertions(+), 43 deletions(-)

--
2.31.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/4] drm/amdgpu: Use %p4cc to print 4CC format
  2021-05-16 12:13 [PATCH 0/4] drm: Finally retire struct drm_format_name_buf Thomas Zimmermann
@ 2021-05-16 12:13 ` Thomas Zimmermann
  2021-05-16 12:24   ` Christian König
  2021-05-16 12:13 ` [PATCH 2/4] drm/simpledrm: " Thomas Zimmermann
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 9+ messages in thread
From: Thomas Zimmermann @ 2021-05-16 12:13 UTC (permalink / raw)
  To: airlied, daniel, maarten.lankhorst, mripard, alexander.deucher,
	christian.koenig, sakari.ailus
  Cc: Thomas Zimmermann, dri-devel, amd-gfx

Replace use of struct drm_format_name_buf with %p4cc for printing
4CC formats.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
index 8a1fb8b6606e..49f73b5b89b0 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
@@ -1077,12 +1077,9 @@ int amdgpu_display_gem_fb_verify_and_init(
 	/* Verify that the modifier is supported. */
 	if (!drm_any_plane_has_format(dev, mode_cmd->pixel_format,
 				      mode_cmd->modifier[0])) {
-		struct drm_format_name_buf format_name;
 		drm_dbg_kms(dev,
-			    "unsupported pixel format %s / modifier 0x%llx\n",
-			    drm_get_format_name(mode_cmd->pixel_format,
-						&format_name),
-			    mode_cmd->modifier[0]);
+			    "unsupported pixel format %p4cc / modifier 0x%llx\n",
+			    &mode_cmd->pixel_format, mode_cmd->modifier[0]);
 
 		ret = -EINVAL;
 		goto err;
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/4] drm/simpledrm: Use %p4cc to print 4CC format
  2021-05-16 12:13 [PATCH 0/4] drm: Finally retire struct drm_format_name_buf Thomas Zimmermann
  2021-05-16 12:13 ` [PATCH 1/4] drm/amdgpu: Use %p4cc to print 4CC format Thomas Zimmermann
@ 2021-05-16 12:13 ` Thomas Zimmermann
  2021-05-16 12:13 ` [PATCH 3/4] drm: Remove drm_get_format_name() Thomas Zimmermann
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: Thomas Zimmermann @ 2021-05-16 12:13 UTC (permalink / raw)
  To: airlied, daniel, maarten.lankhorst, mripard, alexander.deucher,
	christian.koenig, sakari.ailus
  Cc: Thomas Zimmermann, dri-devel, amd-gfx

Replace use of struct drm_format_name_buf with %p4cc for printing
4CC formats.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/tiny/simpledrm.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/tiny/simpledrm.c b/drivers/gpu/drm/tiny/simpledrm.c
index ed40dde4d218..2defd5cc6c99 100644
--- a/drivers/gpu/drm/tiny/simpledrm.c
+++ b/drivers/gpu/drm/tiny/simpledrm.c
@@ -466,7 +466,6 @@ static int simpledrm_device_init_fb(struct simpledrm_device *sdev)
 {
 	int width, height, stride;
 	const struct drm_format_info *format;
-	struct drm_format_name_buf buf;
 	struct drm_device *dev = &sdev->dev;
 	struct platform_device *pdev = sdev->pdev;
 	const struct simplefb_platform_data *pd = dev_get_platdata(&pdev->dev);
@@ -510,9 +509,8 @@ static int simpledrm_device_init_fb(struct simpledrm_device *sdev)
 	drm_dbg_kms(dev, "display mode={" DRM_MODE_FMT "}\n",
 		    DRM_MODE_ARG(&sdev->mode));
 	drm_dbg_kms(dev,
-		    "framebuffer format=\"%s\", size=%dx%d, stride=%d byte\n",
-		    drm_get_format_name(format->format, &buf), width,
-		    height, stride);
+		    "framebuffer format=%p4cc, size=%dx%d, stride=%d byte\n",
+		    &format->format, width, height, stride);
 
 	return 0;
 }
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 3/4] drm: Remove drm_get_format_name()
  2021-05-16 12:13 [PATCH 0/4] drm: Finally retire struct drm_format_name_buf Thomas Zimmermann
  2021-05-16 12:13 ` [PATCH 1/4] drm/amdgpu: Use %p4cc to print 4CC format Thomas Zimmermann
  2021-05-16 12:13 ` [PATCH 2/4] drm/simpledrm: " Thomas Zimmermann
@ 2021-05-16 12:13 ` Thomas Zimmermann
  2021-05-16 12:13 ` [PATCH 4/4] drm/fourcc: Remove struct drm_format_buf_name Thomas Zimmermann
  2021-05-26 19:21 ` [PATCH 0/4] drm: Finally retire struct drm_format_name_buf Thomas Zimmermann
  4 siblings, 0 replies; 9+ messages in thread
From: Thomas Zimmermann @ 2021-05-16 12:13 UTC (permalink / raw)
  To: airlied, daniel, maarten.lankhorst, mripard, alexander.deucher,
	christian.koenig, sakari.ailus
  Cc: Petr Mladek, Andy Shevchenko, dri-devel, amd-gfx

From: Sakari Ailus <sakari.ailus@linux.intel.com>

The %p4cc printk format modifier was recently added to print fourcc codes,
replacing drm_get_format_name(). The function is no longer needed, so
remove it.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/gpu/drm/drm_fourcc.c | 25 -------------------------
 include/drm/drm_fourcc.h     |  1 -
 2 files changed, 26 deletions(-)

diff --git a/drivers/gpu/drm/drm_fourcc.c b/drivers/gpu/drm/drm_fourcc.c
index 03262472059c..5cf45aa6eedc 100644
--- a/drivers/gpu/drm/drm_fourcc.c
+++ b/drivers/gpu/drm/drm_fourcc.c
@@ -30,11 +30,6 @@
 #include <drm/drm_device.h>
 #include <drm/drm_fourcc.h>
 
-static char printable_char(int c)
-{
-	return isascii(c) && isprint(c) ? c : '?';
-}
-
 /**
  * drm_mode_legacy_fb_format - compute drm fourcc code from legacy description
  * @bpp: bits per pixels
@@ -130,26 +125,6 @@ uint32_t drm_driver_legacy_fb_format(struct drm_device *dev,
 }
 EXPORT_SYMBOL(drm_driver_legacy_fb_format);
 
-/**
- * drm_get_format_name - fill a string with a drm fourcc format's name
- * @format: format to compute name of
- * @buf: caller-supplied buffer
- */
-const char *drm_get_format_name(uint32_t format, struct drm_format_name_buf *buf)
-{
-	snprintf(buf->str, sizeof(buf->str),
-		 "%c%c%c%c %s-endian (0x%08x)",
-		 printable_char(format & 0xff),
-		 printable_char((format >> 8) & 0xff),
-		 printable_char((format >> 16) & 0xff),
-		 printable_char((format >> 24) & 0x7f),
-		 format & DRM_FORMAT_BIG_ENDIAN ? "big" : "little",
-		 format);
-
-	return buf->str;
-}
-EXPORT_SYMBOL(drm_get_format_name);
-
 /*
  * Internal function to query information for a given format. See
  * drm_format_info() for the public API.
diff --git a/include/drm/drm_fourcc.h b/include/drm/drm_fourcc.h
index 156b122c0ad5..3ea17b8a79d3 100644
--- a/include/drm/drm_fourcc.h
+++ b/include/drm/drm_fourcc.h
@@ -318,6 +318,5 @@ unsigned int drm_format_info_block_height(const struct drm_format_info *info,
 					  int plane);
 uint64_t drm_format_info_min_pitch(const struct drm_format_info *info,
 				   int plane, unsigned int buffer_width);
-const char *drm_get_format_name(uint32_t format, struct drm_format_name_buf *buf);
 
 #endif /* __DRM_FOURCC_H__ */
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 4/4] drm/fourcc: Remove struct drm_format_buf_name
  2021-05-16 12:13 [PATCH 0/4] drm: Finally retire struct drm_format_name_buf Thomas Zimmermann
                   ` (2 preceding siblings ...)
  2021-05-16 12:13 ` [PATCH 3/4] drm: Remove drm_get_format_name() Thomas Zimmermann
@ 2021-05-16 12:13 ` Thomas Zimmermann
  2021-05-26 19:21 ` [PATCH 0/4] drm: Finally retire struct drm_format_name_buf Thomas Zimmermann
  4 siblings, 0 replies; 9+ messages in thread
From: Thomas Zimmermann @ 2021-05-16 12:13 UTC (permalink / raw)
  To: airlied, daniel, maarten.lankhorst, mripard, alexander.deucher,
	christian.koenig, sakari.ailus
  Cc: Thomas Zimmermann, dri-devel, amd-gfx

The structure is unused. Remove it.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 include/drm/drm_fourcc.h | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/include/drm/drm_fourcc.h b/include/drm/drm_fourcc.h
index 3ea17b8a79d3..3b138d4ae67e 100644
--- a/include/drm/drm_fourcc.h
+++ b/include/drm/drm_fourcc.h
@@ -135,14 +135,6 @@ struct drm_format_info {
 	bool is_yuv;
 };
 
-/**
- * struct drm_format_name_buf - name of a DRM format
- * @str: string buffer containing the format name
- */
-struct drm_format_name_buf {
-	char str[32];
-};
-
 /**
  * drm_format_info_is_yuv_packed - check that the format info matches a YUV
  * format with data laid in a single plane
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/4] drm/amdgpu: Use %p4cc to print 4CC format
  2021-05-16 12:13 ` [PATCH 1/4] drm/amdgpu: Use %p4cc to print 4CC format Thomas Zimmermann
@ 2021-05-16 12:24   ` Christian König
  0 siblings, 0 replies; 9+ messages in thread
From: Christian König @ 2021-05-16 12:24 UTC (permalink / raw)
  To: Thomas Zimmermann, airlied, daniel, maarten.lankhorst, mripard,
	alexander.deucher, sakari.ailus
  Cc: dri-devel, amd-gfx

Am 16.05.21 um 14:13 schrieb Thomas Zimmermann:
> Replace use of struct drm_format_name_buf with %p4cc for printing
> 4CC formats.
>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>

Acked-by: Christian König <christian.koenig@amd.com>

> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 7 ++-----
>   1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> index 8a1fb8b6606e..49f73b5b89b0 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> @@ -1077,12 +1077,9 @@ int amdgpu_display_gem_fb_verify_and_init(
>   	/* Verify that the modifier is supported. */
>   	if (!drm_any_plane_has_format(dev, mode_cmd->pixel_format,
>   				      mode_cmd->modifier[0])) {
> -		struct drm_format_name_buf format_name;
>   		drm_dbg_kms(dev,
> -			    "unsupported pixel format %s / modifier 0x%llx\n",
> -			    drm_get_format_name(mode_cmd->pixel_format,
> -						&format_name),
> -			    mode_cmd->modifier[0]);
> +			    "unsupported pixel format %p4cc / modifier 0x%llx\n",
> +			    &mode_cmd->pixel_format, mode_cmd->modifier[0]);
>   
>   		ret = -EINVAL;
>   		goto err;


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 0/4] drm: Finally retire struct drm_format_name_buf
  2021-05-16 12:13 [PATCH 0/4] drm: Finally retire struct drm_format_name_buf Thomas Zimmermann
                   ` (3 preceding siblings ...)
  2021-05-16 12:13 ` [PATCH 4/4] drm/fourcc: Remove struct drm_format_buf_name Thomas Zimmermann
@ 2021-05-26 19:21 ` Thomas Zimmermann
  2021-05-26 19:54   ` Sakari Ailus
  2021-05-27  2:32   ` Alex Deucher
  4 siblings, 2 replies; 9+ messages in thread
From: Thomas Zimmermann @ 2021-05-26 19:21 UTC (permalink / raw)
  To: airlied, daniel, maarten.lankhorst, mripard, alexander.deucher,
	christian.koenig, sakari.ailus
  Cc: dri-devel, amd-gfx


[-- Attachment #1.1: Type: text/plain, Size: 1322 bytes --]

ping for further a-bs / r-bs

Am 16.05.21 um 14:13 schrieb Thomas Zimmermann:
> This is a cleanup patchset to remove drm_format_name_buf et al. There
> are two instances in drivers that need to be replaced with the %4cc
> printk format modifier. Patch 3 was left over back from an earlier
> patchset. [1] Patch 4 removes struct drm_format_name_buf.
> 
> I built-tested with drm-tip. The patchsetcan be mered through drm-misc.
> 
> [1] https://lore.kernel.org/dri-devel/20210216155723.17109-1-sakari.ailus@linux.intel.com/
> 
> Sakari Ailus (1):
>    drm: Remove drm_get_format_name()
> 
> Thomas Zimmermann (3):
>    drm/amdgpu: Use %p4cc to print 4CC format
>    drm/simpledrm: Use %p4cc to print 4CC format
>    drm/fourcc: Remove struct drm_format_buf_name
> 
>   drivers/gpu/drm/amd/amdgpu/amdgpu_display.c |  7 ++----
>   drivers/gpu/drm/drm_fourcc.c                | 25 ---------------------
>   drivers/gpu/drm/tiny/simpledrm.c            |  6 ++---
>   include/drm/drm_fourcc.h                    |  9 --------
>   4 files changed, 4 insertions(+), 43 deletions(-)
> 
> --
> 2.31.1
> 

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 0/4] drm: Finally retire struct drm_format_name_buf
  2021-05-26 19:21 ` [PATCH 0/4] drm: Finally retire struct drm_format_name_buf Thomas Zimmermann
@ 2021-05-26 19:54   ` Sakari Ailus
  2021-05-27  2:32   ` Alex Deucher
  1 sibling, 0 replies; 9+ messages in thread
From: Sakari Ailus @ 2021-05-26 19:54 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: airlied, dri-devel, amd-gfx, alexander.deucher, christian.koenig

On Wed, May 26, 2021 at 09:21:10PM +0200, Thomas Zimmermann wrote:
> ping for further a-bs / r-bs

Thanks for the ping.

For the series:

Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com>

> 
> Am 16.05.21 um 14:13 schrieb Thomas Zimmermann:
> > This is a cleanup patchset to remove drm_format_name_buf et al. There
> > are two instances in drivers that need to be replaced with the %4cc
> > printk format modifier. Patch 3 was left over back from an earlier
> > patchset. [1] Patch 4 removes struct drm_format_name_buf.
> > 
> > I built-tested with drm-tip. The patchsetcan be mered through drm-misc.
> > 
> > [1] https://lore.kernel.org/dri-devel/20210216155723.17109-1-sakari.ailus@linux.intel.com/
> > 
> > Sakari Ailus (1):
> >    drm: Remove drm_get_format_name()
> > 
> > Thomas Zimmermann (3):
> >    drm/amdgpu: Use %p4cc to print 4CC format
> >    drm/simpledrm: Use %p4cc to print 4CC format
> >    drm/fourcc: Remove struct drm_format_buf_name
> > 
> >   drivers/gpu/drm/amd/amdgpu/amdgpu_display.c |  7 ++----
> >   drivers/gpu/drm/drm_fourcc.c                | 25 ---------------------
> >   drivers/gpu/drm/tiny/simpledrm.c            |  6 ++---
> >   include/drm/drm_fourcc.h                    |  9 --------
> >   4 files changed, 4 insertions(+), 43 deletions(-)
> > 
> > --
> > 2.31.1
> > 
> 

-- 
Sakari Ailus

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 0/4] drm: Finally retire struct drm_format_name_buf
  2021-05-26 19:21 ` [PATCH 0/4] drm: Finally retire struct drm_format_name_buf Thomas Zimmermann
  2021-05-26 19:54   ` Sakari Ailus
@ 2021-05-27  2:32   ` Alex Deucher
  1 sibling, 0 replies; 9+ messages in thread
From: Alex Deucher @ 2021-05-27  2:32 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: amd-gfx list, Sakari Ailus, Dave Airlie,
	Maling list - DRI developers, Deucher, Alexander,
	Christian Koenig

Acked-by: Alex Deucher <alexander.deucher@amd.com>
for the amdgpu changes.

On Wed, May 26, 2021 at 3:21 PM Thomas Zimmermann <tzimmermann@suse.de> wrote:
>
> ping for further a-bs / r-bs
>
> Am 16.05.21 um 14:13 schrieb Thomas Zimmermann:
> > This is a cleanup patchset to remove drm_format_name_buf et al. There
> > are two instances in drivers that need to be replaced with the %4cc
> > printk format modifier. Patch 3 was left over back from an earlier
> > patchset. [1] Patch 4 removes struct drm_format_name_buf.
> >
> > I built-tested with drm-tip. The patchsetcan be mered through drm-misc.
> >
> > [1] https://lore.kernel.org/dri-devel/20210216155723.17109-1-sakari.ailus@linux.intel.com/
> >
> > Sakari Ailus (1):
> >    drm: Remove drm_get_format_name()
> >
> > Thomas Zimmermann (3):
> >    drm/amdgpu: Use %p4cc to print 4CC format
> >    drm/simpledrm: Use %p4cc to print 4CC format
> >    drm/fourcc: Remove struct drm_format_buf_name
> >
> >   drivers/gpu/drm/amd/amdgpu/amdgpu_display.c |  7 ++----
> >   drivers/gpu/drm/drm_fourcc.c                | 25 ---------------------
> >   drivers/gpu/drm/tiny/simpledrm.c            |  6 ++---
> >   include/drm/drm_fourcc.h                    |  9 --------
> >   4 files changed, 4 insertions(+), 43 deletions(-)
> >
> > --
> > 2.31.1
> >
>
> --
> Thomas Zimmermann
> Graphics Driver Developer
> SUSE Software Solutions Germany GmbH
> Maxfeldstr. 5, 90409 Nürnberg, Germany
> (HRB 36809, AG Nürnberg)
> Geschäftsführer: Felix Imendörffer
>

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-05-27  2:32 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-16 12:13 [PATCH 0/4] drm: Finally retire struct drm_format_name_buf Thomas Zimmermann
2021-05-16 12:13 ` [PATCH 1/4] drm/amdgpu: Use %p4cc to print 4CC format Thomas Zimmermann
2021-05-16 12:24   ` Christian König
2021-05-16 12:13 ` [PATCH 2/4] drm/simpledrm: " Thomas Zimmermann
2021-05-16 12:13 ` [PATCH 3/4] drm: Remove drm_get_format_name() Thomas Zimmermann
2021-05-16 12:13 ` [PATCH 4/4] drm/fourcc: Remove struct drm_format_buf_name Thomas Zimmermann
2021-05-26 19:21 ` [PATCH 0/4] drm: Finally retire struct drm_format_name_buf Thomas Zimmermann
2021-05-26 19:54   ` Sakari Ailus
2021-05-27  2:32   ` Alex Deucher

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).