sun.java2d.windows.GDIWindowSurfaceData Java Examples

The following examples show how to use sun.java2d.windows.GDIWindowSurfaceData. 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: D3DVolatileSurfaceManager.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * If the destination surface's peer can potentially handle accelerated
 * on-screen rendering then it is likely that the condition which resulted
 * in VI to Screen operation is temporary, so this method sets the
 * restore countdown in hope that the on-screen accelerated rendering will
 * resume. In the meantime the backup surface of the VISM will be used.
 *
 * The countdown is needed because otherwise we may never break out
 * of "do { vi.validate()..} while(vi.lost)" loop since validate() could
 * restore the source surface every time and it will get lost again on the
 * next copy attempt, and we would never get a chance to use the backup
 * surface. By using the countdown we allow the backup surface to be used
 * while the screen surface gets sorted out, or if it for some reason can
 * never be restored.
 *
 * If the destination surface's peer could never do accelerated onscreen
 * rendering then the acceleration for the SurfaceManager associated with
 * the source surface is disabled forever.
 */
static void handleVItoScreenOp(SurfaceData src, SurfaceData dst) {
    if (src instanceof D3DSurfaceData &&
        dst instanceof GDIWindowSurfaceData)
    {
        D3DSurfaceData d3dsd = (D3DSurfaceData)src;
        SurfaceManager mgr =
            SurfaceManager.getManager((Image)d3dsd.getDestination());
        if (mgr instanceof D3DVolatileSurfaceManager) {
            D3DVolatileSurfaceManager vsm = (D3DVolatileSurfaceManager)mgr;
            if (vsm != null) {
                d3dsd.setSurfaceLost(true);

                GDIWindowSurfaceData wsd = (GDIWindowSurfaceData)dst;
                WComponentPeer p = wsd.getPeer();
                if (D3DScreenUpdateManager.canUseD3DOnScreen(p,
                        (Win32GraphicsConfig)p.getGraphicsConfiguration(),
                        p.getBackBuffersNum()))
                {
                    // 10 is only chosen to be greater than the number of
                    // times a sane person would call validate() inside
                    // a validation loop, and to reduce thrashing between
                    // accelerated and backup surfaces
                    vsm.setRestoreCountdown(10);
                } else {
                    vsm.setAccelerationEnabled(false);
                }
            }
        }
    }
}
 
Example #2
Source File: D3DVolatileSurfaceManager.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * If the destination surface's peer can potentially handle accelerated
 * on-screen rendering then it is likely that the condition which resulted
 * in VI to Screen operation is temporary, so this method sets the
 * restore countdown in hope that the on-screen accelerated rendering will
 * resume. In the meantime the backup surface of the VISM will be used.
 *
 * The countdown is needed because otherwise we may never break out
 * of "do { vi.validate()..} while(vi.lost)" loop since validate() could
 * restore the source surface every time and it will get lost again on the
 * next copy attempt, and we would never get a chance to use the backup
 * surface. By using the countdown we allow the backup surface to be used
 * while the screen surface gets sorted out, or if it for some reason can
 * never be restored.
 *
 * If the destination surface's peer could never do accelerated onscreen
 * rendering then the acceleration for the SurfaceManager associated with
 * the source surface is disabled forever.
 */
static void handleVItoScreenOp(SurfaceData src, SurfaceData dst) {
    if (src instanceof D3DSurfaceData &&
        dst instanceof GDIWindowSurfaceData)
    {
        D3DSurfaceData d3dsd = (D3DSurfaceData)src;
        SurfaceManager mgr =
            SurfaceManager.getManager((Image)d3dsd.getDestination());
        if (mgr instanceof D3DVolatileSurfaceManager) {
            D3DVolatileSurfaceManager vsm = (D3DVolatileSurfaceManager)mgr;
            if (vsm != null) {
                d3dsd.setSurfaceLost(true);

                GDIWindowSurfaceData wsd = (GDIWindowSurfaceData)dst;
                WComponentPeer p = wsd.getPeer();
                if (D3DScreenUpdateManager.canUseD3DOnScreen(p,
                        (Win32GraphicsConfig)p.getGraphicsConfiguration(),
                        p.getBackBuffersNum()))
                {
                    // 10 is only chosen to be greater than the number of
                    // times a sane person would call validate() inside
                    // a validation loop, and to reduce thrashing between
                    // accelerated and backup surfaces
                    vsm.setRestoreCountdown(10);
                } else {
                    vsm.setAccelerationEnabled(false);
                }
            }
        }
    }
}
 
