WineD3D: Implement detection of ATI cards with Mesa DRI drivers

Roman Mamedov roman at rm.pp.ru
Wed Nov 21 17:15:30 CST 2007


Hello.

Presently, if an ATI card uses open-source DRI drivers from the Mesa 
project ( http://dri.freedesktop.org/wiki/ATI ), Wine will report it to 
Windows applications as being some generic nVIDIA model, based on D3D 
capabilities of the card.

This patch adds detection of the used ATI video card, based on Mesa DRI 
module name, which is returned by drivers in GL Renderer string. In my 
opinion, returning even an approximate ATI card model should be better, 
than the present condition, disguising the ATI card as some equally 
generic model from nVIDIA. Also, the patch adds detection of VENDOR_MESA 
from GL Renderer string, as Mesa DRI drivers may have various things as 
GL Vendor, but the GL Renderer name always contains the string "Mesa". 
This patch resolves the bug #7267, "Lineage 2 complains about outdated 
NVIDIA drivers using ATI card with Mesa drivers" -  
http://bugs.winehq.org/show_bug.cgi?id=7267 .

---
Note:
However, the game (Lineage II C4) still does not run after applying the 
patch. Now it is displaying an error message with text "You have 
triggered a bug in the DirectX 9.0 runtime. Please install DirectX 8.1b 
(or later) for a fix", and last messages on console are:

fixme:d3d:state_patchedgestyle (WINED3DRS_PATCHEDGESTYLE,1065353216) not 
yet implemented
fixme:d3d:sampler >>>>>>>>>>>>>>>>> GL_INVALID_ENUM (0x500) from 
glActiveTextureARB @ state.c / 2286
fixme:d3d:sampler >>>>>>>>>>>>>>>>> GL_INVALID_ENUM (0x500) from 
glActiveTextureARB @ state.c / 2286
fixme:d3d:sampler >>>>>>>>>>>>>>>>> GL_INVALID_ENUM (0x500) from 
glActiveTextureARB @ state.c / 2286
fixme:d3d:sampler >>>>>>>>>>>>>>>>> GL_INVALID_ENUM (0x500) from 
glActiveTextureARB @ state.c / 2286
fixme:d3d:sampler >>>>>>>>>>>>>>>>> GL_INVALID_ENUM (0x500) from 
glActiveTextureARB @ state.c / 2286
fixme:d3d:sampler >>>>>>>>>>>>>>>>> GL_INVALID_ENUM (0x500) from 
glActiveTextureARB @ state.c / 2286
fixme:d3d:sampler >>>>>>>>>>>>>>>>> GL_INVALID_ENUM (0x500) from 
glActiveTextureARB @ state.c / 2286
fixme:d3d:sampler >>>>>>>>>>>>>>>>> GL_INVALID_ENUM (0x500) from 
glActiveTextureARB @ state.c / 2286

At this point I am not sure whether this problem could be avoided by 
changing the proposed patch in some way, or the patch itself is correct, 
and there's some kind of more global issue with Mesa DRI drivers or Wine 
D3D implementation. Perhaps someone with more Wine D3D experience could 
look into this? I would appreciate a reply. (And a working Lineage II 
too. :-)

(this is a new version of the patch I sent previously, it fixes a 
mistake in the comments)

---
 ChangeLog              |    5 +++++
 dlls/wined3d/directx.c |   36 +++++++++++++++++++++++++++++++++++-
 2 files changed, 40 insertions(+), 1 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index e7e3c72..21593f1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2007-11-22  Roman Mamedov <roman at rm.pp.ru>
+
+        * dlls/wined3d/directx.c:
+        wined3d: Implement detection of ATI cards with Mesa DRI drivers.
+
 2007-11-09  Alexandre Julliard <julliard at winehq.org>
 
     * dlls/user32/tests/dde.c:
diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c
index 36d7ebc..7e09014 100644
--- a/dlls/wined3d/directx.c
+++ b/dlls/wined3d/directx.c
@@ -5,6 +5,7 @@
  * Copyright 2003-2004 Raphael Junqueira
  * Copyright 2004 Christian Costa
  * Copyright 2005 Oliver Stieber
+ * Copyright 2007 Roman Mamedov
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -487,7 +488,8 @@ BOOL IWineD3DImpl_FillGLCaps(WineD3D_GL_Info *gl_info) {
         } else if (strstr(gl_string, "Intel(R)") ||
            strstr(gl_info->gl_renderer, "Intel(R)")) {
             gl_info->gl_vendor = VENDOR_INTEL;
-        } else if (strstr(gl_string, "Mesa")) {
+        } else if (strstr(gl_string, "Mesa") ||
+                   strstr(gl_info->gl_renderer, "Mesa")) {
             gl_info->gl_vendor = VENDOR_MESA;
         } else {
             gl_info->gl_vendor = VENDOR_WINE;
@@ -1123,6 +1125,38 @@ BOOL IWineD3DImpl_FillGLCaps(WineD3D_GL_Info 
*gl_info) {
             }
             break;
         case VENDOR_MESA:
+            /* For ATI cards, the Mesa DRI "Renderer" string does not 
contain the name of the exact card used.
+             * Instead, it contains the name of driver module, which is 
loaded for it. There are only four
+             * driver modules for whole supported ATI model range. 
Therefore, the card can only be vaguely
+             * guessed from the driver name returned. For details about 
the cards, see the VENDOR_ATI section.
+             */
+            if(strstr(gl_info->gl_renderer, "Rage 128")||
+               strstr(gl_info->gl_renderer, "R200")||
+               strstr(gl_info->gl_renderer, "R300")||
+               strstr(gl_info->gl_renderer, "Radeon"))
+            {
+                gl_info->gl_vendor = VENDOR_ATI;
+                if (strstr(gl_info->gl_renderer, "Rage 128")) { /* 
r128_dri - Rage 128  */
+                    gl_info->gl_card = CARD_ATI_RAGE_128PRO;
+                    vidmem = 16;
+                } else if (strstr(gl_info->gl_renderer, "R200")) { /* 
r200_dri - all R2xx-based cards */
+                    gl_info->gl_card = CARD_ATI_RADEON_8500;
+                    vidmem = 64;
+                } else if (strstr(gl_info->gl_renderer, "R300")) { /* 
r300_dri - all R3xx and R4xx-based cards */
+                    gl_info->gl_card = CARD_ATI_RADEON_9500;
+                    vidmem = 128;
+                } else if (strstr(gl_info->gl_renderer, "Radeon")) { /* 
radeon_dri - all R100-based cards */
+                    /* This one should be the last case, so if the word 
"Radeon" ever added to Mesa gl_renderer
+                     * string of R200 or R300, this detection code will 
keep working properly.
+                     */
+                    gl_info->gl_card = CARD_ATI_RADEON_7200;
+                    vidmem = 32;
+                }
+                break;
+            }
+            /* Card is probably one of the non-ATI cards which are also 
supported by Mesa.
+             * Continue to the fallback behavior of VENDOR_WINE.
+             */
         case VENDOR_WINE:
         default:
             /* Default to generic Nvidia hardware based on the 
supported OpenGL extensions. The choice
-- 
1.5.3.4




More information about the wine-patches mailing list