32
Status – Week Status – Week 257 257 Victor Moya Victor Moya

Status – Week 257

  • Upload
    anaya

  • View
    22

  • Download
    2

Embed Size (px)

DESCRIPTION

Status – Week 257. Victor Moya. Summary. GPU interface. GPU state. API/Driver State. Driver/CPU Proxy. Command Processor. Imagine. GPU Interface. The GPU chip interfaces with: AGP port. Local (video) memory. - PowerPoint PPT Presentation

Citation preview

Page 1: Status – Week 257

Status – Week Status – Week 257257

Victor MoyaVictor Moya

Page 2: Status – Week 257

SummarySummary

GPU interface.GPU interface. GPU state.GPU state. API/Driver State.API/Driver State. Driver/CPU Proxy.Driver/CPU Proxy. Command Processor.Command Processor. Imagine.Imagine.

Page 3: Status – Week 257

GPU InterfaceGPU Interface The GPU chip interfaces with:The GPU chip interfaces with:

AGP port.AGP port. Local (video) memory.Local (video) memory. Output video signal (as DAC is integrated it is Output video signal (as DAC is integrated it is

already raw digital or analog video signal).already raw digital or analog video signal). Input Video signal (TV/Video capture).Input Video signal (TV/Video capture).

We can ignore the output/input video We can ignore the output/input video signals.signals.

Local memory is only accessed by the GPU Local memory is only accessed by the GPU chip. It can use any standard DRAM chip. It can use any standard DRAM interface.interface.

Page 4: Status – Week 257

GPU InterfaceGPU Interface

Video Input

Video Output

AGP Port Local Memory

Page 5: Status – Week 257

GPU Interface: AGP GPU Interface: AGP InterfaceInterface

GPU is connected through the AGP GPU is connected through the AGP port to the CPU and main memory.port to the CPU and main memory.

The CPU can issue commands, The CPU can issue commands, read and write data from/to the read and write data from/to the GPU through the AGP.GPU through the AGP.

The GPU can read data and write The GPU can read data and write data through the AGP.data through the AGP.

Page 6: Status – Week 257

GPU Interface: AGP GPU Interface: AGP InterfaceInterface

DMA can be used to read/write DMA can be used to read/write from/to the main memory to/from from/to the main memory to/from the video memory through the the video memory through the AGP.AGP.

The GPU can send IRQs to the CPU.The GPU can send IRQs to the CPU. AGP can map main memory pages AGP can map main memory pages

to the GPU (graphic overture).to the GPU (graphic overture).

Page 7: Status – Week 257

GPU Interface: AGP GPU Interface: AGP InterfaceInterface

Intel describes the logical and physical Intel describes the logical and physical (signaling) protocol for the AGP port.(signaling) protocol for the AGP port.

Based in the PCI bus.Based in the PCI bus. Transactions:Transactions:

Read.Read. Write.Write. Control?Control?

Do we need to simulate the AGP Do we need to simulate the AGP protocol?protocol?

Page 8: Status – Week 257

GPU Interface: AGP GPU Interface: AGP InterfaceInterface

What do we need?What do we need? Data written to GPU local memory: Data written to GPU local memory:

texturestextures vertex buffersvertex buffers index buffersindex buffers display lists?display lists?

Data read from GPU local memory:Data read from GPU local memory: textures (render targets).textures (render targets). framebuffer: color + Z + stencil.framebuffer: color + Z + stencil.

Page 9: Status – Week 257

GPU Interface: AGP GPU Interface: AGP InterfaceInterface

What do we need?What do we need? Data read from the main memory:Data read from the main memory:

AGP textures.AGP textures. API/Driver buffers in system memory?API/Driver buffers in system memory?

Data written to the main memory:Data written to the main memory: ????

Page 10: Status – Week 257

GPU Interfaces: AGP GPU Interfaces: AGP InterfaceInterface

What do we need?What do we need? Control:Control:

