Analysis: Winlator VirGL + WineD3D implementation deep-dive (no code changes)#2
Draft
Copilot wants to merge 1 commit into
Draft
Conversation
Copilot
AI
changed the title
[WIP] Analyze Winlator architecture and components
Analysis: Winlator VirGL + WineD3D implementation deep-dive (no code changes)
Mar 7, 2026
Catpotatos
pushed a commit
that referenced
this pull request
May 2, 2026
* Gesture overhaul Overhauls the touch gesture system with per-game configuration, richer gesture recognition, click-highlight feedback, a gesture-debug overlay, and a redesigned settings dialog. * Address reviewer feedback - ClickHighlightOverlay: snapshot iteration with stable key per HighlightPoint to prevent index-shift cancellation of in-flight fade animations. - XServerScreen: route 'Show Keyboard' gesture through the same external-display IME path as QuickMenuAction.KEYBOARD (was bypassing imeInputReceiver). - TouchpadView: gate ACTION_POINTER_UP / ACTION_UP cleanup so 4->3 finger transitions no longer tear down 3-finger gestures via two-finger cleanup; ACTION_UP now routes by previous gesture mode. - TouchpadView: add onDetachedFromWindow safety stop for gestureRefreshRunnable. - TouchpadView: fix stale 50ms comment to match TWO_FINGER_SETTLE_MS = 120. - TouchGestureConfig: extract ACTION_KEY_ESC constant and replace duplicated 'key_ESC' literals. - TouchGestureSettingsDialog: move hardcoded ActionCategory headers to string resources (gesture_header_*); add Close/Save contentDescriptions to topbar IconButtons. * Address second-round reviewer feedback - TouchGestureConfig.fromJson: default new gesture-enable flags (twoFingerHold/threeFingerTap/threeFingerHold) to false when missing from saved JSON, so existing per-game configs don't auto-enable gestures on upgrade. New containers still get the data-class true defaults. - TouchpadView.injectClick/injectRelease: short-circuit when an unknown 'key_*' action resolves to null XKeycode, so it no longer falls through to the BUTTON_LEFT default. - TouchpadView.handleTsCancel: also release the long-press injection when longPressTriggered is set. - TouchpadView.handleTsThreeFingerDown: release a fired two-finger hold injection when transitioning from 2 to 3 fingers (was leaving the held button/key down). - TouchpadView.handleTsTwoFingerMove / handleTsThreeFingerMove: bail out early when the corresponding hold has already fired so post-hold jitter cannot lock into pan/zoom. - TouchpadView.onDetachedFromWindow: full handleTsCancel-based cleanup (was only stopGestureRefresh) to release any held injections on view detach. - XServerScreen: drop the 500ms post-delay from the gesture Show Keyboard path (kept on QuickMenu menu path); gestures should respond immediately. - XServerScreen: re-key gestureOverlayConfig on the container's gesture JSON so toggling showClickHighlight/showGestureDebugOverlay mid-session is picked up on next recompose. * Address third-round reviewer feedback - TouchGestureConfig: add compatibilityDefaults() factory (new 2F/3F flags off) and use it for both blank/null and catch fallbacks in fromJson; resolves P2 re: inconsistent gesture enablement on partial/legacy configs (fromJson key-missing defaults were already false). - TouchpadView.handleTsPointerDown: when a second finger goes down, release a long-press that has already fired before cancelLongPressTimer()/cancelDrag(), so the held long-press button/key doesn't leak into the multi-finger gesture. - TouchpadView.handleTsCancel: flush a pending delayedPress callback and release its tap action synchronously; the tap DOWN was already injected by injectClick and its release is normally scheduled, so a cancel before the scheduled release would leave the tap button down. - TouchpadView handleTsMove drag-start: call performPanAction(0, 0, dragAction) immediately so short move+UP sequences still produce a press+release pair (previously the press happened only on the next MOVE frame with non-zero delta). * added russian to list of supported languages (unrelated to this PR) (#2) Co-authored-by: Utkarsh Dalal <utkarsh.dalal@toptal.com> * Fix typo in gesture_show_click_highlight_subtitle --------- Co-authored-by: Utkarsh Dalal <dalal.utkarsh@gmail.com> Co-authored-by: Utkarsh Dalal <utkarsh.dalal@toptal.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
User requested a read-only analysis of how Winlator implements VirGL + WineD3D on Mali GPUs, to serve as a reference for understanding and debugging GameNative's equivalent path. No repository changes were made.
Architecture
Both projects share the same core VirGL stack (GameNative is a Winlator fork):
Key Findings
Environment Variables (VirGL path — identical in both)
Where GameNative Diverges from Winlator
turnipvortekALWAYS_REEXTRACT = true).current_graphics_driverVortekRendererComponent(Vulkan)XServerDisplayActivity.javaXServerScreen.kt(Compose)Why VirGL Works on Mali
Mali lacks Vulkan drivers compatible with Turnip/Vortek. VirGL sidesteps this:
libvirglrenderer.soinitializes a GLES3 EGLContext (Mali supports GLES3 universally), shares it with the mainGLSurfaceViewcontext, and the guest-side Mesavirpipedriver serializes OpenGL calls over a Unix socket to this server. No Mali-specific GL driver involvement at the Mesa level.EGL Context Sharing (Critical Path)
VirGLRendererComponent.getSharedEGLContext()queues onto theGLSurfaceViewthread to capture the active EGL context pointer, then passes it to native as theshare_contextfor VirGL's own EGL context. This enables zero-copy framebuffer blit viaglCopyTexImage2Dback into the X11 drawable texture.Potential Debug Points
ALWAYS_REEXTRACT = true— silent extraction failures on every launch won't be cached awaygraphicsDriver == "virgl"— must start before Wine connectsContainer.GLIBCbranch ofextractGraphicsDriverFiles; Bionic containers skip it entirely💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.