summaryrefslogtreecommitdiff
path: root/gst-libs/gst/vaapi
diff options
context:
space:
mode:
authorGwenole Beauchesne <gwenole.beauchesne@intel.com>2012-08-28 18:11:32 +0300
committerGwenole Beauchesne <gwenole.beauchesne@intel.com>2012-08-28 17:42:19 +0200
commit8ebe4d63d5d6a5db8b70573ca2286cac3c13ce7e (patch)
tree91979f9e75f304fb5114ad4f6e21ace661e1f65d /gst-libs/gst/vaapi
parentfafcf0e13ce75c0e0d12e935e5aac520687a0195 (diff)
display: fix validation process of properties during discovery.
Some VA drivers (e.g. EMGD) can have completely random values for initial display attributes. So, try to improve the discovery process to check the initial display attribute values actually fall within valid bounds. If not, try to reset those to some sensible values like the default value reported through vaQueryDisplayAttributes().
Diffstat (limited to 'gst-libs/gst/vaapi')
-rw-r--r--gst-libs/gst/vaapi/gstvaapidisplay.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/gst-libs/gst/vaapi/gstvaapidisplay.c b/gst-libs/gst/vaapi/gstvaapidisplay.c
index 985c2811..96a72094 100644
--- a/gst-libs/gst/vaapi/gstvaapidisplay.c
+++ b/gst-libs/gst/vaapi/gstvaapidisplay.c
@@ -609,6 +609,7 @@ gst_vaapi_display_create(GstVaapiDisplay *display)
for (i = 0; i < n; i++) {
VADisplayAttribute * const attr = &display_attrs[i];
GstVaapiProperty prop;
+ gint value;
GST_DEBUG(" %s", string_of_VADisplayAttributeType(attr->type));
@@ -645,9 +646,24 @@ gst_vaapi_display_create(GstVaapiDisplay *display)
/* Assume the attribute is really supported if we can get the
* actual and current value */
+ if (!get_attribute(display, attr->type, &value))
+ continue;
+
+ /* Some drivers (e.g. EMGD) have completely random initial
+ * values. So try to reset sensible ones */
+ if (value < attr->min_value || value > attr->max_value) {
+ gint v;
+ if (!(attr->flags & VA_DISPLAY_ATTRIB_SETTABLE))
+ continue;
+ if (!set_attribute(display, attr->type, attr->value))
+ continue;
+ if (!get_attribute(display, attr->type, &v) || v != value)
+ continue;
+ }
+
prop.attribute = *attr;
- if (get_attribute(display, attr->type, &prop.old_value))
- g_array_append_val(priv->properties, prop);
+ prop.old_value = value;
+ g_array_append_val(priv->properties, prop);
}
/* VA image formats */