GPU commands:GPU commands:– Initialize display (resolution, viewport, pixel Initialize display (resolution, viewport, pixel

format …).format …).– Start frame/end frame.Start frame/end frame.– Draw batch (vertex buffer, indexed buffer, …).Draw batch (vertex buffer, indexed buffer, …).

Page 11: Status – Week 257

GPU Interface:AGP GPU Interface:AGP InterfaceInterface

What do we need?What do we need? Control:Control:

GPU state changes:GPU state changes:– Primitive mode.Primitive mode.– Clip planes.Clip planes.– Vertex shader program and vertex shader state.Vertex shader program and vertex shader state.– Rasterization optionsRasterization options– Texture state.Texture state.– Pixel shader program and pixel shader state.Pixel shader program and pixel shader state.– Fragment/Color state (color, Z, Stencil, fog, alpha, Fragment/Color state (color, Z, Stencil, fog, alpha,

scissor, …).scissor, …).– Etc.Etc.

Page 12: Status – Week 257

GPU Interface: AGP GPU Interface: AGP Interface.Interface.

What do we need?What do we need? Signaling (IRQ) to the API/Driver?Signaling (IRQ) to the API/Driver?

End of DMA transfer?End of DMA transfer?

Page 13: Status – Week 257

GPU InterfaceGPU Interface

Simple GPU interface:Simple GPU interface: Write to GPU memory.Write to GPU memory. Read from GPU memory.Read from GPU memory. Write GPU state.Write GPU state. Read GPU state.Read GPU state. Issue GPU command.Issue GPU command. IRQ signal?IRQ signal?

Termination: read/write, command.Termination: read/write, command.

Page 14: Status – Week 257

GPU InterfaceGPU Interface

Write to GPU memory:Write to GPU memory: Address, size, data ->Address, size, data ->

Read from GPU memory:Read from GPU memory: Address, size -> dataAddress, size -> data

Write GPU state:Write GPU state: register, value -> register, value ->

Read GPU state:Read GPU state: register -> valueregister -> value

Issue GPU command:Issue GPU command: command, parameter list ->command, parameter list ->

Page 15: Status – Week 257

GPU InterfaceGPU Interface Registers:Registers:

ViewPort Res X: screen resolution (INT).ViewPort Res X: screen resolution (INT). ViewPort Res Y: screen resolution (INT).ViewPort Res Y: screen resolution (INT). Pixel Mode: bits per pixel, etc (PXFORMAT).Pixel Mode: bits per pixel, etc (PXFORMAT). Color Buffer Address: local memory address for Color Buffer Address: local memory address for

the color buffer (UINT).the color buffer (UINT). Z/Stencil Buffer Address: local memory address Z/Stencil Buffer Address: local memory address

for the Z and Stencil buffers (UINT).for the Z and Stencil buffers (UINT). Texture Memory Address: local memory address Texture Memory Address: local memory address

for the texture buffers (UINT)?for the texture buffers (UINT)? Program Memory Address: local memory address Program Memory Address: local memory address

for the shader program buffers (UINT)?for the shader program buffers (UINT)?

Page 16: Status – Week 257

GPU InterfaceGPU Interface

Registers:Registers: Clear Color: color buffer clear color (QF).Clear Color: color buffer clear color (QF). Primitive Mode: TRIANGLE, TRIANGLE STRIP, Primitive Mode: TRIANGLE, TRIANGLE STRIP,

TRIANGLE FAN, POINT?, LINE?, LINE STRIP?, TRIANGLE FAN, POINT?, LINE?, LINE STRIP?, LINE FAN?.LINE FAN?.

Interpolation (shading?) Mode: FLAT, Interpolation (shading?) Mode: FLAT, LINEAR.LINEAR.

Vertex Shader Program: vertex program Vertex Shader Program: vertex program ID/address (UINT).ID/address (UINT).

Vertex Shader Constants: vertex program Vertex Shader Constants: vertex program constants (QF[], QI []?, B[]?, I[]?).constants (QF[], QI []?, B[]?, I[]?).

Page 17: Status – Week 257

