Open ghost opened 7 years ago
You'll have more chance of getting timely support if you provide a small, self-contained test application that demonstrates the problem.
Is there a skeleton for creating such somewhere?
https://github.com/raspberrypi/firmware/tree/master/opt/vc/src/hello_pi/hello_triangle2 perhaps?
Does:
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
help?
Yes, that does help. Do you still need a test program?
Not if you are happy with the behaviour. I had noticed that Kodi does that (one all GLES platforms) https://github.com/xbmc/xbmc/blob/master/xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGLES.cpp#L455-L456
The kodi code enables it only under alpha<255
, where they probably actually want to blend it with the background.
In mpv, we only want to write opaque alpha to the framebuffer, nothing else. The framebuffer itself still needs dispmanx-blending enabled for use with video overlays.
Wouldn't always enabling blending be slower?
It certainly is a bug, though.
I got the same issue. It is fixed by using:
VC_DISPMANX_ALPHA_T alpha = { DISPMANX_FLAGS_ALPHA_FROM_SOURCE | DISPMANX_FLAGS_ALPHA_FIXED_ALL_PIXELS,
255,
0 };
and pass &alpha
to vc_dispmanx_element_add
DISPMANX_FLAGS_ALPHA_FIXED_ALL_PIXELS
seems to fix it.
@popcornmix @kuon should the fix be implemented?
@ruffio Implemented where?
@kuon if your suggestion is the right medicine, then it should be implemented in firmware and this issue closed.
My fix is for the user side of the problem. I don't know if there is an actual bug in the firmware or if this is a documentation problem.
The bug is still a bug.
@popcornmix do we have a confirmed bug, or what does it take to get confirmed?
I'm seeing very weird behavior with RPI apparently alpha-blending the EGL framebuffer with the dispmanx layers behind it (on Raspbian that's the Linux console with the shell).
Working shader, which renders a solid, opaque deep shade of green:
Not working, the console is very visible on top of the "video":
Sorry for the redundant uniforms. As you can see, in both cases
gl_FragColor.a
will be1.0
, i.e. opaque. The EGL dispmanx layer was created withand
GL_BLEND
is disabled.This issue is especially visible if the video is letterboxed - then the regions cleared by
glClear()
are opaque, while the regions drawn over by the video are not.This can be seen with mpv (git master). Normally it does
color.a = 1.0;
. mpv has pretty complex shader generation; this patch touches the affected code: http://sprunge.us/ghUd (if you change0.01
to0.0
the background console will disappear).In both shader dumps I pasted above, the normal video shader was slightly edited for test purposes. In normal operation, the problem becomes visible if the mmal video overlay is disabled and shaders are used for video - then the video appears faded and gray, with the background console being visible.
I suspect OSD rendering might have similar problems, but haven't confirmed.
Version infos:
Linux raspberrypi 4.4.22-v7+ #912 SMP Mon Sep 26 19:04:59 BST 2016 armv7l GNU/Linux
All on Raspbian... I ran
rpi-update
before making a final test.