]> git.hungrycats.org Git - linux/commitdiff
drm: correct i915 packet length calculations
authorDave Airlie <airlied@starflyer.(none)>
Thu, 9 Sep 2004 05:32:32 +0000 (15:32 +1000)
committerDave Airlie <airlied@starflyer.(none)>
Thu, 9 Sep 2004 05:32:32 +0000 (15:32 +1000)
Correct a couple of packet length calculations.

From: Keith Whitwell
Signed-off-by: Dave Airlie <airlied@linux.ie>
drivers/char/drm/i915_dma.c

index 66db553d0ada453b48b30a427263166a36e81949..27a83fb60697556fefa2dae76657c443cbe87086 100644 (file)
@@ -296,7 +296,14 @@ static int do_validate_cmd(int cmd)
                case 0x1c:
                        return 1;
                case 0x1d:
-                       return (cmd & 0xffff) + 2;
+                       switch ((cmd>>16)&0xff) {
+                       case 0x3:
+                               return (cmd & 0x1f) + 2;
+                       case 0x4:
+                               return (cmd & 0xf) + 2;
+                       default:
+                               return (cmd & 0xffff) + 2;
+                       }
                case 0x1e:
                        if (cmd & (1 << 23))
                                return (cmd & 0xffff) + 1;