diff options
author | Dave Airlie <airlied@redhat.com> | 2007-08-06 19:09:51 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-08-06 20:46:23 -0400 |
commit | 21f16289270447673a7263ccc0b22d562fb01ecb (patch) | |
tree | bce93b4ae8d9a0c259bb6f21f45494aa73d9e2e5 /drivers/char/drm | |
parent | d4ac2477fad0f2680e84ec12e387ce67682c5c13 (diff) |
drm/i915: Fix i965 secured batchbuffer usage
This 965G and above chipsets moved the batch buffer non-secure bits to
another place. This means that previous drm's allowed in-secure batchbuffers
to be submitted to the hardware from non-privileged users who are logged
into X and and have access to direct rendering.
Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/char/drm')
-rw-r--r-- | drivers/char/drm/i915_dma.c | 14 | ||||
-rw-r--r-- | drivers/char/drm/i915_drv.h | 1 |
2 files changed, 12 insertions, 3 deletions
diff --git a/drivers/char/drm/i915_dma.c b/drivers/char/drm/i915_dma.c index 3359cc2b9736..8e7d713a5a15 100644 --- a/drivers/char/drm/i915_dma.c +++ b/drivers/char/drm/i915_dma.c | |||
@@ -184,6 +184,8 @@ static int i915_initialize(struct drm_device * dev, | |||
184 | * private backbuffer/depthbuffer usage. | 184 | * private backbuffer/depthbuffer usage. |
185 | */ | 185 | */ |
186 | dev_priv->use_mi_batchbuffer_start = 0; | 186 | dev_priv->use_mi_batchbuffer_start = 0; |
187 | if (IS_I965G(dev)) /* 965 doesn't support older method */ | ||
188 | dev_priv->use_mi_batchbuffer_start = 1; | ||
187 | 189 | ||
188 | /* Allow hardware batchbuffers unless told otherwise. | 190 | /* Allow hardware batchbuffers unless told otherwise. |
189 | */ | 191 | */ |
@@ -517,8 +519,13 @@ static int i915_dispatch_batchbuffer(struct drm_device * dev, | |||
517 | 519 | ||
518 | if (dev_priv->use_mi_batchbuffer_start) { | 520 | if (dev_priv->use_mi_batchbuffer_start) { |
519 | BEGIN_LP_RING(2); | 521 | BEGIN_LP_RING(2); |
520 | OUT_RING(MI_BATCH_BUFFER_START | (2 << 6)); | 522 | if (IS_I965G(dev)) { |
521 | OUT_RING(batch->start | MI_BATCH_NON_SECURE); | 523 | OUT_RING(MI_BATCH_BUFFER_START | (2 << 6) | MI_BATCH_NON_SECURE_I965); |
524 | OUT_RING(batch->start); | ||
525 | } else { | ||
526 | OUT_RING(MI_BATCH_BUFFER_START | (2 << 6)); | ||
527 | OUT_RING(batch->start | MI_BATCH_NON_SECURE); | ||
528 | } | ||
522 | ADVANCE_LP_RING(); | 529 | ADVANCE_LP_RING(); |
523 | } else { | 530 | } else { |
524 | BEGIN_LP_RING(4); | 531 | BEGIN_LP_RING(4); |
@@ -735,7 +742,8 @@ static int i915_setparam(DRM_IOCTL_ARGS) | |||
735 | 742 | ||
736 | switch (param.param) { | 743 | switch (param.param) { |
737 | case I915_SETPARAM_USE_MI_BATCHBUFFER_START: | 744 | case I915_SETPARAM_USE_MI_BATCHBUFFER_START: |
738 | dev_priv->use_mi_batchbuffer_start = param.value; | 745 | if (!IS_I965G(dev)) |
746 | dev_priv->use_mi_batchbuffer_start = param.value; | ||
739 | break; | 747 | break; |
740 | case I915_SETPARAM_TEX_LRU_LOG_GRANULARITY: | 748 | case I915_SETPARAM_TEX_LRU_LOG_GRANULARITY: |
741 | dev_priv->tex_lru_log_granularity = param.value; | 749 | dev_priv->tex_lru_log_granularity = param.value; |
diff --git a/drivers/char/drm/i915_drv.h b/drivers/char/drm/i915_drv.h index fd918565f4e5..737088bd0780 100644 --- a/drivers/char/drm/i915_drv.h +++ b/drivers/char/drm/i915_drv.h | |||
@@ -282,6 +282,7 @@ extern int i915_wait_ring(struct drm_device * dev, int n, const char *caller); | |||
282 | #define MI_BATCH_BUFFER_START (0x31<<23) | 282 | #define MI_BATCH_BUFFER_START (0x31<<23) |
283 | #define MI_BATCH_BUFFER_END (0xA<<23) | 283 | #define MI_BATCH_BUFFER_END (0xA<<23) |
284 | #define MI_BATCH_NON_SECURE (1) | 284 | #define MI_BATCH_NON_SECURE (1) |
285 | #define MI_BATCH_NON_SECURE_I965 (1<<8) | ||
285 | 286 | ||
286 | #define MI_WAIT_FOR_EVENT ((0x3<<23)) | 287 | #define MI_WAIT_FOR_EVENT ((0x3<<23)) |
287 | #define MI_WAIT_FOR_PLANE_A_FLIP (1<<2) | 288 | #define MI_WAIT_FOR_PLANE_A_FLIP (1<<2) |