/* * Copyright (C) 2007 Ben Skeggs. * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice (including the * next paragraph) shall be included in all copies or substantial * portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */ #include "drmP.h" #include "drm.h" #include "nouveau_drv.h" /*TODO: deciper what each offset in the context represents. The below * contexts are taken from dumps just after the 3D object is * created. */ static void nv40_graph_context_init(struct drm_device *dev, struct nouveau_gpuobj *ctx) { struct drm_nouveau_private *dev_priv = dev->dev_private; int i; /* Always has the "instance address" of itself at offset 0 */ INSTANCE_WR(ctx, 0x00000/4, ctx->im_pramin->start); /* unknown */ INSTANCE_WR(ctx, 0x00024/4, 0x0000ffff); INSTANCE_WR(ctx, 0x00028/4, 0x0000ffff); INSTANCE_WR(ctx, 0x00030/4, 0x00000001); INSTANCE_WR(ctx, 0x0011c/4, 0x20010001); INSTANCE_WR(ctx, 0x00120/4, 0x0f73ef00); INSTANCE_WR(ctx, 0x00128/4, 0x02008821); INSTANCE_WR(ctx, 0x0016c/4, 0x00000040); INSTANCE_WR(ctx, 0x00170/4, 0x00000040); INSTANCE_WR(ctx, 0x00174/4, 0x00000040); INSTANCE_WR(ctx, 0x0017c/4, 0x80000000); INSTANCE_WR(ctx, 0x00180/4, 0x80000000); INSTANCE_WR(ctx, 0x00184/4, 0x80000000); INSTANCE_WR(ctx, 0x00188/4, 0x80000000); INSTANCE_WR(ctx, 0x0018c/4, 0x80000000); INSTANCE_WR(ctx, 0x0019c/4, 0x00000040); INSTANCE_WR(ctx, 0x001a0/4, 0x80000000); INSTANCE_WR(ctx, 0x001b0/4, 0x80000000); INSTANCE_WR(ctx, 0x001c0/4, 0x80000000); INSTANCE_WR(ctx, 0x001d0/4, 0x0b0b0b0c); INSTANCE_WR(ctx, 0x00340/4, 0x00040000); INSTANCE_WR(ctx, 0x00350/4, 0x55555555); INSTANCE_WR(ctx, 0x00354/4, 0x55555555); INSTANCE_WR(ctx, 0x00358/4, 0x55555555); INSTANCE_WR(ctx, 0x0035c/4, 0x55555555); INSTANCE_WR(ctx, 0x00388/4, 0x00000008); INSTANCE_WR(ctx, 0x0039c/4, 0x00000010); INSTANCE_WR(ctx, 0x00480/4, 0x00000100); INSTANCE_WR(ctx, 0x00494/4, 0x00000111); INSTANCE_WR(ctx, 0x00498/4, 0x00080060); INSTANCE_WR(ctx, 0x004b4/4, 0x00000080); INSTANCE_WR(ctx, 0x004b8/4, 0xffff0000); INSTANCE_WR(ctx, 0x004bc/4, 0x00000001); INSTANCE_WR(ctx, 0x004d0/4, 0x46400000); INSTANCE_WR(ctx, 0x004ec/4, 0xffff0000); INSTANCE_WR(ctx, 0x004f8/4, 0x0fff0000); INSTANCE_WR(ctx, 0x004fc/4, 0x0fff0000); INSTANCE_WR(ctx, 0x00504/4, 0x00011100); for (i=0x00520; i<=0x0055c; i+=4) INSTANCE_WR(ctx, i/4, 0x07ff0000); INSTANCE_WR(ctx, 0x00568/4, 0x4b7fffff); INSTANCE_WR(ctx, 0x00594/4, 0x30201000); INSTANCE_WR(ctx, 0x00598/4, 0x70605040); INSTANCE_WR(ctx, 0x0059c/4, 0xb8a89888); INSTANCE_WR(ctx, 0x005a0/4, 0xf8e8d8c8); INSTANCE_WR(ctx, 0x005b4/4, 0x40100000); INSTANCE_WR(ctx, 0x005cc/4, 0x00000004); INSTANCE_WR(ctx, 0x005d8/4, 0x0000ffff); INSTANCE_WR(ctx, 0x0060c/4, 0x435185d6); INSTANCE_WR(ctx, 0x00610/4, 0x2155b699); INSTANCE_WR(ctx, 0x00614/4, 0xfedcba98); INSTANCE_WR(ctx, 0x00618/4, 0x00000098); INSTANCE_WR(ctx, 0x00628/4, 0xffffffff); INSTANCE_WR(ctx, 0x0062c/4, 0x00ff7000); INSTANCE_WR(ctx, 0x00630/4, 0x0000ffff); INSTANCE_WR(ctx, 0x00640/4, 0x00ff0000); INSTANCE_WR(ctx, 0x0067c/4, 0x00ffff00); /* 0x680-0x6BC - NV30_TCL_PRIMITIVE_3D_TX_ADDRESS_UNIT(0-15) */ /* 0x6C0-0x6FC - NV30_TCL_PRIMITIVE_3D_TX_FORMAT_UNIT(0-15) */ for (i=0x006C0; i<=0x006fc; i+=4) INSTANCE_WR(ctx, i/4, 0x00018488); /* 0x700-0x73C - NV30_TCL_PRIMITIVE_3D_TX_WRAP_UNIT(0-15) */ for (i=0x00700; i<=0x0073c; i+=4) INSTANCE_WR(ctx, i/4, 0x00028202); /* 0x740-0x77C - NV30_TCL_PRIMITIVE_3D_TX_ENABLE_UNIT(0-15) */ /* 0x780-0x7BC - NV30_TCL_PRIMITIVE_3D_TX_SWIZZLE_UNIT(0-15) */ for (i=0x00780; i<=0x007bc; i+=4) INSTANCE_WR(ctx, i/4, 0x0000aae4); /* 0x7C0-0x7FC - NV30_TCL_PRIMITIVE_3D_TX_FILTER_UNIT(0-15) */ for (i=0x007c0; i<=0x007fc; i+=4) INSTANCE_WR(ctx, i/4, 0x01012000); /* 0x800-0x83C - NV30_TCL_PRIMITIVE_3D_TX_XY_DIM_UNIT(0-15) */ for (i=0x00800; i<=0x0083c; i+=4) INSTANCE_WR(ctx, i/4, 0x00080008); /* 0x840-0x87C - NV30_TCL_PRIMITIVE_3D_TX_UNK07_UNIT(0-15) */ /* 0x880-0x8BC - NV30_TCL_PRIMITIVE_3D_TX_DEPTH_UNIT(0-15) */ for (i=0x00880; i<=0x008bc; i+=4) * All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * */ #ifndef _GAMMA_DRV_H_ #define _GAMMA_DRV_H_ /* gamma_drv.c */ extern d_open_t gamma_open; extern d_close_t gamma_close; extern d_ioctl_t gamma_ioctl; extern d_ioctl_t gamma_version; extern d_ioctl_t gamma_dma; extern d_ioctl_t gamma_lock; extern d_ioctl_t gamma_unlock; extern d_ioctl_t gamma_control; /* gamma_dma.c */ extern int gamma_dma_schedule(drm_device_t *dev, int locked); extern int gamma_irq_install(drm_device_t *dev, int irq); extern int gamma_irq_uninstall(drm_device_t *dev); extern int gamma_found(void); #endif