Skip to content

FKMS: transparency artifact in drm formats AR24 and AB24 #1773

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wosk opened this issue Jan 17, 2023 · 5 comments
Open

FKMS: transparency artifact in drm formats AR24 and AB24 #1773

wosk opened this issue Jan 17, 2023 · 5 comments

Comments

@wosk
Copy link

wosk commented Jan 17, 2023

Describe the bug
While run modetest -P 75@85:800x480@AR24 in fkms mode on yocto I see artifact in top-left quarter of screen. (My screen is upside down).
The issue observed on AR24 and AB24 formats. May be another with alpha channel.
No dependency on plane resolution.
I don't observe the same issue in non-firmware KMS mode.

To reproduce
tested on yocto core-image-sato in fkms mode (set dtoverlay=vc4-fkms-v3d in /boot/config.txt).

kill 'GUI window manager'
modetest -p # retrieve CRTC id and plane id
modetest -P <plane_id>@<crtc_id>:800x480@AR24
modetest -P <plane_id>@<crtc_id>:800x480@AB24

also
modetest -s 89:#0@AR24 -P 38@87:600x280@AR24

Expected behaviour
No artifacts should be seen

Actual behaviour
There is a part of image in top-left quarter of screen, which have about 50% of transparency.
modetest -P 75@85:800x480@AR24
image
modetest -s 89:#0@AR24 -P 38@87:600x280@AR24 -C
image

System

Linux raspberrypi4-64 5.15.34-v8 #1 SMP PREEMPT Tue Apr 19 19:21:26 UTC 2022 aarch64 GNU/Linux

Logs
modetest -P 38@87:800x480@AR24
testing 800x480@AR24 overlay plane 38

modetest_p_fkms.log
modetest_c_fkms.log
modetest_e_fkms.log

@6by9
Copy link

6by9 commented Jan 17, 2023

5.15.34 is pretty old - rpi-5.15..y is now on 5.15.88.

AR24 = DRM_FORMAT_ARGB8888
AB24 = DRM_FORMAT_ABGR8888

DRM_FORMAT_ABGR8888 was only added to fkms in raspberrypi/linux@dbd073e in Oct 2022, so how does your kernel from April 2022 support it?

Actually looking with kms I think this is just the premultiplied alpha flag.
modetest appears to be deliberately only setting the per-pixel alpha to opaque in the top left quarter of the image. DRM expects the default to be premultiplied unless the "pixel blend mode" property exists on the plane and is set otherwise.

Adding the premultiplied flag to the firmware is a one-liner and appears to give the same output as vc4-kms-v3d. I'm not intending to add the "pixel blend mode" property to fkms - it already exists in vc4-kms-v3d, and that is the preferred solution now.

@6by9
Copy link

6by9 commented Jan 17, 2023

Firmware patch created that selects premultiplied alpha. It'll filter through in due course.

@wosk
Copy link
Author

wosk commented Jan 18, 2023

DRM_FORMAT_ABGR8888 was only added to fkms in raspberrypi/linux@dbd073e in Oct 2022, so how does your kernel from April 2022 support it?

ABGR8888 I tested on another kernel.

popcornmix added a commit to raspberrypi/rpi-firmware that referenced this issue Jan 18, 2023
kernel: overlays: i2c-sensor: Add mpu6050 and mpu9250
See: raspberrypi/linux#5325

firmware: arm_dispmanx: Correct support for NV21, and add support for YV16
See: raspberrypi/firmware#1767

firmware: arm_dispmanx: Fix FKMS to adopt pre-multiplied alpha
See: raspberrypi/firmware#1773
popcornmix added a commit that referenced this issue Jan 18, 2023
kernel: overlays: i2c-sensor: Add mpu6050 and mpu9250
See: raspberrypi/linux#5325

firmware: arm_dispmanx: Correct support for NV21, and add support for YV16
See: #1767

firmware: arm_dispmanx: Fix FKMS to adopt pre-multiplied alpha
See: #1773
@popcornmix
Copy link
Contributor

rpi-update firmware contains potential fix for this

@wosk
Copy link
Author

wosk commented Jan 18, 2023

Looks like the issue was fixed for first plane only and still exist on another planes.
modetest -M v3d -P 3@4096:700x380@AR24 -P 5@4096:500x330@AR24 -P 6@4096:800x230@AR24
image

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

No branches or pull requests

3 participants