Hello Sirs:
    This patch is to solve the video hang issue caused by verification 
function. These 3 patches has been verified in (1) CX700M platform (2) CLE266 
platform (3) K8M800 platform (4) CN400 platform with UniChrome/OpenChrome 
driver except few of these platform is not supported by UniChrome such as CX700 
chipset.

Signed-off-by Bruce C. Chang <brucech...@via.com.tw>

diff -ruN old/drivers/gpu/drm/via/via_3d_reg.h 
new/drivers/gpu/drm/via/via_3d_reg.h
--- old/drivers/gpu/drm/via/via_3d_reg.h        2009-10-22 13:01:06.000000000 
+0800
+++ new/drivers/gpu/drm/via/via_3d_reg.h        2009-10-22 13:11:31.000000000 
+0800
@@ -1647,4 +1647,6 @@
 #define VIA_VIDEO_HEADER6       0xFE050000
 #define VIA_VIDEO_HEADER7       0xFE060000
 #define VIA_VIDEOMASK           0xFFFF0000
+#define INV_DUMMY_MASK         0xFF000000
+#define HALCYON_HEADER_MASK     0xFE000000
 #endif
diff -ruN old/drivers/gpu/drm/via/via_verifier.c 
new/drivers/gpu/drm/via/via_verifier.c
--- old/drivers/gpu/drm/via/via_verifier.c      2009-10-22 13:01:06.000000000 
+0800
+++ new/drivers/gpu/drm/via/via_verifier.c      2009-10-22 13:05:49.000000000 
+0800
@@ -227,7 +227,10 @@
        {0xf2, check_for_header2_err},
        {0xf0, check_for_header1_err},
        {0xcc, check_for_dummy},
-       {0x00, check_number_texunits}
+       {0x00, check_number_texunits},
+       {0x01, no_check},
+       {0x02, no_check},
+       {0x03, no_check}
 };
 
 static hazard_t table1[256];
@@ -768,11 +771,12 @@
                DRM_ERROR("Invalid VIDEO DMA command. "
                          "Attempt to access 3D- or command burst area.\n");
                return 1;
-       } else if ((address > 0xCFF) && (address < 0x1300)) {
+       } else if ((address > 0xDFF) && (address < 0x1200)) {
                DRM_ERROR("Invalid VIDEO DMA command. "
                          "Attempt to access PCI DMA area.\n");
                return 1;
-       } else if (address > 0x13FF) {
+       } else if (((address > 0x13FF) && (address < 0x2200)) ||
+               (address > 0x33ff)) {
                DRM_ERROR("Invalid VIDEO DMA command. "
                          "Attempt to access VGA registers.\n");
                return 1;
@@ -791,10 +795,11 @@
                return 1;
        }
        while (dwords--) {
-               if (*buf++) {
+               if (*buf && !is_dummy_cmd(*buf)) {
                        DRM_ERROR("Illegal video command tail.\n");
                        return 1;
                }
+               buf++;
        }
        *buffer = buf;
        return 0;
diff -ruN old/drivers/gpu/drm/via/via_verifier.h 
new/drivers/gpu/drm/via/via_verifier.h
--- old/drivers/gpu/drm/via/via_verifier.h      2009-10-22 13:01:06.000000000 
+0800
+++ new/drivers/gpu/drm/via/via_verifier.h      2009-10-22 13:05:49.000000000 
+0800
@@ -25,7 +25,7 @@
 
 #ifndef _VIA_VERIFIER_H_
 #define _VIA_VERIFIER_H_
-
+#include "via_3d_reg.h"
 typedef enum {
        no_sequence = 0,
        z_address,
@@ -59,4 +59,31 @@
 extern int via_parse_command_stream(struct drm_device *dev, const uint32_t 
*buf,
                                    unsigned int size);
 
+static inline int is_agp_header(unsigned int data)
+{
+       if (data == HALCYON_HEADER2)
+               return 1;
+       else if ((data & VIA_VIDEOMASK) == VIA_VIDEO_HEADER5)
+               ;
+       else if ((data & VIA_VIDEOMASK) == VIA_VIDEO_HEADER6)
+               ;
+       else if ((data & HALCYON_HEADER_MASK) == HALCYON_HEADER1)
+               ;
+       else
+               return 0;
+
+       return 1;
+}
+
+static inline int is_dummy_cmd(uint32_t cmd)
+{
+               if ((cmd & INV_DUMMY_MASK) == 0xCC000000 ||
+                       (cmd & INV_DUMMY_MASK) == 0xCD000000 ||
+                       (cmd & INV_DUMMY_MASK) == 0xCE000000 ||
+                       (cmd & INV_DUMMY_MASK) == 0xCF000000 ||
+                       (cmd & INV_DUMMY_MASK) == 0xDD000000)
+                       return 1;
+               return 0;
+}
+
 #endif

Thanks and Best Regards 
=================================================
Bruce C. Chang(張祖明)
VIA Technologies, Inc. 
Address: 1F, 531, Chung-Cheng Road, Hsin-Tien, 231 Taipei
Tel: +886-2-22185452 Ext 7323
Mobile: +886-968343824
Fax: +886-2-22186282
Skype: Bruce.C.Chang
Email: brucech...@via.com.tw
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
--
_______________________________________________
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel

Reply via email to