Example #3
Source File: D3DScreenUpdateManager.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Remove the gdi surface corresponding to the passed d3dw surface
 * from list of the cached gdi surfaces.
 *
 * @param d3dw surface for which associated gdi surface is to be removed
 */
private void removeGdiSurface(final D3DWindowSurfaceData d3dw) {
    if (gdiSurfaces != null) {
        GDIWindowSurfaceData gdisd = gdiSurfaces.get(d3dw);
        if (gdisd != null) {
            gdisd.invalidate();
            gdiSurfaces.remove(d3dw);
        }
    }
}
 
Example #4
Source File: WGLGraphicsConfig.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a new SurfaceData that will be associated with the given
 * WComponentPeer.
 */
@Override
public SurfaceData createSurfaceData(WComponentPeer peer,
                                     int numBackBuffers)
{
    SurfaceData sd = WGLSurfaceData.createData(peer);
    if (sd == null) {
        sd = GDIWindowSurfaceData.createData(peer);
    }
    return sd;
}
 
Example #5
Source File: D3DScreenUpdateManager.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates (or returns a cached one) gdi surface for the same peer as
 * the passed d3dw surface has.
 *
 * @param d3dw surface used as key into the cache
 * @return gdi window surface associated with the d3d window surfaces' peer
 */
private synchronized SurfaceData getGdiSurface(D3DWindowSurfaceData d3dw) {
    if (gdiSurfaces == null) {
        gdiSurfaces =
            new HashMap<D3DWindowSurfaceData, GDIWindowSurfaceData>();
    }
    GDIWindowSurfaceData gdisd = gdiSurfaces.get(d3dw);
    if (gdisd == null) {
        gdisd = GDIWindowSurfaceData.createData(d3dw.getPeer());
        gdiSurfaces.put(d3dw, gdisd);
    }
    return gdisd;
}
 
Example #6
Source File: D3DScreenUpdateManager.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates (or returns a cached one) gdi surface for the same peer as
 * the passed d3dw surface has.
 *
 * @param d3dw surface used as key into the cache
 * @return gdi window surface associated with the d3d window surfaces' peer
 */
private synchronized SurfaceData getGdiSurface(D3DWindowSurfaceData d3dw) {
    if (gdiSurfaces == null) {
        gdiSurfaces =
            new HashMap<D3DWindowSurfaceData, GDIWindowSurfaceData>();
    }
    GDIWindowSurfaceData gdisd = gdiSurfaces.get(d3dw);
    if (gdisd == null) {
        gdisd = GDIWindowSurfaceData.createData(d3dw.getPeer());
        gdiSurfaces.put(d3dw, gdisd);
    }
    return gdisd;
}
 
Example #7
Source File: WGLGraphicsConfig.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a new SurfaceData that will be associated with the given
 * WComponentPeer.
 */
@Override
public SurfaceData createSurfaceData(WComponentPeer peer,
                                     int numBackBuffers)
{
    SurfaceData sd = WGLSurfaceData.createData(peer);
    if (sd == null) {
        sd = GDIWindowSurfaceData.createData(peer);
    }
    return sd;
}
 
Example #8
Source File: D3DScreenUpdateManager.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Remove the gdi surface corresponding to the passed d3dw surface
 * from list of the cached gdi surfaces.
 *
 * @param d3dw surface for which associated gdi surface is to be removed
 */
