2012-07-27

Failed to emerge =x11-drivers/xf86-video-vmware-12.0.2 with >=x11-base/xorg-server-1.12.99.902

The new ebuild (x11-drivers/xf86-video-vmware-12.0.2-r1) has been provided since Aug 8th, so this problem has already been resolved. Now, we can emerge it.

Issue

Failed to emerge =x11-drivers/xf86-video-vmware-12.0.2 on VMWare guest Funtoo Linux OS with >=x11-base/xorg-server-1.12.99.902, because xorg-server's APIs (e.g. /usr/include/xorg/scrnintstr.h) changed.

Solution

  1. I applied a following patch(named xorg-server-1.12.99.902.patch) to xf86-video-vmware-12.0.2 sources.
  2. Then, wrote this ebuild and emerged it.

Result

The patched xf86-video-vmware-12.0.2 was installed successfully. However my KDE is unstable(often crashes); I am not sure but I guess the reason is because a new version of xorg-server is unstable.
=x11-base/xorg-server-1.12.99.903 is also available in gentoo portage repository. I tried to upgrade xorg-server to this later version, then reinstalled patched =x11-drivers/xf86-video-vmware-12.0.2. This was also installed successfully, but the unstableness is still not fixed.

Patch to fix xf86-video-vmware driver codes

diff -ur xf86-video-vmware-12.0.2/saa/saa.c xf86-video-vmware/saa/saa.c
--- xf86-video-vmware-12.0.2/saa/saa.c 2012-03-09 01:13:16.000000000 +0900
+++ xf86-video-vmware/saa/saa.c 2012-07-27 01:20:58.324868311 +0900
@@ -594,7 +594,7 @@
  * screen private, before calling down to the next CloseScreen.
  */
 Bool
-saa_close_screen(int i, ScreenPtr pScreen)
+saa_close_screen(ScreenPtr pScreen)
 {
     struct saa_screen_priv *sscreen = saa_screen(pScreen);
     struct saa_driver *driver = sscreen->driver;
@@ -624,7 +624,7 @@
 
     free(sscreen);
 
-    return (*pScreen->CloseScreen) (i, pScreen);
+    return (*pScreen->CloseScreen) (pScreen);
 }
 
 struct saa_driver *
diff -ur xf86-video-vmware-12.0.2/saa/saa.h xf86-video-vmware/saa/saa.h
--- xf86-video-vmware-12.0.2/saa/saa.h 2012-03-09 01:13:16.000000000 +0900
+++ xf86-video-vmware/saa/saa.h 2012-07-27 01:23:54.624865555 +0900
@@ -173,7 +173,7 @@
 saa_bitmap_to_region(PixmapPtr pPix);
 
 extern _X_EXPORT Bool
-saa_close_screen(int i, ScreenPtr pScreen);
+saa_close_screen(ScreenPtr pScreen);
 
 extern _X_EXPORT Bool
 saa_gc_reads_destination(DrawablePtr pDrawable, GCPtr pGC);
diff -ur xf86-video-vmware-12.0.2/src/vmware.c xf86-video-vmware/src/vmware.c
--- xf86-video-vmware-12.0.2/src/vmware.c 2012-03-22 03:57:59.000000000 +0900
+++ xf86-video-vmware/src/vmware.c 2012-07-27 02:48:56.580460231 +0900
@@ -901,8 +901,8 @@
                                                          pScrn->pScreen->rootDepth),
                                            (pointer)(pVMWARE->FbBase + pScrn->fbOffset));
 
-        (*pScrn->EnableDisableFBAccess)(pScrn->pScreen->myNum, FALSE);
-        (*pScrn->EnableDisableFBAccess)(pScrn->pScreen->myNum, TRUE);
+        (*pScrn->EnableDisableFBAccess)(pScrn, FALSE);
+        (*pScrn->EnableDisableFBAccess)(pScrn, TRUE);
     }
 
     vgaHWProtect(pScrn, FALSE);
@@ -1089,8 +1089,9 @@
 }
 
 static Bool
-VMWARECloseScreen(int scrnIndex, ScreenPtr pScreen)
+VMWARECloseScreen(ScreenPtr pScreen)
 {
+    int scrnIndex = pScreen->myNum;
     ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
     VMWAREPtr pVMWARE = VMWAREPTR(pScrn);
     ScreenPtr save = &pVMWARE->ScrnFuncs;
@@ -1119,7 +1120,7 @@
     pScrn->DriverFunc = NULL;
 #endif
 
-    return (*pScreen->CloseScreen)(scrnIndex, pScreen);
+    return (*pScreen->CloseScreen)(pScreen);
 }
 
 static Bool
@@ -1296,8 +1297,9 @@
 }
 
 static Bool
-VMWAREScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
+VMWAREScreenInit(ScreenPtr pScreen, int argc, char **argv)
 {
+    int scrnIndex = pScreen->myNum;
     ScrnInfoPtr pScrn;
     vgaHWPtr hwp;
     VMWAREPtr pVMWARE;
@@ -1582,10 +1584,9 @@
 }
 
 static Bool
