Skip to content

Accelerated compositing fixes #13

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jul 20, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 3 additions & 22 deletions src/opengl/qgl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1602,6 +1602,9 @@ bool operator!=(const QGLFormat& a, const QGLFormat& b)
}

struct QGLContextGroupList {
// this had to be recursive since we got into a deadlock from QtWebkit when switching backends
QGLContextGroupList()
: m_mutex(QMutex::Recursive) {};
void append(QGLContextGroup *group) {
QMutexLocker locker(&m_mutex);
m_list.append(group);
Expand Down Expand Up @@ -2618,11 +2621,7 @@ QGLTexture *QGLContextPrivate::bindTexture(const QPixmap &pixmap, GLenum target,
#if !defined(QT_OPENGL_ES_1)
if (target == GL_TEXTURE_2D && pd->classId() == QPixmapData::OpenGLClass) {

#if defined(QT_OPENGL_ES_2)
const QEglGLPixmapData *data = static_cast<const QEglGLPixmapData *>(pd);
#else
const QGLPixmapData *data = static_cast<const QGLPixmapData *>(pd);
#endif

if (data->isValidContext(q)) {
data->bind();
Expand Down Expand Up @@ -2893,24 +2892,6 @@ void QGLContext::deleteTexture(GLuint id)
glDeleteTextures(1, &id);
}

void QGLContext::setTextureOptions(const QPixmap& pixmap, BindOptions options)
{
QPixmapData *pd = pixmap.pixmapData();

#if defined(QT_OPENGL_ES_2)
if (pd->classId() == QPixmapData::OpenGLClass) {
const QEglGLPixmapData *data = static_cast<const QEglGLPixmapData *>(pd);
if (data->isValidContext(this)) {
data->bind();
data->texture()->options = options;
}
}
#else
Q_UNUSED(pd);
#endif
}


#ifdef Q_MAC_COMPAT_GL_FUNCTIONS
/*! \internal */
void QGLContext::deleteTexture(QMacCompatGLuint id)
Expand Down
2 changes: 0 additions & 2 deletions src/opengl/qgl.h
Original file line number Diff line number Diff line change
Expand Up @@ -364,8 +364,6 @@ class Q_OPENGL_EXPORT QGLContext

void deleteTexture(GLuint tx_id);

void setTextureOptions(const QPixmap& pixmap, BindOptions options);

void drawTexture(const QRectF &target, GLuint textureId, GLenum textureTarget = GL_TEXTURE_2D);
void drawTexture(const QPointF &point, GLuint textureId, GLenum textureTarget = GL_TEXTURE_2D);

Expand Down
4 changes: 0 additions & 4 deletions src/opengl/qglpaintdevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,11 +225,7 @@ QGLPaintDevice* QGLPaintDevice::getDevice(QPaintDevice* pd)
#if !defined(QT_OPENGL_ES_1)
QPixmapData* pmd = static_cast<QPixmap*>(pd)->pixmapData();
if (pmd->classId() == QPixmapData::OpenGLClass)
#if defined(QT_OPENGL_ES_2)
glpd = static_cast<QEglGLPixmapData*>(pmd)->glDevice();
#else
glpd = static_cast<QGLPixmapData*>(pmd)->glDevice();
#endif
#ifdef Q_WS_X11
else if (pmd->classId() == QPixmapData::X11Class)
glpd = static_cast<QX11GLPixmapData*>(pmd);
Expand Down
3 changes: 1 addition & 2 deletions src/plugins/gfxdrivers/egl/eglscreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,7 @@ class EglScreenPrivate : public QWSGraphicsSystem
public:

virtual QPixmapData* createPixmapData(QPixmapData::PixelType type) const {
//return new QGLPixmapData(type);
return new QEglGLPixmapData(type);
return new QGLPixmapData(type);
}

};
Expand Down
10 changes: 1 addition & 9 deletions src/plugins/platforms/palm/qeglfsintegration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,15 +99,7 @@ QPixmapData *QEglFSIntegration::createPixmapData(QPixmapData::PixelType type) co
#ifdef QEGL_EXTRA_DEBUG
qWarning("QEglIntegration::createPixmapData %d\n", type);
#endif
if(soft)
return new QRasterPixmapData(type);
else
// We have to think about either improving on the performance of EglGLPixmapData
// or having QWebKit not copy around so many images at all. For now Raster gives
// us *just* about enough speed.
// FIXME make QEglGLPixmapData faster and re-enable here.
// return new QEglGLPixmapData(type);
return new QRasterPixmapData(type);
return new QRasterPixmapData(type);
}

QPlatformWindow *QEglFSIntegration::createPlatformWindow(QWidget *widget, WId winId) const
Expand Down
10 changes: 1 addition & 9 deletions src/plugins/platforms/webos/qwebosintegration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,7 @@ QPixmapData *QWebOSIntegration::createPixmapData(QPixmapData::PixelType type) co
#ifdef QEGL_EXTRA_DEBUG
qWarning("QEglIntegration::createPixmapData %d\n", type);
#endif
if(m_offscreen)
return new QRasterPixmapData(type);
else
// We have to think about either improving on the performance of EglGLPixmapData
// or having QWebKit not copy around so many images at all. For now Raster gives
// us *just* about enough speed.
// FIXME make QEglGLPixmapData faster and re-enable here.
// return new QEglGLPixmapData(type);
return new QRasterPixmapData(type);
return new QRasterPixmapData(type);
}

QPlatformWindow *QWebOSIntegration::createPlatformWindow(QWidget *widget, WId winId) const
Expand Down
14 changes: 1 addition & 13 deletions src/plugins/platforms/webos/qwebosscreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,8 @@ QWebOSScreen::QWebOSScreen(EGLNativeDisplayType display, bool offscreen)
// , m_nrWindow(0)
, m_direct(false)
{
qDebug() << "\t\t\t\t\**************"<< __PRETTY_FUNCTION__ << "****************";
#ifdef QEGL_EXTRA_DEBUG
qWarning("QEglScreen %p\n", this);
qDebug() << "\t\t\t\t\**************"<< __PRETTY_FUNCTION__ << "****************";
#endif

EGLint major, minor;
Expand Down Expand Up @@ -120,7 +119,6 @@ QWebOSScreen::QWebOSScreen(EGLNativeDisplayType display, bool offscreen)
}
eglSwapInterval(m_dpy, swapInterval);

qDebug() << "\t\t\t\t\************** Returning from "<< __PRETTY_FUNCTION__ << "****************";
}

