This chapter discusses the operation of XGL 3.0.2 on SX. It describes the SX and the implementation of the XGL/SX driver so that you can understand how to use their features most effectively.
The SX is a programmable device that accelerates operations on pixels; for XGL, this includes:
and anything else that involves reading and writing pixel data (color and Z buffer included.) The pixel data can reside either in video ram (the cg14 frame buffer, VRAM), or in main memory (DRAM.)
The SX is currently used to accelerate all XGL pixel operations except accessing a textured pixel from a texture MipMap.
The SX does not support floating point operations. Thus, the transformation, clip checking, clipping, and optionally lighting steps that comprise the 2D and 3D graphics pipeline are done on the CPU. Since the SX runs in parallel with the CPU, typically the CPU will be transforming an object while the SX is rendering the previous object.
The SX has a single hardware context. This context is switched among all processes using SX. For example, using Xlib to render pixels via the server's SX driver, then XGL to render pixels via the XGL/SX driver, will cause a delay as the hardware context is switched between the two processes. Running a performance meter, for example, can cause a noticeable glitch in application animation when the SX context is switched between the meter process and the application. Use of Direct X when mixing Xlib and XGL rendering is highly recommended as, typically, no context switch will occur. The same SX context will be shared between the Xlib rendering calls and the XGL/SX driver. Similarly, mixing XIL, XGL and Direct X in the same process will cause no context switches.
The frame buffer, cg14, supports both 8 and 24 bit drawables, and can have both visible simultaneously. If window identifiers have not all been used up by other 8 bit double-buffered drawables, then the cg14 will use buffer switching for double buffering. Otherwise, the XGL/SX driver uses copy double buffering, using the SX to accelerate the copy. The driver always uses copy double buffering for 24 bit drawables.
The Z buffer is stored in DRAM, with one allocated for each XGL raster that has Z buffering turned on. The SX accelerates Z buffer clearing and comparison.
If SXDRAM is available, the XGL/SX driver will use it for Z buffers, and back buffers as well (if double buffering is enabled, and copy double buffering is being used.) SXDRAM significantly improves line-drawing and context- switching performance. Other pixel operations run about 10%-20% faster.
The XGL/SX driver supports the following subset of the available cg14 visuals:
Note that the application must recognize that 8-bit DirectColor and 8-bit TrueColor visuals exist, and be programmed to not use them with XGL (XGL will reject any attempt to make such a visual an XGL raster.) Also, since the window system can come up in defdepth 24 (see the openwin(1) man page), the application should not assume that the root window is of depth 8 with a default colormap available.
If accumulation buffering (global antialiasing) is intended, a non-zero jitter value must be used. The XGL/SX driver draws Bresenham-style lines in 3D when the X and Y jitter values are exactly zero, and true sampled lines (suitable for accumulation) otherwise.
To maximize performance, zero divides and floating point overflows are allowed to occur in normal operation of the XGL/SX driver. The default is to ignore these exceptions. If the application enables these exceptions, they should be set up to be ignored before calling XGL.
The SX uses the rasterization semantic for picking. See the Solaris XGL 3.0.2 Reference Manual for a complete description of this semantic.
The XGL/SX driver supports only matching XGL_DEV_COLOR_TYPE and XGL_DEV_REAL_COLOR_TYPE; they must both be either XGL_COLOR_INDEX or XGL_COLOR_RGB. Otherwise, the slower XGL/Xlib driver will be used to render into the window raster.
cg14config(1M) should be used to set the gamma value to a reasonable value for your monitor before viewing antialiased lines and dots. A good invocation to start with is
-----------------------------------
/usr/kvm/cg14config -g 2.2 -u 2.2 -----------------------------------
Otherwise, the antialiased objects will not look right.
The gcache should be used where possible to draw polygons other than triangles.
Not all rendering functions are equally accelerated by the XGL/SX driver. The greatest effort was focused on maximizing the performance of the most useful ones. The following is a necessarily-incomplete list of these. Please note that functions not on this list are not slow; they are just not as fast as they could be in the next release of the XGL/SX driver. If operations that are critical to your application are not in this list, please make a request for their speed to be increased.
--------------------------------------------------------------------------------
xgl_context_copy_raster() From window raster to window raster. xgl_multi_marker() 2D circles of radii 1 to 32 pixels. xgl_multi_polyline() In 2D, thin lines, solid or patterned, containing no color or homogeneous values, and with XGL_CTX_ROP equal to XGL_ROP_COPY. In 3D, thin lines, solid or patterned, containing no color, flag, homogeneous or data values, not model clipped, clipped to +w only, and with XGL_CTX_ROP equal to XGL_ROP_COPY. xgl_multi_simple_polygon() In 3D, triangles. The hint flags must be set to XGL_FACET_FLAG_SIDES_ARE_3. xgl_triangle_strip() Triangles that have no homogeneous or data values, are not model clipped, are clipped to +w only, are 24-bit, have edges turned off, are solid and opaque, and have XGL_3D_CTX_Z_BUFFER_COMP_METHOD equal to XGL_Z_COMP_LESS_THAN_OR_EQUAL. xgl_context_accumulate() All operations. --------------------------------------------------------------------------------