Re: mesa on darwin/x11
Jeremy Sequoia <[email protected]> Sun, 28 Jun 2026 11:10:09 -0700
| Newsgroups | gmane.comp.video.mesa3d.devel |
|---|---|
| Message-ID | <[email protected]> |
--Apple-Mail-19DDC49C-80C4-4887-9501-8BAF273F9518 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable <html class=3D"apple-mail-supports-explicit-dark-mode"><head><meta http-equi= v=3D"content-type" content=3D"text/html; charset=3Dutf-8"></head><body dir=3D= "auto">Thanks, Duncan.<div><br></div><div>This does help explain some things= .</div><div><br></div><div>I assumed that you were building with APPLEGL=3D1= + APPLE=3D1 since that is what meson setup. Also, there was only one v= ery minor code difference that APPLE enabled when APPLEGL was unset. A= re you sure you build with APPLEGL=3D0? APPLE=3D1 neuters many of the A= PPLEGL build time branches.</div><div><br></div><div>My goal is slightly dif= ferent than yours in that I want to have runtime choices between Gallium and= OpenGL.fw. I just put up a pull request that I think accomplishes tha= t without breaking anyone else. I'd love it if you could look it over a= nd make sure it works for you as well:</div><div><br></div><div><a href=3D"h= ttps://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/42512">https://gitl= ab.freedesktop.org/mesa/mesa/-/merge_requests/42512</a></div><div><br></div>= <div>This PR also makes some architectural changes to glx (new vtable and a n= ew capability bit to enable runtime vs build time branching) that I'd like o= ther eyes on before I merge to make sure it isn't offensive to folks.</div><= div><br></div><div>Thanks,</div><div>Jeremy</div><div><br id=3D"lineBreakAtB= eginningOfSignature"><div dir=3D"ltr">Sent from my iPhone...</div><div dir=3D= "ltr"><br><blockquote type=3D"cite">On Jun 26, 2026, at 03:17, Duncan Hopkin= s <[email protected]> wrote:<br><br></blockquote></div><block= quote type=3D"cite"><div dir=3D"ltr">=EF=BB=BF<div dir=3D"ltr"><div>Hi = Jeremy,</div><div><br></div><div>I will try my best to remember what the det= ails are for this, but it has also been a good few years since I made this m= ess. :)</div><div><br></div><div>What we need is to be able to compile mesa w= ith zero `OpenGL.framework` dependencies and have the Gallium drivers (= mainly Zink and SWRast) and Kopper kick in.<br>When `OpenGL.framework` and C= GL code is used (the GLX_USE_APPLEGL=3D1 case) the whole of the Gallium and D= RI code paths where by-passed and all GL entried points where faast forwarde= d to `OpenGL.framework`.</div><div>This is not good as we are trying to prod= uce a solution that works without `OpenGL.framework` to avoid "Apple De= pricating OpenGL and OpenCL" issue. Also being able to run against an OpenGL= higher than 4.1 would be nice.</div><div><br></div><div>So falling back to `= OpenGL.framework` at runtime was not something we want or seemed easy to do a= t the time. <br><br>The `<span style=3D"background-color:transparent">G= LX_USE_APPLE=3D1` should indicate that we are running on an Apple syste= m (MacOS) and the `</span><span style=3D"background-color:transparent">GLX_U= SE_APPLEGL=3D1` sould indicate that `OpenGL.framework` is good to be used.<b= r>In our use case we build with </span><span style=3D"background-color:= transparent">`</span><span style=3D"background-color:transparent">GLX_USE_AP= PLE=3D1` </span><span style=3D"background-color:transparent">`</span><s= pan style=3D"background-color:transparent">GLX_USE_APPLEGL=3D0` , we want to= use the Gallium drivers and and avoid any use of the `OpenGL.framework` eve= n if Zink or SWRast fail to start up.</span></div><div><span style=3D"backgr= ound-color:transparent"><br></span></div><div>It has been a minute since we l= ast updated our internal software stack with the latest public mesa version,= so there is a good chance the present mesa code might be broken.</div><div>= In the past, mesa has gotten broken because there is no fully testable MacOS= build for other developers to check against. <br><br></div><div>I was t= rying to push as much code as I could back to mesa, but I got stuck on a&nbs= p;Kopper `VkSurface` issue between xQuarts and MoltenVk, one supports only X= 11 extensions and the other only supports MacOS extensions!</div><div><br></= div><div>Internally we are using these code paths. We also stripped away the= X11 dependencies because we are using this in a native macOS application, n= ot through XQuarts.</div><div><br></div><div>Does this help explain the macr= o mess?</div><div><br></div><div><br></div><div><div dir=3D"ltr" class=3D"gm= ail_signature" data-smartmail=3D"gmail_signature"><div dir=3D"ltr"><div dir=3D= "ltr"><p dir=3D"ltr" style=3D"line-height:1.38;margin-top:0pt;margin-bottom:= 5pt"><span style=3D"background-color:transparent;color:rgb(136,136,136);font= -family:Arial,sans-serif;font-size:9pt;font-weight:700">Duncan Hopkins</span= ><br></p><p dir=3D"ltr" style=3D"line-height:1.656;background-color:#ffffff;= margin-top:0pt;margin-bottom:0pt;padding:0pt 0pt 5pt 0pt"><span style=3D"fon= t-size:9pt;font-family:Arial,sans-serif;color:#888888;background-color:trans= parent;font-weight:700;font-style:normal;font-variant:normal;text-decoration= :none;vertical-align:baseline;white-space:pre;white-space:pre-wrap">Software= Architect</span></p><p dir=3D"ltr" style=3D"line-height:1.656;background-co= lor:#ffffff;margin-top:0pt;margin-bottom:0pt;padding:0pt 0pt 5pt 0pt"><span s= tyle=3D"font-size:9pt;font-family:Arial,sans-serif;color:#888888;background-= color:transparent;font-weight:700;font-style:normal;font-variant:normal;text= -decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-wra= p"><span style=3D"border:none;display:inline-block;overflow:hidden;width:151= px;height:25px"><img src=3D"https://lh7-us.googleusercontent.com/MXjQPvTjjxW= zajuruC43ldsDqnJP5R04cU6egRP_qUkCgTrN_t-aao-fwEs3Yp32C7zue1TrP--9RwPDed6UUyE= -PCNzHFC-hmsSxFCsXEiuJbo-UZWv4uXbY4AXxXN7si6IZE05hf92T45SRk8ILVY6fOaAdcKStRu= vNftBqeLB-8Up-jdlAyPTRFvD7Q" width=3D"151" height=3D"25" style=3D"margin-lef= t:0px;margin-top:0px" data-unique-identifier=3D""></span></span></p><p dir=3D= "ltr" style=3D"line-height:1.656;background-color:#ffffff;margin-top:0pt;mar= gin-bottom:0pt;padding:0pt 0pt 5pt 0pt"><span style=3D"font-size:9pt;font-fa= mily:Arial,sans-serif;color:#888888;background-color:transparent;font-weight= :700;font-style:normal;font-variant:normal;text-decoration:none;vertical-ali= gn:baseline;white-space:pre;white-space:pre-wrap">Tel: </span><span style=3D= "font-size:9pt;font-family:Arial,sans-serif;color:#1155cc;background-color:t= ransparent;font-weight:700;font-style:normal;font-variant:normal;text-decora= tion:none;vertical-align:baseline;white-space:pre;white-space:pre-wrap">+44 2= 0 7479 4350</span></p><p dir=3D"ltr" style=3D"line-height:1.656;background-c= olor:#ffffff;margin-top:0pt;margin-bottom:0pt;padding:0pt 0pt 5pt 0pt"><span= style=3D"font-size:9pt;font-family:Arial,sans-serif;color:#888888;backgroun= d-color:transparent;font-weight:700;font-style:normal;font-variant:normal;te= xt-decoration:none;vertical-align:baseline;white-space:pre;white-space:pre-w= rap">Web:</span><a href=3D"https://www.foundry.com/" style=3D"text-decoratio= n:none" target=3D"_blank"><span style=3D"font-size:9pt;font-family:Arial,san= s-serif;color:#888888;background-color:transparent;font-weight:700;font-styl= e:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;wh= ite-space:pre;white-space:pre-wrap"> </span><span style=3D"font-size:9pt;fon= t-family:Arial,sans-serif;color:#1155cc;background-color:transparent;font-we= ight:700;font-style:normal;font-variant:normal;text-decoration:none;vertical= -align:baseline;white-space:pre;white-space:pre-wrap">www.foundry.com</span>= </a></p><p dir=3D"ltr" style=3D"line-height:1.38;margin-top:12pt;margin-bott= om:12pt"><span style=3D"font-size:7.5pt;font-family:Arial,sans-serif;color:#= 666666;background-color:transparent;font-weight:400;font-style:normal;font-v= ariant:normal;text-decoration:none;vertical-align:baseline;white-space:pre;w= hite-space:pre-wrap">The Foundry Visionmongers Ltd. - Registered= in England and Wales No: 4642027 Address: 5 Golden Square, London, W1F 9HT&= nbsp; - VAT No: 945701320</span></p><p dir=3D"ltr" style=3D"line-heigh= t:1.38;margin-top:0pt;margin-bottom:5pt"><span><span style=3D"font-size:7.5p= t;font-family:Arial,sans-serif;color:rgb(102,102,102);background-color:trans= parent;font-variant:normal;vertical-align:baseline;white-space:pre-wrap">The= Foundry Visionmongers Ltd</span><span style=3D"font-size:7.5pt;font-family:= Arial,sans-serif;color:rgb(102,102,102);font-variant:normal;vertical-align:b= aseline;white-space:pre-wrap"> has its registered office at 19 Cornwall Stre= et, Birmingham, England, B3 2DX. This email is intended for the named recipi= ent only and may contain confidential information. If you are not the intend= ed recipient, notify the sender immediately and destroy this email; you must= not copy, distribute or take action in reliance upon the email or in any at= tachment. For information about how we process data and monitor communicatio= ns please see our </span><a href=3D"https://www.foundry.com/privacy-notice" s= tyle=3D"text-decoration:none" target=3D"_blank"><span style=3D"font-size:7.5= pt;font-family:Arial,sans-serif;color:rgb(102,102,102);font-variant:normal;t= ext-decoration:underline;vertical-align:baseline;white-space:pre-wrap">Priva= cy Policy</span></a><span style=3D"font-size:7.5pt;font-family:Arial,sans-se= rif;color:rgb(102,102,102);font-variant:normal;vertical-align:baseline;white= -space:pre-wrap">.</span></span></p></div></div></div></div><br></div><br><d= iv class=3D"gmail_quote gmail_quote_container"><div dir=3D"ltr" class=3D"gma= il_attr">On Wed, 24 Jun 2026 at 09:54, Jeremy Sequoia <<a href=3D"mailto:= [email protected]">[email protected]</a>> wrote:<br></div><= blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-le= ft:1px solid rgb(204,204,204);padding-left:1ex">Hi Duncan,<br> <br> I haven't been paying much attention to mesa or X11 for a few years. I= 'm just now looking back since I have some free cycles on vacation. I s= ee you did some work in <a href=3D"https://gitlab.freedesktop.org/mesa/mesa/= -/merge_requests/28205" rel=3D"noreferrer" target=3D"_blank">https://gitlab.= freedesktop.org/mesa/mesa/-/merge_requests/28205</a> to get darwin/x11 to us= e gallium, but the way we go about it with macro definitions is quite confus= ing to me since we end up having macros that seem not well defined any more<= br> <br> Previously, GLX_USE_APPLEGL=3D1 meant "build a hacky libGL from the mesa sou= rces in a mostly nonstandard way since we never got around to merging things= together to make the implementation selectable at runtime" and GLX_USE_APPL= EGL=3D0 meant "build a modern gallium libGL that you can use for swrast or I= GLX but that doesn't work with hardware acceleration because we never got ar= ound to moving glx/apple into the modern era. What does GLX_USE_APPLEG= L mean now?<br> <br> With the introduction of GLX_USE_APPLEGL=3D1 GLX_USE_APPLE=3D1, it seems tha= t we're getting gallium but with some slight differences from the GLX_USE_AP= PLEGL=3D0 case.<br> <br> Relatedly, is GLX_USE_APPLEGL=3D0 GLX_USE_APPLE=3D1 expected to be a valid c= onfiguration? If so, what does it mean? It looks like the only d= ifference between it and GLX_USE_APPLEGL=3D0 GLX_USE_APPLE=3D0 is at src/glx= /glxext.c:1029:<br> <br> #if !defined(GLX_USE_APPLE)<br> if (!dpyPriv->has_multibuffer && glx_accel &a= mp;& !debug_get_bool_option("LIBGL_KOPPER_DRI2", false)) {<br> if (glx_driver & GLX_DRIVER_ZINK_YES) {<br> CriticalErrorMessageF("DRI3 not ava= ilable\n");<br> goto init_fail;<br> }<br> glx_driver &=3D ~GLX_DRIVER_ZINK_INFER;<br> }<br> #endif<br> <br> which seems maybe not intentional ... ? Why would we want that for GLX_USE_A= PPLEGL=3D1 GLX_USE_APPLE=3D1 but not GLX_USE_APPLEGL=3D1 GLX_USE_APPLE=3D0?<= br> <br> So I'm confused as to why we need two variables here. I'd like to get u= s down to 0, whereby the OpenGL.framework backend is selectable at runtime r= ather than build time, and these changes you've made seem to make the build s= pace a bit more complicated than they were before.<br> <br> Can you walk me through the design decisions here? I'd be happy to cha= t over Webex / Zoom / whatever if that would be easier.<br> <br> Thanks,<br> Jeremy<br> <br> </blockquote></div> </div></blockquote></div></body></html>= --Apple-Mail-19DDC49C-80C4-4887-9501-8BAF273F9518--