User:Greasemonkey/Intel GenX: Difference between revisions

blitting; me crying about the GTT not working
(Ring buffer tested on Gen6, appears to actually work)
(blitting; me crying about the GTT not working)
Line 162:
 
If you want to check to see if this is working, NOPID is a useful register. The Gen6 docs seem to be missing the location of this register, however it is in the same location as Gen4.5 (0x02094).
 
==Using the blitter==
Tested on:
* GM45 1366x768 CQ60-210TU
 
The HD3000 was tested at some stage but the ring buffer stopped, suggesting an invalid instruction, although there may have also been a GTT issue.
 
===General notes===
 
Firstly you'll want to know your "raster op" modes. They are conceptually the same as the Amiga's modes, although probably with different sources.
 
Here's a list of useful modes:
* 0xF0: Set to pattern (useful for COLOR_BLT)
* 0xCC: Set to source image (useful for SRC_COPY_BLT)
* 0xAA: Set to destination (useful for not much)
* 0x55: Set to opposite of destination (useful for XOR effect)
 
Top bit determines the result when all of {pattern, source, destination} are 1. Bottom bit determines the result when all are 0.
 
The rest is All There In The Manual.
 
'''WARNING:''' When the manual says "pitch in dwords", what they ''really'' mean is "pitch in bytes, aligned to a dword boundary".
 
There are two sets of blitter commands: The XY_ commands, and the other commands. The other commands are a bit simpler, but there are only two of them.
 
*COLOR_BLT fills a rectangular area with a solid colour. Useful for clearing the screen like a boss.
*SRC_COPY_BLT copies from one place in memory to another. If you have no GTT, this will be GPU-to-GPU only. Still faster, easier and more powerful than EGA/VGA.
 
Here's an example of a 32bpp COLOR_BLT used to clear a screen with a nice purple tinge:
<pre>
// COLOR_BLT
genx_rb_push(0
| (0x2<<29) | (0x40<<22)
| (0x3<<20) // a:rgb mask
| 0x03
);
genx_rb_push(0
| (3<<24) // bit depth
| (0xF0<<16) // raster op
| ((screen_pitch_pixels*4) & 0xFFFF) // pitch in bytes, dword-aligned
);
genx_rb_push(((screen_height)<<16)|((screen_width)<<2)); // height in scanlines, width in bytes
genx_rb_push(screen_agp_offset);
genx_rb_push(0x00330066); // XXRRGGBB - HTML colour #330066
</pre>
 
The XY_ commands allow you to specify ranges using X,Y coordinate pairs and apply clipping based on those pairs.
 
Here's the XY_COLOR_BLT version of the above:
<pre>
// XY_COLOR_BLT
genx_rb_push(0
| (0x2<<29) | (0x50<<22)
| (3<<20) // a:rgb mask
| (0<<11) // tiling enable (tile-X only)
| 0x04
);
genx_rb_push(0
| (0<<30) // clipping enable
| (3<<24) // bit depth
| (0xF0<<16) // raster op
| ((screen_pitch_pixels*4) & 0xFFFF) // pitch in bytes, dword-aligned
);
genx_rb_push((0<<16) | (0)); // Y1:X1 top-left
genx_rb_push(((screen_height)<<16)|((screen_width))); // Y2:X2 bottom-right
genx_rb_push(screen_agp_offset);
genx_rb_push(0x00330066); // XXRRGGBB - HTML colour #330066
</pre>
 
Note, if you want clipping, you'll want to run an XY_SETUP_CLIP_BLT command, and then enable the "clipping enable" flag.
 
===Memory-to-GPU blit===
 
''TODO: Get the GTT working first. Only then will this work.''
 
''Nevertheless, this is probably faster than a memcpy.''
 
==Making the GTT behave==
 
''TODO: Succeed. Right now I'm failing. Miserably.''
 
==See Also==
Anonymous user