1. Field of the Invention
The present invention generally relates to clearing graphics data buffers, and more specifically to storing clear values and referencing the clear values for portions of graphics data buffers.
2. Description of the Related Art
The performance of conventional graphics processing systems is sometimes limited by the bandwidth that is available between a graphics processor and external memory storing graphics data, such as color and z values. At various times during rendering, the color and z values are cleared to predetermined values. Accordingly, what is needed in the art is an improved system and method for performing clear operations while minimizing read and write accesses of the external memory storing the graphics data.
A system and method for performing zero-bandwidth-clears reduces external memory accesses by a graphics processor for read and write operations. A set of clear values are stored in the graphics processor. Each region of a color or z buffer (depth and/or stencil) may be configured using a zero-bandwidth-clear command to reference a clear value without writing the external memory. The clear value is provided to a requestor without accessing the external memory when a read access is performed. In addition to reducing accesses of the external memory, cache storage within the graphics processor is conserved since writes to and reads of cleared regions do not access the cache storage.
Another benefit of zero-bandwidth-clears is that one or more regions are cleared in fewer clock cycles compared with writing data to the regions. A rasterizer recognizes the fully-covered regions and generates the zero-bandwidth-clear commands, minimizing the number of clock cycles that are consumed to clear the regions. This may result in improved rendering performance since more clock cycles are available to process other graphics data.
Various embodiments of a method of the invention for performing data clear operations include receiving a clear command including a first clear value for a first tile set within a tile group and determining that a first stored clear value for the tile group is not referenced by any tiles within the tile group. The first clear value is stored as the first stored clear value for the tile group and state information for tiles in the first tile set is updated to reference the first stored clear value, indicating that the tiles in the first tile set are zero-bandwidth cleared to the first stored clear value.
Various embodiments of the invention include a system for performing data clear operations. The system includes a first register, tile group state, and a tile clear unit that is coupled to the first register and the tile group state. The first register is configured to store a first clear value for a tile group including multiple tile sets. The tile group state is configured to store tile state information for each tile in the tile group, the tile state information indicating whether or not each tile is zero-bandwidth-cleared. The tile clear unit is configured to receive a clear command including a clear value for a fully covered tile set, retain the first clear value in the first register when the clear value matches the first clear value, and update the tile group state for tiles in the tile set to indicate that the tiles are zero-bandwidth-cleared to the first clear value.
So that the manner in which the above recited features of the present invention can be understood in detail, a more particular description of the invention, briefly summarized above, may be had by reference to embodiments, some of which are illustrated in the appended drawings. It is to be noted, however, that the appended drawings illustrate only typical embodiments of this invention and are therefore not to be considered limiting of its scope, for the invention may admit to other equally effective embodiments.
In the following description, numerous specific details are set forth to provide a more thorough understanding of the present invention. However, it will be apparent to one of skill in the art that the present invention may be practiced without one or more of these specific details. In other instances, well-known features have not been described in order to avoid obscuring the present invention.
In one embodiment, the parallel processing subsystem 112 incorporates circuitry optimized for graphics and video processing, including, for example, video output circuitry, and constitutes a graphics processing unit (GPU). In another embodiment, the parallel processing subsystem 112 incorporates circuitry optimized for general purpose processing, while preserving the underlying computational architecture, described in greater detail herein. In yet another embodiment, the parallel processing subsystem 112 may be integrated with one or more other system elements, such as the memory bridge 105, CPU 102, and I/O bridge 107 to form a system on chip (SoC).
It will be appreciated that the system shown herein is illustrative and that variations and modifications are possible. The connection topology, including the number and arrangement of bridges, may be modified as desired. For instance, in some embodiments, system memory 104 is connected to CPU 102 directly rather than through a bridge, and other devices communicate with system memory 104 via memory bridge 105 and CPU 102. In other alternative topologies, parallel processing subsystem 112 is connected to I/O bridge 107 or directly to CPU 102, rather than to memory bridge 105. In still other embodiments, one or more of CPU 102, I/O bridge 107, parallel processing subsystem 112, and memory bridge 105 are integrated into one or more chips. The particular components shown herein are optional; for instance, any number of add-in cards or peripheral devices might be supported. In some embodiments, switch 116 is eliminated, and network adapter 118 and add-in cards 120, 121 connect directly to I/O bridge 107.
Referring again to
In operation, CPU 102 is the master processor of computer system 100, controlling and coordinating operations of other system components. In particular, CPU 102 issues commands that control the operation of PPUs 202. In some embodiments, CPU 102 writes a stream of commands for each PPU 202 to a command buffer (not explicitly shown in either
Referring back now to
In one embodiment, communication path 113 is a PCI-E link, in which dedicated lanes are allocated to each PPU 202, as is known in the art. Other communication paths may also be used. An I/O unit 205 generates packets (or other signals) for transmission on communication path 113 and also receives all incoming packets (or other signals) from communication path 113, directing the incoming packets to appropriate components of PPU 202. For example, commands related to processing tasks may be directed to a host interface 206, while commands related to memory operations (e.g., reading from or writing to parallel processing memory 204) may be directed to a memory crossbar unit 210. Host interface 206 reads each command buffer and outputs the work specified by the command buffer to a front end 212.
Each PPU 202 advantageously implements a highly parallel processing architecture. As shown in detail, PPU 202(0) includes a processing cluster array 230 that includes a number C of general processing clusters (GPCs) 208, where C≧1. Each GPC 208 is capable of executing a large number (e.g., hundreds or thousands) of threads concurrently, where each thread is an instance of a program. In various applications, different GPCs 208 may be allocated for processing different types of programs or for performing different types of computations. For example, in a graphics application, a first set of GPCs 208 may be allocated to perform tessellation operations and to produce primitive topologies for patches, and a second set of GPCs 208 may be allocated to perform tessellation shading to evaluate patch parameters for the primitive topologies and to determine vertex positions and other per-vertex attributes. The allocation of GPCs 208 may vary dependent on the workload arising for each type of program or computation. Alternatively, all GPCs 208 may be allocated to perform processing tasks using a time-slice scheme to switch between different processing tasks.
GPCs 208 receive processing tasks to be executed via a work distribution unit 200, which receives commands defining processing tasks from front end unit 212. Processing tasks include pointers to data to be processed, e.g., surface (patch) data, primitive data, vertex data, and/or pixel data, as well as state parameters and commands defining how the data is to be processed (e.g., what program is to be executed). Work distribution unit 200 may be configured to fetch the pointers corresponding to the tasks, work distribution unit 200 may receive the pointers from front end 212, or work distribution unit 200 may receive the data directly. In some embodiments of the present invention, indices specify the location of the data in an array. Front end 212 ensures that GPCs 208 are configured to a valid state before the processing specified by the command buffers is initiated.
When PPU 202 is used for graphics processing, for example, the processing workload for each patch is divided into approximately equal sized tasks to enable distribution of the tessellation processing to multiple GPCs 208. A work distribution unit 200 may be configured to output tasks at a frequency capable of providing tasks to multiple GPCs 208 for processing. In some embodiments of the present invention, portions of GPCs 208 are configured to perform different types of processing. For example a first portion may be configured to perform vertex shading and topology generation, a second portion may be configured to perform tessellation and geometry shading, and a third portion may be configured to perform pixel shading in screen space to produce a rendered image. The ability to allocate portions of GPCs 208 for performing different types of processing efficiently accommodates any expansion and contraction of data produced by the different types of processing. Intermediate data produced by GPCs 208 may buffered to allow the intermediate data to be transmitted between GPCs 208 with minimal stalling when a rate at which data is accepted by a downstream GPC 208 lags the rate at which data is produced by an upstream GPC 208.
Memory interface 214 may be partitioned into a number D of memory partition units that are each directly coupled to a portion of parallel processing memory 204, where D≧1. Each portion of memory generally consists of one or more memory devices (e.g DRAM 220). Persons skilled in the art will appreciate that DRAM 220 may be replaced with other suitable storage devices and can be of generally conventional design. A detailed description is therefore omitted. Render targets, such as frame buffers or texture maps may be stored across DRAMs 220, allowing partition units 215 to write portions of each render target in parallel to efficiently use the available bandwidth of parallel processing memory 204.
Any one of GPCs 208 may process data to be written to any of the partition units 215 within parallel processing memory 204. Crossbar unit 210 is configured to route the output of each GPC 208 to the input of any partition unit 214 or to another GPC 208 for further processing. GPCs 208 communicate with memory interface 214 through crossbar unit 210 to read from or write to various external memory devices. In one embodiment, crossbar unit 210 has a connection to memory interface 214 to communicate with I/O unit 205, as well as a connection to local parallel processing memory 204, thereby enabling the processing cores within the different GPCs 208 to communicate with system memory 104 or other memory that is not local to PPU 202. Crossbar unit 210 may use virtual channels to separate traffic streams between the GPCs 208 and partition units 215.
Again, GPCs 208 can be programmed to execute processing tasks relating to a wide variety of applications, including but not limited to, linear and nonlinear data transforms, filtering of video and/or audio data, modeling operations (e.g., applying laws of physics to determine position, velocity and other attributes of objects), image rendering operations (e.g., tessellation shader, vertex shader, geometry shader, and/or pixel shader programs), and so on. PPUs 202 may transfer data from system memory 104 and/or local parallel processing memories 204 into internal (on-chip) memory, process the data, and write result data back to system memory 104 and/or local parallel processing memories 204, where such data can be accessed by other system components, including CPU 102 or another parallel processing subsystem 112.
A PPU 202 may be provided with any amount of local parallel processing memory 204, including no local memory, and may use local memory and system memory in any combination. For instance, a PPU 202 can be a graphics processor in a unified memory architecture (UMA) embodiment. In such embodiments, little or no dedicated graphics (parallel processing) memory would be provided, and PPU 202 would use system memory exclusively or almost exclusively. In UMA embodiments, a PPU 202 may be integrated into a bridge chip or processor chip or provided as a discrete chip with a high-speed link (e.g., PCI-E) connecting the PPU 202 to system memory via a bridge chip or other communication means.
As noted above, any number of PPUs 202 can be included in a parallel processing subsystem 112. For instance, multiple PPUs 202 can be provided on a single add-in card, or multiple add-in cards can be connected to communication path 113, or one or more PPUs 202 can be integrated into a bridge chip. PPUs 202 in a multi-PPU system may be identical to or different from one another. For instance, different PPUs 202 might have different numbers of processing cores, different amounts of local parallel processing memory, and so on. Where multiple PPUs 202 are present, those PPUs may be operated in parallel to process data at a higher throughput than is possible with a single PPU 202. Systems incorporating one or more PPUs 202 may be implemented in a variety of configurations and form factors, including desktop, laptop, or handheld personal computers, servers, workstations, game consoles, embedded systems, and the like.
In graphics applications, a GPU 208 may be configured to implement a primitive engine for performing screen space graphics processing functions that may include, but are not limited to primitive setup, rasterization, and z culling. The primitive engine receives a processing task from work distribution unit 200, and when the processing task does not require the operations performed by primitive engine, the processing task is passed through the primitive engine to a pipeline manager 305. Operation of GPC 208 is advantageously controlled via a pipeline manager 305 that distributes processing tasks to streaming multiprocessors (SPMs) 310. Pipeline manager 305 may also be configured to control a work distribution crossbar 330 by specifying destinations for processed data output by SPMs 310.
In one embodiment, each GPC 208 includes a number M of SPMs 310, where M≧1, each SPM 310 configured to process one or more thread groups. Also, each SPM 310 advantageously includes an identical set of functional units (e.g., arithmetic logic units, etc.) that may be pipelined, allowing a new instruction to be issued before a previous instruction has finished, as is known in the art. Any combination of functional units may be provided. In one embodiment, the functional units support a variety of operations including integer and floating point arithmetic (e.g., addition and multiplication), comparison operations, Boolean operations (AND, OR, XOR), bit-shifting, and computation of various algebraic functions (e.g., planar interpolation, trigonometric, exponential, and logarithmic functions, etc.); and the same functional-unit hardware can be leveraged to perform different operations.
The series of instructions transmitted to a particular GPC 208 constitutes a thread, as previously defined herein, and the collection of a certain number of concurrently executing threads across the parallel processing engines (not shown) within an SPM 310 is referred to herein as a “thread group.” As used herein, a “thread group” refers to a group of threads concurrently executing the same program on different input data, with each thread of the group being assigned to a different processing engine within an SPM 310. A thread group may include fewer threads than the number of processing engines within the SPM 310, in which case some processing engines will be idle during cycles when that thread group is being processed. A thread group may also include more threads than the number of processing engines within the SPM 310, in which case processing will take place over multiple clock cycles. Since each SPM 310 can support up to G thread groups concurrently, it follows that up to G×M thread groups can be executing in GPC 208 at any given time.
Additionally, a plurality of related thread groups may be active (in different phases of execution) at the same time within an SPM 310. This collection of thread groups is referred to herein as a “cooperative thread array” (“CTA”). The size of a particular CTA is equal to m*k, where k is the number of concurrently executing threads in a thread group and is typically an integer multiple of the number of parallel processing engines within the SPM 310, and m is the number of thread groups simultaneously active within the SPM 310. The size of a CTA is generally determined by the programmer and the amount of hardware resources, such as memory or registers, available to the CTA.
An exclusive local address space is available to each thread and a shared per-CTA address space is used to pass data between threads within a CTA. Data stored in the per-thread local address space and per-CTA address space is stored in L1 cache 320 and an eviction policy may be used to favor keeping the data in L1 cache 320. Each SPM 310 uses space in a corresponding L1 cache 320 that is used to perform load and store operations. Each SPM 310 also has access to L2 caches within the partition units 215 that are shared among all GPCs 208 and may be used to transfer data between threads. Finally, SPMs 310 also have access to off-chip “global” memory, which can include, e.g., parallel processing memory 204 and/or system memory 104. An L2 cache may be used to store data that is written to and read from global memory. It is to be understood that any memory external to PPU 202 may be used as global memory.
In graphics applications, a GPC 208 may be configured such that each SPM 310 is coupled to a texture unit 315 for performing texture mapping operations, e.g., determining texture sample positions, reading texture data, and filtering the texture data. Texture data is read via memory interface 214 and is fetched from an L2 cache, parallel processing memory 204, or system memory 104, as needed. Texture unit 315 may be configured to store the texture data in an internal cache. In some embodiments, texture unit 315 is coupled to L1 cache 320 and texture data is stored in L1 cache 320. Each SPM 310 outputs processed tasks to work distribution crossbar 330 in order to provide the processed task to another GPC 208 for further processing or to store the processed task in an L2 cache, parallel processing memory 204, or system memory 104 via crossbar unit 210. A preROP (pre-raster operations) 325 is configured to receive data from SPM 310, direct data to ROP units within partition units 215, and perform optimizations for color blending, organize pixel color data, and perform address translations.
It will be appreciated that the core architecture described herein is illustrative and that variations and modifications are possible. Any number of processing engines, e.g., primitive engines 304, SPMs 310, texture units 315, or preROPs 325 may be included within a GPC 208. Further, while only one GPC 208 is shown, a PPU 202 may include any number of GPCs 208 that are advantageously functionally similar to one another so that execution behavior does not depend on which GPC 208 receives a particular processing task. Further, each GPC 208 advantageously operates independently of other GPCs 208 using separate and distinct processing engines, L1 caches 320, and so on.
In graphics applications, ROP 360 is a processing unit that performs raster operations, such as stencil, z test, blending, and the like, and outputs pixel data as processed graphics data for storage in graphics memory. ROP 360 receives render and zero-bandwidth clear commands from crossbar unit 210. In some embodiments of the present invention, ROP 360 is included within each GPC 208 instead of each partition unit 215, and pixel reads and writes are transmitted over crossbar unit 210 instead of pixel fragments.
The processed graphics data may be displayed on display device 110 or routed for further processing by CPU 102 or by one of the processing entities within parallel processing subsystem 112. Each partition unit 215 includes a ROP 360 in order to distribute processing of the raster operations. In some embodiments, ROP 360 may be configured to compress z or color data that is written to memory and decompress z or color data that is read from memory.
Persons skilled in the art will understand that the architecture described in
Data assembler 410 processing unit collects vertex data for high-order surfaces, primitives, and the like, and outputs the vertex data, including the vertex attributes, to vertex processing unit 415. Vertex processing unit 415 is a programmable execution unit that is configured to execute vertex shader programs, lighting and transforming vertex data as specified by the vertex shader programs. For example, vertex processing unit 415 may be programmed to transform the vertex data from an object-based coordinate representation (object space) to an alternatively based coordinate system such as world space or normalized device coordinates (NDC) space. Vertex processing unit 415 may read data that is stored in L1 cache 320, parallel processing memory 204, or system memory 104 by data assembler 410 for use in processing the vertex data.
Primitive assembler 420 receives vertex attributes from vertex processing unit 415, reading stored vertex attributes, as needed, and constructs graphics primitives for processing by geometry processing unit 425. Graphics primitives include triangles, line segments, points, and the like. Geometry processing unit 425 is a programmable execution unit that is configured to execute geometry shader programs, transforming graphics primitives received from primitive assembler 420 as specified by the geometry shader programs. For example, geometry processing unit 425 may be programmed to subdivide the graphics primitives into one or more new graphics primitives and calculate parameters, such as plane equation coefficients, that are used to rasterize the new graphics primitives.
In some embodiments, geometry processing unit 425 may also add or delete elements in the geometry stream. Geometry processing unit 425 outputs the parameters and vertices specifying new graphics primitives to a viewport scale, cull, and clip unit 450. Geometry processing unit 425 may read data that is stored in parallel processing memory 204 or system memory 104 for use in processing the geometry data. Viewport scale, cull, and clip unit 450 performs clipping, culling, and viewport scaling and outputs processed graphics primitives to a rasterizer 455 and a clear index unit 456.
Rasterizer 455 scan converts the new graphics primitives and outputs fragments and coverage data to fragment processing unit 460. Additionally, rasterizer 455 may be configured to perform z culling and other z-based optimizations. Clear index unit 456 maintains a table that stores clear values for portions of buffers and generates indexed clear commands as described in conjunction with
Fragment processing unit 460 is a programmable execution unit that is configured to execute fragment shader programs, transforming fragments received from rasterizer 455, as specified by the fragment shader programs. For example, fragment processing unit 460 may be programmed to perform operations such as perspective correction, texture mapping, shading, blending, and the like, to produce shaded fragments that are output to raster operations unit 465. Fragment processing unit 460 may read data that is stored in parallel processing memory 204 or system memory 104 for use in processing the fragment data. Fragments may be shaded at pixel, sample, or other granularity, depending on the programmed sampling rate.
Raster operations unit 465 is a processing unit that performs raster operations, such as stencil, z test, blending, and the like, and outputs pixel data as processed graphics data for storage in graphics memory. The processed graphics data may be stored in graphics memory, e.g., parallel processing memory 204, and/or system memory 104, for display on display device 110 or for further processing by CPU 102 or parallel processing subsystem 112. In some embodiments of the present invention, raster operations unit 465 is configured to compress z or color data that is written to memory and decompress z or color data that is read from memory.
Zero-bandwidth-clear operations are used to indicate that locations in a buffer that is stored in external memory, e.g., PP memory 204, “store” a clear value without accessing the external memory. Instead of actually writing the buffer with the clear value, state information is updated to indicate that locations in the buffer are zero-bandwidth cleared. A clear value command provides a clear value that is used by subsequent clear commands to clear a portion of a buffer. Clear commands are used to write the clear value to the portion of the buffer. When zero-bandwidth-clear operations are enabled, the clear commands may be executed without writing external memory and read requests may be executed without reading external memory. Zero-bandwidth-clear operations may be used to clear portions of buffers storing color, z, stencil, surface normals, distances from a light source to a surface, or any other type of data.
When zero-bandwidth-clears are used a set of clear values are stored in a clear values table in each PPU 202, so that portions of the color and z buffers may be cleared to different values. Tiles (two dimensional portions) of color or z buffers may be configured, when zero-bandwidth-clears are enabled, to reference a clear value stored in the clear values table without writing external memory, e.g., PP memory 204 or system memory 104, or internal memory, e.g., L2 cache 350, when clear commands are received. The effective hit rate of L2 cache 350 (and other internal memories) is increased since zero buffer cleared data does not occupy space in L2 cache 350. The clear value referenced by a tile is read from the clear values table when a read request is executed. Different clear values may be determined for each software application and loaded into the clear values table by device driver 103. Alternately, the clear values table may be automatically loaded with clear values by PPU 202 as the clear values are received with each clear value command.
In step 501 clear index unit 456 determines if the clear value specified by the clear value command matches a current clear value that is stored in a register. In addition to storing a current clear value, a second register stores a current clear index that specifies an entry in the clear values table when the current clear index is valid. The current clear index is initialized as invalid, e.g., 0x0. When the current clear index is valid, the index corresponds to an entry in the clear values table that stores the current clear value. When zero-bandwidth-clears are enabled and the current clear index is valid, the current clear index is output with subsequent clear commands.
In step 501, when clear index unit 456 determines that the clear value received as part of the clear value command does not match the current clear value, clear index unit 456 proceeds to step 505 and determines if any valid entries in the clear values table match the clear value. Each entry storing a color clear value may store 128 bits. Each entry storing a z clear value may store 32 bits of z and 8 bits of stencil. Each entry may also include a valid bit that indicates whether or not a clear value stored in the entry is valid. In some embodiments of the present invention, a separate clear values table or separate entries in a single clear values table are used to store stencil clear values.
If, in step 505 no entries in the clear values table match the clear value in the command, then in step 507 the current clear index value is invalidated and in step 508 the clear value in the command is stored in the register as the current clear value. If, in step 505, an entry in the clear values table does match the clear value in the command, then in step 506 clear index unit 456 updates the current clear index to the index of the entry that stores the matching clear value and in step 508 the clear value in the command is stored in the register as the current clear value. If, in step 501 clear index unit 456 determines that the clear value specified by the clear value command matches the current clear value, then in step 503, the current clear value and current clear index are retained in the registers.
In some embodiments of the present invention, the clear values table in clear index unit 456 stores clear values in a format that may differ from the format of the color and/or z buffer. Clear values of different formats that map to the same bit pattern in the color and/or z buffer can share the same table entry (and corresponding index) and are considered to match in step 505. For example, the four channel color clear value of (0.0, 0.0, 0.0, 0.0) maps to the bit pattern 0x00000000 . . . in one or more color formats. Similarly, the four channel color clear value of (1.0, 1.0, 1.0, 1.0) maps to the bit pattern 0xFFFFFFFF . . . in one or more color formats. When fewer than four channels are used, only the used channels need to match. The clear values table in clear index unit 456 may also store a format indicator in each entry that specifies which clear value formats are compatible with other formats used in the color and/or z buffer.
A tile set may correspond to a memory page, portion of a memory page, or other portion of memory that includes graphics data for one or more pixels. One or more tile sets may be fully or partially covered by a region. Each tile set may include one or more tiles of a buffer and is not necessarily rectangular. In some embodiments of the present invention a tile set includes four tiles and a tile group includes multiple tile sets, such as a collection of tile sets that reside in the same partition unit 215. The indexed clear commands output in step 515 may include a flag to differentiate between whether or not an index field of the indexed clear command is valid. Alternately, an index value of 0x0 may be used to indicate that the index is not valid. The indexed clear commands include the current clear value, and are output by clear index unit 456 for each fully covered tile set within the region. When the indexed clear command index is invalid, the indexed clear command is executed using conventional write requests to store the current clear value in external memory.
After flowing through the graphics pipeline, the indexed clear commands reach one or more partition units 215 associated with the region of graphics data. In step 520 the partition units 215 receive the indexed clear commands and each partition unit 215 determines if the clear index specified by the indexed clear command matches a stored clear index for the tile group. In one embodiment of the present invention, a single clear index is stored for a tile group that may include multiple tile sets. In other embodiments, a single index may be stored for each tile set or a clear index may be stored for each smaller portion of a tile set or single tile. If the indexed clear command index matches the stored index for the tiles in the tile set, then in step 540 tile group state is updated to indicate that the tiles in the tile set are zero-bandwidth cleared. In addition to storing a zero-bandwidth-clear flag for each tile, the tile group state may also store format information. When the zero-bandwidth-clear flag for a tile is asserted, the tile is considered to be cleared to the clear value in the entry of the clear values table that corresponds to the stored index for the tile group.
If, in step 525 the partition unit 215 determines that the clear index specified by the indexed clear command does not match the stored index, then in step 530 the partition unit 215 determines if the stored index is unused. The stored index is considered unused when it is invalid. In some embodiments of the present invention, the stored index may also be considered unused when none of the tiles in a tile group reference the stored index. The tile state indicates which tiles in each tile group are cleared to the clear value referenced by the stored index. Examination of the tile state for each tile in the group can be performed to determine if any of the tiles in the tile group are cleared.
If, in step 530 the partition unit 215 determines that the stored index is unused, then in step 535 the partition unit 215 stores the index specified by the indexed clear command for the tile group and proceeds to step 540. If, in step 530 the partition unit 215 determines that the stored index is used, then in step 545 the partition unit 215 writes the clear value specified by the indexed clear command to the tile, replicating the clear value as needed to fill the tile. In step 548 the partition unit 215 updates the tile state to indicate that the tile is not zero-bandwidth-cleared. Since different tiles in a region may be in different tile groups, some tiles in the region may match the stored index for their group in step 525 while other tiles do not. Similarly, some tiles may be in a tile group that has an unused stored index, while others are in tile groups that do not have an unused stored index. Therefore, different tiles in a region may be processed following different paths through the method shown in
A clear index, e.g., index 555, 565, and 575, is stored for each tile group. The clear index points to an entry of clear values table 580 that stores a clear value. A clear index may also have an invalid value that does not point to an entry of clear values table 580. As shown in
Clear values table 580 stores clear values that are loaded using register writes that bypass the graphics processing pipeline, or may be loaded by commands within a rendering command stream. Register writes may be performed by a resource manager or device driver 103. The clear values that are stored in clear values table 580 may be the same or may differ for each application program. In some embodiments of the present invention, the clear values are loaded into clear values table 580 when the clear value commands are received. Once the clear values table 580 is full, no more clear values received with the clear value command are stored in clear values table 580. The clear value commands are used to load the clear values table 580 in clear index unit 456 and in each partition unit 615.
When the index received with the indexed clear command is valid and matches the index stored in group indices 652, tile clear unit 665 updates tile group state 605 to indicate that the tiles in the tile set are zero-bandwidth-cleared. When the index received with the indexed clear command is valid and does not match the index stored in group indices 652, tile clear unit 665 determines if the stored index is invalid or unused. The stored index is unused if none of the tiles in the group are zero-bandwidth-cleared, according to tile group state 605. Tile clear unit 665 writes the index received with the indexed clear command to group indices 652 when the stored index is invalid or unused, and then updates tile group state 605 to indicate that the tiles in the tile set are zero-bandwidth-cleared. As previously described, when the stored index is used and does not match the index received with the indexed clear command, the data in the tiles are explicitly cleared by writing the corresponding clear value to the tiles.
In some embodiments of the present invention, a command may be used to invalidate the indices stored in group indices 652 and update all of the tiles to indicate that they are not zero-bandwidth-cleared, in order to perform a fast clear of the tile groups. The next valid index that is received with an indexed clear command will be stored in group indices 652 and all tiles in the tile groups may then be cleared to that value using zero-bandwidth-clear operations or cleared by writing tile group state 605 to indicate that the tiles in the tile groups are cleared. Tile group state 605 can also be written to indicate that one or more tiles are zero-bandwidth-cleared to a value corresponding to an index stored in group indices 652.
In addition to reducing the memory bandwidth needed to clear graphics data stored in external and internal memory, zero-bandwidth clears also eliminate the bandwidth required to read cleared data during subsequent rendering.
When tile clear unit 665 determines that the tile is not zero-bandwidth-cleared, then in step 625 the read request is output to FB 655. Otherwise, in step 628 the stored index is used to read a clear value for the tile from the corresponding entry in clear values table 580. In step 630 tile clear unit 665 determines if the tile stores color data, and, if so, in step 632 the clear value for the tile is converted based on the color format specified for the tile to produce a color value. The color format may be received with the read request or may be stored in tile group state 605. In step 634 the color value is replicated as needed and output to satisfy the read request.
If, in step 630 tile clear unit 665 determines that the tile does not store color data, then in step 636 the clear value for the tile set is converted based on the z format specified for the tile set to produce a z value. The z format may be received with the read request or may be stored in tile group state 605. In step 638 the z value is replicated as needed and output to satisfy the read request. In some embodiments of the present invention, the clear value is stored in the format specified for the tile and steps 632 and 636 are omitted.
In step 684 tile clear unit 665 determines if the tile stores color data, and, if so, in step 686 the clear value for the tile is converted based on the color format specified for the tile to produce a color value. The color format may be received with the read request or may be stored in tile group state 605. If, in step 684 tile clear unit 665 determines that the tile does not store color data, then in step 688 the clear value for the tile set is converted based on the z format specified for the tile to produce a z value. The z format may be received with the read request or may be stored in tile group state 605. In some embodiments of the present invention, the clear value is stored in the format specified for the tile and steps 686 and 688 are omitted. In step 690 the converted clear value is replicated and combined with the original write request data, forming an expanded write request. In step 695, this expanded write request is output to FB 655.
In another embodiment of the present invention, zero-bandwidth-clear operations are performed without using clear values table 580. Instead a number of clear values are stored for each tile group. Storing two clear values allows for a first portion of the tiles in the tile group to be cleared to a different value than a second portion of the tiles. This is useful during frame transitions. Since the clear values used to perform zero-bandwidth-clears are not stored in a table, a wider variety of clear values may be used for the different tile groups. Rather than preloading clear values, the clear values for each tile group are stored as they are received and replaced by new clear values when they are no longer referenced by any tiles in the tile group.
ROP 740 receives input clear commands and memory access requests from crossbar unit 210. Input clear commands are input by L2 cache 730 to a tile clear unit 700. Tile clear unit 700 stores clear values for each tile group and a reference count for each stored clear value in clear values and reference counts 752. In some embodiments of the present invention, two clear values and corresponding reference counts are stored for each tile group. In other embodiments of the present invention more than two clear values and corresponding reference counts are stored for each tile group. When a reference count for a tile group equals zero, a new clear value may be stored in clear values and reference counts 752 for the tile group. A tile group state 705 stores state information for the tile group, such as compression and data formats used to represent each tile in a tile group, including a flag that indicates if a tile is zero-bandwidth-cleared to a stored clear value and an index referencing one of the stored clear values. In some embodiments of the present invention, one or more of the tile state, clear values, and reference counts may be written using a command to quickly clear all of the tiles to a value without issuing clear commands for each tile or tile set. In other embodiments of the present invention the reference counts may be omitted and tile clear unit 700 may be configured to check that no tile in the tile group is in a zero-bandwidth clear state and references a particular index. This requires more detailed examination of tile group state 705 while simplifying the updating operation.
If, in step 804 tile clear unit 700 determines that at least one of the stored clear values for the tile group including the tile set is unused, then in step 808 tile clear unit 700 stores the clear value received with the command in an unused clear value register in clear values and reference counts 752. In step 810 tile clear unit 700 updates, i.e., increments, the reference count corresponding to the stored clear value in clear values and reference counts 752 for each tile in the tile set. Tile clear unit 700 also updates, i.e., decrements, another reference count for each tile in the tile set whose tile state indicated that the tile was zero-bandwidth-cleared to a different one of the stored clear values. In step 815 tile clear unit 700 sets the zero-bandwidth-clear flag in tile group state 705 for the tiles in the tile set.
In step 820 partition unit 715 receives a read request. In step 822 tile clear unit 700 determines if the tile is cleared to a stored clear value for the tile group including the tile. Tile clear unit 700 reads the zero-bandwidth-clear flag for the tile that is stored in tile group state 705, to determine whether or not the tile is zero-bandwidth-cleared. If the tile is not cleared, according to the zero-bandwidth-clear flag, then in step 825 tile clear unit 700 outputs the read request to FB 735 via L2 cache 730. The read request is then processed in a conventional manner.
If, in step 822 tile clear unit 700 determines that the tile is cleared, then in step 828 tile clear unit 700 obtains the index stored in tile group state 705 for the tile. The pointer is used to read one of the clear values. When only one clear value is stored for each tile group, an index is not needed. In step 830 tile clear unit 700 determines if the tile stores color data, and, if so, in step 832 the clear value for the tile is converted based on the color format specified for the tile to produce a color value. The color format may be received with the read request or may be stored in tile group state 705. In step 834 the color value is replicated as needed and output to satisfy the read request.
If, in step 830 tile clear unit 700 determines that the tile does not store color data, then in step 836 the clear value for the tile is converted based on the z format specified for the tile to produce a z value. The z format may be received with the read request or may be stored in tile group state 705. In step 838 the z value is replicated as needed and output to satisfy the read request.
If, in step 875 tile clear unit 700 determines that the tile is zero-bandwidth-cleared to a clear value stored for the tile group including the tile, then in step 876 tile clear unit 700 updates the tile group state, e.g., clears the zero-bandwidth-clear flag, for the tile to indicate that the tile is no longer zero-bandwidth-cleared to one of the stored clear values. In step 878 tile clear unit 700 updates, i.e., decrements, the reference count corresponding to the stored clear value in clear values and reference counts 752.
In step 895, the write request is examined to see whether it fully covers the tile. If it does fully cover the tile, in step 895 the write request is output to FB 735. If the write request does not fully cover the tile, in step 882 the zero-bandwidth-clear data is retrieved from clear values and reference counts 752 according to the index stored in tile group state 705, and converted based on the format specified for the tile to produce a clear value.
In step 884 tile clear unit 700 determines if the tile stores color data, and, if so, in step 886 the clear value for the tile is converted based on the color format specified for the tile to produce a color value. The color format may be received with the read request or may be stored in tile group state 705. If, in step 884 tile clear unit 700 determines that the tile does not store color data, then in step 888 the clear value for the tile is converted based on the z format specified for the tile to produce a z value. The z format may be received with the read request or may be stored in tile group state 705. In step 890 the converted clear value is replicated and combined with the original write request data, forming an expanded write request. In step 895 tile clear unit 700 outputs the write request to FB 735 via L2 cache 730. The write request is then processed in a conventional manner.
Systems and methods for performing zero-bandwidth-clear operations can accelerate clears and reduce internal and external memory accesses by PPU 202 and improve cache hit rates. A set of clear values are stored in a common clear value table or in per-tile block registers. Each region of a color or z buffer may be configured when zero-bandwidth-clears are enabled to reference a stored clear value without writing the external or internal memory. The clear value is provided to a requestor without accessing the external or internal memory when a read access is performed. Therefore accesses to external and internal memory may be reduced.
One embodiment of the invention may be implemented as a program product for use with a computer system. The program(s) of the program product define functions of the embodiments (including the methods described herein) and can be contained on a variety of computer-readable storage media. Illustrative computer-readable storage media include, but are not limited to: (i) non-writable storage media (e.g., read-only memory devices within a computer such as CD-ROM disks readable by a CD-ROM drive, flash memory, ROM chips or any type of solid-state non-volatile semiconductor memory) on which information is permanently stored; and (ii) writable storage media (e.g., floppy disks within a diskette drive or hard-disk drive or any type of solid-state random-access semiconductor memory) on which alterable information is stored.
The invention has been described above with reference to specific embodiments. Persons skilled in the art, however, will understand that various modifications and changes may be made thereto without departing from the broader spirit and scope of the invention as set forth in the appended claims. The foregoing description and drawings are, accordingly, to be regarded in an illustrative rather than a restrictive sense.
Number | Name | Date | Kind |
---|---|---|---|
5109520 | Knierim | Apr 1992 | A |
5394170 | Akeley et al. | Feb 1995 | A |
5408606 | Eckart | Apr 1995 | A |
5452299 | Thessin et al. | Sep 1995 | A |
5485586 | Brash et al. | Jan 1996 | A |
5500939 | Kurihara | Mar 1996 | A |
5572655 | Tuljapurkar et al. | Nov 1996 | A |
5623688 | Ikeda et al. | Apr 1997 | A |
5625778 | Childers et al. | Apr 1997 | A |
5664162 | Dye | Sep 1997 | A |
5696945 | Seiler et al. | Dec 1997 | A |
5781201 | McCormack et al. | Jul 1998 | A |
5805868 | Murphy | Sep 1998 | A |
5898895 | Williams | Apr 1999 | A |
5905877 | Guthrie et al. | May 1999 | A |
5923826 | Grzenda et al. | Jul 1999 | A |
6104417 | Nielson et al. | Aug 2000 | A |
6115323 | Hashimoto | Sep 2000 | A |
6157963 | Courtright et al. | Dec 2000 | A |
6157989 | Collins et al. | Dec 2000 | A |
6172670 | Oka et al. | Jan 2001 | B1 |
6202101 | Chin et al. | Mar 2001 | B1 |
6205524 | Ng | Mar 2001 | B1 |
6219725 | Diehl et al. | Apr 2001 | B1 |
6384822 | Bilodeau et al. | May 2002 | B1 |
6469703 | Aleksic et al. | Oct 2002 | B1 |
6545684 | Dragony et al. | Apr 2003 | B1 |
6570571 | Morozumi | May 2003 | B1 |
6580427 | Orenstein et al. | Jun 2003 | B1 |
6674430 | Kaufman et al. | Jan 2004 | B1 |
6778189 | Kilgard | Aug 2004 | B1 |
6853382 | Van Dyke et al. | Feb 2005 | B1 |
6864895 | Tidwell et al. | Mar 2005 | B1 |
7050069 | Selig et al. | May 2006 | B2 |
7129941 | Deering et al. | Oct 2006 | B2 |
7324115 | Fraser | Jan 2008 | B2 |
20030067467 | Wilt et al. | Apr 2003 | A1 |
20030095127 | Blais | May 2003 | A1 |
20040189652 | Emberling | Sep 2004 | A1 |