eglQueryModeStringMESA considered bogus [was Re: EGL_MESA_screen_surface version 7]

Adam Jackson ajax at nwnk.net
Sun May 1 18:32:12 PDT 2005


On Saturday 30 April 2005 03:20, Adam Jackson wrote:
> On Friday 29 April 2005 16:02, Jon Smirl wrote:
> > QueryModeString is there to make it easier to deal with those pesky
> > humans that can't build mode lines in their heads.
>
> I understand why you want it.  You want a human readable string, and that's
> fine.
>
> I don't agree that the EGL API is the place to generate this string.  We
> don't generate human-readable strings for fbconfigs in EGL.  Why would we
> generate them for modelines?

Let me expand on this a bit.

The spec as written makes no guarantee about the format of the mode string.  
It doesn't even guarantee that anything meaningful is ever returned.  You 
could have one driver that returns mode strings based on the ChooseMode sort 
order, meaning the first substring indicated optimal, the second interlaced, 
then refresh, etc.  Now imagine a second driver that returns mode strings 
like WxH at RHz.  The whole point of these strings is to be human readable, 
right?  So now you have two completely different formats that the user could 
see.  More than two, in fact, you have as many different formats as you have 
independent implementations.  If you're a user with two different cards but 
two of the same monitor, and you have to select "1680x1050 at 60" for one of 
them, and "EDID Optimal Mode" for the other, you're going to think "this is 
unpolished unprofessional crap".

The words "optimal" and "interlaced" need to be localized, too, and you have 
no guarantee that the driver knows how to spell "optimal" in Hindi, Russian, 
French, Greek...  You also need to localize the refresh rate number to match 
the current locale's radix separator.

In order to get that right, you have to either mangle the mode string coming 
out of the EGL layer, or else generate them above the EGL layer in the 
application.  Mangling the mode string is O(n*m) in code complexity, where n 
is number of drivers and m is number of releases per driver.

Oh, and since we haven't specified the encoding of the mode string, you'd 
better hope you guess it right.  Remember that UTF-16 looks like lots of 
one-character-long C strings in a row for roman scripts, so, guess you have 
to start poking at intervals down the string and hope you don't segfault.  
Even if you guess right, you don't know that the string is meaningful at all.  
"Richard M. Nixon" is a valid mode string.

To get usable mode strings, you have to do them yourself, in the app, above 
EGL.  We shouldn't try to do it in the EGL layer, because we cannot get it 
right without a meticulously precise spec that brings in a localization 
layer.

- ajax
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/dri-egl/attachments/20050501/2d39f06e/attachment.pgp


More information about the dri-egl mailing list