Remove the GLES 2 dependency for eglfs and kms

Change-Id: If7b80487e01db726367f5a67d2860073f60a0844
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
bb10
Jorgen Lind 2013-11-12 10:50:42 +01:00 committed by The Qt Project
parent 7e768dde39
commit f087ffdc53
9 changed files with 31 additions and 11 deletions

View File

@ -139,6 +139,7 @@ void QEglFSBackingStore::resize(const QSize &size, const QRegion &staticContents
m_window->create();
rootWin->screen()->rootContext()->makeCurrent(rootWin->window());
initializeOpenGLFunctions();
if (m_texture)
glDeleteTextures(1, &m_texture);

View File

@ -43,6 +43,7 @@
#define QEGLFSBACKINGSTORE_H
#include <qpa/qplatformbackingstore.h>
#include <QtGui/QOpenGLFunctions>
#include <QImage>
#include <QRegion>
@ -52,7 +53,7 @@ QT_BEGIN_NAMESPACE
class QOpenGLPaintDevice;
class QEglFSWindow;
class QEglFSBackingStore : public QPlatformBackingStore
class QEglFSBackingStore : public QPlatformBackingStore, public QOpenGLFunctions
{
public:
QEglFSBackingStore(QWindow *window);

View File

@ -53,7 +53,8 @@ static QEglFSCompositor *compositor = 0;
QEglFSCompositor::QEglFSCompositor()
: m_screen(0),
m_program(0)
m_program(0),
m_initialized(false)
{
Q_ASSERT(!compositor);
m_updateTimer.setSingleShot(true);
@ -86,6 +87,10 @@ void QEglFSCompositor::renderAll()
Q_ASSERT(context);
context->makeCurrent(rootWin->window());
if (!m_initialized) {
initializeOpenGLFunctions();
m_initialized = true;
}
ensureProgram();
m_program->bind();

View File

@ -42,7 +42,8 @@
#ifndef QEGLFSCOMPOSITOR_H
#define QEGLFSCOMPOSITOR_H
#include <QTimer>
#include <QtCore/QTimer>
#include <QtGui/QOpenGLFunctions>
QT_BEGIN_NAMESPACE
@ -50,7 +51,7 @@ class QEglFSScreen;
class QEglFSWindow;
class QOpenGLShaderProgram;
class QEglFSCompositor : public QObject
class QEglFSCompositor : public QObject, public QOpenGLFunctions
{
Q_OBJECT
@ -76,6 +77,7 @@ private:
int m_vertexCoordEntry;
int m_textureCoordEntry;
int m_isRasterEntry;
bool m_initialized;
};
QT_END_NAMESPACE

View File

@ -79,7 +79,7 @@ void QEglFSCursor::resetResources()
m_cursorAtlas.texture = 0;
}
static GLuint createShader(GLenum shaderType, const char *program)
GLuint QEglFSCursor::createShader(GLenum shaderType, const char *program)
{
GLuint shader = glCreateShader(shaderType);
glShaderSource(shader, 1 /* count */, &program, NULL /* lengths */);
@ -98,7 +98,7 @@ static GLuint createShader(GLenum shaderType, const char *program)
return 0;
}
static GLuint createProgram(GLuint vshader, GLuint fshader)
GLuint QEglFSCursor::createProgram(GLuint vshader, GLuint fshader)
{
GLuint program = glCreateProgram();
glAttachShader(program, vshader);
@ -286,6 +286,7 @@ void QEglFSCursor::draw(const QRectF &r)
{
if (!m_program) {
// one time initialization
initializeOpenGLFunctions();
createShaderPrograms();
if (!m_cursorAtlas.texture) {

View File

@ -43,15 +43,15 @@
#define QEGLFSCURSOR_H
#include <qpa/qplatformcursor.h>
#include <QtGui/QOpenGLFunctions>
#include "qeglfsscreen.h"
#include <GLES2/gl2.h>
QT_BEGIN_NAMESPACE
class QOpenGLShaderProgram;
class QEglFSScreen;
class QEglFSCursor : public QPlatformCursor
class QEglFSCursor : public QPlatformCursor, public QOpenGLFunctions
{
public:
QEglFSCursor(QEglFSScreen *screen);
@ -78,6 +78,9 @@ protected:
void draw(const QRectF &rect);
void update(const QRegion &region);
GLuint createShader(GLenum shaderType, const char *program);
GLuint createProgram(GLuint vshader, GLuint fshader);
QEglFSScreen *m_screen;
// current cursor information

View File

@ -52,6 +52,7 @@ QKmsBackingStore::QKmsBackingStore(QWindow *window)
, m_context(new QOpenGLContext)
, m_texture(0)
, m_program(0)
, m_initialized(false)
{
m_context->setFormat(window->requestedFormat());
m_context->setScreen(window->screen());
@ -85,6 +86,11 @@ void QKmsBackingStore::flush(QWindow *window, const QRegion &region, const QPoin
m_context->makeCurrent(window);
if (!m_initialized) {
initializeOpenGLFunctions();
m_initialized = true;
}
if (!m_program) {
static const char *textureVertexProgram =
"attribute highp vec2 vertexCoordEntry;\n"

View File

@ -43,6 +43,7 @@
#define QBACKINGSTORE_KMS_H
#include <qpa/qplatformbackingstore.h>
#include <QtGui/QOpenGLFunctions>
#include <QImage>
QT_BEGIN_NAMESPACE
@ -50,7 +51,7 @@ QT_BEGIN_NAMESPACE
class QOpenGLContext;
class QOpenGLShaderProgram;
class QKmsBackingStore : public QPlatformBackingStore
class QKmsBackingStore : public QPlatformBackingStore, public QOpenGLFunctions
{
public:
QKmsBackingStore(QWindow *window);
@ -69,6 +70,7 @@ private:
uint m_texture;
QOpenGLShaderProgram *m_program;
QRegion m_dirty;
bool m_initialized;
};
QT_END_NAMESPACE

View File

@ -55,8 +55,7 @@ extern "C" {
#include <EGL/egl.h>
#include <EGL/eglext.h>
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
#include <QtGui/qopengl.h>
#include <qpa/qplatformscreen.h>