Try to navigate into Local Group Policy Editor by running gpedit.msc. From there go to Computer Configuration\Windows Settings\Security Settings\Local Policies\User Rights Assignment and find the Increasing scheduling priority Policy. Make sure the Window Manager\Window Manager Groupvalue is present in it's Properties panel in the Local Security Setting tab. Also, add the user account you're experiencing the flickering display, whilst using Surface Pen, on to the list by clicking Add User or Group.
Details can be found in this Microsoft Docs article Increase scheduling priority (Windows 10) - Windows security | Microsoft Docs.
I hope this helps, feel free to let me/us know.