Commit 14b60391 authored by Jesse Barnes's avatar Jesse Barnes Committed by Eric Anholt

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: default avatarKristian Høgsberg <krh@redhat.com>
Signed-off-by: default avatarJesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: default avatarEric Anholt <eric@anholt.net>
parent 8e7d2b2c
...@@ -1145,7 +1145,7 @@ int i915_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf) ...@@ -1145,7 +1145,7 @@ int i915_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
mutex_unlock(&dev->struct_mutex); mutex_unlock(&dev->struct_mutex);
return VM_FAULT_SIGBUS; return VM_FAULT_SIGBUS;
} }
list_add(&obj_priv->list, &dev_priv->mm.inactive_list); list_add_tail(&obj_priv->list, &dev_priv->mm.inactive_list);
} }
/* Need a new fence register? */ /* Need a new fence register? */
...@@ -1375,7 +1375,7 @@ i915_gem_mmap_gtt_ioctl(struct drm_device *dev, void *data, ...@@ -1375,7 +1375,7 @@ i915_gem_mmap_gtt_ioctl(struct drm_device *dev, void *data,
mutex_unlock(&dev->struct_mutex); mutex_unlock(&dev->struct_mutex);
return ret; return ret;
} }
list_add(&obj_priv->list, &dev_priv->mm.inactive_list); list_add_tail(&obj_priv->list, &dev_priv->mm.inactive_list);
} }
drm_gem_object_unreference(obj); drm_gem_object_unreference(obj);
......
...@@ -1410,9 +1410,25 @@ ...@@ -1410,9 +1410,25 @@
/* Cursor A & B regs */ /* Cursor A & B regs */
#define CURACNTR 0x70080 #define CURACNTR 0x70080
/* Old style CUR*CNTR flags (desktop 8xx) */
#define CURSOR_ENABLE 0x80000000
#define CURSOR_GAMMA_ENABLE 0x40000000
#define CURSOR_STRIDE_MASK 0x30000000
#define CURSOR_FORMAT_SHIFT 24
#define CURSOR_FORMAT_MASK (0x07 << CURSOR_FORMAT_SHIFT)
#define CURSOR_FORMAT_2C (0x00 << CURSOR_FORMAT_SHIFT)
#define CURSOR_FORMAT_3C (0x01 << CURSOR_FORMAT_SHIFT)
#define CURSOR_FORMAT_4C (0x02 << CURSOR_FORMAT_SHIFT)
#define CURSOR_FORMAT_ARGB (0x04 << CURSOR_FORMAT_SHIFT)
#define CURSOR_FORMAT_XRGB (0x05 << CURSOR_FORMAT_SHIFT)
/* New style CUR*CNTR flags */
#define CURSOR_MODE 0x27
#define CURSOR_MODE_DISABLE 0x00 #define CURSOR_MODE_DISABLE 0x00
#define CURSOR_MODE_64_32B_AX 0x07 #define CURSOR_MODE_64_32B_AX 0x07
#define CURSOR_MODE_64_ARGB_AX ((1 << 5) | CURSOR_MODE_64_32B_AX) #define CURSOR_MODE_64_ARGB_AX ((1 << 5) | CURSOR_MODE_64_32B_AX)
#define MCURSOR_PIPE_SELECT (1 << 28)
#define MCURSOR_PIPE_A 0x00
#define MCURSOR_PIPE_B (1 << 28)
#define MCURSOR_GAMMA_ENABLE (1 << 26) #define MCURSOR_GAMMA_ENABLE (1 << 26)
#define CURABASE 0x70084 #define CURABASE 0x70084
#define CURAPOS 0x70088 #define CURAPOS 0x70088
...@@ -1420,6 +1436,7 @@ ...@@ -1420,6 +1436,7 @@
#define CURSOR_POS_SIGN 0x8000 #define CURSOR_POS_SIGN 0x8000
#define CURSOR_X_SHIFT 0 #define CURSOR_X_SHIFT 0
#define CURSOR_Y_SHIFT 16 #define CURSOR_Y_SHIFT 16
#define CURSIZE 0x700a0
#define CURBCNTR 0x700c0 #define CURBCNTR 0x700c0
#define CURBBASE 0x700c4 #define CURBBASE 0x700c4
#define CURBPOS 0x700c8 #define CURBPOS 0x700c8
......
...@@ -1357,7 +1357,7 @@ static int intel_crtc_cursor_set(struct drm_crtc *crtc, ...@@ -1357,7 +1357,7 @@ static int intel_crtc_cursor_set(struct drm_crtc *crtc,
int pipe = intel_crtc->pipe; int pipe = intel_crtc->pipe;
uint32_t control = (pipe == 0) ? CURACNTR : CURBCNTR; uint32_t control = (pipe == 0) ? CURACNTR : CURBCNTR;
uint32_t base = (pipe == 0) ? CURABASE : CURBBASE; uint32_t base = (pipe == 0) ? CURABASE : CURBBASE;
uint32_t temp; uint32_t temp = I915_READ(control);
size_t addr; size_t addr;
int ret; int ret;
...@@ -1366,7 +1366,12 @@ static int intel_crtc_cursor_set(struct drm_crtc *crtc, ...@@ -1366,7 +1366,12 @@ static int intel_crtc_cursor_set(struct drm_crtc *crtc,
/* if we want to turn off the cursor ignore width and height */ /* if we want to turn off the cursor ignore width and height */
if (!handle) { if (!handle) {
DRM_DEBUG("cursor off\n"); DRM_DEBUG("cursor off\n");
temp = CURSOR_MODE_DISABLE; if (IS_MOBILE(dev) || IS_I9XX(dev)) {
temp &= ~(CURSOR_MODE | MCURSOR_GAMMA_ENABLE);
temp |= CURSOR_MODE_DISABLE;
} else {
temp &= ~(CURSOR_ENABLE | CURSOR_GAMMA_ENABLE);
}
addr = 0; addr = 0;
bo = NULL; bo = NULL;
mutex_lock(&dev->struct_mutex); mutex_lock(&dev->struct_mutex);
...@@ -1409,10 +1414,19 @@ static int intel_crtc_cursor_set(struct drm_crtc *crtc, ...@@ -1409,10 +1414,19 @@ static int intel_crtc_cursor_set(struct drm_crtc *crtc,
addr = obj_priv->phys_obj->handle->busaddr; addr = obj_priv->phys_obj->handle->busaddr;
} }
temp = 0; if (!IS_I9XX(dev))
/* set the pipe for the cursor */ I915_WRITE(CURSIZE, (height << 12) | width);
temp |= (pipe << 28);
temp |= CURSOR_MODE_64_ARGB_AX | MCURSOR_GAMMA_ENABLE; /* Hooray for CUR*CNTR differences */
if (IS_MOBILE(dev) || IS_I9XX(dev)) {
temp &= ~(CURSOR_MODE | MCURSOR_PIPE_SELECT);
temp |= CURSOR_MODE_64_ARGB_AX | MCURSOR_GAMMA_ENABLE;
temp |= (pipe << 28); /* Connect to correct pipe */
} else {
temp &= ~(CURSOR_FORMAT_MASK);
temp |= CURSOR_ENABLE;
temp |= CURSOR_FORMAT_ARGB | CURSOR_GAMMA_ENABLE;
}
finish: finish:
I915_WRITE(control, temp); I915_WRITE(control, temp);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment