Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion host/gl/glestranslator/egl/egl_os_api_wgl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1113,7 +1113,25 @@ class WglDisplay : public EglOS::Display {

WinSurface* winpb = WinSurface::from(pb);

if (!winpb->releaseDC()) return false;
if (!winpb->releaseDC()) {
// The surface is unused either way. Returning here would keep it in
// mLivePbufs for good: it is never reused or destroyed, and every
// later refill (sized from the live count) grows the pool, one
// driver pbuffer (a hidden window on NVIDIA) each. Reuse re-gets its
// DC in refreshDC(); a pbuffer that fails that goes to mDeletePbufs.
// Failures recur with surface churn (about 10 per UI test flow seen in
// the emulator): log the first 8, then at powers of two. sGlobalLock
// guards the counter.
const DWORD error = GetLastError();
static uint64_t sReleaseFailures = 0;
++sReleaseFailures;
if (sReleaseFailures <= 8 || (sReleaseFailures & (sReleaseFailures - 1)) == 0) {
GFXSTREAM_WARNING("wglReleasePbufferDC failed for pbuffer %p (error 0x%lx, %llu "
"failures so far)",
winpb->getPbuffer(), error,
(unsigned long long)sReleaseFailures);
}
}

const EglOS::PixelFormat* pixelFormat =
winpb->getPixelFormat();
Expand Down
Loading