docs/research/gaps/README.md

Gaps between the Windows baseline and Linux

On this page

Windows on the same device (its behaviour, settings and driver packages), the firmware and the ACPI tables are taken as the baseline, and linux-surface (7.3 patches, base v7.3.4) and iptsd are compared against it. Each document lists the differences in one area, how to close them, and what was measured on Linux; the table below orders the gaps by cost, and the last column is where each stands. Where a document gives a "confidence" of confirmed, the item was checked against both the Windows-side value and the Linux source.

The Linux side was measured on NixOS, booted with this repository's kernel (7.3.4 = v7.3.4 + linux-surface 7.3 + kernel/patches).1 The results are in each document's "On Linux" column and in its section on Linux checks. Measured means read from logs or numbers, observed means seen, heard or felt on the device, inferred means derived without running the cause or the effect, and unverified means not tested yet (not a failure). Checked by hand so far: the pen (writing in a drawing application, barrel button, eraser end, pairing, tail button, haptics, cover coupling), touch in everyday use, both cameras in a camera application and their privacy LEDs, screen rotation by turning the device, opening and closing the lid, flicker during use, the keyboard backlight, detaching and folding the cover, the buttons with the cover detached, plugging the charger, an external display on both USB-C ports and two screens over DP MST, counted light taps and swipes, palm rejection while the pen hovers, pen tilt held by hand, a Bluetooth mouse and earset, listening to the speakers through the filter, and speech during playback through the echo-cancelled source. The record per test ID is in docs/test-results.md.

Area Document
Pen and touch pen-touch.md
Cameras camera.md
SAM and platform sam-platform.md
Audio audio.md
Display, graphics and power display-power.md
Pen BLE trace (Windows ETW) pen-ble-trace.md
Pen: continuous haptics, cover-slot coupling, reconnection, the 16 B exchange at connection pen-vendor-exchange.md

The tests are defined in ../../test-plan.md; the unattended post-install check is tools/linux/post-install-check.sh. The pen user-space prototype is in userspace/pen/.

Order of closing the gaps#

Cheapest first, among those whose basis is confirmed.

