summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReynaldo H. Verdejo Pinochet <reynaldo@collabora.com>2012-10-16 17:50:03 -0300
committerSebastian Dröge <sebastian.droege@collabora.co.uk>2012-10-18 14:35:19 +0200
commit32861ab0a77e8c7ab1c9d195c5fe9ababaa1eec4 (patch)
treeaeb0d4ce377f25b7800080281751aa7dc33dd636
parent406630a2942addf34ced679e1ecf4cd622f83253 (diff)
downloadgstreamer-plugins-bad-32861ab0a77e8c7ab1c9d195c5fe9ababaa1eec4.tar.gz
eglglessink: Move DAR query & store to surface init
The DAR (display's pixel aspect ratio) should remain a constant at runtime so there's no point on repeatedly query and store this value. Doing it at surface setup should be enough. As an added bonus this change should make rendering a bit faster.
-rw-r--r--ext/eglgles/gsteglglessink.c71
1 files changed, 35 insertions, 36 deletions
diff --git a/ext/eglgles/gsteglglessink.c b/ext/eglgles/gsteglglessink.c
index e71340570..2890ddd08 100644
--- a/ext/eglgles/gsteglglessink.c
+++ b/ext/eglgles/gsteglglessink.c
@@ -1538,7 +1538,6 @@ static gboolean
gst_eglglessink_update_surface_dimensions (GstEglGlesSink * eglglessink)
{
gint width, height;
- EGLint display_par;
/* Save surface dims */
eglQuerySurface (eglglessink->eglglesctx.display,
@@ -1546,41 +1545,6 @@ gst_eglglessink_update_surface_dimensions (GstEglGlesSink * eglglessink)
eglQuerySurface (eglglessink->eglglesctx.display,
eglglessink->eglglesctx.surface, EGL_HEIGHT, &height);
- /* Save display's pixel aspect ratio
- *
- * DAR is reported as w/h * EGL_DISPLAY_SCALING wich is
- * a constant with value 10000. This attribute is only
- * supported if the EGL version is >= 1.2
- * XXX: Setup this as a property.
- * XXX: Move this initialization out to init_egl_surface()
- * or some other one time check. Right now it's being called once
- * per frame.
- */
- if (eglglessink->eglglesctx.egl_major == 1 &&
- eglglessink->eglglesctx.egl_minor < 2) {
- GST_DEBUG_OBJECT (eglglessink, "Can't query PAR. Using default: %dx%d",
- EGL_DISPLAY_SCALING, EGL_DISPLAY_SCALING);
- eglglessink->eglglesctx.pixel_aspect_ratio = EGL_DISPLAY_SCALING;
- } else {
- eglQuerySurface (eglglessink->eglglesctx.display,
- eglglessink->eglglesctx.surface, EGL_PIXEL_ASPECT_RATIO,
- &display_par);
- /* Fix for outbound DAR reporting on some implementations not
- * honoring the 'should return w/h * EGL_DISPLAY_SCALING' spec
- * requirement
- */
- if (display_par == EGL_UNKNOWN || display_par < EGL_SANE_DAR_MIN ||
- display_par > EGL_SANE_DAR_MAX) {
- GST_DEBUG_OBJECT (eglglessink, "Nonsensical PAR value returned: %d. "
- "Bad EGL implementation? "
- "Will use default: %d/%d", eglglessink->eglglesctx.pixel_aspect_ratio,
- EGL_DISPLAY_SCALING, EGL_DISPLAY_SCALING);
- eglglessink->eglglesctx.pixel_aspect_ratio = EGL_DISPLAY_SCALING;
- } else {
- eglglessink->eglglesctx.pixel_aspect_ratio = display_par;
- }
- }
-
if (width != eglglessink->eglglesctx.surface_width ||
height != eglglessink->eglglesctx.surface_height) {
eglglessink->eglglesctx.surface_width = width;
@@ -1635,6 +1599,7 @@ gst_eglglessink_init_egl_surface (GstEglGlesSink * eglglessink)
GLint test;
GLboolean ret;
GLchar *info_log;
+ EGLint display_par;
const gchar *texnames[3] = { NULL, };
gchar *tmp_prog = NULL;
@@ -1654,6 +1619,40 @@ gst_eglglessink_init_egl_surface (GstEglGlesSink * eglglessink)
if (!gst_eglglessink_context_make_current (eglglessink, TRUE))
goto HANDLE_EGL_ERROR_LOCKED;
+ /* Save display's pixel aspect ratio
+ *
+ * DAR is reported as w/h * EGL_DISPLAY_SCALING wich is
+ * a constant with value 10000. This attribute is only
+ * supported if the EGL version is >= 1.2
+ * XXX: Setup this as a property.
+ * or some other one time check. Right now it's being called once
+ * per frame.
+ */
+ if (eglglessink->eglglesctx.egl_major == 1 &&
+ eglglessink->eglglesctx.egl_minor < 2) {
+ GST_DEBUG_OBJECT (eglglessink, "Can't query PAR. Using default: %dx%d",
+ EGL_DISPLAY_SCALING, EGL_DISPLAY_SCALING);
+ eglglessink->eglglesctx.pixel_aspect_ratio = EGL_DISPLAY_SCALING;
+ } else {
+ eglQuerySurface (eglglessink->eglglesctx.display,
+ eglglessink->eglglesctx.surface, EGL_PIXEL_ASPECT_RATIO,
+ &display_par);
+ /* Fix for outbound DAR reporting on some implementations not
+ * honoring the 'should return w/h * EGL_DISPLAY_SCALING' spec
+ * requirement
+ */
+ if (display_par == EGL_UNKNOWN || display_par < EGL_SANE_DAR_MIN ||
+ display_par > EGL_SANE_DAR_MAX) {
+ GST_DEBUG_OBJECT (eglglessink, "Nonsensical PAR value returned: %d. "
+ "Bad EGL implementation? "
+ "Will use default: %d/%d", eglglessink->eglglesctx.pixel_aspect_ratio,
+ EGL_DISPLAY_SCALING, EGL_DISPLAY_SCALING);
+ eglglessink->eglglesctx.pixel_aspect_ratio = EGL_DISPLAY_SCALING;
+ } else {
+ eglglessink->eglglesctx.pixel_aspect_ratio = display_par;
+ }
+ }
+
/* Save surface dims */
gst_eglglessink_update_surface_dimensions (eglglessink);