~vanvugt/compiz/fix-1023742

« back to all changes in this revision

Viewing changes to plugins/opengl/src/texture.cpp

  • Committer: Tarmac
  • Author(s): Sam Spilsbury
  • Date: 2012-07-02 08:29:20 UTC
  • mfrom: (3256.5.1 compiz.fix_1016367)
  • Revision ID: tarmac-20120702082920-1ld0rfvtj32zug4p
Wait for the server to finish processing requests before doing a bind
(LP: #1016367). Fixes: https://bugs.launchpad.net/bugs/1016367. Approved by Daniel van Vugt.

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
#include <stdlib.h>
32
32
#include <string.h>
33
33
 
 
34
#include <core/servergrab.h>
34
35
#include <opengl/texture.h>
35
36
#include <privatetexture.h>
36
37
#include "privates.h"
429
430
 
430
431
        glBindTexture (target (), name ());
431
432
 
432
 
        (*GL::releaseTexImage) (screen->dpy (), pixmap, GLX_FRONT_LEFT_EXT);
 
433
        releaseTexImage ();
433
434
 
434
435
        glBindTexture (target (), 0);
435
436
        glDisable (target ());
441
442
    }
442
443
}
443
444
 
 
445
bool
 
446
TfpTexture::bindTexImage (const GLXPixmap &glxPixmap)
 
447
{
 
448
    ServerLock sg (screen->serverGrabInterface ());
 
449
    glXWaitX ();
 
450
    (*GL::bindTexImage) (screen->dpy (), glxPixmap, GLX_FRONT_LEFT_EXT, NULL);
 
451
    return true;
 
452
}
 
453
 
 
454
void
 
455
TfpTexture::releaseTexImage ()
 
456
{
 
457
    (*GL::releaseTexImage) (screen->dpy (), pixmap, GLX_FRONT_LEFT_EXT);
 
458
}
 
459
 
444
460
GLTexture::List
445
461
TfpTexture::bindPixmapToTexture (Pixmap pixmap,
446
462
                                 int    width,
572
588
 
573
589
    glBindTexture (texTarget, tex->name ());
574
590
 
575
 
 
576
 
    (*GL::bindTexImage) (screen->dpy (), glxPixmap, GLX_FRONT_LEFT_EXT, NULL);
577
 
 
 
591
    tex->bindTexImage (glxPixmap);
578
592
    tex->setFilter (GL_NEAREST);
579
593
    tex->setWrap (GL_CLAMP_TO_EDGE);
580
594
 
595
609
 
596
610
    if (damaged && pixmap)
597
611
    {
598
 
        (*GL::releaseTexImage) (screen->dpy (), pixmap, GLX_FRONT_LEFT_EXT);
599
 
        (*GL::bindTexImage) (screen->dpy (), pixmap, GLX_FRONT_LEFT_EXT, NULL);
 
612
        releaseTexImage ();
 
613
        bindTexImage (pixmap);
600
614
    }
601
615
 
602
616
    GLTexture::enable (filter);