Index: head/graphics/Makefile =================================================================== --- head/graphics/Makefile +++ head/graphics/Makefile @@ -499,6 +499,7 @@ SUBDIR += libwmf SUBDIR += libwmf-nox11 SUBDIR += libwpg03 + SUBDIR += libxatracker SUBDIR += libyuv SUBDIR += libzmf SUBDIR += lightzone Index: head/graphics/libxatracker/Makefile =================================================================== --- head/graphics/libxatracker/Makefile +++ head/graphics/libxatracker/Makefile @@ -0,0 +1,36 @@ +# Created by: johalun +# $FreeBSD$ + +PORTNAME= libxatracker +PORTVERSION= ${MESAVERSION} +CATEGORIES= graphics + +COMMENT= Mesa XA state tracker + +USE_XORG= xorgproto + +.include +.include "${.CURDIR:H:H}/graphics/mesa-dri/Makefile.common" + +ONLY_FOR_ARCHS= i386 amd64 +ONLY_FOR_ARCHS_REASON= Used only by VMWare supported architectures + +CONFIGURE_ARGS+= --disable-dri \ + --disable-egl \ + --disable-gbm \ + --disable-gles2 \ + --disable-glx \ + --disable-opengl \ + --disable-shared-glapi \ + --with-gallium-drivers= \ + --with-platforms= + +MESA_BUILD_WRKSRC= src/util src/compiler +LDFLAGS_i386= -Wl,-znotext + +CONFIGURE_ARGS+= --enable-xa +MESA_BUILD_WRKSRC+= src/gallium +MESA_INSTALL_WRKSRC= src/gallium/state_trackers/xa src/gallium/targets/xa + +.include "${MASTERDIR}/Makefile.targets" +.include Index: head/graphics/libxatracker/pkg-descr =================================================================== --- head/graphics/libxatracker/pkg-descr +++ head/graphics/libxatracker/pkg-descr @@ -0,0 +1,9 @@ +Mesa is a 3-D graphics library with an API which is very similar to that +of OpenGL*. To the extent that Mesa utilizes the OpenGL command syntax or +state machine, it is being used with authorization from Silicon Graphics, +Inc. However, the author makes no claim that Mesa is in any way a +compatible replacement for OpenGL or associated with Silicon Graphics, Inc. + +XA is a new state tracker designed by VMWare for their virtual GPU driver "vmwgfx". + +WWW: http://www.mesa3d.org/ Index: head/graphics/libxatracker/pkg-plist =================================================================== --- head/graphics/libxatracker/pkg-plist +++ head/graphics/libxatracker/pkg-plist @@ -0,0 +1,7 @@ +include/xa_composite.h +include/xa_context.h +include/xa_tracker.h +lib/libxatracker.so +lib/libxatracker.so.2 +lib/libxatracker.so.2.4.0 +libdata/pkgconfig/xatracker.pc Index: head/x11-drivers/xf86-video-vmware/Makefile =================================================================== --- head/x11-drivers/xf86-video-vmware/Makefile +++ head/x11-drivers/xf86-video-vmware/Makefile @@ -16,6 +16,11 @@ XORG_CAT= driver +LIB_DEPENDS+= libdrm.so:graphics/libdrm \ + libxatracker.so:graphics/libxatracker + +CONFIGURE_ARGS= --without-libudev + .include .if ${ARCH} == i386 Index: head/x11-drivers/xf86-video-vmware/files/patch-vmwgfx_vmwgfx__dri2.c =================================================================== --- head/x11-drivers/xf86-video-vmware/files/patch-vmwgfx_vmwgfx__dri2.c +++ head/x11-drivers/xf86-video-vmware/files/patch-vmwgfx_vmwgfx__dri2.c @@ -0,0 +1,44 @@ +--- vmwgfx/vmwgfx_dri2.c.orig 2018-05-17 07:42:24 UTC ++++ vmwgfx/vmwgfx_dri2.c +@@ -413,8 +413,7 @@ xorg_dri2_init(ScreenPtr pScreen) + modesettingPtr ms = modesettingPTR(pScrn); + DRI2InfoRec dri2info; + int major, minor; +- char fdPath[VMWGFX_FD_PATH_LEN]; +- ssize_t numChar; ++ const char *dev_name; + + memset(&dri2info, 0, sizeof(dri2info)); + +@@ -430,20 +429,13 @@ xorg_dri2_init(ScreenPtr pScreen) + dri2info.fd = ms->fd; + dri2info.driverName = "vmwgfx"; + +- /* +- * This way of obtaining the DRM device name is a bit +- * os-specific. It would be better to obtain it from +- * drmOpen. Currently this works only for Linux. +- */ +- memset(fdPath, 0, VMWGFX_FD_PATH_LEN); +- snprintf(fdPath, VMWGFX_FD_PATH_LEN - 1, "/proc/self/fd/%d", ms->fd); +- numChar = readlink(fdPath, ms->dri2_device_name, VMWGFX_DRI_DEVICE_LEN); +- if (numChar <= 0 || numChar >= VMWGFX_DRI_DEVICE_LEN) { ++ dev_name = drmGetDeviceNameFromFd2(ms->fd); ++ if (!dev_name) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Could not find the drm device name. Disabling dri2.\n"); + return FALSE; + } +- ms->dri2_device_name[numChar] = 0; ++ strncpy(ms->dri2_device_name, dev_name, VMWGFX_DRI_DEVICE_LEN); + dri2info.deviceName = ms->dri2_device_name; + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Path of drm device is \"%s\".\n", ms->dri2_device_name); +@@ -466,6 +458,7 @@ xorg_dri2_init(ScreenPtr pScreen) + dri2info.AuthMagic3 = vmw_dri_auth_magic3; + } + #endif ++ free(dev_name); + + return DRI2ScreenInit(pScreen, &dri2info); + }