D27980: make opengl module support multiple dri devices

Pino Toscano noreply at phabricator.kde.org
Thu Mar 19 11:41:43 GMT 2020


pino added inline comments.

INLINE COMMENTS

> opengl.cpp:169
> +
> +    bool isValid()
> +    {

const

> opengl.cpp:210
>      struct stat fileInfo;
> -    if (::stat("/dev/dri/card0", &fileInfo) != 0)
> -        return false;
> -    if ((fileInfo.st_mode & S_IFCHR) != S_IFCHR)
> -        return false;
> +    if (::stat(qPrintable(path), &fileInfo) != 0) {
> +        return info;

qPrintable is wrong when passing paths to native C functions; use QFile::encodeName instead

> opengl.cpp:230-233
> +    const auto entries = QDir("/dev/dri/").entryList(QDir::System);
> +    for (const auto &entry : entries) {
> +        if (QDir::match(QStringLiteral("card*"), entry)) {
> +            auto info = get_drm_device_sysfs(QStringLiteral("/dev/dri/") + entry);

why not just use QDirIterator instead, so it combines dir listing and filtering?

REPOSITORY
  R102 KInfoCenter

REVISION DETAIL
  https://phabricator.kde.org/D27980

To: sitter
Cc: pino, zzag, apol, adridg, plasma-devel, Orage, LeGast00n, The-Feren-OS-Dev, cblack, jraleigh, zachus, fbampaloukas, GB_2, ragreen, ZrenBot, ngraham, himcesjf, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, ahiemstra, mart
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20200319/f884e612/attachment.html>


More information about the Plasma-devel mailing list