private void removeGdiSurface(final D3DWindowSurfaceData d3dw) {
    if (gdiSurfaces != null) {
        GDIWindowSurfaceData gdisd = gdiSurfaces.get(d3dw);
        if (gdisd != null) {
            gdisd.invalidate();
            gdiSurfaces.remove(d3dw);
        }
    }
}
 
Example #9
Source File: D3DScreenUpdateManager.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates (or returns a cached one) gdi surface for the same peer as
 * the passed d3dw surface has.
 *
 * @param d3dw surface used as key into the cache
 * @return gdi window surface associated with the d3d window surfaces' peer
 */
private synchronized SurfaceData getGdiSurface(D3DWindowSurfaceData d3dw) {
    if (gdiSurfaces == null) {
        gdiSurfaces =
            new HashMap<D3DWindowSurfaceData, GDIWindowSurfaceData>();
    }
    GDIWindowSurfaceData gdisd = gdiSurfaces.get(d3dw);
    if (gdisd == null) {
        gdisd = GDIWindowSurfaceData.createData(d3dw.getPeer());
        gdiSurfaces.put(d3dw, gdisd);
    }
    return gdisd;
}
 
Example #10
Source File: D3DScreenUpdateManager.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Remove the gdi surface corresponding to the passed d3dw surface
 * from list of the cached gdi surfaces.
 *
 * @param d3dw surface for which associated gdi surface is to be removed
 */
private void removeGdiSurface(final D3DWindowSurfaceData d3dw) {
    if (gdiSurfaces != null) {
        GDIWindowSurfaceData gdisd = gdiSurfaces.get(d3dw);
        if (gdisd != null) {
            gdisd.invalidate();
            gdiSurfaces.remove(d3dw);
        }
    }
}
 
Example #11
Source File: D3DVolatileSurfaceManager.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * If the destination surface's peer can potentially handle accelerated
 * on-screen rendering then it is likely that the condition which resulted
 * in VI to Screen operation is temporary, so this method sets the
 * restore countdown in hope that the on-screen accelerated rendering will
 * resume. In the meantime the backup surface of the VISM will be used.
 *
 * The countdown is needed because otherwise we may never break out
 * of "do { vi.validate()..} while(vi.lost)" loop since validate() could
 * restore the source surface every time and it will get lost again on the
 * next copy attempt, and we would never get a chance to use the backup
 * surface. By using the countdown we allow the backup surface to be used
 * while the screen surface gets sorted out, or if it for some reason can
 * never be restored.
 *
 * If the destination surface's peer could never do accelerated onscreen
 * rendering then the acceleration for the SurfaceManager associated with
 * the source surface is disabled forever.
 */
static void handleVItoScreenOp(SurfaceData src, SurfaceData dst) {
    if (src instanceof D3DSurfaceData &&
        dst instanceof GDIWindowSurfaceData)
    {
        D3DSurfaceData d3dsd = (D3DSurfaceData)src;
        SurfaceManager mgr =
            SurfaceManager.getManager((Image)d3dsd.getDestination());
        if (mgr instanceof D3DVolatileSurfaceManager) {
            D3DVolatileSurfaceManager vsm = (D3DVolatileSurfaceManager)mgr;
            if (vsm != null) {
                d3dsd.setSurfaceLost(true);

                GDIWindowSurfaceData wsd = (GDIWindowSurfaceData)dst;
                WComponentPeer p = wsd.getPeer();
                if (D3DScreenUpdateManager.canUseD3DOnScreen(p,
                        (Win32GraphicsConfig)p.getGraphicsConfiguration(),
                        p.getBackBuffersNum()))
                {
                    // 10 is only chosen to be greater than the number of
                    // times a sane person would call validate() inside
                    // a validation loop, and to reduce thrashing between
                    // accelerated and backup surfaces
                    vsm.setRestoreCountdown(10);
                } else {
                    vsm.setAccelerationEnabled(false);
                }
            }
        }
    }
}
 
