]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/amdgpu: Fix UVD min buffer sizes
authorDavid Rosca <david.rosca@amd.com>
Thu, 30 Jul 2026 16:05:52 +0000 (18:05 +0200)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 12 Aug 2026 14:22:24 +0000 (10:22 -0400)
Use correct size for message buffer = sizeof(struct ruvd_msg).
Add ITSCALING_TABLE_BUFFER size.

Signed-off-by: David Rosca <david.rosca@amd.com>
Acked-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: Ruijing Dong <ruijing.dong@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit 37519d007e4261febbcf35b3045f8344f3145497)
Cc: stable@vger.kernel.org
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c

index 004a95d63b0949236b3eef8ba847d3061ed4987b..7560bee895079c1f6f341cc37a35ff1cc4cd1daa 100644 (file)
@@ -918,15 +918,16 @@ static int amdgpu_uvd_cs_pass2(struct amdgpu_uvd_cs_ctx *ctx)
                                  ctx->buf_sizes[cmd]);
                        return -EINVAL;
                }
+       } else if (cmd == 0x204 || cmd == 0x206) {
+               unsigned int min_size = ctx->buf_sizes[cmd == 0x204 ? 5 : 4];
 
-       } else if (cmd == 0x206) {
-               if ((end - start) < ctx->buf_sizes[4]) {
+               if ((end - start) < min_size) {
                        DRM_ERROR("buffer (%d) to small (%d / %d)!\n", cmd,
                                          (unsigned int)(end - start),
-                                         ctx->buf_sizes[4]);
+                                         min_size);
                        return -EINVAL;
                }
-       } else if ((cmd != 0x100) && (cmd != 0x204)) {
+       } else if ((cmd != 0x100)) {
                DRM_ERROR("invalid UVD command %X!\n", cmd);
                return -EINVAL;
        }
@@ -1056,11 +1057,12 @@ int amdgpu_uvd_ring_parse_cs(struct amdgpu_cs_parser *parser,
 {
        struct amdgpu_uvd_cs_ctx ctx = {};
        unsigned int buf_sizes[] = {
-               [0x00000000]    =       2048,
+               [0x00000000]    =       3556,
                [0x00000001]    =       0xFFFFFFFF,
                [0x00000002]    =       0xFFFFFFFF,
                [0x00000003]    =       2048,
                [0x00000004]    =       0xFFFFFFFF,
+               [0x00000005]    =       992,
        };
        int r;