diff options
Diffstat (limited to 'xorg-server/hw/xfree86/ramdac')
-rw-r--r-- | xorg-server/hw/xfree86/ramdac/.gitignore | 2 | ||||
-rw-r--r-- | xorg-server/hw/xfree86/ramdac/CURSOR.NOTES | 382 | ||||
-rw-r--r-- | xorg-server/hw/xfree86/ramdac/Makefile.am | 38 | ||||
-rw-r--r-- | xorg-server/hw/xfree86/ramdac/xf86Cursor.c | 22 | ||||
-rw-r--r-- | xorg-server/hw/xfree86/ramdac/xf86CursorPriv.h | 2 |
5 files changed, 224 insertions, 222 deletions
diff --git a/xorg-server/hw/xfree86/ramdac/.gitignore b/xorg-server/hw/xfree86/ramdac/.gitignore new file mode 100644 index 000000000..9074a4300 --- /dev/null +++ b/xorg-server/hw/xfree86/ramdac/.gitignore @@ -0,0 +1,2 @@ +# Add & Override for this directory and it's subdirectories
+xf86BitOrder.c
diff --git a/xorg-server/hw/xfree86/ramdac/CURSOR.NOTES b/xorg-server/hw/xfree86/ramdac/CURSOR.NOTES index 726e2edc1..a0ecd02ae 100644 --- a/xorg-server/hw/xfree86/ramdac/CURSOR.NOTES +++ b/xorg-server/hw/xfree86/ramdac/CURSOR.NOTES @@ -1,191 +1,191 @@ - CURSOR.NOTES - - This file describes how to add hardware cursor support to a chipset -driver. Though the cursor support itself is in the ramdac module, -cursor management is separate from the rest of the module. - - -1) CURSOR INITIALIZATION AND SHUTDOWN - - All relevant prototypes and defines are in xf86Cursor.h. - - To initialize the cursor, the driver should allocate an -xf86CursorInfoRec via xf86CreateCursorInfoRec(), fill it out as described -later in this document and pass it to xf86InitCursor(). xf86InitCursor() -must be called _after_ the software cursor initialization (usually -miDCInitialize). - - When shutting down, the driver should free the xf86CursorInfoRec -structure in its CloseScreen function via xf86DestroyCursorInfoRec(). - - -2) FILLING OUT THE xf86CursorInfoRec - - The driver informs the ramdac module of it's hardware cursor capablities by -filling out an xf86CursorInfoRec structure and passing it to xf86InitCursor(). -The xf86CursorInfoRec contains the following function pointers: - - -/**** These functions are required ****/ - -void ShowCursor(ScrnInfoPtr pScrn) - - ShowCursor should display the current cursor. - -void HideCursor(ScrnInfoPtr pScrn) - - HideCursor should hide the current cursor. - -void SetCursorPosition(ScrnInfoPtr pScrn, int x, int y) - - Set the cursor position to (x,y). X and/or y may be negative - indicating that the cursor image is partially offscreen on - the left and/or top edges of the screen. It is up to the - driver to trap for this and deal with that situation. - -void SetCursorColors(ScrnInfoPtr pScrn, int bg, int fg) - - Set the cursor foreground and background colors. In 8bpp, fg and - bg are indicies into the current colormap unless the - HARDWARE_CURSOR_TRUECOLOR_AT_8BPP flag is set. In that case - and in all other bpps the fg and bg are in 8-8-8 RGB format. - -void LoadCursorImage(ScrnInfoPtr pScrn, unsigned char *bits) - - LoadCursorImage is how the hardware cursor bits computed by the - RealizeCursor function will be passed to the driver when the cursor - shape needs to be changed. - - -/**** These functions are optional ****/ - - -unsigned char* RealizeCursor(xf86CursorInfoPtr infoPtr, CursorPtr pCurs) - - If RealizeCursor is not provided by the driver, one will be provided - for you based on the Flags field described below. The driver must - provide this function if the hardware cursor format is not one of - the common ones supported by this module. - - -Bool UseHWCursor(ScreenPtr pScreen, CursorPtr pCurs) - - If the driver is unable to use a hardware cursor for reasons - other than the cursor being larger than the maximum specified - in the MaxWidth or MaxHeight field below, it can supply the - UseHWCursor function. If UseHWCursor is provided by the driver, - it will be called whenever the cursor shape changes or the video - mode changes. This is useful for when the hardware cursor cannot - be used in interlaced or doublescan modes. - - -/**** The following fields are required ****/ - -MaxWidth -MaxHeight - - These indicate the largest sized cursor that can be a hardware - cursor. It will fall back to a software cursor when a cursor - exceeding this size needs to be used. - - -Flags - - /* Color related flags */ - - HARDWARE_CURSOR_TRUECOLOR_AT_8BPP - - This indicates that the colors passed to the SetCursorColors - function should not be in 8-8-8 RGB format in 8bpp but rather, - they should be the pixel values from the current colormap. - - - /* Cursor data loading flags */ - - HARDWARE_CURSOR_SHOW_TRANSPARENT - - The HideCursor entry will normally be called instead of displaying a - completely transparent cursor, or when a switch to a software cursor - needs to occur. This flag prevents this behaviour, thus causing the - LoadCursorImage entry to be called with transparent cursor data. - NOTE: If you use this flag and provide your own RealizeCursor() entry, - ensure this entry returns transparent cursor data when called - with a NULL pCurs parameter. - - HARDWARE_CURSOR_UPDATE_UNHIDDEN - - This flag prevents the HideCursor call that would normally occur just before - the LoadCursorImage entry is to be called to load a new hardware cursor - image. - - - /* Cursor data packing flags */ - - Hardware cursor data consists of two pieces, a source and a mask. - The mask is a bitmap indicating which parts of the cursor are - transparent and which parts are drawn. The source is a bitmap - indicating which parts of the non-transparent portion of the the - cursor should be painted in the foreground color and which should - be painted in the background color. - - HARDWARE_CURSOR_INVERT_MASK - - By default, set bits indicate the opaque part of the mask bitmap - and clear bits indicate the transparent part. If your hardware - wants this the opposite way, this flag will invert the mask. - - HARDWARE_CURSOR_SWAP_SOURCE_AND_MASK - - By default, RealizeCursor will store the source first and then - the mask. If the hardware needs this order reversed then this - flag should be set. - - HARDWARE_CURSOR_AND_SOURCE_WITH_MASK - - This flag will have the module logical AND the source with the mask to make - sure there are no source bits set if the corresponding mask bits - aren't set. Some hardware will not care if source bits are set where - there are supposed to be transparent areas, but some hardware will - interpret this as a third cursor color or similar. That type of - hardware will need this flag set. - - HARDWARE_CURSOR_BIT_ORDER_MSBFIRST - - By default, it is assumed that the least significant bit in each byte - corresponds to the leftmost pixel on the screen. If your hardware - has this reversed you should set this flag. - - HARDWARE_CURSOR_NIBBLE_SWAPPED - - If your hardware requires byte swapping of the hardware cursor, enable - this option. - - - /* Source-Mask interleaving flags */ - - By default the source and mask data are inlined (source first unless - the HARDWARE_CURSOR_SWAP_SOURCE_AND_MASK flag is set). Some hardware - will require the source and mask to be interleaved, that is, X number - of source bits should packed and then X number of mask bits repeating - until the entire pattern is stored. The following flags describe the - bit interleave. - - HARDWARE_CURSOR_SOURCE_MASK_NOT_INTERLEAVED - - This one is the default. - - The following are for interleaved cursors. - - HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_1 - HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_8 - HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_16 - HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_32 - HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_64 - - And once again, if your hardware requires something different than - these packing styles, your driver can supply its own RealizeCursor - function. - - - -$XFree86: xc/programs/Xserver/hw/xfree86/ramdac/CURSOR.NOTES,v 1.4tsi Exp $ + CURSOR.NOTES
+
+ This file describes how to add hardware cursor support to a chipset
+driver. Though the cursor support itself is in the ramdac module,
+cursor management is separate from the rest of the module.
+
+
+1) CURSOR INITIALIZATION AND SHUTDOWN
+
+ All relevant prototypes and defines are in xf86Cursor.h.
+
+ To initialize the cursor, the driver should allocate an
+xf86CursorInfoRec via xf86CreateCursorInfoRec(), fill it out as described
+later in this document and pass it to xf86InitCursor(). xf86InitCursor()
+must be called _after_ the software cursor initialization (usually
+miDCInitialize).
+
+ When shutting down, the driver should free the xf86CursorInfoRec
+structure in its CloseScreen function via xf86DestroyCursorInfoRec().
+
+
+2) FILLING OUT THE xf86CursorInfoRec
+
+ The driver informs the ramdac module of it's hardware cursor capablities by
+filling out an xf86CursorInfoRec structure and passing it to xf86InitCursor().
+The xf86CursorInfoRec contains the following function pointers:
+
+
+/**** These functions are required ****/
+
+void ShowCursor(ScrnInfoPtr pScrn)
+
+ ShowCursor should display the current cursor.
+
+void HideCursor(ScrnInfoPtr pScrn)
+
+ HideCursor should hide the current cursor.
+
+void SetCursorPosition(ScrnInfoPtr pScrn, int x, int y)
+
+ Set the cursor position to (x,y). X and/or y may be negative
+ indicating that the cursor image is partially offscreen on
+ the left and/or top edges of the screen. It is up to the
+ driver to trap for this and deal with that situation.
+
+void SetCursorColors(ScrnInfoPtr pScrn, int bg, int fg)
+
+ Set the cursor foreground and background colors. In 8bpp, fg and
+ bg are indicies into the current colormap unless the
+ HARDWARE_CURSOR_TRUECOLOR_AT_8BPP flag is set. In that case
+ and in all other bpps the fg and bg are in 8-8-8 RGB format.
+
+void LoadCursorImage(ScrnInfoPtr pScrn, unsigned char *bits)
+
+ LoadCursorImage is how the hardware cursor bits computed by the
+ RealizeCursor function will be passed to the driver when the cursor
+ shape needs to be changed.
+
+
+/**** These functions are optional ****/
+
+
+unsigned char* RealizeCursor(xf86CursorInfoPtr infoPtr, CursorPtr pCurs)
+
+ If RealizeCursor is not provided by the driver, one will be provided
+ for you based on the Flags field described below. The driver must
+ provide this function if the hardware cursor format is not one of
+ the common ones supported by this module.
+
+
+Bool UseHWCursor(ScreenPtr pScreen, CursorPtr pCurs)
+
+ If the driver is unable to use a hardware cursor for reasons
+ other than the cursor being larger than the maximum specified
+ in the MaxWidth or MaxHeight field below, it can supply the
+ UseHWCursor function. If UseHWCursor is provided by the driver,
+ it will be called whenever the cursor shape changes or the video
+ mode changes. This is useful for when the hardware cursor cannot
+ be used in interlaced or doublescan modes.
+
+
+/**** The following fields are required ****/
+
+MaxWidth
+MaxHeight
+
+ These indicate the largest sized cursor that can be a hardware
+ cursor. It will fall back to a software cursor when a cursor
+ exceeding this size needs to be used.
+
+
+Flags
+
+ /* Color related flags */
+
+ HARDWARE_CURSOR_TRUECOLOR_AT_8BPP
+
+ This indicates that the colors passed to the SetCursorColors
+ function should not be in 8-8-8 RGB format in 8bpp but rather,
+ they should be the pixel values from the current colormap.
+
+
+ /* Cursor data loading flags */
+
+ HARDWARE_CURSOR_SHOW_TRANSPARENT
+
+ The HideCursor entry will normally be called instead of displaying a
+ completely transparent cursor, or when a switch to a software cursor
+ needs to occur. This flag prevents this behaviour, thus causing the
+ LoadCursorImage entry to be called with transparent cursor data.
+ NOTE: If you use this flag and provide your own RealizeCursor() entry,
+ ensure this entry returns transparent cursor data when called
+ with a NULL pCurs parameter.
+
+ HARDWARE_CURSOR_UPDATE_UNHIDDEN
+
+ This flag prevents the HideCursor call that would normally occur just before
+ the LoadCursorImage entry is to be called to load a new hardware cursor
+ image.
+
+
+ /* Cursor data packing flags */
+
+ Hardware cursor data consists of two pieces, a source and a mask.
+ The mask is a bitmap indicating which parts of the cursor are
+ transparent and which parts are drawn. The source is a bitmap
+ indicating which parts of the non-transparent portion of the the
+ cursor should be painted in the foreground color and which should
+ be painted in the background color.
+
+ HARDWARE_CURSOR_INVERT_MASK
+
+ By default, set bits indicate the opaque part of the mask bitmap
+ and clear bits indicate the transparent part. If your hardware
+ wants this the opposite way, this flag will invert the mask.
+
+ HARDWARE_CURSOR_SWAP_SOURCE_AND_MASK
+
+ By default, RealizeCursor will store the source first and then
+ the mask. If the hardware needs this order reversed then this
+ flag should be set.
+
+ HARDWARE_CURSOR_AND_SOURCE_WITH_MASK
+
+ This flag will have the module logical AND the source with the mask to make
+ sure there are no source bits set if the corresponding mask bits
+ aren't set. Some hardware will not care if source bits are set where
+ there are supposed to be transparent areas, but some hardware will
+ interpret this as a third cursor color or similar. That type of
+ hardware will need this flag set.
+
+ HARDWARE_CURSOR_BIT_ORDER_MSBFIRST
+
+ By default, it is assumed that the least significant bit in each byte
+ corresponds to the leftmost pixel on the screen. If your hardware
+ has this reversed you should set this flag.
+
+ HARDWARE_CURSOR_NIBBLE_SWAPPED
+
+ If your hardware requires byte swapping of the hardware cursor, enable
+ this option.
+
+
+ /* Source-Mask interleaving flags */
+
+ By default the source and mask data are inlined (source first unless
+ the HARDWARE_CURSOR_SWAP_SOURCE_AND_MASK flag is set). Some hardware
+ will require the source and mask to be interleaved, that is, X number
+ of source bits should packed and then X number of mask bits repeating
+ until the entire pattern is stored. The following flags describe the
+ bit interleave.
+
+ HARDWARE_CURSOR_SOURCE_MASK_NOT_INTERLEAVED
+
+ This one is the default.
+
+ The following are for interleaved cursors.
+
+ HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_1
+ HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_8
+ HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_16
+ HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_32
+ HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_64
+
+ And once again, if your hardware requires something different than
+ these packing styles, your driver can supply its own RealizeCursor
+ function.
+
+
+
+$XFree86: xc/programs/Xserver/hw/xfree86/ramdac/CURSOR.NOTES,v 1.4tsi Exp $
diff --git a/xorg-server/hw/xfree86/ramdac/Makefile.am b/xorg-server/hw/xfree86/ramdac/Makefile.am index e6f8ed552..3c3780516 100644 --- a/xorg-server/hw/xfree86/ramdac/Makefile.am +++ b/xorg-server/hw/xfree86/ramdac/Makefile.am @@ -1,19 +1,19 @@ -noinst_LTLIBRARIES = libramdac.la
-
-libramdac_la_SOURCES = xf86RamDac.c xf86RamDacCmap.c \
- xf86Cursor.c xf86HWCurs.c IBM.c BT.c TI.c \
- xf86BitOrder.c
-
-sdk_HEADERS = BT.h IBM.h TI.h xf86Cursor.h xf86RamDac.h
-
-DISTCLEANFILES = xf86BitOrder.c
-EXTRA_DIST = BTPriv.h IBMPriv.h TIPriv.h xf86CursorPriv.h xf86RamDacPriv.h \
- CURSOR.NOTES
-
-AM_CFLAGS = -DXAAReverseBitOrder=xf86ReverseBitOrder -DRAMDAC_MODULE \
- $(DIX_CFLAGS) $(XORG_CFLAGS)
-INCLUDES = $(XORG_INCS)
-
-xf86BitOrder.c:
- $(AM_V_GEN)echo "#define XAAReverseBitOrder xf86ReverseBitOrder" > $@
- $(AM_V_GEN)echo "#include \"$(srcdir)/../xaa/xaaBitOrder.c\"" >> $@
+noinst_LTLIBRARIES = libramdac.la + +libramdac_la_SOURCES = xf86RamDac.c xf86RamDacCmap.c \ + xf86Cursor.c xf86HWCurs.c IBM.c BT.c TI.c \ + xf86BitOrder.c + +sdk_HEADERS = BT.h IBM.h TI.h xf86Cursor.h xf86RamDac.h + +DISTCLEANFILES = xf86BitOrder.c +EXTRA_DIST = BTPriv.h IBMPriv.h TIPriv.h xf86CursorPriv.h xf86RamDacPriv.h \ + CURSOR.NOTES + +AM_CFLAGS = -DXAAReverseBitOrder=xf86ReverseBitOrder -DRAMDAC_MODULE \ + $(DIX_CFLAGS) $(XORG_CFLAGS) +INCLUDES = $(XORG_INCS) + +xf86BitOrder.c: + $(AM_V_GEN)echo "#define XAAReverseBitOrder xf86ReverseBitOrder" > $@ + $(AM_V_GEN)echo "#include \"$(srcdir)/../xaa/xaaBitOrder.c\"" >> $@ diff --git a/xorg-server/hw/xfree86/ramdac/xf86Cursor.c b/xorg-server/hw/xfree86/ramdac/xf86Cursor.c index 7fd70fc34..15e2ada78 100644 --- a/xorg-server/hw/xfree86/ramdac/xf86Cursor.c +++ b/xorg-server/hw/xfree86/ramdac/xf86Cursor.c @@ -43,14 +43,14 @@ static miPointerSpriteFuncRec xf86CursorSpriteFuncs = { static void xf86CursorInstallColormap(ColormapPtr); static void xf86CursorRecolorCursor(DeviceIntPtr pDev, ScreenPtr, CursorPtr, Bool); -static Bool xf86CursorCloseScreen(int, ScreenPtr); +static Bool xf86CursorCloseScreen(ScreenPtr); static void xf86CursorQueryBestSize(int, unsigned short *, unsigned short *, ScreenPtr); /* ScrnInfoRec functions */ -static void xf86CursorEnableDisableFBAccess(int, Bool); -static Bool xf86CursorSwitchMode(int, DisplayModePtr, int); +static void xf86CursorEnableDisableFBAccess(ScrnInfoPtr, Bool); +static Bool xf86CursorSwitchMode(ScrnInfoPtr, DisplayModePtr); Bool xf86InitCursor(ScreenPtr pScreen, xf86CursorInfoPtr infoPtr) @@ -118,7 +118,7 @@ xf86InitCursor(ScreenPtr pScreen, xf86CursorInfoPtr infoPtr) /***** Screen functions *****/ static Bool -xf86CursorCloseScreen(int i, ScreenPtr pScreen) +xf86CursorCloseScreen(ScreenPtr pScreen) { ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); miPointerScreenPtr PointPriv = @@ -149,7 +149,7 @@ xf86CursorCloseScreen(int i, ScreenPtr pScreen) free(ScreenPriv->transparentData); free(ScreenPriv); - return (*pScreen->CloseScreen) (i, pScreen); + return (*pScreen->CloseScreen) (pScreen); } static void @@ -203,11 +203,11 @@ xf86CursorRecolorCursor(DeviceIntPtr pDev, /***** ScrnInfoRec functions *********/ static void -xf86CursorEnableDisableFBAccess(int index, Bool enable) +xf86CursorEnableDisableFBAccess(ScrnInfoPtr pScrn, Bool enable) { DeviceIntPtr pDev = inputInfo.pointer; - ScreenPtr pScreen = screenInfo.screens[index]; + ScreenPtr pScreen = xf86ScrnToScreen(pScrn); xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr) dixLookupPrivate(&pScreen->devPrivates, xf86CursorScreenKey); @@ -223,7 +223,7 @@ xf86CursorEnableDisableFBAccess(int index, Bool enable) } if (ScreenPriv->EnableDisableFBAccess) - (*ScreenPriv->EnableDisableFBAccess) (index, enable); + (*ScreenPriv->EnableDisableFBAccess) (pScrn, enable); if (enable && ScreenPriv->SavedCursor) { /* @@ -237,10 +237,10 @@ xf86CursorEnableDisableFBAccess(int index, Bool enable) } static Bool -xf86CursorSwitchMode(int index, DisplayModePtr mode, int flags) +xf86CursorSwitchMode(ScrnInfoPtr pScrn, DisplayModePtr mode) { Bool ret; - ScreenPtr pScreen = screenInfo.screens[index]; + ScreenPtr pScreen = xf86ScrnToScreen(pScrn); xf86CursorScreenPtr ScreenPriv = (xf86CursorScreenPtr) dixLookupPrivate(&pScreen->devPrivates, xf86CursorScreenKey); @@ -250,7 +250,7 @@ xf86CursorSwitchMode(int index, DisplayModePtr mode, int flags) ScreenPriv->isUp = FALSE; } - ret = (*ScreenPriv->SwitchMode) (index, mode, flags); + ret = (*ScreenPriv->SwitchMode) (pScrn, mode); /* * Cannot restore cursor here because the new frame[XY][01] haven't been diff --git a/xorg-server/hw/xfree86/ramdac/xf86CursorPriv.h b/xorg-server/hw/xfree86/ramdac/xf86CursorPriv.h index 062b2eb7c..d04f93207 100644 --- a/xorg-server/hw/xfree86/ramdac/xf86CursorPriv.h +++ b/xorg-server/hw/xfree86/ramdac/xf86CursorPriv.h @@ -26,7 +26,7 @@ typedef struct { miPointerSpriteFuncPtr spriteFuncs; Bool PalettedCursor; ColormapPtr pInstalledMap; - Bool (*SwitchMode) (int, DisplayModePtr, int); + Bool (*SwitchMode) (ScrnInfoPtr, DisplayModePtr); xf86EnableDisableFBAccessProc *EnableDisableFBAccess; CursorPtr SavedCursor; |