Commit graph

253 commits

Author SHA1 Message Date
Jose Fonseca
19c4d51b2d Less verbose ring and buffer dump routines in the DRM to avoid overflow
kmsg.
2002-06-26 19:50:09 +00:00
Jose Fonseca
d5e14d9e01 Fixed the endian problems in mach64_clear_bit in non-x86 architectures and
renamed the function to mach64_clear_dma_eol.
2002-06-21 20:55:47 +00:00
Jose Fonseca
8a6e0b2caa Use of atomic bit ops in ADVANCE_RING() to lock the BUS when writing to the
descriptor table. Slight changes to make the GUI master operations be
    handled more similarly to the Mach64 SDK example.
2002-06-19 18:57:23 +00:00
Jose Fonseca
f7aa134628 Use of le32_to_cpu for the descriptor data and other small fixes in
dump_ring_info.
2002-06-15 08:50:47 +00:00
Leif Delgass
1df3dc0a45 verify blit buffer size 2002-06-13 00:43:31 +00:00
Jose Fonseca
499ea3f017 Better structuring of UPDATE_RING_HEAD and ring related code.
mach64_dump_ring_info now dumps the contents of the buffer pointed by
    the head, via mach64_dump_buf_info.
2002-06-12 17:33:52 +00:00
Jose Fonseca
95f92b7164 Fixed the bug which caused some lockups: UPDATE_RING_HEAD could (and was)
being called without the BM enabled. Disabled the code in
    RING_SPACE_TEST_WITH_RETURN which seems to be no longer necessary.
    Slightly enhanced ADVANCE_RING by eliminating the need to mark DMA_EOL
    in the current tail.
2002-06-11 15:18:04 +00:00
Leif Delgass
75d5b6bb0e First half of commit (DRM) for blits using BM_HOSTDATA. This elminates the
need for userspace clients to add HOSTDATA0 commands to blit buffers
    every 16 dwords. However, it requires using BM_HOSTDATA rather than
    BM_ADDR as the target register in the DMA descriptors for the blit
    data. The first descriptor for a blit buffer sets up the state using
    BM_ADDR. Both types of descriptor work with SRC_BM_OP_SYSTEM_TO_REG in
    SRC_CNTL.
2002-06-08 21:11:35 +00:00
Jose Fonseca
c351b6dd62 Added mach64_dump_ring - a function to dump the active portion of the ring
buffer, as well as the relevant registers. Added a few assertions to
    make sure we aren't using trying to free used buffers. These checks are
    guarded by MACH64_EXTRA_CHECKING to facilitate their future removal.
2002-06-08 09:53:14 +00:00
Jose Fonseca
b236dd748c Protect the GETBUFPTR and GETBUFADDR macros with parenthesis so that they
retain their functionality when used in expressions or comparisons.
2002-06-07 21:24:30 +00:00
Leif Delgass
7b2f55298e Fix bug in UPDATE_RING_HEAD when calculating head_addr. Also some code
cleanup: get rid of unused last_cmd, last_cmd_ofs. Don't allow sending
    buffers via drmDMA.
2002-06-06 14:58:52 +00:00
Jose Fonseca
fe8e3bcca9 The bus master operation is now always checked on the wait loops, fixing
the lockups experienced in the NO_BATCH_DISPATCH code path. All other
    code paths besides NO_BATCH_DISPATCH are broken. do_dma_flush waits for
    completion of all DMA buffers and not just idle engine.
2002-06-06 09:15:50 +00:00
Leif Delgass
c7f975325e Don't release all buffers in the pending list in do_dma_idle for the
NO_BATCH_DISPATCH path, in case the ring hasn't been flushed before
    calling the function.
2002-06-04 20:00:59 +00:00
Leif Delgass
49a9928507 Code clean up, added RING macros, initial try at emitting descriptors to
the ring as they are sent by the client (enabled with
    MACH64_NO_BATCH_DISPATCH). For the "no batch dispatch" path:
- The DMA end of list flag is moved in the COMMIT_RING macro.
- The flush function only starts a new pass if the card has gone idle and
    there are descriptors on the ring still unprocessed. This could be
    better optimized to flush only when there is a large enough queue on
    the card, but we'll always need to flush if we run out of freeable
    buffers.
