Hi,

the attached patch changes blending behaviour for the vdpau-driver to classical 
alpha blending.

So far it expects premultiplied alpha. This is not in line with, at least, what 
intel-driver expects.

Why would one need this change? In lack of an implementation of vaSetSubpictureGlobalAlpha() in the libva-backend/vdpau-driver, the only way to implement fading in/out of subpictures/OSD-elements is to change alpha values per-pixel. That is already expensive and becomes even more expensive if you need to premultiply RGB values. And makes it almost impossible to implement such a feature if blending is handled differently by different libva-backends.

Please redirect me, if I should open a ticket for that.

Thanks for reviewing and considering this patch,
   Holger
diff --git a/src/vdpau_video_x11.c b/src/vdpau_video_x11.c
index 4ddfd1b..4ac558b 100644
--- a/src/vdpau_video_x11.c
+++ b/src/vdpau_video_x11.c
@@ -612,10 +612,10 @@ render_subpicture(
 
     VdpOutputSurfaceRenderBlendState blend_state;
     blend_state.struct_version                 = VDP_OUTPUT_SURFACE_RENDER_BLEND_STATE_VERSION;
-    blend_state.blend_factor_source_color      = VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ONE;
+    blend_state.blend_factor_source_color      = VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_SRC_ALPHA;
     blend_state.blend_factor_source_alpha      = VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ONE;
     blend_state.blend_factor_destination_color = VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA;
-    blend_state.blend_factor_destination_alpha = VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA;
+    blend_state.blend_factor_destination_alpha = VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ZERO;
     blend_state.blend_equation_color           = VDP_OUTPUT_SURFACE_RENDER_BLEND_EQUATION_ADD;
     blend_state.blend_equation_alpha           = VDP_OUTPUT_SURFACE_RENDER_BLEND_EQUATION_ADD;
 
_______________________________________________
Libva mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/libva

Reply via email to