| Message ID | 20260626102040.260324-1-kieran.bingham@ideasonboard.com |
|---|---|
| State | New |
| Headers | show |
| Series |
|
| Related | show |
On Fri, Jun 26, 2026 at 11:20:40AM +0100, Kieran Bingham wrote: > This updates only linux/drm_fourcc.h and linux/drm_mode.h to bring in > updates from Linux 7.1 including an ARM 64k interleaved modifier, > panel-type properties, and some interesting ARGB accessor macros. As those are of no use for libcamera I wouldn't have listed the detailed changes here. > libcamera specific local changes are preserved. > > Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > --- > include/linux/README | 2 +- > include/linux/drm_fourcc.h | 16 ++++++++ > include/linux/drm_mode.h | 84 ++++++++++++++++++++++++++++++++++++++ > 3 files changed, 101 insertions(+), 1 deletion(-) > > diff --git a/include/linux/README b/include/linux/README > index b02952bb28ca..9303e0f14ae6 100644 > --- a/include/linux/README > +++ b/include/linux/README > @@ -1,4 +1,4 @@ > # SPDX-License-Identifier: CC0-1.0 > > -Files in this directory are imported from v7.0 of the Linux kernel. Do not > +Files in this directory are imported from v7.1 of the Linux kernel. Do not > modify them manually. > diff --git a/include/linux/drm_fourcc.h b/include/linux/drm_fourcc.h > index e8a3d949032b..8e2a6abae62f 100644 > --- a/include/linux/drm_fourcc.h > +++ b/include/linux/drm_fourcc.h > @@ -1480,6 +1480,22 @@ drm_fourcc_canonicalize_nvidia_format_mod(__u64 modifier) > #define DRM_FORMAT_MOD_ARM_16X16_BLOCK_U_INTERLEAVED \ > DRM_FORMAT_MOD_ARM_CODE(DRM_FORMAT_MOD_ARM_TYPE_MISC, 1ULL) > > +/* > + * ARM 64k interleaved modifier > + * > + * This is used by ARM Mali v10+ GPUs. With this modifier, the plane is divided > + * into 64k byte 1:1 or 2:1 -sided tiles. The 64k tiles are laid out linearly. > + * Each 64k tile is divided into blocks of 16x16 texel blocks, which are > + * themselves laid out linearly within a 64k tile. Then within each 16x16 > + * block, texel blocks are laid out according to U order, similar to > + * 16X16_BLOCK_U_INTERLEAVED. > + * > + * Note that unlike 16X16_BLOCK_U_INTERLEAVED, the layout does not change > + * depending on whether a format is compressed or not. > + */ > +#define DRM_FORMAT_MOD_ARM_INTERLEAVED_64K \ > + DRM_FORMAT_MOD_ARM_CODE(DRM_FORMAT_MOD_ARM_TYPE_MISC, 2ULL) > + > /* > * Allwinner tiled modifier > * > diff --git a/include/linux/drm_mode.h b/include/linux/drm_mode.h > index 8894b7a80732..381a3e857d4e 100644 > --- a/include/linux/drm_mode.h > +++ b/include/linux/drm_mode.h > @@ -10,6 +10,9 @@ > #ifndef _DRM_MODE_H > #define _DRM_MODE_H > > +#include <linux/bits.h> > +#include <linux/const.h> > + > #include "drm.h" > > #if defined(__cplusplus) > @@ -149,6 +152,10 @@ extern "C" { > #define DRM_MODE_LINK_STATUS_GOOD 0 > #define DRM_MODE_LINK_STATUS_BAD 1 > > +/* Panel type property */ > +#define DRM_MODE_PANEL_TYPE_UNKNOWN 0 > +#define DRM_MODE_PANEL_TYPE_OLED 1 > + > /* > * DRM_MODE_ROTATE_<degrees> > * > @@ -1528,6 +1535,83 @@ struct drm_mode_closefb { > __u32 pad; > }; > > +/* > + * Put 16-bit ARGB values into a standard 64-bit representation that can be > + * used for ioctl parameters, inter-driver communication, etc. > + * > + * If the component values being provided contain less than 16 bits of > + * precision, use a conversion ratio to get a better color approximation. > + * The ratio is computed as (2^16 - 1) / (2^bpc - 1), where bpc and 16 are > + * the input and output precision, respectively. > + * Also note bpc must be greater than 0. > + */ > +#define __DRM_ARGB64_PREP(c, shift) \ > + (((__u64)(c) & __GENMASK(15, 0)) << (shift)) > + > +#define __DRM_ARGB64_PREP_BPC(c, shift, bpc) \ > +({ \ > + __u16 mask = __GENMASK((bpc) - 1, 0); \ > + __u16 conv = __KERNEL_DIV_ROUND_CLOSEST((mask & (c)) * \ > + __GENMASK(15, 0), mask);\ > + __DRM_ARGB64_PREP(conv, shift); \ > +}) > + > +#define DRM_ARGB64_PREP(alpha, red, green, blue) \ > +( \ > + __DRM_ARGB64_PREP(alpha, 48) | \ > + __DRM_ARGB64_PREP(red, 32) | \ > + __DRM_ARGB64_PREP(green, 16) | \ > + __DRM_ARGB64_PREP(blue, 0) \ > +) > + > +#define DRM_ARGB64_PREP_BPC(alpha, red, green, blue, bpc) \ > +({ \ > + __typeof__(bpc) __bpc = bpc; \ > + __DRM_ARGB64_PREP_BPC(alpha, 48, __bpc) | \ > + __DRM_ARGB64_PREP_BPC(red, 32, __bpc) | \ > + __DRM_ARGB64_PREP_BPC(green, 16, __bpc) | \ > + __DRM_ARGB64_PREP_BPC(blue, 0, __bpc); \ > +}) > + > +/* > + * Extract the specified color component from a standard 64-bit ARGB value. > + * > + * If the requested precision is less than 16 bits, make use of a conversion > + * ratio calculated as (2^bpc - 1) / (2^16 - 1), where bpc and 16 are the > + * output and input precision, respectively. > + * > + * If speed is more important than accuracy, use DRM_ARGB64_GET*_BPCS() > + * instead of DRM_ARGB64_GET*_BPC() in order to replace the expensive > + * division with a simple bit right-shift operation. > + */ > +#define __DRM_ARGB64_GET(c, shift) \ > + ((__u16)(((__u64)(c) >> (shift)) & __GENMASK(15, 0))) > + > +#define __DRM_ARGB64_GET_BPC(c, shift, bpc) \ > +({ \ > + __u16 comp = __DRM_ARGB64_GET(c, shift); \ > + __KERNEL_DIV_ROUND_CLOSEST(comp * __GENMASK((bpc) - 1, 0), \ > + __GENMASK(15, 0)); \ > +}) > + > +#define __DRM_ARGB64_GET_BPCS(c, shift, bpc) \ > + (__DRM_ARGB64_GET(c, shift) >> (16 - (bpc))) > + > +#define DRM_ARGB64_GETA(c) __DRM_ARGB64_GET(c, 48) > +#define DRM_ARGB64_GETR(c) __DRM_ARGB64_GET(c, 32) > +#define DRM_ARGB64_GETG(c) __DRM_ARGB64_GET(c, 16) > +#define DRM_ARGB64_GETB(c) __DRM_ARGB64_GET(c, 0) > + > +#define DRM_ARGB64_GETA_BPC(c, bpc) __DRM_ARGB64_GET_BPC(c, 48, bpc) > +#define DRM_ARGB64_GETR_BPC(c, bpc) __DRM_ARGB64_GET_BPC(c, 32, bpc) > +#define DRM_ARGB64_GETG_BPC(c, bpc) __DRM_ARGB64_GET_BPC(c, 16, bpc) > +#define DRM_ARGB64_GETB_BPC(c, bpc) __DRM_ARGB64_GET_BPC(c, 0, bpc) > + > +#define DRM_ARGB64_GETA_BPCS(c, bpc) __DRM_ARGB64_GET_BPCS(c, 48, bpc) > +#define DRM_ARGB64_GETR_BPCS(c, bpc) __DRM_ARGB64_GET_BPCS(c, 32, bpc) > +#define DRM_ARGB64_GETG_BPCS(c, bpc) __DRM_ARGB64_GET_BPCS(c, 16, bpc) > +#define DRM_ARGB64_GETB_BPCS(c, bpc) __DRM_ARGB64_GET_BPCS(c, 0, bpc) > + > #if defined(__cplusplus) > } > #endif
2026. 06. 26. 12:20 keltezéssel, Kieran Bingham írta: > This updates only linux/drm_fourcc.h and linux/drm_mode.h to bring in Does this mean other files have changed that are not updated? > updates from Linux 7.1 including an ARM 64k interleaved modifier, > panel-type properties, and some interesting ARGB accessor macros. > > libcamera specific local changes are preserved. > > Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> > --- > include/linux/README | 2 +- > include/linux/drm_fourcc.h | 16 ++++++++ > include/linux/drm_mode.h | 84 ++++++++++++++++++++++++++++++++++++++ > 3 files changed, 101 insertions(+), 1 deletion(-) > > diff --git a/include/linux/README b/include/linux/README > index b02952bb28ca..9303e0f14ae6 100644 > --- a/include/linux/README > +++ b/include/linux/README > @@ -1,4 +1,4 @@ > # SPDX-License-Identifier: CC0-1.0 > > -Files in this directory are imported from v7.0 of the Linux kernel. Do not > +Files in this directory are imported from v7.1 of the Linux kernel. Do not > modify them manually. > diff --git a/include/linux/drm_fourcc.h b/include/linux/drm_fourcc.h > index e8a3d949032b..8e2a6abae62f 100644 > --- a/include/linux/drm_fourcc.h > +++ b/include/linux/drm_fourcc.h > @@ -1480,6 +1480,22 @@ drm_fourcc_canonicalize_nvidia_format_mod(__u64 modifier) > #define DRM_FORMAT_MOD_ARM_16X16_BLOCK_U_INTERLEAVED \ > DRM_FORMAT_MOD_ARM_CODE(DRM_FORMAT_MOD_ARM_TYPE_MISC, 1ULL) > > +/* > + * ARM 64k interleaved modifier > + * > + * This is used by ARM Mali v10+ GPUs. With this modifier, the plane is divided > + * into 64k byte 1:1 or 2:1 -sided tiles. The 64k tiles are laid out linearly. > + * Each 64k tile is divided into blocks of 16x16 texel blocks, which are > + * themselves laid out linearly within a 64k tile. Then within each 16x16 > + * block, texel blocks are laid out according to U order, similar to > + * 16X16_BLOCK_U_INTERLEAVED. > + * > + * Note that unlike 16X16_BLOCK_U_INTERLEAVED, the layout does not change > + * depending on whether a format is compressed or not. > + */ > +#define DRM_FORMAT_MOD_ARM_INTERLEAVED_64K \ > + DRM_FORMAT_MOD_ARM_CODE(DRM_FORMAT_MOD_ARM_TYPE_MISC, 2ULL) > + > /* > * Allwinner tiled modifier > * > diff --git a/include/linux/drm_mode.h b/include/linux/drm_mode.h > index 8894b7a80732..381a3e857d4e 100644 > --- a/include/linux/drm_mode.h > +++ b/include/linux/drm_mode.h > @@ -10,6 +10,9 @@ > #ifndef _DRM_MODE_H > #define _DRM_MODE_H > > +#include <linux/bits.h> > +#include <linux/const.h> > + > #include "drm.h" > > #if defined(__cplusplus) > @@ -149,6 +152,10 @@ extern "C" { > #define DRM_MODE_LINK_STATUS_GOOD 0 > #define DRM_MODE_LINK_STATUS_BAD 1 > > +/* Panel type property */ > +#define DRM_MODE_PANEL_TYPE_UNKNOWN 0 > +#define DRM_MODE_PANEL_TYPE_OLED 1 > + > /* > * DRM_MODE_ROTATE_<degrees> > * > @@ -1528,6 +1535,83 @@ struct drm_mode_closefb { > __u32 pad; > }; > > +/* > + * Put 16-bit ARGB values into a standard 64-bit representation that can be > + * used for ioctl parameters, inter-driver communication, etc. > + * > + * If the component values being provided contain less than 16 bits of > + * precision, use a conversion ratio to get a better color approximation. > + * The ratio is computed as (2^16 - 1) / (2^bpc - 1), where bpc and 16 are > + * the input and output precision, respectively. > + * Also note bpc must be greater than 0. > + */ > +#define __DRM_ARGB64_PREP(c, shift) \ > + (((__u64)(c) & __GENMASK(15, 0)) << (shift)) > + > +#define __DRM_ARGB64_PREP_BPC(c, shift, bpc) \ > +({ \ > + __u16 mask = __GENMASK((bpc) - 1, 0); \ > + __u16 conv = __KERNEL_DIV_ROUND_CLOSEST((mask & (c)) * \ > + __GENMASK(15, 0), mask);\ > + __DRM_ARGB64_PREP(conv, shift); \ > +}) > + > +#define DRM_ARGB64_PREP(alpha, red, green, blue) \ > +( \ > + __DRM_ARGB64_PREP(alpha, 48) | \ > + __DRM_ARGB64_PREP(red, 32) | \ > + __DRM_ARGB64_PREP(green, 16) | \ > + __DRM_ARGB64_PREP(blue, 0) \ > +) > + > +#define DRM_ARGB64_PREP_BPC(alpha, red, green, blue, bpc) \ > +({ \ > + __typeof__(bpc) __bpc = bpc; \ > + __DRM_ARGB64_PREP_BPC(alpha, 48, __bpc) | \ > + __DRM_ARGB64_PREP_BPC(red, 32, __bpc) | \ > + __DRM_ARGB64_PREP_BPC(green, 16, __bpc) | \ > + __DRM_ARGB64_PREP_BPC(blue, 0, __bpc); \ > +}) > + > +/* > + * Extract the specified color component from a standard 64-bit ARGB value. > + * > + * If the requested precision is less than 16 bits, make use of a conversion > + * ratio calculated as (2^bpc - 1) / (2^16 - 1), where bpc and 16 are the > + * output and input precision, respectively. > + * > + * If speed is more important than accuracy, use DRM_ARGB64_GET*_BPCS() > + * instead of DRM_ARGB64_GET*_BPC() in order to replace the expensive > + * division with a simple bit right-shift operation. > + */ > +#define __DRM_ARGB64_GET(c, shift) \ > + ((__u16)(((__u64)(c) >> (shift)) & __GENMASK(15, 0))) > + > +#define __DRM_ARGB64_GET_BPC(c, shift, bpc) \ > +({ \ > + __u16 comp = __DRM_ARGB64_GET(c, shift); \ > + __KERNEL_DIV_ROUND_CLOSEST(comp * __GENMASK((bpc) - 1, 0), \ > + __GENMASK(15, 0)); \ > +}) > + > +#define __DRM_ARGB64_GET_BPCS(c, shift, bpc) \ > + (__DRM_ARGB64_GET(c, shift) >> (16 - (bpc))) > + > +#define DRM_ARGB64_GETA(c) __DRM_ARGB64_GET(c, 48) > +#define DRM_ARGB64_GETR(c) __DRM_ARGB64_GET(c, 32) > +#define DRM_ARGB64_GETG(c) __DRM_ARGB64_GET(c, 16) > +#define DRM_ARGB64_GETB(c) __DRM_ARGB64_GET(c, 0) > + > +#define DRM_ARGB64_GETA_BPC(c, bpc) __DRM_ARGB64_GET_BPC(c, 48, bpc) > +#define DRM_ARGB64_GETR_BPC(c, bpc) __DRM_ARGB64_GET_BPC(c, 32, bpc) > +#define DRM_ARGB64_GETG_BPC(c, bpc) __DRM_ARGB64_GET_BPC(c, 16, bpc) > +#define DRM_ARGB64_GETB_BPC(c, bpc) __DRM_ARGB64_GET_BPC(c, 0, bpc) > + > +#define DRM_ARGB64_GETA_BPCS(c, bpc) __DRM_ARGB64_GET_BPCS(c, 48, bpc) > +#define DRM_ARGB64_GETR_BPCS(c, bpc) __DRM_ARGB64_GET_BPCS(c, 32, bpc) > +#define DRM_ARGB64_GETG_BPCS(c, bpc) __DRM_ARGB64_GET_BPCS(c, 16, bpc) > +#define DRM_ARGB64_GETB_BPCS(c, bpc) __DRM_ARGB64_GET_BPCS(c, 0, bpc) > + > #if defined(__cplusplus) > } > #endif
Quoting Barnabás Pőcze (2026-06-26 11:51:14) > 2026. 06. 26. 12:20 keltezéssel, Kieran Bingham írta: > > This updates only linux/drm_fourcc.h and linux/drm_mode.h to bring in > > Does this mean other files have changed that are not updated? The other differences were only removing (undoing) changes we've made locally. -- Kieran > > > > updates from Linux 7.1 including an ARM 64k interleaved modifier, > > panel-type properties, and some interesting ARGB accessor macros. > > > > libcamera specific local changes are preserved. > > > > Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> > > --- > > include/linux/README | 2 +- > > include/linux/drm_fourcc.h | 16 ++++++++ > > include/linux/drm_mode.h | 84 ++++++++++++++++++++++++++++++++++++++ > > 3 files changed, 101 insertions(+), 1 deletion(-) > > > > diff --git a/include/linux/README b/include/linux/README > > index b02952bb28ca..9303e0f14ae6 100644 > > --- a/include/linux/README > > +++ b/include/linux/README > > @@ -1,4 +1,4 @@ > > # SPDX-License-Identifier: CC0-1.0 > > > > -Files in this directory are imported from v7.0 of the Linux kernel. Do not > > +Files in this directory are imported from v7.1 of the Linux kernel. Do not > > modify them manually. > > diff --git a/include/linux/drm_fourcc.h b/include/linux/drm_fourcc.h > > index e8a3d949032b..8e2a6abae62f 100644 > > --- a/include/linux/drm_fourcc.h > > +++ b/include/linux/drm_fourcc.h > > @@ -1480,6 +1480,22 @@ drm_fourcc_canonicalize_nvidia_format_mod(__u64 modifier) > > #define DRM_FORMAT_MOD_ARM_16X16_BLOCK_U_INTERLEAVED \ > > DRM_FORMAT_MOD_ARM_CODE(DRM_FORMAT_MOD_ARM_TYPE_MISC, 1ULL) > > > > +/* > > + * ARM 64k interleaved modifier > > + * > > + * This is used by ARM Mali v10+ GPUs. With this modifier, the plane is divided > > + * into 64k byte 1:1 or 2:1 -sided tiles. The 64k tiles are laid out linearly. > > + * Each 64k tile is divided into blocks of 16x16 texel blocks, which are > > + * themselves laid out linearly within a 64k tile. Then within each 16x16 > > + * block, texel blocks are laid out according to U order, similar to > > + * 16X16_BLOCK_U_INTERLEAVED. > > + * > > + * Note that unlike 16X16_BLOCK_U_INTERLEAVED, the layout does not change > > + * depending on whether a format is compressed or not. > > + */ > > +#define DRM_FORMAT_MOD_ARM_INTERLEAVED_64K \ > > + DRM_FORMAT_MOD_ARM_CODE(DRM_FORMAT_MOD_ARM_TYPE_MISC, 2ULL) > > + > > /* > > * Allwinner tiled modifier > > * > > diff --git a/include/linux/drm_mode.h b/include/linux/drm_mode.h > > index 8894b7a80732..381a3e857d4e 100644 > > --- a/include/linux/drm_mode.h > > +++ b/include/linux/drm_mode.h > > @@ -10,6 +10,9 @@ > > #ifndef _DRM_MODE_H > > #define _DRM_MODE_H > > > > +#include <linux/bits.h> > > +#include <linux/const.h> > > + > > #include "drm.h" > > > > #if defined(__cplusplus) > > @@ -149,6 +152,10 @@ extern "C" { > > #define DRM_MODE_LINK_STATUS_GOOD 0 > > #define DRM_MODE_LINK_STATUS_BAD 1 > > > > +/* Panel type property */ > > +#define DRM_MODE_PANEL_TYPE_UNKNOWN 0 > > +#define DRM_MODE_PANEL_TYPE_OLED 1 > > + > > /* > > * DRM_MODE_ROTATE_<degrees> > > * > > @@ -1528,6 +1535,83 @@ struct drm_mode_closefb { > > __u32 pad; > > }; > > > > +/* > > + * Put 16-bit ARGB values into a standard 64-bit representation that can be > > + * used for ioctl parameters, inter-driver communication, etc. > > + * > > + * If the component values being provided contain less than 16 bits of > > + * precision, use a conversion ratio to get a better color approximation. > > + * The ratio is computed as (2^16 - 1) / (2^bpc - 1), where bpc and 16 are > > + * the input and output precision, respectively. > > + * Also note bpc must be greater than 0. > > + */ > > +#define __DRM_ARGB64_PREP(c, shift) \ > > + (((__u64)(c) & __GENMASK(15, 0)) << (shift)) > > + > > +#define __DRM_ARGB64_PREP_BPC(c, shift, bpc) \ > > +({ \ > > + __u16 mask = __GENMASK((bpc) - 1, 0); \ > > + __u16 conv = __KERNEL_DIV_ROUND_CLOSEST((mask & (c)) * \ > > + __GENMASK(15, 0), mask);\ > > + __DRM_ARGB64_PREP(conv, shift); \ > > +}) > > + > > +#define DRM_ARGB64_PREP(alpha, red, green, blue) \ > > +( \ > > + __DRM_ARGB64_PREP(alpha, 48) | \ > > + __DRM_ARGB64_PREP(red, 32) | \ > > + __DRM_ARGB64_PREP(green, 16) | \ > > + __DRM_ARGB64_PREP(blue, 0) \ > > +) > > + > > +#define DRM_ARGB64_PREP_BPC(alpha, red, green, blue, bpc) \ > > +({ \ > > + __typeof__(bpc) __bpc = bpc; \ > > + __DRM_ARGB64_PREP_BPC(alpha, 48, __bpc) | \ > > + __DRM_ARGB64_PREP_BPC(red, 32, __bpc) | \ > > + __DRM_ARGB64_PREP_BPC(green, 16, __bpc) | \ > > + __DRM_ARGB64_PREP_BPC(blue, 0, __bpc); \ > > +}) > > + > > +/* > > + * Extract the specified color component from a standard 64-bit ARGB value. > > + * > > + * If the requested precision is less than 16 bits, make use of a conversion > > + * ratio calculated as (2^bpc - 1) / (2^16 - 1), where bpc and 16 are the > > + * output and input precision, respectively. > > + * > > + * If speed is more important than accuracy, use DRM_ARGB64_GET*_BPCS() > > + * instead of DRM_ARGB64_GET*_BPC() in order to replace the expensive > > + * division with a simple bit right-shift operation. > > + */ > > +#define __DRM_ARGB64_GET(c, shift) \ > > + ((__u16)(((__u64)(c) >> (shift)) & __GENMASK(15, 0))) > > + > > +#define __DRM_ARGB64_GET_BPC(c, shift, bpc) \ > > +({ \ > > + __u16 comp = __DRM_ARGB64_GET(c, shift); \ > > + __KERNEL_DIV_ROUND_CLOSEST(comp * __GENMASK((bpc) - 1, 0), \ > > + __GENMASK(15, 0)); \ > > +}) > > + > > +#define __DRM_ARGB64_GET_BPCS(c, shift, bpc) \ > > + (__DRM_ARGB64_GET(c, shift) >> (16 - (bpc))) > > + > > +#define DRM_ARGB64_GETA(c) __DRM_ARGB64_GET(c, 48) > > +#define DRM_ARGB64_GETR(c) __DRM_ARGB64_GET(c, 32) > > +#define DRM_ARGB64_GETG(c) __DRM_ARGB64_GET(c, 16) > > +#define DRM_ARGB64_GETB(c) __DRM_ARGB64_GET(c, 0) > > + > > +#define DRM_ARGB64_GETA_BPC(c, bpc) __DRM_ARGB64_GET_BPC(c, 48, bpc) > > +#define DRM_ARGB64_GETR_BPC(c, bpc) __DRM_ARGB64_GET_BPC(c, 32, bpc) > > +#define DRM_ARGB64_GETG_BPC(c, bpc) __DRM_ARGB64_GET_BPC(c, 16, bpc) > > +#define DRM_ARGB64_GETB_BPC(c, bpc) __DRM_ARGB64_GET_BPC(c, 0, bpc) > > + > > +#define DRM_ARGB64_GETA_BPCS(c, bpc) __DRM_ARGB64_GET_BPCS(c, 48, bpc) > > +#define DRM_ARGB64_GETR_BPCS(c, bpc) __DRM_ARGB64_GET_BPCS(c, 32, bpc) > > +#define DRM_ARGB64_GETG_BPCS(c, bpc) __DRM_ARGB64_GET_BPCS(c, 16, bpc) > > +#define DRM_ARGB64_GETB_BPCS(c, bpc) __DRM_ARGB64_GET_BPCS(c, 0, bpc) > > + > > #if defined(__cplusplus) > > } > > #endif >
Quoting Laurent Pinchart (2026-06-26 11:50:16) > On Fri, Jun 26, 2026 at 11:20:40AM +0100, Kieran Bingham wrote: > > This updates only linux/drm_fourcc.h and linux/drm_mode.h to bring in > > updates from Linux 7.1 including an ARM 64k interleaved modifier, > > panel-type properties, and some interesting ARGB accessor macros. > > As those are of no use for libcamera I wouldn't have listed the detailed > changes here. Would you be happier with the following ?: include: linux: Update to Linux 7.1 Refresh the kernel headers we import to bring in new changes from the latest release, without undoing local libcamera specific modifications. Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> > > > libcamera specific local changes are preserved. > > > > Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> > > Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > > > --- > > include/linux/README | 2 +- > > include/linux/drm_fourcc.h | 16 ++++++++ > > include/linux/drm_mode.h | 84 ++++++++++++++++++++++++++++++++++++++ > > 3 files changed, 101 insertions(+), 1 deletion(-) > > > > diff --git a/include/linux/README b/include/linux/README > > index b02952bb28ca..9303e0f14ae6 100644 > > --- a/include/linux/README > > +++ b/include/linux/README > > @@ -1,4 +1,4 @@ > > # SPDX-License-Identifier: CC0-1.0 > > > > -Files in this directory are imported from v7.0 of the Linux kernel. Do not > > +Files in this directory are imported from v7.1 of the Linux kernel. Do not > > modify them manually. > > diff --git a/include/linux/drm_fourcc.h b/include/linux/drm_fourcc.h > > index e8a3d949032b..8e2a6abae62f 100644 > > --- a/include/linux/drm_fourcc.h > > +++ b/include/linux/drm_fourcc.h > > @@ -1480,6 +1480,22 @@ drm_fourcc_canonicalize_nvidia_format_mod(__u64 modifier) > > #define DRM_FORMAT_MOD_ARM_16X16_BLOCK_U_INTERLEAVED \ > > DRM_FORMAT_MOD_ARM_CODE(DRM_FORMAT_MOD_ARM_TYPE_MISC, 1ULL) > > > > +/* > > + * ARM 64k interleaved modifier > > + * > > + * This is used by ARM Mali v10+ GPUs. With this modifier, the plane is divided > > + * into 64k byte 1:1 or 2:1 -sided tiles. The 64k tiles are laid out linearly. > > + * Each 64k tile is divided into blocks of 16x16 texel blocks, which are > > + * themselves laid out linearly within a 64k tile. Then within each 16x16 > > + * block, texel blocks are laid out according to U order, similar to > > + * 16X16_BLOCK_U_INTERLEAVED. > > + * > > + * Note that unlike 16X16_BLOCK_U_INTERLEAVED, the layout does not change > > + * depending on whether a format is compressed or not. > > + */ > > +#define DRM_FORMAT_MOD_ARM_INTERLEAVED_64K \ > > + DRM_FORMAT_MOD_ARM_CODE(DRM_FORMAT_MOD_ARM_TYPE_MISC, 2ULL) > > + > > /* > > * Allwinner tiled modifier > > * > > diff --git a/include/linux/drm_mode.h b/include/linux/drm_mode.h > > index 8894b7a80732..381a3e857d4e 100644 > > --- a/include/linux/drm_mode.h > > +++ b/include/linux/drm_mode.h > > @@ -10,6 +10,9 @@ > > #ifndef _DRM_MODE_H > > #define _DRM_MODE_H > > > > +#include <linux/bits.h> > > +#include <linux/const.h> > > + > > #include "drm.h" > > > > #if defined(__cplusplus) > > @@ -149,6 +152,10 @@ extern "C" { > > #define DRM_MODE_LINK_STATUS_GOOD 0 > > #define DRM_MODE_LINK_STATUS_BAD 1 > > > > +/* Panel type property */ > > +#define DRM_MODE_PANEL_TYPE_UNKNOWN 0 > > +#define DRM_MODE_PANEL_TYPE_OLED 1 > > + > > /* > > * DRM_MODE_ROTATE_<degrees> > > * > > @@ -1528,6 +1535,83 @@ struct drm_mode_closefb { > > __u32 pad; > > }; > > > > +/* > > + * Put 16-bit ARGB values into a standard 64-bit representation that can be > > + * used for ioctl parameters, inter-driver communication, etc. > > + * > > + * If the component values being provided contain less than 16 bits of > > + * precision, use a conversion ratio to get a better color approximation. > > + * The ratio is computed as (2^16 - 1) / (2^bpc - 1), where bpc and 16 are > > + * the input and output precision, respectively. > > + * Also note bpc must be greater than 0. > > + */ > > +#define __DRM_ARGB64_PREP(c, shift) \ > > + (((__u64)(c) & __GENMASK(15, 0)) << (shift)) > > + > > +#define __DRM_ARGB64_PREP_BPC(c, shift, bpc) \ > > +({ \ > > + __u16 mask = __GENMASK((bpc) - 1, 0); \ > > + __u16 conv = __KERNEL_DIV_ROUND_CLOSEST((mask & (c)) * \ > > + __GENMASK(15, 0), mask);\ > > + __DRM_ARGB64_PREP(conv, shift); \ > > +}) > > + > > +#define DRM_ARGB64_PREP(alpha, red, green, blue) \ > > +( \ > > + __DRM_ARGB64_PREP(alpha, 48) | \ > > + __DRM_ARGB64_PREP(red, 32) | \ > > + __DRM_ARGB64_PREP(green, 16) | \ > > + __DRM_ARGB64_PREP(blue, 0) \ > > +) > > + > > +#define DRM_ARGB64_PREP_BPC(alpha, red, green, blue, bpc) \ > > +({ \ > > + __typeof__(bpc) __bpc = bpc; \ > > + __DRM_ARGB64_PREP_BPC(alpha, 48, __bpc) | \ > > + __DRM_ARGB64_PREP_BPC(red, 32, __bpc) | \ > > + __DRM_ARGB64_PREP_BPC(green, 16, __bpc) | \ > > + __DRM_ARGB64_PREP_BPC(blue, 0, __bpc); \ > > +}) > > + > > +/* > > + * Extract the specified color component from a standard 64-bit ARGB value. > > + * > > + * If the requested precision is less than 16 bits, make use of a conversion > > + * ratio calculated as (2^bpc - 1) / (2^16 - 1), where bpc and 16 are the > > + * output and input precision, respectively. > > + * > > + * If speed is more important than accuracy, use DRM_ARGB64_GET*_BPCS() > > + * instead of DRM_ARGB64_GET*_BPC() in order to replace the expensive > > + * division with a simple bit right-shift operation. > > + */ > > +#define __DRM_ARGB64_GET(c, shift) \ > > + ((__u16)(((__u64)(c) >> (shift)) & __GENMASK(15, 0))) > > + > > +#define __DRM_ARGB64_GET_BPC(c, shift, bpc) \ > > +({ \ > > + __u16 comp = __DRM_ARGB64_GET(c, shift); \ > > + __KERNEL_DIV_ROUND_CLOSEST(comp * __GENMASK((bpc) - 1, 0), \ > > + __GENMASK(15, 0)); \ > > +}) > > + > > +#define __DRM_ARGB64_GET_BPCS(c, shift, bpc) \ > > + (__DRM_ARGB64_GET(c, shift) >> (16 - (bpc))) > > + > > +#define DRM_ARGB64_GETA(c) __DRM_ARGB64_GET(c, 48) > > +#define DRM_ARGB64_GETR(c) __DRM_ARGB64_GET(c, 32) > > +#define DRM_ARGB64_GETG(c) __DRM_ARGB64_GET(c, 16) > > +#define DRM_ARGB64_GETB(c) __DRM_ARGB64_GET(c, 0) > > + > > +#define DRM_ARGB64_GETA_BPC(c, bpc) __DRM_ARGB64_GET_BPC(c, 48, bpc) > > +#define DRM_ARGB64_GETR_BPC(c, bpc) __DRM_ARGB64_GET_BPC(c, 32, bpc) > > +#define DRM_ARGB64_GETG_BPC(c, bpc) __DRM_ARGB64_GET_BPC(c, 16, bpc) > > +#define DRM_ARGB64_GETB_BPC(c, bpc) __DRM_ARGB64_GET_BPC(c, 0, bpc) > > + > > +#define DRM_ARGB64_GETA_BPCS(c, bpc) __DRM_ARGB64_GET_BPCS(c, 48, bpc) > > +#define DRM_ARGB64_GETR_BPCS(c, bpc) __DRM_ARGB64_GET_BPCS(c, 32, bpc) > > +#define DRM_ARGB64_GETG_BPCS(c, bpc) __DRM_ARGB64_GET_BPCS(c, 16, bpc) > > +#define DRM_ARGB64_GETB_BPCS(c, bpc) __DRM_ARGB64_GET_BPCS(c, 0, bpc) > > + > > #if defined(__cplusplus) > > } > > #endif > > -- > Regards, > > Laurent Pinchart
On Fri, Jun 26, 2026 at 11:57:52AM +0100, Kieran Bingham wrote: > Quoting Barnabás Pőcze (2026-06-26 11:51:14) > > 2026. 06. 26. 12:20 keltezéssel, Kieran Bingham írta: > > > This updates only linux/drm_fourcc.h and linux/drm_mode.h to bring in > > > > Does this mean other files have changed that are not updated? > > The other differences were only removing (undoing) changes we've made > locally. Sounds like it would be useful for the update-kernel-headers.sh to propose a standardized commit message, to streamline reviews of future updates. > > > updates from Linux 7.1 including an ARM 64k interleaved modifier, > > > panel-type properties, and some interesting ARGB accessor macros. > > > > > > libcamera specific local changes are preserved. > > > > > > Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> > > > --- > > > include/linux/README | 2 +- > > > include/linux/drm_fourcc.h | 16 ++++++++ > > > include/linux/drm_mode.h | 84 ++++++++++++++++++++++++++++++++++++++ > > > 3 files changed, 101 insertions(+), 1 deletion(-) > > > > > > diff --git a/include/linux/README b/include/linux/README > > > index b02952bb28ca..9303e0f14ae6 100644 > > > --- a/include/linux/README > > > +++ b/include/linux/README > > > @@ -1,4 +1,4 @@ > > > # SPDX-License-Identifier: CC0-1.0 > > > > > > -Files in this directory are imported from v7.0 of the Linux kernel. Do not > > > +Files in this directory are imported from v7.1 of the Linux kernel. Do not > > > modify them manually. > > > diff --git a/include/linux/drm_fourcc.h b/include/linux/drm_fourcc.h > > > index e8a3d949032b..8e2a6abae62f 100644 > > > --- a/include/linux/drm_fourcc.h > > > +++ b/include/linux/drm_fourcc.h > > > @@ -1480,6 +1480,22 @@ drm_fourcc_canonicalize_nvidia_format_mod(__u64 modifier) > > > #define DRM_FORMAT_MOD_ARM_16X16_BLOCK_U_INTERLEAVED \ > > > DRM_FORMAT_MOD_ARM_CODE(DRM_FORMAT_MOD_ARM_TYPE_MISC, 1ULL) > > > > > > +/* > > > + * ARM 64k interleaved modifier > > > + * > > > + * This is used by ARM Mali v10+ GPUs. With this modifier, the plane is divided > > > + * into 64k byte 1:1 or 2:1 -sided tiles. The 64k tiles are laid out linearly. > > > + * Each 64k tile is divided into blocks of 16x16 texel blocks, which are > > > + * themselves laid out linearly within a 64k tile. Then within each 16x16 > > > + * block, texel blocks are laid out according to U order, similar to > > > + * 16X16_BLOCK_U_INTERLEAVED. > > > + * > > > + * Note that unlike 16X16_BLOCK_U_INTERLEAVED, the layout does not change > > > + * depending on whether a format is compressed or not. > > > + */ > > > +#define DRM_FORMAT_MOD_ARM_INTERLEAVED_64K \ > > > + DRM_FORMAT_MOD_ARM_CODE(DRM_FORMAT_MOD_ARM_TYPE_MISC, 2ULL) > > > + > > > /* > > > * Allwinner tiled modifier > > > * > > > diff --git a/include/linux/drm_mode.h b/include/linux/drm_mode.h > > > index 8894b7a80732..381a3e857d4e 100644 > > > --- a/include/linux/drm_mode.h > > > +++ b/include/linux/drm_mode.h > > > @@ -10,6 +10,9 @@ > > > #ifndef _DRM_MODE_H > > > #define _DRM_MODE_H > > > > > > +#include <linux/bits.h> > > > +#include <linux/const.h> > > > + > > > #include "drm.h" > > > > > > #if defined(__cplusplus) > > > @@ -149,6 +152,10 @@ extern "C" { > > > #define DRM_MODE_LINK_STATUS_GOOD 0 > > > #define DRM_MODE_LINK_STATUS_BAD 1 > > > > > > +/* Panel type property */ > > > +#define DRM_MODE_PANEL_TYPE_UNKNOWN 0 > > > +#define DRM_MODE_PANEL_TYPE_OLED 1 > > > + > > > /* > > > * DRM_MODE_ROTATE_<degrees> > > > * > > > @@ -1528,6 +1535,83 @@ struct drm_mode_closefb { > > > __u32 pad; > > > }; > > > > > > +/* > > > + * Put 16-bit ARGB values into a standard 64-bit representation that can be > > > + * used for ioctl parameters, inter-driver communication, etc. > > > + * > > > + * If the component values being provided contain less than 16 bits of > > > + * precision, use a conversion ratio to get a better color approximation. > > > + * The ratio is computed as (2^16 - 1) / (2^bpc - 1), where bpc and 16 are > > > + * the input and output precision, respectively. > > > + * Also note bpc must be greater than 0. > > > + */ > > > +#define __DRM_ARGB64_PREP(c, shift) \ > > > + (((__u64)(c) & __GENMASK(15, 0)) << (shift)) > > > + > > > +#define __DRM_ARGB64_PREP_BPC(c, shift, bpc) \ > > > +({ \ > > > + __u16 mask = __GENMASK((bpc) - 1, 0); \ > > > + __u16 conv = __KERNEL_DIV_ROUND_CLOSEST((mask & (c)) * \ > > > + __GENMASK(15, 0), mask);\ > > > + __DRM_ARGB64_PREP(conv, shift); \ > > > +}) > > > + > > > +#define DRM_ARGB64_PREP(alpha, red, green, blue) \ > > > +( \ > > > + __DRM_ARGB64_PREP(alpha, 48) | \ > > > + __DRM_ARGB64_PREP(red, 32) | \ > > > + __DRM_ARGB64_PREP(green, 16) | \ > > > + __DRM_ARGB64_PREP(blue, 0) \ > > > +) > > > + > > > +#define DRM_ARGB64_PREP_BPC(alpha, red, green, blue, bpc) \ > > > +({ \ > > > + __typeof__(bpc) __bpc = bpc; \ > > > + __DRM_ARGB64_PREP_BPC(alpha, 48, __bpc) | \ > > > + __DRM_ARGB64_PREP_BPC(red, 32, __bpc) | \ > > > + __DRM_ARGB64_PREP_BPC(green, 16, __bpc) | \ > > > + __DRM_ARGB64_PREP_BPC(blue, 0, __bpc); \ > > > +}) > > > + > > > +/* > > > + * Extract the specified color component from a standard 64-bit ARGB value. > > > + * > > > + * If the requested precision is less than 16 bits, make use of a conversion > > > + * ratio calculated as (2^bpc - 1) / (2^16 - 1), where bpc and 16 are the > > > + * output and input precision, respectively. > > > + * > > > + * If speed is more important than accuracy, use DRM_ARGB64_GET*_BPCS() > > > + * instead of DRM_ARGB64_GET*_BPC() in order to replace the expensive > > > + * division with a simple bit right-shift operation. > > > + */ > > > +#define __DRM_ARGB64_GET(c, shift) \ > > > + ((__u16)(((__u64)(c) >> (shift)) & __GENMASK(15, 0))) > > > + > > > +#define __DRM_ARGB64_GET_BPC(c, shift, bpc) \ > > > +({ \ > > > + __u16 comp = __DRM_ARGB64_GET(c, shift); \ > > > + __KERNEL_DIV_ROUND_CLOSEST(comp * __GENMASK((bpc) - 1, 0), \ > > > + __GENMASK(15, 0)); \ > > > +}) > > > + > > > +#define __DRM_ARGB64_GET_BPCS(c, shift, bpc) \ > > > + (__DRM_ARGB64_GET(c, shift) >> (16 - (bpc))) > > > + > > > +#define DRM_ARGB64_GETA(c) __DRM_ARGB64_GET(c, 48) > > > +#define DRM_ARGB64_GETR(c) __DRM_ARGB64_GET(c, 32) > > > +#define DRM_ARGB64_GETG(c) __DRM_ARGB64_GET(c, 16) > > > +#define DRM_ARGB64_GETB(c) __DRM_ARGB64_GET(c, 0) > > > + > > > +#define DRM_ARGB64_GETA_BPC(c, bpc) __DRM_ARGB64_GET_BPC(c, 48, bpc) > > > +#define DRM_ARGB64_GETR_BPC(c, bpc) __DRM_ARGB64_GET_BPC(c, 32, bpc) > > > +#define DRM_ARGB64_GETG_BPC(c, bpc) __DRM_ARGB64_GET_BPC(c, 16, bpc) > > > +#define DRM_ARGB64_GETB_BPC(c, bpc) __DRM_ARGB64_GET_BPC(c, 0, bpc) > > > + > > > +#define DRM_ARGB64_GETA_BPCS(c, bpc) __DRM_ARGB64_GET_BPCS(c, 48, bpc) > > > +#define DRM_ARGB64_GETR_BPCS(c, bpc) __DRM_ARGB64_GET_BPCS(c, 32, bpc) > > > +#define DRM_ARGB64_GETG_BPCS(c, bpc) __DRM_ARGB64_GET_BPCS(c, 16, bpc) > > > +#define DRM_ARGB64_GETB_BPCS(c, bpc) __DRM_ARGB64_GET_BPCS(c, 0, bpc) > > > + > > > #if defined(__cplusplus) > > > } > > > #endif
Quoting Laurent Pinchart (2026-06-26 12:06:05) > On Fri, Jun 26, 2026 at 11:57:52AM +0100, Kieran Bingham wrote: > > Quoting Barnabás Pőcze (2026-06-26 11:51:14) > > > 2026. 06. 26. 12:20 keltezéssel, Kieran Bingham írta: > > > > This updates only linux/drm_fourcc.h and linux/drm_mode.h to bring in > > > > > > Does this mean other files have changed that are not updated? > > > > The other differences were only removing (undoing) changes we've made > > locally. > > Sounds like it would be useful for the update-kernel-headers.sh to > propose a standardized commit message, to streamline reviews of future > updates. Is my proposal on my reply to you generic enough ? -- Kieran
On Fri, Jun 26, 2026 at 11:59:02AM +0100, Kieran Bingham wrote: > Quoting Laurent Pinchart (2026-06-26 11:50:16) > > On Fri, Jun 26, 2026 at 11:20:40AM +0100, Kieran Bingham wrote: > > > This updates only linux/drm_fourcc.h and linux/drm_mode.h to bring in > > > updates from Linux 7.1 including an ARM 64k interleaved modifier, > > > panel-type properties, and some interesting ARGB accessor macros. > > > > As those are of no use for libcamera I wouldn't have listed the detailed > > changes here. > > Would you be happier with the following ?: > > > include: linux: Update to Linux 7.1 s/7.1/v7.1/ > Refresh the kernel headers we import to bring in new changes from the > latest release, without undoing local libcamera specific modifications. Let's also record that update-kernel-headers.sh was used, I think that's important information. Copying a previous commit message for a similar update, you could write Update the kernel headers to v7.1 using utils/update-kernel-headers.sh. Preserve the libcamera local modifications manually. or something like that. > Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> > > > > libcamera specific local changes are preserved. > > > > > > Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> > > > > Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > > > > > --- > > > include/linux/README | 2 +- > > > include/linux/drm_fourcc.h | 16 ++++++++ > > > include/linux/drm_mode.h | 84 ++++++++++++++++++++++++++++++++++++++ > > > 3 files changed, 101 insertions(+), 1 deletion(-) > > > > > > diff --git a/include/linux/README b/include/linux/README > > > index b02952bb28ca..9303e0f14ae6 100644 > > > --- a/include/linux/README > > > +++ b/include/linux/README > > > @@ -1,4 +1,4 @@ > > > # SPDX-License-Identifier: CC0-1.0 > > > > > > -Files in this directory are imported from v7.0 of the Linux kernel. Do not > > > +Files in this directory are imported from v7.1 of the Linux kernel. Do not > > > modify them manually. > > > diff --git a/include/linux/drm_fourcc.h b/include/linux/drm_fourcc.h > > > index e8a3d949032b..8e2a6abae62f 100644 > > > --- a/include/linux/drm_fourcc.h > > > +++ b/include/linux/drm_fourcc.h > > > @@ -1480,6 +1480,22 @@ drm_fourcc_canonicalize_nvidia_format_mod(__u64 modifier) > > > #define DRM_FORMAT_MOD_ARM_16X16_BLOCK_U_INTERLEAVED \ > > > DRM_FORMAT_MOD_ARM_CODE(DRM_FORMAT_MOD_ARM_TYPE_MISC, 1ULL) > > > > > > +/* > > > + * ARM 64k interleaved modifier > > > + * > > > + * This is used by ARM Mali v10+ GPUs. With this modifier, the plane is divided > > > + * into 64k byte 1:1 or 2:1 -sided tiles. The 64k tiles are laid out linearly. > > > + * Each 64k tile is divided into blocks of 16x16 texel blocks, which are > > > + * themselves laid out linearly within a 64k tile. Then within each 16x16 > > > + * block, texel blocks are laid out according to U order, similar to > > > + * 16X16_BLOCK_U_INTERLEAVED. > > > + * > > > + * Note that unlike 16X16_BLOCK_U_INTERLEAVED, the layout does not change > > > + * depending on whether a format is compressed or not. > > > + */ > > > +#define DRM_FORMAT_MOD_ARM_INTERLEAVED_64K \ > > > + DRM_FORMAT_MOD_ARM_CODE(DRM_FORMAT_MOD_ARM_TYPE_MISC, 2ULL) > > > + > > > /* > > > * Allwinner tiled modifier > > > * > > > diff --git a/include/linux/drm_mode.h b/include/linux/drm_mode.h > > > index 8894b7a80732..381a3e857d4e 100644 > > > --- a/include/linux/drm_mode.h > > > +++ b/include/linux/drm_mode.h > > > @@ -10,6 +10,9 @@ > > > #ifndef _DRM_MODE_H > > > #define _DRM_MODE_H > > > > > > +#include <linux/bits.h> > > > +#include <linux/const.h> > > > + > > > #include "drm.h" > > > > > > #if defined(__cplusplus) > > > @@ -149,6 +152,10 @@ extern "C" { > > > #define DRM_MODE_LINK_STATUS_GOOD 0 > > > #define DRM_MODE_LINK_STATUS_BAD 1 > > > > > > +/* Panel type property */ > > > +#define DRM_MODE_PANEL_TYPE_UNKNOWN 0 > > > +#define DRM_MODE_PANEL_TYPE_OLED 1 > > > + > > > /* > > > * DRM_MODE_ROTATE_<degrees> > > > * > > > @@ -1528,6 +1535,83 @@ struct drm_mode_closefb { > > > __u32 pad; > > > }; > > > > > > +/* > > > + * Put 16-bit ARGB values into a standard 64-bit representation that can be > > > + * used for ioctl parameters, inter-driver communication, etc. > > > + * > > > + * If the component values being provided contain less than 16 bits of > > > + * precision, use a conversion ratio to get a better color approximation. > > > + * The ratio is computed as (2^16 - 1) / (2^bpc - 1), where bpc and 16 are > > > + * the input and output precision, respectively. > > > + * Also note bpc must be greater than 0. > > > + */ > > > +#define __DRM_ARGB64_PREP(c, shift) \ > > > + (((__u64)(c) & __GENMASK(15, 0)) << (shift)) > > > + > > > +#define __DRM_ARGB64_PREP_BPC(c, shift, bpc) \ > > > +({ \ > > > + __u16 mask = __GENMASK((bpc) - 1, 0); \ > > > + __u16 conv = __KERNEL_DIV_ROUND_CLOSEST((mask & (c)) * \ > > > + __GENMASK(15, 0), mask);\ > > > + __DRM_ARGB64_PREP(conv, shift); \ > > > +}) > > > + > > > +#define DRM_ARGB64_PREP(alpha, red, green, blue) \ > > > +( \ > > > + __DRM_ARGB64_PREP(alpha, 48) | \ > > > + __DRM_ARGB64_PREP(red, 32) | \ > > > + __DRM_ARGB64_PREP(green, 16) | \ > > > + __DRM_ARGB64_PREP(blue, 0) \ > > > +) > > > + > > > +#define DRM_ARGB64_PREP_BPC(alpha, red, green, blue, bpc) \ > > > +({ \ > > > + __typeof__(bpc) __bpc = bpc; \ > > > + __DRM_ARGB64_PREP_BPC(alpha, 48, __bpc) | \ > > > + __DRM_ARGB64_PREP_BPC(red, 32, __bpc) | \ > > > + __DRM_ARGB64_PREP_BPC(green, 16, __bpc) | \ > > > + __DRM_ARGB64_PREP_BPC(blue, 0, __bpc); \ > > > +}) > > > + > > > +/* > > > + * Extract the specified color component from a standard 64-bit ARGB value. > > > + * > > > + * If the requested precision is less than 16 bits, make use of a conversion > > > + * ratio calculated as (2^bpc - 1) / (2^16 - 1), where bpc and 16 are the > > > + * output and input precision, respectively. > > > + * > > > + * If speed is more important than accuracy, use DRM_ARGB64_GET*_BPCS() > > > + * instead of DRM_ARGB64_GET*_BPC() in order to replace the expensive > > > + * division with a simple bit right-shift operation. > > > + */ > > > +#define __DRM_ARGB64_GET(c, shift) \ > > > + ((__u16)(((__u64)(c) >> (shift)) & __GENMASK(15, 0))) > > > + > > > +#define __DRM_ARGB64_GET_BPC(c, shift, bpc) \ > > > +({ \ > > > + __u16 comp = __DRM_ARGB64_GET(c, shift); \ > > > + __KERNEL_DIV_ROUND_CLOSEST(comp * __GENMASK((bpc) - 1, 0), \ > > > + __GENMASK(15, 0)); \ > > > +}) > > > + > > > +#define __DRM_ARGB64_GET_BPCS(c, shift, bpc) \ > > > + (__DRM_ARGB64_GET(c, shift) >> (16 - (bpc))) > > > + > > > +#define DRM_ARGB64_GETA(c) __DRM_ARGB64_GET(c, 48) > > > +#define DRM_ARGB64_GETR(c) __DRM_ARGB64_GET(c, 32) > > > +#define DRM_ARGB64_GETG(c) __DRM_ARGB64_GET(c, 16) > > > +#define DRM_ARGB64_GETB(c) __DRM_ARGB64_GET(c, 0) > > > + > > > +#define DRM_ARGB64_GETA_BPC(c, bpc) __DRM_ARGB64_GET_BPC(c, 48, bpc) > > > +#define DRM_ARGB64_GETR_BPC(c, bpc) __DRM_ARGB64_GET_BPC(c, 32, bpc) > > > +#define DRM_ARGB64_GETG_BPC(c, bpc) __DRM_ARGB64_GET_BPC(c, 16, bpc) > > > +#define DRM_ARGB64_GETB_BPC(c, bpc) __DRM_ARGB64_GET_BPC(c, 0, bpc) > > > + > > > +#define DRM_ARGB64_GETA_BPCS(c, bpc) __DRM_ARGB64_GET_BPCS(c, 48, bpc) > > > +#define DRM_ARGB64_GETR_BPCS(c, bpc) __DRM_ARGB64_GET_BPCS(c, 32, bpc) > > > +#define DRM_ARGB64_GETG_BPCS(c, bpc) __DRM_ARGB64_GET_BPCS(c, 16, bpc) > > > +#define DRM_ARGB64_GETB_BPCS(c, bpc) __DRM_ARGB64_GET_BPCS(c, 0, bpc) > > > + > > > #if defined(__cplusplus) > > > } > > > #endif
diff --git a/include/linux/README b/include/linux/README index b02952bb28ca..9303e0f14ae6 100644 --- a/include/linux/README +++ b/include/linux/README @@ -1,4 +1,4 @@ # SPDX-License-Identifier: CC0-1.0 -Files in this directory are imported from v7.0 of the Linux kernel. Do not +Files in this directory are imported from v7.1 of the Linux kernel. Do not modify them manually. diff --git a/include/linux/drm_fourcc.h b/include/linux/drm_fourcc.h index e8a3d949032b..8e2a6abae62f 100644 --- a/include/linux/drm_fourcc.h +++ b/include/linux/drm_fourcc.h @@ -1480,6 +1480,22 @@ drm_fourcc_canonicalize_nvidia_format_mod(__u64 modifier) #define DRM_FORMAT_MOD_ARM_16X16_BLOCK_U_INTERLEAVED \ DRM_FORMAT_MOD_ARM_CODE(DRM_FORMAT_MOD_ARM_TYPE_MISC, 1ULL) +/* + * ARM 64k interleaved modifier + * + * This is used by ARM Mali v10+ GPUs. With this modifier, the plane is divided + * into 64k byte 1:1 or 2:1 -sided tiles. The 64k tiles are laid out linearly. + * Each 64k tile is divided into blocks of 16x16 texel blocks, which are + * themselves laid out linearly within a 64k tile. Then within each 16x16 + * block, texel blocks are laid out according to U order, similar to + * 16X16_BLOCK_U_INTERLEAVED. + * + * Note that unlike 16X16_BLOCK_U_INTERLEAVED, the layout does not change + * depending on whether a format is compressed or not. + */ +#define DRM_FORMAT_MOD_ARM_INTERLEAVED_64K \ + DRM_FORMAT_MOD_ARM_CODE(DRM_FORMAT_MOD_ARM_TYPE_MISC, 2ULL) + /* * Allwinner tiled modifier * diff --git a/include/linux/drm_mode.h b/include/linux/drm_mode.h index 8894b7a80732..381a3e857d4e 100644 --- a/include/linux/drm_mode.h +++ b/include/linux/drm_mode.h @@ -10,6 +10,9 @@ #ifndef _DRM_MODE_H #define _DRM_MODE_H +#include <linux/bits.h> +#include <linux/const.h> + #include "drm.h" #if defined(__cplusplus) @@ -149,6 +152,10 @@ extern "C" { #define DRM_MODE_LINK_STATUS_GOOD 0 #define DRM_MODE_LINK_STATUS_BAD 1 +/* Panel type property */ +#define DRM_MODE_PANEL_TYPE_UNKNOWN 0 +#define DRM_MODE_PANEL_TYPE_OLED 1 + /* * DRM_MODE_ROTATE_<degrees> * @@ -1528,6 +1535,83 @@ struct drm_mode_closefb { __u32 pad; }; +/* + * Put 16-bit ARGB values into a standard 64-bit representation that can be + * used for ioctl parameters, inter-driver communication, etc. + * + * If the component values being provided contain less than 16 bits of + * precision, use a conversion ratio to get a better color approximation. + * The ratio is computed as (2^16 - 1) / (2^bpc - 1), where bpc and 16 are + * the input and output precision, respectively. + * Also note bpc must be greater than 0. + */ +#define __DRM_ARGB64_PREP(c, shift) \ + (((__u64)(c) & __GENMASK(15, 0)) << (shift)) + +#define __DRM_ARGB64_PREP_BPC(c, shift, bpc) \ +({ \ + __u16 mask = __GENMASK((bpc) - 1, 0); \ + __u16 conv = __KERNEL_DIV_ROUND_CLOSEST((mask & (c)) * \ + __GENMASK(15, 0), mask);\ + __DRM_ARGB64_PREP(conv, shift); \ +}) + +#define DRM_ARGB64_PREP(alpha, red, green, blue) \ +( \ + __DRM_ARGB64_PREP(alpha, 48) | \ + __DRM_ARGB64_PREP(red, 32) | \ + __DRM_ARGB64_PREP(green, 16) | \ + __DRM_ARGB64_PREP(blue, 0) \ +) + +#define DRM_ARGB64_PREP_BPC(alpha, red, green, blue, bpc) \ +({ \ + __typeof__(bpc) __bpc = bpc; \ + __DRM_ARGB64_PREP_BPC(alpha, 48, __bpc) | \ + __DRM_ARGB64_PREP_BPC(red, 32, __bpc) | \ + __DRM_ARGB64_PREP_BPC(green, 16, __bpc) | \ + __DRM_ARGB64_PREP_BPC(blue, 0, __bpc); \ +}) + +/* + * Extract the specified color component from a standard 64-bit ARGB value. + * + * If the requested precision is less than 16 bits, make use of a conversion + * ratio calculated as (2^bpc - 1) / (2^16 - 1), where bpc and 16 are the + * output and input precision, respectively. + * + * If speed is more important than accuracy, use DRM_ARGB64_GET*_BPCS() + * instead of DRM_ARGB64_GET*_BPC() in order to replace the expensive + * division with a simple bit right-shift operation. + */ +#define __DRM_ARGB64_GET(c, shift) \ + ((__u16)(((__u64)(c) >> (shift)) & __GENMASK(15, 0))) + +#define __DRM_ARGB64_GET_BPC(c, shift, bpc) \ +({ \ + __u16 comp = __DRM_ARGB64_GET(c, shift); \ + __KERNEL_DIV_ROUND_CLOSEST(comp * __GENMASK((bpc) - 1, 0), \ + __GENMASK(15, 0)); \ +}) + +#define __DRM_ARGB64_GET_BPCS(c, shift, bpc) \ + (__DRM_ARGB64_GET(c, shift) >> (16 - (bpc))) + +#define DRM_ARGB64_GETA(c) __DRM_ARGB64_GET(c, 48) +#define DRM_ARGB64_GETR(c) __DRM_ARGB64_GET(c, 32) +#define DRM_ARGB64_GETG(c) __DRM_ARGB64_GET(c, 16) +#define DRM_ARGB64_GETB(c) __DRM_ARGB64_GET(c, 0) + +#define DRM_ARGB64_GETA_BPC(c, bpc) __DRM_ARGB64_GET_BPC(c, 48, bpc) +#define DRM_ARGB64_GETR_BPC(c, bpc) __DRM_ARGB64_GET_BPC(c, 32, bpc) +#define DRM_ARGB64_GETG_BPC(c, bpc) __DRM_ARGB64_GET_BPC(c, 16, bpc) +#define DRM_ARGB64_GETB_BPC(c, bpc) __DRM_ARGB64_GET_BPC(c, 0, bpc) + +#define DRM_ARGB64_GETA_BPCS(c, bpc) __DRM_ARGB64_GET_BPCS(c, 48, bpc) +#define DRM_ARGB64_GETR_BPCS(c, bpc) __DRM_ARGB64_GET_BPCS(c, 32, bpc) +#define DRM_ARGB64_GETG_BPCS(c, bpc) __DRM_ARGB64_GET_BPCS(c, 16, bpc) +#define DRM_ARGB64_GETB_BPCS(c, bpc) __DRM_ARGB64_GET_BPCS(c, 0, bpc) + #if defined(__cplusplus) } #endif
This updates only linux/drm_fourcc.h and linux/drm_mode.h to bring in updates from Linux 7.1 including an ARM 64k interleaved modifier, panel-type properties, and some interesting ARGB accessor macros. libcamera specific local changes are preserved. Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> --- include/linux/README | 2 +- include/linux/drm_fourcc.h | 16 ++++++++ include/linux/drm_mode.h | 84 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 101 insertions(+), 1 deletion(-)