From 0adb034b32d93e761f38dae2e4485c1095e1a786 Mon Sep 17 00:00:00 2001 From: Julien Moutte Date: Sat, 5 Nov 2005 19:55:12 +0000 Subject: ext/directfb/dfbvideosink.c: Make acceleration detection work, better, add safety checks and ARGB support for cards t... Original commit message from CVS: 2005-11-05 Julien MOUTTE * ext/directfb/dfbvideosink.c: (gst_dfbvideosink_enum_layers), (gst_dfbvideosink_setup), (gst_dfbvideosink_can_blit_from_format), (gst_dfbvideosink_getcaps): Make acceleration detection work, better, add safety checks and ARGB support for cards that support it. --- ext/directfb/dfbvideosink.c | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) (limited to 'ext/directfb') diff --git a/ext/directfb/dfbvideosink.c b/ext/directfb/dfbvideosink.c index e9d68725c..47b2cd2fd 100644 --- a/ext/directfb/dfbvideosink.c +++ b/ext/directfb/dfbvideosink.c @@ -544,6 +544,9 @@ gst_dfbvideosink_setup (GstDfbVideoSink * dfbvideosink) GST_DEBUG ("getting primary surface"); dfbvideosink->layer->GetSurface (dfbvideosink->layer, &dfbvideosink->primary); + + dfbvideosink->primary->SetBlittingFlags (dfbvideosink->primary, + DSBLIT_NOFX); } dfbvideosink->primary->GetPixelFormat (dfbvideosink->primary, @@ -781,15 +784,15 @@ gst_dfbvideosink_can_blit_from_format (GstDfbVideoSink * dfbvideosink, IDirectFBSurface *surface = NULL; DFBSurfaceDescription s_dsc; DFBAccelerationMask mask; - DFBDisplayLayerConfig dlc; + DFBDisplayLayerConfig dlc, prev_dlc; g_return_val_if_fail (GST_IS_DFBVIDEOSINK (dfbvideosink), FALSE); /* Create a surface of desired format */ s_dsc.flags = DSDESC_PIXELFORMAT | DSDESC_WIDTH | DSDESC_HEIGHT; s_dsc.pixelformat = format; - s_dsc.width = 1; - s_dsc.height = 1; + s_dsc.width = 10; + s_dsc.height = 10; ret = dfbvideosink->dfb->CreateSurface (dfbvideosink->dfb, &s_dsc, &surface); if (ret != DFB_OK) { @@ -798,6 +801,13 @@ gst_dfbvideosink_can_blit_from_format (GstDfbVideoSink * dfbvideosink, goto beach; } + /* Backup layer configuration */ + ret = dfbvideosink->layer->GetConfiguration (dfbvideosink->layer, &prev_dlc); + if (ret != DFB_OK) { + GST_WARNING ("failed when getting current layer configuration"); + goto beach; + } + /* Test configuration of the layer to this pixel format */ dlc.flags = DLCONF_PIXELFORMAT; dlc.pixelformat = format; @@ -833,7 +843,14 @@ gst_dfbvideosink_can_blit_from_format (GstDfbVideoSink * dfbvideosink, } else { GST_DEBUG ("blitting from format %s to our primary is not accelerated", gst_dfbvideosink_get_format_name (format)); - res = TRUE; + res = FALSE; + } + + /* Restore original layer configuration */ + ret = dfbvideosink->layer->SetConfiguration (dfbvideosink->layer, &prev_dlc); + if (ret != DFB_OK) { + GST_WARNING ("failed when restoring layer configuration"); + goto beach; } beach: @@ -934,6 +951,15 @@ gst_dfbvideosink_getcaps (GstBaseSink * bsink) gst_caps_append (caps, gst_dfbvideosink_get_caps_from_format (DSPF_RGB24)); } + /* There's something wrong with RGB32, ffmpegcolorspace ? + if (gst_dfbvideosink_can_blit_from_format (dfbvideosink, DSPF_RGB32)) { + gst_caps_append (caps, + gst_dfbvideosink_get_caps_from_format (DSPF_RGB32)); + } */ + if (gst_dfbvideosink_can_blit_from_format (dfbvideosink, DSPF_ARGB)) { + gst_caps_append (caps, + gst_dfbvideosink_get_caps_from_format (DSPF_ARGB)); + } if (gst_dfbvideosink_can_blit_from_format (dfbvideosink, DSPF_YUY2)) { gst_caps_append (caps, gst_dfbvideosink_get_caps_from_format (DSPF_YUY2)); -- cgit v1.2.1