projects
/
harmattan
/
cameraplus
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
48e0e02
)
make fence sync objects configurable
author
Mohammed Sameer
<msameer@foolab.org>
Sun, 23 Dec 2012 15:26:51 +0000
(17:26 +0200)
committer
Mohammed Sameer
<msameer@foolab.org>
Sun, 23 Dec 2012 15:26:51 +0000
(17:26 +0200)
data/n9/qtcamera.ini
patch
|
blob
|
history
lib/qtcamconfig.cpp
patch
|
blob
|
history
lib/qtcamconfig.h
patch
|
blob
|
history
lib/qtcamviewfinderrenderermeego.cpp
patch
|
blob
|
history
lib/qtcamviewfinderrenderermeego.h
patch
|
blob
|
history
diff --git
a/data/n9/qtcamera.ini
b/data/n9/qtcamera.ini
index
85f6f54
..
77bec94
100644
(file)
--- a/
data/n9/qtcamera.ini
+++ b/
data/n9/qtcamera.ini
@@
-11,6
+11,7
@@
element=subdevsrc2
[viewfinder-sink]
element=gltexturesink
renderer=meego
[viewfinder-sink]
element=gltexturesink
renderer=meego
+use-fence=false
[audio-source]
element=pulsesrc
[audio-source]
element=pulsesrc
diff --git
a/lib/qtcamconfig.cpp
b/lib/qtcamconfig.cpp
index
930909b
..
b570ac7
100644
(file)
--- a/
lib/qtcamconfig.cpp
+++ b/
lib/qtcamconfig.cpp
@@
-87,6
+87,10
@@
QString QtCamConfig::viewfinderRenderer() const {
return d_ptr->conf->value("viewfinder-sink/renderer").toString();
}
return d_ptr->conf->value("viewfinder-sink/renderer").toString();
}
+bool QtCamConfig::viewfinderUseFence() const {
+ return d_ptr->conf->value("viewfinder-sink/use-fence").toBool();
+}
+
QString QtCamConfig::audioSource() const {
return d_ptr->element("audio-source");
}
QString QtCamConfig::audioSource() const {
return d_ptr->element("audio-source");
}
diff --git
a/lib/qtcamconfig.h
b/lib/qtcamconfig.h
index
48a4b4c
..
7b2e203
100644
(file)
--- a/
lib/qtcamconfig.h
+++ b/
lib/qtcamconfig.h
@@
-49,8
+49,11
@@
public:
QString deviceScannerProperty() const;
QString videoSource() const;
QString deviceScannerProperty() const;
QString videoSource() const;
+
QString viewfinderSink() const;
QString viewfinderRenderer() const;
QString viewfinderSink() const;
QString viewfinderRenderer() const;
+ bool viewfinderUseFence() const;
+
QString audioSource() const;
QString wrapperVideoSource() const;
QString wrapperVideoSourceProperty() const;
QString audioSource() const;
QString wrapperVideoSource() const;
QString wrapperVideoSourceProperty() const;
diff --git
a/lib/qtcamviewfinderrenderermeego.cpp
b/lib/qtcamviewfinderrenderermeego.cpp
index
4ff08fe
..
f797864
100644
(file)
--- a/
lib/qtcamviewfinderrenderermeego.cpp
+++ b/
lib/qtcamviewfinderrenderermeego.cpp
@@
-25,7
+25,6
@@
#include "qtcamconfig.h"
#include <QX11Info>
#include <QGLContext>
#include "qtcamconfig.h"
#include <QX11Info>
#include <QGLContext>
-#include <EGL/egl.h>
#include <QGLShaderProgram>
#include <gst/interfaces/meegovideotexture.h>
#include <QGLShaderProgram>
#include <gst/interfaces/meegovideotexture.h>
@@
-33,6
+32,14
@@
QT_CAM_VIEWFINDER_RENDERER(RENDERER_TYPE_MEEGO, QtCamViewfinderRendererMeeGo);
#define GL_TEXTURE_EXTERNAL_OES 0x8060
#define GL_TEXTURE_EXTERNAL_OES 0x8060
+typedef void *EGLSyncKHR;
+#define EGL_SYNC_FENCE_KHR 0x30F9
+
+typedef EGLSyncKHR(EGLAPIENTRYP _PFNEGLCREATESYNCKHRPROC)(EGLDisplay dpy, EGLenum type,
+ const EGLint *attrib_list);
+
+_PFNEGLCREATESYNCKHRPROC eglCreateSyncKHR = 0;
+
static const QString FRAGMENT_SHADER = ""
"#extension GL_OES_EGL_image_external: enable\n"
"uniform samplerExternalOES texture0;"
static const QString FRAGMENT_SHADER = ""
"#extension GL_OES_EGL_image_external: enable\n"
"uniform samplerExternalOES texture0;"
@@
-56,7
+63,7
@@
static const QString VERTEX_SHADER = ""
"";
QtCamViewfinderRendererMeeGo::QtCamViewfinderRendererMeeGo(QtCamConfig *config,
"";
QtCamViewfinderRendererMeeGo::QtCamViewfinderRendererMeeGo(QtCamConfig *config,
-
QObject *parent) :
+ QObject *parent) :
QtCamViewfinderRenderer(config, parent),
m_conf(config),
m_sink(0),
QtCamViewfinderRenderer(config, parent),
m_conf(config),
m_sink(0),
@@
-95,6
+102,15
@@
void QtCamViewfinderRendererMeeGo::paint(QPainter *painter) {
if (m_needsInit) {
calculateProjectionMatrix(painter->viewport());
if (m_needsInit) {
calculateProjectionMatrix(painter->viewport());
+
+ if (!eglCreateSyncKHR && m_conf->viewfinderUseFence()) {
+ eglCreateSyncKHR = (_PFNEGLCREATESYNCKHRPROC)eglGetProcAddress("eglCreateSyncKHR");
+
+ if (!eglCreateSyncKHR) {
+ qWarning() << "eglCreateSyncKHR not found. Fences disabled";
+ }
+ }
+
m_needsInit = false;
}
m_needsInit = false;
}
@@
-120,7
+136,7
@@
void QtCamViewfinderRendererMeeGo::resize(const QSizeF& size) {
calculateCoords();
calculateCoords();
- // T
ODO: t
his will destroy everything
+ // This will destroy everything
// but we need a way to reset the viewport and the transformation matrix only.
m_needsInit = true;
// but we need a way to reset the viewport and the transformation matrix only.
m_needsInit = true;
@@
-155,10
+171,10
@@
GstElement *QtCamViewfinderRendererMeeGo::sinkElement() {
Display *d = QX11Info::display();
g_object_set(G_OBJECT(m_sink), "x-display", d, "use-framebuffer-memory", TRUE, NULL);
Display *d = QX11Info::display();
g_object_set(G_OBJECT(m_sink), "x-display", d, "use-framebuffer-memory", TRUE, NULL);
-
EGLDisplay
dpy = eglGetDisplay((EGLNativeDisplayType)d);
+
m_
dpy = eglGetDisplay((EGLNativeDisplayType)d);
EGLContext context = eglGetCurrentContext();
EGLContext context = eglGetCurrentContext();
- g_object_set(G_OBJECT(m_sink), "egl-display", dpy, "egl-context", context, NULL);
+ g_object_set(G_OBJECT(m_sink), "egl-display",
m_
dpy, "egl-context", context, NULL);
m_id = g_signal_connect(G_OBJECT(m_sink), "frame-ready", G_CALLBACK(frame_ready), this);
m_id = g_signal_connect(G_OBJECT(m_sink), "frame-ready", G_CALLBACK(frame_ready), this);
@@
-246,6
+262,8
@@
void QtCamViewfinderRendererMeeGo::createProgram() {
}
void QtCamViewfinderRendererMeeGo::paintFrame(QPainter *painter, int frame) {
}
void QtCamViewfinderRendererMeeGo::paintFrame(QPainter *painter, int frame) {
+ EGLSyncKHR sync = 0;
+
if (frame == -1) {
return;
}
if (frame == -1) {
return;
}
@@
-284,9
+302,11
@@
void QtCamViewfinderRendererMeeGo::paintFrame(QPainter *painter, int frame) {
m_program->release();
m_program->release();
- // We are not using fences.
- // TODO: make it configurable.
- meego_gst_video_texture_release_frame(sink, frame, 0);
+ if (eglCreateSyncKHR) {
+ sync = eglCreateSyncKHR(m_dpy, EGL_SYNC_FENCE_KHR, NULL);
+ }
+
+ meego_gst_video_texture_release_frame(sink, frame, sync);
}
void QtCamViewfinderRendererMeeGo::calculateCoords() {
}
void QtCamViewfinderRendererMeeGo::calculateCoords() {
diff --git
a/lib/qtcamviewfinderrenderermeego.h
b/lib/qtcamviewfinderrenderermeego.h
index
ca0ab7e
..
322c9c5
100644
(file)
--- a/
lib/qtcamviewfinderrenderermeego.h
+++ b/
lib/qtcamviewfinderrenderermeego.h
@@
-28,6
+28,7
@@
#include <QMutex>
#include <QMatrix4x4>
#include <GLES2/gl2.h>
#include <QMutex>
#include <QMatrix4x4>
#include <GLES2/gl2.h>
+#include <EGL/egl.h>
class QGLShaderProgram;
class QGLShaderProgram;
@@
-74,6
+75,7
@@
private:
QSizeF m_size;
QSizeF m_videoSize;
QRectF m_renderArea;
QSizeF m_size;
QSizeF m_videoSize;
QRectF m_renderArea;
+ EGLDisplay m_dpy;
};
#endif /* QT_CAM_VIEWFINDER_RENDERER_MEEGO_H */
};
#endif /* QT_CAM_VIEWFINDER_RENDERER_MEEGO_H */