diff options
author | Keith Packard <keithp@keithp.com> | 2009-08-25 18:35:54 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2009-08-25 18:37:45 -0700 |
commit | 2786a66719a6dbb735eb7c551c412475c30ffa51 (patch) | |
tree | 7298862e468a6d2f301a4056638761317fd91534 | |
parent | e51126c57132492c664f86981c55b166dbb54c79 (diff) |
KMS: allocate one bo per crtc for cursor
The KMS API doesn't provide for sharing a single bo for multiple
cursor images, so allocate one bo for each crtc to hold the cursor
image. KMS also only supports ARGB cursors, so don't bother to
allocate buffers for two color cursors.
Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r-- | src/drmmode_display.c | 16 | ||||
-rw-r--r-- | src/i830.h | 2 | ||||
-rw-r--r-- | src/i830_memory.c | 51 |
3 files changed, 42 insertions, 27 deletions
diff --git a/src/drmmode_display.c b/src/drmmode_display.c index 404f8b94..24c76591 100644 --- a/src/drmmode_display.c +++ b/src/drmmode_display.c @@ -423,4 +423,3 @@ drmmode_load_cursor_argb (xf86CrtcPtr crtc, CARD32 *image) { - ScrnInfoPtr pScrn = crtc->scrn; - I830Ptr pI830 = I830PTR(pScrn); + drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; int ret; @@ -428,3 +427,3 @@ drmmode_load_cursor_argb (xf86CrtcPtr crtc, CARD32 *image) /* cursor should be mapped already */ - ret = dri_bo_subdata(pI830->cursor_mem->bo, 0, 64*64*4, image); + ret = dri_bo_subdata(drmmode_crtc->cursor, 0, 64*64*4, image); if (ret) @@ -452,7 +451,5 @@ drmmode_show_cursor (xf86CrtcPtr crtc) drmmode_ptr drmmode = drmmode_crtc->drmmode; - ScrnInfoPtr pScrn = crtc->scrn; - I830Ptr pI830 = I830PTR(pScrn); drmModeSetCursor(drmmode->fd, drmmode_crtc->mode_crtc->crtc_id, - pI830->cursor_mem->bo->handle, 64, 64); + drmmode_crtc->cursor->handle, 64, 64); } @@ -602,2 +599,9 @@ drmmode_crtc_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int num) +void +drmmode_crtc_set_cursor_bo(xf86CrtcPtr crtc, dri_bo *cursor) +{ + drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; + drmmode_crtc->cursor = cursor; +} + static xf86OutputStatus @@ -695,2 +695,4 @@ extern int drmmode_get_pipe_from_crtc_id(drm_intel_bufmgr *bufmgr, xf86CrtcPtr c extern int drmmode_output_dpms_status(xf86OutputPtr output); +void +drmmode_crtc_set_cursor_bo(xf86CrtcPtr crtc, dri_bo *cursor); diff --git a/src/i830_memory.c b/src/i830_memory.c index 434510a3..26e4cfde 100644 --- a/src/i830_memory.c +++ b/src/i830_memory.c @@ -1136,14 +1136,16 @@ i830_allocate_cursor_buffers(ScrnInfoPtr pScrn) - /* Try to allocate one big blob for our cursor memory. This works - * around a limitation in the FreeBSD AGP driver that allows only one - * physical allocation larger than a page, and could allow us - * to pack the cursors smaller. - */ - size = xf86_config->num_crtc * (HWCURSOR_SIZE + HWCURSOR_SIZE_ARGB); + if (!pI830->use_drm_mode) { + /* Try to allocate one big blob for our cursor memory. This works + * around a limitation in the FreeBSD AGP driver that allows only one + * physical allocation larger than a page, and could allow us + * to pack the cursors smaller. + */ + size = xf86_config->num_crtc * (HWCURSOR_SIZE + HWCURSOR_SIZE_ARGB); - pI830->cursor_mem = i830_allocate_memory(pScrn, "HW cursors", - size, PITCH_NONE, GTT_PAGE_SIZE, - flags, TILE_NONE); - if (pI830->cursor_mem != NULL) - return TRUE; + pI830->cursor_mem = i830_allocate_memory(pScrn, "HW cursors", + size, PITCH_NONE, GTT_PAGE_SIZE, + flags, TILE_NONE); + if (pI830->cursor_mem != NULL) + return TRUE; + } @@ -1156,11 +1158,13 @@ i830_allocate_cursor_buffers(ScrnInfoPtr pScrn) { - pI830->cursor_mem_classic[i] = i830_allocate_memory (pScrn, - "Core cursor", - HWCURSOR_SIZE, - PITCH_NONE, - GTT_PAGE_SIZE, - flags, - TILE_NONE); - if (!pI830->cursor_mem_classic[i]) - return FALSE; + if (!pI830->use_drm_mode) { + pI830->cursor_mem_classic[i] = i830_allocate_memory (pScrn, + "Core cursor", + HWCURSOR_SIZE, + PITCH_NONE, + GTT_PAGE_SIZE, + flags, + TILE_NONE); + if (!pI830->cursor_mem_classic[i]) + return FALSE; + } pI830->cursor_mem_argb[i] = i830_allocate_memory (pScrn, "ARGB cursor", @@ -1577,3 +1581,8 @@ i830_bind_all_memory(ScrnInfoPtr pScrn) } - if (!pI830->use_drm_mode) + if (pI830->use_drm_mode) { + int i; + xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn); + for (i = 0; i < xf86_config->num_crtc; i++) + drmmode_crtc_set_cursor_bo(xf86_config->crtc[i], pI830->cursor_mem_argb[i]->bo); + } else i830_update_cursor_offsets(pScrn); |