Example #12
Source File: D3DVolatileSurfaceManager.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * If the destination surface's peer can potentially handle accelerated
 * on-screen rendering then it is likely that the condition which resulted
 * in VI to Screen operation is temporary, so this method sets the
 * restore countdown in hope that the on-screen accelerated rendering will
 * resume. In the meantime the backup surface of the VISM will be used.
 *
 * The countdown is needed because otherwise we may never break out
 * of "do { vi.validate()..} while(vi.lost)" loop since validate() could
 * restore the source surface every time and it will get lost again on the
 * next copy attempt, and we would never get a chance to use the backup
 * surface. By using the countdown we allow the backup surface to be used
 * while the screen surface gets sorted out, or if it for some reason can
 * never be restored.
 *
 * If the destination surface's peer could never do accelerated onscreen
 * rendering then the acceleration for the SurfaceManager associated with
 * the source surface is disabled forever.
 */
static void handleVItoScreenOp(SurfaceData src, SurfaceData dst) {
    if (src instanceof D3DSurfaceData &&
        dst instanceof GDIWindowSurfaceData)
    {
        D3DSurfaceData d3dsd = (D3DSurfaceData)src;
        SurfaceManager mgr =
            SurfaceManager.getManager((Image)d3dsd.getDestination());
        if (mgr instanceof D3DVolatileSurfaceManager) {
            D3DVolatileSurfaceManager vsm = (D3DVolatileSurfaceManager)mgr;
            if (vsm != null) {
                d3dsd.setSurfaceLost(true);

                GDIWindowSurfaceData wsd = (GDIWindowSurfaceData)dst;
                WComponentPeer p = wsd.getPeer();
                if (D3DScreenUpdateManager.canUseD3DOnScreen(p,
                        (Win32GraphicsConfig)p.getGraphicsConfiguration(),
                        p.getBackBuffersNum()))
                {
                    // 10 is only chosen to be greater than the number of
                    // times a sane person would call validate() inside
                    // a validation loop, and to reduce thrashing between
                    // accelerated and backup surfaces
                    vsm.setRestoreCountdown(10);
                } else {
                    vsm.setAccelerationEnabled(false);
                }
            }
        }
    }
}
 
Example #13
Source File: WGLGraphicsConfig.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a new SurfaceData that will be associated with the given
 * WComponentPeer.
 */
@Override
public SurfaceData createSurfaceData(WComponentPeer peer,
                                     int numBackBuffers)
{
    SurfaceData sd = WGLSurfaceData.createData(peer);
    if (sd == null) {
        sd = GDIWindowSurfaceData.createData(peer);
    }
    return sd;
}
 
Example #14
Source File: D3DScreenUpdateManager.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates (or returns a cached one) gdi surface for the same peer as
 * the passed d3dw surface has.
 *
 * @param d3dw surface used as key into the cache
 * @return gdi window surface associated with the d3d window surfaces' peer
 */
private synchronized SurfaceData getGdiSurface(D3DWindowSurfaceData d3dw) {
    if (gdiSurfaces == null) {
        gdiSurfaces =
            new HashMap<D3DWindowSurfaceData, GDIWindowSurfaceData>();
    }
    GDIWindowSurfaceData gdisd = gdiSurfaces.get(d3dw);
    if (gdisd == null) {
        gdisd = GDIWindowSurfaceData.createData(d3dw.getPeer());
        gdiSurfaces.put(d3dw, gdisd);
    }
    return gdisd;
}
 
Example #15
Source File: WGLGraphicsConfig.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a new SurfaceData that will be associated with the given
 * WComponentPeer.
 */
@Override
public SurfaceData createSurfaceData(WComponentPeer peer,
                                     int numBackBuffers)
{
    SurfaceData sd = WGLSurfaceData.createData(peer);
    if (sd == null) {
        sd = GDIWindowSurfaceData.createData(peer);
    }
    return sd;
}
 
