SiS 315 Graphics Engine Introduction to some capabilities of graphics accelerator hardware.

Slides:



Advertisements
Similar presentations
Linux device-driver issues
Advertisements

Lecture 101 Lecture 10: Kernel Modules and Device Drivers ECE 412: Microcomputer Laboratory.
Device Drivers. Linux Device Drivers Linux supports three types of hardware device: character, block and network –character devices: R/W without buffering.
Lecture for Lab 3, Exp1 of EE505 (Developing Device Driver) T.A. Chulmin Kim CoreLab. Mar, 11, 2011 [XenSchedulerPaper_Hotcloud-commits] r21 - /
Computer System Laboratory
Using VMX within Linux We explore the feasibility of executing ROM-BIOS code within the Linux x86_64 kernel.
Linux ‘Demand-Paging’
CS 686: Programming SuperVGA Graphics Devices Introduction: An exercise in working with graphics file formats.
Creating a device-file node An introduction to some privileged Linux system-calls (needed for an upcoming programming exercise)
Computer Science 635 Advanced Systems Programming Fall 2007 Professor Allan Cruse.
The ‘system-call’ interface We see how an application program can invoke privileged kernel services.
Sleeping and waking An introduction to character-mode device-driver modules for Linux.
CMPT 300: Operating Systems I Dr. Mohamed Hefeeda
The Linux PCI Interface An introduction to the PCI configuration space registers.
IA32 Paging Scheme Introduction to the Pentium’s support for “virtual” memory.
52 Advanced Operating Systems Writing Device Drivers.
Page-Faults in Linux How can we study the handling of page-fault exceptions?
Character Driver Issues Implementing ‘/dev/physmem’
Timeout for some demos An instructive look at how the Linux Operating System sets up system data-structures.
Standard C Libraries Application Programmming Interface to System-Calls.
Embedded Systems Programming Writing Device Drivers.
The ‘ioctl’ driver-function On implementing ‘show’ and ‘hide’ for the SiS 315 hardware cursor.
How to make a pseudo-file As a follow-up to our first lab, we examine the steps needed to create our own ‘/proc’ file.
Phones OFF Please Operating System Introduction Parminder Singh Kang Home:
Graphics acceleration An example of line-drawing by the ATI Radeon’s 2D graphics engine.
Direct I/O Programming An introduction to the Pentium’s mechanism for programming peripheral hardware components.
Embedded System Programming Introduction to Device Drivers.
CS 635 Advanced Systems Programming Spring 2005 Professor Allan B. Cruse University of San Francisco.
The ‘ioctl’ driver-function On implementing a way to query and modify our UART’s baudrate via the ‘device-file’ abstraction.
A device-driver for Video Memory Introduction to basic principles of the PC’s graphics display.
The ‘mmap()’ method Adding the ‘mmap()’ capability to our ‘vram.c’ device-driver.
Operating Systems CS208. What is Operating System? It is a program. It is the first piece of software to run after the system boots. It coordinates the.
Linux Device Drivers Inroduction. What’s a ‘device-driver’? A special kind of computer program Intended to control a peripheral device Needs to execute.
VGA System Services How to use Linux’s ‘vm86()’ system-call to access the video ROM-BIOS functions.
OPERATING SYSTEMS Introduction
SiS 315 An introductory exploration of features of the SVGA graphics processor used in our classroom’s workstations.
What’s needed to transmit? A look at the minimum steps required for programming our anchor nic’s to send packets.
Notes for Lab 10 On implementing ‘show’ and ‘hide’ for the SiS 315 hardware cursor.
Copyright Arshi Khan1 System Programming Instructor Arshi Khan.
I/O Tanenbaum, ch. 5 p. 329 – 427 Silberschatz, ch. 13 p
An Introduction to Device Drivers Sarah Diesburg COP 5641 / CIS 4930.
Loadable Kernel Modules Dzintars Lepešs The University of Latvia.
System Calls 1.
WINDOWS SERVICES. Introduction You often need programs that run continuously in the background Examples: – servers –Print spooler You often need.
ANDROID Presented By Mastan Vali.SK. © artesis 2008 | 2 1. Introduction 2. Platform 3. Software development 4. Advantages Main topics.
Sogang University Advanced Operating Systems (Linux Module Programming) Sang Gue Oh, Ph.D.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 2: Operating-System Structures.
CE Operating Systems Lecture 3 Overview of OS functions and structure.
Operating System What is an Operating System? A program that acts as an intermediary between a user of a computer and the computer hardware. An operating.
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Memory: Relocation.
 Virtual machine systems: simulators for multiple copies of a machine on itself.  Virtual machine (VM): the simulated machine.  Virtual machine monitor.
