diff options
author | Francisco Jerez <currojerez@riseup.net> | 2010-02-10 11:48:47 +0100 |
---|---|---|
committer | Francisco Jerez <currojerez@riseup.net> | 2010-02-10 12:30:15 +0100 |
commit | 0917665d1f2f1e76b6a0e7a4c027512f9f45f41b (patch) | |
tree | 0346438e1e28603f88def01660f2d23be60c23ce | |
parent | e75dd23bd28f636b4c1759633d8dbc775e799add (diff) | |
download | xorg-driver-xf86-video-nouveau-0917665d1f2f1e76b6a0e7a4c027512f9f45f41b.tar.gz |
kms: Kill nv_cursor_convert_cursor.
Well, mostly, the remaining pitch conversion will be unnecessary soon.
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
-rw-r--r-- | src/drmmode_display.c | 91 | ||||
-rw-r--r-- | src/nv_type.h | 9 |
2 files changed, 10 insertions, 90 deletions
diff --git a/src/drmmode_display.c b/src/drmmode_display.c index 97a4a59..efb65f7 100644 --- a/src/drmmode_display.c +++ b/src/drmmode_display.c @@ -367,77 +367,6 @@ done: return ret; } -#define SOURCE_MASK_INTERLEAVE 32 -#define TRANSPARENT_PIXEL 0 - -/* - * Convert a source/mask bitmap cursor to an ARGB cursor, clipping or - * padding as necessary. source/mask are assumed to be alternated each - * SOURCE_MASK_INTERLEAVE bits. - */ -void -nv_cursor_convert_cursor(uint32_t *src, void *dst, int src_stride, int dst_stride, - int bpp, uint32_t fg, uint32_t bg) -{ - int width = min(src_stride, dst_stride); - uint32_t b, m, pxval; - int i, j, k; - - for (i = 0; i < width; i++) { - for (j = 0; j < width / SOURCE_MASK_INTERLEAVE; j++) { - int src_off = i*src_stride/SOURCE_MASK_INTERLEAVE + j; - int dst_off = i*dst_stride + j*SOURCE_MASK_INTERLEAVE; - - b = src[2*src_off]; - m = src[2*src_off + 1]; - - for (k = 0; k < SOURCE_MASK_INTERLEAVE; k++) { - pxval = TRANSPARENT_PIXEL; -#if X_BYTE_ORDER == X_BIG_ENDIAN - if (m & 0x80000000) - pxval = (b & 0x80000000) ? fg : bg; - b <<= 1; - m <<= 1; -#else - if (m & 1) - pxval = (b & 1) ? fg : bg; - b >>= 1; - m >>= 1; -#endif - if (bpp == 32) - ((uint32_t *)dst)[dst_off + k] = pxval; - else - ((uint16_t *)dst)[dst_off + k] = pxval; - } - } - } -} - -static void -drmmode_reload_cursor_image(xf86CrtcPtr crtc) -{ - NVPtr pNv = NVPTR(crtc->scrn); - xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(crtc->scrn); - drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; - struct nouveau_bo *bo = drmmode_crtc->cursor; - drmmode_ptr drmmode = drmmode_crtc->drmmode; - - nouveau_bo_map(bo, NOUVEAU_BO_WR); - nv_cursor_convert_cursor(pNv->curImage, bo->map, nv_cursor_width(pNv), - 64, 32, config->cursor_fg | (0xff << 24), - config->cursor_bg | (0xff << 24)); - nouveau_bo_unmap(bo); - - drmModeSetCursor(drmmode->fd, drmmode_crtc->mode_crtc->crtc_id, - bo->handle, 64, 64); -} - -static void -drmmode_set_cursor_colors (xf86CrtcPtr crtc, int bg, int fg) -{ - drmmode_reload_cursor_image(crtc); -} - static void drmmode_set_cursor_position (xf86CrtcPtr crtc, int x, int y) { @@ -448,30 +377,32 @@ drmmode_set_cursor_position (xf86CrtcPtr crtc, int x, int y) } static void -drmmode_load_cursor_image (xf86CrtcPtr crtc, CARD8 *image) +convert_cursor(CARD32 *dst, CARD32 *src, int dw, int sw) { - NVPtr pNv = NVPTR(crtc->scrn); - - /* save copy of image for colour changes */ - memcpy(pNv->curImage, image, nv_cursor_pixels(pNv)/4); + int i, j; - drmmode_reload_cursor_image(crtc); + for (j = 0; j < sw; j++) { + for (i = 0; i < sw; i++) { + dst[j * dw + i] = src[j * sw + i]; + } + } } static void drmmode_load_cursor_argb (xf86CrtcPtr crtc, CARD32 *image) { + NVPtr pNv = NVPTR(crtc->scrn); drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; struct nouveau_bo *cursor = drmmode_crtc->cursor; drmmode_ptr drmmode = drmmode_crtc->drmmode; nouveau_bo_map(cursor, NOUVEAU_BO_WR); - memcpy(cursor->map, image, 64*64*4); + convert_cursor(cursor->map, image, 64, nv_cursor_width(pNv)); nouveau_bo_unmap(cursor); if (drmmode_crtc->cursor_visible) { drmModeSetCursor(drmmode->fd, drmmode_crtc->mode_crtc->crtc_id, - cursor->handle, 64, 64); + cursor->handle, 64, 64); } } @@ -607,11 +538,9 @@ drmmode_gamma_set(xf86CrtcPtr crtc, CARD16 *red, CARD16 *green, CARD16 *blue, static const xf86CrtcFuncsRec drmmode_crtc_funcs = { .dpms = drmmode_crtc_dpms, .set_mode_major = drmmode_set_mode_major, - .set_cursor_colors = drmmode_set_cursor_colors, .set_cursor_position = drmmode_set_cursor_position, .show_cursor = drmmode_show_cursor, .hide_cursor = drmmode_hide_cursor, - .load_cursor_image = drmmode_load_cursor_image, .load_cursor_argb = drmmode_load_cursor_argb, .shadow_create = drmmode_crtc_shadow_create, .shadow_allocate = drmmode_crtc_shadow_allocate, diff --git a/src/nv_type.h b/src/nv_type.h index dd10a45..e469cdb 100644 --- a/src/nv_type.h +++ b/src/nv_type.h @@ -53,8 +53,6 @@ typedef struct _NVRec { ScreenBlockHandlerProcPtr BlockHandler; CreateScreenResourcesProcPtr CreateScreenResources; CloseScreenProcPtr CloseScreen; - /* Cursor */ - uint32_t curImage[256]; void (*VideoTimerCallback)(ScrnInfoPtr, Time); XF86VideoAdaptorPtr overlayAdaptor; XF86VideoAdaptorPtr blitAdaptor; @@ -205,11 +203,4 @@ static inline int nv_cursor_width(NVPtr pNv) return pNv->dev->chipset >= 0x10 ? NV10_CURSOR_SIZE : NV04_CURSOR_SIZE; } -static inline int nv_cursor_pixels(NVPtr pNv) -{ - int width = nv_cursor_width(pNv); - - return width * width; -} - #endif /* __NV_STRUCT_H__ */ |