Example #16
Source File: D3DScreenUpdateManager.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Remove the gdi surface corresponding to the passed d3dw surface
 * from list of the cached gdi surfaces.
 *
 * @param d3dw surface for which associated gdi surface is to be removed
 */
private void removeGdiSurface(final D3DWindowSurfaceData d3dw) {
    if (gdiSurfaces != null) {
        GDIWindowSurfaceData gdisd = gdiSurfaces.get(d3dw);
        if (gdisd != null) {
            gdisd.invalidate();
            gdiSurfaces.remove(d3dw);
        }
    }
}
 
Example #17
Source File: WGLGraphicsConfig.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a new SurfaceData that will be associated with the given
 * WComponentPeer.
 */
@Override
public SurfaceData createSurfaceData(WComponentPeer peer,
                                     int numBackBuffers)
{
    SurfaceData sd = WGLSurfaceData.createData(peer);
    if (sd == null) {
        sd = GDIWindowSurfaceData.createData(peer);
    }
    return sd;
}
 
Example #18
Source File: D3DScreenUpdateManager.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates (or returns a cached one) gdi surface for the same peer as
 * the passed d3dw surface has.
 *
 * @param d3dw surface used as key into the cache
 * @return gdi window surface associated with the d3d window surfaces' peer
 */
private synchronized SurfaceData getGdiSurface(D3DWindowSurfaceData d3dw) {
    if (gdiSurfaces == null) {
        gdiSurfaces =
            new HashMap<D3DWindowSurfaceData, GDIWindowSurfaceData>();
    }
    GDIWindowSurfaceData gdisd = gdiSurfaces.get(d3dw);
    if (gdisd == null) {
        gdisd = GDIWindowSurfaceData.createData(d3dw.getPeer());
        gdiSurfaces.put(d3dw, gdisd);
    }
    return gdisd;
}
 
Example #19
Source File: D3DScreenUpdateManager.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates (or returns a cached one) gdi surface for the same peer as
 * the passed d3dw surface has.
 *
 * @param d3dw surface used as key into the cache
 * @return gdi window surface associated with the d3d window surfaces' peer
 */
private synchronized SurfaceData getGdiSurface(D3DWindowSurfaceData d3dw) {
    if (gdiSurfaces == null) {
        gdiSurfaces =
            new HashMap<D3DWindowSurfaceData, GDIWindowSurfaceData>();
    }
    GDIWindowSurfaceData gdisd = gdiSurfaces.get(d3dw);
    if (gdisd == null) {
        gdisd = GDIWindowSurfaceData.createData(d3dw.getPeer());
        gdiSurfaces.put(d3dw, gdisd);
    }
    return gdisd;
}
 
Example #20
Source File: D3DVolatileSurfaceManager.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * If the destination surface's peer can potentially handle accelerated
 * on-screen rendering then it is likely that the condition which resulted
 * in VI to Screen operation is temporary, so this method sets the
 * restore countdown in hope that the on-screen accelerated rendering will
 * resume. In the meantime the backup surface of the VISM will be used.
 *
 * The countdown is needed because otherwise we may never break out
 * of "do { vi.validate()..} while(vi.lost)" loop since validate() could
 * restore the source surface every time and it will get lost again on the
 * next copy attempt, and we would never get a chance to use the backup
 * surface. By using the countdown we allow the backup surface to be used
 * while the screen surface gets sorted out, or if it for some reason can
 * never be restored.
 *
 * If the destination surface's peer could never do accelerated onscreen
 * rendering then the acceleration for the SurfaceManager associated with
 * the source surface is disabled forever.
 */