- This path is working up to a point, but lockups still occur. There is a
    small performance improvement.
2002-06-01 21:56:27 +00:00
Jose Fonseca
322a767359 Do not add commands to the end of each buffer to disable busmastering, so
that it's possible to queue buffers while the engine is running. This
    code was put instead on mach64_do_dma_idle so that the busmastering is
    disabled when giving control to the X server.
2002-05-29 18:45:39 +00:00
Jose Fonseca
e111a0ce88 Initialize the freelists before doing any check to the X server data, to
avoid free a non-initialize list in case of failure.
2002-05-28 20:49:38 +00:00
Leif Delgass
2e790fa43c Fix leak of temporary data table if bus master test fails 2002-05-25 04:06:15 +00:00
Leif Delgass
296a76507f fix typo in DRIVER_UNINSTALL() macro 2002-05-23 21:13:53 +00:00
Leif Delgass
5d63766f92 Add conditional definition of list_for_each_safe for earlier kernels. 2002-05-23 16:54:01 +00:00
Leif Delgass
2f11e6b84f - Check BM_GUI_TABLE for buffer completion rather than using pattern
registers for aging
- Disabled frame aging in the drm
- Disable save/restore pattern registers on context switch with DDX
- Move wait for DMA idle from EnterServer to XAA Sync.
- Clean up locking/sync macros in DDX
- Group scissor registers with UPLOAD_MISC in sarea to avoid confusion with
    cliprects (mach64 doesn't have hardware cliprects, just the single
    scissor).
2002-05-22 04:11:12 +00:00
Leif Delgass
3a83c18c24 Checkpoint commit of async DMA, blits and AGP texturing. Buffer aging is
done with the pattern registers which is not ideal, but works. There
    are still lots of places where optimizing is needed. We need to do the
    minimum required to sync with the X server on context switches, since
    right now things slow down whenever the mouse is moved.
2002-05-18 08:57:54 +00:00
Leif Delgass
c3e3c95731 - interrupt-driven DMA framework written by Frank C. Earl (merged from
mach64-0-0-3-dma-branch)
- I've partly filled in the dma_dispatch implementation from the vertex
    dispatch code. We still need to deal with adding a register reset
    buffer to the end of the dma pass. The freelist and blits are also
    still to be filled in.
- I've added XF86Config options for the driver: ForcePCIMode - Don't use
    AGP for buffers/textures, even if agpgart is present PseudoDMAMode -
    Dispatch DMA buffers with MMIO, one register at a time. AgpMode - 1 or
    2 AgpSize - Size of AGP aperture to use for allocations BufferSize -
    Size of vertex buffers in MB (1 or 2)
2002-05-08 05:32:52 +00:00
Jose Fonseca
b53b0e0a04 Use of readl/writel macros for MMIO 2002-05-02 10:12:30 +00:00
Leif Delgass
95417f81a9 Fix typo in last commit (cleanup fix) 2002-05-01 21:12:35 +00:00
Leif Delgass
7379023cec Fix bug in _do_cleanup_dma with freeing descriptor table 2002-05-01 20:59:22 +00:00
Leif Delgass
10b06bc8b3 fix buffer size in descriptor for DMA test. 2002-05-01 00:14:07 +00:00
Leif Delgass
265b19947c Enable/disable DMA based on result of gui-mastering test. MMIO mode can
still be forced at compile time by setting MACH64_USE_DMA to 0.
DMA test now uses already allocated pci pool memory for descriptor table
    and allocates a temporary dma buffer from the pool. This should
    probabaly be changed to use one of our mapped vertex/dma buffers.
Also, return error code if _dispatch_vertex causes a lockup, either with
    DMA (wait for idle fails) or MMIO (wait for fifo times out).
