Ignore:
Timestamp:
May 5, 2011, 5:36:53 AM (14 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/gui/egl/qegl.cpp

    r769 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    4545#include <QtCore/qatomic.h>
    4646#include <QtCore/qdebug.h>
     47
    4748#include "qegl_p.h"
     49#include "qeglcontext_p.h"
     50
    4851
    4952QT_BEGIN_NAMESPACE
     
    6265    static void deref() {
    6366        if (!contexts.deref()) {
    64             eglTerminate(QEglContext::display());
     67            eglTerminate(QEgl::display());
    6568            displayOpen = 0;
    6669        }
     
    8487static QEglContext * volatile currentVGContext = 0;
    8588
    86 EGLDisplay QEglContext::dpy = EGL_NO_DISPLAY;
    87 
    8889QEglContext::QEglContext()
    8990    : apiType(QEgl::OpenGL)
    9091    , ctx(EGL_NO_CONTEXT)
    91     , cfg(0)
     92    , cfg(QEGL_NO_CONFIG)
    9293    , currentSurface(EGL_NO_SURFACE)
    9394    , current(false)
     
    119120}
    120121
     122EGLConfig QEgl::defaultConfig(int devType, API api, ConfigOptions options)
     123{
     124    if ( (devType != QInternal::Pixmap) && ((options & Renderable) == 0))
     125        qWarning("QEgl::defaultConfig() - Only configs for pixmaps make sense to be read-only!");
     126
     127    EGLConfig* targetConfig = 0;
     128
     129    static EGLConfig defaultVGConfigs[] = {
     130        QEGL_NO_CONFIG, // 0    Window  Renderable  Translucent
     131        QEGL_NO_CONFIG, // 1    Window  Renderable  Opaque
     132        QEGL_NO_CONFIG, // 2    Pixmap  Renderable  Translucent
     133        QEGL_NO_CONFIG, // 3    Pixmap  Renderable  Opaque
     134        QEGL_NO_CONFIG, // 4    Pixmap  ReadOnly    Translucent
     135        QEGL_NO_CONFIG  // 5    Pixmap  ReadOnly    Opaque
     136    };
     137    if (api == OpenVG) {
     138        if (devType == QInternal::Widget) {
     139            if (options & Translucent)
     140                targetConfig = &(defaultVGConfigs[0]);
     141            else
     142                targetConfig = &(defaultVGConfigs[1]);
     143        } else if (devType == QInternal::Pixmap) {
     144            if (options & Renderable) {
     145                if (options & Translucent)
     146                    targetConfig = &(defaultVGConfigs[2]);
     147                else // Opaque
     148                    targetConfig = &(defaultVGConfigs[3]);
     149            } else { // Read-only
     150                if (options & Translucent)
     151                    targetConfig = &(defaultVGConfigs[4]);
     152                else // Opaque
     153                    targetConfig = &(defaultVGConfigs[5]);
     154            }
     155        }
     156    }
     157
     158
     159    static EGLConfig defaultGLConfigs[] = {
     160        QEGL_NO_CONFIG, // 0    Window  Renderable  Translucent
     161        QEGL_NO_CONFIG, // 1    Window  Renderable  Opaque
     162        QEGL_NO_CONFIG, // 2    PBuffer Renderable  Translucent
     163        QEGL_NO_CONFIG, // 3    PBuffer Renderable  Opaque
     164        QEGL_NO_CONFIG, // 4    Pixmap  Renderable  Translucent
     165        QEGL_NO_CONFIG, // 5    Pixmap  Renderable  Opaque
     166        QEGL_NO_CONFIG, // 6    Pixmap  ReadOnly    Translucent
     167        QEGL_NO_CONFIG  // 7    Pixmap  ReadOnly    Opaque
     168    };
     169    if (api == OpenGL) {
     170        if (devType == QInternal::Widget) {
     171            if (options & Translucent)
     172                targetConfig = &(defaultGLConfigs[0]);
     173            else // Opaque
     174                targetConfig = &(defaultGLConfigs[1]);
     175        } else if (devType == QInternal::Pbuffer) {
     176            if (options & Translucent)
     177                targetConfig = &(defaultGLConfigs[2]);
     178            else // Opaque
     179                targetConfig = &(defaultGLConfigs[3]);
     180        } else if (devType == QInternal::Pixmap) {
     181            if (options & Renderable) {
     182                if (options & Translucent)
     183                    targetConfig = &(defaultGLConfigs[4]);
     184                else // Opaque
     185                    targetConfig = &(defaultGLConfigs[5]);
     186            } else { // ReadOnly
     187                if (options & Translucent)
     188                    targetConfig = &(defaultGLConfigs[6]);
     189                else // Opaque
     190                    targetConfig = &(defaultGLConfigs[7]);
     191            }
     192        }
     193    }
     194
     195    if (!targetConfig) {
     196        qWarning("QEgl::defaultConfig() - No default config for device/api/options combo");
     197        return QEGL_NO_CONFIG;
     198    }
     199    if (*targetConfig != QEGL_NO_CONFIG)
     200        return *targetConfig;
     201
     202
     203    // We haven't found an EGL config for the target config yet, so do it now:
     204
     205
     206    // Allow overriding from an environment variable:
     207    QByteArray configId;
     208    if (api == OpenVG)
     209        configId = qgetenv("QT_VG_EGL_CONFIG");
     210    else
     211        configId = qgetenv("QT_GL_EGL_CONFIG");
     212    if (!configId.isEmpty()) {
     213        // Overridden, so get the EGLConfig for the specified config ID:
     214        EGLint properties[] = {
     215            EGL_CONFIG_ID, (EGLint)configId.toInt(),
     216            EGL_NONE
     217        };
     218        EGLint configCount = 0;
     219        eglChooseConfig(display(), properties, targetConfig, 1, &configCount);
     220        if (configCount > 0)
     221            return *targetConfig;
     222        qWarning() << "QEgl::defaultConfig() -" << configId << "appears to be invalid";
     223    }
     224
     225    QEglProperties configAttribs;
     226    configAttribs.setRenderableType(api);
     227
     228    EGLint surfaceType;
     229    switch (devType) {
     230        case QInternal::Widget:
     231            surfaceType = EGL_WINDOW_BIT;
     232            break;
     233        case QInternal::Pixmap:
     234            surfaceType = EGL_PIXMAP_BIT;
     235            break;
     236        case QInternal::Pbuffer:
     237            surfaceType = EGL_PBUFFER_BIT;
     238            break;
     239        default:
     240            qWarning("QEgl::defaultConfig() - Can't create EGL surface for %d device type", devType);
     241            return QEGL_NO_CONFIG;
     242    };
     243#ifdef EGL_VG_ALPHA_FORMAT_PRE_BIT
     244    // For OpenVG, we try to create a surface using a pre-multiplied format if
     245    // the surface needs to have an alpha channel:
     246    if (api == OpenVG && (options & Translucent))
     247        surfaceType |= EGL_VG_ALPHA_FORMAT_PRE_BIT;
     248#endif
     249    configAttribs.setValue(EGL_SURFACE_TYPE, surfaceType);
     250
     251#ifdef EGL_BIND_TO_TEXTURE_RGBA
     252    if (devType == QInternal::Pixmap || devType == QInternal::Pbuffer) {
     253        if (options & Translucent)
     254            configAttribs.setValue(EGL_BIND_TO_TEXTURE_RGBA, EGL_TRUE);
     255        else
     256            configAttribs.setValue(EGL_BIND_TO_TEXTURE_RGB, EGL_TRUE);
     257    }
     258#endif
     259
     260    // Add paint engine requirements
     261    if (api == OpenVG) {
     262#if !defined(QVG_SCISSOR_CLIP) && defined(EGL_ALPHA_MASK_SIZE)
     263        configAttribs.setValue(EGL_ALPHA_MASK_SIZE, 1);
     264#endif
     265    } else {
     266        // Both OpenGL paint engines need to have stencil and sample buffers
     267        configAttribs.setValue(EGL_STENCIL_SIZE, 1);
     268        configAttribs.setValue(EGL_SAMPLE_BUFFERS, 1);
     269#ifndef QT_OPENGL_ES_2
     270        // Additionally, the GL1 engine likes to have a depth buffer for clipping
     271        configAttribs.setValue(EGL_DEPTH_SIZE, 1);
     272#endif
     273    }
     274
     275    if (options & Translucent)
     276        configAttribs.setValue(EGL_ALPHA_SIZE, 1);
     277
     278    *targetConfig = chooseConfig(&configAttribs, QEgl::BestPixelFormat);
     279    return *targetConfig;
     280}
     281
     282
    121283// Choose a configuration that matches "properties".
    122 bool QEglContext::chooseConfig
    123         (const QEglProperties& properties, QEgl::PixelFormatMatch match)
    124 {
    125     QEglProperties props(properties);
     284EGLConfig QEgl::chooseConfig(const QEglProperties* properties, QEgl::PixelFormatMatch match)
     285{
     286    QEglProperties props(*properties);
     287    EGLConfig cfg = QEGL_NO_CONFIG;
    126288    do {
    127289        // Get the number of matching configurations for this set of properties.
    128290        EGLint matching = 0;
    129         if (!eglChooseConfig(display(), props.properties(), 0, 0, &matching) || !matching)
     291        EGLDisplay dpy = QEgl::display();
     292        if (!eglChooseConfig(dpy, props.properties(), 0, 0, &matching) || !matching)
    130293            continue;
    131294
     
    136299            if (matching < 1)
    137300                continue;
    138             return true;
     301            return cfg;
    139302        }
    140303
     
    157320                cfg = configs[index];
    158321                delete [] configs;
    159                 return true;
     322                return cfg;
    160323            }
    161324        }
     
    174337        qWarning() << "Requested:" << props.toString();
    175338        qWarning() << "Available:";
    176         dumpAllConfigs();
    177     }
    178     return false;
    179 }
     339        QEgl::dumpAllConfigs();
     340    }
     341    return QEGL_NO_CONFIG;
     342}
     343
     344bool QEglContext::chooseConfig(const QEglProperties& properties, QEgl::PixelFormatMatch match)
     345{
     346    cfg = QEgl::chooseConfig(&properties, match);
     347    return cfg != QEGL_NO_CONFIG;
     348}
     349
     350EGLSurface QEglContext::createSurface(QPaintDevice* device, const QEglProperties *properties)
     351{
     352    return QEgl::createSurface(device, cfg, properties);
     353}
     354
    180355
    181356// Create the EGLContext.
     
    183358{
    184359    // We need to select the correct API before calling eglCreateContext().
     360#ifdef QT_OPENGL_ES
    185361#ifdef EGL_OPENGL_ES_API
    186362    if (apiType == QEgl::OpenGL)
    187363        eglBindAPI(EGL_OPENGL_ES_API);
    188364#endif
     365#else
     366#ifdef EGL_OPENGL_API
     367    if (apiType == QEgl::OpenGL)
     368        eglBindAPI(EGL_OPENGL_API);
     369#endif
     370#endif //defined(QT_OPENGL_ES)
    189371#ifdef EGL_OPENVG_API
    190372    if (apiType == QEgl::OpenVG)
     
    196378    if (properties)
    197379        contextProps = *properties;
    198 #if defined(QT_OPENGL_ES_2)
     380#ifdef QT_OPENGL_ES_2
    199381    if (apiType == QEgl::OpenGL)
    200382        contextProps.setValue(EGL_CONTEXT_CLIENT_VERSION, 2);
     
    204386        shareContext = 0;
    205387    if (shareContext) {
    206         ctx = eglCreateContext(display(), cfg, shareContext->ctx, contextProps.properties());
     388        ctx = eglCreateContext(QEgl::display(), cfg, shareContext->ctx, contextProps.properties());
    207389        if (ctx == EGL_NO_CONTEXT) {
    208             qWarning() << "QEglContext::createContext(): Could not share context:" << errorString(eglGetError());
     390            qWarning() << "QEglContext::createContext(): Could not share context:" << QEgl::errorString();
    209391            shareContext = 0;
    210392        } else {
     
    215397        ctx = eglCreateContext(display(), cfg, 0, contextProps.properties());
    216398        if (ctx == EGL_NO_CONTEXT) {
    217             qWarning() << "QEglContext::createContext(): Unable to create EGL context:" << errorString(eglGetError());
     399            qWarning() << "QEglContext::createContext(): Unable to create EGL context:" << QEgl::errorString();
    218400            return false;
    219401        }
     
    246428    if (ctx == EGL_NO_CONTEXT) {
    247429        qWarning() << "QEglContext::makeCurrent(): Cannot make invalid context current";
     430        return false;
     431    }
     432
     433    if (surface == EGL_NO_SURFACE) {
     434        qWarning() << "QEglContext::makeCurrent(): Cannot make invalid surface current";
    248435        return false;
    249436    }
     
    272459#endif
    273460
    274     bool ok = eglMakeCurrent(display(), surface, surface, ctx);
     461    bool ok = eglMakeCurrent(QEgl::display(), surface, surface, ctx);
    275462    if (!ok)
    276         qWarning() << "QEglContext::makeCurrent():" << errorString(eglGetError());
     463        qWarning() << "QEglContext::makeCurrent(" << surface << "):" << QEgl::errorString();
    277464    return ok;
    278465}
     
    301488#endif
    302489
    303     bool ok = eglMakeCurrent(display(), EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
     490    bool ok = eglMakeCurrent(QEgl::display(), EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
    304491    if (!ok)
    305         qWarning() << "QEglContext::doneCurrent():" << errorString(eglGetError());
     492        qWarning() << "QEglContext::doneCurrent():" << QEgl::errorString();
    306493    return ok;
    307494}
     
    323510        return false;
    324511
    325     bool ok = eglSwapBuffers(display(), surface);
     512    bool ok = eglSwapBuffers(QEgl::display(), surface);
    326513    if (!ok)
    327         qWarning() << "QEglContext::swapBuffers():" << errorString(eglGetError());
     514        qWarning() << "QEglContext::swapBuffers():" << QEgl::errorString();
    328515    return ok;
    329516}
    330517
    331 // Wait for native rendering operations to complete before starting
    332 // to use OpenGL/OpenVG operations.
    333 void QEglContext::waitNative()
    334 {
    335 #ifdef EGL_CORE_NATIVE_ENGINE
    336     eglWaitNative(EGL_CORE_NATIVE_ENGINE);
    337 #endif
    338 }
    339 
    340 // Wait for client OpenGL/OpenVG operations to complete before
    341 // using native rendering operations.
    342 void QEglContext::waitClient()
    343 {
    344 #ifdef EGL_OPENGL_ES_API
    345     if (apiType == QEgl::OpenGL) {
    346         eglBindAPI(EGL_OPENGL_ES_API);
    347         eglWaitClient();
    348     }
    349 #else
    350     if (apiType == QEgl::OpenGL)
    351         eglWaitGL();
    352 #endif
    353 #ifdef EGL_OPENVG_API
    354     if (apiType == QEgl::OpenVG) {
    355         eglBindAPI(EGL_OPENVG_API);
    356         eglWaitClient();
    357     }
    358 #endif
    359 }
    360 
    361 // Query the value of a configuration attribute.
    362 bool QEglContext::configAttrib(int name, EGLint *value) const
    363 {
    364     return eglGetConfigAttrib(display(), cfg, name, value);
    365 }
    366 
    367 void QEglContext::clearError()
    368 {
    369     eglGetError();
    370 }
    371 
    372 EGLint QEglContext::error()
    373 {
    374     return eglGetError();
    375 }
    376 
    377 // Retrieve all of the properties on "cfg".  If zero, return
    378 // the context's configuration.
    379 QEglProperties QEglContext::configProperties(EGLConfig cfg) const
    380 {
    381     if (!cfg)
    382         cfg = config();
    383     QEglProperties props;
    384     for (int name = 0x3020; name <= 0x304F; ++name) {
    385         EGLint value;
    386         if (name != EGL_NONE && eglGetConfigAttrib(display(), cfg, name, &value))
    387             props.setValue(name, value);
    388     }
    389     eglGetError();  // Clear the error state.
    390     return props;
    391 }
    392 
    393 EGLDisplay QEglContext::display()
    394 {
     518bool QEglContext::swapBuffersRegion2NOK(EGLSurface surface, const QRegion *region) {
     519    QVector<QRect> qrects = region->rects();
     520    EGLint *gl_rects;
     521    uint count;
     522    uint i;
     523
     524    count = qrects.size();
     525    QVarLengthArray <EGLint> arr(4 * count);
     526    gl_rects = arr.data();
     527    for (i = 0; i < count; i++) {
     528      QRect qrect = qrects[i];
     529
     530      gl_rects[4 * i + 0] = qrect.x();
     531      gl_rects[4 * i + 1] = qrect.y();
     532      gl_rects[4 * i + 2] = qrect.width();
     533      gl_rects[4 * i + 3] = qrect.height();
     534    }
     535
     536    bool ok = QEgl::eglSwapBuffersRegion2NOK(QEgl::display(), surface, count, gl_rects);
     537
     538    if (!ok)
     539        qWarning() << "QEglContext::swapBuffersRegion2NOK():" << QEgl::errorString();
     540    return ok;
     541}
     542
     543int QEglContext::configAttrib(int name) const
     544{
     545    EGLint value;
     546    EGLBoolean success = eglGetConfigAttrib(QEgl::display(), cfg, name, &value);
     547    if (success)
     548        return value;
     549    else
     550        return EGL_DONT_CARE;
     551}
     552
     553typedef EGLImageKHR (EGLAPIENTRY *_eglCreateImageKHR)(EGLDisplay, EGLContext, EGLenum, EGLClientBuffer, const EGLint*);
     554typedef EGLBoolean (EGLAPIENTRY *_eglDestroyImageKHR)(EGLDisplay, EGLImageKHR);
     555
     556// Defined in qegl.cpp:
     557static _eglCreateImageKHR qt_eglCreateImageKHR = 0;
     558static _eglDestroyImageKHR qt_eglDestroyImageKHR = 0;
     559
     560typedef EGLBoolean (EGLAPIENTRY *_eglSwapBuffersRegion2NOK)(EGLDisplay, EGLSurface, EGLint, const EGLint*);
     561
     562static _eglSwapBuffersRegion2NOK qt_eglSwapBuffersRegion2NOK = 0;
     563
     564EGLDisplay QEgl::display()
     565{
     566    static EGLDisplay dpy = EGL_NO_DISPLAY;
    395567    if (!QEglContextTracker::displayOpened()) {
    396568        dpy = eglGetDisplay(nativeDisplay());
    397569        QEglContextTracker::setDisplayOpened();
    398570        if (dpy == EGL_NO_DISPLAY) {
    399             qWarning("QEglContext::display(): Falling back to EGL_DEFAULT_DISPLAY");
     571            qWarning("QEgl::display(): Falling back to EGL_DEFAULT_DISPLAY");
    400572            dpy = eglGetDisplay(EGLNativeDisplayType(EGL_DEFAULT_DISPLAY));
    401573        }
    402574        if (dpy == EGL_NO_DISPLAY) {
    403             qWarning("QEglContext::display(): Can't even open the default display");
     575            qWarning("QEgl::display(): Can't even open the default display");
    404576            return EGL_NO_DISPLAY;
    405577        }
    406578
    407579        if (!eglInitialize(dpy, NULL, NULL)) {
    408             qWarning() << "QEglContext::display(): Cannot initialize EGL display:" << errorString(eglGetError());
     580            qWarning() << "QEgl::display(): Cannot initialize EGL display:" << QEgl::errorString();
    409581            return EGL_NO_DISPLAY;
    410582        }
     583
     584        // Resolve the egl extension function pointers:
     585#if (defined(EGL_KHR_image) || defined(EGL_KHR_image_base)) && !defined(EGL_EGLEXT_PROTOTYPES)
     586        if (QEgl::hasExtension("EGL_KHR_image") || QEgl::hasExtension("EGL_KHR_image_base")) {
     587            qt_eglCreateImageKHR = (_eglCreateImageKHR) eglGetProcAddress("eglCreateImageKHR");
     588            qt_eglDestroyImageKHR = (_eglDestroyImageKHR) eglGetProcAddress("eglDestroyImageKHR");
     589        }
     590#endif
     591
     592        if (QEgl::hasExtension("EGL_NOK_swap_region2")) {
     593            qt_eglSwapBuffersRegion2NOK = (_eglSwapBuffersRegion2NOK) eglGetProcAddress("eglSwapBuffersRegion2NOK");
     594        }
    411595    }
    412596
     
    414598}
    415599
    416 #if !defined(Q_WS_X11) && !defined(Q_WS_WINCE) // WinCE & X11 implement this properly
    417 EGLNativeDisplayType QEglContext::nativeDisplay()
    418 {
    419     return EGL_DEFAULT_DISPLAY;
    420 }
    421 #endif
     600EGLImageKHR QEgl::eglCreateImageKHR(EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list)
     601{
     602    if (qt_eglCreateImageKHR)
     603        return qt_eglCreateImageKHR(dpy, ctx, target, buffer, attrib_list);
     604
     605    QEgl::display(); // Initialises function pointers
     606    if (qt_eglCreateImageKHR)
     607        return qt_eglCreateImageKHR(dpy, ctx, target, buffer, attrib_list);
     608
     609    qWarning("QEgl::eglCreateImageKHR() called but EGL_KHR_image(_base) extension not present");
     610    return 0;
     611}
     612
     613EGLBoolean QEgl::eglDestroyImageKHR(EGLDisplay dpy, EGLImageKHR img)
     614{
     615    if (qt_eglDestroyImageKHR)
     616        return qt_eglDestroyImageKHR(dpy, img);
     617
     618    QEgl::display(); // Initialises function pointers
     619    if (qt_eglDestroyImageKHR)
     620        return qt_eglDestroyImageKHR(dpy, img);
     621
     622    qWarning("QEgl::eglDestroyImageKHR() called but EGL_KHR_image(_base) extension not present");
     623    return 0;
     624}
     625
     626EGLBoolean QEgl::eglSwapBuffersRegion2NOK(EGLDisplay dpy, EGLSurface surface, EGLint count, const EGLint *rects)
     627{
     628    if (qt_eglSwapBuffersRegion2NOK)
     629        return qt_eglSwapBuffersRegion2NOK(dpy, surface, count, rects);
     630
     631    QEgl::display(); // Initialises function pointers
     632    if (qt_eglSwapBuffersRegion2NOK)
     633        return qt_eglSwapBuffersRegion2NOK(dpy, surface, count, rects);
     634
     635    qWarning("QEgl::eglSwapBuffersRegion2NOK() called but EGL_NOK_swap_region2 extension not present");
     636    return 0;
     637}
     638
     639#ifndef Q_WS_X11
     640EGLSurface QEgl::createSurface(QPaintDevice *device, EGLConfig cfg, const QEglProperties *properties)
     641{
     642    // Create the native drawable for the paint device.
     643    int devType = device->devType();
     644    EGLNativePixmapType pixmapDrawable = 0;
     645    EGLNativeWindowType windowDrawable = 0;
     646    bool ok;
     647    if (devType == QInternal::Pixmap) {
     648        pixmapDrawable = nativePixmap(static_cast<QPixmap *>(device));
     649        ok = (pixmapDrawable != 0);
     650    } else if (devType == QInternal::Widget) {
     651        windowDrawable = nativeWindow(static_cast<QWidget *>(device));
     652        ok = (windowDrawable != 0);
     653    } else {
     654        ok = false;
     655    }
     656    if (!ok) {
     657        qWarning("QEglContext::createSurface(): Cannot create the native EGL drawable");
     658        return EGL_NO_SURFACE;
     659    }
     660
     661    // Create the EGL surface to draw into, based on the native drawable.
     662    const int *props;
     663    if (properties)
     664        props = properties->properties();
     665    else
     666        props = 0;
     667    EGLSurface surf;
     668    if (devType == QInternal::Widget)
     669        surf = eglCreateWindowSurface(QEgl::display(), cfg, windowDrawable, props);
     670    else
     671        surf = eglCreatePixmapSurface(QEgl::display(), cfg, pixmapDrawable, props);
     672    if (surf == EGL_NO_SURFACE) {
     673        qWarning("QEglContext::createSurface(): Unable to create EGL surface, error = 0x%x", eglGetError());
     674    }
     675    return surf;
     676}
     677#endif
     678
    422679
    423680// Return the error string associated with a specific code.
    424 QString QEglContext::errorString(EGLint code)
     681QString QEgl::errorString(EGLint code)
    425682{
    426683    static const char * const errors[] = {
     
    449706
    450707// Dump all of the EGL configurations supported by the system.
    451 void QEglContext::dumpAllConfigs()
     708void QEgl::dumpAllConfigs()
    452709{
    453710    QEglProperties props;
     
    458715    eglGetConfigs(display(), configs, count, &count);
    459716    for (EGLint index = 0; index < count; ++index) {
    460         props = configProperties(configs[index]);
     717        props = QEglProperties(configs[index]);
    461718        qWarning() << props.toString();
    462719    }
     
    464721}
    465722
    466 QString QEglContext::extensions()
    467 {
    468     const char* exts = eglQueryString(QEglContext::display(), EGL_EXTENSIONS);
     723QString QEgl::extensions()
     724{
     725    const char* exts = eglQueryString(QEgl::display(), EGL_EXTENSIONS);
    469726    return QString(QLatin1String(exts));
    470727}
    471728
    472 bool QEglContext::hasExtension(const char* extensionName)
     729bool QEgl::hasExtension(const char* extensionName)
    473730{
    474731    QList<QByteArray> extensions =
    475732        QByteArray(reinterpret_cast<const char *>
    476             (eglQueryString(QEglContext::display(), EGL_EXTENSIONS))).split(' ');
     733            (eglQueryString(QEgl::display(), EGL_EXTENSIONS))).split(' ');
    477734    return extensions.contains(extensionName);
    478735}
Note: See TracChangeset for help on using the changeset viewer.