static void handleVItoScreenOp(SurfaceData src, SurfaceData dst) {
    if (src instanceof D3DSurfaceData &&
        dst instanceof GDIWindowSurfaceData)
    {
        D3DSurfaceData d3dsd = (D3DSurfaceData)src;
        SurfaceManager mgr =
            SurfaceManager.getManager((Image)d3dsd.getDestination());
        if (mgr instanceof D3DVolatileSurfaceManager) {
            D3DVolatileSurfaceManager vsm = (D3DVolatileSurfaceManager)mgr;
            if (vsm != null) {
                d3dsd.setSurfaceLost(true);

                GDIWindowSurfaceData wsd = (GDIWindowSurfaceData)dst;
                WComponentPeer p = wsd.getPeer();
                if (D3DScreenUpdateManager.canUseD3DOnScreen(p,
                        (Win32GraphicsConfig)p.getGraphicsConfiguration(),
                        p.getBackBuffersNum()))
                {
                    // 10 is only chosen to be greater than the number of
                    // times a sane person would call validate() inside
                    // a validation loop, and to reduce thrashing between
                    // accelerated and backup surfaces
                    vsm.setRestoreCountdown(10);
                } else {
                    vsm.setAccelerationEnabled(false);
                }
            }
        }
    }
}
 
Example #21
Source File: D3DScreenUpdateManager.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates (or returns a cached one) gdi surface for the same peer as
 * the passed d3dw surface has.
 *
 * @param d3dw surface used as key into the cache
 * @return gdi window surface associated with the d3d window surfaces' peer
 */
private synchronized SurfaceData getGdiSurface(D3DWindowSurfaceData d3dw) {
    if (gdiSurfaces == null) {
        gdiSurfaces =
            new HashMap<D3DWindowSurfaceData, GDIWindowSurfaceData>();
    }
    GDIWindowSurfaceData gdisd = gdiSurfaces.get(d3dw);
    if (gdisd == null) {
        gdisd = GDIWindowSurfaceData.createData(d3dw.getPeer());
        gdiSurfaces.put(d3dw, gdisd);
    }
    return gdisd;
}
 
Example #22
Source File: D3DVolatileSurfaceManager.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * If the destination surface's peer can potentially handle accelerated
 * on-screen rendering then it is likely that the condition which resulted
 * in VI to Screen operation is temporary, so this method sets the
 * restore countdown in hope that the on-screen accelerated rendering will
 * resume. In the meantime the backup surface of the VISM will be used.
 *
 * The countdown is needed because otherwise we may never break out
 * of "do { vi.validate()..} while(vi.lost)" loop since validate() could
 * restore the source surface every time and it will get lost again on the
 * next copy attempt, and we would never get a chance to use the backup
 * surface. By using the countdown we allow the backup surface to be used
 * while the screen surface gets sorted out, or if it for some reason can
 * never be restored.
 *
 * If the destination surface's peer could never do accelerated onscreen
 * rendering then the acceleration for the SurfaceManager associated with
 * the source surface is disabled forever.
 */
static void handleVItoScreenOp(SurfaceData src, SurfaceData dst) {
    if (src instanceof D3DSurfaceData &&
        dst instanceof GDIWindowSurfaceData)
    {
        D3DSurfaceData d3dsd = (D3DSurfaceData)src;
        SurfaceManager mgr =
            SurfaceManager.getManager((Image)d3dsd.getDestination());
        if (mgr instanceof D3DVolatileSurfaceManager) {
            D3DVolatileSurfaceManager vsm = (D3DVolatileSurfaceManager)mgr;
            if (vsm != null) {
                d3dsd.setSurfaceLost(true);

                GDIWindowSurfaceData wsd = (GDIWindowSurfaceData)dst;
                WComponentPeer p = wsd.getPeer();
                if (D3DScreenUpdateManager.canUseD3DOnScreen(p,
                        (Win32GraphicsConfig)p.getGraphicsConfiguration(),
                        p.getBackBuffersNum()))
                {
                    // 10 is only chosen to be greater than the number of
                    // times a sane person would call validate() inside
                    // a validation loop, and to reduce thrashing between
                    // accelerated and backup surfaces
                    vsm.setRestoreCountdown(10);
                } else {
                    vsm.setAccelerationEnabled(false);
                }
            }
        }
    }
}
 
