SiS315GraphicsEngine_第1頁
SiS315GraphicsEngine_第2頁
SiS315GraphicsEngine_第3頁
SiS315GraphicsEngine_第4頁
SiS315GraphicsEngine_第5頁
已閱讀5頁,還剩11頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)

文檔簡介

1、SiS 315 Graphics Engine Introduction to some capabilities of graphics accelerator hardware1SVGA incompatibilitiesSVGA manufacturers have different ways of implementing their accelerator featuresSiS provides 2D and 3D graphics enginesAccess is via memory-mapped i/o portsThis requires a new Linux devi

2、ce-driver, to allow mapping the io-ports into user-spaceA suitable driver is our engine2d.c It only works with SiS graphics hardware2SiS policySiS officials say it is not company policy to provide individuals with programming infoBut some programming info is available in unofficial sources (e.g., in

3、-line comments by programmers who wrote open source device-drivers for Linux XFree86 systems)Not everything is fully explained, thoughSo a lot of trial-and-error is necessary!3Where to look for infoThe source-code for drivers distributed with the Linux kernel can be found in:/usr/src/local/linux/dri

4、vers/video/sisRecent versions of the SVGALIB package have some SiS-specific code you can viewThere is also a website maintained by the author of the SiS driver for Linux (Thomas Winischhofer): 4Linux kernel modulesLinux permits installing new kernel code at runtime (i.e., without recompiling kernel)

5、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 5Module requir

6、ementsMust define _KERNEL_ and MODULE before any #include statementsMust 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), too6Driver-Module Structureinit_module()cleanup_module()M

7、ODULE_LICENSEstruct write()lseek()mmap()read()static data objects#define -#include -typedef -/ and module abstractThis is the device-driver coreThese are for module mgmt7Our engine2d.c moduleOur module only needs one extra function:int my_mmap( );Also needs a struct object:struct my_fops;The init_mo

8、dule() function will install that structure-object in kernel-space, together with executable code which it referencesThe cleanup_module() function removes that code and data after were finished8How it workskernel-spaceuser-spaceapplicationprogramruntimelibrarysyscallhandlerdevice-drivermoduleint $0

9、x80iretmmapretcallret9Pentiums TablesOur drivers mmap method calls a kernel procedure that knows how to setup some new entries in the CPUs directory and table data-structures which give the effect of mapping the GPUs i/o-ports into an applications virtual address-spaceThen the program can read or wr

10、ite these i/o-ports as if they were memory-locations10The PCI InterfaceThe graphics hardware connects with the CPU using the AGP bus, conforming to a standard PCI-bus programming interfaceLinux kernel functions can be called from our init_module() to query the GPU chipIdentify the chips make and mod

11、el Get physical address for its i/o-memoryDetermine the length of the i/o-memory 11Linux device-nodesLinux treats devices as if they were filesWe must create a device- our GPU Device-files normally go in /dev directoryWe invent a for our device-fileWe pick an unused device id-numberA system administ

12、rator creates the file:root# mknod /dev/sismmio c 101 0root# chmod a+rw /dev/sismmio12Our sisaccel.cpp demoWe have written a short demo-program It uses the SiS 315s 2D graphics engine It fills some rectangles with a solid colorIt also shows how to draw a line-segmentThese operations could be done, a

13、s we know, with software algorithms but its faster to let the hardware do it insteadYou are invited to experiment further!13#include “sisaccel.h”This header defines symbolic names for some of the 2D engines i/o addresses Accelerator commands involve writing the values for various parameters to these

14、 i/o port-addresses, concluding with a value that encodes a desired engine commandSome Extended Sequencer registers must be initialized beforehand, to enable engine14Truecolor GraphicsWe used VESA graphics mode 0 x413BScreen-resolution is 800 x600Pixels are 32-bits in size (Truecolor)Recall the Truecolor pixel-format:Alpha channelbyte0byte3byte2byte115MakefileIn order to compile the engine2d.c driver, we recommend using t

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
  • 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論