Rev 4348 | Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
4315 | Serge | 1 | |
2 | #include |
||
3 | #include |
||
4 | |||
5 | |||
6 | //#include "xf86.h" |
||
7 | #include "uxa/intel.h" |
||
8 | #include "i830_reg.h" |
||
9 | #include "i965_reg.h" |
||
10 | |||
11 | |||
12 | #include "brw_defines.h" |
||
13 | #include "brw_structs.h" |
||
14 | |||
15 | |||
16 | #include |
||
17 | #include |
||
18 | |||
19 | |||
20 | #define PictOpSrc 1 |
||
21 | #define PictOpDst 2 |
||
22 | #define PictOpOver 3 |
||
23 | #define PictOpOverReverse 4 |
||
24 | #define PictOpIn 5 |
||
25 | #define PictOpInReverse 6 |
||
26 | #define PictOpOut 7 |
||
27 | #define PictOpOutReverse 8 |
||
28 | #define PictOpAtop 9 |
||
29 | #define PictOpAtopReverse 10 |
||
30 | #define PictOpXor 11 |
||
31 | #define PictOpAdd 12 |
||
32 | #define PictOpSaturate 13 |
||
33 | #define PictOpMaximum 13 |
||
34 | |||
35 | |||
36 | |||
37 | |||
38 | __LOCK_INIT_RECURSIVE(, __uxa_lock); |
||
39 | |||
40 | |||
41 | |||
42 | |||
43 | { |
||
44 | struct list entry; |
||
45 | uint32_t width; |
||
46 | uint32_t height; |
||
47 | void *data; |
||
48 | uint32_t pitch; |
||
49 | drm_intel_bo *bo; |
||
50 | uint32_t bo_size; |
||
51 | uint32_t flags; |
||
52 | }surface_t; |
||
53 | |||
54 | |||
55 | |||
56 | |||
57 | |||
58 | |||
59 | |||
60 | |||
61 | |||
62 | |||
63 | { |
||
64 | return 0; |
||
65 | }; |
||
66 | |||
67 | |||
68 | { |
||
69 | intel_screen_private *intel = intel_get_screen_private(); |
||
70 | |||
71 | |||
72 | intel->vertex_flush(intel); |
||
73 | |||
74 | |||
75 | } |
||
76 | |||
77 | |||
78 | { |
||
79 | struct intel_screen_private *intel = intel_get_screen_private(); |
||
80 | drm_intel_bo *bo; |
||
81 | surface_t *sf; |
||
82 | unsigned int size; |
||
83 | |||
84 | |||
85 | |||
86 | |||
87 | list_for_each_entry(sf, &sf_list, entry) |
||
88 | { |
||
89 | if (sf->bo->handle == handle) |
||
90 | { |
||
91 | bitmap->handle = (uint32_t)sf; |
||
92 | break; |
||
93 | } |
||
94 | } |
||
95 | __lock_release_recursive(__uxa_lock); |
||
96 | |||
97 | |||
98 | return 0; |
||
99 | |||
100 | |||
101 | if(sf == NULL) |
||
102 | goto err_1; |
||
103 | |||
104 | |||
105 | |||
106 | |||
107 | |||
108 | |||
109 | sf->height = bitmap->height; |
||
110 | sf->data = NULL; |
||
111 | sf->pitch = bitmap->pitch; |
||
112 | sf->bo = bo; |
||
113 | sf->bo_size = size; |
||
114 | sf->flags = bitmap->flags; |
||
115 | |||
116 | |||
117 | |||
118 | |||
119 | |||
120 | |||
121 | |||
122 | |||
123 | }; |
||
124 | |||
125 | |||
126 | { |
||
127 | sna_bitmap_from_handle(bitmap, handle); |
||
128 | }; |
||
129 | |||
130 | |||
131 | |||
132 | int w, int h, int src_x, int src_y) |
||
133 | { |
||
134 | struct _Pixmap pixSrc, pixMask; |
||
135 | struct intel_pixmap privSrc; |
||
136 | struct _Picture pictSrc, pictDst; |
||
137 | struct intel_screen_private *intel = intel_get_screen_private(); |
||
138 | |||
139 | |||
140 | |||
141 | |||
142 | |||
143 | |||
144 | get_proc_info(proc_info); |
||
145 | winx = *(uint32_t*)(proc_info+34); |
||
146 | winy = *(uint32_t*)(proc_info+38); |
||
147 | |||
148 | |||
149 | memset(&pixMask, 0, sizeof(pixMask)); |
||
150 | memset(&privSrc, 0, sizeof(pixSrc)); |
||
151 | |||
152 | |||
153 | memset(&pictDst, 0, sizeof(pictDst)); |
||
154 | |||
155 | |||
156 | pixSrc.drawable.width = sf->width; |
||
157 | pixSrc.drawable.height = sf->height; |
||
158 | pixSrc.devKind = sf->pitch; |
||
159 | pixSrc.private = &privSrc; |
||
160 | |||
161 | |||
162 | privSrc.bo = sf->bo; |
||
163 | privSrc.stride = sf->pitch; |
||
164 | privSrc.tiling = I915_TILING_X; |
||
165 | |||
166 | |||
167 | pictSrc.filter = PictFilterNearest; |
||
168 | pictSrc.repeatType = RepeatNone; |
||
169 | |||
170 | |||
171 | pictDst.filter = PictFilterNearest; |
||
172 | pictDst.repeatType = RepeatNone; |
||
173 | |||
174 | |||
175 | |||
176 | |||
177 | // pixDst.drawable.width = sna_fb.width; |
||
178 | // pixDst.drawable.height = sna_fb.height; |
||
179 | |||
180 | |||
181 | // pixMask.drawable.width = update.width; |
||
182 | // pixMask.drawable.height = update.height; |
||
183 | |||
184 | |||
185 | &pixSrc, NULL, &fb_pixmap); |
||
186 | |||
187 | |||
188 | |||
189 | dst_x, dst_y, w, h); |
||
190 | |||
191 | |||
192 | |||
193 | |||
194 | |||
195 | |||
196 | }; |
||
197 | |||
198 | |||
199 | |||
200 | { |
||
201 | struct drm_i915_fb_info fb; |
||
202 | static struct intel_pixmap ipix; |
||
203 | int ret; |
||
204 | |||
205 | |||
206 | |||
207 | |||
208 | if( ret != 0 ) |
||
209 | return ret; |
||
210 | |||
211 | |||
212 | if(intel->front_buffer == NULL) |
||
213 | return -1; |
||
214 | |||
215 | |||
216 | list_init(&ipix.batch); |
||
217 | ipix.stride = fb.pitch; |
||
218 | ipix.tiling = fb.tiling; |
||
219 | ipix.pinned = PIN_SCANOUT; |
||
220 | |||
221 | |||
222 | printf("size %d, offset %d handle %d\n",ipix.bo->size, ipix.bo->offset, ipix.bo->handle); |
||
223 | |||
224 | |||
225 | fb_pixmap.drawable.width = fb.width; |
||
226 | fb_pixmap.drawable.height = fb.height; |
||
227 | fb_pixmap.devKind = fb.pitch; |
||
228 | fb_pixmap.private = &ipix; |
||
229 | |||
230 | |||
231 | } |
||
232 | |||
233 | |||
234 | { |
||
235 | struct drm_i915_fb_info fb; |
||
236 | struct intel_pixmap *ipix; |
||
237 | size_t size; |
||
238 | int ret; |
||
239 | |||
240 | |||
241 | if( ret != 0 ) |
||
242 | return ret; |
||
243 | |||
244 | |||
245 | ipix->stride = fb.pitch; |
||
246 | ipix->tiling = fb.tiling; |
||
247 | |||
248 | |||
249 | fb_pixmap.drawable.height = fb.height; |
||
250 | fb_pixmap.devKind = fb.pitch; |
||
251 | |||
252 | |||
253 | }; |
||
254 | |||
255 | |||
256 | { |
||
257 | static struct pci_device device; |
||
258 | struct intel_screen_private *intel = intel_get_screen_private(); |
||
259 | |||
260 | |||
261 | int caps = 0; |
||
262 | |||
263 | |||
264 | |||
265 | |||
266 | |||
267 | |||
268 | goto done; |
||
269 | |||
270 | |||
271 | io.io_code = SRV_GET_PCI_INFO; |
||
272 | io.input = &device; |
||
273 | io.inp_size = sizeof(device); |
||
274 | io.output = NULL; |
||
275 | io.out_size = 0; |
||
276 | |||
277 | |||
278 | goto err1; |
||
279 | |||
280 | |||
281 | if (intel == NULL) |
||
282 | goto err1; |
||
283 | |||
284 | |||
285 | |||
286 | |||
287 | memset(intel, 0, sizeof(*intel)); |
||
288 | |||
289 | |||
290 | |||
291 | |||
292 | intel->info = intel_detect_chipset(intel->PciInfo); |
||
293 | intel->scrn = service; |
||
294 | |||
295 | |||
296 | if(intel->bufmgr == NULL) |
||
297 | { |
||
298 | printf("Memory manager initialization failed\n"); |
||
299 | goto err1; |
||
300 | }; |
||
301 | |||
302 | |||
303 | goto err1; |
||
304 | |||
305 | |||
306 | |||
307 | |||
308 | gen4_render_state_init(); |
||
309 | |||
310 | |||
311 | printf("Hardware acceleration initialization failed\n"); |
||
312 | goto err1; |
||
313 | } |
||
314 | |||
315 | |||
316 | |||
317 | |||
318 | |||
319 | |||
320 | // caps = sna_device->render.caps; |
||
321 | |||
322 | |||
323 | __lock_release_recursive(__uxa_lock); |
||
324 | |||
325 | |||
326 | return caps; |
||
327 | } |
||
328 | |||
329 | |||
330 | |||
331 | |||
332 | gen6_context_switch(intel_screen_private *intel, |
||
333 | int new_mode) |
||
334 | { |
||
335 | intel_batch_submit(intel->scrn); |
||
336 | } |
||
337 | |||
338 | |||
339 | gen5_context_switch(intel_screen_private *intel, |
||
340 | int new_mode) |
||
341 | { |
||
342 | /* Ironlake has a limitation that a 3D or Media command can't |
||
343 | * be the first command after a BLT, unless it's |
||
344 | * non-pipelined. Instead of trying to track it and emit a |
||
345 | * command at the right time, we just emit a dummy |
||
346 | * non-pipelined 3D instruction after each blit. |
||
347 | */ |
||
348 | |||
349 | |||
350 | OUT_BATCH(MI_FLUSH | |
||
351 | MI_STATE_INSTRUCTION_CACHE_FLUSH | |
||
352 | MI_INHIBIT_RENDER_CACHE_FLUSH); |
||
353 | } else { |
||
354 | OUT_BATCH(CMD_POLY_STIPPLE_OFFSET << 16); |
||
355 | OUT_BATCH(0); |
||
356 | } |
||
357 | } |
||
358 | |||
359 | |||
360 | gen4_context_switch(intel_screen_private *intel, |
||
361 | int new_mode) |
||
362 | { |
||
363 | if (new_mode == I915_EXEC_BLT) { |
||
364 | OUT_BATCH(MI_FLUSH | |
||
365 | MI_STATE_INSTRUCTION_CACHE_FLUSH | |
||
366 | MI_INHIBIT_RENDER_CACHE_FLUSH); |
||
367 | } |
||
368 | } |
||
369 | |||
370 | |||
371 | intel_limits_init(intel_screen_private *intel) |
||
372 | { |
||
373 | /* Limits are described in the BLT engine chapter under Graphics Data Size |
||
374 | * Limitations, and the descriptions of SURFACE_STATE, 3DSTATE_BUFFER_INFO, |
||
375 | * 3DSTATE_DRAWING_RECTANGLE, 3DSTATE_MAP_INFO, and 3DSTATE_MAP_INFO. |
||
376 | * |
||
377 | * i845 through i965 limits 2D rendering to 65536 lines and pitch of 32768. |
||
378 | * |
||
379 | * i965 limits 3D surface to (2*element size)-aligned offset if un-tiled. |
||
380 | * i965 limits 3D surface to 4kB-aligned offset if tiled. |
||
381 | * i965 limits 3D surfaces to w,h of ?,8192. |
||
382 | * i965 limits 3D surface to pitch of 1B - 128kB. |
||
383 | * i965 limits 3D surface pitch alignment to 1 or 2 times the element size. |
||
384 | * i965 limits 3D surface pitch alignment to 512B if tiled. |
||
385 | * i965 limits 3D destination drawing rect to w,h of 8192,8192. |
||
386 | * |
||
387 | * i915 limits 3D textures to 4B-aligned offset if un-tiled. |
||
388 | * i915 limits 3D textures to ~4kB-aligned offset if tiled. |
||
389 | * i915 limits 3D textures to width,height of 2048,2048. |
||
390 | * i915 limits 3D textures to pitch of 16B - 8kB, in dwords. |
||
391 | * i915 limits 3D destination to ~4kB-aligned offset if tiled. |
||
392 | * i915 limits 3D destination to pitch of 16B - 8kB, in dwords, if un-tiled. |
||
393 | * i915 limits 3D destination to pitch 64B-aligned if used with depth. |
||
394 | * i915 limits 3D destination to pitch of 512B - 8kB, in tiles, if tiled. |
||
395 | * i915 limits 3D destination to POT aligned pitch if tiled. |
||
396 | * i915 limits 3D destination drawing rect to w,h of 2048,2048. |
||
397 | * |
||
398 | * i845 limits 3D textures to 4B-aligned offset if un-tiled. |
||
399 | * i845 limits 3D textures to ~4kB-aligned offset if tiled. |
||
400 | * i845 limits 3D textures to width,height of 2048,2048. |
||
401 | * i845 limits 3D textures to pitch of 4B - 8kB, in dwords. |
||
402 | * i845 limits 3D destination to 4B-aligned offset if un-tiled. |
||
403 | * i845 limits 3D destination to ~4kB-aligned offset if tiled. |
||
404 | * i845 limits 3D destination to pitch of 8B - 8kB, in dwords. |
||
405 | * i845 limits 3D destination drawing rect to w,h of 2048,2048. |
||
406 | * |
||
407 | * For the tiled issues, the only tiled buffer we draw to should be |
||
408 | * the front, which will have an appropriate pitch/offset already set up, |
||
409 | * so UXA doesn't need to worry. |
||
410 | */ |
||
411 | if (INTEL_INFO(intel)->gen >= 040) { |
||
412 | intel->accel_pixmap_offset_alignment = 4 * 2; |
||
413 | intel->accel_max_x = 8192; |
||
414 | intel->accel_max_y = 8192; |
||
415 | } else { |
||
416 | intel->accel_pixmap_offset_alignment = 4; |
||
417 | intel->accel_max_x = 2048; |
||
418 | intel->accel_max_y = 2048; |
||
419 | } |
||
420 | } |
||
421 | |||
422 | |||
423 | |||
424 | { |
||
425 | intel_screen_private *intel = intel_get_screen_private(); |
||
426 | |||
427 | |||
428 | |||
429 | |||
430 | intel->vertex_count = 0; |
||
431 | intel->vertex_offset = 0; |
||
432 | intel->vertex_used = 0; |
||
433 | intel->floats_per_vertex = 0; |
||
434 | intel->last_floats_per_vertex = 0; |
||
435 | intel->vertex_bo = NULL; |
||
436 | intel->surface_used = 0; |
||
437 | intel->surface_reloc = 0; |
||
438 | |||
439 | |||
440 | intel->uxa_driver->check_composite = i965_check_composite; |
||
441 | intel->uxa_driver->check_composite_texture = i965_check_composite_texture; |
||
442 | intel->uxa_driver->prepare_composite = i965_prepare_composite; |
||
443 | intel->uxa_driver->composite = i965_composite; |
||
444 | intel->uxa_driver->done_composite = i830_done_composite; |
||
445 | */ |
||
446 | intel->vertex_flush = i965_vertex_flush; |
||
447 | intel->batch_flush = i965_batch_flush; |
||
448 | intel->batch_commit_notify = i965_batch_commit_notify; |
||
449 | |||
450 | |||
451 | intel->context_switch = gen4_context_switch; |
||
452 | } else if (IS_GEN5(intel)) { |
||
453 | intel->context_switch = gen5_context_switch; |
||
454 | } else { |
||
455 | intel->context_switch = gen6_context_switch; |
||
456 | } |
||
457 | |||
458 | |||
459 | } |
||
460 | |||
461 | |||
462 | |||
463 | .gen = -1, |
||
464 | }; |
||
465 | |||
466 | |||
467 | .gen = 030, |
||
468 | }; |
||
469 | static const struct intel_device_info intel_i945_info = { |
||
470 | .gen = 031, |
||
471 | }; |
||
472 | |||
473 | |||
474 | .gen = 033, |
||
475 | }; |
||
476 | |||
477 | |||
478 | .gen = 040, |
||
479 | }; |
||
480 | |||
481 | |||
482 | .gen = 045, |
||
483 | }; |
||
484 | |||
485 | |||
486 | .gen = 050, |
||
487 | }; |
||
488 | |||
489 | |||
490 | .gen = 060, |
||
491 | }; |
||
492 | |||
493 | |||
494 | .gen = 070, |
||
495 | }; |
||
496 | |||
497 | |||
498 | .gen = 071, |
||
499 | }; |
||
500 | |||
501 | |||
502 | .gen = 075, |
||
503 | }; |
||
504 | |||
505 | |||
506 | { 0x8086, (d), PCI_MATCH_ANY, PCI_MATCH_ANY, 0x3 << 16, 0xff << 16, (intptr_t)(i) } |
||
507 | |||
508 | |||
509 | |||
510 | |||
511 | |||
512 | INTEL_I915GM_IDS(&intel_i915_info), |
||
513 | INTEL_I945G_IDS(&intel_i945_info), |
||
514 | INTEL_I945GM_IDS(&intel_i945_info), |
||
515 | |||
516 | |||
517 | INTEL_PINEVIEW_IDS(&intel_g33_info), |
||
518 | |||
519 | |||
520 | INTEL_I965GM_IDS(&intel_i965_info), |
||
521 | |||
522 | |||
523 | INTEL_GM45_IDS(&intel_g4x_info), |
||
524 | |||
525 | |||
526 | INTEL_IRONLAKE_M_IDS(&intel_ironlake_info), |
||
527 | |||
528 | |||
529 | INTEL_SNB_M_IDS(&intel_sandybridge_info), |
||
530 | |||
531 | |||
532 | INTEL_IVB_M_IDS(&intel_ivybridge_info), |
||
533 | |||
534 | |||
535 | INTEL_HSW_M_IDS(&intel_haswell_info), |
||
536 | |||
537 | |||
538 | INTEL_VLV_M_IDS(&intel_valleyview_info), |
||
539 | |||
540 | |||
541 | |||
542 | |||
543 | }; |
||
544 | |||
545 | |||
546 | { |
||
547 | while(list->device_id) |
||
548 | { |
||
549 | if(dev==list->device_id) |
||
550 | return list; |
||
551 | list++; |
||
552 | } |
||
553 | return NULL; |
||
554 | } |
||
555 | |||
556 | |||
557 | |||
558 | intel_detect_chipset(struct pci_device *pci) |
||
559 | { |
||
560 | const struct pci_id_match *ent = NULL; |
||
561 | |||
562 | |||
563 | |||
564 | |||
565 | return (const struct intel_device_info*)ent->match_data; |
||
566 | else |
||
567 | return &intel_generic_info; |
||
568 | }><>><>><> |
||
569 |