Index: git/hw/kdrive/w100/ati.c =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ git/hw/kdrive/w100/ati.c 2006-09-02 12:12:14.000000000 +0200 @@ -0,0 +1,434 @@ +/* + * Copyright © 2006 Alberto Mardegan + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Alberto Mardegan not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Alberto Mardegan makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * ALBERTO MARDEGAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL ALBERTO MARDEGAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "ati.h" +#include "w100_regs.h" + + +struct pci_id_entry ati_pci_ids[] = { + {0x1002, 0x5644, 0, "ATI Imageon 3200"}, + {0x1002, 0x5741, 0, "ATI Imageon 100"}, + {0x1002, 0x5744, 0, "ATI Imageon 3220"}, + {0, 0, 0, NULL} +}; + + +static Bool +ATICardInit(KdCardInfo * card) +{ + ATICardInfo *atic; + int i; + Bool initialized = FALSE; + + atic = xcalloc(sizeof(ATICardInfo), 1); + if (atic == NULL) + return FALSE; + +#ifdef KDRIVEFBDEV + if (!initialized && fbdevInitialize(card, &atic->backend_priv.fbdev)) { + atic->use_fbdev = TRUE; + initialized = TRUE; + atic->backend_funcs.cardfini = fbdevCardFini; + atic->backend_funcs.scrfini = fbdevScreenFini; + atic->backend_funcs.initScreen = fbdevInitScreen; + atic->backend_funcs.finishInitScreen = fbdevFinishInitScreen; + atic->backend_funcs.createRes = fbdevCreateResources; + atic->backend_funcs.preserve = fbdevPreserve; + atic->backend_funcs.restore = fbdevRestore; + atic->backend_funcs.dpms = fbdevDPMS; + atic->backend_funcs.enable = fbdevEnable; + atic->backend_funcs.disable = fbdevDisable; + atic->backend_funcs.getColors = fbdevGetColors; + atic->backend_funcs.putColors = fbdevPutColors; +#ifdef RANDR + atic->backend_funcs.randrSetConfig = fbdevRandRSetConfig; +#endif + } +#endif +#ifdef KDRIVEVESA + if (!initialized && vesaInitialize(card, &atic->backend_priv.vesa)) { + atic->use_vesa = TRUE; + initialized = TRUE; + atic->backend_funcs.cardfini = vesaCardFini; + atic->backend_funcs.scrfini = vesaScreenFini; + atic->backend_funcs.initScreen = vesaInitScreen; + atic->backend_funcs.finishInitScreen = vesaFinishInitScreen; + atic->backend_funcs.createRes = vesaCreateResources; + atic->backend_funcs.preserve = vesaPreserve; + atic->backend_funcs.restore = vesaRestore; + atic->backend_funcs.dpms = vesaDPMS; + atic->backend_funcs.enable = vesaEnable; + atic->backend_funcs.disable = vesaDisable; + atic->backend_funcs.getColors = vesaGetColors; + atic->backend_funcs.putColors = vesaPutColors; +#ifdef RANDR + atic->backend_funcs.randrSetConfig = vesaRandRSetConfig; +#endif + } +#endif + + if (!initialized || !ATIMap(card, atic)) { + xfree(atic); + return FALSE; + } + + card->driver = atic; + + for (i = 0; ati_pci_ids[i].name != NULL; i++) { + if (ati_pci_ids[i].device == card->attr.deviceID) { + atic->pci_id = &ati_pci_ids[i]; + break; + } + } + + ErrorF("Using ATI card: %s\n", atic->pci_id->name); + + return TRUE; +} + +static void +ATICardFini(KdCardInfo * card) +{ + ATICardInfo *atic = (ATICardInfo *) card->driver; + + ATIUnmap(card, atic); + atic->backend_funcs.cardfini(card); +} + +/* + * Once screen->off_screen_base is set, this function + * allocates the remaining memory appropriately + */ + +static void +ATISetOffscreen(KdScreenInfo * screen) +{ + ATICardInfo(screen); + int screen_size; + char *mmio = atic->reg_base; + + /* check (and adjust) pitch */ + if (mmio) { + int byteStride = screen->fb[0].byteStride; + int bitStride; + int pixelStride; + int bpp = screen->fb[0].bitsPerPixel; + + /* + * Ensure frame buffer is correctly aligned + */ + if (byteStride & 0x3f) { + byteStride = (byteStride + 0x3f) & ~0x3f; + bitStride = byteStride * 8; + pixelStride = bitStride / bpp; + + screen->fb[0].byteStride = byteStride; + screen->fb[0].pixelStride = pixelStride; + } + } + + screen_size = screen->fb[0].byteStride * screen->height; + + screen->off_screen_base = screen_size; + +} + +static Bool +ATIScreenInit(KdScreenInfo * screen) +{ + ATIScreenInfo *atis; + ATICardInfo(screen); + Bool success = FALSE; + + atis = xcalloc(sizeof(ATIScreenInfo), 1); + if (atis == NULL) + return FALSE; + + atis->atic = atic; + atis->screen = screen; + screen->driver = atis; + + if (screen->fb[0].depth == 0) + screen->fb[0].depth = 16; +#ifdef KDRIVEFBDEV + if (atic->use_fbdev) { + success = fbdevScreenInitialize(screen, &atis->backend_priv.fbdev); + } +#endif +#ifdef KDRIVEVESA + if (atic->use_vesa) { + success = vesaScreenInitialize(screen, &atis->backend_priv.vesa); + } +#endif + + if (!success) { + screen->driver = NULL; + xfree(atis); + return FALSE; + } + + ErrorF + ("Offscreen memory at offset %08x, memory base %08x, size %08x\n", + screen->off_screen_base, screen->memory_base, + screen->memory_size); + ATISetOffscreen(screen); + + return TRUE; +} + +#ifdef RANDR +static Bool +ATIRandRSetConfig(ScreenPtr pScreen, + Rotation randr, int rate, RRScreenSizePtr pSize) +{ + KdScreenPriv(pScreen); + KdScreenInfo *screen = pScreenPriv->screen; + ATICardInfo *atic = screen->card->driver; + Bool ret; + + ATIDrawDisable(pScreen); + ret = atic->backend_funcs.randrSetConfig(pScreen, randr, rate, pSize); + ATISetOffscreen(screen); + /* + * Set frame buffer mapping + */ + (*pScreen->ModifyPixmapHeader) (fbGetScreenPixmap(pScreen), + pScreen->width, + pScreen->height, + screen->fb[0].depth, + screen->fb[0].bitsPerPixel, + screen->fb[0].byteStride, + screen->fb[0].frameBuffer); + + ATIDrawEnable(pScreen); + return ret; +} + +static Bool +ATIRandRInit(ScreenPtr pScreen) +{ + rrScrPrivPtr pScrPriv; + + pScrPriv = rrGetScrPriv(pScreen); + pScrPriv->rrSetConfig = ATIRandRSetConfig; + return TRUE; +} +#endif + +static void +ATIScreenFini(KdScreenInfo * screen) +{ + ATIScreenInfo *atis = (ATIScreenInfo *) screen->driver; + ATICardInfo *atic = screen->card->driver; + + atic->backend_funcs.scrfini(screen); + xfree(atis); + screen->driver = 0; +} + +Bool +ATIMap(KdCardInfo * card, ATICardInfo * atic) +{ + atic->mem_base = (CARD8 *) KdMapDevice(ATI_MEM_BASE(card), + ATI_MEM_SIZE(card)); + + if (atic->mem_base == NULL) + return FALSE; + atic->reg_base = atic->mem_base + 0x10000; /* XXX */ + + KdSetMappedMode(ATI_MEM_BASE(card), ATI_MEM_SIZE(card), + KD_MAPPED_MODE_REGISTERS); + + return TRUE; +} + +void +ATIUnmap(KdCardInfo * card, ATICardInfo * atic) +{ + if (atic->reg_base) { + KdResetMappedMode(ATI_REG_BASE(card), ATI_REG_SIZE(card), + KD_MAPPED_MODE_REGISTERS); + KdUnmapDevice((void *) atic->reg_base, ATI_REG_SIZE(card)); + atic->reg_base = 0; + } +} + +static Bool +ATIInitScreen(ScreenPtr pScreen) +{ + KdScreenPriv(pScreen); + ATICardInfo(pScreenPriv); + + return atic->backend_funcs.initScreen(pScreen); +} + +static Bool +ATIFinishInitScreen(ScreenPtr pScreen) +{ + KdScreenPriv(pScreen); + ATICardInfo(pScreenPriv); + + if (!atic->backend_funcs.finishInitScreen(pScreen)) + return FALSE; +#ifdef RANDR + if (!ATIRandRInit(pScreen)) + return FALSE; +#endif + return TRUE; +} + +static Bool +ATICreateResources(ScreenPtr pScreen) +{ + KdScreenPriv(pScreen); + ATICardInfo(pScreenPriv); + + return atic->backend_funcs.createRes(pScreen); +} + +static void +ATIPreserve(KdCardInfo * card) +{ + ATICardInfo *atic = card->driver; + + atic->backend_funcs.preserve(card); +} + +static void +ATIRestore(KdCardInfo * card) +{ + ATICardInfo *atic = card->driver; + + ATIUnmap(card, atic); + + atic->backend_funcs.restore(card); +} + +static Bool +ATIDPMS(ScreenPtr pScreen, int mode) +{ + KdScreenPriv(pScreen); + ATICardInfo(pScreenPriv); + + return atic->backend_funcs.dpms(pScreen, mode); +} + +static Bool +ATIEnable(ScreenPtr pScreen) +{ + KdScreenPriv(pScreen); + ATICardInfo(pScreenPriv); + mc_ext_mem_location_u eml; + char *mmio; + + if (!atic->backend_funcs.enable(pScreen)) + return FALSE; + + if ((atic->reg_base == NULL) + && !ATIMap(pScreenPriv->screen->card, atic)) + return FALSE; + + mmio = atic->reg_base; + eml.val = MMIO_IN32(mmio, mmMC_EXT_MEM_LOCATION); + atic->ext_mem_location = eml.f.mc_ext_mem_start << 8; + ATISetOffscreen(pScreenPriv->screen); + + return TRUE; +} + +static void +ATIDisable(ScreenPtr pScreen) +{ + KdScreenPriv(pScreen); + ATICardInfo(pScreenPriv); + + ATIUnmap(pScreenPriv->card, atic); + + atic->backend_funcs.disable(pScreen); +} + +static void +ATIGetColors(ScreenPtr pScreen, int fb, int n, xColorItem * pdefs) +{ + KdScreenPriv(pScreen); + ATICardInfo(pScreenPriv); + + atic->backend_funcs.getColors(pScreen, fb, n, pdefs); +} + +static void +ATIPutColors(ScreenPtr pScreen, int fb, int n, xColorItem * pdefs) +{ + KdScreenPriv(pScreen); + ATICardInfo(pScreenPriv); + + atic->backend_funcs.putColors(pScreen, fb, n, pdefs); +} + +/* Compute log base 2 of val. */ +int +ATILog2(int val) +{ + int bits; + + for (bits = 0; val != 0; val >>= 1, ++bits); + return bits - 1; +} + + + +KdCardFuncs ATIFuncs = { + ATICardInit, /* cardinit */ + ATIScreenInit, /* scrinit */ + ATIInitScreen, /* initScreen */ + ATIFinishInitScreen, /* finishInitScreen */ + ATICreateResources, /* createRes */ + ATIPreserve, /* preserve */ + ATIEnable, /* enable */ + ATIDPMS, /* dpms */ + ATIDisable, /* disable */ + ATIRestore, /* restore */ + ATIScreenFini, /* scrfini */ + ATICardFini, /* cardfini */ + +#define ATICursorInit 0 +#define ATICursorEnable 0 +#define ATICursorDisable 0 +#define ATICursorFini 0 +#define ATIRecolorCursor 0 + ATICursorInit, /* initCursor */ + ATICursorEnable, /* enableCursor */ + ATICursorDisable, /* disableCursor */ + ATICursorFini, /* finiCursor */ + ATIRecolorCursor, /* recolorCursor */ + + ATIDrawInit, /* initAccel */ + ATIDrawEnable, /* enableAccel */ + ATIDrawDisable, /* disableAccel */ + ATIDrawFini, /* finiAccel */ + + ATIGetColors, /* getColors */ + ATIPutColors, /* putColors */ +}; Index: git/hw/kdrive/w100/ati_cursor.c =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ git/hw/kdrive/w100/ati_cursor.c 2006-09-02 12:12:14.000000000 +0200 @@ -0,0 +1,93 @@ +/* + * Copyright © 2006 Alberto Mardegan + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Alberto Mardegan not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Alberto Mardegan makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * ALBERTO MARDEGAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL ALBERTO MARDEGAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "ati.h" +#include "cursorstr.h" +#include "ati_draw.h" + +static void +ATIMoveCursor(ScreenPtr pScreen, int x, int y) +{ +} + + +static Bool +ATIRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor) +{ + return FALSE; +} + + +static Bool +ATIUnrealizeCursor(ScreenPtr pScreen, CursorPtr pCursor) +{ + return TRUE; +} + + +static void +ATISetCursor(ScreenPtr pScreen, CursorPtr pCursor, int x, int y) +{ +} + + +miPointerSpriteFuncRec ATIPointerSpriteFuncs = { + ATIRealizeCursor, + ATIUnrealizeCursor, + ATISetCursor, + ATIMoveCursor, +}; + + +void +ATICursorEnable(ScreenPtr pScreen) +{ +} + + +void +ATICursorDisable(ScreenPtr pScreen) +{ +} + + +Bool +ATICursorInit(ScreenPtr pScreen) +{ + return FALSE; +} + + +void +ATIRecolorCursor(ScreenPtr pScreen, int ndef, xColorItem * pdef) +{ + return; +} + + +void +ATICursorFini(ScreenPtr pScreen) +{ +} Index: git/hw/kdrive/w100/ati_dma.c =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ git/hw/kdrive/w100/ati_dma.c 2006-09-02 12:12:14.000000000 +0200 @@ -0,0 +1,333 @@ +/* + * Copyright © 2006 Alberto Mardegan + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Alberto Mardegan not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Alberto Mardegan makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * ALBERTO MARDEGAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL ALBERTO MARDEGAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +#include + +#include "ati.h" +#include "w100_regs.h" +#include "w100_const.h" +#include "ati_dma.h" +#include "ati_draw.h" + + +#define DEBUG_FIFO 0 + +extern CARD32 w100_microcode[][2]; + +#if DEBUG_FIFO +static void +ATIDebugFifo(ATIScreenInfo * atis) +{ + ATICardInfo *atic = atis->atic; + char *mmio = atic->reg_base; + + ErrorF("mmCP_CSQ_CNTL: 0x%08x\n", MMIO_IN32(mmio, mmCP_CSQ_CNTL)); + ErrorF("mmCP_CSQ_STAT: 0x%08x\n", MMIO_IN32(mmio, mmCP_CSQ_STAT)); + ErrorF("mmRBBM_STATUS: 0x%08x\n", MMIO_IN32(mmio, mmRBBM_STATUS)); +} +#endif + +static void +ATIUploadMicrocode(ATIScreenInfo * atis) +{ + ATICardInfo *atic = atis->atic; + char *mmio = atic->reg_base; + int i; + + MMIO_OUT32(mmio, mmCP_ME_RAM_ADDR, 0); + for (i = 0; i < 256; i++) { + MMIO_OUT32(mmio, mmCP_ME_RAM_DATAH, w100_microcode[i][1]); + MMIO_OUT32(mmio, mmCP_ME_RAM_DATAL, w100_microcode[i][0]); + } +} + +/* Required when reading from video memory after acceleration to make sure all + * data has been flushed to video memory from the pixel cache. + */ +static void +ATIFlushPixelCache(ATIScreenInfo * atis) +{ + ATICardInfo *atic = atis->atic; + char *mmio = atic->reg_base; + rbbm_status_u rs; + TIMEOUT_LOCALS; + + WHILE_NOT_TIMEOUT(.2) { + rs.val = MMIO_IN32(mmio, mmRBBM_STATUS); + if (!rs.f.gui_active) + break; + } + if (TIMEDOUT()) + ErrorF("Timeout flushing pixel cache.\n"); +} + +static void +ATIEngineReset(ATIScreenInfo * atis) +{ + ATICardInfo *atic = atis->atic; + char *mmio = atic->reg_base; + CARD32 sclk_cntl; + sclk_cntl_u sc; + rbbm_soft_reset_u rsr; + +#if DEBUG_FIFO + ErrorF("Engine Reset!\n"); + ATIDebugFifo(atis); +#endif + + ATIFlushPixelCache(atis); + + sc.val = sclk_cntl = MMIO_IN32(mmio, mmSCLK_CNTL); + sc.f.sclk_force_e2 = sc.f.sclk_force_e3 = sc.f.sclk_force_idct = 1; + MMIO_OUT32(mmio, mmSCLK_CNTL, sc.val); + + rsr.val = 0; + rsr.f.soft_reset_e2 = 1; + MMIO_OUT32(mmio, mmRBBM_SOFT_RESET, rsr.val); + MMIO_OUT32(mmio, mmRBBM_SOFT_RESET, 0); + + MMIO_OUT32(mmio, mmSCLK_CNTL, sclk_cntl); +} + +inline void +ATIWaitAvailMMIO(ATIScreenInfo * atis, int n) +{ + ATICardInfo *atic = atis->atic; + char *mmio = atic->reg_base; + rbbm_status_u rs; + TIMEOUT_LOCALS; + + if (atis->mmio_avail >= n) { + atis->mmio_avail -= n; + return; + } + WHILE_NOT_TIMEOUT(.2) { + rs.val = MMIO_IN32(mmio, mmRBBM_STATUS); + atis->mmio_avail = rs.f.cmdfifo_avail; + if (atis->mmio_avail >= n) + break; + ErrorF("Available %d slots.\n", atis->mmio_avail); + } + if (TIMEDOUT()) { + ErrorF("Timeout waiting for %d MMIO slots.\n", n); + ATIEngineReset(atis); + ATIDrawSetup(atis->screen->pScreen); + } + atis->mmio_avail -= n; +} + + +void +ATIWaitIdle(ATIScreenInfo * atis) +{ + ATICardInfo *atic = atis->atic; + char *mmio = atic->reg_base; + rbbm_status_u rs; + TIMEOUT_LOCALS; + + /* Empty the fifo */ + ATIWaitAvailMMIO(atis, 16); + + WHILE_NOT_TIMEOUT(.2) { + rs.val = MMIO_IN32(mmio, mmRBBM_STATUS); + if (!rs.f.gui_active) + break; +#if DEBUG_FIFO + ATIDebugFifo(atis); +#endif + /* don't know if this is needed, but it's in aticore */ + MMIO_IN32(mmio, mmCP_RB_RPTR); + } + if (TIMEDOUT()) { + ErrorF("Timeout idling accelerator, resetting...\n"); + ATIEngineReset(atis); + ATIDrawSetup(atis->screen->pScreen); + } + + ATIFlushPixelCache(atis); + +#if DEBUG_FIFO + ErrorF("Idle?\n"); + ATIDebugFifo(atis); +#endif +} + + +static Bool +ATIDMAInit(ScreenPtr pScreen, Bool use_agp) +{ + KdScreenPriv(pScreen); + ATIScreenInfo(pScreenPriv); + ATICardInfo(pScreenPriv); + char *mmio = atic->reg_base; + int dma_offset, rbsize = 10; + wrap_start_dir_u wsd; + wrap_buf_a_u wba; + cp_rb_cntl_u rc; + cp_csq_cntl_u cc; + CARD32 mem_offset; + + /* with rbsize = 10, DMA buffer will be of 0x2000 (8192) bytes */ + atis->ring_count = 1 << (rbsize + 1); + atis->ring_mask = atis->ring_count - 1; + atis->ring_len = atis->ring_count * 4; + atis->dma_space = KdOffscreenAlloc(pScreen, atis->ring_len, + 16, TRUE, NULL, NULL); + if (atis->dma_space == NULL) + return FALSE; + + wsd.val = MMIO_IN32(mmio, mmWRAP_START_DIR); + atis->ring_addr = + (CARD32 *) (atic->mem_base + (wsd.f.start_addr << 1)); + dma_offset = atis->dma_space->offset; + + ATIUploadMicrocode(atis); + ATIEngineReset(atis); + + atis->ring_read = 0; + atis->ring_write = 0; + atis->ring_free = atis->ring_count; + + mem_offset = atic->ext_mem_location + atis->dma_space->offset; + MMIO_OUT32(mmio, mmCP_RB_BASE, mem_offset); + MMIO_OUT32(mmio, mmCP_RB_WPTR, atis->ring_write); + MMIO_OUT32(mmio, mmCP_RB_RPTR, atis->ring_read); + MMIO_OUT32(mmio, mmCP_RB_RPTR_ADDR, 0); + + wba.val = 0; + wba.f.offset_addr_a = mem_offset; + switch (rbsize) { + case 9: + wba.f.block_size_a = WB_BLOCK_SIZE_A_0; + break; + case 10: + wba.f.block_size_a = WB_BLOCK_SIZE_A_1; + break; + case 11: + wba.f.block_size_a = WB_BLOCK_SIZE_A_2; + break; + case 12: + wba.f.block_size_a = WB_BLOCK_SIZE_A_3; + break; + case 13: + wba.f.block_size_a = WB_BLOCK_SIZE_A_4; + break; + } + MMIO_OUT32(mmio, mmWRAP_BUF_A, wba.val); + + rc.val = 0; + rc.f.rb_no_update = 1; + rc.f.rb_bufsz = rbsize; + MMIO_OUT32(mmio, mmCP_RB_CNTL, rc.val); + + cc.val = 0; + cc.f.csq_mode = CSQ_CNTL_MODE_FREERUN; + MMIO_OUT32(mmio, mmCP_CSQ_CNTL, cc.val); + + return TRUE; +} + +static Bool +ATIDMAFini(ScreenPtr pScreen) +{ + KdScreenPriv(pScreen); + ATIScreenInfo(pScreenPriv); + ATICardInfo(pScreenPriv); + char *mmio = atic->reg_base; + + MMIO_OUT32(mmio, mmCP_CSQ_CNTL, 0); + + ATIEngineReset(atis); + + //KdOffscreenFree(pScreen, atis->dma_space); + + return TRUE; +} + +void +ATIDMASetup(ScreenPtr pScreen) +{ + KdScreenPriv(pScreen); + ATIScreenInfo(pScreenPriv); + + atis->using_dma = FALSE; + atis->using_pio = FALSE; + if (ATIDMAInit(pScreen, FALSE)) + atis->using_dma = TRUE; + + if (atis->using_dma) + ErrorF("Initialized DMA\n"); +} + +void +ATIDMATeardown(ScreenPtr pScreen) +{ + KdScreenPriv(pScreen); + ATIScreenInfo(pScreenPriv); + + ATIWaitIdle(atis); + + if (atis->using_dma) + ATIDMAFini(pScreen); + + atis->using_pio = FALSE; + atis->using_dma = FALSE; +} + + +CARD32 * +ATIRequestEntries(ATIScreenInfo * atis, int n) +{ + char *mmio = atis->atic->reg_base; + CARD32 *ptr; + TIMEOUT_LOCALS; + + WHILE_NOT_TIMEOUT(1) { + if (atis->ring_free > n) { + ptr = atis->ring_addr + atis->ring_write; + return ptr; + } + atis->ring_read = MMIO_IN32(mmio, mmCP_RB_RPTR); + atis->ring_write = MMIO_IN32(mmio, mmCP_RB_WPTR); + + if (atis->ring_read == atis->ring_write) { + atis->ring_free = atis->ring_count; + } else { + atis->ring_free = + (atis->ring_count + + atis->ring_read - atis->ring_write) & atis->ring_mask; + } + } + if (TIMEDOUT()) + ErrorF("Timeout waiting for %d entries.\n", n); + return NULL; +} + +void +ATISubmitEntries(ATIScreenInfo * atis, int n) +{ + char *mmio = atis->atic->reg_base; + atis->ring_free -= n; + atis->ring_write += n; + atis->ring_write &= atis->ring_mask; + MMIO_OUT32(mmio, mmCP_RB_WPTR, atis->ring_write); +} Index: git/hw/kdrive/w100/ati_dma.h =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ git/hw/kdrive/w100/ati_dma.h 2006-09-02 12:12:14.000000000 +0200 @@ -0,0 +1,176 @@ +/* + * Copyright © 2004 Eric Anholt + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Eric Anholt not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Eric Anholt makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL ERIC ANHOLT BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ +/* $Header: /cvs/xserver/xserver/hw/kdrive/ati/ati_dma.h,v 1.5 2005-01-27 05:25:57 anholt Exp $ */ + +#ifndef _ATI_DMA_H_ +#define _ATI_DMA_H_ + +#define CCE_DEBUG 1 + +/* CCE packet defines */ + +#define ATI_CCE_PACKETTYPE_MASK 0xc0000000 +#define ATI_CCE_PACKET0 0x00000000 +#define ATI_CCE_PACKET0_COUNT_MASK 0x3fff0000 +#define ATI_CCE_PACKET0_ONE_REG_WR 0x00008000 +#define ATI_CCE_PACKET0_REG_MASK 0x000007ff +#define ATI_CCE_PACKET1 0x40000000 +#define ATI_CCE_PACKET1_REG_1 0x000007ff +#define ATI_CCE_PACKET1_REG_2 0x003ff800 +#define ATI_CCE_PACKET1_REG_2_SHIFT 10 +#define ATI_CCE_PACKET2 0x80000000 +#define ATI_CCE_PACKET3 0xc0000000 +#define ATI_CCE_PACKET3_COUNT_MASK 0x3fff0000 +#define ATI_CCE_PACKET3_IT_OPCODE_MASK 0x0000ff00 + + +#if !CCE_DEBUG +#define DMA_PACKET0(reg, count) \ + (ATI_CCE_PACKET0 | (((count) - 1) << 16) | ((reg) >> 2)) +#else +#define DMA_PACKET0(reg, count) \ + (__packet0count = (count), __reg = (reg), \ + ATI_CCE_PACKET0 | (((count) - 1) << 16) | ((reg) >> 2)) +#endif +#define DMA_PACKET1(reg1, reg2) \ + (ATI_CCE_PACKET1 | \ + (((reg2) >> 2) << ATI_CCE_PACKET1_REG_2_SHIFT) | ((reg1) >> 2)) +#define DMA_PACKET3(type, count) \ + ((type) | (((count) - 1) << 16)) + + + +#ifdef USE_DMA + +#if !CCE_DEBUG + +#define RING_LOCALS \ + CARD32 *__head; int __count +#define BEGIN_DMA(n) \ +do { \ + __head = ATIRequestEntries(atis, n); \ + __count = 0; \ +} while (0) +#define END_DMA() do { \ + ATISubmitEntries(atis, __count); \ +} while (0) + +#else /* CCE_DEBUG */ +#define RING_LOCALS \ + CARD32 *__head; int __count, __total, __reg, __packet0count +#define BEGIN_DMA(n) \ +do { \ + __head = ATIRequestEntries(atis, n); \ + __count = 0; \ + __total = n; \ + __reg = 0; \ + __packet0count = 0; \ +} while (0) +#define END_DMA() do { \ + if (__count != __total) \ + FatalError("count != total (%d vs %d) at %s:%d\n", \ + __count, __total, __FILE__, __LINE__); \ + ATISubmitEntries(atis, __count); \ +} while (0) + +#endif /* CCE_DEBUG */ + +#define BEGIN_DMA_REG(n) BEGIN_DMA(n * 2) +#define END_DMA_REG() END_DMA() + +#define OUT_REG(reg, val) \ +do { \ + OUT_RING(DMA_PACKET0(reg, 1)); \ + OUT_RING(val); \ +} while (0) + + +#else /* USE_DMA */ + + +#define RING_LOCALS char *__mmio = atis->atic->reg_base +#define BEGIN_DMA_REG(n) \ +do { \ + ATIWaitAvailMMIO(atis, n); \ +} while (0) +#define END_DMA_REG() do {} while (0) +#define OUT_REG(reg, val) MMIO_OUT32(__mmio, reg, val) +#endif /* USE_DMA */ + + +#define OUT_RING(val) do { \ + __head[__count++] = (val); \ +} while (0) + +#define OUT_RING_REG(reg, val) do { \ + if (__reg != reg) \ + FatalError("unexpected reg (0x%x vs 0x%x) at %s:%d\n", \ + reg, __reg, __FILE__, __LINE__); \ + if (__packet0count-- <= 0) \ + FatalError("overrun of packet0 at %s:%d\n", \ + __FILE__, __LINE__); \ + __head[__count++] = (val); \ + __reg += 4; \ +} while (0) + +#define OUT_RING_F(x) OUT_RING(GET_FLOAT_BITS(x)) + +#define TIMEOUT_LOCALS struct timeval _target, _curtime + +static inline Bool +tv_le(struct timeval *tv1, struct timeval *tv2) +{ + if (tv1->tv_sec < tv2->tv_sec || + (tv1->tv_sec == tv2->tv_sec && tv1->tv_usec < tv2->tv_usec)) + return TRUE; + else + return FALSE; +} + +#define WHILE_NOT_TIMEOUT(_timeout) \ + gettimeofday(&_target, NULL); \ + _target.tv_usec += ((_timeout) * 1000000); \ + _target.tv_sec += _target.tv_usec / 1000000; \ + _target.tv_usec = _target.tv_usec % 1000000; \ + while (gettimeofday(&_curtime, NULL), tv_le(&_curtime, &_target)) + +#define TIMEDOUT() (!tv_le(&_curtime, &_target)) + + +void +ATIFlushIndirect(ATIScreenInfo *atis, Bool discard); + +void +ATIDMASetup(ScreenPtr pScreen); + +void +ATIDMATeardown(ScreenPtr pScreen); + +CARD32 * +ATIRequestEntries(ATIScreenInfo *atis, int n); + +void +ATISubmitEntries(ATIScreenInfo *atis, int n); + +inline void +ATIWaitAvailMMIO(ATIScreenInfo *atis, int n); +#endif /* _ATI_DMA_H_ */ Index: git/hw/kdrive/w100/ati_draw.c =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ git/hw/kdrive/w100/ati_draw.c 2006-09-02 12:12:14.000000000 +0200 @@ -0,0 +1,477 @@ +/* + * Copyright © 2006 Alberto Mardegan + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Alberto Mardegan not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Alberto Mardegan makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * ALBERTO MARDEGAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL ALBERTO MARDEGAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +#define USE_DMA +#define DRAW_USING_PACKET3 + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "ati.h" +#include "w100_regs.h" +#include "w100_const.h" +#include "ati_dma.h" +#include "ati_draw.h" +#include "kaa.h" + + +CARD8 ATISolidRop[16] = { + /* GXclear */ 0x00, + /* 0 */ + /* GXand */ 0xa0, + /* src AND dst */ + /* GXandReverse */ 0x50, + /* src AND NOT dst */ + /* GXcopy */ 0xf0, + /* src */ + /* GXandInverted */ 0x0a, + /* NOT src AND dst */ + /* GXnoop */ 0xaa, + /* dst */ + /* GXxor */ 0x5a, + /* src XOR dst */ + /* GXor */ 0xfa, + /* src OR dst */ + /* GXnor */ 0x05, + /* NOT src AND NOT dst */ + /* GXequiv */ 0xa5, + /* NOT src XOR dst */ + /* GXinvert */ 0x55, + /* NOT dst */ + /* GXorReverse */ 0xf5, + /* src OR NOT dst */ + /* GXcopyInverted */ 0x0f, + /* NOT src */ + /* GXorInverted */ 0xaf, + /* NOT src OR dst */ + /* GXnand */ 0x5f, + /* NOT src OR NOT dst */ + /* GXset */ 0xff, + /* 1 */ +}; + +CARD8 ATIBltRop[16] = { + /* GXclear */ 0x00, + /* 0 */ + /* GXand */ 0x88, + /* src AND dst */ + /* GXandReverse */ 0x44, + /* src AND NOT dst */ + /* GXcopy */ 0xcc, + /* src */ + /* GXandInverted */ 0x22, + /* NOT src AND dst */ + /* GXnoop */ 0xaa, + /* dst */ + /* GXxor */ 0x66, + /* src XOR dst */ + /* GXor */ 0xee, + /* src OR dst */ + /* GXnor */ 0x11, + /* NOT src AND NOT dst */ + /* GXequiv */ 0x99, + /* NOT src XOR dst */ + /* GXinvert */ 0x55, + /* NOT dst */ + /* GXorReverse */ 0xdd, + /* src OR NOT dst */ + /* GXcopyInverted */ 0x33, + /* NOT src */ + /* GXorInverted */ 0xbb, + /* NOT src OR dst */ + /* GXnand */ 0x77, + /* NOT src OR NOT dst */ + /* GXset */ 0xff, + /* 1 */ +}; + +static int copydx, copydy; +static ATIScreenInfo *accel_atis; +static char *accel_mmio; + + +void +ATIDrawSetup(ScreenPtr pScreen) +{ + KdScreenPriv(pScreen); + ATIScreenInfo(pScreenPriv); + default_sc_bottom_right_u dsbr; + RING_LOCALS; + + dsbr.val = 0; + dsbr.f.default_sc_right = dsbr.f.default_sc_bottom = W100_MAXINT; + + BEGIN_DMA_REG(2); + OUT_REG(mmDEFAULT_SC_BOTTOM_RIGHT, dsbr.val); + OUT_REG(mmSRC_SC_BOTTOM_RIGHT, dsbr.val); + END_DMA_REG(); +} + +static void +ATIWaitMarker(ScreenPtr pScreen, int marker) +{ + KdScreenPriv(pScreen); + ATIScreenInfo(pScreenPriv); + + ENTER_DRAW(0); + ATIWaitIdle(atis); + LEAVE_DRAW(0); +} + + +#if ATI_TRACE_DRAW +void +ATIEnterDraw(PixmapPtr pPix, const char *function) +{ + if (pPix != NULL) { + KdScreenPriv(pPix->drawable.pScreen); + CARD32 offset; + + offset = ((CARD8 *) pPix->devPrivate.ptr - + pScreenPriv->screen->memory_base); + + ErrorF("Enter %s 0x%x (%dx%dx%d/%d)\n", function, offset, + pPix->drawable.width, pPix->drawable.height, + pPix->drawable.depth, pPix->drawable.bitsPerPixel); + } else + ErrorF("Enter %s\n", function); +} + +void +ATILeaveDraw(PixmapPtr pPix, const char *function) +{ + if (pPix != NULL) { + KdScreenPriv(pPix->drawable.pScreen); + CARD32 offset; + + offset = ((CARD8 *) pPix->devPrivate.ptr - + pScreenPriv->screen->memory_base); + + ErrorF("Leave %s 0x%x\n", function, offset); + } else + ErrorF("Leave %s\n", function); +} +#endif + +/* Assumes that depth 15 and 16 can be used as depth 16, which is okay since we + * require src and dest datatypes to be equal. + */ +static Bool +ATIGetDatatypeBpp(int bpp, CARD32 * type) +{ + switch (bpp) { + case 8: + *type = DATATYPE_8BPP; + return TRUE; + case 16: + *type = DATATYPE_ARGB1555; + return TRUE; + default: + ATI_FALLBACK(("Unsupported bpp: %d\n", bpp)); + return FALSE; + } +} + + +Bool +ATIGetPixmapOffsetPitch(PixmapPtr pPix, CARD32 * pitch, CARD32 * offset) +{ + KdScreenPriv(pPix->drawable.pScreen); + ATICardInfo(pScreenPriv); + + /* XXX this only works for surfaces allocated in external memory */ + *offset = ((CARD8 *) pPix->devPrivate.ptr - + pScreenPriv->screen->memory_base) + atic->ext_mem_location; + *pitch = pPix->devKind >> 1; + + return TRUE; +} + + +static Bool +ATIPrepareSolid(PixmapPtr pPix, int alu, Pixel pm, Pixel fg) +{ + KdScreenPriv(pPix->drawable.pScreen); + ATIScreenInfo(pScreenPriv); + ATICardInfo(pScreenPriv); + CARD32 datatype, dst_pitch, dst_offset; + dp_gui_master_cntl_u gmc; + dp_cntl_u dp_cntl; + RING_LOCALS; + + accel_atis = atis; + accel_mmio = atic->reg_base; + + if (!ATIGetDatatypeBpp(pPix->drawable.bitsPerPixel, &datatype)) + return FALSE; + if (!ATIGetPixmapOffsetPitch(pPix, &dst_pitch, &dst_offset)) + return FALSE; + + ENTER_DRAW(pPix); + + gmc.val = 0; + gmc.f.gmc_dst_pitch_offset_cntl = 1; + gmc.f.gmc_dst_clipping = 1; + gmc.f.gmc_brush_datatype = BRUSH_SOLIDCOLOR; + gmc.f.gmc_dst_datatype = datatype; + gmc.f.gmc_src_datatype = datatype; + gmc.f.gmc_byte_pix_order = 1; + gmc.f.gmc_rop3 = ATISolidRop[alu]; + gmc.f.gmc_dp_src_source = SOURCE_MEM_RECTANGULAR; + gmc.f.gmc_clr_cmp_fcn_dis = 1; + gmc.f.gmc_dp_op = OP_ROP; + + dp_cntl.val = 0; + dp_cntl.f.dst_x_dir = 1; + dp_cntl.f.dst_y_dir = 1; + + BEGIN_DMA_REG(6); + OUT_REG(mmDST_PITCH, dst_pitch); + OUT_REG(mmDST_OFFSET, dst_offset); + OUT_REG(mmDP_GUI_MASTER_CNTL, gmc.val); + OUT_REG(mmDP_BRUSH_FRGD_CLR, fg); + OUT_REG(mmDP_WRITE_MSK, pm); + OUT_REG(mmDP_CNTL, dp_cntl.val); + END_DMA_REG(); + + LEAVE_DRAW(pPix); + return TRUE; +} + +static void +ATISolid(int x1, int y1, int x2, int y2) +{ + ENTER_DRAW(0); + ATIScreenInfo *atis = accel_atis; + RING_LOCALS; + +#ifdef DRAW_USING_PACKET3 + BEGIN_DMA(3); + OUT_RING(DMA_PACKET3(W100_CCE_PACKET3_PAINT_MULTI, 2)); + OUT_RING((x1 << 16) | y1); + OUT_RING(((x2 - x1) << 16) | (y2 - y1)); + END_DMA(); +#elif defined DRAW_USING_PACKET0 + BEGIN_DMA(3); + OUT_RING(DMA_PACKET0(mmDST_Y_X, 2)); + OUT_RING_REG(mmDST_Y_X, (y1 << 16) | x1); + OUT_RING_REG(mmDST_HEIGHT_WIDTH, ((y2 - y1) << 16) | (x2 - x1)); + END_DMA(); +#else + BEGIN_DMA_REG(2); + OUT_REG(mmDST_Y_X, (y1 << 16) | x1); + OUT_REG(mmDST_HEIGHT_WIDTH, ((y2 - y1) << 16) | (x2 - x1)); + END_DMA_REG(); +#endif + LEAVE_DRAW(0); +} + + +static void +ATIDoneSolid(void) +{ + ENTER_DRAW(0); + LEAVE_DRAW(0); +} + + +static Bool +ATIPrepareCopy(PixmapPtr pSrc, PixmapPtr pDst, int dx, int dy, int alu, + Pixel pm) +{ + KdScreenPriv(pDst->drawable.pScreen); + ATIScreenInfo(pScreenPriv); + ATICardInfo(pScreenPriv); + CARD32 datatype, src_pitch, src_offset, dst_pitch, dst_offset; + dp_gui_master_cntl_u gmc; + dp_cntl_u dp_cntl; + dp_datatype_u dpdt; + RING_LOCALS; + + accel_mmio = atic->reg_base; + copydx = dx; + copydy = dy; + accel_atis = atis; + + if (!ATIGetDatatypeBpp(pDst->drawable.bitsPerPixel, &datatype)) + return FALSE; + if (!ATIGetPixmapOffsetPitch(pSrc, &src_pitch, &src_offset)) + return FALSE; + if (!ATIGetPixmapOffsetPitch(pDst, &dst_pitch, &dst_offset)) + return FALSE; + + ENTER_DRAW(pDst); + + gmc.val = 0; + gmc.f.gmc_src_pitch_offset_cntl = 1; + gmc.f.gmc_dst_pitch_offset_cntl = 1; + gmc.f.gmc_src_clipping = 1; + gmc.f.gmc_dst_clipping = 1; + gmc.f.gmc_brush_datatype = BRUSH_NONE; + gmc.f.gmc_dst_datatype = datatype; + gmc.f.gmc_src_datatype = datatype; + gmc.f.gmc_byte_pix_order = 1; + gmc.f.gmc_rop3 = ATIBltRop[alu]; + gmc.f.gmc_dp_src_source = SOURCE_MEM_RECTANGULAR; + gmc.f.gmc_clr_cmp_fcn_dis = 1; + gmc.f.gmc_dp_op = OP_ROP; + + dp_cntl.val = 0; + if (dx >= 0) + dp_cntl.f.dst_x_dir = 1; + if (dy >= 0) + dp_cntl.f.dst_y_dir = 1; + + dpdt.val = 0; + dpdt.f.dp_dst_datatype = datatype; + dpdt.f.dp_src_datatype = datatype; + dpdt.f.dp_byte_pix_order = 1; + + BEGIN_DMA_REG(8); + OUT_REG(mmSRC_PITCH, src_pitch); + OUT_REG(mmSRC_OFFSET, src_offset); + OUT_REG(mmDST_PITCH, dst_pitch); + OUT_REG(mmDST_OFFSET, dst_offset); + OUT_REG(mmDP_GUI_MASTER_CNTL, gmc.val); + OUT_REG(mmDP_WRITE_MSK, pm); + OUT_REG(mmDP_CNTL, dp_cntl.val); + OUT_REG(mmDP_DATATYPE, dpdt.val); + END_DMA_REG(); + + LEAVE_DRAW(pDst); + return TRUE; +} + +static void +ATICopy(int srcX, int srcY, int dstX, int dstY, int w, int h) +{ + ATIScreenInfo *atis = accel_atis; + RING_LOCALS; + + ENTER_DRAW(0); +#ifndef DRAW_USING_PACKET3 + if (copydx < 0) { + srcX += w - 1; + dstX += w - 1; + } + if (copydy < 0) { + srcY += h - 1; + dstY += h - 1; + } +#endif + +#ifdef DRAW_USING_PACKET3 + BEGIN_DMA(4); + OUT_RING(DMA_PACKET3(W100_CCE_PACKET3_BITBLT_MULTI, 3)); + OUT_RING((srcX << 16) | srcY); + OUT_RING((dstX << 16) | dstY); + OUT_RING((w << 16) | h); + END_DMA(); +#elif defined DRAW_USING_PACKET0 + BEGIN_DMA(4); + OUT_RING(DMA_PACKET0(mmSRC_Y_X, 3)); + OUT_RING_REG(mmSRC_Y_X, (srcY << 16) | srcX); + OUT_RING_REG(mmDST_Y_X, (dstY << 16) | dstX); + OUT_RING_REG(mmDST_HEIGHT_WIDTH, (h << 16) | w); + END_DMA(); +#else + BEGIN_DMA_REG(3); + OUT_REG(mmSRC_Y_X, (srcY << 16) | srcX); + OUT_REG(mmDST_Y_X, (dstY << 16) | dstX); + OUT_REG(mmDST_HEIGHT_WIDTH, (h << 16) | w); + END_DMA_REG(); +#endif + LEAVE_DRAW(0); +} + + +static void +ATIDoneCopy(void) +{ + ENTER_DRAW(0); + LEAVE_DRAW(0); +} + + +Bool +ATIDrawInit(ScreenPtr pScreen) +{ + KdScreenPriv(pScreen); + ATIScreenInfo(pScreenPriv); + + ErrorF("Screen: %d/%d depth/bpp\n", pScreenPriv->screen->fb[0].depth, + pScreenPriv->screen->fb[0].bitsPerPixel); + + memset(&atis->kaa, 0, sizeof(KaaScreenInfoRec)); + atis->kaa.waitMarker = ATIWaitMarker; + atis->kaa.PrepareSolid = ATIPrepareSolid; + atis->kaa.Solid = ATISolid; + atis->kaa.DoneSolid = ATIDoneSolid; + atis->kaa.PrepareCopy = ATIPrepareCopy; + atis->kaa.Copy = ATICopy; + atis->kaa.DoneCopy = ATIDoneCopy; + /* XXX if this flag isn't specified, Kdrive crashes in kaaPixmapUseMemory + * or kaaPixmapUseScreen. But this is probably caused by some bug in this + * driver... */ + atis->kaa.flags |= KAA_OFFSCREEN_PIXMAPS; + if (!kaaDrawInit(pScreen, &atis->kaa)) + return FALSE; + + return TRUE; +} + + +void +ATIDrawEnable(ScreenPtr pScreen) +{ + KdScreenPriv(pScreen); + ATIScreenInfo(pScreenPriv); + + ATIDMASetup(pScreen); + ATIDrawSetup(pScreen); + + atis->scratch_area = NULL; + atis->kaa.PrepareBlend = NULL; + atis->kaa.Blend = NULL; + atis->kaa.DoneBlend = NULL; + atis->kaa.CheckComposite = NULL; + atis->kaa.PrepareComposite = NULL; + atis->kaa.Composite = NULL; + atis->kaa.DoneComposite = NULL; + atis->kaa.UploadToScreen = NULL; + atis->kaa.UploadToScratch = NULL; + + + kaaMarkSync(pScreen); +} + +void +ATIDrawDisable(ScreenPtr pScreen) +{ + ATIDMATeardown(pScreen); +} + +void +ATIDrawFini(ScreenPtr pScreen) +{ + kaaDrawFini(pScreen); +} Index: git/hw/kdrive/w100/ati_draw.h =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ git/hw/kdrive/w100/ati_draw.h 2006-09-02 12:12:14.000000000 +0200 @@ -0,0 +1,107 @@ +/* + * Copyright © 2004 Eric Anholt + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Eric Anholt not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Eric Anholt makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL ERIC ANHOLT BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ +/* $Header: /cvs/xserver/xserver/hw/kdrive/ati/ati_draw.h,v 1.9 2005-02-21 03:44:10 anholt Exp $ */ + +#ifndef _ATI_DRAW_H_ +#define _ATI_DRAW_H_ + +Bool ATIGetOffsetPitch(ATIScreenInfo *atis, int bpp, CARD32 *pitch_offset, + int offset, int pitch); +Bool ATIGetPixmapOffsetPitch(PixmapPtr pPix, CARD32 *pitch, CARD32 *offset); + +Bool R128CheckComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture, + PicturePtr pDstPicture); +Bool R128PrepareComposite(int op, PicturePtr pSrcPicture, + PicturePtr pMaskPicture, PicturePtr pDstPicture, PixmapPtr pSrc, + PixmapPtr pMask, PixmapPtr pDst); +void R128Composite(int srcX, int srcY, int maskX, int maskY, int dstX, int dstY, + int w, int h); +void R128DoneComposite(void); + +Bool R128PrepareTrapezoids(PicturePtr pDstPicture, PixmapPtr pDst); +void R128Trapezoids(KaaTrapezoid *traps, int ntraps); +void R128DoneTrapezoids(void); + +Bool R100CheckComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture, + PicturePtr pDstPicture); +Bool R100PrepareComposite(int op, PicturePtr pSrcPicture, + PicturePtr pMaskPicture, PicturePtr pDstPicture, PixmapPtr pSrc, + PixmapPtr pMask, PixmapPtr pDst); +Bool R200CheckComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture, + PicturePtr pDstPicture); +Bool R200PrepareComposite(int op, PicturePtr pSrcPicture, + PicturePtr pMaskPicture, PicturePtr pDstPicture, PixmapPtr pSrc, + PixmapPtr pMask, PixmapPtr pDst); +void RadeonComposite(int srcX, int srcY, int maskX, int maskY, int dstX, + int dstY, int w, int h); +void RadeonDoneComposite(void); + +Bool RadeonPrepareTrapezoids(PicturePtr pDstPicture, PixmapPtr pDst); +void RadeonTrapezoids(KaaTrapezoid *traps, int ntraps); +void RadeonDoneTrapezoids(void); + +void RadeonSwitchTo2D(ATIScreenInfo *atis); +void RadeonSwitchTo3D(ATIScreenInfo *atis); +void ATIWaitIdle(ATIScreenInfo *atis); + +#define ATI_TRACE_FALL 0 +#define ATI_TRACE_DRAW 1 + +#if ATI_TRACE_FALL +#define ATI_FALLBACK(x) \ +do { \ + ErrorF("%s: ", __FUNCTION__); \ + ErrorF x; \ + return FALSE; \ +} while (0) +#else +#define ATI_FALLBACK(x) return FALSE +#endif + +#if ATI_TRACE_DRAW +#define ENTER_DRAW(pix) ATIEnterDraw(pix, __FUNCTION__) +#define LEAVE_DRAW(pix) ATILeaveDraw(pix, __FUNCTION__) + +void +ATIEnterDraw (PixmapPtr pPixmap, const char *function); + +void +ATILeaveDraw (PixmapPtr pPixmap, const char *function); +#else /* ATI_TRACE */ +#define ENTER_DRAW(pix) +#define LEAVE_DRAW(pix) +#endif /* !ATI_TRACE */ + +#ifndef USE_DMA +/* if DMA is not going to be used, drawing using PACKET3 or PACKET0 won't + * be possible */ +#ifdef DRAW_USING_PACKET3 +#undef DRAW_USING_PACKET3 +#endif + +#ifdef DRAW_USING_PACKET0 +#undef DRAW_USING_PACKET0 +#endif + +#endif /* USE_DMA */ + +#endif /* _ATI_DRAW_H_ */ Index: git/hw/kdrive/w100/ati.h =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ git/hw/kdrive/w100/ati.h 2006-09-02 12:12:14.000000000 +0200 @@ -0,0 +1,256 @@ +/* + * $Id: ati.h,v 1.18 2005-06-10 02:14:44 anholt Exp $ + * + * Copyright © 2003 Eric Anholt + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Eric Anholt not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Eric Anholt makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * ERIC ANHOLT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL ERIC ANHOLT BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ +/* $Header: /cvs/xserver/xserver/hw/kdrive/ati/ati.h,v 1.18 2005-06-10 02:14:44 anholt Exp $ */ + +#ifndef _ATI_H_ +#define _ATI_H_ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#ifdef KDRIVEFBDEV +#include +#endif +#ifdef KDRIVEVESA +#include +#endif + +#include "kxv.h" + + +#define ATI_MEM_BASE(c) (0x08000000) +#define ATI_MEM_SIZE(c) (0x01000000) +#define ATI_REG_BASE(c) (ATI_MEM_BASE(c) + 0x10000) /* the 0x08000000 must be obtained from /proc/iomem, the 0x10000 from ReadCfgReg(cfgREG_BASE) << 16) & 0xff0000 */ +#define ATI_REG_SIZE(c) (0x2000) + +#ifdef __powerpc__ + +static __inline__ void +MMIO_OUT32(__volatile__ void *base, const unsigned long offset, + const unsigned int val) +{ + __asm__ __volatile__( + "stwbrx %1,%2,%3\n\t" + "eieio" + : "=m" (*((volatile unsigned char *)base+offset)) + : "r" (val), "b" (base), "r" (offset)); +} + +static __inline__ CARD32 +MMIO_IN32(__volatile__ void *base, const unsigned long offset) +{ + register unsigned int val; + __asm__ __volatile__( + "lwbrx %0,%1,%2\n\t" + "eieio" + : "=r" (val) + : "b" (base), "r" (offset), + "m" (*((volatile unsigned char *)base+offset))); + return val; +} + +#else + +#define MMIO_OUT32(mmio, a, v) (*(VOL32 *)((mmio) + (a)) = (v)) +#define MMIO_IN32(mmio, a) (*(VOL32 *)((mmio) + (a))) + +#endif + +#define MMIO_OUT8(mmio, a, v) (*(VOL8 *)((mmio) + (a)) = (v)) +#define MMIO_IN8(mmio, a, v) (*(VOL8 *)((mmio) + (a))) + + +typedef volatile CARD8 VOL8; +typedef volatile CARD16 VOL16; +typedef volatile CARD32 VOL32; + +struct pci_id_entry { + CARD16 vendor; + CARD16 device; + CARD8 caps; + char *name; +}; + +struct backend_funcs { + void (*cardfini)(KdCardInfo *); + void (*scrfini)(KdScreenInfo *); + Bool (*initScreen)(ScreenPtr); + Bool (*finishInitScreen)(ScreenPtr pScreen); + Bool (*createRes)(ScreenPtr); + void (*preserve)(KdCardInfo *); + void (*restore)(KdCardInfo *); + Bool (*dpms)(ScreenPtr, int); + Bool (*enable)(ScreenPtr); + void (*disable)(ScreenPtr); + void (*getColors)(ScreenPtr, int, int, xColorItem *); + void (*putColors)(ScreenPtr, int, int, xColorItem *); +#ifdef RANDR + Bool (*randrSetConfig) (ScreenPtr, Rotation, int, RRScreenSizePtr); +#endif +}; + +typedef struct _ATICardInfo { + union { +#ifdef KDRIVEFBDEV + FbdevPriv fbdev; +#endif +#ifdef KDRIVEVESA + VesaCardPrivRec vesa; +#endif + } backend_priv; + struct backend_funcs backend_funcs; + + struct pci_id_entry *pci_id; + CARD8 *mem_base; + CARD8 *reg_base; + CARD32 fb_location; + CARD32 ext_mem_location; + Bool use_fbdev, use_vesa; +} ATICardInfo; + +#define getATICardInfo(kd) ((ATICardInfo *) ((kd)->card->driver)) +#define ATICardInfo(kd) ATICardInfo *atic = getATICardInfo(kd) + +typedef struct _ATICursor { + int width, height; + int xhot, yhot; + + Bool has_cursor; + CursorPtr pCursor; + Pixel source, mask; + KdOffscreenArea *area; +} ATICursor; + +typedef struct _ATIPortPriv { + int brightness; + int saturation; + RegionRec clip; + CARD32 size; + KdOffscreenArea *off_screen; + DrawablePtr pDraw; + PixmapPtr pPixmap; + + CARD32 src_offset; + CARD32 src_pitch; + CARD8 *src_addr; + + int id; + int src_x1, src_y1, src_x2, src_y2; + int dst_x1, dst_y1, dst_x2, dst_y2; + int src_w, src_h, dst_w, dst_h; +} ATIPortPrivRec, *ATIPortPrivPtr; + +typedef struct _ATIScreenInfo { + union { +#ifdef KDRIVEFBDEV + FbdevScrPriv fbdev; +#endif +#ifdef KDRIVEVESA + VesaScreenPrivRec vesa; +#endif + } backend_priv; + KaaScreenInfoRec kaa; + + ATICardInfo *atic; + KdScreenInfo *screen; + + int scratch_offset; + int scratch_next; + KdOffscreenArea *scratch_area; + + ATICursor cursor; + + KdVideoAdaptorPtr pAdaptor; + int num_texture_ports; + + Bool using_pio; /* If we use decode DMA packets to MMIO. */ + Bool using_dma; /* If we use non-DRI DMA to submit packets. */ + + KdOffscreenArea *dma_space; /* For "DMA" from framebuffer. */ + CARD32 *ring_addr; /* Beginning of ring buffer. */ + int ring_write; /* Index of write ptr in ring. */ + int ring_read; /* Index of read ptr in ring. */ + int ring_len; + int ring_mask; + int ring_count; + int ring_free; + + + int mmio_avail; +} ATIScreenInfo; + +#define getATIScreenInfo(kd) ((ATIScreenInfo *) ((kd)->screen->driver)) +#define ATIScreenInfo(kd) ATIScreenInfo *atis = getATIScreenInfo(kd) + +typedef union { float f; CARD32 i; } fi_type; + + +/* ati.c */ +Bool +ATIMap(KdCardInfo *card, ATICardInfo *atic); + +void +ATIUnmap(KdCardInfo *card, ATICardInfo *atic); + +/* ati_draw.c */ +void +ATIDrawSetup(ScreenPtr pScreen); + +Bool +ATIDrawInit(ScreenPtr pScreen); + +void +ATIDrawEnable(ScreenPtr pScreen); + +void +ATIDrawDisable(ScreenPtr pScreen); + +void +ATIDrawFini(ScreenPtr pScreen); + + +/* ati_cursor.c */ +Bool +ATICursorInit(ScreenPtr pScreen); + +void +ATICursorEnable(ScreenPtr pScreen); + +void +ATICursorDisable(ScreenPtr pScreen); + +void +ATICursorFini(ScreenPtr pScreen); + +void +ATIRecolorCursor(ScreenPtr pScreen, int ndef, xColorItem *pdef); + +int +ATILog2(int val); + + +extern KdCardFuncs ATIFuncs; + +#endif /* _ATI_H_ */ Index: git/hw/kdrive/w100/ati_microcode.c =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ git/hw/kdrive/w100/ati_microcode.c 2006-09-02 12:12:14.000000000 +0200 @@ -0,0 +1,412 @@ +/* + * Copyright © 2006 Alberto Mardegan + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Alberto Mardegan not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Alberto Mardegan makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * ALBERTO MARDEGAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL ALBERTO MARDEGAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +/* CCE microcode (from ATI) */ + +#include "ati.h" + + +CARD32 w100_microcode[][2] = { + {0x21007000, 0x00000000} + , + {0x20007000, 0x00000000} + , + {0x00000098, 0x00000004} + , + {0x0000009c, 0x00000004} + , + {0x66544a49, 0x00000000} + , + {0x49494174, 0x00000000} + , + {0x54517d83, 0x00000000} + , + {0x498d8b64, 0x00000000} + , + {0x49494949, 0x00000000} + , + {0x49b6493c, 0x00000000} + , + {0x49494949, 0x00000000} + , + {0x49494949, 0x00000000} + , + {0x49490d10, 0x00000000} + , + {0x000f0000, 0x00000016} + , + {0x30292027, 0x00000000} + , + {0x00000012, 0x00000004} + , + {0x000f0000, 0x00000016} + , + {0x30292427, 0x00000000} + , + {0x0000730f, 0x00000002} + , /* mmIDCT_CONTROL */ + {0x00061000, 0x00000002} + , + {0x0000001d, 0x0000001a} + , + {0x00004000, 0x0000001e} + , + {0x00061000, 0x00000002} + , + {0x0000001d, 0x0000001a} + , + {0x00004000, 0x0000001e} + , + {0x00061000, 0x00000002} + , + {0x0000001d, 0x0000001a} + , + {0x00004000, 0x0000001e} + , + {0x00000013, 0x00000004} + , + {0x0003803a, 0x00000002} + , + {0x04006300, 0x00000002} + , /* mmIDCT_RUNS */ + {0x00000013, 0x00000004} + , + {0x00007300, 0x00000002} + , /* mmIDCT_RUNS */ + {0x00065000, 0x00000002} + , + {0x00003301, 0x00000002} + , /* mmIDCT_LEVELS */ + {0x04006301, 0x00000006} + , /* mmIDCT_LEVELS */ + {0x00007300, 0x00000002} + , /* mmIDCT_RUNS */ + {0x00007301, 0x00000002} + , /* mmIDCT_LEVELS */ + {0x00007301, 0x00000006} + , /* mmIDCT_LEVELS */ + {0x0003803a, 0x00000002} + , + {0x04006300, 0x00000006} + , /* mmIDCT_RUNS */ + {0x00a05000, 0x00000002} + , + {0x00000039, 0x0000000c} + , + {0x00000000, 0x00000002} + , + {0x00007300, 0x00000002} + , /* mmIDCT_RUNS */ + {0x00007301, 0x00000002} + , /* mmIDCT_LEVELS */ + {0x00007301, 0x00000002} + , /* mmIDCT_LEVELS */ + {0x0060002a, 0x00000004} + , + {0x00007488, 0x00000002} + , /* mmE2_ARITHMETIC_CNTL */ + {0x0003803b, 0x00000002} + , + {0x00098000, 0x00000002} + , + {0x00200000, 0x00000002} + , + {0x00000039, 0x0000000c} + , + {0x00007465, 0x00000002} + , /* mmDST_X_Y */ + {0x00007464, 0x00000002} + , /* mmSRC_X_Y */ + {0x00007478, 0x00000002} + , /* mmMVC_CNTL_START */ + {0x00600034, 0x00000004} + , + {0x00000000, 0x00000006} + , + {0xffffffff, 0x00000000} + , + {0x00000006, 0x00000000} + , + {0x01605000, 0x00000002} + , + {0x00065000, 0x00000002} + , + {0x00098000, 0x00000002} + , + {0x00061000, 0x00000002} + , + {0x64c0603d, 0x00000004} + , + {0x00080000, 0x00000016} + , + {0x00000000, 0x00000000} + , + {0x0400241d, 0x00000002} + , /* mmBRUSH_Y_X */ + {0x00007424, 0x00000002} + , /* mmDST_LINE_START */ + {0x00067425, 0x00000002} + , /* mmDST_LINE_END */ + {0x04002424, 0x00000002} + , /* mmDST_LINE_START */ + {0x00067425, 0x00000002} + , /* mmDST_LINE_END */ + {0x00000046, 0x00000004} + , + {0x00005000, 0x00000000} + , + {0x00061000, 0x00000002} + , + {0x0000740e, 0x00000002} + , /* mmDST_Y_X */ + {0x00019000, 0x00000002} + , + {0x00011050, 0x00000014} + , + {0x00000050, 0x00000012} + , + {0x0400240f, 0x00000002} + , /* mmDST_HEIGHT_WIDTH */ + {0x0000504a, 0x00000004} + , + {0x00007465, 0x00000002} + , /* mmDST_X_Y */ + {0x00007466, 0x00000002} + , /* mmDST_WIDTH_HEIGHT */ + {0x00000051, 0x00000004} + , + {0x01e65473, 0x00000002} + , /* mmDP_CNTL_DST_DIR */ + {0x4401b0b9, 0x00000002} + , + {0x01c110b9, 0x00000002} + , + {0x2666705d, 0x00000018} + , + {0x040c2465, 0x00000002} + , /* mmDST_X_Y */ + {0x0000005d, 0x00000018} + , + {0x04002464, 0x00000002} + , /* mmSRC_X_Y */ + {0x00007466, 0x00000002} + , /* mmDST_WIDTH_HEIGHT */ + {0x00000054, 0x00000004} + , + {0x00401060, 0x00000008} + , + {0x00101000, 0x00000002} + , + {0x000d80ff, 0x00000002} + , + {0x00800063, 0x00000008} + , + {0x000f9000, 0x00000002} + , + {0x000e00ff, 0x00000002} + , + {0x00000000, 0x00000006} + , + {0x00000080, 0x00000018} + , + {0x00000054, 0x00000004} + , + {0x00007490, 0x00000002} + , /* mmDP_SRC_FRGD_CLR */ + {0x00065000, 0x00000002} + , + {0x00009000, 0x00000002} + , + {0x00041000, 0x00000002} + , + {0x0c00340e, 0x00000002} + , /* mmDST_Y_X */ + {0x00049000, 0x00000002} + , + {0x00051000, 0x00000002} + , + {0x01e784f8, 0x00000002} + , + {0x00200000, 0x00000002} + , + {0x00600073, 0x0000000c} + , + {0x00007463, 0x00000002} + , /* mmDST_HEIGHT_WIDTH_8 */ + {0x006074f0, 0x00000021} + , /* mmHOST_DATA0 */ + {0x20007068, 0x00000004} + , + {0x00005068, 0x00000004} + , + {0x00007490, 0x00000002} + , /* mmDP_SRC_FRGD_CLR */ + {0x00007491, 0x00000002} + , /* mmDP_SRC_BKGD_CLR */ + {0x0000740e, 0x00000002} + , /* mmDST_Y_X */ + {0x0000740f, 0x00000002} + , /* mmDST_HEIGHT_WIDTH */ + {0x00a05000, 0x00000002} + , + {0x00600076, 0x0000000c} + , + {0x006074f0, 0x00000021} + , /* mmHOST_DATA0 */ + {0x000074f8, 0x00000002} + , /* mmHOST_DATA_LAST */ + {0x00000076, 0x00000004} + , + {0x000a740e, 0x00000002} + , /* mmDST_Y_X */ + {0x0020740f, 0x00000002} + , /* mmDST_HEIGHT_WIDTH */ + {0x00600079, 0x00000004} + , + {0x0000748c, 0x00000002} + , /* mmCLR_CMP_CNTL */ + {0x0000748d, 0x00000002} + , /* mmCLR_CMP_CLR_SRC */ + {0x0000748e, 0x00000006} + , /* mmCLR_CMP_CLR_DST */ + {0x00005000, 0x00000002} + , + {0x00a05000, 0x00000002} + , + {0x00007468, 0x00000002} + , /* mmDST_HEIGHT_Y */ + {0x00061000, 0x00000002} + , + {0x00000084, 0x0000000c} + , + {0x00058000, 0x00000002} + , + {0x0c607462, 0x00000002} + , /* mmDST_WIDTH_X */ + {0x00000086, 0x00000004} + , + {0x00600085, 0x00000004} + , + {0x400070ba, 0x00000000} + , + {0x000380ba, 0x00000002} + , + {0x00000093, 0x0000001c} + , + {0x00065095, 0x00000018} + , + {0x0400246f, 0x00000002} + , /* mmSC_TOP_LEFT */ + {0x00061096, 0x00000018} + , + {0x04007470, 0x00000000} + , /* mmSC_BOTTOM_RIGHT */ + {0x0000746f, 0x00000002} + , /* mmSC_TOP_LEFT */ + {0x00007470, 0x00000000} + , /* mmSC_BOTTOM_RIGHT */ + {0x00090000, 0x00000006} + , + {0x00090000, 0x00000002} + , + {0x000d8002, 0x00000006} + , + {0x01200000, 0x00000002} + , + {0x20077000, 0x00000002} + , + {0x01200000, 0x00000002} + , + {0x20007000, 0x00000002} + , + {0x00061000, 0x00000002} + , + {0x0120741b, 0x00000002} + , /* mmDP_GUI_MASTER_CNTL */ + {0x8040740a, 0x00000002} + , /* mmSRC_PITCH_OFFSET */ + {0x8040740b, 0x00000002} + , /* mmDST_PITCH_OFFSET */ + {0x00110000, 0x00000002} + , + {0x000380ba, 0x00000002} + , + {0x000000aa, 0x0000001c} + , + {0x00061096, 0x00000018} + , + {0x84407471, 0x00000002} + , /* mmSRC_SC_BOTTOM_RIGHT */ + {0x00061095, 0x00000018} +