Direct access to slave processing by unprotected application using context saving and restoration5794037Abstract A computer system provides multiple unprotected applications direct access to a slave processor. The host processor issues context switching requests to save and restore partially completed unprotected requests in the slave processor. Claims I claim: Description RELATED APPLICATIONS
______________________________________
Request Peak Performance
______________________________________
Vectors 1.4M/s (10 pixel)-aliased
550K/s (10 pixel)-
antialiased
BitBlits (masked) 18 MPix/s/64-planes-
BitBlits (non-masked)
26 MPix/s/64-planes
Slow Recfills 30 MPix/s
(with masking, ALU)
Fast Recfills 400 MPix/s
Triangles 450K+/s (50 pixel avg.)
Expand Bitmap 32 MPix/s
Putblock8 32 MPix/s
Putblock32 25 MPix/s (bus limited)
Putblock32/Z 12 MPix/s (bus limited)
Getblock8 32 MPix/s
Getblock32 25 MPix/s (bus limited)
Getblock32/Z 12 MPix/s (bus limited)
Load VLTs 2 Contexts/vertical blank
Save/Restore Context
32 words of data
______________________________________
Static Frame Buffer The maximum configuration for the static frame buffer contains a total of 132 planes:
______________________________________
Description planes buffering
______________________________________
Highlight 1 double
Overlay 8 double
Overlay VLT Context
1 double
Image 24 double
Image VLT Context 3 double
Alpha 8 single
WID 12 single
Z buffer 32 single
Mask 6 single
______________________________________
The static frame buffer "stacks" the overlay and highlight visuals on top of the image visual. A selectable value for the highlight and overlay planes is specified as "transparent" allowing the visual(s) below to display. A non-transparent value in the overlay planes will override the image visual. A non-transparent value in the highlight plane will override both the image visual and the overlay visual. Display of both highlight and overlay may be independently disabled via the WID lookup tables. Overlay transparency may also be turned off via the WID LUT. A total of 8 VLT contexts are supported. Only the first two are accessible by the overlay planes, while all 8 are accessible by the image planes. All contexts may be configured as either pseudo color or true color contexts, and this determines whether the image planes are being used in true color or pseudo color mode. Hardware contrast adjustment is supported. A hardware cursor is provided. It will support cursor sizes up to 64.times.64 and 2 planes in depth. One of the two planes is configured as an enable plane. The frame buffer supports interlaced stereoscopic displays. Roam Frame Buffer The optional roam frame buffer contains a total of 40 planes, with the following breakdown:
______________________________________
Description Planes Buffering
______________________________________
Image 24 single
Overlay 8 single
Highlight 1 double
Image Vlt Context 3 single
Overlay Vlt Context
1 single
Mask planes 2 single
______________________________________
III. Hardware Request Formats All requests begin with a 32 bit request word. The upper halfword contains the request code, and the lower halfword contains graphics control information. The graphic control information for all graphic requests is the same and as follows:
______________________________________
bits 14:0 these bits map to bits 14:0 of the
GE.sub.-- GCR (graphics engine graphics control
register). Under the subhead *Vector
Requests* in the section below entitled
DRAW REQUESTS, is a description of the
various graphics engine registers; there
the function of these bits in the
context of the GE.sub.-- GCR is explained..
bit 15 GE.sub.-- GCR write enable
GE.sub.-- GCR.sub.-- WE .sub.-- H
If set then bits 14:0 above will be written
to the GE.sub.-- GCR before the request is executed.
The GE.sub.-- GCR will be permanently modified. If
this bit is not set the bits currently in the
GE.sub.-- GCR will be used. The write is subject to
masking by the GE.sub.-- GCR.sub.-- WEMASK register.
______________________________________
The format of control information for non-graphic requests is defined with the requests themselves. The upper halfword containing the request code is further divided into 3 subfields as follows:
______________________________________
bit 31 0 reserved
bit 30 0 reserved
bit 29 1 for requests which return data
bit 28 1 for protected requests
bits ›27:24! major request ID
bits ›23:16! vertex format for draw requests
request modifier/subrequest code
for other requests
______________________________________
Requests may be fixed length (eg most of the control requests), fixed length dependent on parameters in the request (eg raster placement requests) or variable length (open ended) (eg the vector request). Open-ended requests end with a 1 or 2 word terminator. Terminators vary depending on the particular request. Requests are further divided into protected and nonprotected requests. Protected requests will not be executed unless they were written to the protected FIFO. Nonprotected requests will execute from either FIFO. Note there is only one physical FIFO, mapped into several addresses. The sync FIFO is considered a protected FIFO, and hence can execute protected requests. It is intended that for application "direct access" to the graphics processor of this implementation, the applications will be able to write to the nonprotected FIFO, but not the protected or sync FIFOs. Context switching will be supported at any point in any non-protected request written to the non-protected FIFO. Protected requests or requests written to a protected FIFO are not interruptible. No support for clipping or clip checking is provided in the graphics engine, apart from the masking planes. X,Y coordinates and window origins are signed, but all generated pixels must end up as valid screen coordinates. IV. Draw Requests There are two main draw requests: E3Vec (vector) and E3Tri (triangle). These requests are open ended and consist of a request header word and then an open ended sequence of vertices. The vertex format is the same for the vector request and the triangle request. The format of the vertex expected by the graphics engine is encoded in the 8 bit "vertex control" field (VCTRL) of the request header word. The VCTRL field specifies both the format of data in the vertex, and the existence of optional data. There is also a special purpose clipped vector request, E3ClipVec. This request draws one stroke, and has only one data format--there is no vertex control field. The Graphics Engine processes draw requests the same way regardless of the destination visual selected in the GE.sub.-- BUFSEL register. A 32 bit RGBA value is generated--this will come from the iterator if shading is being done, or else from the GE.sub.-- FGCOLOR/BGCOLOR registers. If dithering is enabled, this value will be dithered as described in the application notes, and the 8 bit dither index placed in the low 8 bits of the RGBA value (the "R" field). The G, B and A fields are left as is. This value is written to IZ›31:00!--the low half of the resolver bus. The upper 32 bits of the IZ bus have a Z value placed on it. This comes from the iterator or the GE.sub.-- Z register, depending on whether Z is included with the vertex. In the resolver IZ›63:32! is used to perform Z buffering ALWAYS if it is enabled, regardless of the destination visual selected. The destination visual selects the planes to which IZ›31:00! are written. If the destination visual is less than 32 bits, only the lower portion of the IZ bus will be written to it. Alpha operations always use IZ›31:24! as the source alpha, the destination alpha is either the contents of the alpha planes or 0.times.FF depending on the visual selected. Vertex Format The minimum information in a vertex is simply an (X,Y) pair. Optional data is Z, (U,V,S), color (RGB), and alpha. Thus the maximum is (X,Y,Z,U,V,S,R,G,B,A). This is also the required order for the vertex data. The number of 32 bit words of data required to represent a vertex can be from 1 word (packed X,Y, no optional data) to 20 words (double precision for all data, all optional data included). The format of VCTRL is as follows: ##STR2## XFMT data format for X,Y,Z,U,V,S Specifies the data format of coordinate data. It is encoded as follows:
______________________________________
00 packed 16 bit for X, Y and U, V (X, U low). Z, S
unsigned 32 bit.
01 32 bit, signed integer for X, Y, U, V. Z, S are
unsigned.
10 IEEE single precision floating point
11 IEEE double precision floating point.
______________________________________
ZF Z flag Specifies that Z is included with the vertex. Z always follows X,Y if it exists. Z is a minimum of 32 bits, so is in unsigned 32 bit format even if XFMT is 00. If it is zero then the Z value of pixels generated is considered to be the value in GE.sub.-- Z for Z buffer operations. If Z is provided with the vertex, Z values will be interpolated along line segments and triangle facets. TF Texture flag Specifies that the request is to be textured. If TF is set, texture coordinates (U, V, S) are included with the vertex and are in the format as specified by XFMT. Note that if XFMT is 0 (packed format) U and V are packed, and S is a 32 bit quantity in the next word. U, V and S coordinates are interpolated along line segments and on triangle facets. CFMT Color format The CFMT field specifies whether color is included with the-vertex, and if so the format of the color data. CFXT is encoded as follows: ##STR3## Color follows the S coordinate if it exists, else it follows the Z coordinate if it exists, else it follows the (X,Y) coordinate. If color is not supplied with the vertex, segments or facets are drawn in the foreground color. If they are supplied then they are interpolated along line segments, or Gouraud shading is performed for triangle facets. If SHADE.sub.-- FLAT.sub.-- H is set in the GE-GCR then shading is inhibited and each stroke or facet is drawn flat shaded in the color of the last vertex received. AF Alpha flag This flag indicate s whether alpha is included with the color coordinate. AF is ignored if CFMT is 00. If AF is set, alpha is taken from the high 8 bits of the color word if color is in packed format. For CFMT=10 or 11 alpha is a single or double precision value which follows blue in the vertex. If AF is clear, the alpha value is taken from the foreground color register. In this case the high 8 bits of the packed color are ignored, and alpha will not be in the vertex data for floating point formats. Note that the AF bit does not have any effect on alpha operations--alpha blending, if enabled, will still occur on pixel writes using the alpha value from the foreground register. Vertex Handling Vertex data is transformed to internal format as it is read from the FIFO. The transform can be handled differently depending on some of the bits in the graphics control register (GE.sub.-- GCR). X and Y coordinates are signed and window relative. If they are in an integer format they are used as is. If they are in a floating point format, and FIX.sub.-- VER.sub.-- H is set, they will be truncated before use. If COORD.sub.-- OFFSET.sub.-- H is set in the GCR then either 2028 or 4096 will be subtracted from both X and Y before use, depending on OFFSET.sub.-- 4R.sub.-- H. This is done after derivatives are calculated, so that the derivatives are independent of screen position. Z is unsigned, and will be clamped to 0 if in floating point format and negative. If Z is not specified, Z from the GE.sub.-- Z register will be used for any Z operations requested. If Z is specified, it is interpolated for both vector and triangle requests. U, V and S coordinates are described in the appendix on texture processing. Color values are used as is if in packed format. For floating point color values, the color components are in the range ›0,1!. Internally the graphics engine scales the value to the range ›0,255!. If alpha exists it is treated the same as one of the color components. If dithering is enabled, the color range is different, and color scaling is handled differently. See the application notes on dithering for a discussion on this. Dithering can be applied to both vector and triangle requests. Vertex Terminators The vector and triangle requests are open ended, and are terminated by a terminator value as the first data value of a vertex. This value depends on the XF field as follows:
______________________________________
XF DATA TYPE Terminator
______________________________________
00 integer (X, Y)
0 .times. 80000000
01 integer X coord
0 .times. 80000000
10 float X coord
NaN with exp = 255, bits
›22:19! = 1
11 double X coord
NaN with exp = 2047, bit 51 = 1
______________________________________
Terminators are a single 32 bit value, except in the case of double precision values in which case it is two 32 bit words, where the first is arbitrary (least significant part of the double) and the second word is as above. Floating point terminators are not completely decoded--the sign bit and part of the mantissa are not used and thus may be arbitrary. The following bit patterns represent the floating point terminators. "x"s represent bits that are arbitrary: single precision: x111 1111 1111 1xxx xxxx xxxx xxxx xxxx Double precision: x111 1111 1111 1xxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxxxxxxxx For example, the following hex values would be considered terminators for floating point formats: float: 0.times.7FF80000 double: 0.times.7FF80000 00000000 Vector Request The vector request uses a stroking algorithm to draw a single pixel width line. These lines can be used for weight 0.times.windows lines since X does not require any particular pixelization. They cannot be used for width 1.times.windows lines, because they do not produce the characteristic "knobbly" thickening and thinning which weight 1.times.windows lines produce. Two different algorithms are used to stroke vectors: the Bresenham algorithm, and a DDA algorithm which lights the closest pixel to a line, including lines with floating point coordinates--ie subpixel accuracy. In the case of a tie between two pixels in the DDA algorithm, the pixel below or to the right will be drawn. Additional setup time in the graphics engine is required for DDA stroking, and this will impact short vector performance. 10 pixel solid DDA vectors will run at about 50% of the Bresenham rate, 10 pixel shaded color/Z at about 70% the Bresenham rate. For vectors over about 20 pixels the extra setup time will be hidden, so there would be no degradation in performance The algorithm used depends on the state of the GCR. If antialiasing is enabled (VEC.sub.-- AA.sub.-- H set), the DDA algorithm is always used. Otherwise if FIX.sub.-- VER.sub.-- H is set, the Bresenham algorithm is used, and if FIX.sub.-- VER.sub.-- H is clear, the DDA algorithm is used. This is independent of the format of the X,Y coordinate. Normally a vector request produces a linestring, but if VEC.sub.-- SEGMENT.sub.-- H is set in the graphics control register there is an implied disconnect between each pair of vertices, producing a sequence of disconnected segments. The graphics engine maintains the concept of a "first segment" attribute while stroking vector requests. Normally the first segment of a request has the "first segment" attribute, while subsequent segments do not. If VEC.sub.-- SEGMENT.sub.-- H is set, then all segments have the "first segment" attribute. If VEC .sub.-- CONTIN.sub.-- SYMB.sub.-- H is set, then NO segments have the "first segment" attribute (even if VEC.sub.-- SEGMENT.sub.-- H is set). "First segments" differ from subsequent segments in the following areas: symbology is reset before the segment is drawn VEC.sub.-- DRAW.sub.-- FIRST.sub.-- H is ignored, and the first pixel is drawn always for anti-aliased lines the AA.sub.-- V.sub.-- FBFUNC is NOT used for the first pixel There are two bits in the GCR which define behavior of the vector stroker at the first and last pixels of lines/linestrings. These are VEC.sub.-- DRAW.sub.-- FIRST.sub.-- H and VEC.sub.-- DROP.sub.-- LAST.sub.-- H. If VEC.sub.-- DRAW.sub.-- FIRST.sub.-- H is not set, the first pixel of linestring segments AFTER the first are not drawn. If VEC.sub.-- DROP.sub.-- LAST.sub.-- H is set, the last pixel of all line segments, including first and single segments, are not drawn. If neither of these bits are set, the graphics engine is in "X windows" mode. If the request produces a linestring the first pixel of segments after the first are not drawn, so that internal vertex pixels are not drawn twice. All pixels of the first segment are drawn. All pixels of segments are drawn if VEC.sub.-- SEGMENT.sub.-- H is set. If both bits are set, the graphics engine is in "Windows" mode, and the last pixel of all segments is dropped. The pixel is dropped even if VEC.sub.-- SEGMENT.sub.-- H is set. These mode bits also affect DDA stroked lines. In this case they operate slightly differently. Pixels are only dropped if the start/endpoint of the segment falls exactly on a pixel center in the major axis. If a segment "crosses" a pixel center, that pixel will always be drawn, even if it is the first or last pixel, and regardless of the state of the two bits. The two bits should be set such that first and last pixels are always drawn for antialiased lines. E3Vec vector requests can be antialiased with a performance penalty. Symbology will be applied to vector requests if VEC.sub.-- SYMB.sub.-- H is set in GE.sub.-- GCR. As each pixel for a stroke is generated, the LSB of the symbology mask is checked. If it is a 1 then the pixel is drawn normally. If the symbology bit is 0, then there are two possibilities. If BG.sub.-- WE.sub.-- H is set in GE.sub.-- GCR then this pixel is drawn in the color in GE.sub.-- BGCOLOR. If BG.sub.-- WE.sub.-- H is clear in the GE.sub.-- GCR then the pixel is not drawn. After each pixel is drawn (or not) a specified number of times, the symbology mask is rotated right 1 pixel. Only the number of bits defined in the symbology count register are included in the rotate. The repeat count register specifies the number of pixels drawn before the symbology mask is rotated. The symbology repeat count is not incremented on pixels not drawn due to the VEC.sub.-- DRAW.sub.-- FIRST.sub.-- H/VEC.sub.-- DROP.sub.-- LAST.sub.-- H bits in the GCR. Symbology is reset to the original loaded values at the start of every request, and also at the start of every segment if VEC.sub.-- SEGMENT.sub.-- H is set in the GE.sub.-- GCR. Symbology reset across requests and segments can be suppressed by setting VEC.sub.-- CONTIN.sub.-- SYMB.sub.-- H in the GCR. Registers which affect the vector request:
______________________________________
GE.sub.-- GCR
VEC.sub.-- AA.sub.-- H
enables antialiasing
VEC.sub.-- SEGMENT.sub.-- H
vector is segments no linestrings
VEC.sub.-- SYMB.sub.-- H
symbolize vector
VEC.sub.-- DRAW.sub.-- FIRST.sub.-- H
draw first pixel of segments
VEC.sub.-- DROP.sub.-- LAST.sub.-- H
don't draw last pixel of segments
FIX.sub.-- VER.sub.-- H
fix X, Y endpoints
SHADE.sub.-- FLAT.sub.-- H
each segment is constant color
DITHER.sub.-- EN.sub.-- H
enables dithering
ATST.sub.-- EN.sub.-- H
enable alpha test
Z.sub.-- EN.sub.-- H
enables Z buffering
BG.sub.-- WE.sub.-- H
enable write of "off " symbolized
pixels
UMASK.sub.-- PO.sub.-- H
selects the polarity for plane O
masking
UMASR.sub.-- PLN.sub.-- EN.sub.-- H
write enable for user mask plane
(visual 8)
VEC.sub.-- CONTIN.sub.-- SYMB.sub.-- H
continue vector symbology
STEREO.sub.-- EN.sub.-- H
stereo addressing mode
STEREO.sub.-- F1.sub.-- H
stereo field 1 selected
STEREO.sub.-- DITHER.sub.-- H
stereo dithering mode
COORD.sub.-- OFFSET.sub.-- H
coordinates are offset
OFFSET.sub.-- 4K.sub.-- H
offset is 4K
WRITE.sub.-- MASK.sub.-- EN.sub.-- H
enables masking
MASK.sub.-- EN.sub.-- H›5:0!
selects which mask planes are used
for masking
GE.sub.-- GCR.sub.-- WEMASK
Selects which bits in the GCR may be modified by the
control part of the request word
GE.sub.-- FGCOLOR
this defined the data written for requests which do not
include a color as part of the vertex data, and alpha
for requests in which alpha is not included in the
vertex data.
GE.sub.-- BGCOLOR
defines the color of "off" pixels of symbolized lines
if BG.sub.-- WE.sub.-- H is set in the GE.sub.-- GCR.
GE.sub.-- Z
this defines the Z value which will be used for Z
buffering if it is enabled, and Z is not included with
the vertices.
GE.sub.-- MISC.sub.-- DATA
this defines "implied" data which will be written to
control planes if the appropriate plane enables are
set, and the visual is one of 0-5. See section on
visuals for description of implied data for each
visual.
GE.sub.-- SYMBOLOGY
GE.sub.-- SYMB.sub.-- CTRL
GE.sub.-- AA.sub.-- CTRL
controls antialiasing parameters
GE.sub.-- WORG or: GE.sub.-- ROAM.sub.-- WORG
GE.sub.-- SWIDTH or GE.sub.-- ROAM.sub.-- SWIDTH
GE.sub.-- DITH.sub.-- CTRL
GE.sub.-- TEX.sub.-- ORG
GE.sub.-- TEX.sub.-- BCOLOR
GE.sub.-- TEX.sub.-- CTRL
GE .sub.-- ATST.sub.-- CTRL
Value and function used for alpha test if enabled
GE.sub.-- ZFUNC
selects the Z buffer function performed if Z buffering
is enabled
GE.sub.-- FBFUNC
selects the frame buffer merge function to be performed
GE.sub.-- BUFSEL
selects which visual is written to, plus selects which
buffer of the visual, or roam buffer.
GE.sub.-- IMAGE.sub.-- PLN.sub.-- EN
plane enables for the true color visual
GE.sub.-- OL.sub.-- PLN.sub.-- EN
plane enables for overlay visuals
GE.sub.-- HL.sub.-- PLN.sub.-- EN
plane enable for highlight visuals
GE.sub.-- MISC.sub.-- PLN.sub.-- EN plane enables for the Z buffer (if
enabled)
plus WID, mask, and VLT context depending on the visual
selected.
______________________________________
Valid visuals for vector requests are 0-5 and 8. Drawing to visual 14 will give a graphics engine error. Drawing to other visuals will not generate an error; however the results in the frame buffer are not defined. Masking is guaranteed to work on all visuals, however. Clipped vector request: E3ClipVec A special purpose request is provided for X windows clipped and wide vectors. This request draws a single Bresenham stroke with provision to initialize the Bresenham error parameters and starting symbology position. The request takes a starting pixel in packed form only, and no support is provided for shading color, Z or texture. The vector is always drawn in the foreground color, at the depth specified in GE.sub.-- Z (if Z buffering is enabled), and cannot be textured. Wide lines: X windows wide lines can be drawn using this request by multistroking with different initial Bresenham setup parameters. There is an explicit "DRAW FIRST" bit in the symbology control field. The wide line code must explicitly set this for the first stroke, and clear for subsequent strokes of the wide line. Clipped vectors: 1) Vector starts in window and goes out: If the vector was not part of a previous line string, reset the symbology by clearing LOAD.sub.-- CUR.sub.-- SYMB.sub.-- H in the request and VEC.sub.-- CONTIN.sub.-- SYMB.sub.-- H in the GCR. If the vector is part of a linestring, clear LOAD.sub.-- CUR.sub.-- SYMB.sub.-- H and DRAW.sub.-- FIRST in the request, set VEC.sub.-- CONTIN.sub.-- SYMB.sub.-- H in the GCR so that symbology continues across the vertex, and the first pixel is dropped. 2) Vector starts and finishes out of the window: In this case, the symbology mask must be set to the correct position for the first drawn pixel. The correct symbology bit and repeat count must be calculated for the first pixel, and loaded by the request. 3) Vector starts outside, and finishes inside: For standalone vectors, this case can be handled the same as the previous case. If the vector is part of a linestring, and is to be continued by a linestring request, then it should be set up as above, but 1 subtracted from the pixel count. After the clipped stroke is drawn the linestring is started with VEC.sub.-- CONTIN.sub.-- SYMB.sub.-- H set in the GCR so symbology continues from where the clipped stroke finished. The interior vertex will only be drawn once, but as the first pixel of the linestring, rather than the last pixel of the clipped line segment. Notes on symbology: VEC.sub.-- SYMB.sub.-- H is supported in the GCR--symbology can be enabled or disabled. If symbology is enabled, then symbology can be set to any required initial value by setting the symbology bit select and repeat count, and setting LOAD.sub.-- CUR.sub.-- SYMB.sub.-- H. Note that setting the bit select and repeat count to zero is the same as resetting the symbology. If LOAD.sub.-- CUR.sub.-- SYMB.sub.-- H is clear, then the standard GCR bits apply. If VEC.sub.-- CONTIN.sub.-- SYMB.sub.-- H is set, the symbology will continue from its current position, if it is clear the symbology will restart. The registers which affect the clipped vector request are the same as those which affect the E3Vec request, except for the following: Support for GCR bits:
__________________________________________________________________________
VEC.sub.-- AA.sub.-- H
must be disabled, or results are undefined
VEC.sub.-- SEGMENT.sub.-- H
ignored
VEC.sub.-- DRAW.sub.-- FIRST.sub.-- H
ignored
VEC.sub.-- DROP.sub.-- LAST.sub.-- H
ignored
FIX.sub.-- VER.sub.-- H
ignored
SHADE.sub.-- FLAT.sub.-- H
ignored
VEC.sub.-- CONTIN.sub.-- SYMB.sub.-- H
ignored if LOAD.sub.-- CUR.sub.-- SYMB.sub.-- H set in
request,
COORD.sub.-- OFFSET.sub.-- H
ignored - offset is not supported
OFFSET.sub.-- 4R.sub.-- H
ignored
all other bits are supported normally
GE.sub.-- AA.sub.-- CTRL:
antialiasing is not supported
GE-TEX registers:
texturing is not supported
##STR4##
##STR5##
__________________________________________________________________________
This request draws a single stroked linestring (polyline). If VEC.sub.-- SEGMENT.sub.-- H is set pairs of coordinates are drawn as disconnected segments. The data consists of a sequence of vertices followed by a terminator which is dependent on the coordinate data type. Each coordinate is an (X,Y) pair optionally followed by a Z coordinate, a texture coordinate, a color value and an alpha value. If Z is provided Z will be interpolated along each stroke. If Z is not provided the static Z value from GE.sub.-- Z will be used. If U, v and S are provided, they will be interpolated, and used as texture coordinates by the texture processor. If color is provided per vertex, shading will be performed, unless SHADE.sub.-- FLAT.sub.-- H is set in the GE.sub.-- GCR in which case each stroke is drawn in the color associated with the second vertex of the stroke. If alpha is provided it is shaded like one of the color components. If it is not, a constant alpha value from the foreground color register is used. Symbology will applied if enabled. If VEC.sub.-- AA.sub.-- H is set the line will be antialiased. If FIX.sub.-- VER.sub.-- H is set, floating point X,Y coordinates are truncated before use. If COORD.sub.-- OFFSET.sub.-- H is set, a 2K or 4K offset will be subtracted from the X and Y coordinates. The source of IZ›31:00! is GE.sub.-- FGCOLOR, GE.sub.-- BGCOLOR or the color iterator The source of IZ›63:32! is GE.sub.-- Z or the Z iterator ##STR6## This is a special purpose request to draw clipped line segments, and aid in drawing X wide lines. It draws a single Bresenham stroke with the specified starting Bresenham parameters and symbology start point. The stroke is drawn in the current foreground color. If Z buffering is enabled the static Z value in GE.sub.-- Z is used. Request data is as follows:
______________________________________
MAJOR major axis position of first pixel to be
drawn, window relative
MINOR major axis position of first pixel to be
drawn, window relative
COUNT Bresenham iteration count (maximum = 4k
1)
BRES.sub.-- ERR.sub.-- INIT
initial: Bresenham error-this should be
loaded with the error term corresponding
to the position of the first pixel-ie
at the MAJOR, MINOR position specified in
the request.
BRES.sub.-- DELTA.sub.-- MAJOR
Bresenham error increment for a move in
the major axis
BRES.sub.-- DELTA.sub.-- BOTH
Bresenham error increment for a move in
the both axes
______________________________________
SYMB.sub.-- CTRL controls symbolization of the line, including current symbology position, whether the first pixel is drawn or not and octant.
______________________________________
bits 4:0
CUR.sub.-- SYMB 5 bit value to
select the first bit
in the symbology
mask to be used. 0 =
use bit 0, 1 = use
bit 1, etc. Setting
this bit to a value
greater than
SYMB.sub.-- COUNT in
GE.sub.-- SYMB.sub.-- CTRL will
give undefined
results.
bits 7:
reserved, MBZ
bits 15:8
CUR.sub.-- SYMB.sub.-- REPEAT
current value of the
repeat counter. This
counter counts up to the
value in SYMB.sub.-- REPEAT in
GE.sub.-- SYMB.sub.-- CTRL. Setting
this to a value greater
than or equal to
SYMB.sub.-- REPEAT in
GE.sub.-- SYMB.sub.-- CTRL will give
undefined results
bit 16 LOAD.sub.-- CUR.sub.-- SYMB.sub.-- H
set to load the iterator
current symbology bit
select and repeat count
with the data in the
above fields. If clear
then the symbology will
either continue from the
current value, or be
reset depending on
VEC.sub.-- CONTIN.sub.-- SYMB.sub.-- H in
GE.sub.-- GCR.
bit 17 DRAW.sub.-- FIRST.sub.-- H
if set, draw the first
pixel, if clear the first
pixel will not be drawn
(and symbology won't be
advanced)
bit 18 MINOR.sub.-- NEG.sub.-- H
set if the delta in the
minor axis is negative
bit 19 MAJOR.sub.-- NEG.sub.-- H
set if the delta in the
major axis is negative
bit 20 MAJOR.sub.-- Y.sub.-- H
set if Y is the major
axis, clear if X is the
major axis
bit 31:21
reserved, MBZ
______________________________________
COORD.sub.-- OFFSET.sub.-- H is ignored for this request. Note that VEC.sub.-- DRAW.sub.-- FIRST.sub.-- H and VEC.sub.-- DROP.sub.-- LAST.sub.-- H in the GCR are ignored, thus there is no support for DROP LAST. The same effect can be obtained by decrementing the COUNT field. Also DRAW FIRST H defined here applies independently of VEC.sub.-- CONTIN.sub.-- SYMB.sub.-- H in the GCR, as opposed to the behavior of VEC.sub.-- DRAW.sub.-- FIRST.sub.-- H in the GCR. The source of IZ›31:00! is GE.sub.-- FGCOLOR or GE.sub.-- BGCOLOR The source of IZ›63:32! is GE.sub.-- Z 3.1.5 Triangle Request The triangle request is open ended and accepts a stream of vertices. After the first two vertices a triangle is drawn between each new vertex and the previous two vertices. Pixelization uses the "top left"rule. All pixels whose center falls within the triangle boundary are drawn. Pixels whose center fall exactly on the triangle boundary are drawn if they are on a left hand edge, or a horizontal top edge. They are not drawn if they fall on a right hand edge or a horizontal bottom edge. Note on using triangles for X wide lines: The problem with drawing wide lines (with butt ends) as two triangles is pixelization of boundary points. All points completely inside a rectangle must be drawn. This is OR. However boundary pixels appear to be a problem. X specifies that boundary pixels are drawn if the body of the line is below or to the right of the pixel. Triangles have the rules specified above, and hence boundary pixelization is not necessarily the same for the two. For lines which are horizontal or vertical, two triangles give the correct pixelization. For lines with positive slope (ie top left.fwdarw.bottom right, since origin is top left), pixelization is also correct. Lines with negative slope have potentially incorrect pixelization on the top and bottom--the bottom edge will include the "on" pixels, while the top edge will exclude them. This is because the "top" edge of the line is a "right" edge of one of the triangles. The left and right edges of the line will be correct. Possibilities: use two triangles if slope >=0, else use software use two triangles to draw the "body" of the line (a parallelogram) and use software to draw the two small triangles on the top and bottom. a combination of the above two use two triangles and shift the rectangle a tiny amount in an upwards direction in the direction of the line segment The registers which affect triangle requests are the same as for vector requests, except for the following: GE.sub.-- GCR VEC *** bits are ignored BG.sub.-- WE.sub.-- H is unused GE.sub.-- AA.sub.-- CTRL antialiasing not provided for triangles the symbology registers are ignored V.Context Switching In accordance with an embodiment of the present invention, applications are given direct access to the slave processor, which in this case is graphics processor. This is made possible by providing for context switching in the middle of application requests. Context switching is implemented in the current embodiment with the assistance of the logical FIFO buffers. A host processor 400 includes system software operating on a CPU. The host processor 400 can run a plurality of applications simultaneously. This is done by periodically switching from processing one application to the other. To prevent a problem when this switch occurs in the middle of a request to the graphics processor, the host issues a protected SaveContext request. Rather than interpreting the SaveContext request as data related to a pending request from an application, the graphics engine 22 immediately recognizes the SaveContext request as a protected request and not an unprotected data word from the currently running application. The SaveContext request is addressed to the protected logical FIFO, whereas an application addresses all data words, including requests, to the nonprotected logical FIFO. The graphics engine stores the current context and restores the context state previously saved for the next application process. Context saving and switching are transparent to the applications. The applications operate as if they have direct access to the graphics processor. In accordance with the currently described embodiment, all unprotected requests are interruptible. The graphics engine 22 detects a break in a request by the fact that the request stream switches from the nonprotected FIFO to the protected FIFO. Any time the graphics engine is executing out of the nonprotected FIFO, the stream may switch to the protected FIFO. The word in the protected FIFO should be a SaveContext request. If it is not, the host is not operating properly. When the SaveContext request is properly recognized, the internal dynamic state of the graphics engine 22 is written to the output FIFO 21b. A save frame is created with all of the necessary state and context data. The graphics engine writes a save frame which may be used to restore the current processing state by being executed through the input FIFO 21a as part of a context restore operation. The first word in the save frame is a count word indicating the number of words in the save frame. The state of the graphics engine registers and tables are not automatically saved as part of the save frame. If these are needed, an explicit request to save them must be made. To restore a context, the system restores registers (and tables if required) that were explicitly saved. The contents of the save frame are then written to the nonprotected input FIFO buffer 21. Upon executing the restored data words, the graphics engine is exactly as it was just before the unprotected request stream was interrupted. Normally the next word in the FIFO would be the next unprotected word of the interrupted request. If the next word is protected, the graphics engine behaves as above described and a new SaveContext will resave the current context. A typical context switch will look something like this (P=protected, U=nonprotected, S=SYNC):
______________________________________
fifo request
______________________________________
context switch to user 1
P E3SaveContext save previous users GE context
P E3ReadRegister save registers
P E3ReadProtRegister
save protected registers
S E3SetUserID 1
P E3LoadProtRegister
load user 1 protected
registers
U E3LoadRegister load user 1 registers
U save frame load user 1 GE save frame
U .
U .
U . .rarw. (see ERROR HANDLING
below)
U E3Tri #1
U E3Tri #2 (partial)
context switch to user 2
P E3SaveContext save user 1 context
P E3ReadRegister save registers
P E3ReadProtRegister
save protected registers
S E3SetUserID 2
P E3LoadProtRegister
load user 2 protected
U E3LoadRegister load user 2 registers
U save frame load user 2 GE save frame
U user 2 requests
U .
U .
context switch back to user 1
P E3SaveContext save user 2 context
P E3ReadRegister save registers
P E3ReadProtRegister
save protected registers
S E3SetUserID 1
P E3LoadProtRegister
load user 1 protected
registers
P UE3LoadRegister load user 1 registers
U save frame
U E3Tri #2 (the rest)
U E3Tri #3
______________________________________
The format of a save frame depends upon the particular processor implementation. It is useful to make the first word of the save frame a count of the data words in the save frame. If the context switch occurs between requests, the count will be zero, indicating there is no request context to restore. The data words that need to be saved depend upon the particular request being interrupted. A scheme for saving only those words that are necessary for restoring the graphics engine context can be determined on an implementation specific basis. For pending simple requests that have been interrupted, the save frame may include an exact copy of the request up to the point at which the context save request was executed. Certain long requests that span many words, may be saved by saving the original request word and any uncompleted pending portions of the request. VI. Error Handling When the graphics engine detects an error, it performs the following sequence: sets the GE.sub.-- ERROR bit in the CSR writes an error status into the GSR register request stream status: RS.sub.-- ERROR is set RS.sub.-- QUAL contains the error code RS.sub.-- ID contains a copy of GE.sub.-- UID halts If the error interrupt enable bit is set in the CSR, an interrupt will occur. The following requests are detected:
______________________________________
RS.sub.-- QUAL
Error
______________________________________
1 ILLREQ request could not be decoded
to a valid graphics engine
request.
2 PRIV attempt to execute a protected
request in the unprotected
fifo
3 BADVIS visual is illegal for graphic
request:
any request to visuals 7 and
15
any request to visual 6,
unless accessing texture
processor memory
any request other than
E3BitBlit to visual 14
any E3BitBlit involving the
texture processor, if visual
14 selected
______________________________________
To restart the graphics engine, the CPU must deassert and then assert GE.sub.-- RUN.sub.-- H in the CSR. At this point the graphics engine loads the GSR with GS.sub.-- CONTINUE. If ERROR.sub.-- FLUSH.sub.-- H is set in the CSR when GE.sub.-- RUN.sub.-- H is asserted, the graphics engine will assert SYNC.sub.-- ACTIVE.sub.-- H and flush the fifo until it comes to a request which was written to the sync fifo. At this point it will deassert SYNC.sub.-- ACTIVE.sub.-- H and start executing requests, starting with the request which was written to the sync fifo. If FLUSH.sub.-- FIFO.sub.-- H is not set, the graphics engine will assume the next word in the input fifo is the start of a new request. If enabled, an interrupt will be generated on the falling edge of SYNC.sub.-- ACTIVE.sub.-- H. Note: ERROR.sub.-- FLUSH.sub.-- H only causes a flush to occur on restart after an error. This signal is ignored when GE.sub.-- RUN.sub.-- H is asserted after a reset, or if the graphics engine was stopped by deassertion of GE.sub.-- RUN.sub.-- H. Whenever the kernel (or server) changes context it should save the existing context, and then send an E3SetUserID request to the sync fifo with a 16 bit ID. This request performs two functions. Since it is written to the sync fifo, it can be used to resynchronize the request stream after an error occurs. Also, if an error occurs, the ID of the context being executed is displayed in the GSR, so that the kernel can identify the process which caused the error. In the above request stream example for context switching if an error occurred at the indicated position, the graphics engine would generate an error and halt with user ID 1 in the GSR register. The kernel would kill the process, and flush the graphics engine, which would discard the request stream up to the E3SetUserID for user 2.
|
Same subclass Same class Consider this |
||||||||||
