Skip to contentSkip to conversation

drm: Finally retire struct drm_format_name_buf

PATCH In review Thomas Zimmermann 4 participants 9 messages May 16, 2021 – May 27, 2021

Subsystems (3)
lore
Share & tools
lore

Thomas Zimmermann

author maintainer
#0 lore raw

cover drm: Finally retire struct drm_format_name_buf

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/[email protected]/

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

author maintainer
#1 lore raw

PATCH 1/4 drm/amdgpu: Use %p4cc to print 4CC format

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

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +2 -5
index 8a1fb8b6606e..49f73b5b89b0 100644
@@ -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;
Signature · 1 line
2.31.1
maintainer Acked-by on v1 1/4
#2 lore raw

Re: [PATCH 1/4] drm/amdgpu: Use %p4cc to print 4CC format

Am 16.05.21 um 14:13 schrieb Thomas Zimmermann:

Quoted 4 lines

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

Quoted 13 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 7 ++-----
  1 file changed, 2 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +0 -1
index 8a1fb8b6606e..49f73b5b89b0 100644
@@ -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;

drivers/gpu/drm/amd/amdgpu/amdgpu_display.c int amdgpu_display_gem_fb_verify_and_init( · line 1085

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +2 -4
  		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;

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

author maintainer
#3 lore raw

PATCH 2/4 drm/simpledrm: Use %p4cc to print 4CC format

In reply to Thomas Zimmermann

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

---
 drivers/gpu/drm/tiny/simpledrm.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/gpu/drm/tiny/simpledrm.c +2 -4
index ed40dde4d218..2defd5cc6c99 100644
@@ -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;
 }
Signature · 6 lines
2.31.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
author maintainer
#4 lore raw

PATCH 3/4 drm: Remove drm_get_format_name()

In reply to Thomas Zimmermann

From: Sakari Ailus <[email protected]>

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.

---
 drivers/gpu/drm/drm_fourcc.c | 25 -------------------------
 include/drm/drm_fourcc.h     |  1 -
 2 files changed, 26 deletions(-)
drivers/gpu/drm/drm_fourcc.c +0 -25
index 03262472059c..5cf45aa6eedc 100644
@@ -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.
include/drm/drm_fourcc.h +0 -1
index 156b122c0ad5..3ea17b8a79d3 100644
@@ -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__ */
Signature · 6 lines
2.31.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
author maintainer
#5 lore raw

PATCH 4/4 drm/fourcc: Remove struct drm_format_buf_name

In reply to Thomas Zimmermann

The structure is unused. Remove it.

---
 include/drm/drm_fourcc.h | 8 --------
 1 file changed, 8 deletions(-)
include/drm/drm_fourcc.h +0 -8
index 3ea17b8a79d3..3b138d4ae67e 100644
@@ -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
Signature · 6 lines
2.31.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
author maintainer
#6 lore raw
In reply to Thomas Zimmermann

ping for further a-bs / r-bs

Am 16.05.21 um 14:13 schrieb Thomas Zimmermann:

Quoted 26 lines

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/[email protected]/

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

Signature · 6 lines
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
Reviewed-by
#7 lore raw
Quoted 1 line · Thomas Zimmermann

ping for further a-bs / r-bs

Thanks for the ping.

For the series:

Quoted 29 lines

Am 16.05.21 um 14:13 schrieb Thomas Zimmermann:

Quoted 26 lines

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/[email protected]/

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

Signature · 1 line
Sakari Ailus
Acked-by
#8 lore raw
In reply to Thomas Zimmermann

for the amdgpu changes.

Quoted 31 lines · Thomas Zimmermann

ping for further a-bs / r-bs

Am 16.05.21 um 14:13 schrieb Thomas Zimmermann:

Quoted 17 lines

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/[email protected]/

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

Quoted 9 lines
  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

Quoted 8 lines

--
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

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx