sun.java2d.pipe.hw.AccelGraphicsConfig Java Examples

The following examples show how to use sun.java2d.pipe.hw.AccelGraphicsConfig. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TranslucentWindowPainter.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Creates an instance of the painter for particular peer.
 */
public static TranslucentWindowPainter createInstance(WWindowPeer peer) {
    GraphicsConfiguration gc = peer.getGraphicsConfiguration();
    if (!forceSW && gc instanceof AccelGraphicsConfig) {
        String gcName = gc.getClass().getSimpleName();
        AccelGraphicsConfig agc = (AccelGraphicsConfig)gc;
        // this is a heuristic to check that we have a pcix board
        // (those have higher transfer rate from gpu to cpu)
        if ((agc.getContextCapabilities().getCaps() & CAPS_PS30) != 0 ||
            forceOpt)
        {
            // we check for name to avoid loading classes unnecessarily if
            // a pipeline isn't enabled
            if (gcName.startsWith("D3D")) {
                return new VIOptD3DWindowPainter(peer);
            } else if (forceOpt && gcName.startsWith("WGL")) {
                // on some boards (namely, ATI, even on pcix bus) ogl is
                // very slow reading pixels back so for now it is disabled
                // unless forced
                return new VIOptWGLWindowPainter(peer);
            }
        }
    }
    return new BIWindowPainter(peer);
}
 
Example #2
Source File: TranslucentWindowPainter.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Creates an instance of the painter for particular peer.
 */
public static TranslucentWindowPainter createInstance(WWindowPeer peer) {
    GraphicsConfiguration gc = peer.getGraphicsConfiguration();
    if (!forceSW && gc instanceof AccelGraphicsConfig) {
        String gcName = gc.getClass().getSimpleName();
        AccelGraphicsConfig agc = (AccelGraphicsConfig)gc;
        // this is a heuristic to check that we have a pcix board
        // (those have higher transfer rate from gpu to cpu)
        if ((agc.getContextCapabilities().getCaps() & CAPS_PS30) != 0 ||
            forceOpt)
        {
            // we check for name to avoid loading classes unnecessarily if
            // a pipeline isn't enabled
            if (gcName.startsWith("D3D")) {
                return new VIOptD3DWindowPainter(peer);
            } else if (forceOpt && gcName.startsWith("WGL")) {
                // on some boards (namely, ATI, even on pcix bus) ogl is
                // very slow reading pixels back so for now it is disabled
                // unless forced
                return new VIOptWGLWindowPainter(peer);
            }
        }
    }
    return new BIWindowPainter(peer);
}
 
Example #3
Source File: TranslucentWindowPainter.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected Image getBackBuffer(boolean clear) {
    int w = window.getWidth();
    int h = window.getHeight();
    GraphicsConfiguration gc = peer.getGraphicsConfiguration();

    if (viBB == null || viBB.getWidth() != w || viBB.getHeight() != h ||
        viBB.validate(gc) == IMAGE_INCOMPATIBLE)
    {
        flush();

        if (gc instanceof AccelGraphicsConfig) {
            AccelGraphicsConfig agc = ((AccelGraphicsConfig)gc);
            viBB = agc.createCompatibleVolatileImage(w, h,
                                                     TRANSLUCENT,
                                                     RT_PLAIN);
        }
        if (viBB == null) {
            viBB = gc.createCompatibleVolatileImage(w, h, TRANSLUCENT);
        }
        viBB.validate(gc);
    }

    return clear ? clearImage(viBB) : viBB;
}
 
Example #4
Source File: RSLAPITest.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
private static void testContext(final AccelGraphicsConfig agc) {
    BufferedContext c = agc.getContext();
    final AccelDeviceEventListener l = new AccelDeviceEventListener() {
        public void onDeviceDispose() {
            System.out.println("onDeviceDispose invoked");
            agc.removeDeviceEventListener(this);
        }
        public void onDeviceReset() {
            System.out.println("onDeviceReset invoked");
        }
    };
    agc.addDeviceEventListener(l);

    RenderQueue rq = c.getRenderQueue();
    rq.lock();
    try {
        c.saveState();
        rq.flushNow();
        c.restoreState();
        rq.flushNow();
        System.out.println("Passed: Save/Restore");
    } finally {
        rq.unlock();
    }
}
 
Example #5
Source File: RSLAPITest.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
private static void testContext(final AccelGraphicsConfig agc) {
    BufferedContext c = agc.getContext();
    final AccelDeviceEventListener l = new AccelDeviceEventListener() {
        public void onDeviceDispose() {
            System.out.println("onDeviceDispose invoked");
            agc.removeDeviceEventListener(this);
        }
        public void onDeviceReset() {
            System.out.println("onDeviceReset invoked");
        }
    };
    agc.addDeviceEventListener(l);

    RenderQueue rq = c.getRenderQueue();
    rq.lock();
    try {
        c.saveState();
        rq.flushNow();
        c.restoreState();
        rq.flushNow();
        System.out.println("Passed: Save/Restore");
    } finally {
        rq.unlock();
    }
}
 
Example #6
Source File: RSLAPITest.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
private static void testContext(final AccelGraphicsConfig agc) {
    BufferedContext c = agc.getContext();
    final AccelDeviceEventListener l = new AccelDeviceEventListener() {
        public void onDeviceDispose() {
            System.out.println("onDeviceDispose invoked");
            agc.removeDeviceEventListener(this);
        }
        public void onDeviceReset() {
            System.out.println("onDeviceReset invoked");
        }
    };
    agc.addDeviceEventListener(l);

    RenderQueue rq = c.getRenderQueue();
    rq.lock();
    try {
        c.saveState();
        rq.flushNow();
        c.restoreState();
        rq.flushNow();
        System.out.println("Passed: Save/Restore");
    } finally {
        rq.unlock();
    }
}
 
Example #7
Source File: TranslucentWindowPainter.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Creates an instance of the painter for particular peer.
 */
public static TranslucentWindowPainter createInstance(WWindowPeer peer) {
    GraphicsConfiguration gc = peer.getGraphicsConfiguration();
    if (!forceSW && gc instanceof AccelGraphicsConfig) {
        String gcName = gc.getClass().getSimpleName();
        AccelGraphicsConfig agc = (AccelGraphicsConfig)gc;
        // this is a heuristic to check that we have a pcix board
        // (those have higher transfer rate from gpu to cpu)
        if ((agc.getContextCapabilities().getCaps() & CAPS_PS30) != 0 ||
            forceOpt)
        {
            // we check for name to avoid loading classes unnecessarily if
            // a pipeline isn't enabled
            if (gcName.startsWith("D3D")) {
                return new VIOptD3DWindowPainter(peer);
            } else if (forceOpt && gcName.startsWith("WGL")) {
                // on some boards (namely, ATI, even on pcix bus) ogl is
                // very slow reading pixels back so for now it is disabled
                // unless forced
                return new VIOptWGLWindowPainter(peer);
            }
        }
    }
    return new BIWindowPainter(peer);
}
 
Example #8
Source File: TranslucentWindowPainter.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected Image getBackBuffer(boolean clear) {
    int w = window.getWidth();
    int h = window.getHeight();
    GraphicsConfiguration gc = peer.getGraphicsConfiguration();

    if (viBB == null || viBB.getWidth() != w || viBB.getHeight() != h ||
        viBB.validate(gc) == IMAGE_INCOMPATIBLE)
    {
        flush();

        if (gc instanceof AccelGraphicsConfig) {
            AccelGraphicsConfig agc = ((AccelGraphicsConfig)gc);
            viBB = agc.createCompatibleVolatileImage(w, h,
                                                     TRANSLUCENT,
                                                     RT_PLAIN);
        }
        if (viBB == null) {
            viBB = gc.createCompatibleVolatileImage(w, h, TRANSLUCENT);
        }
        viBB.validate(gc);
    }

    return clear ? clearImage(viBB) : viBB;
}
 
Example #9
Source File: TranslucentWindowPainter.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected Image getBackBuffer(boolean clear) {
    int w = window.getWidth();
    int h = window.getHeight();
    GraphicsConfiguration gc = peer.getGraphicsConfiguration();

    if (viBB == null || viBB.getWidth() != w || viBB.getHeight() != h ||
        viBB.validate(gc) == IMAGE_INCOMPATIBLE)
    {
        flush();

        if (gc instanceof AccelGraphicsConfig) {
            AccelGraphicsConfig agc = ((AccelGraphicsConfig)gc);
            viBB = agc.createCompatibleVolatileImage(w, h,
                                                     TRANSLUCENT,
                                                     RT_PLAIN);
        }
        if (viBB == null) {
            viBB = gc.createCompatibleVolatileImage(w, h, TRANSLUCENT);
        }
        viBB.validate(gc);
    }

    return clear ? clearImage(viBB) : viBB;
}
 
Example #10
Source File: TranslucentWindowPainter.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected Image getBackBuffer(boolean clear) {
    int w = window.getWidth();
    int h = window.getHeight();
    GraphicsConfiguration gc = peer.getGraphicsConfiguration();

    if (viBB == null || viBB.getWidth() != w || viBB.getHeight() != h ||
        viBB.validate(gc) == IMAGE_INCOMPATIBLE)
    {
        flush();

        if (gc instanceof AccelGraphicsConfig) {
            AccelGraphicsConfig agc = ((AccelGraphicsConfig)gc);
            viBB = agc.createCompatibleVolatileImage(w, h,
                                                     TRANSLUCENT,
                                                     RT_PLAIN);
        }
        if (viBB == null) {
            viBB = gc.createCompatibleVolatileImage(w, h, TRANSLUCENT);
        }
        viBB.validate(gc);
    }

    return clear ? clearImage(viBB) : viBB;
}
 
Example #11
Source File: TranslucentWindowPainter.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Creates an instance of the painter for particular peer.
 */
public static TranslucentWindowPainter createInstance(WWindowPeer peer) {
    GraphicsConfiguration gc = peer.getGraphicsConfiguration();
    if (!forceSW && gc instanceof AccelGraphicsConfig) {
        String gcName = gc.getClass().getSimpleName();
        AccelGraphicsConfig agc = (AccelGraphicsConfig)gc;
        // this is a heuristic to check that we have a pcix board
        // (those have higher transfer rate from gpu to cpu)
        if ((agc.getContextCapabilities().getCaps() & CAPS_PS30) != 0 ||
            forceOpt)
        {
            // we check for name to avoid loading classes unnecessarily if
            // a pipeline isn't enabled
            if (gcName.startsWith("D3D")) {
                return new VIOptD3DWindowPainter(peer);
            } else if (forceOpt && gcName.startsWith("WGL")) {
                // on some boards (namely, ATI, even on pcix bus) ogl is
                // very slow reading pixels back so for now it is disabled
                // unless forced
                return new VIOptWGLWindowPainter(peer);
            }
        }
    }
    return new BIWindowPainter(peer);
}
 
Example #12
Source File: RSLAPITest.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
private static void testContext(final AccelGraphicsConfig agc) {
    BufferedContext c = agc.getContext();
    final AccelDeviceEventListener l = new AccelDeviceEventListener() {
        public void onDeviceDispose() {
            System.out.println("onDeviceDispose invoked");
            agc.removeDeviceEventListener(this);
        }
        public void onDeviceReset() {
            System.out.println("onDeviceReset invoked");
        }
    };
    agc.addDeviceEventListener(l);

    RenderQueue rq = c.getRenderQueue();
    rq.lock();
    try {
        c.saveState();
        rq.flushNow();
        c.restoreState();
        rq.flushNow();
        System.out.println("Passed: Save/Restore");
    } finally {
        rq.unlock();
    }
}
 
Example #13
Source File: TranslucentWindowPainter.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Creates an instance of the painter for particular peer.
 */
public static TranslucentWindowPainter createInstance(WWindowPeer peer) {
    GraphicsConfiguration gc = peer.getGraphicsConfiguration();
    if (!forceSW && gc instanceof AccelGraphicsConfig) {
        String gcName = gc.getClass().getSimpleName();
        AccelGraphicsConfig agc = (AccelGraphicsConfig)gc;
        // this is a heuristic to check that we have a pcix board
        // (those have higher transfer rate from gpu to cpu)
        if ((agc.getContextCapabilities().getCaps() & CAPS_PS30) != 0 ||
            forceOpt)
        {
            // we check for name to avoid loading classes unnecessarily if
            // a pipeline isn't enabled
            if (gcName.startsWith("D3D")) {
                return new VIOptD3DWindowPainter(peer);
            } else if (forceOpt && gcName.startsWith("WGL")) {
                // on some boards (namely, ATI, even on pcix bus) ogl is
                // very slow reading pixels back so for now it is disabled
                // unless forced
                return new VIOptWGLWindowPainter(peer);
            }
        }
    }
    return new BIWindowPainter(peer);
}
 
Example #14
Source File: TranslucentWindowPainter.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected Image getBackBuffer(boolean clear) {
    int w = window.getWidth();
    int h = window.getHeight();
    GraphicsConfiguration gc = peer.getGraphicsConfiguration();

    if (viBB == null || viBB.getWidth() != w || viBB.getHeight() != h ||
        viBB.validate(gc) == IMAGE_INCOMPATIBLE)
    {
        flush();

        if (gc instanceof AccelGraphicsConfig) {
            AccelGraphicsConfig agc = ((AccelGraphicsConfig)gc);
            viBB = agc.createCompatibleVolatileImage(w, h,
                                                     TRANSLUCENT,
                                                     RT_PLAIN);
        }
        if (viBB == null) {
            viBB = gc.createCompatibleVolatileImage(w, h, TRANSLUCENT);
        }
        viBB.validate(gc);
    }

    return clear ? clearImage(viBB) : viBB;
}
 
Example #15
Source File: RSLAPITest.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
private static void testContext(final AccelGraphicsConfig agc) {
    BufferedContext c = agc.getContext();
    final AccelDeviceEventListener l = new AccelDeviceEventListener() {
        public void onDeviceDispose() {
            System.out.println("onDeviceDispose invoked");
            agc.removeDeviceEventListener(this);
        }
        public void onDeviceReset() {
            System.out.println("onDeviceReset invoked");
        }
    };
    agc.addDeviceEventListener(l);

    RenderQueue rq = c.getRenderQueue();
    rq.lock();
    try {
        c.saveState();
        rq.flushNow();
        c.restoreState();
        rq.flushNow();
        System.out.println("Passed: Save/Restore");
    } finally {
        rq.unlock();
    }
}
 
Example #16
Source File: TranslucentWindowPainter.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Creates an instance of the painter for particular peer.
 */
public static TranslucentWindowPainter createInstance(WWindowPeer peer) {
    GraphicsConfiguration gc = peer.getGraphicsConfiguration();
    if (!forceSW && gc instanceof AccelGraphicsConfig) {
        String gcName = gc.getClass().getSimpleName();
        AccelGraphicsConfig agc = (AccelGraphicsConfig)gc;
        // this is a heuristic to check that we have a pcix board
        // (those have higher transfer rate from gpu to cpu)
        if ((agc.getContextCapabilities().getCaps() & CAPS_PS30) != 0 ||
            forceOpt)
        {
            // we check for name to avoid loading classes unnecessarily if
            // a pipeline isn't enabled
            if (gcName.startsWith("D3D")) {
                return new VIOptD3DWindowPainter(peer);
            } else if (forceOpt && gcName.startsWith("WGL")) {
                // on some boards (namely, ATI, even on pcix bus) ogl is
                // very slow reading pixels back so for now it is disabled
                // unless forced
                return new VIOptWGLWindowPainter(peer);
            }
        }
    }
    return new BIWindowPainter(peer);
}
 
Example #17
Source File: RSLAPITest.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
private static void testContext(final AccelGraphicsConfig agc) {
    BufferedContext c = agc.getContext();
    final AccelDeviceEventListener l = new AccelDeviceEventListener() {
        public void onDeviceDispose() {
            System.out.println("onDeviceDispose invoked");
            agc.removeDeviceEventListener(this);
        }
        public void onDeviceReset() {
            System.out.println("onDeviceReset invoked");
        }
    };
    agc.addDeviceEventListener(l);

    RenderQueue rq = c.getRenderQueue();
    rq.lock();
    try {
        c.saveState();
        rq.flushNow();
        c.restoreState();
        rq.flushNow();
        System.out.println("Passed: Save/Restore");
    } finally {
        rq.unlock();
    }
}
 
Example #18
Source File: TranslucentWindowPainter.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Creates an instance of the painter for particular peer.
 */
public static TranslucentWindowPainter createInstance(WWindowPeer peer) {
    GraphicsConfiguration gc = peer.getGraphicsConfiguration();
    if (!forceSW && gc instanceof AccelGraphicsConfig) {
        String gcName = gc.getClass().getSimpleName();
        AccelGraphicsConfig agc = (AccelGraphicsConfig)gc;
        // this is a heuristic to check that we have a pcix board
        // (those have higher transfer rate from gpu to cpu)
        if ((agc.getContextCapabilities().getCaps() & CAPS_PS30) != 0 ||
            forceOpt)
        {
            // we check for name to avoid loading classes unnecessarily if
            // a pipeline isn't enabled
            if (gcName.startsWith("D3D")) {
                return new VIOptD3DWindowPainter(peer);
            } else if (forceOpt && gcName.startsWith("WGL")) {
                // on some boards (namely, ATI, even on pcix bus) ogl is
                // very slow reading pixels back so for now it is disabled
                // unless forced
                return new VIOptWGLWindowPainter(peer);
            }
        }
    }
    return new BIWindowPainter(peer);
}
 
Example #19
Source File: TranslucentWindowPainter.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected Image getBackBuffer(boolean clear) {
    int w = window.getWidth();
    int h = window.getHeight();
    GraphicsConfiguration gc = peer.getGraphicsConfiguration();

    if (viBB == null || viBB.getWidth() != w || viBB.getHeight() != h ||
        viBB.validate(gc) == IMAGE_INCOMPATIBLE)
    {
        flush();

        if (gc instanceof AccelGraphicsConfig) {
            AccelGraphicsConfig agc = ((AccelGraphicsConfig)gc);
            viBB = agc.createCompatibleVolatileImage(w, h,
                                                     TRANSLUCENT,
                                                     RT_PLAIN);
        }
        if (viBB == null) {
            viBB = gc.createCompatibleVolatileImage(w, h, TRANSLUCENT);
        }
        viBB.validate(gc);
    }

    return clear ? clearImage(viBB) : viBB;
}
 
Example #20
Source File: RSLAPITest.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
private static void testContext(final AccelGraphicsConfig agc) {
    BufferedContext c = agc.getContext();
    final AccelDeviceEventListener l = new AccelDeviceEventListener() {
        public void onDeviceDispose() {
            System.out.println("onDeviceDispose invoked");
            agc.removeDeviceEventListener(this);
        }
        public void onDeviceReset() {
            System.out.println("onDeviceReset invoked");
        }
    };
    agc.addDeviceEventListener(l);

    RenderQueue rq = c.getRenderQueue();
    rq.lock();
    try {
        c.saveState();
        rq.flushNow();
        c.restoreState();
        rq.flushNow();
        System.out.println("Passed: Save/Restore");
    } finally {
        rq.unlock();
    }
}
 
Example #21
Source File: TranslucentWindowPainter.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Creates an instance of the painter for particular peer.
 */
public static TranslucentWindowPainter createInstance(WWindowPeer peer) {
    GraphicsConfiguration gc = peer.getGraphicsConfiguration();
    if (!forceSW && gc instanceof AccelGraphicsConfig) {
        String gcName = gc.getClass().getSimpleName();
        AccelGraphicsConfig agc = (AccelGraphicsConfig)gc;
        // this is a heuristic to check that we have a pcix board
        // (those have higher transfer rate from gpu to cpu)
        if ((agc.getContextCapabilities().getCaps() & CAPS_PS30) != 0 ||
            forceOpt)
        {
            // we check for name to avoid loading classes unnecessarily if
            // a pipeline isn't enabled
            if (gcName.startsWith("D3D")) {
                return new VIOptD3DWindowPainter(peer);
            } else if (forceOpt && gcName.startsWith("WGL")) {
                // on some boards (namely, ATI, even on pcix bus) ogl is
                // very slow reading pixels back so for now it is disabled
                // unless forced
                return new VIOptWGLWindowPainter(peer);
            }
        }
    }
    return new BIWindowPainter(peer);
}
 
