2006-02-15 Keith Packard * Makefile.am: * ati.c: (ATIMapReg): * ati.h: * ati_cursor.c: (ATIMoveCursor), (ClassicSetCursorColors), (ClassicLoadCursor), (RadeonLoadCursor), (ATIUnloadCursor): Fix kdrive pointer signed/unsigned types. 2006-02-14 Eric Anholt * ati_draw.c: (ATIDrawDisable): Remove the waitSync from KdDisableScreen and push it off to drivers' disableAccel hook, which is more correct anyway. This makes kdrive.c not have any knowledge of kaa, opening the way for using exa from kdrive. 2006-02-09 Keith Packard reviewed by: Eric Anholt * ati_video.c: (RadeonDisplayVideo): Replace TRI_FAN with RECT_LIST to eliminate tearing 2005-08-07 Keith Packard * ati_video.c: (RadeonDisplayVideo): Build with modular X libraries and headers 2005-06-09 Eric Anholt * ati.h: * ati_video.c: Axe a few dead fields from the port priv struct and add my name to the "Copyright" line of the license to ati_video.c that already has my name in the text. 2005-06-09 Eric Anholt * ati_dri.c: Perform a warnings sweep on hw/kdrive. A number of these were my fault, but some come from others. 2005-06-09 Eric Anholt * ati.c: * ati.h: * ati_draw.c: (ATIWaitMarker), (ATIGetOffsetPitch), (ATIUploadToScreen), (ATIUploadToScratch), (ATIDrawInit), (ATIDrawEnable): * ati_dri.c: (ATIDRISwapContext): * ati_video.c: (R128DisplayVideo), (RadeonDisplayVideo): - Replace the syncAccel hook in the kdrive structure with a pair of hooks in the kaa structure: markSync and waitMarker. The first, if set, returns a hardware-dependent marker number which can then be waited for with waitMarker. If markSync is absent (which is the case on all drivers currently), waitMarker must wait for idle on any given marker number. The intention is to allow for more parallelism when we get downloading from framebuffer, or more fine-grained idling. - Replace the KdMarkSync/KdCheckSync functions with kaaMarkSync and kaaWaitSync. These will need to be refined when KAA starts being smart about using them. Merge kpict.c into kasync.c since kasyn.c has all the rest of these fallback funcs. - Restructure all drivers to initialize a KaaInfo structure by hand rather than statically in dubious order. - Whack the i810 driver into shape in hopes that it'll work after this change (it certainly wouldn't have before this). Doesn't support my i845 though. - Make a new KXV helper to avoid duplicated code to fill the region with the necessary color key. Use it in i810 and mach64 (tested). 2005-02-28 Keith Packard * ati_reg.h: Add macrovision register defines 2005-01-24 19:37 anholt * ati_dma.c, ati_draw.c, ati_reg.h: Finish converting RB2D_DSTCACHE to RB3D_DSTCACHE. Remove an extra pixel cache flush in the idle function. Init an extra reg for r200, and annotate the TCL_BYPASS better. Also, clean up some style nits from the last commit. 2005-01-24 18:39 keithp * ati.h, ati_draw.c, ati_reg.h, radeon_composite.c: Add tracing. Hack Radeon cache registers to use 3D addresses. Works on M6 2005-01-24 17:38 anholt * ati_dri.c: Silence a warning about uninitialized variable (though it would be). 2005-01-20 08:22 anholt * ati_dma.c, ati_dma.h, ati_dri.c: Add a set of macros for dealing with the repeated code to wait for a while reading a register/attempting DMA. Now it'll wait for a certain number of seconds rather than a certain number of times through the loop before deciding that it's timed out and resetting the hardware. Also, add more timeout handling, and reset the draw state after resetting the engine. 2005-01-19 23:28 anholt * radeon_composite.c: Use RadeonSwitchTo3D() instead of doing the WAIT_UNTIL ourselves (RST3D() also does DC_FLUSH, which may be important). 2005-01-19 23:09 anholt * ati_video.c: Add R200 XV support, and make R100 (hopefully) use linear filtering instead of nearest. Also, use RadeonSwitchTo3D instead of doing the WAIT_UNTIL ourselves. 2005-01-19 17:09 anholt * ati_dma.c, ati_reg.h: Make R200 PDMA work -- primary queue sizes are now 9 bits, not 8. 2004-12-22 10:39 anholt * ati_draw.c, ati_reg.h, radeon_composite.c: Back out the previous day's broken R200 "fix" -- the same number of coords are always emitted. Fix the real problem, which was not enough regs being initialized in ati_draw.c. Fix a typo that was resulting in alpha coming out as 0 * src or 0 * broken instead of src * 1 or src * mask. Assign the blending results to R0, as appears to be necessary. Unbreak the dst-alpha-blend-with-no-dst-alpha code. Yow. And set the right DMA count for the r200 traps code. 2004-12-21 01:51 anholt * ati_draw.c, radeon_composite.c: Fix r200 render (for real this time?) by setting tex1_comp_cnt right for non-mask rendering. Reenable it. Also, R200TexFormats was used instead of R100 in one place. Harmless so far, because the formats were in the same order. 2004-12-21 01:49 anholt * ati_dri.c: Whitespace nit. 2004-09-19 20:12 anholt * ati_draw.c, ati_reg.h, radeon_composite.c: Fix the R200 Render code. Composite and Trapezoids are now supported just as well as on R100. 2004-09-19 03:57 anholt * ati_dri.c, ati_reg.h: Unbreak the AGP DRI case. That was quite a pile of broken code. 2004-09-13 23:26 anholt * ati.c, ati_reg.h: Add proper PCI/AGP detection, based on Mike Harris's code for Radeon, but using the MMIO mirror of the bits instead of config space. 2004-09-12 16:22 anholt * ati_draw.c: - Fix a segfault on VT switch with DRI. Still dies due to cursor allocation troubles. - Move the RemoveBlockAndWakeupHandlers to match RegisterBlockAndWakeupHandlers. - Enable R100 trapezoid "acceleration" when DRI is working, so that it can be exposed and worked on. 2004-09-12 16:01 anholt * ati_dri.c: Fix a bad argument missed in the previous commit for ATIDRIDMA* functions. 2004-09-12 15:21 anholt * ati_draw.c: Move the RegisterBlockAndWakeupHandlers to before DRI initialization. The change to use that instead of manual wrapping made the DMA dispatch come after the lock had been dropped, causing lots of pain. 2004-09-12 13:31 anholt * ati.h, ati_dma.c, ati_dri.c: Reset the CCE/CP on engine reset, and make the ATIDRIDMA functions take a more useful argument. 2004-09-12 13:19 anholt * ati_draw.c: Add missing kaa.h include for kaaInitTrapOffsets. 2004-09-12 13:02 anholt * ati_dri.c: Fix handling of is_agp. is_agp is whether the card is actually AGP, while using_agp should say whether AGP is being used as part of DMA/DRI. 2004-09-12 12:52 anholt * ati_dma.c, ati_dma.h, ati_dri.c: Improve error handling, especially in the DRI case. Do some FatalErrors instead of ErrorFs for things that are really bad, and put limits on some loops. Now, sometimes instead of hanging the entire system, we (mostly-) cleanly drop to console when the card has hung. 2004-09-11 02:28 anholt * ati.h, ati_dma.h, ati_draw.c, ati_draw.h, ati_reg.h, r128_composite.c, radeon_composite.c: - Add disabled WIP trapezoid code for R128 and R100. The R128 rendering is not doing an add of 1 per triangle like I hoped, and instead seems to be saturating all the pixels or something. The R100 acceleration renders pretty well, with some gaps. Note that both are slower than software due to lack of DMA to submit vertices. - Mostly fix R128 and Radeon transform support, including supporting bilinear filtering on R128. Subpixel offsets are still probably an issue (reported by rendercheck), but I want to make 100% sure about my understanding of the protocol before changing everybody, including fb. - Add support for dst formats without alpha to R128 Composite. - Remove the R128 Blend code, which has long outlived its usefulness. (I kept it around for one reason: It could be useful for the w/h > 1024 case with no mask and a non-src op. That seems pretty infrequent and not worth the trouble). 2004-07-24 10:02 keithp * ati.c: Check for mmio before restoring crtc/crtc2 pitch registers 2004-07-22 11:17 keithp * ati.c, ati.h, ati_cursor.c, ati_reg.h: 2004-07-22 Keith Packard reviewed by: * hw/kdrive/ati/ati.c: (ATISetOffscreen), (ATISetPitch), (ATIRandRSetConfig), (ATIPreserve), (ATIRestore), (ATIEnable): * hw/kdrive/ati/ati.h: * hw/kdrive/ati/ati_cursor.c: (RadeonLoadCursor), (ATIUnloadCursor), (ATICursorEnable): * hw/kdrive/ati/ati_reg.h: Correct pitch so that accelerator can run on 1400x1050 screens. Add a few more register sets for cursors. 2004-07-19 05:07 anholt * radeon_composite.c: Add support for a8b8g8r8 and x8b8g8r8 pictures, which showed up frequently with metacity usage. 2004-07-19 04:42 anholt * ati_cursor.c: Breakage in last commit to this file: pCurPriv->area isn't set up until Enable, these days. 2004-07-19 04:19 anholt * ati_draw.c: Set the right number of texture coordinates for r200 Render support (still disabled, needs to be tested). 2004-07-19 04:16 anholt * r128_composite.c, radeon_composite.c: - Add Radeon picture transform support. - On R128, don't refer to an old Composite's mask transform when the current Composite doesn't have a mask. - Staticize some global variables in r128_composite.c. 2004-07-19 00:53 anholt * ati.c, ati.h, ati_cursor.c, ati_draw.c, ati_draw.h: Use the offscreen memory manager as much as possible to do the reservation of memory at startup. Do some drive-by cleanups while I'm here (sorry!). 2004-07-19 00:20 anholt * r128_composite.c: Add support for transforms of textures on R128. 2004-07-03 03:23 anholt * r128_composite.c: Clean up Rage 128 composite code. Now it composites more operations correctly and is simpler. 2004-06-27 17:48 keithp * ati.c, ati.h, ati_cursor.c, ati_draw.c: 2004-06-27 Keith Packard * hw/kdrive/ati/ati.c: (ATICardInit), (ATISetOffscreen), (ATIScreenInit), (ATIRandRSetConfig), (ATIRandRInit), (ATIFinishInitScreen), (ATIEnable): * hw/kdrive/ati/ati.h: * hw/kdrive/ati/ati_cursor.c: (ATICursorInit): * hw/kdrive/ati/ati_draw.c: (RadeonSwitchTo2D), (RadeonSwitchTo3D), (ATIBlockHandler), (ATIWakeupHandler), (ATIDrawEnable), (ATIDrawDisable), (ATIDrawFini): Separate out off-screen allocation from Init. Fix Enable to update off-screen addresses. Wrap RandR to update off-screen addresses. * hw/kdrive/fbdev/fbdev.c: (fbdevMapFramebuffer): Set off_screen_base and memory_size fields correctly. 2004-06-25 21:13 keithp * ati.c, ati_cursor.c, ati_draw.c, ati_reg.h: 2004-06-25 Keith Packard * hw/kdrive/ati/ati.c: (ATIScreenInit): * hw/kdrive/ati/ati_cursor.c: (ATIMoveCursor), (ClassicAllocCursorColors), (ClassicSetCursorColors), (ClassicRecolorCursor), (ClassicLoadCursor), (RadeonLoadCursor), (ATIRealizeCursor), (ATISetCursor), (ATICursorEnable), (ATIRecolorCursor): * hw/kdrive/ati/ati_draw.c: (ATIDrawFini): * hw/kdrive/ati/ati_reg.h: Add ARGB cursor support for Radeon cards. 2004-06-10 12:22 anholt * ati_draw.c: - Pass the right pixel mask (all ones) in to PrepareSolid in the solid-fill-based composite acceleration. - Use a real pixmap when doing an UploadToScratch (For pDrawable->type == DRAWABLE_WINDOW, you need to get the backing pixmap). - Pass back the x/y offsets from kaaGetOffscreenPixmap unconditionally, because they'll be used in the scratch case. - Turn on the Render acceleration for Rage 128 and Radeon 100-series at last! 2004-06-10 02:50 anholt * ati_draw.c: Align scratch area offsets to the offscreen byte alignment. 2004-06-10 01:37 anholt * ati_dma.c: Oops, testers reported that the last patch actually didn't work (conflicts occurred), so the R300 PDMA doesn't work. Disable. 2004-06-09 22:57 anholt * ati_dma.c, ati_microcode.c: Bug #242: Fix setup of R300 cards, by providing R300 CP code from volodya-project and initializing PDMA. 2004-05-17 13:18 anholt * Makefile.am, ati.c, ati.h, ati_cursor.c, ati_dma.c, ati_dma.h, ati_draw.c, ati_draw.h, ati_dri.c, ati_microcode.c, ati_reg.h, ati_video.c, r128_composite.c, radeon_composite.c: Overhaul of the ATI driver: - Add monochrome hardware cursor support. - Try to auto-detect AGP support for DRI on Radeons. And fail. Detect it properly on R128. - Set up card for pseudo-DMA if possible. Convert 2D rendering code to prepare DMA packets only. Use generic code to decode DMA packets to MMIO if PDMA is unavailable. Add WIP code to support "real" DMA without DRM support. - Dispatch pending DMA commands when the server sleeps. Otherwise some things, such as typing in an xterm, wouldn't show up for a time. - Fix Radeon Composite acceleration in many ways, and add Rage 128 Composite acceleration. Disable them both due to still-not-understood issues they have. They fail with In, Out, AtopReverse, and Xor, and text rendering is strange. - Add textured XV support for R100 and Rage 128. No brightness/sat controls, but it does support multiple ports, and cooperates with Composite. - Add WIP code for hostdata uploads. - Many cleanups and fixes. 2004-01-24 21:31 anholt * ati_dri.c: Disable GLX visuals code on !GLXEXT, and remove a useless prototype. 2004-01-24 17:30 anholt * ati.c, ati.h, ati_dri.c, radeon_composite.c: - Add glx visuals code based on XFree86's Radeon driver. - Reserve areas for back/depth/span when USING_DRI && GLXEXT. This would be better in a TransitionTo3d, but we'd need to work with the offscreen memory manager for that. - Misc. fixes to ati_dri.c for DRI+GLX. Needs more work still. 2004-01-24 17:16 anholt * ati_draw.h: Oops, turn fallback output back off. 2004-01-24 17:04 anholt * ati_dri.c: Whitespace cleanup. 2004-01-10 16:10 anholt * ati_draw.c, r128_blendtmp.h: Support 1x1 repeat sources in R128's Blend. 2004-01-09 00:43 anholt * ati.c, ati.h, ati_draw.c, ati_draw.h, ati_dri.c: Change PCI ID information field to be one of r128, r100, r200, r300. This is all the information we need so far. Put that information into atic, and use it correctly in the code (unlike before). 2004-01-08 12:18 anholt * ati_draw.c, radeon_composite.c: Compile fixes for non-DRI case and for non-C99 compiler. 2004-01-08 00:25 anholt * ati.c: Forced commit: Previous commit included the removal of the 8192 scanline limit on offscreen memory in the fbdev case. I remember daenzer (who originally put that code in) saying he wasn't sure of it, and there doesn't seem to be any reason for that limit given how acceleration is done. 2004-01-08 00:16 anholt * ati.c, ati.h, ati_draw.c: - Add a new UploadToScratch kaa hook for putting the data for a single pixmap into temporary offscreen storage. Subsequent UploadToScratch may clobber the data of previous ones. This allows hardware acceleration of composite operations on glyphs. - Add a new UploadToScreen kaa hook for doing the actual moving of data to framebuffer. This would allow us to do things like hostdata blits or memcpy to agp and then blit. - Add an UploadToScreen on ATI which is just memcpy, but which will be replaced with a hostdata blit soon. - Add UploadToScratch on ATI and reserve 64k of scratch space. This provided a 3x speedup of rgb24text on my Radeon. 2004-01-06 18:30 anholt * radeon_composite.c: Speed things up slightly by removing Z values from emitted vertices and by emitting as a tri fan rather than a tri list. A rect list would save an additional vertex (out of 4) per rectangle, but there's no measurable speed difference and the tri fan may be useful when transforms come into play. 2004-01-04 12:47 anholt * ati_draw.c, radeon_composite.c: - Correctly set the texture coordinate set source for the second texture unit. - Re-enable Radeon's Composite accel now that fonts work again. 2004-01-03 03:46 anholt * ati_draw.c, radeon_composite.c: - Add more Composite operations, including Saturate, to Radeon Composite accel. I don't 100% trust that the math works for Saturate, but I can't tell from existing information. - Fix texture pitch fallback checks. - Fallback when src or mask have transforms. - Disable Radeon Composite accel until the offset thing is fixed. - Set offscreenPitch to 64 on Radeon thanks to new information and a kaa fix. Fixes acceleration at width!=1024. 2003-12-31 15:24 anholt * radeon_composite.c: Some strange \240 character snuck into the original commit of this file. 2003-12-30 00:45 anholt * ati_drawtmp.h: There's never a copy between different depths. Remove the check. 2003-12-30 00:23 anholt * Makefile.am, ati_draw.c, ati_draw.h, ati_drawtmp.h, ati_reg.h, radeon_composite.c: - Add new Composite hook for kdrive drivers, which only ensures that the pixmaps are offscreen and don't have alpha maps. It is the last case checked before going to software fallback - Use the new Composite hook in the ati driver to implement acceleration of most Composites that get done in an xcompmgr environment on r100 series cards. It is only available when using the DRM. There are still some corruption issues, but the DRI is still non-default and I need to get this into version control. 2003-12-29 01:04 anholt * Makefile.am: Add dependency lines so that servers are rebuilt when server libraries are changed. 2003-12-28 22:24 anholt * Makefile.am, ati.c, ati.h, ati_draw.c, ati_draw.h, ati_drawtmp.h, ati_dri.c, ati_dri.h, ati_dripriv.h, ati_reg.h, ati_sarea.h, ati_stub.c, r128_blendtmp.h, r128_common.h, r128_sarea.h, radeon_common.h, radeon_sarea.h: Merge dri-0-1-branch to trunk. Notable changes: - Add libdrm and libdri. Portions of the DRI extension are stubbed out. - Use the DRM in the ATI driver when available. This provides a minor performance improvement in x11perf, and opens the possibility of using the 3d hardware for acceleration in the future. - Implement solid fill acceleration for Composite in KAA. - Implement Blend hook for Composite and use it on r128. - Fix a bug of mine that resulted in overuse of offscreen memory. - Fix many miscellaneous bugs in ATI driver and add PCI IDs. 2003-12-28 21:10 anholt * ati_drawtmp.h, r128_blendtmp.h: - Disable libdrm verbosity. It isn't important enough yet to make a run-time flag for it. - Fix the (void)atic; tricks to quiet unused variable warnings in ATI template files. Mixing statements and variable defines works in newer compilers, but not pdx's. 2003-12-28 01:16 anholt * ati.h, ati_draw.c, ati_draw.h, ati_drawtmp.h, ati_dri.c, r128_blendtmp.h: - Allow acceleration between same-depth pixmaps, rather than between anything and a dst that matched the screen depth (fixes corruption for non-screen-depth src and makes more acceleration possible). - Add ATI_FALLBACK macro and use it to allow verbose descriptions of why hardware acceleration fails. - Check that src and dst alignment meet requirements of the card before accelerating. The BIOS may set up screens that don't meet the requirements. - Fix the R128 offset alignment (32 bytes, not 8). - Enable Blend operation even if screen is 24bpp (it will fail if the dest is 24bpp anyway). 2003-12-27 02:46 anholt * ati_reg.h, r128_blendtmp.h: Properly initialize texture registers in Blend. Fixes problems with blending code such as whiteness in test-render, or no blending at all. Tested by: andersca 2003-12-23 14:29 anholt * Makefile.am, ati_draw.c, ati_drawtmp.h, ati_reg.h, r128_blendtmp.h: - Implement acceleration of Composite on R128 when there is no mask, no transformation, no repeat, and only certain ops are used. - Add debugging output for software fallbacks for Composite. - Allow pixmaps in offscreen that don't match root depth. - Clean up some mess in ati_reg.h. Many thanks to andersca for a lot of this code. 2003-12-09 21:01 anholt * ati_draw.c: Add missing kaaDrawFini to ATI driver. 2003-12-01 14:56 anholt * Makefile.am, ati.c, ati.h, ati_draw.c, ati_draw.h, ati_drawtmp.h, ati_dri.c, ati_dri.h, ati_dripriv.h, ati_reg.h, ati_sarea.h, ati_stub.c, r128_common.h, r128_sarea.h, radeon_common.h, radeon_sarea.h: - Initial add of enough of the DRI to create a 2d driver that uses the DRM for its acceleration. - Converted the ATI driver to use the DRM to execute rendering commands using DMA instead of MMIO when available. 2003-11-30 20:33 anholt * Makefile.am, ati.c, ati.h, ati_stub.c: - Add fbdev mode-setting backend to Xati. It and vesa are compiled in when available, with fbdev being used by default. - Use depth 16 by default when vesa backend is used. - Add MMIO defines for PowerPC (should be in a common location). Many thanks for Michel Daenzer for much of this code. 2003-11-30 19:15 anholt * ati.c: Add more RV250 PCI IDs. 2003-11-30 17:46 anholt * ati_draw.c: Remove sys/io.h inclusion from some files that didn't need it, and change asm/io.h to sys/io.h in vga.c, which newer Linux complains about. 2003-11-25 14:39 anholt * ati.c: Add new Radeon 9200 PCI IDs. 2003-11-23 02:12 anholt * ati_draw.c: - Fix Radeon offscreen pixmap pitch alignment. - Remove usleeps from idle and waitavail code, recommended by keithp. - Add a workaround for apparent broken acceleration with Rage 128 and offset alignment with 8-bit acceleration (24-hack and plain 8-bit). - Minor cleanup of setup code. 2003-11-22 18:08 anholt * ati.c: Add RV250 PCI IDs. 2003-11-19 23:49 anholt * ati.c, ati.h, ati_draw.c, ati_reg.h: - Fix a bug in pitch alignment for offscren pixmaps. - Add 24-bit acceleration for Xati using the 8-bit trick from mach64. - Add offscreen pixmap support to Xati. 2003-11-19 16:05 anholt * ati.c, ati_draw.c: - Fix confusion of depth/bitsPerPixel in ati_draw.c - Disable acceleration with 24bpp due to apparent broken acceleration. Accel at 24bpp was the cause of the crashes when people tried to use any depth over 16. XFree86 doesn't support 24 either. - Disable at < 8bpp, too. - Add the other Rage 128 PCI IDs. - Remove unnecessary setting of scissor registers (only default scissor gets used). 2003-11-19 00:32 anholt * .cvsignore, Makefile.am, ati.c, ati.h, ati_draw.c, ati_reg.h, ati_stub.c: - Add PCI information (device/vendor id, bus location) to KdCardAttr to help with ati, and future DRM drivers. - Add new "ati" kdrive driver. It has ancestry in the r128 driver from andersca, but took a detour through being the WIP SiS 300 driver on the way. It supports Radeons (tested on QD VIVO and 7500) and Rage 128. Current limitations include that it requires depth 16 and that the other Rage 128 PCI IDs aren't included yet.