Weird GPU crash -- possible cause: resizing media (1 Viewer)

RoChess

Extension Developer
  • Premium Supporter
  • March 10, 2006
    4,434
    1,897
    I've been dealing with weird crashes. The display would go into a checkerboard, or mainly a giant purple banner across the screen. Audio would then play a few more seconds, and then eventually MediaPortal restarts and I can resume play and never experience the crash again, until the next time I power up the HTPC. Totally expected it to be hardware related all this time, and don't have time yet to test replacement parts, but because it is so consistent I've started to see better patterns that I need to investigate more.

    HTPC is outputting at 4K resolution with Windows OS set to 200% scaling (bringing that up, cuz it has lead to issues before such as splash-screen version label positioning, which @ajs has fixed now). The logs show a 3D crash, but there are weird entries right before when MediaPortal calculates the offsets, and resize X-coordinates are way off in a negative point and that is when crash happens.

    What I found out recently is that when I play just widescreen 4K files then it does not crash. Need way more tests to confirm, but it seems to be that way, which is why I'm creating this thread, to hopefully find others with the same issue that can help debug with a wider range of hardware.

    Checkerboard happens in a flash, so I never find the time to get camera in time, but Google image search allowed me to find one that looked close enough:

    5ab96c920c8ac_IMG20180317113346crahs.thumb.jpg.26086871b7b8fe77fc777700058199d8.jpg


    I keep updating Radeon 2020 drivers, and the 1/3rd height purple stripe across the screen horizontal near the bottom is the more current crash result, but not able to find an image on that. That seems to be relating to DXVA though, as I've seen that shade of pink before in the past on DXVA issues.

    MediaPortal Error log crash entry is always something like:

    Code:
    [2020-05-02 22:47:34,162] [Log    ] [MPMain   ] [ERROR] - Exception: Error in the application.
    -2005530508 (Unknown)
       at Microsoft.DirectX.Direct3D.Device.PresentInternal(tagRECT* sourceRectangle, tagRECT* destRectangle, IntPtr overrideWindow)
       at Microsoft.DirectX.Direct3D.Device.Present()
       at MediaPortal.D3D.RecoverDevice()  Message: Error in the application.  Site   : Void PresentInternal(Microsoft.DirectX.PrivateImplementationDetails.tagRECT*, Microsoft.DirectX.PrivateImplementationDetails.tagRECT*, IntPtr)  Source : Microsoft.DirectX.Direct3D  Stack Trace:     at Microsoft.DirectX.Direct3D.Device.PresentInternal(tagRECT* sourceRectangle, tagRECT* destRectangle, IntPtr overrideWindow)
       at Microsoft.DirectX.Direct3D.Device.Present()
       at MediaPortal.D3D.RecoverDevice()

    Attached is FULL mediaportal.log showing 2x Lost-in-Space 4K episodes playing fine, then I launched Stephen Colbert episode in 1080p and moments later it crashes the GPU, restarts MediaPortal and then I can play everything fine (including the episode that crashed).

    One thing that strikes me as odd is the overlay positioning calculation:

    Code:
    Lost in Space 2x01:
    
           [2020-05-02 21:13:15,509] [Log    ] [MPMain   ] [INFO ] - overlay: src        : (0,0)-(0,0)
           [2020-05-02 21:13:15,509] [Log    ] [MPMain   ] [INFO ] - overlay: dst        : (0,-2147483648)-(3840,0)
    
           [2020-05-02 21:13:16,062] [Log    ] [MPMain   ] [INFO ] - overlay: src        : (0,0)-(0,0)
           [2020-05-02 21:13:16,063] [Log    ] [MPMain   ] [INFO ] - overlay: dst        : (0,-2147483648)-(3840,0)
    
           [2020-05-02 21:13:16,310] [Log    ] [MPMain   ] [DEBUG] - PlaneScene: src        : (0,0)-(3840,1744)
           [2020-05-02 21:13:16,311] [Log    ] [MPMain   ] [DEBUG] - PlaneScene: dst        : (0,207)-(3840,1953)
    
    Lost in Space 2x02:
    
           [2020-05-02 22:02:04,876] [Log    ] [MPMain   ] [INFO ] - overlay: src        : (0,0)-(0,0)
           [2020-05-02 22:02:04,877] [Log    ] [MPMain   ] [INFO ] - overlay: dst        : (0,-2147483648)-(3840,0)
    
           [2020-05-02 22:02:05,315] [Log    ] [MPMain   ] [INFO ] - overlay: src        : (0,0)-(0,0)
           [2020-05-02 22:02:05,316] [Log    ] [MPMain   ] [INFO ] - overlay: dst        : (0,-2147483648)-(3840,0)
    
           [2020-05-02 22:02:05,426] [Log    ] [54       ] [DEBUG] - PlaneScene: src        : (0,0)-(3840,1744)
           [2020-05-02 22:02:05,427] [Log    ] [54       ] [DEBUG] - PlaneScene: dst        : (0,207)-(3840,1953)
    
    Stephen Colbert:
    
           [2020-05-02 22:47:19,591] [Log    ] [MPMain   ] [INFO ] - overlay: src        : (0,0)-(0,0)
           [2020-05-02 22:47:19,592] [Log    ] [MPMain   ] [INFO ] - overlay: dst        : (0,-2147483648)-(3840,0)
    
           [2020-05-02 22:47:19,877] [Log    ] [MPMain   ] [INFO ] - overlay: src        : (0,0)-(0,0)
           [2020-05-02 22:47:19,878] [Log    ] [MPMain   ] [INFO ] - overlay: dst        : (0,-2147483648)-(3840,0)
    
           [2020-05-02 22:47:20,047] [Log    ] [124      ] [DEBUG] - PlaneScene: src        : (0,0)-(1920,1080)
           [2020-05-02 22:47:20,048] [Log    ] [124      ] [DEBUG] - PlaneScene: dst        : (0,0)-(3840,2160)

    Really hoping I'm not the only one :censored:
     

    Attachments

    • MediaPortal.log
      252.6 KB

    CyberSimian

    Test Group
  • Team MediaPortal
  • June 10, 2013
    2,955
    1,851
    Southampton
    Home Country
    United Kingdom United Kingdom
    One thing that strikes me as odd is the overlay positioning calculation
    I have noticed an error in MP's calculation of the video screen size. It occurs sometimes when switching between full screen and windowed. This is what I said in a post dated 2018-11-21:

    Looking at the logs, the screen size starts off as 1920x1080, but somewhere it seems to change to 1920x1030, with the video being mapped onto 1875x1030.

    I notice this because it causes black vertical bars on the left and right edges of the full-screen video. The MP panels don't have these black bars, but my skin layout calculations are affected, and I end up with one less row in lists (e.g. in the "Recorded TV" panel).

    I have not found any way to reset this other than exiting MP and restarting.

    -- from CyberSimian in the UK
     

    ajs

    Development Group
  • Team MediaPortal
  • February 29, 2008
    16,030
    11,095
    Kyiv
    Home Country
    Ukraine Ukraine
    -2005530508 (Unknown)
    Error -2005530508 in the log, which means "D3DERR_DEVICEHUNG", "Hardware adapter reset by OS" :)

    Code:
        // ERR_DEVICEHUNG indicates that the device that returned this code caused
        // the hardware adapter to be reset by the OS. Most applications should
        // destroy the device and quit. Applications that must continue should
        // destroy all video memory objects (surfaces, textures, state blocks etc)
        // and call Reset() to put the device in a default state. If the
        // application then continues rendering in the same way, the device will
        // return to this state.
        // Applies to Direct3D 9Ex only.
        ERR_DEVICEHUNG = -2005530508

    @Sebastiii :coffee::whistle:
     

    RoChess

    Extension Developer
  • Premium Supporter
  • March 10, 2006
    4,434
    1,897
    • Thread starter
    • Moderator
    • #4
    Error -2005530508 in the log, which means "D3DERR_DEVICEHUNG", "Hardware adapter reset by OS" :)

    Totally aware that this is hardware related, but the problem is that it only appears to happens on specific media files (the non-4K ones that get upscaled based on recent testing), and it was never an issue in the past. The problem is that system was offline for quite a while until I fixed HDD failure (was using a Roku and nNidia Shield with Kodi for a while) and a massive amount of items got updated once system was on-line again to scan for updates, including OS, drivers, MediaPortal, and all the plugins.

    And of course hardware could in extreme rare case have degraded to cause this issue at a hardware level, albeit unlikely.

    Just difficult to imagine it is hardware though as when the crash happens within minutes after a cold-boot when playing upscaled media, but after MediaPortal restarts automatically then it never crashes again. Can play upscaled and 4K media 24/7 without issues, but the moment I power system down, then the next time it boots up I'm just waiting for the crash, which is annoying to say the least.

    Just don't have the time to spend days in reinstalling OS, trying different chipset/video drivers revisions, wide range of MediaPortal versions, plugin versions, etc. We're talking thousands of combinations it can be due to the many conditions at play. Plan to try a select few though, just to test/see, but just won't have the time for that for a while, so was hoping running some MediaPortal test builds that extra log entries could provide more insights.

    Or should I just run into Trace mode for a while? The issue is random, but extremely reliable to test for as it always happens within minutes of playing upscaled media.
     

    RoChess

    Extension Developer
  • Premium Supporter
  • March 10, 2006
    4,434
    1,897
    • Thread starter
    • Moderator
    • #5
    I'm curious now what would happen if DirectX 12 is forced, but that's probably not an easy thing to try.

    Not like DX9 is needed, because even Windows 7 got a backport of DX12, so any active supported OS (and Win7 is really on it's last limbs) supports DX12, so it would be a matter of hardware support, and curious now how many MediaPortal users are still relying on hardware that doesn't support DirectX 10, 11, or 12.

    I would think that relying on more modern versions would speed things up, especially if MediaPortal gets ported to .NET5

    Just thinking out loud :whistle:
     

    HTPCSourcer

    Retired Team Member
  • Premium Supporter
  • May 16, 2008
    11,418
    2,336
    Home Country
    Germany Germany
    Not like DX9 is needed, because even Windows 7 got a backport of DX12
    Things are a little bit more complicated. DX12 lacks certain DShow filters that the current MP code requires to play video and TV. These filters have not been completely removed by Microsoft but are now part of the Windows platform itself. While this could in principle be addressed by the MP software, you would then need to adopt different Windows versions.

    In the end it needs somebody who looks at it and adjusts the code.
     

    ajs

    Development Group
  • Team MediaPortal
  • February 29, 2008
    16,030
    11,095
    Kyiv
    Home Country
    Ukraine Ukraine
    I think we need wait @Sebastiii Maybe he knows how to get around this error so that the media portal does not fall, or maybe he just started playing the file from the place it occurred.
     

    Sebastiii

    Development Group
  • Team MediaPortal
  • November 12, 2007
    16,583
    10,403
    France
    Home Country
    France France
    Hi, nope I have don't a solution when this error happen, I remember trying to reset GPU under MP but need to have MP restarted not like audio hardware.
    It was often related to Intel when refresh rate kick in but here it's an ATI but maybe it's 4K related, I can't debug this, I don't have any 4k hardware :(
    The error happen when audio hardware is removed, I would say that maybe a driver is causing it.
    Hard to tell :(
     

    RoChess

    Extension Developer
  • Premium Supporter
  • March 10, 2006
    4,434
    1,897
    • Thread starter
    • Moderator
    • #9
    I don't have any 4k hardware :(

    If it keeps annoying me enough I'll have to help you with that :whistle:

    The error happen when audio hardware is removed, I would say that maybe a driver is causing it.
    Hard to tell :(

    That's weird, because video locks up first with audio still playing for a few more seconds before MediaPortal restarts, but this will give me a few more avenues to test for. The main difference is that when I was on 1.19-1.21 without this issue that it was HTPC -> Marantz -> LG 65" 4K, and now it's an Optoma HD27HDR projector which on the input side pretends to be a 4K projector, but has 1080p output. Want one of those 4K native laser projectors, but price needs to drop a lot first.

    So, once I get around to drill more holes and add more molly-bolts to the TV-mount the TV will be available again, but in the meantime I'll switch HTPC to 1080p for a while to see if crash disappears.

    Well aware that for a developer reproducibility is key to even begin contemplating a solution, as logs are often not enough, or at least to have a verifiable way to check if bug got fixed. Will try to get more scenarios to go through, but it is just sooooo freaking time-consuming, and I have to balance it with work, and preferring to use MediaPortal to watch media :rolleyes:
     

    Users who are viewing this thread

    Top Bottom