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  <julien@moutte.net>

* 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.
This commit is contained in:
Julien Moutte 2005-11-05 19:55:12 +00:00
parent 478c8ba299
commit 0adb034b32
2 changed files with 38 additions and 4 deletions

View file

@ -1,3 +1,11 @@
2005-11-05 Julien MOUTTE <julien@moutte.net>
* 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.
2005-11-04 Julien MOUTTE <julien@moutte.net> 2005-11-04 Julien MOUTTE <julien@moutte.net>
* ext/directfb/dfbvideosink.c: (gst_dfbvideosink_surface_create), * ext/directfb/dfbvideosink.c: (gst_dfbvideosink_surface_create),

View file

@ -544,6 +544,9 @@ gst_dfbvideosink_setup (GstDfbVideoSink * dfbvideosink)
GST_DEBUG ("getting primary surface"); GST_DEBUG ("getting primary surface");
dfbvideosink->layer->GetSurface (dfbvideosink->layer, dfbvideosink->layer->GetSurface (dfbvideosink->layer,
&dfbvideosink->primary); &dfbvideosink->primary);
dfbvideosink->primary->SetBlittingFlags (dfbvideosink->primary,
DSBLIT_NOFX);
} }
dfbvideosink->primary->GetPixelFormat (dfbvideosink->primary, dfbvideosink->primary->GetPixelFormat (dfbvideosink->primary,
@ -781,15 +784,15 @@ gst_dfbvideosink_can_blit_from_format (GstDfbVideoSink * dfbvideosink,
IDirectFBSurface *surface = NULL; IDirectFBSurface *surface = NULL;
DFBSurfaceDescription s_dsc; DFBSurfaceDescription s_dsc;
DFBAccelerationMask mask; DFBAccelerationMask mask;
DFBDisplayLayerConfig dlc; DFBDisplayLayerConfig dlc, prev_dlc;
g_return_val_if_fail (GST_IS_DFBVIDEOSINK (dfbvideosink), FALSE); g_return_val_if_fail (GST_IS_DFBVIDEOSINK (dfbvideosink), FALSE);
/* Create a surface of desired format */ /* Create a surface of desired format */
s_dsc.flags = DSDESC_PIXELFORMAT | DSDESC_WIDTH | DSDESC_HEIGHT; s_dsc.flags = DSDESC_PIXELFORMAT | DSDESC_WIDTH | DSDESC_HEIGHT;
s_dsc.pixelformat = format; s_dsc.pixelformat = format;
s_dsc.width = 1; s_dsc.width = 10;
s_dsc.height = 1; s_dsc.height = 10;
ret = dfbvideosink->dfb->CreateSurface (dfbvideosink->dfb, &s_dsc, &surface); ret = dfbvideosink->dfb->CreateSurface (dfbvideosink->dfb, &s_dsc, &surface);
if (ret != DFB_OK) { if (ret != DFB_OK) {
@ -798,6 +801,13 @@ gst_dfbvideosink_can_blit_from_format (GstDfbVideoSink * dfbvideosink,
goto beach; 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 */ /* Test configuration of the layer to this pixel format */
dlc.flags = DLCONF_PIXELFORMAT; dlc.flags = DLCONF_PIXELFORMAT;
dlc.pixelformat = format; dlc.pixelformat = format;
@ -833,7 +843,14 @@ gst_dfbvideosink_can_blit_from_format (GstDfbVideoSink * dfbvideosink,
} else { } else {
GST_DEBUG ("blitting from format %s to our primary is not accelerated", GST_DEBUG ("blitting from format %s to our primary is not accelerated",
gst_dfbvideosink_get_format_name (format)); 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: beach:
@ -934,6 +951,15 @@ gst_dfbvideosink_getcaps (GstBaseSink * bsink)
gst_caps_append (caps, gst_caps_append (caps,
gst_dfbvideosink_get_caps_from_format (DSPF_RGB24)); 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)) { if (gst_dfbvideosink_can_blit_from_format (dfbvideosink, DSPF_YUY2)) {
gst_caps_append (caps, gst_caps_append (caps,
gst_dfbvideosink_get_caps_from_format (DSPF_YUY2)); gst_dfbvideosink_get_caps_from_format (DSPF_YUY2));