We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 4403

Summary: [PATCH] Check for resources when validating KMSDRM device in check_modesetting
Product: SDL Reporter: Sergey Zhuravlevich <zhurxx>
Component: videoAssignee: Ryan C. Gordon <icculus>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2 CC: icculus
Version: 2.0.9   
Hardware: ARM   
OS: Linux   
Attachments: PATCH: Check for resources when validating KMSDRM device in check_modesetting.

Description Sergey Zhuravlevich 2018-11-30 12:04:26 UTC
Created attachment 3515 [details]
PATCH: Check for resources when validating KMSDRM device in check_modesetting.

On our imx51 based platform card1 is the right card to use for rendering and card0 has zero connectors, encoders and CRTCs. This patch adds a check for resources to device selection routine so the right card could be picked on any platform.
Comment 1 Ryan C. Gordon 2018-12-01 17:59:16 UTC
Just to verify: the call to KMSDRM_drmModeFreeResources() needs to happen if resources != NULL, but right now it's happening only in here:

if (resources->count_connectors > 0 && resources->count_encoders > 0 && resources->count_crtcs > 0) {
    available = SDL_TRUE;
    KMSDRM_drmModeFreeResources(resources);
}


...should I move that outside of the if statement?

--ryan.
Comment 2 Sergey Zhuravlevich 2018-12-01 18:27:41 UTC
(In reply to Ryan C. Gordon from comment #1)
> Just to verify: the call to KMSDRM_drmModeFreeResources() needs to happen if
> resources != NULL, but right now it's happening only in here:
> 
> if (resources->count_connectors > 0 && resources->count_encoders > 0 &&
> resources->count_crtcs > 0) {
>     available = SDL_TRUE;
>     KMSDRM_drmModeFreeResources(resources);
> }
> 
> 
> ...should I move that outside of the if statement?
> 
> --ryan.

Yes, sure, that was my mistake. Thanks for noticing!
Comment 3 Ryan C. Gordon 2018-12-01 21:32:54 UTC
Ok, this patch (with that free call moved) is now https://hg.libsdl.org/SDL/rev/2e2cff8a14b6, thanks!

--ryan.