Module: Mesa
Branch: staging/23.2
Commit: b69195123901ff1dd896d504bdbe01ee3559415a
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=b69195123901ff1dd896d504bdbe01ee3559415a

Author: David Rosca <[email protected]>
Date:   Thu Jul 13 09:14:00 2023 +0200

radeonsi: Use DIV_ROUND_UP instead of ALIGN_POT

DIV_ROUND_UP is the correct replacement for ALIGN_TO.

Fixes: ba83c1e2
Signed-off-by: David Rosca <[email protected]>
Reviewed-by: Yonggang Luo <[email protected]>
Reviewed-by: Ruijing Dong <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24127>
(cherry picked from commit d408ae88db6df25463f6ba0165f7b5b004346658)

---

 .pick_status.json                             |  2 +-
 src/gallium/drivers/radeonsi/radeon_vcn_enc.c | 10 +++++-----
 src/gallium/drivers/radeonsi/radeon_vcn_enc.h |  2 +-
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index e259ee117d3..df6e523c96f 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -74,7 +74,7 @@
         "description": "radeonsi: Use DIV_ROUND_UP instead of ALIGN_POT",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": "ba83c1e254d8a968c166610765ab92ce4cf0778e",
         "notes": null
diff --git a/src/gallium/drivers/radeonsi/radeon_vcn_enc.c 
b/src/gallium/drivers/radeonsi/radeon_vcn_enc.c
index 611b4a957ea..638a467de93 100644
--- a/src/gallium/drivers/radeonsi/radeon_vcn_enc.c
+++ b/src/gallium/drivers/radeonsi/radeon_vcn_enc.c
@@ -719,10 +719,10 @@ static int setup_dpb(struct radeon_encoder *enc)
 
    offset = 0;
    if (enc_pic->quality_modes.pre_encode_mode) {
-      uint32_t pre_size  = ALIGN_POT((aligned_width >> 2), rec_alignment) *
-                           ALIGN_POT((aligned_height >> 2), rec_alignment);
-      uint32_t full_size = ALIGN_POT(aligned_width, rec_alignment) *
-                           ALIGN_POT(aligned_height, rec_alignment);
+      uint32_t pre_size  = DIV_ROUND_UP((aligned_width >> 2), rec_alignment) *
+                           DIV_ROUND_UP((aligned_height >> 2), rec_alignment);
+      uint32_t full_size = DIV_ROUND_UP(aligned_width, rec_alignment) *
+                           DIV_ROUND_UP(aligned_height, rec_alignment);
       pre_size  = align(pre_size, 4);
       full_size = align(full_size, 4);
 
@@ -1168,7 +1168,7 @@ static void radeon_enc_av1_bs_copy_end(struct 
radeon_encoder *enc, uint32_t bits
 {
    assert(bits > 0);
    /* it must be dword aligned at the end */
-   *enc->enc_pic.copy_start = ALIGN_POT(bits, 32) * 4 + 12;
+   *enc->enc_pic.copy_start = DIV_ROUND_UP(bits, 32) * 4 + 12;
    *(enc->enc_pic.copy_start + 2) = bits;
 }
 
diff --git a/src/gallium/drivers/radeonsi/radeon_vcn_enc.h 
b/src/gallium/drivers/radeonsi/radeon_vcn_enc.h
index 3ee2d7a11b8..8a3c165dfbd 100644
--- a/src/gallium/drivers/radeonsi/radeon_vcn_enc.h
+++ b/src/gallium/drivers/radeonsi/radeon_vcn_enc.h
@@ -177,7 +177,7 @@
 
 #define RENCODE_COLOR_SPACE_YUV                                                
     0
 
-#define PIPE_ALIGN_IN_BLOCK_SIZE(value, alignment) ALIGN_POT(value, alignment)
+#define PIPE_ALIGN_IN_BLOCK_SIZE(value, alignment) DIV_ROUND_UP(value, 
alignment)
 
 #define RADEON_ENC_CS(value) (enc->cs.current.buf[enc->cs.current.cdw++] = 
(value))
 #define RADEON_ENC_BEGIN(cmd)                                                  
                  \

Reply via email to