Example #23
Source File: D3DVolatileSurfaceManager.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * If the destination surface's peer can potentially handle accelerated
 * on-screen rendering then it is likely that the condition which resulted
 * in VI to Screen operation is temporary, so this method sets the
 * restore countdown in hope that the on-screen accelerated rendering will
 * resume. In the meantime the backup surface of the VISM will be used.
 *
 * The countdown is needed because otherwise we may never break out
 * of "do { vi.validate()..} while(vi.lost)" loop since validate() could
 * restore the source surface every time and it will get lost again on the
 * next copy attempt, and we would never get a chance to use the backup
 * surface. By using the countdown we allow the backup surface to be used
 * while the screen surface gets sorted out, or if it for some reason can
 * never be restored.
 *
 * If the destination surface's peer could never do accelerated onscreen
 * rendering then the acceleration for the SurfaceManager associated with
 * the source surface is disabled forever.
 */
static void handleVItoScreenOp(SurfaceData src, SurfaceData dst) {
    if (src instanceof D3DSurfaceData &&
        dst instanceof GDIWindowSurfaceData)
    {
        D3DSurfaceData d3dsd = (D3DSurfaceData)src;
        SurfaceManager mgr =
            SurfaceManager.getManager((Image)d3dsd.getDestination());
        if (mgr instanceof D3DVolatileSurfaceManager) {
            D3DVolatileSurfaceManager vsm = (D3DVolatileSurfaceManager)mgr;
            if (vsm != null) {
                d3dsd.setSurfaceLost(true);

                GDIWindowSurfaceData wsd = (GDIWindowSurfaceData)dst;
                WComponentPeer p = wsd.getPeer();
                if (D3DScreenUpdateManager.canUseD3DOnScreen(p,
                        (Win32GraphicsConfig)p.getGraphicsConfiguration(),
                        p.getBackBuffersNum()))
                {
                    // 10 is only chosen to be greater than the number of
                    // times a sane person would call validate() inside
                    // a validation loop, and to reduce thrashing between
                    // accelerated and backup surfaces
                    vsm.setRestoreCountdown(10);
                } else {
                    vsm.setAccelerationEnabled(false);
                }
            }
        }
    }
}
 
Example #24
Source File: WGLGraphicsConfig.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a new SurfaceData that will be associated with the given
 * WComponentPeer.
 */
@Override
public SurfaceData createSurfaceData(WComponentPeer peer,
                                     int numBackBuffers)
{
    SurfaceData sd = WGLSurfaceData.createData(peer);
    if (sd == null) {
        sd = GDIWindowSurfaceData.createData(peer);
    }
    return sd;
}
 
Example #25
Source File: D3DScreenUpdateManager.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Remove the gdi surface corresponding to the passed d3dw surface
 * from list of the cached gdi surfaces.
 *
 * @param d3dw surface for which associated gdi surface is to be removed
 */
private void removeGdiSurface(final D3DWindowSurfaceData d3dw) {
    if (gdiSurfaces != null) {
        GDIWindowSurfaceData gdisd = gdiSurfaces.get(d3dw);
        if (gdisd != null) {
            gdisd.invalidate();
            gdiSurfaces.remove(d3dw);
        }
    }
}
 
Example #26
Source File: D3DScreenUpdateManager.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates (or returns a cached one) gdi surface for the same peer as
 * the passed d3dw surface has.
 *
 * @param d3dw surface used as key into the cache
 * @return gdi window surface associated with the d3d window surfaces' peer
 */
