Skip to contentSkip to conversation

drm/fourcc: Add Arm 16x16 block modifier

PATCH In review Raymond Smith 5 participants 10 messages Jun 21, 2019 – Sep 30, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/fourcc: Add Arm 16x16 block modifier

Add the DRM_FORMAT_MOD_ARM_16X16_BLOCK_U_INTERLEAVED modifier to denote the 16x16 block u-interleaved format used in Arm Utgard and Midgard GPUs.

---
 include/uapi/drm/drm_fourcc.h | 10 ++++++++++
 1 file changed, 10 insertions(+)
include/uapi/drm/drm_fourcc.h +10 -0
index 3feeaa3..8ed7ecf 100644
@@ -743,6 +743,16 @@ extern "C" {
 #define AFBC_FORMAT_MOD_BCH     (1ULL << 11)
 
 /*
+ * Arm 16x16 Block U-Interleaved modifier
+ *
+ * This is used by Arm Mali Utgard and Midgard GPUs. It divides the image
+ * into 16x16 pixel blocks. Blocks are stored linearly in order, but pixels
+ * in the block are reordered.
+ */
+#define DRM_FORMAT_MOD_ARM_16X16_BLOCK_U_INTERLEAVED \
+	fourcc_mod_code(ARM, ((1ULL << 55) | 1))
+
+/*
  * Allwinner tiled modifier
  *
  * This tiling mode is implemented by the VPU found on all Allwinner platforms,
Signature · 1 line
2.7.4
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Raymond Smith

Add the DRM_FORMAT_MOD_ARM_16X16_BLOCK_U_INTERLEAVED modifier to denote the 16x16 block u-interleaved format used in Arm Utgard and Midgard GPUs.

Thanks for chasing this down!

Quoted 28 lines
---
 include/uapi/drm/drm_fourcc.h | 10 ++++++++++
 1 file changed, 10 insertions(+)
include/uapi/drm/drm_fourcc.h +10 -0
index 3feeaa3..8ed7ecf 100644
@@ -743,6 +743,16 @@ extern "C" {
 #define AFBC_FORMAT_MOD_BCH     (1ULL << 11)
 
 /*
+ * Arm 16x16 Block U-Interleaved modifier
+ *
+ * This is used by Arm Mali Utgard and Midgard GPUs. It divides the image
+ * into 16x16 pixel blocks. Blocks are stored linearly in order, but pixels
+ * in the block are reordered.
+ */
+#define DRM_FORMAT_MOD_ARM_16X16_BLOCK_U_INTERLEAVED \
+	fourcc_mod_code(ARM, ((1ULL << 55) | 1))
+
+/*
  * Allwinner tiled modifier
  *
  * This tiling mode is implemented by the VPU found on all Allwinner platforms,
Signature · 1 line
2.7.4
#2 lore raw
In reply to Raymond Smith
Quoted 16 lines · Raymond Smith

Add the DRM_FORMAT_MOD_ARM_16X16_BLOCK_U_INTERLEAVED modifier to denote the 16x16 block u-interleaved format used in Arm Utgard and Midgard GPUs.

---
 include/uapi/drm/drm_fourcc.h | 10 ++++++++++
 1 file changed, 10 insertions(+)
include/uapi/drm/drm_fourcc.h +0 -0
index 3feeaa3..8ed7ecf 100644
@@ -743,6 +743,16 @@ extern "C" {
 #define AFBC_FORMAT_MOD_BCH     (1ULL << 11)

include/uapi/drm/drm_fourcc.h extern "C" { · line 753

Quoted 10 lines
include/uapi/drm/drm_fourcc.h +8 -0
 
 /*
+ * Arm 16x16 Block U-Interleaved modifier
+ *
+ * This is used by Arm Mali Utgard and Midgard GPUs. It divides the image
+ * into 16x16 pixel blocks. Blocks are stored linearly in order, but pixels
+ * in the block are reordered.
+ */
+#define DRM_FORMAT_MOD_ARM_16X16_BLOCK_U_INTERLEAVED \
+       fourcc_mod_code(ARM, ((1ULL << 55) | 1))

This seems to be an extremely random pick for a new number. What's the thinking here? Aside from "doesnt match any of the afbc combos" ofc. If you're already up to having thrown away 55bits, then it's not going to last long really :-)

I think a good idea would be to reserve a bunch of the high bits as some form of index (afbc would get index 0 for backwards compat). And then the lower bits would be for free use for a given index/mode. And the first mode is probably an enumeration, where possible modes simple get enumerated without further flags or anything.

The other bit: Would be real good to define the format a bit more precisely, including the layout within the tile.

Also ofc needs acks from lima/panfrost people since I assume they'll be using this, too.

Thanks, Daniel

Quoted 8 lines
include/uapi/drm/drm_fourcc.h +2 -1
+
+/*
  * Allwinner tiled modifier
  *
  * This tiling mode is implemented by the VPU found on all Allwinner platforms,
--

2.7.4

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#3 lore raw
Quoted 19 lines · Daniel Vetter
Quoted 17 lines · Raymond Smith

Add the DRM_FORMAT_MOD_ARM_16X16_BLOCK_U_INTERLEAVED modifier to denote the 16x16 block u-interleaved format used in Arm Utgard and Midgard GPUs.

---
 include/uapi/drm/drm_fourcc.h | 10 ++++++++++
 1 file changed, 10 insertions(+)
include/uapi/drm/drm_fourcc.h +0 -0
index 3feeaa3..8ed7ecf 100644
@@ -743,6 +743,16 @@ extern "C" {
 #define AFBC_FORMAT_MOD_BCH     (1ULL << 11)
 
Quoted 10 lines

include/uapi/drm/drm_fourcc.h extern "C" { · line 753

Quoted 9 lines
include/uapi/drm/drm_fourcc.h +8 -0
 /*
+ * Arm 16x16 Block U-Interleaved modifier
+ *
+ * This is used by Arm Mali Utgard and Midgard GPUs. It divides the image
+ * into 16x16 pixel blocks. Blocks are stored linearly in order, but pixels
+ * in the block are reordered.
+ */
+#define DRM_FORMAT_MOD_ARM_16X16_BLOCK_U_INTERLEAVED \
+       fourcc_mod_code(ARM, ((1ULL << 55) | 1))

Thanks for the patch.

Quoted 11 lines

This seems to be an extremely random pick for a new number. What's the thinking here? Aside from "doesnt match any of the afbc combos" ofc. If you're already up to having thrown away 55bits, then it's not going to last long really :-)

I think a good idea would be to reserve a bunch of the high bits as some form of index (afbc would get index 0 for backwards compat). And then the lower bits would be for free use for a given index/mode. And the first mode is probably an enumeration, where possible modes simple get enumerated without further flags or anything.

This idea is like my previous patch:
https://patchwork.kernel.org/patch/10852619/

lima driver just need a unique modifier to represent this format, so this patch is enough for lima needs.

But I'm also a little worry about the expansion of only reserve the top bit
(55) for classification from the ARM point of view. A few more bit (at least 2 for being able to represent 4 class of format) and more clear class/format fields division would be better.

Thanks,
Qiang

Quoted 6 lines

Also ofc needs acks from lima/panfrost people since I assume they'll be using this, too.

Thanks, Daniel

Quoted 14 lines
Quoted 8 lines
include/uapi/drm/drm_fourcc.h +2 -1
+
+/*
  * Allwinner tiled modifier
  *
  * This tiling mode is implemented by the VPU found on all Allwinner platforms,
--

2.7.4

--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

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

#4 lore raw
In reply to Daniel Vetter

Hi Daniel,

Quoted 33 lines · Daniel Vetter
Quoted 16 lines · Raymond Smith

Add the DRM_FORMAT_MOD_ARM_16X16_BLOCK_U_INTERLEAVED modifier to denote the 16x16 block u-interleaved format used in Arm Utgard and Midgard GPUs.

---
 include/uapi/drm/drm_fourcc.h | 10 ++++++++++
 1 file changed, 10 insertions(+)
include/uapi/drm/drm_fourcc.h +0 -0
index 3feeaa3..8ed7ecf 100644
@@ -743,6 +743,16 @@ extern "C" {
 #define AFBC_FORMAT_MOD_BCH     (1ULL << 11)

include/uapi/drm/drm_fourcc.h extern "C" { · line 753

Quoted 10 lines
include/uapi/drm/drm_fourcc.h +8 -0
 
 /*
+ * Arm 16x16 Block U-Interleaved modifier
+ *
+ * This is used by Arm Mali Utgard and Midgard GPUs. It divides the image
+ * into 16x16 pixel blocks. Blocks are stored linearly in order, but pixels
+ * in the block are reordered.
+ */
+#define DRM_FORMAT_MOD_ARM_16X16_BLOCK_U_INTERLEAVED \
+       fourcc_mod_code(ARM, ((1ULL << 55) | 1))

This seems to be an extremely random pick for a new number. What's the thinking here? Aside from "doesnt match any of the afbc combos" ofc. If you're already up to having thrown away 55bits, then it's not going to last long really :-)

Quoted 5 lines

I think a good idea would be to reserve a bunch of the high bits as some form of index (afbc would get index 0 for backwards compat). And then the lower bits would be for free use for a given index/mode. And the first mode is probably an enumeration, where possible modes simple get enumerated without further flags or anything.

Yup, that's the plan:

(0 << 55): AFBC
(1 << 55): This "non-category" for U-Interleaved (1 << 54): Whatever the next category is (3 << 54): Whatever comes after that
(1 << 53): Maybe we'll get here someday
...

I didn't want to explicitly reserve some high bits, because we've no idea how many to reserve. This way, we can assign exactly as many high bits as we need, when we need them. If any of the "modes" start encroaching towards the high bits, we'll have to make a decision at that point.

Also, this is the only U-Interleaved format (that I know of), so it's not worth calling bit 55 "The U-Interleaved bit" because that would be a waste of space. It's more like the "misc" bit, but that's not a useful name to enshrine in UAPI.

Note that isn't the same as the "not-AFBC bit", because we may well have something in the future which is neither AFBC nor "misc".

We've been very careful in our code to enforce all undefined/unrecognised bits to be zero, to ensure that this works.

Quoted 3 lines

The other bit: Would be real good to define the format a bit more precisely, including the layout within the tile.

It's U-Interleaved, obviously ;-)

-Brian

Quoted 6 lines

Also ofc needs acks from lima/panfrost people since I assume they'll be using this, too.

Thanks, Daniel

Quoted 14 lines
Quoted 8 lines
include/uapi/drm/drm_fourcc.h +2 -1
+
+/*
  * Allwinner tiled modifier
  *
  * This tiling mode is implemented by the VPU found on all Allwinner platforms,
--

2.7.4

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

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

#5 lore raw
Quoted 43 lines · Brian Starkey

Hi Daniel,

Quoted 33 lines · Daniel Vetter
Quoted 16 lines · Raymond Smith

Add the DRM_FORMAT_MOD_ARM_16X16_BLOCK_U_INTERLEAVED modifier to denote the 16x16 block u-interleaved format used in Arm Utgard and Midgard GPUs.

---
 include/uapi/drm/drm_fourcc.h | 10 ++++++++++
 1 file changed, 10 insertions(+)
include/uapi/drm/drm_fourcc.h +0 -0
index 3feeaa3..8ed7ecf 100644
@@ -743,6 +743,16 @@ extern "C" {
 #define AFBC_FORMAT_MOD_BCH     (1ULL << 11)

include/uapi/drm/drm_fourcc.h extern "C" { · line 753

Quoted 10 lines
include/uapi/drm/drm_fourcc.h +8 -0
 
 /*
+ * Arm 16x16 Block U-Interleaved modifier
+ *
+ * This is used by Arm Mali Utgard and Midgard GPUs. It divides the image
+ * into 16x16 pixel blocks. Blocks are stored linearly in order, but pixels
+ * in the block are reordered.
+ */
+#define DRM_FORMAT_MOD_ARM_16X16_BLOCK_U_INTERLEAVED \
+       fourcc_mod_code(ARM, ((1ULL << 55) | 1))

This seems to be an extremely random pick for a new number. What's the thinking here? Aside from "doesnt match any of the afbc combos" ofc. If you're already up to having thrown away 55bits, then it's not going to last long really :-)

Quoted 5 lines

I think a good idea would be to reserve a bunch of the high bits as some form of index (afbc would get index 0 for backwards compat). And then the lower bits would be for free use for a given index/mode. And the first mode is probably an enumeration, where possible modes simple get enumerated without further flags or anything.

Quoted 7 lines

Yup, that's the plan:

(0 << 55): AFBC
(1 << 55): This "non-category" for U-Interleaved (1 << 54): Whatever the next category is (3 << 54): Whatever comes after that
(1 << 53): Maybe we'll get here someday

Uh, so the index would be encoded with least-significant bit first, starting from bit55 downwards? Clever idea, but I think this needs a macro (or at least a comment). Not sure there's a ready-made bitmask mirror function for this stuff, works case we can hand-code it and extend every time we need one more bit encoded. Something like:

MIRROR_U32((u & (BIT(0)) << 31 | (u & BIT(1) << 30 | ...)

And then shift that to the correct place. Probably want an

ARM_MODIFIER_ENCODE(space_idx, flags) macro which assembles everything.

Quoted 8 lines
        ...

I didn't want to explicitly reserve some high bits, because we've no idea how many to reserve. This way, we can assign exactly as many high bits as we need, when we need them. If any of the "modes" start encroaching towards the high bits, we'll have to make a decision at that point.

Quoted 4 lines

Also, this is the only U-Interleaved format (that I know of), so it's not worth calling bit 55 "The U-Interleaved bit" because that would be a waste of space. It's more like the "misc" bit, but that's not a useful name to enshrine in UAPI.

Yeah that's what I meant. Also better to explicitly reserve this, i.e.

#define ARM_FBC_MODIFIER_SPACE 0
#define ARM_MISC_MODIFIER_SPACE 1

and then encode with the mirror trickery.

Quoted 11 lines

Note that isn't the same as the "not-AFBC bit", because we may well have something in the future which is neither AFBC nor "misc".

We've been very careful in our code to enforce all undefined/unrecognised bits to be zero, to ensure that this works.

Quoted 3 lines

The other bit: Would be real good to define the format a bit more precisely, including the layout within the tile.

It's U-Interleaved, obviously ;-)

:-) I mean full code exists in panfrost/lima, so this won't change anything really ...

Cheers, Daniel

Quoted 23 lines

-Brian

Quoted 20 lines

Also ofc needs acks from lima/panfrost people since I assume they'll be using this, too.

Thanks, Daniel

Quoted 8 lines
include/uapi/drm/drm_fourcc.h +2 -1
+
+/*
  * Allwinner tiled modifier
  *
  * This tiling mode is implemented by the VPU found on all Allwinner platforms,
--

2.7.4

--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#6 lore raw
Quoted 46 lines · Daniel Vetter
Quoted 45 lines · Brian Starkey

Hi Daniel,

Quoted 33 lines · Daniel Vetter
Quoted 16 lines · Raymond Smith

Add the DRM_FORMAT_MOD_ARM_16X16_BLOCK_U_INTERLEAVED modifier to denote the 16x16 block u-interleaved format used in Arm Utgard and Midgard GPUs.

---
 include/uapi/drm/drm_fourcc.h | 10 ++++++++++
 1 file changed, 10 insertions(+)
include/uapi/drm/drm_fourcc.h +0 -0
index 3feeaa3..8ed7ecf 100644
@@ -743,6 +743,16 @@ extern "C" {
 #define AFBC_FORMAT_MOD_BCH     (1ULL << 11)

include/uapi/drm/drm_fourcc.h extern "C" { · line 753

Quoted 10 lines
include/uapi/drm/drm_fourcc.h +8 -0
 
 /*
+ * Arm 16x16 Block U-Interleaved modifier
+ *
+ * This is used by Arm Mali Utgard and Midgard GPUs. It divides the image
+ * into 16x16 pixel blocks. Blocks are stored linearly in order, but pixels
+ * in the block are reordered.
+ */
+#define DRM_FORMAT_MOD_ARM_16X16_BLOCK_U_INTERLEAVED \
+       fourcc_mod_code(ARM, ((1ULL << 55) | 1))

This seems to be an extremely random pick for a new number. What's the thinking here? Aside from "doesnt match any of the afbc combos" ofc. If you're already up to having thrown away 55bits, then it's not going to last long really :-)

Quoted 5 lines

I think a good idea would be to reserve a bunch of the high bits as some form of index (afbc would get index 0 for backwards compat). And then the lower bits would be for free use for a given index/mode. And the first mode is probably an enumeration, where possible modes simple get enumerated without further flags or anything.

Yup, that's the plan:

Quoted 8 lines
Quoted 5 lines

(0 << 55): AFBC
(1 << 55): This "non-category" for U-Interleaved (1 << 54): Whatever the next category is (3 << 54): Whatever comes after that
(1 << 53): Maybe we'll get here someday

Uh, so the index would be encoded with least-significant bit first, starting from bit55 downwards?

Yeah.

Quoted 7 lines

Clever idea, but I think this needs a
macro (or at least a comment). Not sure there's a ready-made bitmask mirror function for this stuff, works case we can hand-code it and extend every time we need one more bit encoded. Something like:

MIRROR_U32((u & (BIT(0)) << 31 | (u & BIT(1) << 30 | ...)

Is it really worth it? People can just use the definitions as written in drm_fourcc.h. I agree that we should have the high bits described in a comment though.

Quoted 17 lines

And then shift that to the correct place. Probably want an

ARM_MODIFIER_ENCODE(space_idx, flags) macro which assembles everything.

Quoted 8 lines
        ...

I didn't want to explicitly reserve some high bits, because we've no idea how many to reserve. This way, we can assign exactly as many high bits as we need, when we need them. If any of the "modes" start encroaching towards the high bits, we'll have to make a decision at that point.

Quoted 4 lines

Also, this is the only U-Interleaved format (that I know of), so it's not worth calling bit 55 "The U-Interleaved bit" because that would be a waste of space. It's more like the "misc" bit, but that's not a useful name to enshrine in UAPI.

Quoted 7 lines

Yeah that's what I meant. Also better to explicitly reserve this, i.e.

#define ARM_FBC_MODIFIER_SPACE 0
#define ARM_MISC_MODIFIER_SPACE 1

and then encode with the mirror trickery.

I don't really see the value in that either, it's just giving userspace the opportunity to depend on more stuff: more future headaches. So long as the 64-bit values are stable, that should be enough.

Quoted 7 lines
Quoted 7 lines

Note that isn't the same as the "not-AFBC bit", because we may well have something in the future which is neither AFBC nor "misc".

We've been very careful in our code to enforce all undefined/unrecognised bits to be zero, to ensure that this works.

Quoted 1 line
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

The other bit: Would be real good to define the format a bit more precisely, including the layout within the tile.

It's U-Interleaved, obviously ;-)

:-) I mean full code exists in panfrost/lima, so this won't change anything really ...

Yeah, so for us to provide a more detailed description would require another lengthy loop through our legal approval process, and I'm not sure we can make a strong business case (which is what we need) for why this is needed.

Of course, if someone happens to know the layout and wants to contribute to this file... Then I don't know how ack/r-b would work in that case, but I imagine the subsystem maintainer(s) might take issue with us attempting to block that contribution.

Thanks,
-Brian

Quoted 33 lines

Cheers, Daniel

Quoted 23 lines

-Brian

Quoted 20 lines

Also ofc needs acks from lima/panfrost people since I assume they'll be using this, too.

Thanks, Daniel

Quoted 8 lines
include/uapi/drm/drm_fourcc.h +2 -1
+
+/*
  * Allwinner tiled modifier
  *
  * This tiling mode is implemented by the VPU found on all Allwinner platforms,
--

2.7.4

--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#7 lore raw
Quoted 93 lines · Brian Starkey
Quoted 46 lines · Daniel Vetter
Quoted 45 lines · Brian Starkey

Hi Daniel,

Quoted 33 lines · Daniel Vetter
Quoted 16 lines · Raymond Smith

Add the DRM_FORMAT_MOD_ARM_16X16_BLOCK_U_INTERLEAVED modifier to denote the 16x16 block u-interleaved format used in Arm Utgard and Midgard GPUs.

---
 include/uapi/drm/drm_fourcc.h | 10 ++++++++++
 1 file changed, 10 insertions(+)
include/uapi/drm/drm_fourcc.h +0 -0
index 3feeaa3..8ed7ecf 100644
@@ -743,6 +743,16 @@ extern "C" {
 #define AFBC_FORMAT_MOD_BCH     (1ULL << 11)

include/uapi/drm/drm_fourcc.h extern "C" { · line 753

Quoted 10 lines
include/uapi/drm/drm_fourcc.h +8 -0
 
 /*
+ * Arm 16x16 Block U-Interleaved modifier
+ *
+ * This is used by Arm Mali Utgard and Midgard GPUs. It divides the image
+ * into 16x16 pixel blocks. Blocks are stored linearly in order, but pixels
+ * in the block are reordered.
+ */
+#define DRM_FORMAT_MOD_ARM_16X16_BLOCK_U_INTERLEAVED \
+       fourcc_mod_code(ARM, ((1ULL << 55) | 1))

This seems to be an extremely random pick for a new number. What's the thinking here? Aside from "doesnt match any of the afbc combos" ofc. If you're already up to having thrown away 55bits, then it's not going to last long really :-)

Quoted 5 lines

I think a good idea would be to reserve a bunch of the high bits as some form of index (afbc would get index 0 for backwards compat). And then the lower bits would be for free use for a given index/mode. And the first mode is probably an enumeration, where possible modes simple get enumerated without further flags or anything.

Yup, that's the plan:

Quoted 8 lines
Quoted 5 lines

(0 << 55): AFBC
(1 << 55): This "non-category" for U-Interleaved (1 << 54): Whatever the next category is (3 << 54): Whatever comes after that
(1 << 53): Maybe we'll get here someday

Uh, so the index would be encoded with least-significant bit first, starting from bit55 downwards?

Yeah.

Quoted 7 lines

Clever idea, but I think this needs a
macro (or at least a comment). Not sure there's a ready-made bitmask mirror function for this stuff, works case we can hand-code it and extend every time we need one more bit encoded. Something like:

MIRROR_U32((u & (BIT(0)) << 31 | (u & BIT(1) << 30 | ...)

Is it really worth it? People can just use the definitions as written in drm_fourcc.h. I agree that we should have the high bits described in a comment though.

Quoted 22 lines

And then shift that to the correct place. Probably want an

ARM_MODIFIER_ENCODE(space_idx, flags) macro which assembles everything.

Quoted 8 lines
        ...

I didn't want to explicitly reserve some high bits, because we've no idea how many to reserve. This way, we can assign exactly as many high bits as we need, when we need them. If any of the "modes" start encroaching towards the high bits, we'll have to make a decision at that point.

Quoted 4 lines

Also, this is the only U-Interleaved format (that I know of), so it's not worth calling bit 55 "The U-Interleaved bit" because that would be a waste of space. It's more like the "misc" bit, but that's not a useful name to enshrine in UAPI.

Yeah that's what I meant. Also better to explicitly reserve this, i.e.

#define ARM_FBC_MODIFIER_SPACE 0
#define ARM_MISC_MODIFIER_SPACE 1

Quoted 7 lines
Quoted 2 lines

and then encode with the mirror trickery.

I don't really see the value in that either, it's just giving userspace the opportunity to depend on more stuff: more future headaches. So long as the 64-bit values are stable, that should be enough.

If you think you need to save the few bits this potentially saves you over just encoding 8bit enum like in Qiang's original patch I think you get to type a few macros and comments ...

Quoted 20 lines
Quoted 7 lines
Quoted 7 lines

Note that isn't the same as the "not-AFBC bit", because we may well have something in the future which is neither AFBC nor "misc".

We've been very careful in our code to enforce all undefined/unrecognised bits to be zero, to ensure that this works.

Quoted 1 line
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

The other bit: Would be real good to define the format a bit more precisely, including the layout within the tile.

It's U-Interleaved, obviously ;-)

:-) I mean full code exists in panfrost/lima, so this won't change anything really ...

Yeah, so for us to provide a more detailed description would require another lengthy loop through our legal approval process, and I'm not sure we can make a strong business case (which is what we need) for why this is needed.

Quoted 4 lines

Of course, if someone happens to know the layout and wants to contribute to this file... Then I don't know how ack/r-b would work in that case, but I imagine the subsystem maintainer(s) might take issue with us attempting to block that contribution.

Well can't really take a modifier without knowing what it's for, I guess this is up to lima/panfrost folks then to figure out :-P -Daniel

Quoted 37 lines

Thanks,
-Brian

Quoted 33 lines

Cheers, Daniel

Quoted 23 lines

-Brian

Quoted 20 lines

Also ofc needs acks from lima/panfrost people since I assume they'll be using this, too.

Thanks, Daniel

Quoted 8 lines
include/uapi/drm/drm_fourcc.h +2 -1
+
+/*
  * Allwinner tiled modifier
  *
  * This tiling mode is implemented by the VPU found on all Allwinner platforms,
--

2.7.4

--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#8 lore raw

Hi guys,

I'd like to know the status of this patch? I expect a v2 adding some comments/macros about the high bit plan would be enough?

@Raymond & @Brian do you still need another long process to send out a v2 patch? If so, I can help to prepare a v2 patch according to your previous mail.

Thanks,
Qiang

Quoted 176 lines · Daniel Vetter
Quoted 93 lines · Brian Starkey
Quoted 46 lines · Daniel Vetter
Quoted 45 lines · Brian Starkey

Hi Daniel,

Quoted 33 lines · Daniel Vetter
Quoted 16 lines · Raymond Smith

Add the DRM_FORMAT_MOD_ARM_16X16_BLOCK_U_INTERLEAVED modifier to denote the 16x16 block u-interleaved format used in Arm Utgard and Midgard GPUs.

---
 include/uapi/drm/drm_fourcc.h | 10 ++++++++++
 1 file changed, 10 insertions(+)
include/uapi/drm/drm_fourcc.h +0 -0
index 3feeaa3..8ed7ecf 100644
@@ -743,6 +743,16 @@ extern "C" {
 #define AFBC_FORMAT_MOD_BCH     (1ULL << 11)

include/uapi/drm/drm_fourcc.h extern "C" { · line 753

Quoted 10 lines
include/uapi/drm/drm_fourcc.h +8 -0
 
 /*
+ * Arm 16x16 Block U-Interleaved modifier
+ *
+ * This is used by Arm Mali Utgard and Midgard GPUs. It divides the image
+ * into 16x16 pixel blocks. Blocks are stored linearly in order, but pixels
+ * in the block are reordered.
+ */
+#define DRM_FORMAT_MOD_ARM_16X16_BLOCK_U_INTERLEAVED \
+       fourcc_mod_code(ARM, ((1ULL << 55) | 1))

This seems to be an extremely random pick for a new number. What's the thinking here? Aside from "doesnt match any of the afbc combos" ofc. If you're already up to having thrown away 55bits, then it's not going to last long really :-)

Quoted 5 lines

I think a good idea would be to reserve a bunch of the high bits as some form of index (afbc would get index 0 for backwards compat). And then the lower bits would be for free use for a given index/mode. And the first mode is probably an enumeration, where possible modes simple get enumerated without further flags or anything.

Yup, that's the plan:

Quoted 8 lines
Quoted 5 lines

(0 << 55): AFBC
(1 << 55): This "non-category" for U-Interleaved (1 << 54): Whatever the next category is (3 << 54): Whatever comes after that
(1 << 53): Maybe we'll get here someday

Uh, so the index would be encoded with least-significant bit first, starting from bit55 downwards?

Yeah.

Quoted 7 lines

Clever idea, but I think this needs a
macro (or at least a comment). Not sure there's a ready-made bitmask mirror function for this stuff, works case we can hand-code it and extend every time we need one more bit encoded. Something like:

MIRROR_U32((u & (BIT(0)) << 31 | (u & BIT(1) << 30 | ...)

Is it really worth it? People can just use the definitions as written in drm_fourcc.h. I agree that we should have the high bits described in a comment though.

Quoted 22 lines

And then shift that to the correct place. Probably want an

ARM_MODIFIER_ENCODE(space_idx, flags) macro which assembles everything.

Quoted 8 lines
        ...

I didn't want to explicitly reserve some high bits, because we've no idea how many to reserve. This way, we can assign exactly as many high bits as we need, when we need them. If any of the "modes" start encroaching towards the high bits, we'll have to make a decision at that point.

Quoted 4 lines

Also, this is the only U-Interleaved format (that I know of), so it's not worth calling bit 55 "The U-Interleaved bit" because that would be a waste of space. It's more like the "misc" bit, but that's not a useful name to enshrine in UAPI.

Yeah that's what I meant. Also better to explicitly reserve this, i.e.

#define ARM_FBC_MODIFIER_SPACE 0
#define ARM_MISC_MODIFIER_SPACE 1

Quoted 7 lines
Quoted 2 lines

and then encode with the mirror trickery.

I don't really see the value in that either, it's just giving userspace the opportunity to depend on more stuff: more future headaches. So long as the 64-bit values are stable, that should be enough.

If you think you need to save the few bits this potentially saves you over just encoding 8bit enum like in Qiang's original patch I think you get to type a few macros and comments ...

Quoted 20 lines
Quoted 7 lines
Quoted 7 lines

Note that isn't the same as the "not-AFBC bit", because we may well have something in the future which is neither AFBC nor "misc".

We've been very careful in our code to enforce all undefined/unrecognised bits to be zero, to ensure that this works.

Quoted 1 line
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

The other bit: Would be real good to define the format a bit more precisely, including the layout within the tile.

It's U-Interleaved, obviously ;-)

:-) I mean full code exists in panfrost/lima, so this won't change anything really ...

Yeah, so for us to provide a more detailed description would require another lengthy loop through our legal approval process, and I'm not sure we can make a strong business case (which is what we need) for why this is needed.

Quoted 4 lines

Of course, if someone happens to know the layout and wants to contribute to this file... Then I don't know how ack/r-b would work in that case, but I imagine the subsystem maintainer(s) might take issue with us attempting to block that contribution.

Well can't really take a modifier without knowing what it's for, I guess this is up to lima/panfrost folks then to figure out :-P -Daniel

Quoted 37 lines

Thanks,
-Brian

Quoted 33 lines

Cheers, Daniel

Quoted 23 lines

-Brian

Quoted 20 lines

Also ofc needs acks from lima/panfrost people since I assume they'll be using this, too.

Thanks, Daniel

Quoted 8 lines
include/uapi/drm/drm_fourcc.h +2 -1
+
+/*
  * Allwinner tiled modifier
  *
  * This tiling mode is implemented by the VPU found on all Allwinner platforms,
--

2.7.4

--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

Quoted 4 lines

--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

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

#9 lore raw
Quoted 8 lines · Qiang Yu

Hi guys,

I'd like to know the status of this patch? I expect a v2 adding some comments/macros about the high bit plan would be enough?

@Raymond & @Brian do you still need another long process to send out a v2 patch? If so, I can help to prepare a v2 patch according to your previous mail.

Apologies for the long wait.
@Raymond has left the company, so now I will be looking into it. I will respin the patch in a day or two.

Quoted 184 lines

Thanks,
Qiang

Quoted 180 lines · Daniel Vetter
Quoted 93 lines · Brian Starkey
Quoted 46 lines · Daniel Vetter
Quoted 45 lines · Brian Starkey

Hi Daniel,

Quoted 33 lines · Daniel Vetter
Quoted 16 lines · Raymond Smith

Add the DRM_FORMAT_MOD_ARM_16X16_BLOCK_U_INTERLEAVED modifier to denote the 16x16 block u-interleaved format used in Arm Utgard and Midgard GPUs.

---
 include/uapi/drm/drm_fourcc.h | 10 ++++++++++
 1 file changed, 10 insertions(+)
include/uapi/drm/drm_fourcc.h +0 -0
index 3feeaa3..8ed7ecf 100644
@@ -743,6 +743,16 @@ extern "C" {
 #define AFBC_FORMAT_MOD_BCH     (1ULL << 11)

include/uapi/drm/drm_fourcc.h extern "C" { · line 753

Quoted 10 lines
include/uapi/drm/drm_fourcc.h +8 -0
 
 /*
+ * Arm 16x16 Block U-Interleaved modifier
+ *
+ * This is used by Arm Mali Utgard and Midgard GPUs. It divides the image
+ * into 16x16 pixel blocks. Blocks are stored linearly in order, but pixels
+ * in the block are reordered.
+ */
+#define DRM_FORMAT_MOD_ARM_16X16_BLOCK_U_INTERLEAVED \
+       fourcc_mod_code(ARM, ((1ULL << 55) | 1))

This seems to be an extremely random pick for a new number. What's the thinking here? Aside from "doesnt match any of the afbc combos" ofc. If you're already up to having thrown away 55bits, then it's not going to last long really :-)

Quoted 5 lines

I think a good idea would be to reserve a bunch of the high bits as some form of index (afbc would get index 0 for backwards compat). And then the lower bits would be for free use for a given index/mode. And the first mode is probably an enumeration, where possible modes simple get enumerated without further flags or anything.

Yup, that's the plan:

Quoted 8 lines
Quoted 5 lines

(0 << 55): AFBC
(1 << 55): This "non-category" for U-Interleaved (1 << 54): Whatever the next category is (3 << 54): Whatever comes after that
(1 << 53): Maybe we'll get here someday

Uh, so the index would be encoded with least-significant bit first, starting from bit55 downwards?

Yeah.

Quoted 7 lines

Clever idea, but I think this needs a
macro (or at least a comment). Not sure there's a ready-made bitmask mirror function for this stuff, works case we can hand-code it and extend every time we need one more bit encoded. Something like:

MIRROR_U32((u & (BIT(0)) << 31 | (u & BIT(1) << 30 | ...)

Is it really worth it? People can just use the definitions as written in drm_fourcc.h. I agree that we should have the high bits described in a comment though.

Quoted 22 lines

And then shift that to the correct place. Probably want an

ARM_MODIFIER_ENCODE(space_idx, flags) macro which assembles everything.

Quoted 8 lines
        ...

I didn't want to explicitly reserve some high bits, because we've no idea how many to reserve. This way, we can assign exactly as many high bits as we need, when we need them. If any of the "modes" start encroaching towards the high bits, we'll have to make a decision at that point.

Quoted 4 lines

Also, this is the only U-Interleaved format (that I know of), so it's not worth calling bit 55 "The U-Interleaved bit" because that would be a waste of space. It's more like the "misc" bit, but that's not a useful name to enshrine in UAPI.

Yeah that's what I meant. Also better to explicitly reserve this, i.e.

#define ARM_FBC_MODIFIER_SPACE 0
#define ARM_MISC_MODIFIER_SPACE 1

Quoted 7 lines
Quoted 2 lines

and then encode with the mirror trickery.

I don't really see the value in that either, it's just giving userspace the opportunity to depend on more stuff: more future headaches. So long as the 64-bit values are stable, that should be enough.

If you think you need to save the few bits this potentially saves you over just encoding 8bit enum like in Qiang's original patch I think you get to type a few macros and comments ...

Quoted 20 lines
Quoted 7 lines
Quoted 7 lines

Note that isn't the same as the "not-AFBC bit", because we may well have something in the future which is neither AFBC nor "misc".

We've been very careful in our code to enforce all undefined/unrecognised bits to be zero, to ensure that this works.

Quoted 1 line
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

The other bit: Would be real good to define the format a bit more precisely, including the layout within the tile.

It's U-Interleaved, obviously ;-)

:-) I mean full code exists in panfrost/lima, so this won't change anything really ...

Yeah, so for us to provide a more detailed description would require another lengthy loop through our legal approval process, and I'm not sure we can make a strong business case (which is what we need) for why this is needed.

Quoted 4 lines

Of course, if someone happens to know the layout and wants to contribute to this file... Then I don't know how ack/r-b would work in that case, but I imagine the subsystem maintainer(s) might take issue with us attempting to block that contribution.

Well can't really take a modifier without knowing what it's for, I guess this is up to lima/panfrost folks then to figure out :-P -Daniel

Quoted 37 lines

Thanks,
-Brian

Quoted 33 lines

Cheers, Daniel

Quoted 23 lines

-Brian

Quoted 20 lines

Also ofc needs acks from lima/panfrost people since I assume they'll be using this, too.

Thanks, Daniel

Quoted 8 lines
include/uapi/drm/drm_fourcc.h +2 -1
+
+/*
  * Allwinner tiled modifier
  *
  * This tiling mode is implemented by the VPU found on all Allwinner platforms,
--

2.7.4

--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

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