Example #22
Source File: RSLAPITest.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
private static void testContext(final AccelGraphicsConfig agc) {
    BufferedContext c = agc.getContext();
    final AccelDeviceEventListener l = new AccelDeviceEventListener() {
        public void onDeviceDispose() {
            System.out.println("onDeviceDispose invoked");
            agc.removeDeviceEventListener(this);
        }
        public void onDeviceReset() {
            System.out.println("onDeviceReset invoked");
        }
    };
    agc.addDeviceEventListener(l);

    RenderQueue rq = c.getRenderQueue();
    rq.lock();
    try {
        c.saveState();
        rq.flushNow();
        c.restoreState();
        rq.flushNow();
        System.out.println("Passed: Save/Restore");
    } finally {
        rq.unlock();
    }
}
 
Example #23
Source File: TranslucentWindowPainter.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected Image getBackBuffer(boolean clear) {
    int w = window.getWidth();
    int h = window.getHeight();
    GraphicsConfiguration gc = peer.getGraphicsConfiguration();

    if (viBB == null || viBB.getWidth() != w || viBB.getHeight() != h ||
        viBB.validate(gc) == IMAGE_INCOMPATIBLE)
    {
        flush();

        if (gc instanceof AccelGraphicsConfig) {
            AccelGraphicsConfig agc = ((AccelGraphicsConfig)gc);
            viBB = agc.createCompatibleVolatileImage(w, h,
                                                     TRANSLUCENT,
                                                     RT_PLAIN);
        }
        if (viBB == null) {
            viBB = gc.createCompatibleVolatileImage(w, h, TRANSLUCENT);
        }
        viBB.validate(gc);
    }

    return clear ? clearImage(viBB) : viBB;
}
 
Example #24
Source File: RSLAPITest.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
private static void testContext(final AccelGraphicsConfig agc) {
    BufferedContext c = agc.getContext();
    final AccelDeviceEventListener l = new AccelDeviceEventListener() {
        public void onDeviceDispose() {
            System.out.println("onDeviceDispose invoked");
            agc.removeDeviceEventListener(this);
        }
        public void onDeviceReset() {
            System.out.println("onDeviceReset invoked");
        }
    };
    agc.addDeviceEventListener(l);

    RenderQueue rq = c.getRenderQueue();
    rq.lock();
    try {
        c.saveState();
        rq.flushNow();
        c.restoreState();
        rq.flushNow();
        System.out.println("Passed: Save/Restore");
    } finally {
        rq.unlock();
    }
}
 
Example #25
Source File: TranslucentWindowPainter.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Creates an instance of the painter for particular peer.
 */
public static TranslucentWindowPainter createInstance(WWindowPeer peer) {
    GraphicsConfiguration gc = peer.getGraphicsConfiguration();
    if (!forceSW && gc instanceof AccelGraphicsConfig) {
        String gcName = gc.getClass().getSimpleName();
        AccelGraphicsConfig agc = (AccelGraphicsConfig)gc;
        // this is a heuristic to check that we have a pcix board
        // (those have higher transfer rate from gpu to cpu)
        if ((agc.getContextCapabilities().getCaps() & CAPS_PS30) != 0 ||
            forceOpt)
        {
            // we check for name to avoid loading classes unnecessarily if
            // a pipeline isn't enabled
            if (gcName.startsWith("D3D")) {
                return new VIOptD3DWindowPainter(peer);
            } else if (forceOpt && gcName.startsWith("WGL")) {
                // on some boards (namely, ATI, even on pcix bus) ogl is
                // very slow reading pixels back so for now it is disabled
                // unless forced
                return new VIOptWGLWindowPainter(peer);
            }
        }
    }
    return new BIWindowPainter(peer);
}
 
Example #26
Source File: TranslucentWindowPainter.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected Image getBackBuffer(boolean clear) {
    int w = window.getWidth();
    int h = window.getHeight();
    GraphicsConfiguration gc = peer.getGraphicsConfiguration();

    if (viBB == null || viBB.getWidth() != w || viBB.getHeight() != h ||
        viBB.validate(gc) == IMAGE_INCOMPATIBLE)
    {
        flush();

        if (gc instanceof AccelGraphicsConfig) {
            AccelGraphicsConfig agc = ((AccelGraphicsConfig)gc);
            viBB = agc.createCompatibleVolatileImage(w, h,
                                                     TRANSLUCENT,
                                                     RT_PLAIN);
        }
        if (viBB == null) {
            viBB = gc.createCompatibleVolatileImage(w, h, TRANSLUCENT);
        }
        viBB.validate(gc);
    }

    return clear ? clearImage(viBB) : viBB;
}
 
