From e9e6152cb38ca5f1ea6d65cf9bf32150bf9d2b7b Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Sun, 18 Oct 2009 11:46:19 +0200 Subject: st/xorg: Clean up cursor functions a bit --- src/gallium/state_trackers/xorg/xorg_crtc.c | 81 +++++++++++++++++------------ 1 file changed, 47 insertions(+), 34 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/state_trackers/xorg/xorg_crtc.c b/src/gallium/state_trackers/xorg/xorg_crtc.c index 67fe29a69d..6c6b6b5d1c 100644 --- a/src/gallium/state_trackers/xorg/xorg_crtc.c +++ b/src/gallium/state_trackers/xorg/xorg_crtc.c @@ -173,18 +173,23 @@ crtc_shadow_destroy(xf86CrtcPtr crtc, PixmapPtr rotate_pixmap, void *data) //ScrnInfoPtr pScrn = crtc->scrn; } +/* + * Cursor functions + */ + static void -crtc_destroy(xf86CrtcPtr crtc) +crtc_set_cursor_colors(xf86CrtcPtr crtc, int bg, int fg) { - struct crtc_private *crtcp = crtc->driver_private; +} - if (crtcp->cursor_tex) - pipe_texture_reference(&crtcp->cursor_tex, NULL); +static void +crtc_set_cursor_position(xf86CrtcPtr crtc, int x, int y) +{ + modesettingPtr ms = modesettingPTR(crtc->scrn); + struct crtc_private *crtcp = crtc->driver_private; - drmModeFreeCrtc(crtcp->drm_crtc); - xfree(crtcp); + drmModeMoveCursor(ms->fd, crtcp->drm_crtc->crtc_id, x, y); } - static void crtc_load_cursor_argb(xf86CrtcPtr crtc, CARD32 * image) { @@ -229,15 +234,6 @@ crtc_load_cursor_argb(xf86CrtcPtr crtc, CARD32 * image) ms->screen->tex_transfer_destroy(transfer); } -static void -crtc_set_cursor_position(xf86CrtcPtr crtc, int x, int y) -{ - modesettingPtr ms = modesettingPTR(crtc->scrn); - struct crtc_private *crtcp = crtc->driver_private; - - drmModeMoveCursor(ms->fd, crtcp->drm_crtc->crtc_id, x, y); -} - static void crtc_show_cursor(xf86CrtcPtr crtc) { @@ -258,38 +254,55 @@ crtc_hide_cursor(xf86CrtcPtr crtc) drmModeSetCursor(ms->fd, crtcp->drm_crtc->crtc_id, 0, 0, 0); } +void +crtc_cursor_destroy(xf86CrtcPtr crtc) +{ + struct crtc_private *crtcp = crtc->driver_private; + + if (crtcp->cursor_tex) { + pipe_texture_reference(&crtcp->cursor_tex, NULL); + } +} + +/* + * Misc functions + */ + +static void +crtc_destroy(xf86CrtcPtr crtc) +{ + struct crtc_private *crtcp = crtc->driver_private; + + if (crtcp->cursor_tex) + pipe_texture_reference(&crtcp->cursor_tex, NULL); + + drmModeFreeCrtc(crtcp->drm_crtc); + xfree(crtcp); +} + static const xf86CrtcFuncsRec crtc_funcs = { .dpms = crtc_dpms, - .save = NULL, - .restore = NULL, + .lock = crtc_lock, .unlock = crtc_unlock, .mode_fixup = crtc_mode_fixup, .prepare = crtc_prepare, .mode_set = crtc_mode_set, .commit = crtc_commit, - .gamma_set = crtc_gamma_set, - .shadow_create = crtc_shadow_create, - .shadow_allocate = crtc_shadow_allocate, - .shadow_destroy = crtc_shadow_destroy, + + .set_cursor_colors = crtc_set_cursor_colors, .set_cursor_position = crtc_set_cursor_position, .show_cursor = crtc_show_cursor, .hide_cursor = crtc_hide_cursor, - .load_cursor_image = NULL, /* lets convert to argb only */ - .set_cursor_colors = NULL, /* using argb only */ .load_cursor_argb = crtc_load_cursor_argb, - .destroy = crtc_destroy, -}; -void -crtc_cursor_destroy(xf86CrtcPtr crtc) -{ - struct crtc_private *crtcp = crtc->driver_private; + .shadow_create = crtc_shadow_create, + .shadow_allocate = crtc_shadow_allocate, + .shadow_destroy = crtc_shadow_destroy, - if (crtcp->cursor_tex) { - pipe_texture_reference(&crtcp->cursor_tex, NULL); - } -} + .gamma_set = crtc_gamma_set, + .destroy = crtc_destroy, +}; void crtc_init(ScrnInfoPtr pScrn) -- cgit v1.2.3