Answer a texture's placement through the image in place's making up to its bind

On the Radeon 780M (RADV) a guest surface whose pitch is no multiple of 256
bytes (3664 px BGRA8 at 14656 bytes a row) is refused Refusal::Pitch where the
image in place is made: the driver lays its linear image's rows out at another
pitch, and refuses the DRM_FORMAT_MOD_LINEAR image at that one. The query
stopped at the route and answered InPlace, so the consumer sent such a surface
in place and got a shadow copied in for every command buffer, the case the
query exists to prevent.

Now the image in place's making is two steps, shared: Device::unplaced makes
and checks the image of a plan before any memory is bound (over pages imported
by their pointer, in_place_unbound's linear or DRM_FORMAT_MOD_LINEAR image and
its requirements against the bytes' place and memory type; over dma-buf pages,
dma_buf_image_unbound's image checked against the pages, before the caller's
source is asked), and Device::place binds it. in_place_image runs the rows
check, then the wider plans and the declared plan through both steps as
before. The query's placement_over_buffer, where the route is the image in
place, calls Device::in_place_image_made: the same rows check and the same
unbound step for the declared plan first and then the wider plans, releasing
each image unbound, answering Shadow(Refused(kind)) with the declared plan's
refusal where none is made. Its cost: one or two VkImages where the declared
plan is made in place, a pair more per wider plan where it is refused; nothing
bound or submitted. What only the bind shows stays unknown: over dma-buf pages
the caller's source and the driver's import of its dma-buf.

The new device test a_pitch_the_device_lays_no_image_at_answers_its_shadow
asks and makes BGRA8Unorm textures at pitches past their rows (61 texels at
256..1024 bytes, 3664 texels at 14656, 14672 and 14848, a render target), each
answer equal to what the making counted, and at least one Shadow(Refused(Pitch)).

(cherry picked from commit fb619a2a4f6fa9bfa524cd7ae88c6e76a10d12ed)
This commit is contained in:
Anees Iqbal committed 2026-11-08 00:02:46 -08:00
1 parent 06099fa943
commit d60e8b5b60
8 files changed
+394 -125

No files matched your search

+10 -2
View File
@@ -392,8 +392,16 @@ where the verdict passes; a shadow and why (`TextureShadowReason`: the policy, t
check's failed or unchecked verdict with its access and row ends, a refusal, texels past the
buffer's length, a device copy); no host pages; or a shape no image in place takes. The making's
own route answers it (`texture/route.rs`), after every check the making runs before it makes
anything, so the same arguments are refused with the same errors; what only making the texture
shows (the device refusing the image in place, memory, a lost device) it does not know. A pending
anything, so the same arguments are refused with the same errors; where the route is the image in
place, the query runs the image's making up to the bind (`texture/in_place_image.rs`): it makes the
driver's linear image, and the `DRM_FORMAT_MOD_LINEAR` one where the driver lays the first out at
another pitch, checks their requirements against the bytes' place and memory type, and releases
them unbound, so a pitch, an image, a placement or rows the device refuses answer
`Shadow(Refused(..))`, the shadow the texture then is. That is one or two `VkImage`s where the
declared plan is made in place, and a pair more for each wider plan the making tries first where it
is refused; nothing is bound or submitted. Only the bind shows the rest: over pages imported as
dma-bufs, the caller's source's dma-buf and the driver's import of it; and memory or a lost device,
which fail the making. A pending
verdict starts the check, as a texture's making does. `Device::settle_in_place_checks` starts the
check and says when the verdicts are known (a zero timeout waits for nothing). They become known
once per `VkDevice`: a GPU recovery's new one reads them from the record as it is made, or checks