Ben Skeggs | 857a329 | 2008-07-11 20:44:39 +1000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2008 Ben Skeggs |
| 3 | * |
| 4 | * Permission is hereby granted, free of charge, to any person obtaining a |
| 5 | * copy of this software and associated documentation files (the "Software"), |
| 6 | * to deal in the Software without restriction, including without limitation |
| 7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 8 | * and/or sell copies of the Software, and to permit persons to whom the |
| 9 | * Software is furnished to do so, subject to the following conditions: |
| 10 | * |
| 11 | * The above copyright notice and this permission notice shall be included in |
| 12 | * all copies or substantial portions of the Software. |
| 13 | * |
| 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 17 | * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
| 18 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF |
| 19 | * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 20 | * SOFTWARE. |
| 21 | */ |
| 22 | |
Ben Skeggs | 84cc07d | 2008-02-29 15:03:57 +1100 | [diff] [blame] | 23 | #include "pipe/p_screen.h" |
Ben Skeggs | 84cc07d | 2008-02-29 15:03:57 +1100 | [diff] [blame] | 24 | |
Zack Rusin | 969c728 | 2009-01-31 15:14:38 -0500 | [diff] [blame] | 25 | #include "util/u_simple_screen.h" |
| 26 | |
Ben Skeggs | 84cc07d | 2008-02-29 15:03:57 +1100 | [diff] [blame] | 27 | #include "nv50_context.h" |
| 28 | #include "nv50_screen.h" |
| 29 | |
Ben Skeggs | b2e48f8 | 2008-03-12 02:39:13 +1100 | [diff] [blame] | 30 | #include "nouveau/nouveau_stateobj.h" |
| 31 | |
Ben Skeggs | 1cec61e | 2008-03-13 18:08:22 +1100 | [diff] [blame] | 32 | #define NV5X_GRCLASS5097_CHIPSETS 0x00000001 |
Ben Skeggs | a361606 | 2008-07-21 19:05:55 +1000 | [diff] [blame] | 33 | #define NV8X_GRCLASS8297_CHIPSETS 0x00000050 |
| 34 | #define NV9X_GRCLASS8297_CHIPSETS 0x00000014 |
Ben Skeggs | b2e48f8 | 2008-03-12 02:39:13 +1100 | [diff] [blame] | 35 | |
Ben Skeggs | 84cc07d | 2008-02-29 15:03:57 +1100 | [diff] [blame] | 36 | static boolean |
| 37 | nv50_screen_is_format_supported(struct pipe_screen *pscreen, |
Ben Skeggs | 39793a2 | 2008-07-23 14:14:55 +1000 | [diff] [blame] | 38 | enum pipe_format format, |
| 39 | enum pipe_texture_target target, |
| 40 | unsigned tex_usage, unsigned geom_flags) |
Ben Skeggs | 84cc07d | 2008-02-29 15:03:57 +1100 | [diff] [blame] | 41 | { |
Ben Skeggs | 39793a2 | 2008-07-23 14:14:55 +1000 | [diff] [blame] | 42 | if (tex_usage & PIPE_TEXTURE_USAGE_RENDER_TARGET) { |
Ben Skeggs | 32ed02b | 2008-05-05 19:49:06 +1000 | [diff] [blame] | 43 | switch (format) { |
| 44 | case PIPE_FORMAT_A8R8G8B8_UNORM: |
| 45 | case PIPE_FORMAT_R5G6B5_UNORM: |
| 46 | case PIPE_FORMAT_Z24S8_UNORM: |
| 47 | case PIPE_FORMAT_Z16_UNORM: |
| 48 | return TRUE; |
| 49 | default: |
| 50 | break; |
| 51 | } |
Ben Skeggs | 39793a2 | 2008-07-23 14:14:55 +1000 | [diff] [blame] | 52 | } else { |
Ben Skeggs | 32ed02b | 2008-05-05 19:49:06 +1000 | [diff] [blame] | 53 | switch (format) { |
Ben Skeggs | c0ed6a8 | 2008-06-13 12:09:46 +1000 | [diff] [blame] | 54 | case PIPE_FORMAT_A8R8G8B8_UNORM: |
Ben Skeggs | 7c745de | 2008-07-11 21:19:41 +1000 | [diff] [blame] | 55 | case PIPE_FORMAT_A1R5G5B5_UNORM: |
| 56 | case PIPE_FORMAT_A4R4G4B4_UNORM: |
| 57 | case PIPE_FORMAT_R5G6B5_UNORM: |
| 58 | case PIPE_FORMAT_L8_UNORM: |
| 59 | case PIPE_FORMAT_A8_UNORM: |
Ben Skeggs | 32ed02b | 2008-05-05 19:49:06 +1000 | [diff] [blame] | 60 | case PIPE_FORMAT_I8_UNORM: |
Ben Skeggs | 7c745de | 2008-07-11 21:19:41 +1000 | [diff] [blame] | 61 | case PIPE_FORMAT_A8L8_UNORM: |
Ben Skeggs | e8b0088 | 2009-01-13 11:44:30 +1000 | [diff] [blame] | 62 | case PIPE_FORMAT_DXT1_RGB: |
| 63 | case PIPE_FORMAT_DXT1_RGBA: |
| 64 | case PIPE_FORMAT_DXT3_RGBA: |
| 65 | case PIPE_FORMAT_DXT5_RGBA: |
Ben Skeggs | 32ed02b | 2008-05-05 19:49:06 +1000 | [diff] [blame] | 66 | return TRUE; |
| 67 | default: |
| 68 | break; |
| 69 | } |
Ben Skeggs | 32ed02b | 2008-05-05 19:49:06 +1000 | [diff] [blame] | 70 | } |
| 71 | |
Ben Skeggs | 84cc07d | 2008-02-29 15:03:57 +1100 | [diff] [blame] | 72 | return FALSE; |
| 73 | } |
| 74 | |
| 75 | static const char * |
| 76 | nv50_screen_get_name(struct pipe_screen *pscreen) |
| 77 | { |
| 78 | struct nv50_screen *screen = nv50_screen(pscreen); |
Ben Skeggs | 1ef0856 | 2008-05-13 12:16:35 +1000 | [diff] [blame] | 79 | struct nouveau_device *dev = screen->nvws->channel->device; |
Ben Skeggs | 84cc07d | 2008-02-29 15:03:57 +1100 | [diff] [blame] | 80 | static char buffer[128]; |
| 81 | |
Ben Skeggs | 1ef0856 | 2008-05-13 12:16:35 +1000 | [diff] [blame] | 82 | snprintf(buffer, sizeof(buffer), "NV%02X", dev->chipset); |
Ben Skeggs | 84cc07d | 2008-02-29 15:03:57 +1100 | [diff] [blame] | 83 | return buffer; |
| 84 | } |
| 85 | |
| 86 | static const char * |
| 87 | nv50_screen_get_vendor(struct pipe_screen *pscreen) |
| 88 | { |
| 89 | return "nouveau"; |
| 90 | } |
| 91 | |
| 92 | static int |
| 93 | nv50_screen_get_param(struct pipe_screen *pscreen, int param) |
| 94 | { |
| 95 | switch (param) { |
| 96 | case PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS: |
| 97 | return 32; |
| 98 | case PIPE_CAP_NPOT_TEXTURES: |
Ben Skeggs | ed8f0b7 | 2009-01-12 14:27:51 +1000 | [diff] [blame] | 99 | return 1; |
Ben Skeggs | 84cc07d | 2008-02-29 15:03:57 +1100 | [diff] [blame] | 100 | case PIPE_CAP_TWO_SIDED_STENCIL: |
| 101 | return 1; |
| 102 | case PIPE_CAP_GLSL: |
| 103 | return 0; |
| 104 | case PIPE_CAP_S3TC: |
Ben Skeggs | e8b0088 | 2009-01-13 11:44:30 +1000 | [diff] [blame] | 105 | return 1; |
Ben Skeggs | 84cc07d | 2008-02-29 15:03:57 +1100 | [diff] [blame] | 106 | case PIPE_CAP_ANISOTROPIC_FILTER: |
Ben Skeggs | f7c2010 | 2009-01-13 10:55:06 +1000 | [diff] [blame] | 107 | return 1; |
Ben Skeggs | 84cc07d | 2008-02-29 15:03:57 +1100 | [diff] [blame] | 108 | case PIPE_CAP_POINT_SPRITE: |
| 109 | return 0; |
| 110 | case PIPE_CAP_MAX_RENDER_TARGETS: |
| 111 | return 8; |
| 112 | case PIPE_CAP_OCCLUSION_QUERY: |
Ben Skeggs | 918fc55 | 2009-01-13 10:44:52 +1000 | [diff] [blame] | 113 | return 1; |
Ben Skeggs | 84cc07d | 2008-02-29 15:03:57 +1100 | [diff] [blame] | 114 | case PIPE_CAP_TEXTURE_SHADOW_MAP: |
Ben Skeggs | 68bb26b6 | 2009-01-13 10:58:17 +1000 | [diff] [blame] | 115 | return 1; |
Ben Skeggs | 84cc07d | 2008-02-29 15:03:57 +1100 | [diff] [blame] | 116 | case PIPE_CAP_MAX_TEXTURE_2D_LEVELS: |
| 117 | return 13; |
| 118 | case PIPE_CAP_MAX_TEXTURE_3D_LEVELS: |
| 119 | return 10; |
| 120 | case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS: |
| 121 | return 13; |
Ben Skeggs | ce8e846 | 2008-08-07 11:38:56 +1000 | [diff] [blame] | 122 | case PIPE_CAP_TEXTURE_MIRROR_CLAMP: |
| 123 | case PIPE_CAP_TEXTURE_MIRROR_REPEAT: |
| 124 | return 1; |
Ben Skeggs | 300e42d | 2008-12-16 17:30:04 +1100 | [diff] [blame] | 125 | case PIPE_CAP_MAX_VERTEX_TEXTURE_UNITS: |
| 126 | return 0; |
Ben Skeggs | fbb6cc7 | 2008-04-04 12:39:45 +1000 | [diff] [blame] | 127 | case NOUVEAU_CAP_HW_VTXBUF: |
Ben Skeggs | 17e95de | 2008-07-11 02:01:23 +1000 | [diff] [blame] | 128 | return 1; |
Ben Skeggs | fbb6cc7 | 2008-04-04 12:39:45 +1000 | [diff] [blame] | 129 | case NOUVEAU_CAP_HW_IDXBUF: |
| 130 | return 0; |
Ben Skeggs | 84cc07d | 2008-02-29 15:03:57 +1100 | [diff] [blame] | 131 | default: |
| 132 | NOUVEAU_ERR("Unknown PIPE_CAP %d\n", param); |
| 133 | return 0; |
| 134 | } |
| 135 | } |
| 136 | |
| 137 | static float |
| 138 | nv50_screen_get_paramf(struct pipe_screen *pscreen, int param) |
| 139 | { |
| 140 | switch (param) { |
| 141 | case PIPE_CAP_MAX_LINE_WIDTH: |
| 142 | case PIPE_CAP_MAX_LINE_WIDTH_AA: |
| 143 | return 10.0; |
| 144 | case PIPE_CAP_MAX_POINT_WIDTH: |
| 145 | case PIPE_CAP_MAX_POINT_WIDTH_AA: |
| 146 | return 64.0; |
| 147 | case PIPE_CAP_MAX_TEXTURE_ANISOTROPY: |
| 148 | return 16.0; |
| 149 | case PIPE_CAP_MAX_TEXTURE_LOD_BIAS: |
| 150 | return 4.0; |
| 151 | default: |
| 152 | NOUVEAU_ERR("Unknown PIPE_CAP %d\n", param); |
| 153 | return 0.0; |
| 154 | } |
| 155 | } |
| 156 | |
| 157 | static void |
| 158 | nv50_screen_destroy(struct pipe_screen *pscreen) |
| 159 | { |
| 160 | FREE(pscreen); |
| 161 | } |
| 162 | |
| 163 | struct pipe_screen * |
Ben Skeggs | 1ef0856 | 2008-05-13 12:16:35 +1000 | [diff] [blame] | 164 | nv50_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws) |
Ben Skeggs | 84cc07d | 2008-02-29 15:03:57 +1100 | [diff] [blame] | 165 | { |
| 166 | struct nv50_screen *screen = CALLOC_STRUCT(nv50_screen); |
Ben Skeggs | b2e48f8 | 2008-03-12 02:39:13 +1100 | [diff] [blame] | 167 | struct nouveau_stateobj *so; |
| 168 | unsigned tesla_class = 0, ret; |
Ben Skeggs | 1ef0856 | 2008-05-13 12:16:35 +1000 | [diff] [blame] | 169 | unsigned chipset = nvws->channel->device->chipset; |
Ben Skeggs | 3250bac | 2008-03-12 02:56:10 +1100 | [diff] [blame] | 170 | int i; |
Ben Skeggs | 84cc07d | 2008-02-29 15:03:57 +1100 | [diff] [blame] | 171 | |
| 172 | if (!screen) |
| 173 | return NULL; |
Ben Skeggs | baaae56 | 2008-02-29 22:54:40 +1100 | [diff] [blame] | 174 | screen->nvws = nvws; |
Ben Skeggs | 84cc07d | 2008-02-29 15:03:57 +1100 | [diff] [blame] | 175 | |
Ben Skeggs | 63a3a37 | 2009-02-20 09:32:47 +1000 | [diff] [blame^] | 176 | /* DMA engine object */ |
| 177 | ret = nvws->grobj_alloc(nvws, 0x5039, &screen->m2mf); |
| 178 | if (ret) { |
| 179 | NOUVEAU_ERR("Error creating M2MF object: %d\n", ret); |
| 180 | nv50_screen_destroy(&screen->pipe); |
| 181 | return NULL; |
| 182 | } |
| 183 | |
Ben Skeggs | 1339373 | 2009-02-05 14:04:45 +1000 | [diff] [blame] | 184 | /* 2D object */ |
| 185 | ret = nvws->grobj_alloc(nvws, NV50_2D, &screen->eng2d); |
| 186 | if (ret) { |
| 187 | NOUVEAU_ERR("Error creating 2D object: %d\n", ret); |
| 188 | nv50_screen_destroy(&screen->pipe); |
| 189 | return NULL; |
| 190 | } |
| 191 | |
Ben Skeggs | b2e48f8 | 2008-03-12 02:39:13 +1100 | [diff] [blame] | 192 | /* 3D object */ |
| 193 | if ((chipset & 0xf0) != 0x50 && (chipset & 0xf0) != 0x80) { |
| 194 | NOUVEAU_ERR("Not a G8x chipset\n"); |
| 195 | nv50_screen_destroy(&screen->pipe); |
| 196 | return NULL; |
| 197 | } |
| 198 | |
Ben Skeggs | 1cec61e | 2008-03-13 18:08:22 +1100 | [diff] [blame] | 199 | switch (chipset & 0xf0) { |
| 200 | case 0x50: |
| 201 | if (NV5X_GRCLASS5097_CHIPSETS & (1 << (chipset & 0x0f))) |
| 202 | tesla_class = 0x5097; |
| 203 | break; |
| 204 | case 0x80: |
| 205 | if (NV8X_GRCLASS8297_CHIPSETS & (1 << (chipset & 0x0f))) |
| 206 | tesla_class = 0x8297; |
| 207 | break; |
| 208 | case 0x90: |
| 209 | if (NV9X_GRCLASS8297_CHIPSETS & (1 << (chipset & 0x0f))) |
| 210 | tesla_class = 0x8297; |
| 211 | break; |
| 212 | default: |
| 213 | break; |
| 214 | } |
| 215 | |
| 216 | if (tesla_class == 0) { |
Ben Skeggs | b2e48f8 | 2008-03-12 02:39:13 +1100 | [diff] [blame] | 217 | NOUVEAU_ERR("Unknown G8x chipset: NV%02x\n", chipset); |
| 218 | nv50_screen_destroy(&screen->pipe); |
| 219 | return NULL; |
| 220 | } |
| 221 | |
| 222 | ret = nvws->grobj_alloc(nvws, tesla_class, &screen->tesla); |
| 223 | if (ret) { |
| 224 | NOUVEAU_ERR("Error creating 3D object: %d\n", ret); |
| 225 | nv50_screen_destroy(&screen->pipe); |
| 226 | return NULL; |
| 227 | } |
| 228 | |
| 229 | /* Sync notifier */ |
| 230 | ret = nvws->notifier_alloc(nvws, 1, &screen->sync); |
| 231 | if (ret) { |
| 232 | NOUVEAU_ERR("Error creating notifier object: %d\n", ret); |
| 233 | nv50_screen_destroy(&screen->pipe); |
| 234 | return NULL; |
| 235 | } |
| 236 | |
Ben Skeggs | 63a3a37 | 2009-02-20 09:32:47 +1000 | [diff] [blame^] | 237 | /* Static M2MF init */ |
| 238 | so = so_new(32, 0); |
| 239 | so_method(so, screen->m2mf, 0x0180, 3); |
| 240 | so_data (so, screen->sync->handle); |
| 241 | so_data (so, screen->nvws->channel->vram->handle); |
| 242 | so_data (so, screen->nvws->channel->vram->handle); |
| 243 | so_emit(nvws, so); |
| 244 | so_ref (NULL, &so); |
| 245 | |
Ben Skeggs | 1339373 | 2009-02-05 14:04:45 +1000 | [diff] [blame] | 246 | /* Static 2D init */ |
| 247 | so = so_new(64, 0); |
| 248 | so_method(so, screen->eng2d, NV50_2D_DMA_NOTIFY, 4); |
| 249 | so_data (so, screen->sync->handle); |
| 250 | so_data (so, screen->nvws->channel->vram->handle); |
| 251 | so_data (so, screen->nvws->channel->vram->handle); |
| 252 | so_data (so, screen->nvws->channel->vram->handle); |
| 253 | so_method(so, screen->eng2d, NV50_2D_OPERATION, 1); |
| 254 | so_data (so, NV50_2D_OPERATION_SRCCOPY); |
| 255 | so_method(so, screen->eng2d, 0x0290, 1); |
| 256 | so_data (so, 0); |
| 257 | so_method(so, screen->eng2d, 0x0888, 1); |
| 258 | so_data (so, 1); |
| 259 | so_emit(nvws, so); |
| 260 | so_ref(NULL, &so); |
| 261 | |
Ben Skeggs | b2e48f8 | 2008-03-12 02:39:13 +1100 | [diff] [blame] | 262 | /* Static tesla init */ |
Ben Skeggs | f722fd9 | 2008-06-01 22:41:40 +1000 | [diff] [blame] | 263 | so = so_new(256, 20); |
| 264 | |
| 265 | so_method(so, screen->tesla, 0x1558, 1); |
| 266 | so_data (so, 1); |
Ben Skeggs | b2e48f8 | 2008-03-12 02:39:13 +1100 | [diff] [blame] | 267 | so_method(so, screen->tesla, NV50TCL_DMA_NOTIFY, 1); |
| 268 | so_data (so, screen->sync->handle); |
Ben Skeggs | add89c7 | 2008-07-11 00:21:42 +1000 | [diff] [blame] | 269 | so_method(so, screen->tesla, NV50TCL_DMA_UNK0(0), |
| 270 | NV50TCL_DMA_UNK0__SIZE); |
| 271 | for (i = 0; i < NV50TCL_DMA_UNK0__SIZE; i++) |
Ben Skeggs | 3250bac | 2008-03-12 02:56:10 +1100 | [diff] [blame] | 272 | so_data(so, nvws->channel->vram->handle); |
Ben Skeggs | add89c7 | 2008-07-11 00:21:42 +1000 | [diff] [blame] | 273 | so_method(so, screen->tesla, NV50TCL_DMA_UNK1(0), |
| 274 | NV50TCL_DMA_UNK1__SIZE); |
| 275 | for (i = 0; i < NV50TCL_DMA_UNK1__SIZE; i++) |
Ben Skeggs | 3250bac | 2008-03-12 02:56:10 +1100 | [diff] [blame] | 276 | so_data(so, nvws->channel->vram->handle); |
Ben Skeggs | f722fd9 | 2008-06-01 22:41:40 +1000 | [diff] [blame] | 277 | so_method(so, screen->tesla, 0x121c, 1); |
| 278 | so_data (so, 1); |
| 279 | |
| 280 | so_method(so, screen->tesla, 0x13bc, 1); |
| 281 | so_data (so, 0x54); |
| 282 | so_method(so, screen->tesla, 0x13ac, 1); |
| 283 | so_data (so, 1); |
Ben Skeggs | f722fd9 | 2008-06-01 22:41:40 +1000 | [diff] [blame] | 284 | so_method(so, screen->tesla, 0x16b8, 1); |
| 285 | so_data (so, 8); |
| 286 | |
Ben Skeggs | 716c1cd | 2008-06-01 23:10:31 +1000 | [diff] [blame] | 287 | /* Shared constant buffer */ |
Zack Rusin | adfbba4 | 2009-01-30 15:56:00 -0500 | [diff] [blame] | 288 | screen->constbuf = ws->buffer_create(ws, 0, 0, 128 * 4 * 4); |
Ben Skeggs | ab3d55e | 2008-06-12 13:11:41 +1000 | [diff] [blame] | 289 | if (nvws->res_init(&screen->vp_data_heap, 0, 128)) { |
Ben Skeggs | 716c1cd | 2008-06-01 23:10:31 +1000 | [diff] [blame] | 290 | NOUVEAU_ERR("Error initialising constant buffer\n"); |
| 291 | nv50_screen_destroy(&screen->pipe); |
| 292 | return NULL; |
| 293 | } |
Ben Skeggs | f722fd9 | 2008-06-01 22:41:40 +1000 | [diff] [blame] | 294 | |
Ben Skeggs | 716c1cd | 2008-06-01 23:10:31 +1000 | [diff] [blame] | 295 | so_method(so, screen->tesla, 0x1280, 3); |
| 296 | so_reloc (so, screen->constbuf, 0, NOUVEAU_BO_VRAM | |
| 297 | NOUVEAU_BO_RD | NOUVEAU_BO_HIGH, 0, 0); |
| 298 | so_reloc (so, screen->constbuf, 0, NOUVEAU_BO_VRAM | |
| 299 | NOUVEAU_BO_RD | NOUVEAU_BO_LOW, 0, 0); |
| 300 | so_data (so, (NV50_CB_PMISC << 16) | 0x00001000); |
| 301 | |
| 302 | /* Texture sampler/image unit setup - we abuse the constant buffer |
| 303 | * upload mechanism for the moment to upload data to the tex config |
| 304 | * blocks. At some point we *may* want to go the NVIDIA way of doing |
| 305 | * things? |
| 306 | */ |
Zack Rusin | adfbba4 | 2009-01-30 15:56:00 -0500 | [diff] [blame] | 307 | screen->tic = ws->buffer_create(ws, 0, 0, 32 * 8 * 4); |
Ben Skeggs | 716c1cd | 2008-06-01 23:10:31 +1000 | [diff] [blame] | 308 | so_method(so, screen->tesla, 0x1280, 3); |
| 309 | so_reloc (so, screen->tic, 0, NOUVEAU_BO_VRAM | |
| 310 | NOUVEAU_BO_RD | NOUVEAU_BO_HIGH, 0, 0); |
| 311 | so_reloc (so, screen->tic, 0, NOUVEAU_BO_VRAM | |
| 312 | NOUVEAU_BO_RD | NOUVEAU_BO_LOW, 0, 0); |
| 313 | so_data (so, (NV50_CB_TIC << 16) | 0x0800); |
| 314 | so_method(so, screen->tesla, 0x1574, 3); |
| 315 | so_reloc (so, screen->tic, 0, NOUVEAU_BO_VRAM | |
| 316 | NOUVEAU_BO_RD | NOUVEAU_BO_HIGH, 0, 0); |
| 317 | so_reloc (so, screen->tic, 0, NOUVEAU_BO_VRAM | |
| 318 | NOUVEAU_BO_RD | NOUVEAU_BO_LOW, 0, 0); |
| 319 | so_data (so, 0x00000800); |
| 320 | |
Zack Rusin | adfbba4 | 2009-01-30 15:56:00 -0500 | [diff] [blame] | 321 | screen->tsc = ws->buffer_create(ws, 0, 0, 32 * 8 * 4); |
Ben Skeggs | 716c1cd | 2008-06-01 23:10:31 +1000 | [diff] [blame] | 322 | so_method(so, screen->tesla, 0x1280, 3); |
| 323 | so_reloc (so, screen->tsc, 0, NOUVEAU_BO_VRAM | |
| 324 | NOUVEAU_BO_RD | NOUVEAU_BO_HIGH, 0, 0); |
| 325 | so_reloc (so, screen->tsc, 0, NOUVEAU_BO_VRAM | |
| 326 | NOUVEAU_BO_RD | NOUVEAU_BO_LOW, 0, 0); |
| 327 | so_data (so, (NV50_CB_TSC << 16) | 0x0800); |
| 328 | so_method(so, screen->tesla, 0x155c, 3); |
| 329 | so_reloc (so, screen->tsc, 0, NOUVEAU_BO_VRAM | |
| 330 | NOUVEAU_BO_RD | NOUVEAU_BO_HIGH, 0, 0); |
| 331 | so_reloc (so, screen->tsc, 0, NOUVEAU_BO_VRAM | |
| 332 | NOUVEAU_BO_RD | NOUVEAU_BO_LOW, 0, 0); |
| 333 | so_data (so, 0x00000800); |
| 334 | |
| 335 | |
| 336 | /* Vertex array limits - max them out */ |
Ben Skeggs | f722fd9 | 2008-06-01 22:41:40 +1000 | [diff] [blame] | 337 | for (i = 0; i < 16; i++) { |
| 338 | so_method(so, screen->tesla, 0x1080 + (i * 8), 2); |
| 339 | so_data (so, 0x000000ff); |
| 340 | so_data (so, 0xffffffff); |
| 341 | } |
Ben Skeggs | 3250bac | 2008-03-12 02:56:10 +1100 | [diff] [blame] | 342 | |
Ben Skeggs | 101305f | 2008-06-13 10:58:27 +1000 | [diff] [blame] | 343 | so_method(so, screen->tesla, NV50TCL_DEPTH_RANGE_NEAR, 2); |
| 344 | so_data (so, fui(0.0)); |
| 345 | so_data (so, fui(1.0)); |
| 346 | |
Ben Skeggs | 431504b | 2008-06-16 18:56:39 +1000 | [diff] [blame] | 347 | so_method(so, screen->tesla, 0x1234, 1); |
| 348 | so_data (so, 1); |
| 349 | so_method(so, screen->tesla, 0x1458, 1); |
| 350 | so_data (so, 1); |
| 351 | |
Ben Skeggs | b2e48f8 | 2008-03-12 02:39:13 +1100 | [diff] [blame] | 352 | so_emit(nvws, so); |
Ben Skeggs | 714cb4a | 2008-06-17 23:55:23 +1000 | [diff] [blame] | 353 | so_ref(so, &screen->static_init); |
Ben Skeggs | bbefb54 | 2008-03-30 20:32:22 +1000 | [diff] [blame] | 354 | nvws->push_flush(nvws, 0, NULL); |
Ben Skeggs | b2e48f8 | 2008-03-12 02:39:13 +1100 | [diff] [blame] | 355 | |
Ben Skeggs | 84cc07d | 2008-02-29 15:03:57 +1100 | [diff] [blame] | 356 | screen->pipe.winsys = ws; |
| 357 | |
| 358 | screen->pipe.destroy = nv50_screen_destroy; |
| 359 | |
| 360 | screen->pipe.get_name = nv50_screen_get_name; |
| 361 | screen->pipe.get_vendor = nv50_screen_get_vendor; |
| 362 | screen->pipe.get_param = nv50_screen_get_param; |
| 363 | screen->pipe.get_paramf = nv50_screen_get_paramf; |
| 364 | |
| 365 | screen->pipe.is_format_supported = nv50_screen_is_format_supported; |
| 366 | |
Ben Skeggs | 84cc07d | 2008-02-29 15:03:57 +1100 | [diff] [blame] | 367 | nv50_screen_init_miptree_functions(&screen->pipe); |
Ben Skeggs | 63a3a37 | 2009-02-20 09:32:47 +1000 | [diff] [blame^] | 368 | nv50_transfer_init_screen_functions(&screen->pipe); |
Zack Rusin | 969c728 | 2009-01-31 15:14:38 -0500 | [diff] [blame] | 369 | u_simple_screen_init(&screen->pipe); |
Ben Skeggs | 84cc07d | 2008-02-29 15:03:57 +1100 | [diff] [blame] | 370 | |
| 371 | return &screen->pipe; |
| 372 | } |
| 373 | |