Annoying display bug! Please help me, I'm about to give up :) (5 Viewers)

Vasilich

Portal Pro
August 30, 2009
3,394
1,170
Germany, Mayence
Home Country
Russian Federation Russian Federation
@Owlsroost
it should have smth to do with DPI scaling, as that strange resolution (above in logs) 1536x864 is actually 1920x1080 downscaled to exactly 20% (or you can get 1920 from 1536 by enlarging the latter to 25%). What function do we use to detect display resolution? maybe it is not DPI-aware? or its behaviour was changed in recent windows version?
 
Last edited:

Owlsroost

Retired Team Member
  • Premium Supporter
  • October 28, 2008
    5,540
    5,038
    Cambridge
    Home Country
    United Kingdom United Kingdom
    What function do we use to detect display resolution?

    No idea - I've never looked at the code. I know what dshowhelper uses, which is why I aksed for the evr logs earlier (so I could check if that is reporting the correct monitor size).

    I agree that the new DPI scaling changes in 8.1 are likely to be the problem here - reading some of the MS document, it looks like 8.1 is trying to get 'clever' about handling DPI scaling....
     

    mbuzina

    Retired Team Member
  • Premium Supporter
  • April 11, 2005
    2,839
    726
    Germany
    Home Country
    Germany Germany
    I think I found a temporary workaround (it is not nice as you need to "disable" all the DPI features).

    1. Go To Control Panel, Appearance & Personalization, Display
    2. Enable "Let me choose one scaling level for all my displays"
    3. Choose Radio Button "Smaller (100%)"
    4. Log Off/Log On

    Now MP should stay as big as it is. Unfortunately you will not get any scaling for your system anymore (so please Devs, make this App Multi-Monitor-DPI aware (which should not be too hard as MP by itself just always needs 100%)).
     

    Sebastiii

    Development Group
  • Team MediaPortal
  • November 12, 2007
    16,583
    10,403
    France
    Home Country
    France France
    I have try to quickly debug and set DPI to larger (Windows tell me that i'm @ 1920x1080) but MP and C# code tell :
    {Bounds = {X=1280,Y=0,Width=1280,Height=720} WorkingArea = {X=1280,Y=0,Width=1280,Height=720} Primary = false DeviceName = "\\\\.\\DISPLAY2"}
    -> 1280x720.

    I think this is the issue (if i understand correctly) if we can find a way to MP get screen correct resolution and not the DPI one, i think it will be good :)
     

    mbuzina

    Retired Team Member
  • Premium Supporter
  • April 11, 2005
    2,839
    726
    Germany
    Home Country
    Germany Germany
    Yes, that is the issue (It should not be tooo hard).

    The word document linked above shows the steps (Page 18)
    · SetProcessDpiAwareness (or DPI manifest entry) sets the process to a specified DPI awareness level, which then determines how Windows scales the UI. This supersedes SetProcessDPIAware. Note: you can also set the DPI awareness level in the application manifest.
    · GetProcessDpiAwareness returns the DPI awareness level. This supersedes IsProcessDPIAware.
    · GetDpiForMonitor returns the DPI for a monitor.
    · The WM_DPICHANGED window notification is sent to per-monitor DPI-aware applications when a window’s position changes such that most of its area intersects a monitor with a DPI that is different from the DPI before the position change. To create an application that resizes and re-renders itself when a user moves it to a different display, you use this notification.
    · Note: the WM_DPICHANGED notification is not sent when the user changes the desktop scaling value in Control Panel.

    So we should call SetProcessDpiAwareness(_Process_DPI_Awareness.Process_Per_Monitor_DPI_Aware) (http://msdn.microsoft.com/library/windows/desktop/dn302122.aspx) early before any Resolution checking is done and probably that should be it (we might listen to the message as well, but I guess since it has no impact on MP rendering...).
     

    Owlsroost

    Retired Team Member
  • Premium Supporter
  • October 28, 2008
    5,540
    5,038
    Cambridge
    Home Country
    United Kingdom United Kingdom
    Seb - you need to read the MS documentation that mbuzina linked to above - and this http://msdn.microsoft.com/en-us/library/windows/desktop/dd464646(v=vs.85).aspx and http://msdn.microsoft.com/en-us/library/windows/desktop/ee308410(v=vs.85).aspx (which may be the simplest way of saying 'don't mess with me' to the OS :) if I'm understanding it correctly. It's also the solution MS recomends - it suggests the 'DPI awareness' method calls are not the best way normally).

    I think we need to play by the MS 'rules' here, otherwise we'll be in trouble with this issue again at some point....
     
    Last edited:

    Sebastiii

    Development Group
  • Team MediaPortal
  • November 12, 2007
    16,583
    10,403
    France
    Home Country
    France France
    Good news :)
    It seems that i have something to try :) It detect the right Monitor value.

    I have add the change for MP and Configuration, now we need to someone to reproduce the issue :) (Because right now i can't with or without the patch).
    I can provide bin against master :)
     

    Users who are viewing this thread

    Top Bottom