psx.wiki

Graphics Processing Unit (GPU): Difference between revisions

Revision as of 02:22, 23 October 2026
RemmyLee
(Hardware and system software pages from the Sony manuals)
Revision as of 02:43, 23 October 2026
RemmyLee
(GPU at register depth: GP0, GP1, GPUSTAT, VRAM, rendering, T-cache, video timing)
Line 4:Line 4:
summary: Drawing processor and display controller of the PlayStation.summary: Drawing processor and display controller of the PlayStation.
category: Hardwarecategory: Hardware
+category: GPU
------
## Overview## Overview
−The PlayStation has two graphics processors: the GPU and the GTE (Geometry Transformation Engine).[^hw33]+In the PlayStation there is the GPU (the graphics drawing processor) and the GTE (the geometry transform engine). The GPU is equipped with a CRTC function for screen display and a high-speed polygon and sprite drawing function for the frame buffer, while the GTE carries out high-speed calculation of coordinate data and light source data as the CPU coprocessor.[^hw33] The GPU and the GTE connect to the CPU as shown in [System Architecture](/hardware/system-architecture/).
−The GPU and the GTE connect to the CPU as shown in [System Architecture](/hardware/system-architecture/).+The basic principle of the graphics system is that the CPU transfers texture images and color palettes (CLUTs) to the frame buffer and then causes the GPU to draw polygons from the coordinates and colors that the GTE computes.[^hw14] The GPU draws by executing strings of instructions (primitives) stored in main memory, and the data structures of the libgpu library correspond closely to the primitives that the GPU hardware recognizes.[^lo84]
−The GPU draws polygons and sprites into the frame buffer. It also displays areas of the frame buffer on the screen.[^hw33]+The GPU has the following drawing functions:[^hw35]
−The GTE is a coprocessor of the CPU. It calculates coordinate data and light source data.[^hw33]+Table: GPU drawing capabilities
−## Frame Buffer+| Name | Description |
+| --- | --- |
+| Sprite drawing | 1 x 1 to 256 x 256 pixels. 4-bit CLUT (16 colors per sprite), 8-bit CLUT (256 colors per sprite) or 15-bit direct (32,768 colors per sprite). |
+| Polygon drawing | Flat shading. Gouraud shading. Texture mapping. |
+| Line drawing | Gradation. |
+| Image transfer | CPU to frame buffer. Frame buffer to CPU. Frame buffer to frame buffer. |
+| Other | Blending (translucency). Dithering. Clipping. Offset specification. |
−The GPU has 1 MB of video memory (VRAM).[^hw33]+## Reference Pages
−The frame buffer is 1024 x 512 pixels.[^hw35]+The GPU is described in detail on the following pages:
−The frame buffer is dual ported. The GPU can draw into it while the display reads from it.[^hw33]+Table: GPU pages
−DMA can transfer data between the frame buffer and main memory.[^hw33]+| Page | Content |
+| --- | --- |
+| [GP0 Drawing Commands](/hardware/gpu/gp0-drawing/) | Polygon, line and rectangle commands, vertex and color attributes, drawing rules |
+| [GP0 Environment Commands](/hardware/gpu/gp0-environment/) | GP0(E1h) to GP0(E6h): texture page, texture window, drawing area, offset, mask bit |
+| [GP0 Transfer and Other Commands](/hardware/gpu/gp0-transfer/) | Fill, VRAM copies, cache clear, interrupt request, NOP |
+| [GP1 Display Control Commands](/hardware/gpu/gp1/) | Reset, display enable, DMA direction, display area and range, display mode |
+| [GPUSTAT and GPUREAD](/hardware/gpu/gpustat/) | Status register bits, ready bits, interlace field |
+| [Frame Buffer (VRAM)](/hardware/gpu/vram/) | Pixel format, display and drawing areas, texture pages, CLUTs, transparency |
+| [GPU Rendering](/hardware/gpu/rendering/) | Shading, modulation, semi-transparency, dithering, ordering tables |
+| [Texture Cache and Drawing Speed](/hardware/gpu/texture-cache/) | Cache blocks and entries, access cycles, command FIFO |
+| [GPU Video Timing](/hardware/gpu/video-timing/) | Video clock, dot clock, refresh rates, NTSC and PAL, interlace |
−## Display Area+## I/O Ports
−The GPU displays a rectangular area of the frame buffer on the screen. Sony calls this area the display area.[^hw33]+The CPU controls the GPU through two 32-bit ports. GP0 receives drawing commands and VRAM data, and GP1 receives display control commands; reading GP0 returns the results of VRAM reads and register reads, and reading GP1 returns the status register.[^spx-io]
+Table: GPU I/O ports
+
+| Port | Name | Write | Read |
+| --- | --- | --- | --- |
+| 0x1F801810 | GP0 | Drawing commands and VRAM data | GPUREAD: VRAM data and GP1(10h) results |
+| 0x1F801814 | GP1 | Display control commands | GPUSTAT: status register |
+
+psx-spx describes the connection between the CPU and the GPU as a 32-bit data-only bus that it calls the VBUS. Apart from address line 2, which selects between the two ports, no address lines run between the two chips, so the GPU acts as a device that executes 32-bit commands.[^spx-io]
+
+## DMA
+
+High-speed DMA transfer may be performed between the frame buffer and main memory.[^hw33] Two DMA channels serve the GPU:[^spx-dma]
+
+Table: GPU DMA channels
+
+| Channel | Mode | Use |
+| --- | --- | --- |
+| DMA2 | Linked list | Sending drawing commands, GP0(20h) to GP0(7Fh) and GP0(E1h) to GP0(E6h) |
+| DMA2 | Continuous | VRAM transfers to and from the GPU, GP0(A0h) and GP0(C0h) |
+| DMA6 | | Initializing an ordering table in main RAM |
+
+DMA2 is equivalent to software access to the GP0 port, and the DMA direction must be set with GP1(04h) before it is used. DMA6 only writes main RAM and is not connected to the GPU.[^spx-dma] Libgpu uses DMA6 in ClearOTagR(), which is why a reverse ordering table is initialized faster than a normal one.[^lo816][^spx-ot]
+
+## Frame Buffer
+
+The GPU has 1 MB of video memory (VRAM). The frame buffer is dual ported, and may be accessed for drawing while display takes place.[^hw33] It is 1024 pixels wide by 512 pixels tall with 16 bits per pixel, and it holds the display area, the drawing area, texture patterns and CLUTs.[^lo84] The [frame buffer page](/hardware/gpu/vram/) describes its layout.
+
+The GPU displays the content of rectangular areas of the frame buffer on the CRT display, and these areas are called display areas.[^hw33] Drawing coordinates are signed 11-bit values from -1024 to 1023. Since the frame buffer is 1024 x 512, coordinates outside it wrap around. The drawing origin can be placed anywhere in the frame buffer by the coordinate offset, and the GPU clips all drawing to the current drawing area.[^hw35]
+
## Screen Modes## Screen Modes
−The GPU supports the following screen modes:+The GPU supports the following screen modes:[^hw34]
Table: Window resolutionsTable: Window resolutions
Line 49:Line 95:
| 9 | 384 x 480 | Interlace || 9 | 384 x 480 | Interlace |
+Sony gives the width of modes 8 and 9 as 384 in PlayStation Hardware and lists a width of 360 for DISPENV in the Run-Time Library Overview. psx-spx gives this width as 368 pixels and derives it from a dot clock divider of 7.[^hw34][^lo86][^spx-08][^spx-nocash]
+
## Display Colors## Display Colors
−The GPU has two display color modes: 15-bit direct and 24-bit direct.[^hw34]+The GPU supports 2 modes for color display: 15-bit direct (32,768 colors) and 24-bit direct (full color).[^hw34]
−### 15-bit Direct Mode+15-bit direct mode can display up to 32,768 colors. The number of colors is limited compared with 24-bit mode, but color computation in the GPU is done in 24 bits; because of this and the dither feature, quasi-full color display is possible.[^hw34]
−15-bit direct mode displays up to 32,768 colors.[^hw34]+24-bit direct mode can display up to 16,777,216 colors. However, it can only display image data transferred to the frame buffer, because the GPU assumes 16 bits per pixel and cannot draw in this mode. Coordinates and display locations stay in 16-bit units, so a 640 x 480 24-bit image is treated as 960 x 480 in the frame buffer. The display start X (DBX) must also be a multiple of 8, which makes the minimum screen size in this mode 8 x 2 pixels.[^hw34]
−The GPU computes color in 24 bits and dithers the result. The display comes close to 24-bit color.[^hw34]+## Sprites and Texture Pages
−### 24-bit Direct Mode+The GPU supports sprites of up to 256 x 256 pixels, and width and height can vary up to this value. The image data of a sprite is placed in a non-display area of the frame buffer and must be transferred there before the sprite drawing command is executed.[^hw35]
−24-bit direct mode displays up to 16,777,216 colors.[^hw34]+Sprite patterns are placed in 256 x 256 pixel areas of the frame buffer called texture pages. The size of a texture page in the frame buffer varies with the texture mode, and the TSB parameter of the drawing command gives its page number. The page number of a page with upper left corner (tx, ty) is tpage = ty/16 + tx/64, although the actual tpage value also contains data such as the CLUT mode and the semi-transparency rate.[^hw36]
−The GPU cannot draw in this mode. Drawing assumes 16 bits per pixel.[^hw34]+There are three sprite color modes: 4-bit CLUT, 8-bit CLUT and 15-bit direct. A CLUT (color lookup table) is a table of RGB values, with 16 entries for a 4-bit sprite and 256 for an 8-bit sprite, and each pixel of the sprite pattern gives its color by an index into the table. A CLUT can be selected for each sprite, and one entry has the same structure as a 15-bit pixel. The CBA parameter of the drawing command gives the left coordinate of the CLUT in the frame buffer.[^hw36]
−This mode displays image data that was transferred into the frame buffer.[^hw34]+## Polygons
−Frame buffer coordinates stay in 16-bit units. A 640 x 480 image in 24-bit mode occupies 960 x 480 in the frame buffer.[^hw34]+The polygons that the GPU handles are triangles and quadrilaterals, and each is drawn from the screen coordinates of its vertices. With Gouraud shading a different color may be specified for each vertex, and the GPU interpolates the colors across the polygon. Texture mapping applies a 2-dimensional image to a polygon; its texture patterns are placed in non-display areas of the frame buffer and handled the same way as sprite patterns.[^hw37]
−## Drawing Functions+## Texture Cache
−The GPU has the following drawing functions:+The texture cache (T-cache) is a 2K-byte high-speed buffer memory between the GPU and the frame buffer. Because each texel of a texture pattern is likely to be read more than once while each pixel of the polygon is drawn only once, reading texels through the T-cache speeds up texture mapping. Its size in pixels depends on the pixel mode:[^hw37][^hw38]
−Table: GPU drawing capabilities+Table: T-cache size
−| Name | Description |+| Pixel Mode | Size (width x length) |
| --- | --- || --- | --- |
−| Sprite drawing | 1 x 1 to 256 x 256 pixels. 4-bit CLUT (16 colors per sprite), 8-bit CLUT (256 colors per sprite) or 15-bit direct (32,768 colors per sprite). |+| 4 bits/pixel | 64 x 64 pixels |
−| Polygon drawing | Flat shading. Gouraud shading. Texture mapping. |+| 8 | 64 x 32 |
−| Line drawing | Gradation. |+| 16 | 32 x 32 |
−| Image transfer | CPU to frame buffer. Frame buffer to CPU. Frame buffer to frame buffer. |
−| Other | Blending (translucency). Dithering. Clipping. Offset specification. |
−## Drawing Coordinates+For frame buffer access timing Sony refers to the libgpu overview, which the [texture cache page](/hardware/gpu/texture-cache/) follows.[^hw38]
−Drawing coordinates are signed 11-bit values. X and Y range from -1024 to 1023.[^hw35]+## GPU Versions
−The coordinate offset sets the drawing origin anywhere in the frame buffer.[^hw35]+psx-spx distinguishes three GPU versions:[^spx-ver]
−The GPU clips all drawing to the current drawing area.[^hw35]+Table: GPU versions
−## Sprite Drawing+| Item | v0 | v1 | v2 |
+| --- | --- | --- | --- |
+| GPU chip | CXD8514Q (160-pin) | CXD8538Q (208-pin prototype) | CXD8561Q/BQ/CQ, CXD9500Q (208-pin) |
+| Mainboard | EARLY-PU-8 and below | Arcade boards only | LATE-PU-8 and up |
+| Memory type | Dual-ported VRAM | Dual-ported VRAM | Normal DRAM |
+| GPUSTAT bit 13 with interlace off | Always 0 | Unknown | Always 1 |
+| GP1(10h) index 7 | Not supported | 1 | 2 |
+| Rectangle X and Y flip | No | No | Yes |
+| Shaded textures | ((color/8) x texel)/2 | Unknown | (color x texel)/16 |
−The GPU draws sprites of up to 256 x 256 pixels. Width and height can each vary up to that size.[^hw35]+The v1 GPU appears only on some arcade boards and seems to use different drawing commands. Another arcade-only revision, the CXD8654Q (v2b), seems to use the same commands as the v2.[^spx-ver] PSX games should not use the flip feature of the v2 GPU, because older consoles do not have it.[^spx-flip]
−Sprite image data sits in a non-display area of the frame buffer. It must be transferred there before the sprite drawing command runs.[^hw35]+## Library
−### Texture Pages+Libgpu, the Basic Graphics library, is a low-level library for primitives such as triangles, rectangles and sprites. It provides system functions that control the whole graphics system, frame buffer access functions, primitive functions and ordering table functions. Its synchronization functions wait for the vertical blank and for the end of drawing.[^lo83] The libgpu primitives and the GPU commands they produce are listed in [GP0 Drawing Commands](/hardware/gpu/gp0-drawing/).
−A 256 x 256 pixel area of sprite patterns in the frame buffer is a texture page.[^hw36]
−
−The size of a texture page in the frame buffer depends on the texture mode.[^hw36]
−
−The TSB parameter of a drawing command gives the page number. The page number of a texture page at (tx, ty) is tpage = ty/16 + tx/64.[^hw36]
−
−The actual tpage value also holds the CLUT mode (4, 8 or 16 bits) and the semi-transparency rate.[^hw36]
−
−### Sprite Pattern Color Modes
−
−Sprites have three color modes: 4-bit CLUT, 8-bit CLUT and 15-bit direct.[^hw36]
−
−A CLUT (color lookup table) is a table of RGB values. Each pixel of a CLUT sprite is an index into it.[^hw36]
−
−A 4-bit CLUT has 16 entries and an 8-bit CLUT has 256 entries. Each entry has the same structure as a 15-bit pixel.[^hw36]
−
−Each sprite can have its own CLUT.[^hw36]
−
−The CBA parameter of a drawing command gives the left coordinate of the CLUT in the frame buffer.[^hw36]
−
−## Polygon Drawing
−
−The GPU draws triangles and rectangles from the screen coordinates of each vertex.[^hw37]
−
−With Gouraud shading each vertex has its own color. The GPU interpolates the colors across the polygon.[^hw37]
−
−Texture mapping applies a 2-dimensional image to a polygon. Texture patterns sit in non-display areas of the frame buffer and are handled like sprite patterns.[^hw37]
−
−## Texture Cache
−
−The texture cache (T-cache) is a high-speed buffer memory between the GPU and the frame buffer. It speeds up drawing.[^hw37]
−
−Each pixel of a texture is likely to be read more than once.[^hw37]
−
−The GPU reads a texture pixel from the T-cache when it is there. Otherwise it reads the frame buffer.[^hw37]
−
−The T-cache holds its data from polygon to polygon. Polygons drawn in a row are faster when their textures fit in the T-cache.[^hw37]
−
−The T-cache is 2K bytes.[^hw38]
−
−The T-cache size in pixels for each pixel mode:
−
−Table: T-cache size
−
−| Pixel Mode | Size (width x length) |
−| --- | --- |
−| 4 bits/pixel | 64 x 64 pixels |
−| 8 | 64 x 32 |
−| 16 | 32 x 32 |
−
## References## References
+[^hw14]: Sony Computer Entertainment Inc. PlayStation Hardware. August 1998. Page 1-4.
[^hw33]: Sony Computer Entertainment Inc. PlayStation Hardware. August 1998. Page 3-3.[^hw33]: Sony Computer Entertainment Inc. PlayStation Hardware. August 1998. Page 3-3.
[^hw34]: Sony Computer Entertainment Inc. PlayStation Hardware. August 1998. Page 3-4, Table 3-1.[^hw34]: Sony Computer Entertainment Inc. PlayStation Hardware. August 1998. Page 3-4, Table 3-1.
Line 157:Line 162:
[^hw37]: Sony Computer Entertainment Inc. PlayStation Hardware. August 1998. Page 3-7.[^hw37]: Sony Computer Entertainment Inc. PlayStation Hardware. August 1998. Page 3-7.
[^hw38]: Sony Computer Entertainment Inc. PlayStation Hardware. August 1998. Page 3-8, Table 3-2.[^hw38]: Sony Computer Entertainment Inc. PlayStation Hardware. August 1998. Page 3-8, Table 3-2.
+[^lo83]: Sony Computer Entertainment Inc. Run-Time Library Overview. January 1999. Page 8-3.
+[^lo84]: Sony Computer Entertainment Inc. Run-Time Library Overview. January 1999. Page 8-4.
+[^lo86]: Sony Computer Entertainment Inc. Run-Time Library Overview. January 1999. Page 8-6.
+[^lo816]: Sony Computer Entertainment Inc. Run-Time Library Overview. January 1999. Page 8-16.
+[^spx-io]: psx-spx. Graphics Processing Unit (GPU), GPU I/O Ports (0x1f801810, 0x1f801814). https://psx-spx.consoledev.net/graphicsprocessingunitgpu/#gpu-io-ports-dma-channels-commands-vram
+[^spx-dma]: psx-spx. Graphics Processing Unit (GPU), GPU-related DMA Channels (DMA2 and DMA6). https://psx-spx.consoledev.net/graphicsprocessingunitgpu/#gpu-io-ports-dma-channels-commands-vram
+[^spx-ot]: psx-spx. Graphics Processing Unit (GPU), Initializing an empty OT (via DMA6). https://psx-spx.consoledev.net/graphicsprocessingunitgpu/#gpu-depth-ordering
+[^spx-08]: psx-spx. Graphics Processing Unit (GPU), GP1(08h) - Display mode. https://psx-spx.consoledev.net/graphicsprocessingunitgpu/#gpu-display-control-commands-gp1
+[^spx-nocash]: psx-spx. Graphics Processing Unit (GPU), GPU Timings, Nocash's original GPU Timings notes. https://psx-spx.consoledev.net/graphicsprocessingunitgpu/#gpu-timings
+[^spx-ver]: psx-spx. Graphics Processing Unit (GPU), Summary of GPU Differences. https://psx-spx.consoledev.net/graphicsprocessingunitgpu/#gpu-versions
+[^spx-flip]: psx-spx. Graphics Processing Unit (GPU), X/Y-Flip and PSone 2 MB VRAM. https://psx-spx.consoledev.net/graphicsprocessingunitgpu/#gpu-versions