-VMWARESwitchMode(int scrnIndex, DisplayModePtr mode, int flags)
+VMWARESwitchMode(ScrnInfoPtr pScrn, DisplayModePtr mode)
 
 {
-    ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
     ScreenPtr pScreen = pScrn->pScreen;
 
     pScreen->mmWidth = (pScreen->width * VMWARE_INCHTOMM +
@@ -1597,9 +1598,8 @@
 }
 
 static Bool
-VMWAREEnterVT(int scrnIndex, int flags)
+VMWAREEnterVT(ScrnInfoPtr pScrn)
 {
-    ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
     VMWAREPtr pVMWARE = VMWAREPTR(pScrn);
 
     /*
@@ -1616,9 +1616,8 @@
 }
 
 static void
-VMWARELeaveVT(int scrnIndex, int flags)
+VMWARELeaveVT(ScrnInfoPtr pScrn)
 {
-    ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
     VMWAREPtr pVMWARE = VMWAREPTR(pScrn);
 
     /*
@@ -1631,17 +1630,17 @@
 }
 
 static void
-VMWAREFreeScreen(int scrnIndex, int flags)
+VMWAREFreeScreen(ScrnInfoPtr pScrn)
 {
     /*
      * If the vgahw module is used vgaHWFreeHWRec() would be called
      * here.
      */
-   VMWAREFreeRec(xf86Screens[scrnIndex]);
+   VMWAREFreeRec(pScrn);
 }
 
 static ModeStatus
-VMWAREValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags)
+VMWAREValidMode(ScrnInfoPtr pScrn, DisplayModePtr mode, Bool verbose, int flags)
 {
     return MODE_OK;
 }
diff -ur xf86-video-vmware-12.0.2/vmwgfx/vmwgfx_driver.c xf86-video-vmware/vmwgfx/vmwgfx_driver.c
--- xf86-video-vmware-12.0.2/vmwgfx/vmwgfx_driver.c 2012-03-09 01:13:16.000000000 +0900
+++ xf86-video-vmware/vmwgfx/vmwgfx_driver.c 2012-07-27 03:26:32.892020254 +0900
@@ -107,15 +107,15 @@
  */
 
 static Bool drv_pre_init(ScrnInfoPtr pScrn, int flags);
