Remove the GLES 2 dependency for eglfs and kms
Change-Id: If7b80487e01db726367f5a67d2860073f60a0844 Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>bb10
parent
7e768dde39
commit
f087ffdc53
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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 ®ion);
|
||||
|
||||
GLuint createShader(GLenum shaderType, const char *program);
|
||||
GLuint createProgram(GLuint vshader, GLuint fshader);
|
||||
|
||||
QEglFSScreen *m_screen;
|
||||
|
||||
// current cursor information
|
||||
|
|
|
|||
|
|
@ -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 ®ion, 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"
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue