Skip to content

Commit

Permalink
[WPE] WPE Platform: make sure the DRM device selected is capable of m…
Browse files Browse the repository at this point in the history
…odesetting

https://bugs.webkit.org/show_bug.cgi?id=268535

Reviewed by Carlos Garcia Campos and Adrian Perez de Castro.

Fixes the findDevice() by ensuring the returning device has DRM
resources.

Related-To: #23608

* Source/WebKit/WPEPlatform/wpe/drm/WPEDisplayDRM.cpp:
(findDevice):

Canonical link: https://commits.webkit.org/273896@main
  • Loading branch information
psaavedra committed Feb 1, 2024
1 parent fdeaefe commit 3b6c9da
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Source/WebKit/WPEPlatform/wpe/drm/WPEDisplayDRM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,14 @@ static UnixFileDescriptor findDevice(GError** error)
continue;

fd = UnixFileDescriptor { open(device->nodes[DRM_NODE_PRIMARY], O_RDWR | O_CLOEXEC), UnixFileDescriptor::Adopt };
if (fd)
if (!fd)
continue;

WPE::DRM::UniquePtr<drmModeRes> resources(drmModeGetResources(fd.value()));
if (resources && resources->count_crtcs && resources->count_connectors && resources->count_encoders)
break;

fd.release();
}

drmFreeDevices(devices, numDevices);
Expand Down

0 comments on commit 3b6c9da

Please sign in to comment.