Commit ae75019c authored by Keith Packard's avatar Keith Packard

Create driver-independent CRTC-based cursor layer.

This moves most of the cursor management code out of the intel driver and
into the general server code. Of course, the hope is that this code will be
useful for other driver writers as well.

Check out xf86Crtc.h for the usage information, making sure you add the
needed hooks to the crtc funcs structure for your driver.
(cherry picked from commit 4d81c99a)
parent 4bf1b280
......@@ -56,6 +56,7 @@ XORG_LIBS = \
parser/libxf86config.a \
dixmods/libdixmods.la \
modes/libxf86modes.a \
ramdac/libramdac.a \
ddc/libddc.a \
i2c/libi2c.a \
@XORG_LIBS@
......
......@@ -2,7 +2,8 @@ noinst_LIBRARIES = libloader.a
INCLUDES = $(XORG_INCS) -I$(srcdir)/../parser -I$(srcdir)/../dixmods/extmod \
-I$(srcdir)/../vbe -I$(top_srcdir)/miext/cw -I$(srcdir)/../int10 \
-I$(srcdir)/../ddc -I$(srcdir)/../i2c -I$(srcdir)/../modes
-I$(srcdir)/../ddc -I$(srcdir)/../i2c -I$(srcdir)/../modes \
-I$(srcdir)/../ramdac
#AM_LDFLAGS = -r
AM_CFLAGS = -DIN_LOADER $(DIX_CFLAGS) $(XORG_CFLAGS)
......
......@@ -841,6 +841,7 @@ DuplicateModule(ModuleDescPtr mod, ModuleDescPtr parent)
static const char *compiled_in_modules[] = {
"ddc",
"i2c",
"ramdac",
NULL
};
......@@ -861,7 +862,7 @@ doLoadModule(const char *module, const char *path, const char **subdirlist,
PatternPtr patterns = NULL;
int noncanonical = 0;
char *m = NULL;
char **cim;
const char **cim;
xf86MsgVerb(X_INFO, 3, "LoadModule: \"%s\"", module);
......
......@@ -1220,6 +1220,11 @@ _X_HIDDEN void *xfree86LookupTab[] = {
SYMFUNC(xf86RandR12SetConfig)
SYMFUNC(xf86RandR12SetRotations)
#endif
SYMFUNC(xf86_cursors_init)
SYMFUNC(xf86_reload_cursors)
SYMFUNC(xf86_show_cursors)
SYMFUNC(xf86_hide_cursors)
SYMFUNC(xf86_cursors_fini)
SYMFUNC(xf86DoEDID_DDC1)
SYMFUNC(xf86DoEDID_DDC2)
......
......@@ -3,6 +3,7 @@ noinst_LIBRARIES = libxf86modes.a
libxf86modes_a_SOURCES = \
xf86Crtc.c \
xf86Crtc.h \
xf86Cursors.c \
xf86cvt.c \
xf86DiDGA.c \
xf86EdidModes.c \
......@@ -16,7 +17,8 @@ libxf86modes_a_SOURCES = \
INCLUDES = $(XORG_INCS) -I$(srcdir)/../ddc -I$(srcdir)/../i2c \
-I$(srcdir)/../loader -I$(srcdir)/../rac -I$(srcdir)/../parser \
-I$(srcdir)/../scanpci -I$(srcdir)/../vbe -I$(srcdir)/../int10 \
-I$(srcdir)/../vgahw -I$(srcdir)/../dixmods/extmod
-I$(srcdir)/../vgahw -I$(srcdir)/../ramdac \
-I$(srcdir)/../dixmods/extmod
sdk_HEADERS = \
xf86Crtc.h \
......
......@@ -28,6 +28,7 @@
#include "xf86Rename.h"
#endif
#include "xf86Modes.h"
#include "xf86Cursor.h"
#include "damage.h"
/* Compat definitions for older X Servers. */
......@@ -37,6 +38,9 @@
#ifndef M_T_DRIVER
#define M_T_DRIVER 0x40
#endif
#ifndef HARDWARE_CURSOR_ARGB
#define HARDWARE_CURSOR_ARGB 0x00004000
#endif
typedef struct _xf86Crtc xf86CrtcRec, *xf86CrtcPtr;
typedef struct _xf86Output xf86OutputRec, *xf86OutputPtr;
......@@ -154,6 +158,42 @@ typedef struct _xf86CrtcFuncs {
void
(*shadow_destroy) (xf86CrtcPtr crtc, PixmapPtr pPixmap, void *data);
/**
* Set cursor colors
*/
void
(*set_cursor_colors) (xf86CrtcPtr crtc, int bg, int fg);
/**
* Set cursor position
*/
void
(*set_cursor_position) (xf86CrtcPtr crtc, int x, int y);
/**
* Show cursor
*/
void
(*show_cursor) (xf86CrtcPtr crtc);
/**
* Hide cursor
*/
void
(*hide_cursor) (xf86CrtcPtr crtc);
/**
* Load monochrome image
*/
void
(*load_cursor_image) (xf86CrtcPtr crtc, CARD8 *image);
/**
* Load ARGB image
*/
void
(*load_cursor_argb) (xf86CrtcPtr crtc, CARD32 *image);
/**
* Clean up driver-specific bits of the crtc
*/
......@@ -174,12 +214,6 @@ struct _xf86Crtc {
*/
Bool enabled;
/** Track whether cursor is within CRTC range */
Bool cursorInRange;
/** Track state of cursor associated with this CRTC */
Bool cursorShown;
/**
* Active mode
*
......@@ -232,6 +266,19 @@ struct _xf86Crtc {
#else
void *randr_crtc;
#endif
/**
* Current cursor is ARGB
*/
Bool cursor_argb;
/**
* Track whether cursor is within CRTC range
*/
Bool cursor_in_range;
/**
* Track state of cursor associated with this CRTC
*/
Bool cursor_shown;
};
typedef struct _xf86OutputFuncs {
......@@ -495,6 +542,13 @@ typedef struct _xf86CrtcConfig {
const xf86CrtcConfigFuncsRec *funcs;
CreateScreenResourcesProcPtr CreateScreenResources;
/* Cursor information */
xf86CursorInfoPtr cursor_info;
CursorPtr cursor;
CARD8 *cursor_image;
Bool cursor_on;
CARD32 cursor_fg, cursor_bg;
} xf86CrtcConfigRec, *xf86CrtcConfigPtr;
extern int xf86CrtcConfigPrivateIndex;
......@@ -637,4 +691,41 @@ xf86ConnectorGetName(xf86ConnectorType connector);
Bool
xf86SetDesiredModes (ScrnInfoPtr pScrn);
/**
* Initialize the CRTC-based cursor code. CRTC function vectors must
* contain relevant cursor setting functions.
*
* Driver should call this from ScreenInit function
*/
Bool
xf86_cursors_init (ScreenPtr screen, int max_width, int max_height, int flags);
/**
* Called when anything on the screen is reconfigured.
*
* Reloads cursor images as needed, then adjusts cursor positions.
*
* Driver should call this from crtc commit function.
*/
void
xf86_reload_cursors (ScreenPtr screen);
/**
* Called from EnterVT to turn the cursors back on
*/
void
xf86_show_cursors (ScrnInfoPtr scrn);
/**
* Called by the driver to turn cursors off
*/
void
xf86_hide_cursors (ScrnInfoPtr scrn);
/**
* Clean up CRTC-based cursor code. Driver must call this at CloseScreen time.
*/
void
xf86_cursors_fini (ScreenPtr screen);
#endif /* _XF86CRTC_H_ */
This diff is collapsed.
module_LTLIBRARIES = libramdac.la
noinst_LIBRARIES = libramdac.a
libramdac_la_LDFLAGS = -avoid-version
libramdac_la_SOURCES = xf86RamDacMod.c xf86RamDac.c xf86RamDacCmap.c \
libramdac_a_SOURCES = xf86RamDac.c xf86RamDacCmap.c \
xf86Cursor.c xf86HWCurs.c IBM.c BT.c TI.c \
xf86BitOrder.c
......
......@@ -44,5 +44,8 @@ void xf86ForceHWCursor (ScreenPtr pScreen, Bool on);
#define HARDWARE_CURSOR_NIBBLE_SWAPPED 0x00000800
#define HARDWARE_CURSOR_SHOW_TRANSPARENT 0x00001000
#define HARDWARE_CURSOR_UPDATE_UNHIDDEN 0x00002000
#ifdef ARGB_CURSOR
#define HARDWARE_CURSOR_ARGB 0x00004000
#endif
#endif /* _XF86CURSOR_H */
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