Skip to content

KMS Writeback Fixes - #4924

Merged
pelwell merged 6 commits into
raspberrypi:rpi-5.15.yfrom
mripard:rpi/5.15-writeback-fixes
Mar 7, 2022
Merged

pelwell merged 6 commits into
raspberrypi:rpi-5.15.yfrom
mripard:rpi/5.15-writeback-fixes

Conversation

@mripard

@mripard mripard commented Mar 4, 2022

Copy link
Copy Markdown
Contributor

Hi,

Here's a few fixes to fix the timeouts for the IGT writeback tests.

The last patch is probably going to be controversial, and I'm not sure what the right solution could be.
I've started a thread on the mailing lists to see if it's appropriate of if we should find a better solution:
https://lore.kernel.org/dri-devel/20220304144607.3pwfwhxf4zsckan7@houat/T/#u

Fixes #4874

mripard added 3 commits March 4, 2022 17:15
By default, the HVS driver will force the HVS output 3 to be muxed to
the HVS channel 2. However, the Transposer can only be assigned to the
HVS channel 2, so whenever we try to use the writeback connector, we'll
mux its associated output (Output 2) to the channel 2.

This leads to both the output 2 and 3 feeding from the same channel,
which is explicitly discouraged in the documentation.

In order to avoid this, let's reset all the output muxes to their reset
value.

Fixes: 87ebcd4 ("drm/vc4: crtc: Assign output to channel automatically")
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
We use the channel from our vc4_crtc_state structure in multiple places,
let's store it in a local variable to make it cleaner.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
The documentation explicitly states we must prevent the output
2 and 3 from feeding from the same HVS channel.

Let's add a warning to make some noise if we ever find ourselves in such
a case.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
@popcornmix

Copy link
Copy Markdown
Collaborator

By padding, you are referring to the X byte in XRGB8888 (rather than unused pixels if stride is wider than width)?
The transposer will write something to that (it's generally inefficient to preserve what was there, requiring a read/modify/write with wide accesses). I guess it's convention whether you say 0 or ff is the right answer.
In theory it's unused so shouldn't matter, but may be more efficient if we make the same choice as most software would like.

@mripard

mripard commented Mar 4, 2022

Copy link
Copy Markdown
Contributor Author

By padding, you are referring to the X byte in XRGB8888 (rather than unused pixels if stride is wider than width)?

Yes

The transposer will write something to that (it's generally inefficient to preserve what was there, requiring a read/modify/write with wide accesses). I guess it's convention whether you say 0 or ff is the right answer. In theory it's unused so shouldn't matter, but may be more efficient if we make the same choice as most software would like.

It's not really clear to me what most software would like :) Similarly, I'm not sure whether IGT expectations that all hardware can force the X component to 0xff is reasonable. We'll see how the discussion turns out

@6by9

6by9 commented Mar 4, 2022

Copy link
Copy Markdown
Contributor

All look reasonable to me.

Minor grammatical niggle on

The documentation explicitly states we must prevent the output 2 and 3 from feeding from the same HVS channel.

"The documentation explicitly states we must prevent one HVS channel feeding multiple outputs simultaneously.

Let's add a warning to make some noise if we ever find ourselves in such a case on output 2"

Or we could add a check on each of the channels just to make sure.

In an RGBX format you would hope that the X really was ignored, but acknowledge that for things like IGT it is far easier to just hash the entire buffer, however that does then put expectations on how the writeback connector should function.

@popcornmix

Copy link
Copy Markdown
Collaborator

Consensus here is ff for the unused X/alpha value is as good as any value.
If you were to use this buffer as a format with alpha, then ff at least means it would be visible rather than fully transparent (e.g. copying it to /dev/fb configured as ARGB8888).

Comment thread drivers/gpu/drm/vc4/vc4_kms.c Resolved
mripard added 3 commits March 7, 2022 09:54
When debugging, finding out what muxing decisions were made and what the
actual core clock rate is is always useful, so let's add some more
messages.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
The TXP_VSTART_AT_EOF will generate a second VSTART signal to the HVS.
However, the HVS waits for VSTART to enable the FIFO and will thus start
filling the FIFO before the start of the frame.

This leads to corruption at the beginning of the first frame, and
content from the previous frame at the beginning of the next frames.

Since one VSTART is enough, let's get rid of it.

Fixes: 008095e ("drm/vc4: Add support for the transposer block")
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
If we use a format that has padding instead of the alpha component (such
as XRGB8888), it appears that the Transposer will fill the padding to 0,
disregarding what was stored in the input buffer padding.

This leads to issues with IGT, since it will set the padding to 0xff,
but will then compare the CRC of the two frames which will thus fail.

Fixes: 008095e ("drm/vc4: Add support for the transposer block")
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
@mripard
mripard force-pushed the rpi/5.15-writeback-fixes branch from 485de88 to eaf9ce5 Compare March 7, 2022 08:55
@pelwell
pelwell merged commit 09bdca2 into raspberrypi:rpi-5.15.y Mar 7, 2022
popcornmix added a commit to raspberrypi/firmware that referenced this pull request Mar 11, 2022
kernel: ARM: dts: bcm2711-rpi-ds: Disable the BCM2835 STC
See: #1702

kernel: KMS Writeback Fixes
See: raspberrypi/linux#4924

kernel: staging: vc04_services: codec: Add support for V4L2_PIX_FMT_RGBA32 format
See: raspberrypi/linux#4931

kernel: drm/vc4: Fix out of order frames during asynchronous page flips
See: raspberrypi/linux#4925
popcornmix added a commit to raspberrypi/rpi-firmware that referenced this pull request Mar 11, 2022
kernel: ARM: dts: bcm2711-rpi-ds: Disable the BCM2835 STC
See: raspberrypi/firmware#1702

kernel: KMS Writeback Fixes
See: raspberrypi/linux#4924

kernel: staging: vc04_services: codec: Add support for V4L2_PIX_FMT_RGBA32 format
See: raspberrypi/linux#4931

kernel: drm/vc4: Fix out of order frames during asynchronous page flips
See: raspberrypi/linux#4925
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

KMS (DRM) writeback device stalls, test suite fails (on Pi4, at least)

5 participants