2002-05-01 00:10:29 +00:00
Jose Fonseca
33e6c36a6e Use DMA by default. 2002-04-30 12:21:20 +00:00
Leif Delgass
dd8f31bcef Disable code that was causing kernel oops. I haven't yet determined why the
oops happens.
2002-04-28 18:48:59 +00:00
Leif Delgass
2558b54aa0 Byte swapping for vertex DMA data and DMA descriptors 2002-04-28 04:33:56 +00:00
Leif Delgass
121100a515 Account for endianess in register reads/writes. 2002-04-27 19:16:23 +00:00
Leif Delgass
45a5c02888 use virt_to_bus instead of virt_to_phys to get DMA buffer address, which
should work on non-x86 architecures.
2002-04-27 04:46:17 +00:00
Leif Delgass
edac61a944 remove duplicate prototype for mach64_do_wait_for_idle (oops) 2002-04-26 22:03:29 +00:00
Leif Delgass
40a9e22bf9 Initial hacked-up code for synchronous DMA of vertex buffers (disabled but
functional for both PCI and AGP). 16 KB descriptor table is created by
    the drm and the handles stored in the device private structure.
Finish setup of AGP -- AGP registers are now initialized.
Fix up MMIO for PCI.
2002-04-26 21:57:07 +00:00
Jose Fonseca
c04bb660f4 Better support for kernel ring buffers. Changes to allow the evetual use of
buffer aging.
2002-04-23 23:47:09 +00:00
Jose Fonseca
0436f9bb35 Fixed the DMA emul code which was checking the FIFO every 17th entry
instead of 16
2002-04-21 23:38:55 +00:00
Jose Fonseca
3c16d33f8a Changed the DMA emulation code to wait for FIFO instead of idle engine 2002-04-21 23:34:01 +00:00
Jose Fonseca
95dba10bc0 Slighty more optimized DMA emulation C code. Support for waiting for
checking empty FIFO - but disabled for now.
2002-04-21 14:32:28 +00:00
Leif Delgass
31a6440465 Implement streamlined vertex buffer by setting up multiple sequential
register writes.
Register addresses in command/vertex buffer now specified by memory-mapped
    address, which is needed for real DMA.
Fix multi-reg write increment in pseudo-DMA flush (byte address needs +4
    incr.).
Restore DMAGETPTR grouping of state register writes.
2002-04-21 06:25:08 +00:00
Jose Fonseca
b21b585cf0 Forgot to increment the register number in the pseudo DMA algorithm 2002-04-20 22:04:42 +00:00
Jose Fonseca
e5b7dc8c19 Fixed another discrepancy in mach64_drm.h (this one harmless because is
wasn't being used). Use of the DMAGETPTR / DMAADVANCE for which
    conditional as they aren't executed in block. Update of
    mach64_print_dirty.
2002-04-20 21:42:00 +00:00
Leif Delgass
bd00770298 Add agp texture region info to DRM. Also, use DMA* macros for DRM
emit_state functions. This ensures a wait_for_fifo for the MMIO writes.
2002-04-20 20:11:08 +00:00
Jose Fonseca
f080c751f3 Fix a discrepancy in the definition of the upload flags. This still doesn't
fix the problem that since the last update UT and some example aren't
    showing textures anymore, but other programs do...
2002-04-20 12:28:20 +00:00
Jose Fonseca
d04ebd5463 Added the state hardware programming functions to here 2002-04-20 12:03:19 +00:00
Leif Delgass
7aea29f4bc Preliminary changes required for AGP textures. AGP texture area is now
mapped in the DDX driver and Mesa client. DRI and Mesa screen
    structures updated to add agp texture region data. The AGP card heap is
    not setup in the Mesa driver screen init yet, so about all this does
    right now is print AGP mode info in the renderer string and the texture
    region should show up in the X log and /proc/dri
2002-04-20 07:38:16 +00:00
Jose Fonseca
c7df8b994c Fixed the DMA emulation code thanks to Keith 2002-04-20 00:20:49 +00:00
Jose Fonseca
c0622174af Code restructuring to be more similar to the existing drivers.
Implementation of several functions to support the handling of DMA
    buffers. The DMA emulation code is disabled because it segfaults when
    trying to read the DMA buffer.
2002-04-19 07:12:32 +00:00
Jose Fonseca
b7ff3cdd0f Removal of erroneous PCI GART code. Better support for PCI cards. More
robustness in the DRM DMA initialization code.
2002-04-15 00:51:14 +00:00
Jose Fonseca
572ee321d9 Error checking when mapping as is done in other drivers 2002-04-12 13:02:26 +00:00
Leif Delgass
0873cfb116 Make sure we wait for enough FIFO entries (needed to add 2 to account for
scissors being added in a couple places).
2002-04-09 22:27:42 +00:00