Hi,

this changes the background color of vdpau surfaces from default green to (almost) black in vdpau-driver to avoid the ugly green flickering during startup and after shutdown of a video playback.

Thinking about a good value for this background color, I wonder whether it could not be bound to, i.e. derived from VADisplayAttribBackgroundColor which is already mapped to VDP_VIDEO_MIXER_ATTRIBUTE_BACKGROUND_COLOR in vdpau-driver. This would probably go beyond VADisplayAttribBackgroundColor semantics but would have two advantages:

1. When a libva app uses VADisplayAttribBackgroundColor vdpau-driver could garantee to provide a *unique* bg color both for uncovered window background and surface background.

2. Provide a way for the libva user to configure surface background in environments where a default background value would trigger an unwanted bleed through into other windows through color keying. cf. [1]

Comments?

Thanks for considering,
regards,
  Holger

[1]
http://cgit.freedesktop.org/~aplattner/libvdpau/commit/?id=ca9e637c61e80145f0625a590c91429db67d0a40
>From 80fcc9bbc1b01a630f02cf7e0dd1c7a19d2e0b76 Mon Sep 17 00:00:00 2001
From: Holger Kaelberer <[email protected]>
Date: Fri, 15 Feb 2013 13:33:29 +0100
Subject: [PATCH] Set surface background to (almost) black instead of default
 green

This changes the effective background color of vdpau surfaces to
(almost) black. The default greenish value ({ 0.462745, 0.725490,
0.003922}) leads to ugly green flickering during startup after
shutdown.

Note: Plain black or white should not be set as background, because it
is commonly used and causes video to bleed through into other
windows using this color.
---
 src/vdpau_video_x11.c |    9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/vdpau_video_x11.c b/src/vdpau_video_x11.c
index 8171549..8a718a7 100644
--- a/src/vdpau_video_x11.c
+++ b/src/vdpau_video_x11.c
@@ -206,6 +206,9 @@ output_surface_create(
 
     if (drawable != None) {
         VdpStatus vdp_status;
+        /* note: choose a rare color close to plain black as background
+         * 0/0/0 causes the window to bleed through black in other windows.*/
+        VdpColor vdp_bg = {0.003922f, 0.007843f, 0.003922f, 0};
         vdp_status = vdpau_presentation_queue_target_create_x11(
             driver_data,
             driver_data->vdp_device,
@@ -227,6 +230,12 @@ output_surface_create(
             output_surface_destroy(driver_data, obj_output);
             return NULL;
         }
+
+        vdp_status = vdpau_presentation_queue_set_background_color(
+            driver_data,
+            obj_output->vdp_flip_queue,
+            &vdp_bg
+        );
     }
     return obj_output;
 }
-- 
1.7.9.5

_______________________________________________
Libva mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/libva

Reply via email to