Order Gap How to close it Kind Confidence On Linux 7.3.4
1 Front camera OV5693 does not work: Windows writes 0x4800=0x2d (MIPI control) and Linux does not Set bit 5 before starting the stream. linux-surface/kernel#180, backport of upstream media next 0e12587945f6 Kernel patch Confirmed Measured: 90/90 frames in the front 2592x1944 mode, 0x4800=0x20 while streaming. No comparison against a kernel without the patch was made. In the binned 1296x972 mode every frame is a Frame sync error as soon as either flip is on (measured, cause unverified). Patch 0020 does not offer that mode, so requests for 720p and below also go to the 2592x1944 mode and frames arrive (measured: 1280x720 120/120)
2 No rear autofocus: ipu-bridge does not know SSDB VCM type 0x11 (DW9800) Add 0x11 → dw9800k to ipu_vcm_types Kernel patch Mapping confirmed, compatibility inferred Measured: Instantiated dw9800k VCM, focus_absolute 0–1023 appears and the image changes over DAC 400–800. With patch 0021 an open lens node no longer keeps the rear sensor powered (sensor and VCM are suspended when idle). Without patch 0022 the lens device is missing on one boot in two; with it the device appeared on the first boot of that kernel (1/1). The patched libcamera (0007–0009) adds a contrast autofocus that moves the lens; it focuses (observed, once a protective film over the rear camera of the test unit was removed; camera.md section 6)
3 PSR2: Windows turns PSR2 off on this panel and turns PSR off entirely on AC i915.enable_psr=1, later quirk_disable_psr2 in intel_quirks.c Kernel parameter → patch Windows setting confirmed, cause of flicker inferred Measured: booted without the parameter, the quirk of patch 0014 alone gives PSR1 (tainted 0; passing the parameter taints the kernel). The parameter is not needed on this kernel. No flicker was noticed during use (observed). A 10-minute static-screen test and a test split by AC and battery are unverified
4 The minimum fan RPM survives a reboot from Windows (#1726) Send 0 to FAN command 0x0b at probe (control/power-thermal.md 1.4) Kernel patch Inferred (another person's trace) Measured: 0 RPM in all 12 idle samples, no warning from the patch in the log. 0x0b sets the speed of a fan that SAM has stopped (requests of 1500–7500 give 1588–7407 rpm, 0 stops the fan) and is ignored while SAM is driving the fan itself. 0x0c does nothing. Measured since (SAM-4): after a load under Windows and a reboot the fan ran at about 3000 rpm for the first minutes while warm and stopped at 38.8 °C, 0 rpm for the rest of the 6 minutes; no floor is left behind. Not compared with a kernel without the patch
5 iptsd has no SP9 (0x0C52) preset, and the default thresholds differ from the wiki values Preset conf (thresholds 24/20/5 and so on) Configuration Confirmed Measured: the preset is loaded and there are 0 ghost touches in 150 seconds without contact. With sp9-digitizerd at 24/20, exactly 10 light taps and 5 three-finger swipes are all caught; at the iptsd defaults 40/36, 1/10 and 0/5 (TOUCH-1)
6 No audio codec fixup (PCI 8086:7270, codec SSID 10ec:1284) Pin patch file with the pin configuration of the device (hda-jack-retask/patch=), then a quirk once the effect is confirmed Configuration → patch Pins measured, need inferred Measured: the BIOS pin values match the speaker, DMIC and no-jack layout Windows reports, so no pin patch is needed. The driver is legacy snd_hda_intel. The coefficients were not compared
7 No speaker protection processing (Windows runs software processing on the speakers; there is no smart amplifier) PipeWire filter-chain built from this device's measurements: high-pass 50 Hz, cut at the 3.7 kHz distortion peak, limiter User space Measured Measured: the filter chain comes up as the default sink; its digital transfer is −5.9 dB at 50 Hz and at 3.6–3.8 kHz, and around 3.7 kHz the recorded THD of each speaker roughly halves. 100 Hz–1 kHz is left unchanged. The raw sink behind the filter is raised to 100 % every time WirePlumber starts (left at WirePlumber's 40 % it holds the amplifier at −23.9 dB). Observed: no audible distortion at 25–100 % volume, left and right correct, and no large difference against the filter off (AUD-1, AUD-2)
8 The rtc-surface node is missing from the SP9 group Add the RTC node to ssam_node_group_sp9 Kernel patch Confirmed Measured: rtc1 (surface_rtc) appears and its time is within 1 second of system UTC. There is no alarm (wakealarm)
9 No driver for USB-C UCSI (SAM HID IID 7) Apply linux-surface/kernel#184 Kernel patch (external) Confirmed Measured: typec port0 and port1 and the partner (PD) appear. Without patch 0019 the port's own PDOs come out wrong because of a length byte that SAM puts in front of the response (confirmed from the raw bytes); with it they read correctly (port source 5 V 3 A, charger source 9/12/15 V 3 A). What remains: the partner list has no 5 V entry and voltage_now is 0
10 No automatic bonding and no connection keeping for Slim Pen 2 (#1656) The pen slot of the Type Cover: the cover's FFF4 reports + LE legacy OOB pairing (kernel patch 0023), with the host's identity key given to the pen; the device helper runs the procedure Kernel patch + user space Confirmed on the device Measured + observed: manual pairing works (2/2, battery 96 %). A SET of Features 86 and 112 on the digitizer leaves the values unchanged and Inputs 84 and 110 never arrive, and a pen bonded in pairing mode does not advertise again once it has disconnected by itself (50–80 s idle). Measured since, with patch 0023 loaded as a module: with the pen in the cover's pen slot, the cover procedure and LE legacy OOB pairing bond it within 1 s (LTK and IRK stored), and a pen bonded that way, having disconnected by itself after 50 s, reconnected 3.5 s after it was picked up. The exchange Windows performs on reconnection is a firmware update check and not the condition. The device helper runs the procedure (sp9-ctl pen couple, or automatically with sp9-ctl pen auto-couple on): it hands the key to the pen first and connects with the controller's address resolution off, and with that order pen couple bonded a pen without a bond at the first attempt 12/12 on a booted kernel built with 0023 (measured; the pen's HID attached without restarting bluetoothd). Patch 0024 replaces the controller's resolving-list entry when the pen's identity key changed, so a pen bonded again in the same boot reconnects (measured) (pen-vendor-exchange.md sections 2–4 and 2.10, helper.md)
11 120 Hz exists only in DisplayID, so every 60↔120 switch is a full modeset Check the VRR path (MSA ignore DPCD) Investigation Inferred Measured: vrr_capable=1, range 30–120 Hz, DPCD 0x007 bit 6. 10/10 switches with VRR on, each a full modeset with the screen dark for about 1.1 s (DSP-2). Seamless switching as on Windows is not reached
9b No power-limit or skin-temperature management (Windows SMF keeps adjusting the MCHBAR PLs and the fan rpm) RAPL/EPP profile hook + VTS1 skin daemon; an MCHBAR driver if there is no MMIO User space → kernel Path confirmed, effect on Linux inferred Measured: without the helper only low-power differs in power (6 W under the same load, 33 W for the other three), and under a 10-minute load the surface sensor (temp9) rises to 51 °C (Windows lowers PL1 at 47–48 °C). With the helper running, PL1/PL2/EPP are written per profile (35/60 W·64, 28/45·115, 28/35·153, 10/11·184). intel-rapl-mmio does not exist, so only the MSR side is written. A load comparison in that state and the skin-temperature protection are unverified. The surface_thermal hwmon has no VTS1 label, so the channel is picked by number (temp9)
12 Host thermal and power management (MSHW0188 thermal zones, SAPD MSHW0299, SMF PL adjustment), DPST, pen haptics Large work. To be decided from measurements on the installed system Driver/daemon Mostly inferred Measured: no ACPI thermal zone is created; the thermal zones are x86_pkg_temp and iwlwifi_1 only. Pen haptics: the click is felt; the continuous waveforms play once the host feeds the pen's speed back to the digitizer through Feature 9, which the device helper (or surface-pen-feedback) does (observed, pen-vendor-exchange.md section 1). Without that feedback they are not felt, or come weak and intermittent as Auto Trigger
13 iptsd's pen position, tilt, contact and pressure differ from what Windows reports (wobble on slow diagonals, broken light strokes, tilt 9–32° too large, position off by up to 0.94 mm at the edges) Patches to iptsd's pen processing, turned on by the preset (userspace/iptsd 0001–0017), and the same processing in sp9-digitizerd (digitizerd.md) User space Confirmed by replaying raw captures against the Windows output for the same captures Measured by replay: position within 0.04–0.05 mm and tilt within 2° in the median, 133 position reports a second instead of 67 (pen-touch.md section 5). Observed: writing in a drawing application, barrel button and eraser end work with both daemons. Tilt against real angles is unverified
14 Camera applications show purple lines, a wrong or swinging exposure and no rear focus control (libcamera 0.7.2 simple pipeline and software ISP; sensor gain ranges wider than the sensors follow) libcamera 0.8.0 with userspace/libcamera patches (option camera.libcamera), kernel patches 0025 and 0026 User space + kernel patch Confirmed (measured causes) Measured: no purple lines, the exposure settles within 5–23 frames (CAM-7). Observed: both cameras in a camera application without lines and with normal brightness (CAM-2). Rear focus unverified (item 2)
15 The orientation does not follow a device at rest: the sensor hub reports only after a change larger than its sensitivity, so iio-sensor-proxy reads (0, 0, 0) udev rule that writes the accelerometer's sensitivity as 0 (option sensors.enable) Configuration Confirmed Measured: 0 after boot, reports at 8.5 Hz, orientation within 0.7 s. Observed: the screen follows the device in a compositor that reads iio-sensor-proxy (SAM-7). The light sensor follows covering and uncovering (measured, DSP-4). The state after a suspend is unverified
16 No IR camera: no VD55G0 driver in mainline or linux-surface's patches ST's VD55G0 driver as adapted in linux-surface/kernel#164, an ipu-bridge SMO55F0 entry, the illuminator on sensor GPIO 1, and an IPU6 capture fix that ends the 8-bit and packed truncation (patches 0027–0031) Kernel patch (external + local) Confirmed on the device Measured: the sensor probes (model ID 0x4730) and is in the media graph on CSI-2 port 3; 8-bit and packed output truncated until patch 0030, intact with it; libcamera 90 frames with 0 CSI-2 errors. Observed: a dark room is visible under the illuminator (CAM-8; camera.md difference 8). Face sign-in is not provided

Submitting to external repositories (PRs) has low priority. The patches and settings are kept and used in this repository.

The kernel patches for orders 1, 2, 3, 4, 8 and 9 are in kernel/ (0001–0014 and, on top of them, 0019–0022; provenance in PROVENANCE.md); items 10 and 14 add 0023–0026, item 16 adds 0027–0031. The kernel built with Nix boots on this device with this repository's patches in it (most measurements were taken on kernels with 0001–0022; 0029 has so far been loaded as a module only). The on-device measurements per patch are in PROVENANCE.md. "The code is in" and "the function works" are different things: for whether a function works, read the last column of the table above and the individual documents.

Items 3, 5, 6 and 7 and the wiki workarounds (hpiosize, pinctrl_tigerlake) exist as files in userspace/platform/ (item 6 is opt-in). Item 6 has no use on this device: the pin values are already right and the path is legacy, not SOF (audio.md 2.1, G2). The I/O range that pci=hpiosize=0 was meant to keep clear is reserved by PCHRESV on 7.3.4 (measured). Booted without the parameter, the bridge I/O windows lie outside that range, and there are no GPE errors over s2idle and 4 lid close/open cycles (measured, display-power.md difference 7). i915.enable_psr=1 of item 3 is not needed on this repository's kernel either (table above). pci=hpiosize=0 is for use with a distribution kernel; for PSR the platform files there write FORCE_PSR1 to i915 debugfs instead (component psr), because the parameter taints the kernel (display-power.md difference 1).

Further camera results: an INT3472 _DSM clock-frequency patch (0015, 24 MHz for the IR camera). The IR camera (VD55G0) runs on ST's driver, not vd55g1 (item 16). For the OV5693 binned mode the link frequency was derived as 358.4 MHz, and there is no patch that fixes the mode: on the device it fails with a Frame sync error on every frame once a flip is on. Patch 0020 does not offer the mode, so applications that request 720p or below also receive frames from the front camera (camera.md section 3 item 2, section 4).

9b (RAPL/EPP profiles, the VTS1 skin-protection experiment), the keyboard backlight, touch while the screen is off, and pen haptics (part of item 12) are covered in user space by the device helper (docs/helper.md). With the helper running on the device, the per-profile power limits, the keyboard backlight and pen haptics (inking, speed feedback) are confirmed; skin protection and touch while the screen is off are unverified. Continuation of touchpad two-finger scrolling at the edge is handled by the compositor, not the helper: only the compositor knows the scroll-direction setting (control/typecover.md section 3).

Notes#

  1. Part of the measurements were taken unattended on a kernel with patches 0001–0017; load, suspend, lid, pen and helper were measured on a kernel that also carries 0018–0022. The pen's cover coupling and reconnection were measured with patches 0023 and 0024 (0023 first loaded into that kernel as a module, then on booted kernels built with them), the camera gain ranges with 0025 and 0026, and the IR camera on a kernel with 0001–0028 and 0029 loaded as a module. Where the patch range affects a result, the range is given. ↩

View this page's Markdown on GitHub