Query supported OpenGL core profile version on X11, GLX
Needs ReviewPublic

Authored by madcatx on Jul 8 2017, 10:59 AM.



Querying OpenGL version on X11 may return only the highest supported OpenGL version that provides the deprecated functionality. Since Mesa does not support (and will not support) compatibility OpenGL profiles, KInfoCenter may incorrectly show only OpenGL 3.0 as the latest supported OpenGL version. This patch queries the supported OpenGL core profiles and displays the highest supported core profile if such information is available.

Test Plan

The patch works as expected with my Sandy Bridge HD3000 GPU and Mesa 17.0.5. KInfoCenter correctly shows that Core profile 3.3 is supported on this GPU. Additional Testing was done on Radeon 7730LE, Mesa 17.1rc2. OpenGL 3.0 compatibility and OpenGL 4.5 core profile support is shown correctly.

Diff Detail

R102 KInfoCenter
Lint Skipped
Unit Tests Skipped
madcatx created this revision.Jul 8 2017, 10:59 AM
Restricted Application added a project: Plasma. · View Herald TranscriptJul 8 2017, 10:59 AM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
cfeck added a subscriber: cfeck.Jul 8 2017, 11:38 AM

BUG: 373856

graesslin requested changes to this revision.Jul 8 2017, 12:56 PM
graesslin added a subscriber: graesslin.

I highly suggest to use the new context attribute builder I created for KWin. See D6411


Please don't add qDebug in new code, use qCDebug instead. Same of course for all the other cases in the change.


please use nullptr in new code.

This revision now requires changes to proceed.Jul 8 2017, 12:56 PM

Fair enough, I'll give it another go. Would it make sense to follow this with a trivial NULL -> nullptr patch to keep the code in this file consistent?

fredrik added a subscriber: fredrik.Jul 8 2017, 3:32 PM

You should use the GLX_MESA_query_renderer extension for this when it is available.

madcatx updated this revision to Diff 16377.Jul 9 2017, 10:56 AM
madcatx edited edge metadata.

v2. The code now tries to leverage GLX_MESA_query_renderer when it is available and falls back to the old-fashioned probing otherwise. As for some of the suggestions by Martin:

  • The new code now uses nullptrs instead of NULLs
  • qCDebug() does not seem to be used anywhere in the whole kinfocenter so I cannot simply replace qDebug()s with their qCDebug() counterparts without declaring the logging category first.
  • As for the GlxContext builders, is it worth it to pull in some KWin dependencies just to query the OpenGL core profile? Currently the kinfocenter does not seem to depend of KWin in any way.