diff options
author | Alex Deucher <alexander.deucher@amd.com> | 2012-08-31 18:17:24 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2013-06-28 14:40:56 -0400 |
commit | ebc32b27af25b23604e725eb50d844a8d26116bb (patch) | |
tree | 767d829df948c656ae7b74a26ccdb02466e4dbd2 | |
parent | 4adaea996454b1ad5185f9c0f37667dbfc266495 (diff) |
radeon: update cursor handling for CIK
CIK asics have 128x128 hw cursors
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r-- | src/drmmode_display.c | 15 | ||||
-rw-r--r-- | src/radeon.h | 10 | ||||
-rw-r--r-- | src/radeon_kms.c | 20 |
3 files changed, 37 insertions, 8 deletions
diff --git a/src/drmmode_display.c b/src/drmmode_display.c index e342de71..3a0187e7 100644 --- a/src/drmmode_display.c +++ b/src/drmmode_display.c @@ -584,14 +584,17 @@ drmmode_set_cursor_position (xf86CrtcPtr crtc, int x, int y) static void drmmode_load_cursor_argb (xf86CrtcPtr crtc, CARD32 *image) { + ScrnInfoPtr pScrn = crtc->scrn; + RADEONInfoPtr info = RADEONPTR(pScrn); drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; int i; uint32_t *ptr; + uint32_t cursor_size = info->cursor_w * info->cursor_h; /* cursor should be mapped already */ ptr = (uint32_t *)(drmmode_crtc->cursor_bo->ptr); - for (i = 0; i < 64 * 64; i++) + for (i = 0; i < cursor_size; i++) ptr[i] = cpu_to_le32(image[i]); } @@ -599,21 +602,27 @@ drmmode_load_cursor_argb (xf86CrtcPtr crtc, CARD32 *image) static void drmmode_hide_cursor (xf86CrtcPtr crtc) { + ScrnInfoPtr pScrn = crtc->scrn; + RADEONInfoPtr info = RADEONPTR(pScrn); drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; drmmode_ptr drmmode = drmmode_crtc->drmmode; - drmModeSetCursor(drmmode->fd, drmmode_crtc->mode_crtc->crtc_id, 0, 64, 64); + drmModeSetCursor(drmmode->fd, drmmode_crtc->mode_crtc->crtc_id, 0, + info->cursor_w, info->cursor_h); } static void drmmode_show_cursor (xf86CrtcPtr crtc) { + ScrnInfoPtr pScrn = crtc->scrn; + RADEONInfoPtr info = RADEONPTR(pScrn); drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; drmmode_ptr drmmode = drmmode_crtc->drmmode; uint32_t handle = drmmode_crtc->cursor_bo->handle; - drmModeSetCursor(drmmode->fd, drmmode_crtc->mode_crtc->crtc_id, handle, 64, 64); + drmModeSetCursor(drmmode->fd, drmmode_crtc->mode_crtc->crtc_id, handle, + info->cursor_w, info->cursor_h); } static void * diff --git a/src/radeon.h b/src/radeon.h index 36665b10..912e24d7 100644 --- a/src/radeon.h +++ b/src/radeon.h @@ -235,6 +235,12 @@ typedef enum { (info->ChipFamily == CHIP_FAMILY_RS300) || \ (info->ChipFamily == CHIP_FAMILY_R200)) +#define CURSOR_WIDTH 64 +#define CURSOR_HEIGHT 64 + +#define CURSOR_WIDTH_CIK 128 +#define CURSOR_HEIGHT_CIK 128 + struct radeon_exa_pixmap_priv { struct radeon_bo *bo; uint32_t tiling_flags; @@ -473,6 +479,10 @@ typedef struct { /* Perform vsync'ed SwapBuffers? */ Bool swapBuffersWait; + + /* cursor size */ + int cursor_w; + int cursor_h; } RADEONInfoRec, *RADEONInfoPtr; /* radeon_accel.c */ diff --git a/src/radeon_kms.c b/src/radeon_kms.c index 9783c932..c3f50d59 100644 --- a/src/radeon_kms.c +++ b/src/radeon_kms.c @@ -51,9 +51,6 @@ #include "radeon_chipinfo_gen.h" -#define CURSOR_WIDTH 64 -#define CURSOR_HEIGHT 64 - #include "radeon_bo_gem.h" #include "radeon_cs_gem.h" #include "radeon_vbo.h" @@ -946,6 +943,15 @@ Bool RADEONPreInit_KMS(ScrnInfoPtr pScrn, int flags) } } + /* set cursor size */ + if (info->ChipFamily >= CHIP_FAMILY_BONAIRE) { + info->cursor_w = CURSOR_WIDTH_CIK; + info->cursor_h = CURSOR_HEIGHT_CIK; + } else { + info->cursor_w = CURSOR_WIDTH; + info->cursor_h = CURSOR_HEIGHT; + } + { struct drm_radeon_gem_info mminfo; @@ -1016,7 +1022,10 @@ Bool RADEONPreInit_KMS(ScrnInfoPtr pScrn, int flags) static Bool RADEONCursorInit_KMS(ScreenPtr pScreen) { - return xf86_cursors_init (pScreen, CURSOR_WIDTH, CURSOR_HEIGHT, + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); + RADEONInfoPtr info = RADEONPTR(pScrn); + + return xf86_cursors_init (pScreen, info->cursor_w, info->cursor_h, (HARDWARE_CURSOR_TRUECOLOR_AT_8BPP | HARDWARE_CURSOR_AND_SOURCE_WITH_MASK | HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_1 | @@ -1532,9 +1541,10 @@ static Bool radeon_setup_kernel_mem(ScreenPtr pScreen) info->front_surface = surface; } { - int cursor_size = 64 * 4 * 64; + int cursor_size; int c; + cursor_size = info->cursor_w * info->cursor_h * 4; cursor_size = RADEON_ALIGN(cursor_size, RADEON_GPU_PAGE_SIZE); for (c = 0; c < xf86_config->num_crtc; c++) { /* cursor objects */ |