/*
* 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)
INSTANCE_WR(ctx, i/4, 0x00100008);
/* unknown */
for (i=0x00910; i<=0x0091c; i+=4)
INSTANCE_WR(ctx, i/4, 0x0001bc80);
for (i=0x00920; i<=0x0092c; i+=4)
INSTANCE_WR(ctx, i/4, 0x00000202);
for (i=0x00940; i<=0x0094c; i+=4)
INSTANCE_WR(ctx, i/4, 0x00000008);
for (i=0x00960; i<=0x0096c; i+=4)
INSTANCE_WR(ctx, i/4, 0x00080008);
INSTANCE_WR(ctx, 0x00980/4, 0x00000002);
INSTANCE_WR(ctx, 0x009b4/4, 0x00000001);
INSTANCE_WR(ctx, 0x009c0/4, 0x3e020200);
INSTANCE_WR(ctx, 0x009c4/4, 0x00ffffff);
INSTANCE_WR(ctx, 0x009c8/4, 0x60103f00);
INSTANCE_WR(ctx, 0x009d4/4, 0x00020000);
INSTANCE_WR(ctx, 0x00a08/4, 0x00008100);
INSTANCE_WR(ctx, 0x00aac/4, 0x00000001);
INSTANCE_WR(ctx, 0x00af0/4, 0x00000001);
INSTANCE_WR(ctx, 0x00af8/4, 0x80800001);
INSTANCE_WR(ctx, 0x00bcc/4, 0x00000005);
INSTANCE_WR(ctx, 0x00bf8/4, 0x00005555);
INSTANCE_WR(ctx, 0x00bfc/4, 0x00005555);
INSTANCE_WR(ctx, 0x00c00/4, 0x00005555);
INSTANCE_WR(ctx, 0x00c04/4, 0x00005555);
INSTANCE_WR(ctx, 0x00c08/4, 0x00005555);
INSTANCE_WR(ctx, 0x00c0c/4, 0x00005555);
INSTANCE_WR(ctx, 0x00c44/4, 0x00000001);
for (i=0x03008; i<=0x03080; i+=8)
INSTANCE_WR(ctx, i/4, 0x3f800000);
for (i=0x05288; i<=0x08570; i+=24)
INSTANCE_WR(ctx, i/4, 0x00000001);
for (i=0x08628; i<=0x08e18; i+=16)
INSTANCE_WR(ctx, i/4, 0x3f800000);
for (i=0x0bd28; i<=0x0f010; i+=24)
INSTANCE_WR(ctx, i/4, 0x00000001);
for (i=0x0f0c8; i<=0x0f8b8; i+=16)
INSTANCE_WR(ctx, i/4, 0x3f800000);
for (i=0x127c8; i<=0x15ab0; i+=24)
INSTANCE_WR(ctx, i/4, 0x00000001);
for (i=0x15b68; i<=0x16358; i+=16)
INSTANCE_WR(ctx, i/4, 0x3f800000);
for (i=0x19268; i<=0x1c550; i+=24)
INSTANCE_WR(ctx, i/4, 0x00000001);
for (i=0x1c608; i<=0x1cdf8; i+=16)
INSTANCE_WR(ctx, i/4, 0x3f800000);
for (i=0x1fd08; i<=0x22ff0; i+=24)
INSTANCE_WR(ctx, i/4, 0x00000001);
for (i=0x230a8; i<=0x23898; i+=16)
INSTANCE_WR(ctx, i/4, 0x3f800000);
for (i=0x267a8; i<=0x29a90; i+=24)
INSTANCE_WR(ctx, i/4, 0x00000001);
for (i=0x29b48; i<=0x2a338; i+=16)
INSTANCE_WR(ctx, i/4, 0x3f800000);
}
static void
nv41_graph_context_init(struct drm_device *dev, struct nouveau_gpuobj *ctx)
{
|