diff options
author | Jesse Barnes <jbarnes@virtuousgeek.org> | 2009-05-20 16:47:08 -0400 |
---|---|---|
committer | Eric Anholt <eric@anholt.net> | 2009-05-22 15:31:14 -0400 |
commit | 14b60391587ab9b2207c4fb6281763a93ae85e0f (patch) | |
tree | 5925182c46bd48205b28a56515c137a87fc49672 /drivers | |
parent | 8e7d2b2c6ecd3c21a54b877eae3d5be48292e6b5 (diff) |
i915: support 8xx desktop cursors
For some reason we never added 8xx desktop cursor support to the
kernel. This patch fixes that.
[krh: Also set the size on pre-i915 hw.]
Tested-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Eric Anholt <eric@anholt.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpu/drm/i915/i915_gem.c | 4 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/i915_reg.h | 17 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_display.c | 26 |
3 files changed, 39 insertions, 8 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 4a24c90fb940..717b6a854bcd 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c | |||
@@ -1145,7 +1145,7 @@ int i915_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf) | |||
1145 | mutex_unlock(&dev->struct_mutex); | 1145 | mutex_unlock(&dev->struct_mutex); |
1146 | return VM_FAULT_SIGBUS; | 1146 | return VM_FAULT_SIGBUS; |
1147 | } | 1147 | } |
1148 | list_add(&obj_priv->list, &dev_priv->mm.inactive_list); | 1148 | list_add_tail(&obj_priv->list, &dev_priv->mm.inactive_list); |
1149 | } | 1149 | } |
1150 | 1150 | ||
1151 | /* Need a new fence register? */ | 1151 | /* Need a new fence register? */ |
@@ -1375,7 +1375,7 @@ i915_gem_mmap_gtt_ioctl(struct drm_device *dev, void *data, | |||
1375 | mutex_unlock(&dev->struct_mutex); | 1375 | mutex_unlock(&dev->struct_mutex); |
1376 | return ret; | 1376 | return ret; |
1377 | } | 1377 | } |
1378 | list_add(&obj_priv->list, &dev_priv->mm.inactive_list); | 1378 | list_add_tail(&obj_priv->list, &dev_priv->mm.inactive_list); |
1379 | } | 1379 | } |
1380 | 1380 | ||
1381 | drm_gem_object_unreference(obj); | 1381 | drm_gem_object_unreference(obj); |
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h index 15da44cf21b1..9668cc0d7f4e 100644 --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h | |||
@@ -1410,9 +1410,25 @@ | |||
1410 | 1410 | ||
1411 | /* Cursor A & B regs */ | 1411 | /* Cursor A & B regs */ |
1412 | #define CURACNTR 0x70080 | 1412 | #define CURACNTR 0x70080 |
1413 | /* Old style CUR*CNTR flags (desktop 8xx) */ | ||
1414 | #define CURSOR_ENABLE 0x80000000 | ||
1415 | #define CURSOR_GAMMA_ENABLE 0x40000000 | ||
1416 | #define CURSOR_STRIDE_MASK 0x30000000 | ||
1417 | #define CURSOR_FORMAT_SHIFT 24 | ||
1418 | #define CURSOR_FORMAT_MASK (0x07 << CURSOR_FORMAT_SHIFT) | ||
1419 | #define CURSOR_FORMAT_2C (0x00 << CURSOR_FORMAT_SHIFT) | ||
1420 | #define CURSOR_FORMAT_3C (0x01 << CURSOR_FORMAT_SHIFT) | ||
1421 | #define CURSOR_FORMAT_4C (0x02 << CURSOR_FORMAT_SHIFT) | ||
1422 | #define CURSOR_FORMAT_ARGB (0x04 << CURSOR_FORMAT_SHIFT) | ||
1423 | #define CURSOR_FORMAT_XRGB (0x05 << CURSOR_FORMAT_SHIFT) | ||
1424 | /* New style CUR*CNTR flags */ | ||
1425 | #define CURSOR_MODE 0x27 | ||
1413 | #define CURSOR_MODE_DISABLE 0x00 | 1426 | #define CURSOR_MODE_DISABLE 0x00 |
1414 | #define CURSOR_MODE_64_32B_AX 0x07 | 1427 | #define CURSOR_MODE_64_32B_AX 0x07 |
1415 | #define CURSOR_MODE_64_ARGB_AX ((1 << 5) | CURSOR_MODE_64_32B_AX) | 1428 | #define CURSOR_MODE_64_ARGB_AX ((1 << 5) | CURSOR_MODE_64_32B_AX) |
1429 | #define MCURSOR_PIPE_SELECT (1 << 28) | ||
1430 | #define MCURSOR_PIPE_A 0x00 | ||
1431 | #define MCURSOR_PIPE_B (1 << 28) | ||
1416 | #define MCURSOR_GAMMA_ENABLE (1 << 26) | 1432 | #define MCURSOR_GAMMA_ENABLE (1 << 26) |
1417 | #define CURABASE 0x70084 | 1433 | #define CURABASE 0x70084 |
1418 | #define CURAPOS 0x70088 | 1434 | #define CURAPOS 0x70088 |
@@ -1420,6 +1436,7 @@ | |||
1420 | #define CURSOR_POS_SIGN 0x8000 | 1436 | #define CURSOR_POS_SIGN 0x8000 |
1421 | #define CURSOR_X_SHIFT 0 | 1437 | #define CURSOR_X_SHIFT 0 |
1422 | #define CURSOR_Y_SHIFT 16 | 1438 | #define CURSOR_Y_SHIFT 16 |
1439 | #define CURSIZE 0x700a0 | ||
1423 | #define CURBCNTR 0x700c0 | 1440 | #define CURBCNTR 0x700c0 |
1424 | #define CURBBASE 0x700c4 | 1441 | #define CURBBASE 0x700c4 |
1425 | #define CURBPOS 0x700c8 | 1442 | #define CURBPOS 0x700c8 |
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 3387cf32f385..c9d6f10ba92e 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -1357,7 +1357,7 @@ static int intel_crtc_cursor_set(struct drm_crtc *crtc, | |||
1357 | int pipe = intel_crtc->pipe; | 1357 | int pipe = intel_crtc->pipe; |
1358 | uint32_t control = (pipe == 0) ? CURACNTR : CURBCNTR; | 1358 | uint32_t control = (pipe == 0) ? CURACNTR : CURBCNTR; |
1359 | uint32_t base = (pipe == 0) ? CURABASE : CURBBASE; | 1359 | uint32_t base = (pipe == 0) ? CURABASE : CURBBASE; |
1360 | uint32_t temp; | 1360 | uint32_t temp = I915_READ(control); |
1361 | size_t addr; | 1361 | size_t addr; |
1362 | int ret; | 1362 | int ret; |
1363 | 1363 | ||
@@ -1366,7 +1366,12 @@ static int intel_crtc_cursor_set(struct drm_crtc *crtc, | |||
1366 | /* if we want to turn off the cursor ignore width and height */ | 1366 | /* if we want to turn off the cursor ignore width and height */ |
1367 | if (!handle) { | 1367 | if (!handle) { |
1368 | DRM_DEBUG("cursor off\n"); | 1368 | DRM_DEBUG("cursor off\n"); |
1369 | temp = CURSOR_MODE_DISABLE; | 1369 | if (IS_MOBILE(dev) || IS_I9XX(dev)) { |
1370 | temp &= ~(CURSOR_MODE | MCURSOR_GAMMA_ENABLE); | ||
1371 | temp |= CURSOR_MODE_DISABLE; | ||
1372 | } else { | ||
1373 | temp &= ~(CURSOR_ENABLE | CURSOR_GAMMA_ENABLE); | ||
1374 | } | ||
1370 | addr = 0; | 1375 | addr = 0; |
1371 | bo = NULL; | 1376 | bo = NULL; |
1372 | mutex_lock(&dev->struct_mutex); | 1377 | mutex_lock(&dev->struct_mutex); |
@@ -1409,10 +1414,19 @@ static int intel_crtc_cursor_set(struct drm_crtc *crtc, | |||
1409 | addr = obj_priv->phys_obj->handle->busaddr; | 1414 | addr = obj_priv->phys_obj->handle->busaddr; |
1410 | } | 1415 | } |
1411 | 1416 | ||
1412 | temp = 0; | 1417 | if (!IS_I9XX(dev)) |
1413 | /* set the pipe for the cursor */ | 1418 | I915_WRITE(CURSIZE, (height << 12) | width); |
1414 | temp |= (pipe << 28); | 1419 | |
1415 | temp |= CURSOR_MODE_64_ARGB_AX | MCURSOR_GAMMA_ENABLE; | 1420 | /* Hooray for CUR*CNTR differences */ |
1421 | if (IS_MOBILE(dev) || IS_I9XX(dev)) { | ||
1422 | temp &= ~(CURSOR_MODE | MCURSOR_PIPE_SELECT); | ||
1423 | temp |= CURSOR_MODE_64_ARGB_AX | MCURSOR_GAMMA_ENABLE; | ||
1424 | temp |= (pipe << 28); /* Connect to correct pipe */ | ||
1425 | } else { | ||
1426 | temp &= ~(CURSOR_FORMAT_MASK); | ||
1427 | temp |= CURSOR_ENABLE; | ||
1428 | temp |= CURSOR_FORMAT_ARGB | CURSOR_GAMMA_ENABLE; | ||
1429 | } | ||
1416 | 1430 | ||
1417 | finish: | 1431 | finish: |
1418 | I915_WRITE(control, temp); | 1432 | I915_WRITE(control, temp); |