Linux Kernel Management. Module 9 – Kernel Administration ♦ Overview The innermost layer of Linux operating system is the kernel, which is a thin layer.
Digression on r/w ‘/proc’ files An application of kernel module programming to Super VGA graphics device control.
An Introduction to Device Drivers Ted Baker  Andy Wang COP 5641 / CIS 4930.
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.
CSC414 “Introduction to UNIX/ Linux” Lecture 2. Schedule 1. Introduction to Unix/ Linux 2. Kernel Structure and Device Drivers. 3. System and Storage.
Lab 12 Department of Computer Science and Information Engineering National Taiwan University Lab12 – Driver 2014/12/16 1 /21.
COMP 3438 – Part I - Lecture 5 Character Device Drivers
Silberschatz, Galvin and Gagne ©2011 Operating System Concepts Essentials – 8 th Edition Chapter 2: The Linux System Part 1.
CSNB334 Advanced Operating Systems 3. Kernel Structure and Organization Lecturer: Abdul Rahim Ahmad.
Linux Details: Device Drivers
Linux Kernel Module Programming
Computer System Laboratory
CS 3305 System Calls Lecture 7.
Introduction to the Kernel and Device Drivers
An Introduction to Device Drivers
Chapter 2: The Linux System Part 1
Linux Details: Device Drivers
Implementation of Embedded OS
Computer System Laboratory
Presentation transcript:

SiS 315 Graphics Engine Introduction to some capabilities of graphics accelerator hardware

SVGA incompatibilities SVGA manufacturers have different ways of implementing their accelerator features SiS provides 2D and 3D graphics engines Access is via memory-mapped i/o ports This requires a new Linux device-driver, to allow mapping the io-ports into user-space A suitable driver is our ‘engine2d.c’ It only works with SiS graphics hardware

SiS policy SiS officials say it is not company policy to provide individuals with programming info But some programming info is available in ‘unofficial’ sources (e.g., in-line comments by programmers who wrote ‘open source’ device-drivers for Linux XFree86 systems) Not everything is fully explained, though So a lot of ‘trial-and-error’ is necessary!

Where to look for info The source-code for drivers distributed with the Linux kernel can be found in: /usr/src/local/linux/drivers/video/sis Recent versions of the SVGALIB package have some SiS-specific code you can view There is also a website maintained by the author of the SiS driver for Linux (Thomas Winischhofer):

Linux kernel modules Linux permits installing new kernel code at runtime (i.e., without recompiling kernel) A system administrator can install/remove kernel modules, and may grant users this same privilege (by adjusting permissions on the ‘insmod’ and ‘rmmod’ commands) Modules are written in the C language (not C++) and include special header-files that are distributed with the kernel source-code

Module requirements Must define __KERNEL__ and MODULE before any #include statements Must have: #include Maybe others: e.g., #include Must have these two public functions: int init_module( void ); void cleanup_module( void ); Usually device-specific function(s), too

Driver-Module Structure init_module() cleanup_module() MODULE_LICENSE struct file_operations write() lseek() mmap() read() static data objects #define #include typedef // filename and module abstract This is the device-driver core These are for module mgmt

Our ‘engine2d.c’ module Our module only needs one extra function: int my_mmap( ); Also needs a ‘struct file_operations’ object: struct file_operations my_fops; The ‘init_module()’ function will install that structure-object in kernel-space, together with executable code which it references The ‘cleanup_module()’ function removes that code and data after we’re finished

How it works kernel-spaceuser-space application program runtime library syscall handler device-driver module int $0x80 iret mmap ret call ret

Pentium’s Page-Tables Our driver’s ‘mmap’ method calls a kernel procedure that knows how to setup some new entries in the CPU’s page-directory and page-table data-structures which give the effect of mapping the GPU’s i/o-ports into an application’s virtual address-space Then the program can read or write these i/o-ports as if they were memory-locations

The PCI Interface The graphics hardware connects with the CPU using the AGP bus, conforming to a standard PCI-bus programming interface Linux kernel functions can be called from our ‘init_module()’ to query the GPU chip –Identify the chip’s make and model –Get physical address for its i/o-memory –Determine the length of the i/o-memory

Linux device-nodes Linux treats devices as if they were files We must create a device-file for our GPU Device-files normally go in ‘/dev’ directory We invent a filename for our device-file We pick an unused device id-number A system administrator creates the file: root# mknod /dev/sismmio c root# chmod a+rw /dev/sismmio

Our ‘sisaccel.cpp’ demo We have written a short demo-program It uses the SiS 315’s 2D graphics engine It fills some rectangles with a solid color It also shows how to draw a line-segment These operations could be done, as we know, with software algorithms – but it’s faster to let the hardware do it instead You are invited to experiment further!

#include “sisaccel.h” This header defines symbolic names for some of the 2D engine’s i/o addresses Accelerator commands involve writing the values for various parameters to these i/o port-addresses, concluding with a value that encodes a desired engine ‘command’ Some Extended Sequencer registers must be initialized beforehand, to enable engine

Truecolor Graphics We used VESA graphics mode 0x413B Screen-resolution is 800x600 Pixels are 32-bits in size (‘Truecolor’) Recall the Truecolor pixel-format: Alpha channel byte0byte3 byte2byte1

Makefile In order to compile the ‘engine2d.c’ driver, we recommend using the ‘Makefile’ on our class website (copy it to your directory): $ make engine2d.o Be sure you compile it BEFORE you try to run the ‘gpuaccel.cpp’ demo-program Don’t forget that your IOPL needs to be 3 e.g., run the ‘iopl3’ program first