Skip to contentSkip to conversation

drm/fourcc: fix Amlogic format modifier masks

PATCH In review Simon Ser 2 participants 2 messages Jan 10, 2021 – Jan 11, 2021

Subsystems (2)
lore
Share & tools
lore

Simon Ser

author
#0 lore raw

PATCH 1/1 drm/fourcc: fix Amlogic format modifier masks

The comment says the layout and options use 8 bits, and the shift uses 8 bits. However the mask is 0xf, ie. 0b00001111 (4 bits).

This could be surprising when introducing new layouts or options that take more than 4 bits, as this would silently drop the high bits.

Make the masks consistent with the comment and the shift.

Found when writing a drm_info patch [1].

[1]: https://github.com/ascent12/drm_info/pull/67

Fixes d6528ec88309 ("drm/fourcc: Add modifier definitions for describing Amlogic Video Framebuffer Compression")
Cc Neil Armstrong <[email protected]>
Cc Sam Ravnborg <[email protected]>
Cc Kevin Hilman <[email protected]>
Cc Daniel Vetter <[email protected]>
---
 include/uapi/drm/drm_fourcc.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
include/uapi/drm/drm_fourcc.h +2 -2
index 723c8e23ca87..5f42a14481bd 100644
@@ -1036,9 +1036,9 @@ drm_fourcc_canonicalize_nvidia_format_mod(__u64 modifier)
  * Not all combinations are valid, and different SoCs may support different
  * combinations of layout and options.
  */
-#define __fourcc_mod_amlogic_layout_mask 0xf
+#define __fourcc_mod_amlogic_layout_mask 0xff
 #define __fourcc_mod_amlogic_options_shift 8
-#define __fourcc_mod_amlogic_options_mask 0xf
+#define __fourcc_mod_amlogic_options_mask 0xff
 
 #define DRM_FORMAT_MOD_AMLOGIC_FBC(__layout, __options) \
 	fourcc_mod_code(AMLOGIC, \
Signature · 6 lines
2.30.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Acked-by on v1 1/1
#1 lore raw

Hi,

Quoted 6 lines · Simon Ser

The comment says the layout and options use 8 bits, and the shift uses 8 bits. However the mask is 0xf, ie. 0b00001111 (4 bits).

This could be surprising when introducing new layouts or options that take more than 4 bits, as this would silently drop the high bits.

Indeed, but the masks are "private", and would be updated accordingly when introducing new layouts.

Quoted 24 lines

Make the masks consistent with the comment and the shift.

Found when writing a drm_info patch [1].

[1]: https://github.com/ascent12/drm_info/pull/67

Fixes d6528ec88309 ("drm/fourcc: Add modifier definitions for describing Amlogic Video Framebuffer Compression")
Cc Neil Armstrong <[email protected]>
Cc Sam Ravnborg <[email protected]>
Cc Kevin Hilman <[email protected]>
Cc Daniel Vetter <[email protected]>
---
 include/uapi/drm/drm_fourcc.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
include/uapi/drm/drm_fourcc.h +0 -0
index 723c8e23ca87..5f42a14481bd 100644
@@ -1036,9 +1036,9 @@ drm_fourcc_canonicalize_nvidia_format_mod(__u64 modifier)
  * Not all combinations are valid, and different SoCs may support different

include/uapi/drm/drm_fourcc.h drm_fourcc_canonicalize_nvidia_format_mod(__u64 modifier) · line 1044

Quoted 10 lines
include/uapi/drm/drm_fourcc.h +2 -2
  * combinations of layout and options.
  */
-#define __fourcc_mod_amlogic_layout_mask 0xf
+#define __fourcc_mod_amlogic_layout_mask 0xff
 #define __fourcc_mod_amlogic_options_shift 8
-#define __fourcc_mod_amlogic_options_mask 0xf
+#define __fourcc_mod_amlogic_options_mask 0xff
 
 #define DRM_FORMAT_MOD_AMLOGIC_FBC(__layout, __options) \
 	fourcc_mod_code(AMLOGIC, \

Anyway:

Thanks,
Neil
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel