Mesa integration

Thursday, March 16, 2017

I keep going on the integration of Marc-Andre's patch.

Adapting the patch

The patch does not apply cleanly. Installing Emacs to be able to use its wonderful diff/patch mode. Roughly 50% of the hunks apply OK. The rest needs to be adjusted / rewritten, but nothing major.

There is a conflict with version numbers for the loader. The patch requires a bump, so the original patch has:

--- a/include/GL/internal/dri_interface.h

+++ b/include/GL/internal/dri_interface.h @@ -502,7 +502,7 @@ struct __DRIdamageExtensionRec { * SWRast Loader extension. */ #define __DRI_SWRAST_LOADER "DRI_SWRastLoader" -#define __DRI_SWRAST_LOADER_VERSION 2 +#define __DRI_SWRAST_LOADER_VERSION 3 struct __DRIswrastLoaderExtensionRec { __DRIextension base;

However, the version being installed is already version 3, so I need to find all places that depend on this, and replace 3 with 4.

Interestingly, there is this part of the patch:

@@ -200,13 +296,14 @@ swrastGetImage(__DRIdrawable * read,
    ximage->data = NULL;
 }
 

-static const __DRIswrastLoaderExtension swrastLoaderExtension = { - .base = {__DRI_SWRAST_LOADER, 2 }, +static __DRIswrastLoaderExtension swrastLoaderExtension = { + .base = {__DRI_SWRAST_LOADER, 3 }, .getDrawableInfo = swrastGetDrawableInfo, .putImage = swrastPutImage, .getImage = swrastGetImage, .putImage2 = swrastPutImage2, + .putImageShm = swrastPutImageShm, }; static const __DRIextension *loader_extensions[] =

I find it strange that we have a hard-coded 3 here, not a reference to __DRI_SWRAST_LOADER_VERSION. Asked Marc-André if there is a reason for that.

Compiling the patch

As is, my adapted patch does not work:

drisw_glx.c: In function 'XCreateDrawable':

drisw_glx.c:85:10: error: 'struct drisw_drawable' has no member named 'shminfo' pdp->shminfo.shmid = shmid; ^ drisw_glx.c:91:41: error: 'struct drisw_drawable' has no member named 'shminfo' &pdp->shminfo, ^

Typo when I manually applied the last part of the patch (shmInfo). Next error:

drisw_glx.c: In function 'driswCreateScreen':

drisw_glx.c:790:7: error: assignment of member 'putImageShm' in read-only object swrastLoaderExtension.putImageShm = NULL; ^

This was another hunk that did not apply cleanly, and I did not see that const had been removed:

@@ -200,13 +296,14 @@ swrastGetImage(__DRIdrawable * read,
    ximage->data = NULL;
 }
 

-static const __DRIswrastLoaderExtension swrastLoaderExtension = { - .base = {__DRI_SWRAST_LOADER, 2 }, +static __DRIswrastLoaderExtension swrastLoaderExtension = { + .base = {__DRI_SWRAST_LOADER, 3 }, .getDrawableInfo = swrastGetDrawableInfo, .putImage = swrastPutImage, .getImage = swrastGetImage, .putImage2 = swrastPutImage2, + .putImageShm = swrastPutImageShm, };

  CC       drisw.lo

drisw.c:80:15: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'void' static INLINE void ^ drisw.c:93:15: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'void' static INLINE void ^

Apparently, INLINE has been replaced with a regular inline. This is the last error.

The resulting Mesa works:

GL_RENDERER   = Gallium 0.4 on llvmpipe (LLVM 3.8, 128 bits)

GL_VERSION = 2.1 Mesa 11.2.2 GL_VENDOR = VMware, Inc. VisualID 446, 0x1be

XQuartz security model

I wish it was possible to do the old export DISPLAY=pc:0 to run Emacs on my local dispay, instead of through VNC. Tried for quite a bit of time to make it work "the right way", but finally had to give up.

Using reverse SSH tunelling helps. It's a bit tedious to setup, though, because you have to re-establish the tunnel every single time your reboot the guest. How annoying.

Blogmax

Made a few tweaks to BlogMax to adapt it to my needs. In particular, I added the ability to add bullets and line items easily.