private synchronized SurfaceData getGdiSurface(D3DWindowSurfaceData d3dw) {
    if (gdiSurfaces == null) {
        gdiSurfaces =
            new HashMap<D3DWindowSurfaceData, GDIWindowSurfaceData>();
    }
    GDIWindowSurfaceData gdisd = gdiSurfaces.get(d3dw);
    if (gdisd == null) {
        gdisd = GDIWindowSurfaceData.createData(d3dw.getPeer());
        gdiSurfaces.put(d3dw, gdisd);
    }
    return gdisd;
}
 
Example #27
Source File: D3DVolatileSurfaceManager.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * If the destination surface's peer can potentially handle accelerated
 * on-screen rendering then it is likely that the condition which resulted
 * in VI to Screen operation is temporary, so this method sets the
 * restore countdown in hope that the on-screen accelerated rendering will
 * resume. In the meantime the backup surface of the VISM will be used.
 *
 * The countdown is needed because otherwise we may never break out
 * of "do { vi.validate()..} while(vi.lost)" loop since validate() could
 * restore the source surface every time and it will get lost again on the
 * next copy attempt, and we would never get a chance to use the backup
 * surface. By using the countdown we allow the backup surface to be used
 * while the screen surface gets sorted out, or if it for some reason can
 * never be restored.
 *
 * If the destination surface's peer could never do accelerated onscreen
 * rendering then the acceleration for the SurfaceManager associated with
 * the source surface is disabled forever.
 */
static void handleVItoScreenOp(SurfaceData src, SurfaceData dst) {
    if (src instanceof D3DSurfaceData &&
        dst instanceof GDIWindowSurfaceData)
    {
        D3DSurfaceData d3dsd = (D3DSurfaceData)src;
        SurfaceManager mgr =
            SurfaceManager.getManager((Image)d3dsd.getDestination());
        if (mgr instanceof D3DVolatileSurfaceManager) {
            D3DVolatileSurfaceManager vsm = (D3DVolatileSurfaceManager)mgr;
            if (vsm != null) {
                d3dsd.setSurfaceLost(true);

                GDIWindowSurfaceData wsd = (GDIWindowSurfaceData)dst;
                WComponentPeer p = wsd.getPeer();
                if (D3DScreenUpdateManager.canUseD3DOnScreen(p,
                        (Win32GraphicsConfig)p.getGraphicsConfiguration(),
                        p.getBackBuffersNum()))
                {
                    // 10 is only chosen to be greater than the number of
                    // times a sane person would call validate() inside
                    // a validation loop, and to reduce thrashing between
                    // accelerated and backup surfaces
                    vsm.setRestoreCountdown(10);
                } else {
                    vsm.setAccelerationEnabled(false);
                }
            }
        }
    }
}
 
Example #28
Source File: WGLGraphicsConfig.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a new SurfaceData that will be associated with the given
 * WComponentPeer.
 */
@Override
public SurfaceData createSurfaceData(WComponentPeer peer,
                                     int numBackBuffers)
{
    SurfaceData sd = WGLSurfaceData.createData(peer);
    if (sd == null) {
        sd = GDIWindowSurfaceData.createData(peer);
    }
    return sd;
}
 
Example #29
Source File: D3DScreenUpdateManager.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Remove the gdi surface corresponding to the passed d3dw surface
 * from list of the cached gdi surfaces.
 *
 * @param d3dw surface for which associated gdi surface is to be removed
 */
private void removeGdiSurface(final D3DWindowSurfaceData d3dw) {
    if (gdiSurfaces != null) {
        GDIWindowSurfaceData gdisd = gdiSurfaces.get(d3dw);
        if (gdisd != null) {
            gdisd.invalidate();
            gdiSurfaces.remove(d3dw);
        }
    }
}
 
Example #30
Source File: WGLGraphicsConfig.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a new SurfaceData that will be associated with the given
 * WComponentPeer.
 */
@Override
public SurfaceData createSurfaceData(WComponentPeer peer,
                                     int numBackBuffers)
{
    SurfaceData sd = WGLSurfaceData.createData(peer);
    if (sd == null) {
        sd = GDIWindowSurfaceData.createData(peer);
    }
    return sd;
}