Example #27
Source File: RSLAPITest.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
private static void testContext(final AccelGraphicsConfig agc) {
    BufferedContext c = agc.getContext();
    final AccelDeviceEventListener l = new AccelDeviceEventListener() {
        public void onDeviceDispose() {
            System.out.println("onDeviceDispose invoked");
            agc.removeDeviceEventListener(this);
        }
        public void onDeviceReset() {
            System.out.println("onDeviceReset invoked");
        }
    };
    agc.addDeviceEventListener(l);

    RenderQueue rq = c.getRenderQueue();
    rq.lock();
    try {
        c.saveState();
        rq.flushNow();
        c.restoreState();
        rq.flushNow();
        System.out.println("Passed: Save/Restore");
    } finally {
        rq.unlock();
    }
}
 
Example #28
Source File: TranslucentWindowPainter.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Creates an instance of the painter for particular peer.
 */
public static TranslucentWindowPainter createInstance(WWindowPeer peer) {
    GraphicsConfiguration gc = peer.getGraphicsConfiguration();
    if (!forceSW && gc instanceof AccelGraphicsConfig) {
        String gcName = gc.getClass().getSimpleName();
        AccelGraphicsConfig agc = (AccelGraphicsConfig)gc;
        // this is a heuristic to check that we have a pcix board
        // (those have higher transfer rate from gpu to cpu)
        if ((agc.getContextCapabilities().getCaps() & CAPS_PS30) != 0 ||
            forceOpt)
        {
            // we check for name to avoid loading classes unnecessarily if
            // a pipeline isn't enabled
            if (gcName.startsWith("D3D")) {
                return new VIOptD3DWindowPainter(peer);
            } else if (forceOpt && gcName.startsWith("WGL")) {
                // on some boards (namely, ATI, even on pcix bus) ogl is
                // very slow reading pixels back so for now it is disabled
                // unless forced
                return new VIOptWGLWindowPainter(peer);
            }
        }
    }
    return new BIWindowPainter(peer);
}
 
Example #29
Source File: RSLAPITest.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
private static void testContext(final AccelGraphicsConfig agc) {
    BufferedContext c = agc.getContext();
    final AccelDeviceEventListener l = new AccelDeviceEventListener() {
        public void onDeviceDispose() {
            System.out.println("onDeviceDispose invoked");
            agc.removeDeviceEventListener(this);
        }
        public void onDeviceReset() {
            System.out.println("onDeviceReset invoked");
        }
    };
    agc.addDeviceEventListener(l);

    RenderQueue rq = c.getRenderQueue();
    rq.lock();
    try {
        c.saveState();
        rq.flushNow();
        c.restoreState();
        rq.flushNow();
        System.out.println("Passed: Save/Restore");
    } finally {
        rq.unlock();
    }
}
 
Example #30
Source File: TranslucentWindowPainter.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Creates an instance of the painter for particular peer.
 */
public static TranslucentWindowPainter createInstance(WWindowPeer peer) {
    GraphicsConfiguration gc = peer.getGraphicsConfiguration();
    if (!forceSW && gc instanceof AccelGraphicsConfig) {
        String gcName = gc.getClass().getSimpleName();
        AccelGraphicsConfig agc = (AccelGraphicsConfig)gc;
        // this is a heuristic to check that we have a pcix board
        // (those have higher transfer rate from gpu to cpu)
        if ((agc.getContextCapabilities().getCaps() & CAPS_PS30) != 0 ||
            forceOpt)
        {
            // we check for name to avoid loading classes unnecessarily if
            // a pipeline isn't enabled
            if (gcName.startsWith("D3D")) {
                return new VIOptD3DWindowPainter(peer);
            } else if (forceOpt && gcName.startsWith("WGL")) {
                // on some boards (namely, ATI, even on pcix bus) ogl is
                // very slow reading pixels back so for now it is disabled
                // unless forced
                return new VIOptWGLWindowPainter(peer);
            }
        }
    }
    return new BIWindowPainter(peer);
}