Graphics acceleration An example of line-drawing by the ATI Radeon’s 2D graphics engine.

Slides:



Advertisements
Similar presentations
1 (Review of Prerequisite Material). Processes are an abstraction of the operation of computers. So, to understand operating systems, one must have a.
Advertisements

Using VMX within Linux We explore the feasibility of executing ROM-BIOS code within the Linux x86_64 kernel.
The ATA/IDE Interface Can we write a character-mode device driver for the hard disk?
The Operating System. What is an Operating System? The program that is loaded first and manages the hardware resources like main memory, backing storage.
VGA Text Mode An introduction to font selection and to reprogramming of the Character Generator ram.
I/O Unit.
Khaled A. Al-Utaibi  Computers are Every Where  What is Computer Engineering?  Design Levels  Computer Engineering Fields  What.
CS4315A. Berrached:CMS:UHD1 Operating Systems and Computer Organization Chapter 4.
BIOS (Basic Input Output Service) Contains system data used by the ROM BIOS service routines. Serves as a standardized communication interface between.
CS-334: Computer Architecture
Avishai Wool lecture Introduction to Systems Programming Lecture 8 Input-Output.
The Linux PCI Interface An introduction to the PCI configuration space registers.
SiS 315 Graphics Engine Introduction to some capabilities of graphics accelerator hardware.
1 Hardware and Software Architecture Chapter 2 n The Intel Processor Architecture n History of PC Memory Usage (Real Mode)
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 2: Computer-System Structures Computer System Operation I/O Structure Storage.
Direct I/O Programming An introduction to the Pentium’s mechanism for programming peripheral hardware components.
1 Computer System Overview OS-1 Course AA
Graphics Bitmaps Drawing characters glyphs and multicolor patterns.
Computer System Overview
Chapter 7 Interupts DMA Channels Context Switching.
How to do ‘page-flipping’ The steps needed when revising our ‘wfmodel1.cpp’ prototype to achieve ‘smooth’ animation.
Understanding POST and ROM-BIOS service functions Numerous low-level services are available to real-mode programs (include boot-loaders)
Cs238 Lecture 3 Operating System Structures Dr. Alan R. Davis.
A device-driver for Video Memory Introduction to basic principles of the PC’s graphics display.
SiS 315 An introductory exploration of features of the SVGA graphics processor used in our classroom’s workstations.
Chapter 13: I/O Systems I/O Hardware Application I/O Interface
Presentation by David Fong
1 CSC 2405: Computer Systems II Spring 2012 Dr. Tom Way.
Input/Output. Input/Output Problems Wide variety of peripherals —Delivering different amounts of data —At different speeds —In different formats All slower.
Chapter 7 Input/Output Luisa Botero Santiago Del Portillo Ivan Vega.
Computer Organization
System Calls 1.
Chapter 10: Input / Output Devices Dr Mohamed Menacer Taibah University
1 Computer System Overview Chapter 1. 2 n An Operating System makes the computing power available to users by controlling the hardware n Let us review.
CSC 322 Operating Systems Concepts Lecture - 25: by Ahmed Mumtaz Mustehsan Special Thanks To: Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall,
ECE291 Computer Engineering II Lecture 9 Josh Potts University of Illinois at Urbana- Champaign.
MICROPROCESSOR INPUT/OUTPUT
1. Introduction 2. Methods for I/O Operations 3. Buses 4. Liquid Crystal Displays 5. Other Types of Displays 6. Graphics Adapters 7. Optical Discs 10/01/20151Input/Output.
Recall: Three I/O Methods Synchronous: Wait for I/O operation to complete. Asynchronous: Post I/O request and switch to other work. DMA (Direct Memory.
Laface Operating System Design Booting a PC to run a kernel from Low memory VGA display.
2009 Sep 10SYSC Dept. Systems and Computer Engineering, Carleton University F09. SYSC2001-Ch7.ppt 1 Chapter 7 Input/Output 7.1 External Devices 7.2.
Accessing I/O Devices Processor Memory BUS I/O Device 1 I/O Device 2.
CH10 Input/Output DDDData Transfer EEEExternal Devices IIII/O Modules PPPProgrammed I/O IIIInterrupt-Driven I/O DDDDirect Memory.
Fall 2000M.B. Ibáñez Lecture 25 I/O Systems. Fall 2000M.B. Ibáñez Categories of I/O Devices Human readable –used to communicate with the user –video display.
Digression on r/w ‘/proc’ files An application of kernel module programming to Super VGA graphics device control.
The computer system’s I/O architecture is its interface to the outside world. This architecture provides a systematic means of controlling interaction.
CE Operating Systems Lecture 2 Low level hardware support for operating systems.
1 Computer Systems II Introduction to Processes. 2 First Two Major Computer System Evolution Steps Led to the idea of multiprogramming (multiple concurrent.
Chapter 13 – I/O Systems (Pgs ). Devices  Two conflicting properties A. Growing uniformity in interfaces (both h/w and s/w): e.g., USB, TWAIN.
CE Operating Systems Lecture 2 Low level hardware support for operating systems.
Input/Output Problems Wide variety of peripherals —Delivering different amounts of data —At different speeds —In different formats All slower than CPU.
IT3002 Computer Architecture
بسم الله الرحمن الرحيم MEMORY AND I/O.
An operating system (OS) is a collection of system programs that together control the operation of a computer system.
CPIT Program Execution. Today, general-purpose computers use a set of instructions called a program to process data. A computer executes the.
Homework Reading Machine Projects Labs
Computer Organization & Assembly Language Chapter 3
CS 286 Computer Organization and Architecture
CS703 - Advanced Operating Systems
McGraw-Hill Technology Education
Operating Systems Chapter 5: Input/Output Management
McGraw-Hill Technology Education
McGraw-Hill Technology Education
Chapter 13: I/O Systems “The two main jobs of a computer are I/O and [CPU] processing. In many cases, the main job is I/O, and the [CPU] processing is.
Presentation transcript:

Graphics acceleration An example of line-drawing by the ATI Radeon’s 2D graphics engine

Bresenham’s algorithm Recall this iterative algorithm for doing a ‘scanline conversion’ for a straight line It required five parameters: –The starting endpoint coordinates: (X0,Y0) –The ending endpoint coordinates: (X1,Y1) –The foreground color for the solid-color line It begins by initializing a decision-variable – errorTerm = 2*deltaY - deltaX;

Algorithm’s main loop for (int y = Y0, x = X0; x <= X1; x++) { drawPixel( x, y, color ); if ( errorTerm >= 0 ) { errorTerm += 2*delY; } else { y += 1; errorTerm += 2*(delY – delX); } }

How much work for CPU? Example: To draw the longest visible line (in 1024x768 graphics mode) will require approximately 10,000 CPU instructions The loop gets executed once for each of the 1024 horizontal pixels, and each pass through that loop requires about ten CPU operations: moves, compares, branches, adds and subtracts, plus the function-calls

Is acceleration possible? The IBM 8514/A appeared in late 1980s It could do line-drawing (and some other common graphics operations) if just a few parameters were supplied So instead of requiring the CPU to do ten thousand operations, the CPU could do maybe ten operations, then let the 8514/A graphics engine do the rest of the work!

8514/A Block Diagram VRAM memory ROM RAMDAC Display Monitor PC Bus Interface LUT DAC Display processor Drawing engine CRT controller PC Bus Graphics processor CPU

ATI improved on IBM’s 8514/A Various OEM vendors soon introduced their own graphics accelerator designs Because IBM had not released details of its design, others had to create their own programming interfaces – all are different Early PC graphics software was therefore NOT portable between hardware platforms

How does X300 draw lines? To demonstrate the line-drawing ability of our classroom’s Radeon X300 graphics processors, we wrote ‘drawline.cpp’ demo We did not have access to ATI’s official Radeon programming manual, but we had several such manuals from other vendors, and we found ‘clues’ in source-code files for the Linux Radeon device-driver

Programming concepts Our demo-program must first verify that it is running on a Radeon-equipped machine It must determine how it can communicate with the Radeon’s graphics accelerator Normal VGA registers are at ‘standard’ I/O port-addresses, but the graphics engine is outside the scope of established standards

Peripheral Component Interconnect An industry committee (led by Intel) has established a standard mechanism that PC device-drivers can use to identify the peripheral devices that a workstation has, and their mechanisms for communication To simplify the Pre-Boot Execution code, modern PC’s provide ROM-BIOS routines that can be called to identify peripherals

PCI Configuration Space ADDITIONAL PCI CONFIGURATION DATA Each peripheral device has a set of nonvolatile memory-locations which store information about that device using a standard layout PCI CONFIGURATION HEADER 1024 bytes 256 bytes This device-information is accessed via I/O Port-Addresses 0x3C8-0x3CF

PCI Configuration Header BASE-ADDRESS RESOURCE 0 BASE-ADDRESS RESOURCE 1 BASE-ADDRESS RESOURCE 2 BASE-ADDRESS RESOURCE 3 DEVICE ID VENDOR ID VENDOR-ID = 0x1002: Advanced Technologies, Incorporated DEVICE-ID = 0x5B60: ATI Radeon X300 graphics processor BASE-ADDRESS for RESOURCE 1 is the 2D engine’s I/O port Sixteen longword entries (256 bytes) Our ‘findsvga.cpp’ utility will show you the PCI Configuration Space for any peripheral devices of Class 0x (i.e., VGA-compatible graphics cards)

Interface to PCI BIOS Our ‘dosio.c’ device-driver (and ‘int86.cpp’ companion code) allow us access to BIOS The PCI BIOS services are accessible (in the Pentium’s virtual-8086 mode) using function 0xB1 of software interrupt 0x1A There are several subfunctions – you can find documentation online – for example, Professor Ralf Brown’s Interrupt List

return_radeon_port_address(); Our demo invokes these PCI ROM-BIOS subfunctions to discover which I/O Port our Radeon’s 2D graphics engine uses –Subfunction 1: Detect BIOS presence –Subfunction 3: Find Device in a Class –Subfunction A: Read Configuration Dword Configuration Dword at offset 0x14 holds I/O Port-Address for 2D graphics engine

The ATI I/O Port Interface MM_INDEXMM_DATA iobase + 0iobase + 4 You output a register’s index to the iobase + 0 address Then you have read or write access to that register at the iobase + 4 address

Many 2D engine registers! You can peruse the ‘radeon.h’ header-file to see names and register-index numbers for the Radeon 2D graphics accelerator You could also write a programming loop to input the contents from various offsets and thereby get some idea of which ones appear to hold ‘live’ values (i.e.,hundreds!) Only a small number used in line-drawing

Main Line-Drawing registers DP_GUI_MASTER_CNTL DP_BRUSH_FRGD_COLOR DP_BRUSH_BKGD_COLOR DP_WRITE_MSK DST_LINE_START DST_LINE_END

Others that affect drawing RB2D_DSTCACHE_MODE MC_FB_LOCATION DEFAULT_PITCH_OFFSET DST_PITCH_OFFSET SRC_PITCH_OFFSET DP_DATATYPE DEFAULT_SC_TOP_LEFT DEFAULT_SC_BOTTOM_RIGHT

CPU/GPU synchronization Intel Pentium CPU ATI Radeon GPU When CPU off-loads the work of drawing lines (and doing other common Graphical operations) tp the Graphics Processing Unit, then this frees up the CPU to execute other instructions – but it opens up the possibility that the CPU will send more drawing commands to the GPU, even before the GPU is finished doing earlier commands. Some mechanism is needed to prevent the GPU from becoming overwhelmed by work the CPU sends it. Solution is a FIFO for pending commands, plus a Status Register

Engine has 64 FIFO slots Before the CPU initiates a new drawing command, it checks to see if there are enough free slots in the command FIFO for storing that command’s parameters The CPU can do ‘busy-waiting’ until the GPU reports that enough FIFO slots are ready to accept new command-arguments An alternative is ‘interrupt-driven’ drawing

Testing ‘drawline.cpp’ We developed our ‘drawline.cpp’ demo on a Radeon 7000 graphics card, then tested it on a newer and faster Radeon 9250 Our code worked fine Tonight we shall try it on the Radeon X300 If these various models of the Radeon are fully compatible with one another, we can expect our demo to work fine on the X300

Hardware changes? But if any significant differences exist in the various Radeon design-generations, then we may discover that our ‘drawline’ fails to perform properly on an X300 We would then have to explore the ways in which Radeon designs have changed, and try to devise ‘fixes’ for any flaws that we have found in our software application

In-class exercises Try running the ‘drawline.cpp’ application on our classroom or CS Lab workstation: maybe it works fine, maybe it doesn’t Look at the source-code files for the Linux ‘open-source’ ATI Radeon device-driver If our ‘drawline’ work ok, see if you can add code that programs the engine to fill rectangles or copy screen-areas; or, if ‘drawline’ fails, see if you can devise a ‘fix’