void QWebOSScreen::createAndSetPlatformContext() const {
Expand All @@ -129,7 +127,6 @@ void QWebOSScreen::createAndSetPlatformContext() const {

void QWebOSScreen::createAndSetPlatformContext()
{
qDebug() << "\t\t\t\t\**************"<< __PRETTY_FUNCTION__ << "1 ****************";
QPlatformWindowFormat platformFormat = QPlatformWindowFormat::defaultFormat();

platformFormat.setWindowApi(QPlatformWindowFormat::OpenGL);
Expand All @@ -154,8 +151,6 @@ void QWebOSScreen::createAndSetPlatformContext()
platformFormat.setSampleBuffers(true);
}

qDebug() << "\t\t\t\t\**************"<< __PRETTY_FUNCTION__ << "2 ****************";

EGLConfig config = q_configFromQPlatformWindowFormat(m_dpy, platformFormat);

EGLNativeWindowType eglWindow = 0;
Expand Down Expand Up @@ -204,7 +199,6 @@ void QWebOSScreen::createAndSetPlatformContext()
}
else
{
qDebug() << "\t\t\t\t\**************"<< __PRETTY_FUNCTION__ << "4 ****************";
m_surface = eglCreateWindowSurface(m_dpy, config, eglWindow, NULL);
}

Expand Down Expand Up @@ -237,11 +231,9 @@ void QWebOSScreen::createAndSetPlatformContext()
attribList[temp++] = 2; // GLES version 2
attribList[temp++] = EGL_NONE;

qDebug() << "\t\t\t\t\**************"<< __PRETTY_FUNCTION__ << "6 ****************";

//start me in offscreen mode
m_platformContext = new QEGLPlatformContext(m_dpy,config,attribList,m_surface,EGL_OPENGL_ES_API);
//qDebug("\t\t\t\tPlatform Context : %p", m_platformContext);

EGLint w,h; // screen size detection
eglQuerySurface(m_dpy, m_surface, EGL_WIDTH, &w);
Expand All @@ -251,9 +243,6 @@ void QWebOSScreen::createAndSetPlatformContext()

glClearColor(0.7f, 0.7f, 0.7f, 1.0f);

qDebug() << "\t\t\t\t\**************"<< __PRETTY_FUNCTION__ << "7 ****************";
//m_platformContext->makeCurrent();
qDebug() << "\t\t\t\t\**************"<< __PRETTY_FUNCTION__ << "8 ****************";
}

//void QWebOSScreen::directRendering(bool enable)
Expand Down Expand Up @@ -293,7 +282,6 @@ int QWebOSScreen::depth() const

QImage::Format QWebOSScreen::format() const
{
qDebug() << "\t\t\t\t\**************"<< __PRETTY_FUNCTION__ << "****************";
if (m_format == QImage::Format_Invalid)
createAndSetPlatformContext();
return m_format;
Expand Down
16 changes: 9 additions & 7 deletions src/plugins/platforms/webos/qweboswindowsurface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,11 @@ class QWebOSPaintDevice : public QGLPaintDevice
QSize size() const { return m_screen->geometry().size(); }
QGLContext* context() const { return QGLContext::fromPlatformGLContext(m_screen->platformContext());}

QPaintEngine *paintEngine() const { qDebug() << "\t\t\t\t\**************"<< __PRETTY_FUNCTION__ << "****************"; return qt_qgl_paint_engine(); }
QPaintEngine *paintEngine() const {
return qt_qgl_paint_engine();
}

void beginPaint(){
qDebug() << "\t\t\t\t\**************"<< __PRETTY_FUNCTION__ << "****************";
QGLPaintDevice::beginPaint();
}
private:
Expand Down Expand Up @@ -79,11 +80,14 @@ QWebOSWindowSurface::QWebOSWindowSurface(QWebOSScreen *screen, QWidget *window,

void QWebOSWindowSurface::flush(QWidget *widget, const QRegion &region, const QPoint &offset)
{
qDebug() << "\t\t\t\t\**************"<< __PRETTY_FUNCTION__ << "****************";
Q_UNUSED(widget);
Q_UNUSED(region);
Q_UNUSED(offset);


// QGraphicsView contains a QWidget for its frame, even if it is not visible. Any repaint
// on that frame widget will cause an extra buffer swap, causing problems. This filters out
// that swap.
if(qobject_cast<QGraphicsView*>(widget))
return;
widget->platformWindow()->glContext()->swapBuffers();
}

Expand All @@ -109,12 +113,10 @@ void QWebOSWindowSurface::flush(QWidget *widget, const QRegion &region, const QP

QWebOSWindowSurface::~QWebOSWindowSurface()
{
qDebug() << "\t\t\t\t\**************"<< __PRETTY_FUNCTION__ << "****************";
}

void QWebOSWindowSurface::resize(const QSize &size)
{
qDebug() << "\t\t\t\t\**************"<< __PRETTY_FUNCTION__ << "****************";
Q_UNUSED(size);
}

Expand Down