Deep Color support

John Kåre Alsaker john.kare.alsaker at gmail.com
Sun Apr 27 03:11:39 PDT 2014


I implemented support for ABGR16161616 framebuffers in mesa/wl_drm.
My patch has bit-rotted a bit now, but it gives you an idea about what to do:
https://github.com/Zoxc/mesa/commit/73f39f1366287bab02c993cb3537980e89b3cdca

My motivation for this was to have clients render with linear gamma.

One thing to note is that EGL clients usually will pick the highest
color depth by default.
We'd likely want to prevent this somehow, even though it goes against EGL spec.

On Sun, Apr 27, 2014 at 11:52 AM, Wolfgang Draxinger
<wdraxinger.maillist at draxit.de> wrote:
> On Sun, 27 Apr 2014 11:35:37 +0200
> Wolfgang Draxinger
> <wdraxinger.maillist at draxit.de> wrote:
>
>> > Btw. weren't FBConfigs a GLX thing?
>>
>> No, XRender actually; GLX just piggybacks on that.
>
> Okay, that needs some explanation. While all functions that have
> "FBConfig" in their name are part of GLX you actually have so use some
> XRender functions to select the desired pixel format from the subset of
> FBConfigs offered to you by GLX.
>
> In my own OpenGL/GLX programs I use the following code for FBConfig
> selection:
>
>         fbconfigs =
>             glXChooseFBConfig(
>                 Xdisplay, Xscreen, VisData,
>                 &numfbconfigs);
>
>         int need_alpha = 0;
>         for(int i = 0; VisData[i] != None; i+=2) {
>             if( VisData[i] == GLX_ALPHA_SIZE
>              && VisData[i+1] > 0 ) {
>                 need_alpha = 1;
>                 break;
>             }
>         }
>
>         fbconfig = 0;
>         if( need_alpha ) {
>             for(int i = 0; i<numfbconfigs; i++) {
>                 visual = (XVisualInfo*)
>                 glXGetVisualFromFBConfig(
>                     Xdisplay, fbconfigs[i]);
>
>                 if(!visual)
>                     continue;
>
>                 pict_format =
>                     XRenderFindVisualFormat(
>                         Xdisplay,
>                         visual->visual);
>
>                 if(!pict_format)
>                     continue;
>
>                 fbconfig = fbconfigs[i];
>                 if(pict_format->direct.alphaMask > 0) {
>                         break;
>                 }
>             }
>         }
>         else {
>             fbconfig = fbconfigs[0];
>         }
>
>         if(!fbconfig) {
>                 fatalError("No matching FB config found");
>         }
>
> It took me quite a while to figure out that glXChooseFBConfig returns a
> superset of XRender visuals that you have to comb through in a second
> search to select the subset with the desired properties (in this case
> an alpha channel on the X11 backing store).
>
>
> Regards,
>
> Wolfgang
>
>
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel


More information about the wayland-devel mailing list