GPU InterfaceGPU Interface Registers:Registers:

Vertex Stream0-n: ID/address to the current Vertex Stream0-n: ID/address to the current vertex buffer stream (UINT).vertex buffer stream (UINT).

Vertex Stream Size0-n: Size of the stream Vertex Stream Size0-n: Size of the stream (UINT).(UINT).

Vertex Stream Stride0-n: stride of the stream Vertex Stream Stride0-n: stride of the stream (UINT).(UINT).

Vertex Stream Mapping0-n: mapping to the Vertex Stream Mapping0-n: mapping to the vertex shader input registers.vertex shader input registers.

Index Stream: ID/address to the current vertex Index Stream: ID/address to the current vertex buffer stream (UINT).buffer stream (UINT).

Index Stream Size: size of the stream (UINT).Index Stream Size: size of the stream (UINT).

Page 18: Status – Week 257

GPU InterfaceGPU Interface Registers:Registers:

Clip Plane Left: left clip plane (FLOAT).Clip Plane Left: left clip plane (FLOAT). Clip Plane Right: right clip plane (FLOAT).Clip Plane Right: right clip plane (FLOAT). Clip Plane Top: top clip plane (FLOAT).Clip Plane Top: top clip plane (FLOAT). Clip Plane Bottom: bottom clip plane (FLOAT).Clip Plane Bottom: bottom clip plane (FLOAT). Clip Plane Near: near clip plane (FLOAT).Clip Plane Near: near clip plane (FLOAT). Clip Plane Far: far clip plane (FLOAT).Clip Plane Far: far clip plane (FLOAT). User Clip Planes0-n: User volume clip planes User Clip Planes0-n: User volume clip planes

(QF).(QF). Culling Mode: NONE, FRONT, BACK, Culling Mode: NONE, FRONT, BACK,

FRONT_BACK.FRONT_BACK.

Page 19: Status – Week 257

GPU InterfaceGPU Interface

Registers:Registers: Multisampling related registers (?).Multisampling related registers (?). Supersampling related registers (?).Supersampling related registers (?). Point related registers (?).Point related registers (?). Line related registers (?).Line related registers (?). Zbias/Depth Offset: ?Zbias/Depth Offset: ?

Page 20: Status – Week 257

GPU InterfaceGPU Interface

Registers:Registers: Texture related registers (?).Texture related registers (?). Pxel shader related state:Pxel shader related state:

Pixel shader program: pixel shader Pixel shader program: pixel shader program ID/address (UINT).program ID/address (UINT).

Pixel shader constants: pixel shader Pixel shader constants: pixel shader constant bank (QF[]).constant bank (QF[]).

Fog related registers (?).Fog related registers (?).

Page 21: Status – Week 257

GPU InterfaceGPU Interface

Registers:Registers: Scissor test related registers (?).Scissor test related registers (?). Alpha test related registers (?).Alpha test related registers (?). Stencil test related registers (?).Stencil test related registers (?). Depth test related registers (?).Depth test related registers (?). Blending related registers (?).Blending related registers (?). Others (?).Others (?).

Page 22: Status – Week 257

GPU InterfaceGPU Interface Commands:Commands:

Reset: reset of the GPU.Reset: reset of the GPU. No parameters:No parameters:

Clear: clears all buffers?Clear: clears all buffers? No parameters.No parameters.

SwapBuffer: changes the display (front) buffer.SwapBuffer: changes the display (front) buffer. No parameters?.No parameters?.

DrawBatch: draws a vertex batch (array).DrawBatch: draws a vertex batch (array). No parameters (if the info is in the GPU registers).No parameters (if the info is in the GPU registers).

DrawIndexedBatch: draw an indexed vertex DrawIndexedBatch: draw an indexed vertex batch.batch.

No parameters (if the info is in the GPU registers).No parameters (if the info is in the GPU registers).

Page 23: Status – Week 257

GPU InterfaceGPU Interface

Commands:Commands: Blit: local memory to local memory Blit: local memory to local memory

