drm/i915: Add contexts for HSW
authorBen Widawsky <ben@bwidawsk.net>
Wed, 25 Jul 2012 03:47:30 +0000 (20:47 -0700)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Wed, 25 Jul 2012 16:23:56 +0000 (18:23 +0200)
Basic context support on HSW is no different than previous generations.
The size of the context object changes, but that's about it.

Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/i915_gem_context.c
drivers/gpu/drm/i915/i915_reg.h

index 5d0d6ad489e221caf7f25e715673166567c9e32e..5c2d354cebbd744daeb77a39fa06485053514159 100644 (file)
@@ -112,7 +112,10 @@ static int get_context_size(struct drm_device *dev)
                break;
        case 7:
                reg = I915_READ(GEN7_CXT_SIZE);
-               ret = GEN7_CXT_TOTAL_SIZE(reg) * 64;
+               if (IS_HASWELL(dev))
+                       ret = HSW_CXT_TOTAL_SIZE(reg) * 64;
+               else
+                       ret = GEN7_CXT_TOTAL_SIZE(reg) * 64;
                break;
        default:
                BUG();
index 81a3de6b093ce95d49117d21f1c4d189cb683f1d..1310caaaafd616e6d96e49a28e6594a55b19975c 100644 (file)
                                         GEN7_CXT_EXTENDED_SIZE(ctx_reg) + \
                                         GEN7_CXT_GT1_SIZE(ctx_reg) + \
                                         GEN7_CXT_VFSTATE_SIZE(ctx_reg))
+#define HSW_CXT_POWER_SIZE(ctx_reg)    ((ctx_reg >> 26) & 0x3f)
+#define HSW_CXT_RING_SIZE(ctx_reg)     ((ctx_reg >> 23) & 0x7)
+#define HSW_CXT_RENDER_SIZE(ctx_reg)   ((ctx_reg >> 15) & 0xff)
+#define HSW_CXT_TOTAL_SIZE(ctx_reg)    (HSW_CXT_POWER_SIZE(ctx_reg) + \
+                                        HSW_CXT_RING_SIZE(ctx_reg) + \
+                                        HSW_CXT_RENDER_SIZE(ctx_reg) + \
+                                        GEN7_CXT_VFSTATE_SIZE(ctx_reg))
+
 
 /*
  * Overlay regs