project-navigation
Personal tools

Author Topic: Display problems on high PPI screens  (Read 8219 times)

Offline Kaz

  • Rookie
  • ***
  • Posts: 54
    • View Profile
Display problems on high PPI screens
« on: April 05, 2009, 04:14:44 am »
An unfortunate accident with my laptop recently forced me to get a new display panel, and the new panel is very high resolution for the size (1680x1050 on 15.4"). Things looked so small that I did some research on the PPI configuration available for Windows Vista. As a result of this, I have configured the setting to the actual PPI setting ofmy new panel (129 PPI). This, combined with the PPI VIrtualization technology introduced in Vista has given a vey pleasant overall result. See http://blogs.msdn.com/kamvedbrat/archive/2006/12/02/dpi-scaling-in-windows-vista.aspx for more information.

Unfortunately, UFO:AI has an annoying problem with this. Since the game uses the pixel as it's basic unit, it is essentially a PPI aware application, so PPI virtualization should not mess with it. The catch: the executable is not marcked as PPI aware, so the OS virtualizes PPI. What this does is use the compositing engine to scale the windows as needed to the configured PPI configuration. Since this is usually done in hardware, perofmance is not affected much, but as a result even a 1024x768 window gets scaled larger than my entire screen when accounting for title bar and other decorations. My first workaround was to lower to mode 5 (960x720) which just fit in the physical screen. Unfortunately, between the downsampling to 960x720 and the upscaling from the virtualized PPI buffer the result was plain ugly.

Even worse was firing up the game in full screen mode. The upscaling remained in effect, blowing parts of the game display off screen and leaving me without a functional mouse cursor. I had to alt-tab out of the program and kill it from the OS.

Some more research, pointed me to an application compatibility property which allows you to disable the PPI virtualization for the app, without touching the rest of the system. To do this, you have to open the properties of the executable, go to the Compatibility tab and mark the "Disable display scaling on high DPI settings" checkbox. The game is again working as expected, in both windowed mode and full screen mode.

I will keep researching how to make this behaviour the default so the game works as expected out of the box in the future. Any new developments will be posted here.

Cheers!

Update: The definitive solution is to mark the application as "DPI aware" using a manifest. See the PDF document in the link above or http://www.rw-designer.com/DPI-aware for detailed information on this manifest. How to do this has already flown way over my head. Perhaps someone with more Windows development experience can add some information?
« Last Edit: April 05, 2009, 05:35:24 am by Kaz »

Offline bayo

  • Professional loser
  • Project Coder
  • Captain
  • ***
  • Posts: 733
    • View Profile
Re: Display problems on high PPI screens
« Reply #1 on: April 05, 2009, 02:07:55 pm »
Hello. I use Vista too and i test the game with 120 DPI (instead of 96 DPI), and every thing work fine with the game (2.3.dev); without manifest or any config of the .exe.

Do you use the development version? or the last release 2.2.x?

"Not DPI aware: This mode is the default one when resolution is set to more than 120 DPI" [http://www.rw-designer.com/DPI-aware]
Bigger than 120 DPI, Windows should not think an application is DPI aware. And UFO:AI is not DPI aware. Am i wrong?

Offline Kaz

  • Rookie
  • ***
  • Posts: 54
    • View Profile
Re: Display problems on high PPI screens
« Reply #2 on: April 05, 2009, 03:09:05 pm »
I also use 2.3 from svn. At DPI settings below 144 DPI Windows will not enable DPI virtualization by default. To get here you need to go into the "Custom DPI" dialog and clear the "Use Windows XP style DPI scaling" checkbox. If this checkbox is set, you will not get virtualized DPI and will not see this issue. Note that since this setting is new to Vista, Windows XP is not subject to it.

Cheers!

Edit: The 144 DPI threshold I mention is reported in some sources as 120 DPI. My personal experience is that going to 129 did not uncheck it automatically, so 144 seems more likely correct to me.
« Last Edit: April 05, 2009, 03:11:31 pm by Kaz »

Offline bayo

  • Professional loser
  • Project Coder
  • Captain
  • ***
  • Posts: 733
    • View Profile
Re: Display problems on high PPI screens
« Reply #3 on: April 05, 2009, 09:33:04 pm »
I just commit a manifest embeded into the resources of the binary file (r23893). But i realy dont know if it work or not. Can you update svn and rebuild the file. To test it, you should remove your last exe configuration. I dont know how you can do it.

If it dont work, you can copy-paste the file /build/projects/ufo.exe.manifest into the ufo.exe dir and test like that.

If it dont work...


Offline Kaz

  • Rookie
  • ***
  • Posts: 54
    • View Profile
Re: Display problems on high PPI screens
« Reply #4 on: April 06, 2009, 06:30:26 am »
First tests are working propperly. I will perform more extensive testing tomorrow and report.

Cheers!

odie

  • Guest
Re: Display problems on high PPI screens
« Reply #5 on: April 06, 2009, 07:08:08 am »
If it dont work, you can copy-paste the file /build/projects/ufo.exe.manifest into the ufo.exe dir and test like that.

If it dont work...

If that still does not work, remove all instances of your installation paths.

Goto your user profile, "C:\Documents and Settings\<USER>\Application Data\UfoAI" directory and backup your savefiles (you want), <USER> is your userprofile directory. Then delete the whole folder away.

Next, you might want to do a "regedit" and find all instances of UFOAI and delete them. But do make sure you have a backup of your registry in case..... DO NOT TRY THIS IF YOU ARE NOT PROFICIENT IN Registry Editing - You might conk off your whole computer!

Then do a restart (which i believe is not really necessary, but do it for amateur's sake), and reinstall.

Well, this will hopefully reset all your custom settings...... hmmmmph.
If it still does, sit down, pray and repeat steps.

Offline BTAxis

  • Administrator
  • PHALANX Commander
  • *******
  • Posts: 2607
    • View Profile
Re: Display problems on high PPI screens
« Reply #6 on: April 06, 2009, 10:20:09 am »
Regedit shouldn't be necessary, as UFO:AI doesn't use any info from there (unless I'm mistaken, but I don't think I am). The only instances you'll find is from the system, recently accessed files and the like. These shouldn't affect the program in any way.

odie

  • Guest
Re: Display problems on high PPI screens
« Reply #7 on: April 06, 2009, 11:29:06 am »
Regedit shouldn't be necessary, as UFO:AI doesn't use any info from there (unless I'm mistaken, but I don't think I am). The only instances you'll find is from the system, recently accessed files and the like. These shouldn't affect the program in any way.
Actually, there is 1 or 2 entries. But not critical - save paths and program paths and uninstaller paths.

Usually the uninstaller does a clean enough job. That is just in case. :D

Cheers!

Offline Kaz

  • Rookie
  • ***
  • Posts: 54
    • View Profile
Re: Display problems on high PPI screens
« Reply #8 on: April 07, 2009, 03:44:54 am »
Actually, there is 1 or 2 entries. But not critical - save paths and program paths and uninstaller paths.

Usually the uninstaller does a clean enough job. That is just in case. :D

Cheers!

In this case it could affect, since Windows itself saves the compatibility flags for specific executables in the registry.

On the testing front, I managed to run the game correctly in several different resolutions, both windowed and full screen successfully. This is after clearing the compatibility flag and using the new manifest. As far as I can tell, the issue is solved and closed.

Now if I only had linux running on the lappy...

Offline BTAxis

  • Administrator
  • PHALANX Commander
  • *******
  • Posts: 2607
    • View Profile
Re: Display problems on high PPI screens
« Reply #9 on: April 07, 2009, 03:59:59 am »
In this case it could affect, since Windows itself saves the compatibility flags for specific executables in the registry.

This is true, but you won't find this by searching for UFOAI. The executable is called ufo.exe.

odie

  • Guest
Re: Display problems on high PPI screens
« Reply #10 on: April 07, 2009, 04:07:51 am »
This is true, but you won't find this by searching for UFOAI. The executable is called ufo.exe.

Yupz yupz.

It might be a better idea to suggest to search for "ufo" instead of "ufoai".

I did a ufo search and was careful not to delete all instances, since i do have 2.2 version on the computer too. If u dun have, and do not have games like UFO afterlight and stuff (who happens to have ufo somewhere in the registry), go ahead and delete UFO instances. :)

Cheers!