[libcamera-devel,1/2] utils: gen-formats: Support big-endian DRM formats
diff mbox series

Message ID 20210131184352.10635-2-laurent.pinchart@ideasonboard.com
State Accepted
Delegated to: Laurent Pinchart
Headers show
Series
  • libcamera: Add support for RGB565X format
Related show

Commit Message

Laurent Pinchart Jan. 31, 2021, 6:43 p.m. UTC
DRM 4CCs are defined in little-endian, and can be declined in a
big-endian version by setting bit 31 (DRM_FORMAT_BIG_ENDIAN) in the 4CC
value.

Add support for such formats in the gen-formats.py script.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 utils/gen-formats.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Niklas Söderlund Feb. 1, 2021, 4:19 p.m. UTC | #1
Hi Laurent,

Thanks for your work.

On 2021-01-31 20:43:51 +0200, Laurent Pinchart wrote:
> DRM 4CCs are defined in little-endian, and can be declined in a
> big-endian version by setting bit 31 (DRM_FORMAT_BIG_ENDIAN) in the 4CC
> value.
> 
> Add support for such formats in the gen-formats.py script.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>

> ---
>  utils/gen-formats.py | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/utils/gen-formats.py b/utils/gen-formats.py
> index 60dcecc345d5..da79a8bbba3a 100755
> --- a/utils/gen-formats.py
> +++ b/utils/gen-formats.py
> @@ -59,10 +59,13 @@ def generate_h(formats, drm_fourcc):
>  
>      for format in formats:
>          name, format = format.popitem()
> +        fourcc = drm_fourcc.fourcc(format['fourcc'])
> +        if format.get('big-endian'):
> +            fourcc += '| DRM_FORMAT_BIG_ENDIAN'
>  
>          data = {
>              'name': name,
> -            'fourcc': drm_fourcc.fourcc(format['fourcc']),
> +            'fourcc': fourcc,
>              'mod': '0, 0',
>          }
>  
> -- 
> Regards,
> 
> Laurent Pinchart
> 
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel@lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel

Patch
diff mbox series

diff --git a/utils/gen-formats.py b/utils/gen-formats.py
index 60dcecc345d5..da79a8bbba3a 100755
--- a/utils/gen-formats.py
+++ b/utils/gen-formats.py
@@ -59,10 +59,13 @@  def generate_h(formats, drm_fourcc):
 
     for format in formats:
         name, format = format.popitem()
+        fourcc = drm_fourcc.fourcc(format['fourcc'])
+        if format.get('big-endian'):
+            fourcc += '| DRM_FORMAT_BIG_ENDIAN'
 
         data = {
             'name': name,
-            'fourcc': drm_fourcc.fourcc(format['fourcc']),
+            'fourcc': fourcc,
             'mod': '0, 0',
         }