copy.copy. Source addressSource address Target address.Target address.

Page 24: Status – Week 257

GPU StateGPU State

GPU control registers.GPU control registers. GPU status registers?GPU status registers?

Queries.Queries. End Of Frame.End Of Frame. Occlusion queries: number of pixels Occlusion queries: number of pixels

drawn.drawn.

Page 25: Status – Week 257

GPU StateGPU State

Rendering mode:Rendering mode: IMR: Immediate Mode Renderer.IMR: Immediate Mode Renderer.

Only stores current state (immediate).Only stores current state (immediate). Deferred Rendering.Deferred Rendering.

Must store all state changes for the next frame.Must store all state changes for the next frame. Must have stored the current (drawing) frame.Must have stored the current (drawing) frame. Perhaps some permanent state (resolution?).Perhaps some permanent state (resolution?). Storage:Storage:

– Local memory (Bin).Local memory (Bin).– System memory (driver).System memory (driver).

Page 26: Status – Week 257

API/Driver StateAPI/Driver State

OpenGL: OpenGL specification has OpenGL: OpenGL specification has an appendix with all the OpenGL an appendix with all the OpenGL state variables.state variables.

DirectX: would need research. DirectX: would need research. State based in COM objects.State based in COM objects.

Page 27: Status – Week 257

API/Driver emulationAPI/Driver emulation

Must translate API calls (OpenGL) Must translate API calls (OpenGL) and API objects (DirectX) to GPU and API objects (DirectX) to GPU commands.commands.

Read a trace file and translate to Read a trace file and translate to GPU commands (static).GPU commands (static).

Replace system API libraries (dlls, Replace system API libraries (dlls, shared libs) and send commands shared libs) and send commands to a GPU simulator (dynamic).to a GPU simulator (dynamic).

Page 28: Status – Week 257

API/Driver emulationAPI/Driver emulation

First prototype for GLTrace traces:First prototype for GLTrace traces: Set initial state (resolution, etc).Set initial state (resolution, etc). Calculate the projection and model Calculate the projection and model

view matrix (multiplication).view matrix (multiplication). Store the combinend matrix Store the combinend matrix

(multiplied) in the vertex shader (multiplied) in the vertex shader constant memory.constant memory.

Store the default transformation vertex Store the default transformation vertex shader program (vertex x matrix).shader program (vertex x matrix).

Translate glRectf into two triangles.Translate glRectf into two triangles.

Page 29: Status – Week 257

API/Driver EmulationAPI/Driver Emulation

Store vertex and vertex parameters Store vertex and vertex parameters between glBegin and glEnd functions.between glBegin and glEnd functions.

Issue vertex and vertex parameters to Issue vertex and vertex parameters to the GPU.the GPU.

Set other rasterization and fragment Set other rasterization and fragment parameters for the OpenGL stub.parameters for the OpenGL stub.

Page 30: Status – Week 257

API/Driver EmulationAPI/Driver Emulation

Future development:Future development: Add lightning and material state: Add lightning and material state:

store in vertex shader constant bank.store in vertex shader constant bank. Create lightning vertex program.Create lightning vertex program. Support DrawElements and other Support DrawElements and other

vertex array and index based vertex array and index based rendering modes.rendering modes.

Page 31: Status – Week 257

Command ProcessorCommand Processor

Stores all or part of the GPU state.Stores all or part of the GPU state. GPU state can be replicated in the GPU state can be replicated in the

different sections of the GPU different sections of the GPU (geometry, rasterization, fragment).(geometry, rasterization, fragment).

Receives commands from the main Receives commands from the main system (API/driver).system (API/driver).

Interprets and issues those Interprets and issues those commands to the GPU units.commands to the GPU units.

Page 32: Status – Week 257

ImagineImagine

‘‘Computer Graphics on a Stream Computer Graphics on a Stream Architecture’, John Douglas Owens, Architecture’, John Douglas Owens, PhD dissertation.PhD dissertation.

Not read yet either.Not read yet either.