From: Mark Brown <broonie@kernel.org>
To: Alex Deucher <alexdeucher@gmail.com>
Cc: Alex Deucher <alexander.deucher@amd.com>,
Dave Airlie <airlied@redhat.com>,
David Rosca <david.rosca@amd.com>,
DRI <dri-devel@lists.freedesktop.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Linux Next Mailing List <linux-next@vger.kernel.org>,
Olivier Kaloudoff <olivier.kaloudoff@gmail.com>,
Prike Liang <Prike.Liang@amd.com>
Subject: linux-next: manual merge of the amdgpu tree with the drm-fixes tree
Date: Fri, 13 Nov 2026 16:07:46 +0000 [thread overview]
Message-ID: <avc10k-hNT64kqd_@sirena.org.uk> (raw)
[-- Attachment #1: Type: text/plain, Size: 5882 bytes --]
Hi all,
Today's linux-next merge of the amdgpu tree got a conflict in:
drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c
between commits:
87a841d8c0b71 ("drm/amdgpu: Fix VCE buffer size check for DPB and input surface")
e23621a91bb59 ("drm/amdgpu/vce: don't allocate a scheduler fence in the direct IB test")
c3fed6272bb47 ("drm/amdgpu: guard VCE/UVD sched entity teardown on failed probe")
from the drm-fixes tree and commits:
98a9958c22deb ("drm/amdgpu: Allow VCE SEI command in IB")
24c0be8ac3ef2 ("drm/amdgpu: Fix VCE buffer size check for DPB and input surface")
b229fdd689c8b ("drm/amdgpu: Allow multiple VCE create commands with same handle")
5349075eac146 ("drm/amdgpu: Use feedback buffer for VCE destroy message")
995905389d93b ("drm/amdgpu/vce: don't allocate a scheduler fence in the direct IB test")
from the amdgpu tree.
I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging. You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c
index 11f8fe98aac46..e2cdd5a46aa24 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c
@@ -559,7 +559,9 @@ static int amdgpu_vce_get_destroy_msg(struct amdgpu_ring *ring, uint32_t handle,
const unsigned int ib_size_dw = 1024;
struct amdgpu_job *job;
struct amdgpu_ib *ib;
+ struct amdgpu_ib ib_msg;
struct dma_fence *f = NULL;
+ uint64_t addr;
int i, r;
r = amdgpu_job_alloc_with_ib(ring->adev,
@@ -573,7 +575,17 @@ static int amdgpu_vce_get_destroy_msg(struct amdgpu_ring *ring, uint32_t handle,
if (r)
return r;
+ memset(&ib_msg, 0, sizeof(ib_msg));
+ /* only one gpu page is needed, alloc +1 page to make addr aligned. */
+ r = amdgpu_ib_get(ring->adev, NULL, AMDGPU_GPU_PAGE_SIZE * 2,
+ direct ? AMDGPU_IB_POOL_DIRECT : AMDGPU_IB_POOL_DELAYED,
+ &ib_msg);
+ if (r)
+ goto err;
+
ib = &job->ibs[0];
+ /* let addr point to page boundary */
+ addr = AMDGPU_GPU_PAGE_ALIGN(ib_msg.gpu_addr);
/* stitch together an VCE destroy msg */
ib->length_dw = 0;
@@ -587,9 +599,15 @@ static int amdgpu_vce_get_destroy_msg(struct amdgpu_ring *ring, uint32_t handle,
ib->ptr[ib->length_dw++] = 0x00000001; /* destroy session */
ib->ptr[ib->length_dw++] = 0x00000000;
ib->ptr[ib->length_dw++] = 0x00000000;
- ib->ptr[ib->length_dw++] = 0xffffffff; /* feedback is not needed, set to 0xffffffff and firmware will not output feedback */
+ ib->ptr[ib->length_dw++] = 0xffffffff;
ib->ptr[ib->length_dw++] = 0x00000000;
+ ib->ptr[ib->length_dw++] = 0x00000014; /* len */
+ ib->ptr[ib->length_dw++] = 0x05000005; /* feedback buffer */
+ ib->ptr[ib->length_dw++] = upper_32_bits(addr);
+ ib->ptr[ib->length_dw++] = addr;
+ ib->ptr[ib->length_dw++] = 0x00000001;
+
ib->ptr[ib->length_dw++] = 0x00000008; /* len */
ib->ptr[ib->length_dw++] = 0x02000001; /* destroy cmd */
@@ -600,6 +618,7 @@ static int amdgpu_vce_get_destroy_msg(struct amdgpu_ring *ring, uint32_t handle,
r = amdgpu_job_submit_direct(job, ring, &f);
else
f = amdgpu_job_submit(job);
+ amdgpu_ib_free(&ib_msg, f);
if (r)
goto err;
@@ -771,6 +790,7 @@ int amdgpu_vce_ring_parse_cs(struct amdgpu_cs_parser *p,
{
unsigned int fb_idx = 0, bs_idx = 0;
int session_idx = -1;
+ uint32_t img_size[AMDGPU_MAX_VCE_HANDLES];
uint32_t destroyed = 0;
uint32_t created = 0;
uint32_t allocated = 0;
@@ -862,7 +882,15 @@ int amdgpu_vce_ring_parse_cs(struct amdgpu_cs_parser *p,
r = session_idx;
goto out;
}
- size = &p->adev->vce.img_size[session_idx];
+ /*
+ * Stage the image size locally and only commit it once
+ * the whole IB is valid, otherwise a failed create
+ * could change the size of a live session.
+ */
+ if (!(created & (1 << session_idx)))
+ img_size[session_idx] =
+ p->adev->vce.img_size[session_idx];
+ size = &img_size[session_idx];
break;
case 0x00000002: /* task info */
@@ -875,11 +903,6 @@ int amdgpu_vce_ring_parse_cs(struct amdgpu_cs_parser *p,
if (destroyed & (1 << session_idx)) {
destroyed &= ~(1 << session_idx);
allocated |= 1 << session_idx;
-
- } else if (!(allocated & (1 << session_idx))) {
- DRM_ERROR("Handle already in use!\n");
- r = -EINVAL;
- goto out;
}
luma_pitch = amdgpu_ib_get_value(ib, idx + 8);
@@ -904,6 +927,7 @@ int amdgpu_vce_ring_parse_cs(struct amdgpu_cs_parser *p,
case 0x04000007: /* motion estimation */
case 0x04000008: /* rdo */
case 0x04000009: /* vui */
+ case 0x0400000d: /* sei */
case 0x05000002: /* auxiliary buffer */
case 0x05000009: /* clock table */
break;
@@ -1006,7 +1030,12 @@ int amdgpu_vce_ring_parse_cs(struct amdgpu_cs_parser *p,
out:
if (!r) {
- /* No error, free all destroyed handle slots */
+ /* No error, commit the image size of created sessions */
+ for (i = 0; i < AMDGPU_MAX_VCE_HANDLES; ++i)
+ if (created & (1 << i))
+ p->adev->vce.img_size[i] = img_size[i];
+
+ /* and free all destroyed handle slots */
tmp = destroyed;
} else {
/* Error during parsing, free all allocated handle slots */
@@ -1064,11 +1093,6 @@ int amdgpu_vce_ring_parse_cs_vm(struct amdgpu_cs_parser *p,
if (destroyed & (1 << session_idx)) {
destroyed &= ~(1 << session_idx);
allocated |= 1 << session_idx;
-
- } else if (!(allocated & (1 << session_idx))) {
- DRM_ERROR("Handle already in use!\n");
- r = -EINVAL;
- goto out;
}
break;
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next reply other threads:[~2026-11-13 16:07 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-13 16:07 Mark Brown [this message]
-- strict thread matches above, loose matches on Subject: below --
2026-09-18 11:49 Mark Brown
2026-06-08 11:29 Mark Brown
2026-03-05 13:37 Mark Brown
2026-02-27 14:00 Mark Brown
2021-07-23 2:58 Stephen Rothwell
2021-07-23 3:08 ` Stephen Rothwell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=avc10k-hNT64kqd_@sirena.org.uk \
--to=broonie@kernel.org \
--cc=Prike.Liang@amd.com \
--cc=airlied@redhat.com \
--cc=alexander.deucher@amd.com \
--cc=alexdeucher@gmail.com \
--cc=david.rosca@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-next@vger.kernel.org \
--cc=olivier.kaloudoff@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®