Platform Notes: SPARCstation 10SX and SPARCstation 20 System Configuration Guide

Chapter 4 XGL Accelerator Guide for SX

This chapter discusses the operation of XGL 3.1 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.

Overview

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 SPARCstation 10SX system and SPARCstation 20 system are now used to accelerate all XGL pixel operations except accessing a textured pixel from a texture MipMap when certain attributes are not set

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.

Texture Mapping

The 3.1 release of the XGL/SX driver has limited support for accelerated texture mapping of 3d triangle_strips and multi_simple_polygons. All texture mapping functionality is fully supported. If the following XGL attributes are set to the indicated values, then the SPARCstation 10SX system and SPARCstation 20 system hardware is used to render the following textured surfaces:

 XGL_3D_CTX_SURF_FACE_DISTINGUISH FALSE XGL_3D_CTX_SURF_FRONT_ILLUMINATION XGL_ILLUM_NONE XGL_3D_CTX_SURF_TMAP_PERSP_CORRECTION XGL_TEXTURE_PERSP_NONE Xgl_texture_interp_method XGL_TEXTURE_INTERP_POINT (desc.interp_info.filter1/filter2) Xgl_texture_op XGL_TEXTURE_OP_REPLACE (desc.comp_info.render_component_desc[0].texture_op)

You also need sufficient SXDRAM available to hold the texture. Refer to Chapter 2, Reserving DRAM for SX Accelerated Applications for further details, such as the size of the texture that should be included when calculating the size of SXDRAM that needs to be reserved.

X Visuals

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.

XGL_3D_CTX_JITTER_OFFSET

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.

SIGFPE

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.

XGL_CTX_PICK_APERTURE

The SX uses the rasterization semantic for picking. See the Solaris XGL Reference Manual for a complete description of this semantic.

XGL_DEV_COLOR_TYPE and XGL_DEV_REAL_COLOR_TYPE

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.

Antialiasing

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

/platform/SUNW,SPARCstation-10,SX/sbin/cg14config -g 2.2 -u 2.2

Otherwise, the antialiased objects will not look right.

Performance Considerations

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.

Table 4-1 XGL Functions with Performance Considerations
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.