-static Bool drv_screen_init(int scrnIndex, ScreenPtr pScreen, int argc,
+static Bool drv_screen_init(ScreenPtr pScreen, int argc,
        char **argv);
-static Bool drv_switch_mode(int scrnIndex, DisplayModePtr mode, int flags);
-static void drv_adjust_frame(int scrnIndex, int x, int y, int flags);
-static Bool drv_enter_vt(int scrnIndex, int flags);
-static void drv_leave_vt(int scrnIndex, int flags);
-static void drv_free_screen(int scrnIndex, int flags);
-static ModeStatus drv_valid_mode(int scrnIndex, DisplayModePtr mode, Bool verbose,
-            int flags);
+static Bool drv_switch_mode(ScrnInfoPtr pScrn, DisplayModePtr mode);
+static void drv_adjust_frame(ScrnInfoPtr pScrn, int x, int y);
+static Bool drv_enter_vt(ScrnInfoPtr pScrn);
+static void drv_leave_vt(ScrnInfoPtr pScrn);
+static void drv_free_screen(ScrnInfoPtr pScrn);
+static ModeStatus drv_valid_mode(ScrnInfoPtr pScrn, DisplayModePtr mode,
+                                 Bool verbose, int flags);
 
 extern void xorg_tracker_set_functions(ScrnInfoPtr scrn);
 
@@ -133,7 +133,7 @@
  * Internal function definitions
  */
 
-static Bool drv_close_screen(int scrnIndex, ScreenPtr pScreen);
+static Bool drv_close_screen(ScreenPtr pScreen);
 
 /*
  * Internal functions
@@ -708,14 +708,13 @@
     free(pixmaps);
 }
 
-static void drv_block_handler(int i, pointer blockData, pointer pTimeout,
+static void drv_block_handler(ScreenPtr pScreen, pointer pTimeout,
                               pointer pReadmask)
 {
-    ScreenPtr pScreen = screenInfo.screens[i];
     modesettingPtr ms = modesettingPTR(xf86Screens[pScreen->myNum]);
 
     vmwgfx_swap(ms, pScreen, BlockHandler);
-    pScreen->BlockHandler(i, blockData, pTimeout, pReadmask);
+    pScreen->BlockHandler(pScreen, pTimeout, pReadmask);
     vmwgfx_swap(ms, pScreen, BlockHandler);
 
     vmwgfx_flush_dri2(pScreen);
@@ -735,9 +734,9 @@
     if (!ret)
  return ret;
 
-    drv_adjust_frame(pScrn->scrnIndex, pScrn->frameX0, pScrn->frameY0, 0);
+    drv_adjust_frame(pScrn, pScrn->frameX0, pScrn->frameY0);
 
-    return drv_enter_vt(pScreen->myNum, 1);
+    return drv_enter_vt(pScrn);
 }
 
 static Bool
@@ -902,7 +901,7 @@
 
 
 static Bool
-drv_screen_init(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
+drv_screen_init(ScreenPtr pScreen, int argc, char **argv)
 {
     ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
     modesettingPtr ms = modesettingPTR(pScrn);
@@ -1088,9 +1087,8 @@
 }
 
 static void
-drv_adjust_frame(int scrnIndex, int x, int y, int flags)
+drv_adjust_frame(ScrnInfoPtr pScrn, int x, int y)
 {
-    ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
     xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
     xf86OutputPtr output = config->output[config->compat_output];
     xf86CrtcPtr crtc = output->crtc;
@@ -1104,15 +1102,14 @@
 }
 
 static void
-drv_free_screen(int scrnIndex, int flags)
+drv_free_screen(ScrnInfoPtr pScrn)
 {
-    drv_free_rec(xf86Screens[scrnIndex]);
+    drv_free_rec(pScrn);
 }
 
 static void
-drv_leave_vt(int scrnIndex, int flags)
+drv_leave_vt(ScrnInfoPtr pScrn)
 {
-    ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
     modesettingPtr ms = modesettingPTR(pScrn);
 
     vmwgfx_cursor_bypass(ms->fd, 0, 0);
@@ -1130,10 +1127,8 @@
  * This gets called when gaining control of the VT, and from ScreenInit().
  */
 static Bool
-drv_enter_vt(int scrnIndex, int flags)
+drv_enter_vt(ScrnInfoPtr pScrn)
 {
-    ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
-
     if (!drv_set_master(pScrn))
  return FALSE;
 
@@ -1144,16 +1139,15 @@
 }
 
 static Bool
-drv_switch_mode(int scrnIndex, DisplayModePtr mode, int flags)
+drv_switch_mode(ScrnInfoPtr pScrn, DisplayModePtr mode)
 {
-    ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
-
     return xf86SetSingleMode(pScrn, mode, RR_Rotate_0);
 }
 
 static Bool
-drv_close_screen(int scrnIndex, ScreenPtr pScreen)
+drv_close_screen(ScreenPtr pScreen)
 {
+    int scrnIndex = pScreen->myNum;
     ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
     modesettingPtr ms = modesettingPTR(pScrn);
 
@@ -1166,7 +1160,7 @@
  xorg_dri2_close(pScreen);
 
     if (pScrn->vtSema)
- pScrn->LeaveVT(scrnIndex, 0);
+ pScrn->LeaveVT(pScrn);
 
     pScrn->vtSema = FALSE;
 
@@ -1180,11 +1174,11 @@
     if (ms->xat)
  xa_tracker_destroy(ms->xat);
 
-    return (*pScreen->CloseScreen) (scrnIndex, pScreen);
+    return (*pScreen->CloseScreen) (pScreen);
 }
 
 static ModeStatus
-drv_valid_mode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags)
+drv_valid_mode(ScrnInfoPtr pScrn, DisplayModePtr mode, Bool verbose, int flags)
 {
     return MODE_OK;
 }
diff -ur xf86-video-vmware-12.0.2/vmwgfx/vmwgfx_driver.h xf86-video-vmware/vmwgfx/vmwgfx_driver.h
--- xf86-video-vmware-12.0.2/vmwgfx/vmwgfx_driver.h 2012-03-09 01:13:16.000000000 +0900
+++ xf86-video-vmware/vmwgfx/vmwgfx_driver.h 2012-07-27 03:24:03.561274238 +0900
@@ -118,9 +118,9 @@
     ScreenBlockHandlerProcPtr saved_BlockHandler;
     CreateScreenResourcesProcPtr saved_CreateScreenResources;
     CloseScreenProcPtr saved_CloseScreen;
-    Bool (*saved_EnterVT)(int, int);
-    void (*saved_LeaveVT)(int, int);
-    void (*saved_AdjustFrame)(int, int, int, int);
+    Bool (*saved_EnterVT)(ScrnInfoPtr);
+    void (*saved_LeaveVT)(ScrnInfoPtr);
+    void (*saved_AdjustFrame)(ScrnInfoPtr, int, int);
     Bool (*saved_UseHWCursor)(ScreenPtr, CursorPtr);
     Bool (*saved_UseHWCursorARGB)(ScreenPtr, CursorPtr);
 

Ebuild

EAPI=4

XORG_DRI=always
inherit xorg-2

DESCRIPTION="VMware SVGA video driver"
KEYWORDS="~amd64"
IUSE=""

RDEPEND="x11-libs/libdrm[libkms,video_cards_vmware]
 media-libs/mesa[xa]
        >=x11-base/xorg-server-1.12.99.902" 
DEPEND="${RDEPEND}"

src_unpack() {
 unpack "${A}"
 cd "${S}"
 epatch "${FILESDIR}"/xorg-server-1.12.99.902.patch
}

0 件のコメント:

コメントを投稿