version 2.0 preliminary · pmc and pci graphics version 2.0 preliminary 10 april 2001 peritek...

83
PMC and PCI Graphics Version 2.0 PRELIMINARY 10 April 2001 Peritek Corporation 5550 Redwood Road Oakland, CA 94619 (510) 531-6500 FAX (510) 530-8563 email: [email protected] web: http://www.peritek.com

Upload: others

Post on 23-Jul-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Version 2.0 PRELIMINARY · PMC and PCI Graphics Version 2.0 PRELIMINARY 10 April 2001 Peritek Corporation 5550 Redwood Road Oakland, CA 94619 (510) 531-6500 FAX (510) 530-8563

PMC and PCI Graphics

Version 2.0

PRELIMINARY

10 April 2001

Peritek Corporation 5550 Redwood Road Oakland, CA 94619

(510) 531-6500

FAX (510) 530-8563 email: [email protected] web: http://www.peritek.com

Page 2: Version 2.0 PRELIMINARY · PMC and PCI Graphics Version 2.0 PRELIMINARY 10 April 2001 Peritek Corporation 5550 Redwood Road Oakland, CA 94619 (510) 531-6500 FAX (510) 530-8563

2

Page 3: Version 2.0 PRELIMINARY · PMC and PCI Graphics Version 2.0 PRELIMINARY 10 April 2001 Peritek Corporation 5550 Redwood Road Oakland, CA 94619 (510) 531-6500 FAX (510) 530-8563

3

Notices

Information contained in this manual is disclosed in confidence and may not be

duplicated in full or in part by any person without prior approval of Peritek Corporation. Its sole purpose is to provide detailed documentation to effectively install and operate Peritek equipment. The use of this document for any other purpose is specifically prohibited.

The information in this document is subject to change without notice. The specifications of GLP and other components described in this manual are subject to change without notice. Peritek Corporation assumes no responsibility for any errors or omissions that may occur in this manual.

Peritek Corporation assumes no responsibility for the use or reliability of software or hardware that is not supplied by Peritek, or which has not been installed in accordance with this manual.

GLP and Peritek are trademarks of Peritek Corporation. LynxOS, Solaris, and VxWorks are registered trademarks of Lynx, Sun, and Wind River, respectively. OpenGL is a registered trademark of Silicon Graphics, Inc.

Copyright © 2001 by Peritek Corporation

Page 4: Version 2.0 PRELIMINARY · PMC and PCI Graphics Version 2.0 PRELIMINARY 10 April 2001 Peritek Corporation 5550 Redwood Road Oakland, CA 94619 (510) 531-6500 FAX (510) 530-8563

Table of Contents 1 Introduction ................................................................................................................ 9

1.1 Overview of the Graphics Library Package (GLP)................................................ 9 1.2 Using this manual ................................................................................................ 11 1.3 Getting started...................................................................................................... 11

2 Installation and System-specific Information ........................................................ 18 2.1 Basic installation instructions .............................................................................. 18 2.2 LynxOS PowerPC................................................................................................ 18

Loading drivers for LynxOS 3.0 and 2.5.1................................................................. 18 Loading drivers for LynxOS 3.1 ................................................................................ 19 Running precompiled Peritek demos on LynxOS ...................................................... 20

2.3 Solaris SPARC..................................................................................................... 22 Installing the VCQ-M or VFG-M driver on Solaris SPARC ..................................... 22 Running precompiled Peritek demos on Solaris......................................................... 23

2.4 Tornado (VxWorks) PowerPC............................................................................. 24 Configuring the VxWorks BSP .................................................................................. 25 Determining the Bus Number and Device Number of the PMC slot ......................... 26 Configuring the Peritek Graphics Card’s PCI header ................................................ 27 Checking the PCI configuration headers .................................................................... 29 Running demos on VxWorks PowerPC ..................................................................... 30

3 The libPK library ..................................................................................................... 36 3.1 Data Structures..................................................................................................... 36

Pk_board..................................................................................................................... 36 Pk_colormap............................................................................................................... 36 Pk_drawable ............................................................................................................... 36 Pk_font ....................................................................................................................... 37 Pk_glyph_info ............................................................................................................ 37 Pk_pixelinfo ............................................................................................................... 38 Pk_video_input_device .............................................................................................. 39 Pk_video_capture_info............................................................................................... 40

3.2 Pk_board Methods ............................................................................................... 40 pk_create_board.......................................................................................................... 40 pk_get_boardinfo........................................................................................................ 40 pk_set_framebuffer..................................................................................................... 40 pk_get_videosize ........................................................................................................ 41 pk_get_drawable......................................................................................................... 41 pk_get_errorcode ........................................................................................................ 42 pk_set_errorcode ........................................................................................................ 42 pk_create_drawable .................................................................................................... 42 pk_get_cursordrawable............................................................................................... 42 pk_set_cursorhotspot .................................................................................................. 42 pk_position_cursor ..................................................................................................... 43 pk_create_truetype_font ............................................................................................. 43 pk_create_ti_font ........................................................................................................ 43

Page 5: Version 2.0 PRELIMINARY · PMC and PCI Graphics Version 2.0 PRELIMINARY 10 April 2001 Peritek Corporation 5550 Redwood Road Oakland, CA 94619 (510) 531-6500 FAX (510) 530-8563

Table of Contents

5

pk_create_ti_font_mem.............................................................................................. 43 pk_video_enable......................................................................................................... 43 pk_swap_buffers......................................................................................................... 43 pk_pan_absolute ......................................................................................................... 44 pk_pan_relative .......................................................................................................... 44 pk_get_pixelinfo......................................................................................................... 44 pk_read_flash.............................................................................................................. 44 pk_write_flash ............................................................................................................ 44 pk_read_seeprom........................................................................................................ 45 pk_write_seeprom ...................................................................................................... 45

3.3 Pk_colormap Methods ......................................................................................... 45 pk_lookup_color......................................................................................................... 45 pk_allocate_color........................................................................................................ 45 pk_allocate_closest_color........................................................................................... 46 pk_allocate_colorcell.................................................................................................. 46 pk_allocate_colorcells ................................................................................................ 46 pk_release_color......................................................................................................... 46 pk_release_colors ....................................................................................................... 46 pk_allocate_colorplanes ............................................................................................. 46 pk_release_colorplanes............................................................................................... 46 pk_set_color ............................................................................................................... 47 pk_set_colors .............................................................................................................. 47 pk_set_colors_random................................................................................................ 47 pk_get_color ............................................................................................................... 47 pk_get_colors ............................................................................................................. 47 pk_get_colors_random ............................................................................................... 47

3.4 Pk_drawable Methods.......................................................................................... 48 pk_get_board .............................................................................................................. 48 pk_front_drawable...................................................................................................... 48 pk_back_drawable ...................................................................................................... 48 pk_primary_drawable................................................................................................. 48 pk_overlay_drawable.................................................................................................. 48 pk_create_front_drawable .......................................................................................... 48 pk_create_back_drawable .......................................................................................... 49 pk_create_primary_drawable ..................................................................................... 49 pk_create_overlay_drawable ...................................................................................... 49 pk_destroy_drawable.................................................................................................. 49 pk_get_size ................................................................................................................. 49 pk_get_cliprect ........................................................................................................... 49 pk_get_pixformat ....................................................................................................... 49 pk_get_depth .............................................................................................................. 50 pk_get_memspace ...................................................................................................... 50 pk_set_cliprect............................................................................................................ 50 pk_make_color ........................................................................................................... 50 pk_extract_color ......................................................................................................... 50 pk_read_pixel ............................................................................................................. 50

Page 6: Version 2.0 PRELIMINARY · PMC and PCI Graphics Version 2.0 PRELIMINARY 10 April 2001 Peritek Corporation 5550 Redwood Road Oakland, CA 94619 (510) 531-6500 FAX (510) 530-8563

Peritek GLP Manual

6

pk_draw_pixel ............................................................................................................ 51 pk_draw_line .............................................................................................................. 51 pk_draw_triangle ........................................................................................................ 51 pk_draw_rectangle...................................................................................................... 51 pk_draw_polygon ....................................................................................................... 51 pk_draw_polyline ....................................................................................................... 51 pk_draw_linesegs ....................................................................................................... 51 pk_draw_circle ........................................................................................................... 52 pk_draw_ellipse.......................................................................................................... 52 pk_draw_arc ............................................................................................................... 52 pk_draw_piearc .......................................................................................................... 52 pk_fill_triangle ........................................................................................................... 52 pk_fill_rectangle......................................................................................................... 53 pk_fill_polygon .......................................................................................................... 53 pk_fill_circle............................................................................................................... 53 pk_fill_ellipse ............................................................................................................. 53 pk_fill_piearc.............................................................................................................. 53 pk_create_colormap.................................................................................................... 53 pk_get_colormap ........................................................................................................ 54 pk_destroy_colormap ................................................................................................. 54 pk_draw_char ............................................................................................................. 54 pk_draw_text .............................................................................................................. 54 pk_draw_text16 .......................................................................................................... 54 pk_draw_text32 .......................................................................................................... 54 pk_draw_string ........................................................................................................... 55 pk_draw_string16 ....................................................................................................... 55 pk_draw_string32 ....................................................................................................... 55 pk_bitblt...................................................................................................................... 55 pk_block_copy ........................................................................................................... 56 pk_shaded_line ........................................................................................................... 56 pk_shaded_triangle..................................................................................................... 56 pk_read_span .............................................................................................................. 56 pk_write_span............................................................................................................. 57 pk_read_pixmap ......................................................................................................... 57 pk_write_pixmap........................................................................................................ 57 pk_flush ...................................................................................................................... 57

3.5 Pk_font Methods.................................................................................................. 57 pk_destroy_font .......................................................................................................... 57 pk_get_ascent ............................................................................................................. 58 pk_get_descent ........................................................................................................... 58 pk_get_spacing ........................................................................................................... 58 pk_glyph_info............................................................................................................. 58

3.6 Pk_video_input_device........................................................................................ 58 pk_create_video_input_device ................................................................................... 58 pk_capture_single_frame............................................................................................ 59 pk_capture_multiple_frames ...................................................................................... 59

Page 7: Version 2.0 PRELIMINARY · PMC and PCI Graphics Version 2.0 PRELIMINARY 10 April 2001 Peritek Corporation 5550 Redwood Road Oakland, CA 94619 (510) 531-6500 FAX (510) 530-8563

Table of Contents

7

pk_capture_continuous............................................................................................... 59 3.7 Pk_video_capture_info ........................................................................................ 59

pk_set_source ............................................................................................................. 59 pk_get_source............................................................................................................. 59 pk_set_video_format .................................................................................................. 59 pk_get_video_format.................................................................................................. 60 pk_set_xt..................................................................................................................... 60 pk_get_xt .................................................................................................................... 60 pk_set_horz_scaling ................................................................................................... 60 pk_get_horz_scaling................................................................................................... 60 pk_set_vert_scaling .................................................................................................... 60 pk_get_vert_scaling.................................................................................................... 60 pk_set_cropping ......................................................................................................... 60 pk_get_cropping ......................................................................................................... 60 pk_set_display_location ............................................................................................. 61 pk_get_display_location............................................................................................. 61 pk_set_decimation ...................................................................................................... 61 pk_get_decimation ..................................................................................................... 61 pk_set_contrast ........................................................................................................... 61 pk_get_contrast........................................................................................................... 61 pk_set_hue.................................................................................................................. 61 pk_get_contrast........................................................................................................... 61 pk_set_u_saturation .................................................................................................... 62 pk_get_u_saturation ................................................................................................... 62 pk_set_v_saturation .................................................................................................... 62 pk_get_v_saturation ................................................................................................... 62 pk_set_brightness ....................................................................................................... 62 pk_get_brightness....................................................................................................... 62 pk_set_coring ............................................................................................................. 62 pk_get_coring ............................................................................................................. 62

3.8 PCI access functions ............................................................................................ 63 show_pci_devices....................................................................................................... 63 pci_show_device_config ............................................................................................ 63 pci_read_config .......................................................................................................... 63 pci_write_config......................................................................................................... 63

4 The libVFX library................................................................................................... 64 4.1 Pixel format.......................................................................................................... 64 4.2 Memory spaces .................................................................................................... 65 4.3 Board info ............................................................................................................ 65 4.4 VFX-M specific functions ................................................................................... 66

vfx_configure.............................................................................................................. 66 vfx_load_timing ......................................................................................................... 66 vfx_show_timing........................................................................................................ 66 vfx_adjust_timing....................................................................................................... 67 vfx_adjust_sync.......................................................................................................... 67 vfx_write_palette ........................................................................................................ 67

Page 8: Version 2.0 PRELIMINARY · PMC and PCI Graphics Version 2.0 PRELIMINARY 10 April 2001 Peritek Corporation 5550 Redwood Road Oakland, CA 94619 (510) 531-6500 FAX (510) 530-8563

Peritek GLP Manual

8

5 The libVCQM library .............................................................................................. 68 5.1 Pixel format.......................................................................................................... 68 5.2 Memory spaces .................................................................................................... 68 5.3 Board info ............................................................................................................ 68 5.4 VCQ-M specific functions................................................................................... 69

vcqm_access_registers................................................................................................ 69 vcqm_configure .......................................................................................................... 69 vcqm_load_timing...................................................................................................... 69 vcqm_show_timing .................................................................................................... 70 vcqm_write_palette .................................................................................................... 70 vcqm_write_cursor_color........................................................................................... 70

6 The libPKMesa library ............................................................................................ 72 6.1 Data structures ..................................................................................................... 72

PKMesaVisual ............................................................................................................ 72 PKMesaBuffer ............................................................................................................ 72 PKMesaContext.......................................................................................................... 72

6.2 Functions.............................................................................................................. 72 PKMesaCreateVisual ................................................................................................. 72 PKMesaDestroyVisual ............................................................................................... 72 PKMesaCreateBuffer.................................................................................................. 73 PKMesaDestroyBuffer ............................................................................................... 73 PKMesaCreateContext ............................................................................................... 73 PKMesaDestroyContext ............................................................................................. 73 PKMesaMakeCurrent ................................................................................................. 73 PKMesaSwapBuffers ................................................................................................. 73

7 The libMesa library.................................................................................................. 73 Base OpenGL functions ............................................................................................. 74 OpenGL extensions .................................................................................................... 76 Mesa specific OpenGL extensions ............................................................................. 76 SGI OpenGL extensions............................................................................................. 77

8 The libGLU library .................................................................................................. 77 9 The libGLUT library................................................................................................ 78

Page 9: Version 2.0 PRELIMINARY · PMC and PCI Graphics Version 2.0 PRELIMINARY 10 April 2001 Peritek Corporation 5550 Redwood Road Oakland, CA 94619 (510) 531-6500 FAX (510) 530-8563

The libPK library

9

1 Introduction

1.1 Overview of the Graphics Library Package (GLP)

The Graphics Library Package (GLP) is designed to allow portability of code between different Peritek PCI and PMC graphics boards without sacrificing the ability to program the graphics hardware directly for applications that require it. Users may write graphics code either at a high-level, using the MesaGL, GLU and GLUT portable API’s, or at a lower level, if tuning for performance is an essential consideration. Currently the Graphics Library Package runs on Peritek’s VFG-M and VCQ-M boards, based on the Cirrus 7555 graphics chip set, and on Peritek’s VFX-M (also called Eclipse 2), based on Number 9’s Imagine 128 chipset. Hardware manuals for these boards may be found on the Peritek web page, www.peritek.com.

Applications

PKGLUT (Peritek GLU Toolkit) GLU (Graphics Library Utilities)

Mesa (portable graphics API)

PK VCQ-M VFX-M

User Level Libraries Kernel Level Drivers

VCQ-M VFX-M

Table 1-1 GLP Software Structure

The core of the package is the libPK (Peritek) library. This library provides an

API (Applications Programming Interface) for generic rendering, but with the capability of using optimized methods for each Peritek board type. Support for the OpenGL API is provided with libPKMesa, based on the publicly available Mesa 3-D, Version 3, graphics package, similar to most OpenGL 1.1 capabilities. Support for GLU and GLUT facilities is to be provided with libPKGLU and libGLUT. Currently these libraries are partially implemented, providing useful portability to code written with these standard interfaces, but not yet providing windowing or event handling facilities.

Error! Reference source not found. illustrates the GLP’s software structure. Higher level libraries are implemented using those shown below them in the figure. Other higher level libraries not shown may be implemented in the future.

The GLP is composed of a number of modules and libraries. Each library and driver module has its own naming convention (see Table 1-2 and Table 1-1). The underscore after the prefix in a file name indicates that it is part of a Peritek library. The Mesa library uses a different convention. Test programs and demos that use a library are often named with the prefix but without the underscore.

Page 10: Version 2.0 PRELIMINARY · PMC and PCI Graphics Version 2.0 PRELIMINARY 10 April 2001 Peritek Corporation 5550 Redwood Road Oakland, CA 94619 (510) 531-6500 FAX (510) 530-8563

Peritek GLP Manual

10

Library Name Purpose Function prefix

libPK Generic rendering pk_ libVFX VFX-M specific rendering vfx_

libVCQM VCQ-M specific rendering vcqm_ libPKMesa Peritek Mesa support for OpenGL API PKMesa libPKGLU OpenGL-style utilities glu_ libGLUT OpenGL-style toolkit glut_

Table 1-2 Naming Conventions for Libraries

Device Driver

Purpose Function prefix

vfx VFX-M device driver vfx_ vcq VCQ-M device driver vcqm_

Table 1-3 Naming convention for the Graphics Library Package

The operating system, processor board and Peritek board combinations shown in Table 1-4 have been tested at Peritek. Any combination in the same row of the table should work. Since the Graphics Library Package is written in portable C code and source code is provided, other systems can be supported as required by the addition of driver code to access PCI configuration space and map the Peritek board memory. This code often has to be changed for successive versions of the same operating system.

Operating System/Processor Processor Boards Peritek Boards LynxOS 3.0, PowerPC (also LynxOS 2.5.1)

Motorola MVME2604. Cetia CVME60x

VFX-M VCQ-M

LynxOS 3.1, PowerPC Motorola MVME2700. SBS VG4

Cetia VMPC5A

VFX-M VCQ-M

Solaris 2.6, 7, 8, Sparc Themis UltraSparc II Sun Ultra10

Force ?

VFX-M VCQ-M

Tornado 1 & 2 VxWorks 5.3 & 5.4) PowerPC

MVME2604/2700 series Cetia CVME60x

Dy4 SVME178, 179 Radstone RS60x Microsys CU824 Dynatem VS750 Force Powercore Artesyn BajaPPC

VFX-M VCQ-M

VFG-M (video capture)

Table 1-4 Supported configurations

Page 11: Version 2.0 PRELIMINARY · PMC and PCI Graphics Version 2.0 PRELIMINARY 10 April 2001 Peritek Corporation 5550 Redwood Road Oakland, CA 94619 (510) 531-6500 FAX (510) 530-8563

The libPK library

11

1.2 Using this manual

Functions available for you to use in developing your graphics application are described in this manual, grouped by library. Within the library description sections, related functions are grouped together. To look up a function by name, use the Index at the back of the manual. You will also find certain topics listed in the Index, such as “colormap” or “pixel format.”

Different fonts are used as follows:

Bold face type (like this) indicates a special name within running text, such as a function name, a structure name, a file name, or a library name.

Plain fixed width text (like this) indicates a code fragment, such as anexact function declaration.

Italic type (like this) is used for referencing the names of function arguments within running text describing the function.

You may also wish to consult the hardware manual for your board type, or for advanced graphics operations and performance, the databook for the board’s graphics chip. All of these documents are available on the Peritek web site. 1.3 Getting started First you will need to install the GLP software has been installed in your system, as outlined in Section 2.1. Then, depending on your operating system and processor board, you may need to install a driver, reconfigure your kernel for more memory space, or run a PCI configuration routine before you can run the Peritek-supplied demos or develop graphics applications of your own. This is described in detail in Sections 2.2 through 2.4. These sections will also describe how to determine the bus and device IDs of your graphics boards, which will vary according to the configuration of your processor board. These bus and device IDs must be given as parameters to pk_create_board in order to map the graphics board. For applications using libGLUT they are passed as parameters to glutInit.

Flag Description -b Bus number -d Device number -D Device name -w Width of screen in pixels -h Heighth of screen in pixels -c Clock frequency in milliHz, e.g., 60000 for a 60Hz vertical

refresh -p Pixel format. See sections 4.1 and 5.1 for values for different

board types. Table 1-5 Common flags for demos and GLUT programs

Page 12: Version 2.0 PRELIMINARY · PMC and PCI Graphics Version 2.0 PRELIMINARY 10 April 2001 Peritek Corporation 5550 Redwood Road Oakland, CA 94619 (510) 531-6500 FAX (510) 530-8563

Peritek GLP Manual

12

After your system has been configured, you should run the Peritek-supplied pre-compiled demo and test programs shown in Table 1-7. These precompiled demos and libraries can be found in the operating system specific lib directory; see Table 1-8. The standard arguments used by most of the demo programs, and expected by glutInit when using libGLUT, can be found in Table 1-5. Scripts are provided to run these programs on your operating system and to serve as examples of the arguments for each demo program. Check the appropriate scripts directory (see Table 1-8.) If the default monitor initializations given in the scripts do not work for your monitor, please contact Peritek for assistance. Precompiled libraries

Solaris (lib/solaris)

Tornado2 (lib/tor2-ppc)

LynxOS (lib/lynxos) Notes

libPk libpk.a libpk.o bt848.o

libpk.a Peritek device-independent low-level graphics. Video capture for Tornado 2 only, in bt848.o library

libMesa libmesa.a mesa.o libmesa.a Mesa implementation of OpenGL API

libVFX libvfx.a libvfx.a VFX-M and Eclipse2 specific functions. Not separately linked for Tornado2.

libVCQM libvcqm.a libvcqm.a VCQ-M and VFG-M specific functions. Not separately linked for Tornado2.

libGLP libglp.a libglp.o Combined libPK and libMesa, for OpenGL API users. Library not supplied for LynxOS.

libGLU libmesaglu.a libmesaglu.o GLU support based on Mesa source. Not yet compiled for LynxOS.

libGLUT libGLUT.a libGLUT.o GLUT support based on Mesa source. Not compiled for LynxOS.

Table 1-6 Precompiled libraries supplied with Peritek distribution

Once you are able to run the precompiled demos correctly, begin developing your own application by recompiling the demos in directory src/glp/. A sample makefile is provided for your operating system and processor type, indicated by the extension, e.g. Makefile.tor2-ppc.. You will need to change the Makefile, setting environment variables and adjusting paths to reflect your system. For Solaris and LynxOS systems, and for Tornado2 systems using a Solaris host, a complete set of shell scripts and makefiles is provided for building each library and a number of demo programs. Modify the top-level build.sh script and the makeit.sh script in each subdirectory of src and mesa-src to have

Page 13: Version 2.0 PRELIMINARY · PMC and PCI Graphics Version 2.0 PRELIMINARY 10 April 2001 Peritek Corporation 5550 Redwood Road Oakland, CA 94619 (510) 531-6500 FAX (510) 530-8563

The libPK library

13

the correct system names and path names for your environment. Since you are not likely to need to recompile the Mesa libaries, you may wish to alter the makefile for your operating system in src/glp to reference the precompiled versions in lib/<osname>, for libMesa, libGLU and libGLUT, rather than using the build scripts to completely rebuild those libraries..

For Tornado2 systems using a Windows host, the Makefile.tor2-ppc makefiles can be used as a basis for a creating projects to build the libraries.

Precompiled

demo programs Description Source files

pkflag Displays a flag pattern with labels. pkflag.c pk_flag.c

pktestpat Displays a test pattern created with libPK on the specified board.

pktestpat.c pk_testpatterns.c

pkdemo Displays a demo that draws shaded teapots, using libPKMesa on the specified board

pkdemo.c teapots.cpp

pkmulti A single program that controls multiple channels using libPK. (only for VCQ-M).

pkmulti.c pkflag.c pkhello.c

pkglutglutestlight This tests the GLU library -- you should see spheres, tetrahedrons, toroids, cones, and cubes, as solid surfaces and as wireframes.

pkglut_test/ pkglut_gluttestlight.c

Table 1-7 Precompiled demonstration and test programs

After successfully recompiling and running the demos, you are ready to start developing your own application using libPK, libMesa, libGLU and libGLUT. For libPK, begin by carefully reading the description of the library’s data structures in Section 3.1. The Pk_board data structure represents the display device, which may in fact be only part of a physical board. The VCQ-M, for example, has four display controllers, and thus four possible Pk_board structures for each physical board. The pk_create_board method associates a Pk_board structure with a particular device, and pk_set_framebuffer initializes the display to a particular resolution, sets the pixel format and also initializes a structure of type Pk_drawable.

The concept of drawable represented in the structure Pk_drawable includes both a region of video memory and a set of methods that will act on the drawable whenever the libPK interface for a method is called on that drawable. Derived drawables may operate on the same region of memory as a base drawable, but with a different set of methods. Planned development for the library includes using derived drawables to implement double-buffering, pen and pattern drawing, and viewports. Drawables may also refer to a part of video memory that is not displayed. Drawing methods may be used on this memory in the same way as for the visible frame buffer, and the resulting picture moved to the display drawable using bitblt or block copy.

Page 14: Version 2.0 PRELIMINARY · PMC and PCI Graphics Version 2.0 PRELIMINARY 10 April 2001 Peritek Corporation 5550 Redwood Road Oakland, CA 94619 (510) 531-6500 FAX (510) 530-8563

Peritek GLP Manual

14

Directory Description of contents bsp/ Sample changes needed for Tornado2 Board

Support Packages (BSPs) bsp/tornado2/mv2700 The BSP changes for the Motorola mv2700 drivers/lynxos/ The pciacc.c driver for accessing the PCI bus drivers/solaris/ The Solaris sparc driver for the VCQ-M fonts/ Font files in subdirectories 100dpi,75dpi,misc,ti lib/ Pre-compiled object files and libraries lib/lynxos/ LynxOS specific archives, and demo binaries lib/solaris/ Solaris sparc specific archives, and demo

binaries lib/tor2-ppc/ VxWorks PowerPC specific object files and

demos mesa/ The Mesa-3.0 distribution in gzipped-tar format scripts/lynxos/ shell scripts specific to LynxOS scripts/solaris/ shell scripts specific to Solaris scripts/vxworks/ Tornado shell scripts specific to VxWorks build/ Source files and shell scripts to build libraries

and test programs. build/GL Mesa libGL header files build/mesa-src/ Mesa source files as adapted by Peritek for

libMesa build/mesa-src/mesa-src-glu Mesa source files needed for libPKGLU build/src/ GLP source files (libPK, libVFX, libVCQM)

Test programs using libPK. build/src/bt848 Source to build bt848.o, currently needed to

support video capture with VFG-M on Tornado PowerPC systems. Not yet supported on other operating systems.

build/src/pkglu libPKGLU source files build/src/pkglut libGLUT source files build/src/pkglut_test Test programs using libGLUT

Table 1-8 Directories in the Peritek GLP distribution

The main display drawable created by pk_set_framebuffer is initialized to refer to all of the displayable primary video memory (the actual display, plus any memory that may be displayed using pan and scroll), and to the set of methods that allows access to that board type. In order to draw something on the primary planes of the display, use pk_get_drawable with the board data structure as argument to get a pointer to this main display drawable, and then use any desired drawing method with that drawable as an argument. Calling pk_overlay_drawable with the drawable pointer returned by pk_get_drawable as argument returns a pointer to a drawable that can be used to operate on displayable overlay video memory.

For libPK, scan the lists of board, colormap, drawable and font methods for the operations you want to perform, and use the source code for the demos as examples to get started. For libPKMesa, libPKGLU and libGLUT, see the references to documentation

Page 15: Version 2.0 PRELIMINARY · PMC and PCI Graphics Version 2.0 PRELIMINARY 10 April 2001 Peritek Corporation 5550 Redwood Road Oakland, CA 94619 (510) 531-6500 FAX (510) 530-8563

The libPK library

15

on the Mesa 3-D library and the OpenGL API in sections 6 and 7. If you want more information about GLUT, OpenGL and sample programs, an excellent internet resource is www.opengl.org.The locations of GLP source code, binaries and scripts in the file hierarchy are shown in Table 1-8. Path names are shown relative to the directory where you installed the package.

Source files for example programs

Description

pkexample.c A framework for running a variety of simple tests of libPK. pkmesatest.c Shows use of MesaGL functions with libPKMesa, without

libGLUT. pkoffscreen.c Offscreen drawables. pkoverlay.c Overlays with the VFX-M. pkolaydb.c Overlays and double buffering. pktestfill.c Timing of fill polygon operations pktestpat.c Overlays and double buffering. vcqmregs.c Interactively dump registers for the VCQ-M or VFG-M. vcqmtest.c Memory and register tests for the VCQ-M. vfxtest.c Memory and register test for the VFX-M. pkolaydb.c Overlays and double buffering.

Table 1-9 Source file examples for libPK (in build/src)

A variety of example programs in addition to the simple precompiled demos are provided as source files. See Table 1-9 and Table 1-10 for source code examples files that are provided. Those in Table 1-9 show common uses of libPK functions. The purpose of the programs in the pkglut_test directory is two fold. The primary goal is to test that the development environment is properly configured, and that you have the opportunity to test, and determine, that your graphics system functions properly before you move on to using your own routines. Second, it provides you an opportunity to see how to program a using the Peritek version of GLUT.

If you are using Solaris or LynxOS, or Tornado 2 with a Solaris host, you can rebuild any of these test programs using the shell script build_one.sh that is provided, along with the parameter appropiate to your OS: solaris, lynxos or tor2-ppc. For example, typing

% sh buildone.sh solaris

from the build directory of the Peritek distribution on a Solaris Sparc system will cause to new directories, mesa-obj.solaris and obj.solaris, to be created. These directories and their subdirectories will contain links to the source files in the directories and subdirectories of the mesa-src and src directories, and, after the build is completed, will contain object files, archive libraries and executables for the test files.

A clean rebuild can always be accomplished using build_one.sh. To incrementally rebuild test programs after changes, or after adding one of your own programs, you may type, e.g.,

% sh makeit.sh solaris

Page 16: Version 2.0 PRELIMINARY · PMC and PCI Graphics Version 2.0 PRELIMINARY 10 April 2001 Peritek Corporation 5550 Redwood Road Oakland, CA 94619 (510) 531-6500 FAX (510) 530-8563

Peritek GLP Manual

16

Source files for example programs

Description

pkglut_bounce.c A picture of a bouncing ball composed of red, green, blue and white polygons.

pkglut_dancingsquare.c A 2D square slowly rotating over a larger rectangle, slowly changing colors

pkglut_display.c A general purpose display routine, used in combination with pkglut_main.c

pkglut_glutestlight.c Tests the GLU library. You should see spheres, tetrahedrons, toroids, cones, and cubes, as solid surfaces and as wireframes.

pkglut_main.c An example of a main program, with its event loop. pkglut_mipmap.c Demonstrates the use of mipmaps for texture maps. You

should see see something like a triangle, with layers of multiple colors showing where the mipmaps are.

pkglut_nurbstest2.c An example of a NURB. You should see a surface stretched from four corners outward. The green surface is the outside surface of the NURB; the blue surface is the inside surface of the NURB. Issues with regard to surface normals, material properties, and lighting are important. NURBS are easily created, but they can be problematic in that only one surface (outside), or the other (inside), can be seen unless you turn on two-sided materials, material properties, and lighting.

pkglut_quadric.c Tests the display of quadric surfaces. You should see a sliced cone, a sphere, a partial "pie" (with a slice cut out), and something that looks like a spider web.

pkglut_solidcube.c Demonstrates the use of the Z-buffer.You should see a cube rotating about its center, slowly changing color. Also revolving about its center is a rectangle, the surface changing color.

pkglut_solidcubelight.c Like pkglut_solidcube.c, except the lights have been turned on, and there is a smaller cube that is located at the source of light.

pkglut_solidspherelight.c Exactly the same code for pkglut_solidcubelight.c except the cubes have been replaced with spheres.

pkglut_solidteapotlight.c Similar to pkglut_solidcubelight.c, except for the teapot, which uses splined surfaces, and requires a different means to get the surface to light up. Material properties are an important consideration, and the code includes the means to do this.

pkglut_wireframe.c Rotating wireframe cube, to do doublebuffering, and go as fast as possible. You will see a green square behind the wireframe, used to clear the screen. What was written into a second buffer appears around the green square.

Table 1-10 Source file examples for libGLUT (in build/src/pkglut_test

Page 17: Version 2.0 PRELIMINARY · PMC and PCI Graphics Version 2.0 PRELIMINARY 10 April 2001 Peritek Corporation 5550 Redwood Road Oakland, CA 94619 (510) 531-6500 FAX (510) 530-8563

The libPK library

17

(where solaris may be replaced with either lynxos or tor2-ppc) in obj.solaris, and only the files that have changed will be rebuilt. Rebuilding the Mesa and GLU libraries should only be necessary after receiving a new software revision or patches from Peritek. To do this, execute the makeit.sh script in the mesa-obj directory.

If you will only be building for one operating system, you may wish to build the object files in the same directories as the source files. In that case, don’t use build_one.sh. Instead, first go to mesa-src and execute the makeit.sh script, with the correct OS parameter, in order to build the Mesa and GLU libraries. Then goto src and execute that directory’s makeit.sh. Building the libraries and test programs from the src tree requires that the mesa-src tree already be built.

New programs of your own may be added to this build by adding a rule to the makefile for your OS e.g. Makefile.solaris in the directory where you add the program.

If you are using Tornado 2 on a Windows NT host, copy Makefile.tor2-ppc to Makefile and use the source directories mesa-src and src and their subdirectories as the basis for creating downloadable applications. See Section 2.4 for a description of how to download the necessary libraries to the VxWorks target from the host before running an application.

Page 18: Version 2.0 PRELIMINARY · PMC and PCI Graphics Version 2.0 PRELIMINARY 10 April 2001 Peritek Corporation 5550 Redwood Road Oakland, CA 94619 (510) 531-6500 FAX (510) 530-8563

Peritek GLP Manual

18

2 Installation and System-specific Information

This chapter deals with installation and the system-specific details you need to know to get your first picture on the board. See Chapter 1 for a higher-level description of the package and the way you will use it for developing applications. 2.1 Basic installation instructions

The Peritek GLP is supplied on CDROM and includes precompiled library archives as well as source code. The software can be found on the CDROM both as a tar file (usually the fastest and easiest format for installation) and unpacked, for reference. To install on a system where tar is available, do the following:

1) Copy the file glp.tar from the CDROM to the directory where you wish to keep the Peritek software tree.

2) Extract the file hierarchy from the tar file: tar xf glp.tar If you do not have tar on your system, copy the file hierarchy directly from the CDROM.

2.2 LynxOS PowerPC See Table 1-4 Supported configurations for a list of the operating system versions and processor boards that are supported. Loading drivers for LynxOS 3.0 and 2.5.1 A driver pciacc is provided to allow the GLP software to access the PCI configuration header of Peritek PCI devices. To install this driver, perform the following steps: 1) Create the directory pciacc in /sys/drivers on your LynxOS system.

2) Copy the Makefile and all the source files (*.c, *.h) from the directory drivers/lynxos directory in the distribution to the /sys/drivers/pciacc directory. 3) Change to the /sys/drivers/pciacc and type make to build the driver files for your system. (Note: on LynxOS 2.5.1 systems, the pciacc.import file must be created WITH leading periods in the symbol names where they occur in the output of nm, but on LynxOS 3.0 systems the symbol names listed in the .import file must be created WITHOUT these leading periods -- check to see that the Makefile in the pciacc directory does this correctly for your system.) 4) When the make completes, type make load to load the driver and install the devices. Use the LynxOS drivers and devices calls to check that the pciacc driver and device have been created.

Page 19: Version 2.0 PRELIMINARY · PMC and PCI Graphics Version 2.0 PRELIMINARY 10 April 2001 Peritek Corporation 5550 Redwood Road Oakland, CA 94619 (510) 531-6500 FAX (510) 530-8563

The libPK library

19

5) If your system will be regularly running the Peritek GLP, you may wish to have this driver loaded as part of system start-up. To do this, create a file, /net/rc.local containing:

#!/bin/shcd /sys/drivers/pciaccmake load

This will automatically load the drivers on system startup. Loading drivers for LynxOS 3.1

Starting with Lynx 3.1, the existing pk_vfx and pciacc drivers for the VFX-M board have been merged into a single DRM compliant driver. The pk_vfx driver supported the X server and the pciacc driver provided support for the GLP library. Now there is a single driver servicing both the X server and the GLP library. This unified driver is platform independent and has been tested on the following platforms ( as required by the acceptance criterion for the project): SBS VG4, Cetia VMPC5a and MVME2603 ( 761 I/O ).

The unified driver will run unmodified on all three platforms but there are some modifications required to the base platform system files to fix some anomalies exposed by this driver. As a result a slightly different set of files need to be installed on all three boards. Details of all such anomalies and fixes are given below. The driver itself is binary compatible across all three boards. On SBS VG4 systems: # cp driver/* $ENV_PREFIX/sys/drivers.vg4_drm/pk_vfx/# cp sbs/hw_intr.o $ENV_PREFIX/sys/bsp.vg4_drm/

On Cetia VMPC5a systems:

# cp driver/* $ENV_PREFIX/sys/drivers.vmpc/pk_vfx/# cp cetia/pcibusdrvr.c $ENV_PREFIX/sys/drivers.vmpc/pci/

On MVME2603 systems : # cp driver/* ENV_PREFIX/sys/drivers.pp_drm/pk_vfx/

The following steps need to be followed to configure the driver: On SBS VG4 Board :

# cd $ENV_PREFIX/sys/bsp.vg4_drm/# make a.out (

This is to link the new hw_intr.o into the kernel. The existing BSP does not have correct IRQ values for the PMC slots on the SBS board. # cd $ENV_PREFIX/sys/drivers.vg4_drm/pk_vfx# make

Regenerate the KDI and boot the board with this KDI Mount the pk_vfx directory from the development system on to the sbs board. # make drinstall ( to load the driver )

Page 20: Version 2.0 PRELIMINARY · PMC and PCI Graphics Version 2.0 PRELIMINARY 10 April 2001 Peritek Corporation 5550 Redwood Road Oakland, CA 94619 (510) 531-6500 FAX (510) 530-8563

Peritek GLP Manual

20

# make load_pciacc

To install the devices required by the GLP library. Note that user can load devices for both the X server and the GLP provided there are two cards installed on the board. If there is only one card, only one set of devices can be installed i.e. either the X server devices or the GLP device. The second load operation will fail.

To unload the driver: make unload_pciacc

On Cetia VMPC5a Board :

# cd $ENV_PREFIX/sys/drivers.vmpc/pci# make

This would rebuild the pcibusdrvr. The Cetia BSP is currently not completely DRM compliant. Most devices depend on the pcibusdrvr to program them. For the VFX-M card the pcibusdrvr was modified to ignore all Peritek devices so that they can be programmed by DRM and be accessed by DRM interfaces instead of pcibusdrvr interfaces) # cd /sys/lynx.os# make install# reboot –aN# cd /sys/drivers.vmpc/pk_vfx

# make drinstall ( to install the driver)# make load_pciacc

To install the devices required by the GLP library.

To unload the driver: make unload_pciacc

On Motorola MVME2603 Board :

# cd /sys/drivers.vmpc/pk_vfx

# make drinstall ( to install the driver)# make load_pciacc

To install the devices required by the GLP library.

To unload the driver: make unload_X OR make unload_pciacc

Running precompiled Peritek demos on LynxOS

Most of the Peritek demos will run on all Peritek graphics displays. On LynxOS, you need to supply the bus number and device (slot) number of the Peritek device. This information appears during boot as the devices are probed, and can also be found in the processor board specific Makefile in the driver directory You must use these bus and

Page 21: Version 2.0 PRELIMINARY · PMC and PCI Graphics Version 2.0 PRELIMINARY 10 April 2001 Peritek Corporation 5550 Redwood Road Oakland, CA 94619 (510) 531-6500 FAX (510) 530-8563

The libPK library

21

device numbers as parameters to the –b and –d flags of the Peritek demo programs on LynxOS. (See Table 1-5) Here is a sample invocation of the Peritek demo pktestpat, which uses the Peritek device on PCI bus 1 at slot 0 and draws a test pattern of color ramps and white lines at the specified resolution of width 1280 and height 1024 with vertical frequency 66 MHz and 16 bit pixel format with 5 bits red, 6 bits green and 5 bits blue fields.

pktestpat -b1 -d0 -w1280 -h1024 –c66000 –p565

If arguments are not supplied, the demo programs use default values. The pkflag demo draws an imaginary flag and then displays the fonts that are part

of the GLP distribution. Before invoking it, there should be a link in the current directory to the fonts directory in the Peritek distribution.

pkflag -b1 -d0 -w1024 -h768

The pkdemo program is a standard OpenGL demo for drawing teapots that uses

libPkMesa as well as libPk. pkdemo -b1 -d0 -w1024 -h768

By default, this demo runs with a 24-bit pixel format; indexed pixel formats cannot be used. On the versions of the VFX-M with less memory, this program will not execute at the default 1280x1024 resolution, and the width and height flags must be set to smaller values as above.. The scripts directory in the Peritek distribution contains subdirectories for different operating systems. The subdirectory for your operating system will have shell Scripts such as do_vcqmdemo.sh and do_vfxdemo.sh with several different invocations of Peritek demo programs as examples.

The script do_vfxdemo.sh for LynxOS includes calls to smems to allow reuse of shared memory regions.

for s in ioconfig mw0 mw1 rbase xywa xywb; dosmems -r $s 2>/dev/null

donesmemssleep 1

For most monitors, the default initialization used in the demos should work quite well. For some, adjustment to timing parameters or sync signals may be required. See the description of the timing adjustment commands for the VFX-M on page 66 of this manual, as well as section 4.5.1 in the VFX-M Graphics Board User’s Manual. You may contact Peritek for assistance in determining the correct video timing parameters and sync setting for your monitor. Once this is determined, follow the call to pk_set_framebuffer in the demo code with a call to vfx_load_timing with the correct parameters, and, if necessary, to vfx_adjust_sync, and recompile the demo.

The following are sample invocations of pktestpat with different resolutions and pixel format on each of the display controllers on a VCQ-M whose bus has been assigned the number 2:

Page 22: Version 2.0 PRELIMINARY · PMC and PCI Graphics Version 2.0 PRELIMINARY 10 April 2001 Peritek Corporation 5550 Redwood Road Oakland, CA 94619 (510) 531-6500 FAX (510) 530-8563

Peritek GLP Manual

22

LynxOS:

pktestpat -b2 -d0 -p 888pktestpat -b2 -d1 -w 800 -h 600 -p 565pktestpat -b2 -d2 -w 1024 -h 768pktestpat -b2 -d3 -w 512 -h 512

The default pixel format is 8-bit indexed, the default resolution is 1280x1024. The demos for the VCQ-M will also work on the VFG-M, except that the VFG-M has only two Cirrus Logic graphics displays instead of 4. The video capture chips on the VFG-M are not yet supported under LynxOS.

In addition to the pktestpat, pkflag and pkdemo programs, which can also be run on the VFX-M, the program pkmulti demonstrates a single program controlling all four devices on a VCQ-M.

The script dovcqmdemo.sh for LynxOS includes calls to smems to allow reuse of shared memory regions

for s in ioconfig vcqm020.dispmem vcqm020.mmio vcqm021.dispmemvcqm021.mmio vcqm022.dispmem vcqm022.mmio vcqm023.dispmem vcqm023.mmio; do

smems -r $s 2>/dev/nulldone

2.3 Solaris SPARC

On Solaris SPARC systems each controller of the VCQ-M will be accessed using a different device name. The kernel must be recompiled to install the Peritek driver and create the VCQ-M devices. In addition, the Sun Workshop Tools must be installed. The installation steps are: Installing the VCQ-M or VFG-M driver on Solaris SPARC The following steps for installing the driver assume that the Peritek software distribution has already been unpacked from CD-ROM, as described in section 1.2. 1) Become the root user:

$ suPassword:<password goes here>#

2) # set path =(/opt/SUNWspro/bin /usr/ccs/bin $path)

3) Build the device driver in the drivers/solaris directory of your Peritek distribution:

# cd <directory>/drivers/solaris# make

4) Copy the device driver just created from the subdirectory sparc (which is created by the make) to the kernel directory:

Page 23: Version 2.0 PRELIMINARY · PMC and PCI Graphics Version 2.0 PRELIMINARY 10 April 2001 Peritek Corporation 5550 Redwood Road Oakland, CA 94619 (510) 531-6500 FAX (510) 530-8563

The libPK library

23

# cp sparc/vcqm /kernel/drv

5) Add the device driver to the system (the 1013,40 parameter below identifies the Cirrus logic 7555 chip on the VCQ-M}:

# /usr/sbin/add_drv -m'* 0666 root root' -i'"pci1013,40"' vcqm

If the installation of the device files was successful, the VCQ-M should just show up in /devices. Since the exact location of these device files is system dependent, you may have to search the device tree under /devices to find the entries, which are of the form pci@<slot>/display@#:vcqm_#. On Peritek’s test system they are under the directory /devices/pci@1f,0/pci@1/pci@3/ as:

pci@<slot>/pci@<slot>/display@0:vcqm_0pci@<slot>/display@1:vcqm_1pci@<slot>/display@2:vcqm_2pci@<slot>/display@3:vcqm_3

6) It is probably then desirable to make symlinks in /dev with commands similar to the following: # ln -s /devices/pci@1f,0/pci@1/pci@3/pci@<slot>/display@0:vcqm_0 /dev/vcqm0# ln -s /devices/pci@1f,0/pci@1/pci@3/pci@<slot>/display@1:vcqm_1 /dev/vcqm1# ln -s /devices/pci@1f,0/pci@1/pci@3/pci@<slot>/display@2:vcqm_2 /dev/vcqm2# ln -s /devices/pci@1f,0/pci@1/pci@3/pci@<slot>/display@3:vcqm_3 /dev/vcqm3

Halt the system and reboot for the driver install to take effect. Be sure to reboot with the –r option in order to reconfigure the device tree.

Running precompiled Peritek demos on Solaris To run the Peritek demos, you will have to determine the bus number and device (slot) number of the Peritek device. This information appears on the console during boot, and can be reprinted with the dmesg command. You must use the bus numbers as a parameter to the –b flag and you will need a device name as parameter to a –D flag (you will probably want to use the shorter linked device name, rather than the name in the /devices tree). Most demos will run on all Peritek boards. See Table 1-7 for a list of the demos.

Here is a sample invocation of the Peritek demo pktestpat, which uses the Peritek device on PCI bus 1 at slot 0 and draws a test pattern of color ramps and white lines at the specified resolution of width 1280 and height 1024 with vertical frequency 66 MHz and 16 bit pixel format with 5 bits red, 6 bits green and 5 bits blue fields.

pktestpat -b1 –D/dev/vcqm0 -w1280 -h1024 –c66000 –p565

If arguments are not supplied, the demo programs use default values. The pkflag demo draws an imaginary flag and then displays the fonts that are part

of the GLP distribution. Before invoking it, there should be a link in the current directory to the fonts directory in the Peritek distribution.

pkflag -b1 –D/dev/vcqm0 -w1024 -h768

Page 24: Version 2.0 PRELIMINARY · PMC and PCI Graphics Version 2.0 PRELIMINARY 10 April 2001 Peritek Corporation 5550 Redwood Road Oakland, CA 94619 (510) 531-6500 FAX (510) 530-8563

Peritek GLP Manual

24

The pkdemo program is a standard OpenGL demo for drawing teapots that uses

libPkMesa as well as libPk. pkdemo -b1 –D/dev/vcqm0 -w1024 -h768

By default, this demo runs with a 24-bit pixel format; indexed pixel formats cannot be used. On the versions of the VFX-M with less memory, this program will not execute at the default 1280x1024 resolution, and the width and height flags must be set to smaller values as above.. Look in the scripts/solaris directory in the Peritek distribution for do_vcqmdemo.sh and do_vfxdemo.sh, each with several different invocations of Peritek demo programs as examples. The demos for the VCQ-M will also work on the VFG-M, except that the VFG-M has only two Cirrus Logic graphics displays instead of 4. The video capture chips on the VFG-M are not yet supported under Solaris.

For most monitors, the default initialization used in the demos should work quite well. For some, adjustment to timing parameters or sync signals may be required. See the description of the timing adjustment commands for the VFX-M on page 66 of this manual, as well as section 4.5.1 in the VFX-M Graphics Board User’s Manual. You may contact Peritek for assistance in determining the correct video timing parameters and sync setting for your monitor. Once this is determined, follow the call to pk_set_framebuffer in the demo code with a call to vfx_load_timing with the correct parameters, and, if necessary, to vfx_adjust_sync, and recompile the demo.

The following are sample invocations of pktestpat with different resolutions and pixel format on each of the display controllers on a VCQ-M whose bus has been assigned the number 2:

pktestpat -b2 –D/dev/vcqm0 -p 888pktestpat -b2 –D/dev/vcqm1 -w 800 -h 600 -p 565pktestpat -b2 –D/dev/vcqm2 -w 1024 -h 768pktestpat -b2 –D/dev/vcqm3 -w 512 -h 512

The default pixel format is 8-bit indexed, the default resolution is 1280x1024. The demos for the VCQ-M will also work on the VFG-M, except that the VFG-M has only two Cirrus Logic graphics displays instead of 4. The video capture chips on the VFG-M are not yet supported under Solaris.

In addition to the pktestpat, pkflag and pkdemo programs, which can also be run on the VFX-M, the program pkmulti demonstrates a single program controlling all four devices on a VCQ-M. 2.4 Tornado (VxWorks) PowerPC Peritek’s GLP software for Wind River System’s VxWorks operating has to take into account the lack of standardization in PCI device access for different VxWorks BSPs. Different BSPs use different PCI configuration access addresses and different PCI memory mappings, and do not provide a standard API, used by all BSPs, that the Peritek library can use to access the PCI configuration header. Most BSPs do not have enough PCI memory space allocated in the default kernel for the Peritek graphics cards. Some

Page 25: Version 2.0 PRELIMINARY · PMC and PCI Graphics Version 2.0 PRELIMINARY 10 April 2001 Peritek Corporation 5550 Redwood Road Oakland, CA 94619 (510) 531-6500 FAX (510) 530-8563

The libPK library

25

BSPs do not even program the PMC slot’s configuration header correctly. This has the following consequences for Peritek GLP software: • = The GLP library object file has a particular memory mapping compiled in.

Rather than specifying PCI configuration constants and memory base addresses every time a GLP program is run, the appropriate constants are compiled into the GLP library. This means that you must choose the correct library to load or link to for your Vxworks BSP. See Error! Reference source not found. to determine what library is correct for your BSP, and what compile flag is needed if you are re-compiling and linking the source with your application.

• = You may need to build a custom VxWorks kernel. For most BSPs, all that is required is to increase the amount of PCI memory space that is allocated. How to do this is described under the heading Configuring the VxWorks BSP below.

• = You may need to run a Peritek-supplied program to configure the graphics board’s PCI configuration header. Normally, the processor’s firmware or the BSP should detect devices on the PCI bus, allocate the PCI memory and IO space they request, and program the PCI devices’ configuration headers. Some PowerPC Vxworks BSPs do not do this. For those cases, it is necessary to figure out where to place the Peritek PMC graphics card in PCI memory and IO space, and program the graphics cards PCI configuration header using Peritek supplied routine. See Configuring the Peritek Graphics Card’s PCI header below.

The following subsections describe how to make these configuration changes and run the Peritek-supplied demos. Filename Power PC BSP Compile line constant libglp.o MVME2400/2600/2700, non-

extended_VME, Cetia CVME60x. Dy4 SVME178, Radstone RS60x, Force Powercore

-DPREP

libglp_xvme.o Motorola MVME2400/2600/2700, EXTENDED_VME

-DXVME

libglp_newppc.o Artesyn Baja PowerPC, Microsys CU824

-DNEWPPC

libglp_svme179 Dy4 SVME 179 -DSVME179 libglp_vs750.o Dynatem VS750 -DVS750

Figure 2-1 Object libraries for different PowerPC processor Boards with VxWorks

Configuring the VxWorks BSP For most VxWorks BSPs, the default VxWorks kernel does not provide enough CPU-PCI memory space to map in the memory on the PCI graphics card. In order to make this memory space available, the sysPhysMemDesc table in sysLib.c must be modified and your VxWorks kernel rebuilt. Usually, the only change required is to modify the sysPhysMemDesc table in sysLib.c file in your BSP directory to map in enough PCI memory space. For example, to allow an Artesyn BajaPPC750 VxWorks system to use

Page 26: Version 2.0 PRELIMINARY · PMC and PCI Graphics Version 2.0 PRELIMINARY 10 April 2001 Peritek Corporation 5550 Redwood Road Oakland, CA 94619 (510) 531-6500 FAX (510) 530-8563

Peritek GLP Manual

26

an Eclipse 2, it is only necessary to change the entry in the sysPhysMemDesc table that defines PCI memory space:

/* PCI memory space */{(void *) PCI_MEM_ADRS,(void *) PCI_MEM_ADRS,0x01000000, /* 16 meg */VM_STATE_MASK_VALID | VM_STATE_MASK_WRITABLE | VM_STATE_MASK_CACHEABLE |VM_STATE_MASK_GUARDED,VM_STATE_VALID | VM_STATE_WRITABLE | VM_STATE_CACHEABLE_NOT |VM_STATE_GUARDED},

to increase the 0x01000000 (16 megabyte) size of the PCI memory address space to 0x02000000 (32 megabytes). See Figure 2-2 for the amount of space that needs to be available for each card (due to memory windowing and alignment issues, this will be greater than the actual amount of video memory on the Peritek graphics board.) If there is more than one Peritek Graphics Card being used, or if other devices are using PCI memory space, the amount allocated in sysPhysMemDescr will need to be increased accordingly. Occasionally the firmware or the OS will assign memory base addresses to the PMC graphics card in an inefficient way and use more memory space than is shown here. This can be determined by examining the header with the pci_show_device_config function described in the next section.

Peritek Graphics Card Size of PCI memory space Eclipse 2 32 megabytes VFX-M/X 64 megabytes VFG-M 40 megabytes VCQ-M 72 megabytes

Figure 2-2 Amount of PCI memory space needed

Determining the Bus Number and Device Number of the PMC slot Peritek supplies functions for VxWorks that will show you all the devices on the PCI primary (and secondary, if present) buses in your system, and that will allow you to show and, if desired, modify the PCI configuration header. These functions (see Section 3.8 for a full description) are supplied as part of the libPK and libGLP libraries. Running these functions will confirm that you are loading the library version with the correct memory mapping for your system, and will also supply the bus and device number needed to specify the graphics card to the Peritek software.

First copy the correct version of libGLP (see Figure 2-1) into the working directory of your Tornado shell, changing its name to just libglp.o. In the Tornado shell examples that follow we will assume that the file is named libglp.o.

To determine the bus and device number of the Peritek graphics board, execute the following:

ld <libglp.oshow_pci_devices(-1)

Page 27: Version 2.0 PRELIMINARY · PMC and PCI Graphics Version 2.0 PRELIMINARY 10 April 2001 Peritek Corporation 5550 Redwood Road Oakland, CA 94619 (510) 531-6500 FAX (510) 530-8563

The libPK library

27

This shows all the PCI devices on all configured PCI buses in the system. You will see a line BUS DEV FUNC CLASS SUBCLASS VENDOR DEVICE

followed by those values for various PCI devices. If you are using a Peritek VFX-M or Eclipse 2, you should see a line like this somewhere in the list: 000 16 00 display VGA Number Nine Vis I128s2

showing that the Peritek graphics card, which contains a Number Nine Imagine 128 chip set, has been found on bus 0 as device number 16.

If you are using a Peritek VFG-M or VCQ-M, you will see a line like this: 000 16 00 bridge PCItoPCI Texas Instruments PCI2031

If you r BSP has configured the bridge device, you will also see two (for a VFG-M ) or four (for a VCQ-M) lines that look like this: 001 00 00 display VGA Cirrus Logic CL-GD7555001 01 00 display VGA Cirrus Logic CL-GD7555

These lines show the bus and device numbers (1, 0 and 1, 1) of the Cirrus Logic graphics chipsets on the Peritek card. If you don't see lines like this, the BSP has not configured the bridge, and we will need to do it ourselves -- see next section. When running the demos or initializing your applications programs, you will use the bus and device number to select the graphics device. Configuring the Peritek Graphics Card’s PCI header Some BSPs (e.g. Motorola MVME 2604 and Force PowerCore 603) do not configure PCI bus devices on boot, so a special function must be run to do this on boot-up before any other routines are run. Peritek provides two functions to do this, vfx_configure (see Section 4.4) for the VFX-M and Eclipse2 boards that use Number 9 Imagine 128 graphics chip, and vcqm_configure (see Section 5.4) for the VFG-M and VCQ-M boards that use the Cirrus Logic GD7555.

Here is an example Tornado shell script that calls vfx_configure. This script can be found in the distribution as scripts/vxworks/vfx_mv2604.scp. The correct libGLP should be copied into the shell’s working directory as libglp.o before running the script. Here is the contents of the script vfx_mv2604.scp.

# This script programs the header of the VFX-M on the MV2604,# since the OS and firmware fail to do so. It must be run# on power up, before any other VFX-M activity.

ld < libglp.o

vfxbus = 0vfxslot = 16pcimembase = 0x03000000pciiobase = 0x01080000

Page 28: Version 2.0 PRELIMINARY · PMC and PCI Graphics Version 2.0 PRELIMINARY 10 April 2001 Peritek Corporation 5550 Redwood Road Oakland, CA 94619 (510) 531-6500 FAX (510) 530-8563

Peritek GLP Manual

28

interrupt_line = 0x19

vfx_config(0, vfxbus, vfxslot, pcimembase, pciiobase, interrupt_line) The values to use for vfxbus and vfxslot are the ones displayed by show_pci_devices for the Number Nine Vis I128s2 device. The hard part is determining the correct values for pcimembase and pciiobase, since these depend not only on the system mapping, but also on the other PCI devices in the system and their use of memory and I/O space.

Examine the BSP’s header files and documentation to determine a region of PCI memory space that is mapped in, unoccupied, and big enough to satisfy the memory requirements in Figure 2-2. You may need to alter the BSP, see Configuring the VxWorks BSP, in this section, above. Then use the PCI address of that region (not the CPU address) as pcimembase. In the above script, for a non-EXTENDED_VME Motorola MVME 2604, the CPU memory base of the region where the board is mapped is 0xc3000000, since the base for converting PCI to CPU memory addresses is 0xc0000000 in that memory mapping. If you are using more than one VFX-M board, or have other PCI devices that use PCI memory space, you must make sure that the PCI memory regions assigned to each board do not overlap.

You must also find the start of an unused region of PCI I/O space by examining the BSP’s headers and documentation to use as pciiobase. Only a small amount (256 bytes) of PCI IO space is required, so this is not usually a problem. Often the BSP will specify a particular region to be used by the PMC slot. In the above script, we are actually using the region specified for the PCM SPAN in the mv2604 BSP. The CPU address of this region would be 0x81080000.

The value to use to program the interrupt line field in the PCI display device’s header can usually be found be reading the processor board manual.

Here is another script example, which can be found in scripts/vxworks/vfx_pcore.scp.

# This script programs the header of the VFX-M on the Force pcore60x,# since the OS and firmware fail to do so. It must be run# on power up, before any other VFX-M activity.

ld < libglp.o

vfxbus = 0vfxslot = 28pcimembase = 0xd0000000pciiobase = 0x00840000interrupt_line = 0x3vfx_config(0, vfxbus, vfxslot, pcimembase, pciiobase, interrupt_line)

This board uses the NEWPPC memory mapping. In that memory mapping, the

CPU relative and PCI relative memory addresses are the same. The pciiobase address, however, is found at CPU address 0xfe840000.

For the VCQ-M and VFG-M, no memory needs to be mapped into PCI I/O space, but the graphics devices on the Peritek card are all on the other side of a PCI to PCI bridge, and some BSPs do not program the bridge correctly. Here is a sample script using

Page 29: Version 2.0 PRELIMINARY · PMC and PCI Graphics Version 2.0 PRELIMINARY 10 April 2001 Peritek Corporation 5550 Redwood Road Oakland, CA 94619 (510) 531-6500 FAX (510) 530-8563

The libPK library

29

the vcqm_configure function that can be found in the distribution as scripts/vxworks/vcqm_mv2604.scp.

ld <libglp.ovcqmbus = 0vcqmslot = 16secbus = 1pcimembase = 0x02000000pcimemsize = 0x06000000vcqm_configure(0, vcqmbus, vcqmslot, &secbus, &pcimembase, pcimemsize)

Finding pcimembase can be done in the same way as for the VFX-M, referring to Figure 2-2 to find out how much memory space is required. The value for pcimemsize can always be set to 0x06000000. The value for secbus must be set to the bus number you wish to be assigned to the PCI to PCI bridge on the Peritek card. Usually you will want this number to be one more than the highest numbered PCI bus already in your system. If your system has more than one PMC slot, and you are configuring more than one VCQ-M or VFG-M, the values returned in the variables secbus and pcimembase can be used in the call to configure the next VCQ-M or VFG-M.

Note that these scripts should be run only on boot up, not as part of executing every application on the Peritek board. You may want to add these commands to your VxWorks start-up script. Checking the PCI configuration headers To see whether your Peritek card has a valid configuration header, use the bus and device number shown when running show_pci_devices and type: pci_show_device_config(0, vfxbus, vfxslot, 0)

For a VFX-M/X, configured by vfx_pcore.scr, as described in the preceding section, you should see a device record like this: Vendor ID: 0x105dDevice ID: 0x2339Command: 0x0003Status: 0x0280Revision: 0x0280Class code: 0x030000Cache line size: 0x00Latency timer: 0x00Header Type: 0x00BIST: 0x00BAR 0: 0xd1000008BAR 1: 0xd2000008BAR 2: 0xd0400000BAR 3: 0xd0800000BAR 4: 0xd0120000BAR 5: 0x00840000Cardbus CIS Ptr: 0x00000000Subsystem Vendor:0x10f0Subsystem ID: 0x0000Expansion ROM: 0xd0100001

Page 30: Version 2.0 PRELIMINARY · PMC and PCI Graphics Version 2.0 PRELIMINARY 10 April 2001 Peritek Corporation 5550 Redwood Road Oakland, CA 94619 (510) 531-6500 FAX (510) 530-8563

Peritek GLP Manual

30

Interrupt Line: 0x03Interrupt Pin: 0x01Min Grant: 0x00Max Latency: 0x00

The first two lines showing Vendor ID and Device ID should be the same for any VFX-M or Eclipse 2. The lines BAR 0 to BAR 5 are where you should look for the memory configuration. If the firmware and/or BSP has configured the device, rather the this particular script that called vfx_configure, you should still see addresses within mapped PCI memory space. aligned on at least 4MB boundaries for BAR 0 and BAR 1, and other values within mapped PCI memory space assigned to BAR 2-4.. If you see BAR 4 as 0xffff0001 this almost always indicates that the header has not been programmed.

Sometimes even when the header has been programmed correctly, it’s been programmed into a region that the BSP has not mapped in sysPhysMemDescr, and you will still need to configure the BSP to map in this space, as described above in Configuring the VxWorks BSP.

For a VCQ-M or a VFG-M, the “Cirrus Logic CL-GD7555” lines must show up in the output of show_pci_devices(-1), as described in Determining the Bus Number and Device Number (above) before the configuration header of the Cirrus Logic graphic devices can be seen. Using

ld <libglp.ovcqmbus = 0vcqmslot = 29secbus = 1pcimembase = 0xd8000000pcimemsize = 0x06000000vcqm_configure(0, vcqmbus, vcqmslot, &secbus, &pcimembase, pcimemsize)

to configure a VCQ-M in the second slot of the same Force Powercore system where the VFX-M is installed and has the configuration header shown above, we can then type pci_show_device_config(0, 1, 0, 0)

to get output that has the first two lines as Vendor ID: 0x1013Device ID: 0x2339

to identify the Cirrus Logic GD7555, and shows two programmed BARs:

BAR 0: 0xd8000000BAR 1: 0xdc002000

Running demos on VxWorks PowerPC

To run the precompiled demos (see Table 1-7), copy the correct version of libGLP from lib/tor2-ppc into your test directory, after performing any required processor board specific configuration as described above. See Figure 2-1 to determine which library is

Page 31: Version 2.0 PRELIMINARY · PMC and PCI Graphics Version 2.0 PRELIMINARY 10 April 2001 Peritek Corporation 5550 Redwood Road Oakland, CA 94619 (510) 531-6500 FAX (510) 530-8563

The libPK library

31

correct for your processor board. Then copy the following files into your test directory, which should be the working directory of your Tornado shell. lib/tor2-ppc/pkdemo lib/tor2-ppc/pkflag lib/tor2-ppc/pktestpat lib/tor2-ppc/pkmulti lib/tor2-ppc/libpkglut.o lib/tor2-ppc/libmesaglu.o lib/tor2-ppc/pkglutglutestlight scripts/vxworks/vcqm_demo.scp or scripts/vxworks/vfx_demo.scp For the parameter lists of the functions corresponding to these files, see Figure 2-3. Note that the same function, pkglut_main(char *argstring), is used for all the libGLUT demos (see Table 1-10) The argstring is constructed by putting the desired Unix-style arglist in quotes, e.g. pkglut_main(“-b 1 -d 0 –w 1024 –h 768”)

See Table 1-5 for possible flags to include in this argument string and their meanings. You will need to copy or link the entire fonts subtree as well into the directory

that is the current directory for the programs when they are running. If you are using the target shell, then the current directory of the program will be the same as the current directory of the shell. However, if you are using the Tornado host shell, the current directory of the demo program depends on how files are fetched by the target. If the target is using ftp to a Windows host, the file names will be relative to the ftp base directory. The demo programs use font names that assume the fonts directory is a subdirectory of the current directory by default, but you can specify a font path if necessary as an argument to pkflag and pkmulti. Then you can experiment to determine what font path is correct. Precompiled demo Declaration for VxWorks function. pktestpat pktestpat(int bus, int dev, int func, int width, int

height, int clockfreq, int pixformat, int pat);

pkflag pkflag(char *devname, int bus, int dev, int func, intwidth, int height, int pixformat, char * fontpath);

pkmulti pkmulti(int nboard, char *fontpath);

pkdemo pkdemo(char *devname, int bus, int dev, int func, intwidth, int height, int pixformat);

pkglutglutestlight pkglut_main(char *argstring);

Figure 2-3 Parameter declarations for Peritek VxWorks functions

If you have a VCQ-M, you may run the Tornado shell script vcqm_demo.scp by typing at the Tornado shell prompt, with your test directory as the current directory: < vcqm_demo.scp

Page 32: Version 2.0 PRELIMINARY · PMC and PCI Graphics Version 2.0 PRELIMINARY 10 April 2001 Peritek Corporation 5550 Redwood Road Oakland, CA 94619 (510) 531-6500 FAX (510) 530-8563

Peritek GLP Manual

32

Here is a copy of vcqm_demo.scp:

# Demos running on all four Cirrus chip sets of a single VCQ-M.# A single VCQ-M functions as four graphics boards.

# PCI secondary bus number for VCQ-M depends on system configuration# Correct value of vcqbus for MV2604 with one VCQ-M:

vcqbus = 1

ld < libglp.old < pktestpat

# Demo of four boards on single VCQ-M running at different resolutions# The last argument controls which demo to run.

board0 = pktestpat(vcqbus, 0, 0, 640, 640, 66000, 8, 0)board1 = pktestpat(vcqbus, 1, 0, 800, 600, 66000, 8, 0)board2 = pktestpat(vcqbus, 2, 0, 1024, 768, 66000, 8, 0)board3 = pktestpat(vcqbus, 3, 0, 512, 512, 66000, 8, 1)

# Other graphics functions that operated on the board pointers# returned# could be inserted here.

# Demo of a single program running on all four boards# (default resolution 1024 x 768, pixformat 8, clock frequency 66000)

ld < pkmulti

# The variable bus1 is a global in pkmulti, be sure to load the pkmulti# object file before setting bus1 to the correct value for your system.# To alter the resolution or the pixformat, you may also set the# global variables in pkmulti.c from the shell (commented out here).# To run pkmulti for two VCQ-Ms in a single system, you will also# need to set bus2, as well as changing the argument of pkmulti to# the number of displays you will actually be running..

bus0 = vcqbus# width = 640# height = 480# clockfreq = 66000# pixformat = 24

pkmulti(4)

# The following demo uses libPKMesa to demonstrate shaded drawing# using OpenGLld < pkdemo

pkdemo(vcqbus, 0, 0, 640, 480)pkdemo(vcqbus, 1, 0, 640, 480)pkdemo(vcqbus, 2, 0, 640, 480)pkdemo(vcqbus, 3, 0, 640, 480)

Page 33: Version 2.0 PRELIMINARY · PMC and PCI Graphics Version 2.0 PRELIMINARY 10 April 2001 Peritek Corporation 5550 Redwood Road Oakland, CA 94619 (510) 531-6500 FAX (510) 530-8563

The libPK library

33

You should first see test patterns on all four screens, then a flag and font displays, then shaded teapots. To examine any of the patterns more closely, just edit the script to execute only the pattern you are interested in. If there are any failures, please contact Peritek for assistance.

For the VFX-M, run the Tornado shell script vfx_demo.scp, < vfx_demo.scp

which is shown below:

# vfxbus and vfxslot must be set to the location of the VFX-M# on the PCI bus

vfxbus = 0vfxslot = 11

ld < libglp.old < pktestpat

# Demo of board on single VFX-M running at different resolutions# The last argument controls which demo to run.

board = pktestpat(vfxbus, vfxslot, 0, 640, 640, 66000, 8, 1, "fonts")board = pktestpat(vfxbus, vfxslot, 0, 800, 600, 66000, 8, 1, "fonts")board = pktestpat(vfxbus, vfxslot, 0, 1024, 768, 66000, 8, 1, "fonts")board = pktestpat(vfxbus, vfxslot, 0, 1280, 1024, 60000, 8, 2, "fonts")board = pktestpat(vfxbus, vfxslot, 0, 1600, 1200, 59000, 8, 1, "fonts")

# Other graphics functions that operated on the board pointer returned# could be inserted here. pkflag is an example demo.

ld <pkflagpkflag(0, vfxbus, vfxslot, 0, 1280, 1024, 8, "fonts/ti")

# The following demo uses libMesa to demonstrate shaded drawing# using OpenGLld < pkdemo

pkdemo(0, vfxbus, vfxslot, 0, 1024, 768)

# The following loads a PKGLUT demo of lighting models in GLU.

ld <libmesaglu.old <libpkglut.old <pkglutglutestlighttaskSpawn("glutestlight", 100, 0x0008, 40000, pkglut_main, "-b 0 -d 11-w 800 -h 600")

You should first see test patterns in a variety of pixel formats, then a flag with font display, then shaded teapot, then a continous display of 3D-geometric forms, rotating, changing lighting, and changing from smooth surface to wire frame. To halt the last program, give the following command to the Tornado shell: td glutestlight

Page 34: Version 2.0 PRELIMINARY · PMC and PCI Graphics Version 2.0 PRELIMINARY 10 April 2001 Peritek Corporation 5550 Redwood Road Oakland, CA 94619 (510) 531-6500 FAX (510) 530-8563

Peritek GLP Manual

34

to delete the task that has been spawned. To examine any of the patterns more closely, just edit the script to execute only the pattern you are interested in. If there are any failures, please contact Peritek for assistance. For most monitors, the default initialization used in the demos should work quite well. For some, adjustment to timing parameters or sync signals may be required. See the description of the timing adjustment commands for the VFX-M on page 66 of this manual, as well as section 4.5.1 in the VFX-M Graphics Board User’s Manual. Here is an example VxWorks script showing the use of the vfx_adjust_timing function with a Sceptre flat panel: # Initializes Motorola MVME2604 for VFX-M # After calling test pattern, adjust timing for Sceptre FT15G flat# panel

bus = 0x0dev_name = 0slot = 16func = 0pcimembase = 0x03000000pciiobase = 0x01080000interrupt_line = 0x19

#program barsvfx_config(0,bus, slot, pcimembase, pciiobase, interrupt_line)

width = 1024height = 768

#vertical frequency is given in Khzvertfreq = 60000vertblank = 787vertfporch = 140vertsync = 54horblank = 4800horfporch = 50horsync = 2000

#pixformat 8 = 8 bit, 888 = 24 bitpixformat = 8

#pattern 0 = color 1 = grayscalepattern = 0fontpath = “fonts”

#draw a test patternboard = pktestpat(bus, slot, func, width, height, vertfreq, pixformat,pattern, fontpath)vfx_adjust_timing(board, vertfreq, vertblank, vertfporch, vertsync,horblank, horfporch, horsync)

Page 35: Version 2.0 PRELIMINARY · PMC and PCI Graphics Version 2.0 PRELIMINARY 10 April 2001 Peritek Corporation 5550 Redwood Road Oakland, CA 94619 (510) 531-6500 FAX (510) 530-8563

The libPK library

35

If you are using a VFG-M and wish to do video capture using the VFG-M’s Bt848 chips, the video capture library is not yet completely integrated into libGLP. You will need to copy the correct version of bt848.o to your test directory, and then you may execute the commands shown in the script below. When you write your own applications, currently you must use bt848_ functions instead of the device independent functions described in Section 3.7. See the source code in build/src/bt848 for examples.

# Demo for video capture on the VFG-M# vcqbus is the bus number of the bus on the VFG-M#vcqbus = 1

ld < libglp.o

# display a test patternld < pktestpatboard0 = pktestpat(vcqbus, 0, 0, 640, 480, 66000, 565, 1)board1 = pktestpat(vcqbus, 1, 0, 640, 480, 66000, 565, 1)

# load the video capture libraryld <bt848.o

# Parameters for pk_write_frame are:# pk_write_frame(char *devname, int bus, int dev, int func,# int do_display, int gbus, int gdev, int gfunc, int vfmt,# int howmany)# bus, dev and func are bus, slot and function for the video capturedevice# gbus, gdev and gfunc are for the frame buffer# vfmt is the index into the video format array; see the listing of the# array in the source: bt848/pk_write_frame.c

# Uncomment the next line to do video capture over the PCI bus frombt848# device (1, 2, 0) to framebuffer (1, 0, 0) with a full NTSC format

#pk_write_frame(0, 1, 2, 0, 1, 1, 0, 0, 0, 0)

# Uncomment the following lines to do the video window on board0# (This is PCI device (vcqbus,0,0), Channel A).

#vcqm_configure_videowindow(board0, 0, 0, 640, 480, 0x2000000, 565)#vcqm_configure_videowindow_port(board0, 0, 0, 640, 480, 0x2000000, 1,1)#vcqm_enable_videowindow_port(board0)

# videowindow from graphics chip on channel A goes to Bt848 on ChannelD# videowindow from graphics chip on channel B goes to Bt848 on ChannelC# Channel A is slot 0, Channel B is slot 1, Channel D is slot 2,# Channel C is slot 3

# video input for pk_write_frame is mux2 (green connector).# video input for video window demo is mux0 (red connector).

Page 36: Version 2.0 PRELIMINARY · PMC and PCI Graphics Version 2.0 PRELIMINARY 10 April 2001 Peritek Corporation 5550 Redwood Road Oakland, CA 94619 (510) 531-6500 FAX (510) 530-8563

Peritek GLP Manual

36

3 The libPK library The libPK library is a graphics card independent API for doing 2D and some 3D graphics. The API is close to the hardware. For the most part the API is implemented by macros that indirectly call the correct board specific function. The libPK library also provides generic implementations of various graphics functions. It is possible to use the API to draw on just about anything. Specializations and optimizations are done for the particular capabilities of the VFX-M and VCQ-M, based on the hardware dependent libraries. 3.1 Data Structures

Pk_board This structure has no members that are accessible to the user. It is used to represent a specific display device. For the VFX-M it contains information necessary to access the Number Nine i128 series II graphics controller. For the VCQ-M it contains information necessary to access one of the four Cirrus Logic GD7555 graphics controllers. The pk_create_board function returns a pointer to a Pk_board object. After calling pk_destroy_board no further use should be made of the object. The function pk_set_framebuffer is used to initialize a board structure.

Pk_colormap

This structure has no members that are accessible to the user. It is used to represent a color palette. A Pk_colormap can be associated with every Pk_drawable. The Pk_colormap contains a mapping from pixel values to the red, green, and blue components of each color. A colormap may be used either for indexed color lookup or for gamma correction.

Pk_drawable

This structure is used to represent either a chunk of memory that is capable of storing an array of pixels and a set of methods for rendering pixels in a particular fashion, or else a set of methods for rendering on another base drawable. There are a number of drawing methods that can be used on a drawable to generate graphics. For different kinds of drawables, the libPK method interfaces described in section 3.4 will invoke the appropriate method for that drawable and board type. To make pictures appear on the screen, use pk_get_drawable, with an initialized Pk_board pointer as its argument, to get the primary display drawable. Then operate on that drawable with colormap and drawing methods, and see the result directly on the screen. Sophisticated applications create off-screen drawables using the function pk_create_drawable, operate on the off-screen drawable with drawing methods, and then transfer pixels to the screen using pk_block_copy or pk_bitblt. On boards

Page 37: Version 2.0 PRELIMINARY · PMC and PCI Graphics Version 2.0 PRELIMINARY 10 April 2001 Peritek Corporation 5550 Redwood Road Oakland, CA 94619 (510) 531-6500 FAX (510) 530-8563

The libPK library

37

that support overlays, the function pk_overlay_drawable can be applied to the primary display drawable to get a drawable that can be used to display graphics in the overlay.

Pk_font This structure is used to represent a font that can be used for drawing text. The structure contains no user accessible members. Currently only TI fonts can be represented. Support for TrueType fonts will be added in the future.

Pk_glyph_info This structure is used to communicate information about the geometry of a glyph in a font. Its user accessible members are:

unsigned int code

This member is the character code of the glyph in the font. For example, the character code for the ASCII letter ‘A’ is 65. The type of the field is unsigned int so that 16-bit and 32-bit character codes can be supported.

int width

This member is the width of the glyph bitmap. The width is the number of pixels between and including the left most drawn pixel and the right most drawn pixel of the glyph.

int height

This member is the height of the glyph bitmap. The height is the number of pixels between and including the top most drawn pixel and the bottom most drawn pixel of the glyph.

int refx

This member is the signed offset from the left most drawn pixel of the glyph to the glyphs reference point. This value will be positive if the reference point is to the right of the left most drawn pixel. It will be negative if the reference point is to the left of the glyph image.

int refy

This member is the signed offset from the top most drawn pixel of the glyph to the glyphs reference point. This value will be positive if the reference point is below the top most drawn pixel. It will be negative if the reference point is above the glyph image.

int space

This member is the number of pixels from the reference point of the current character to the reference point of the next character without kerning.

Page 38: Version 2.0 PRELIMINARY · PMC and PCI Graphics Version 2.0 PRELIMINARY 10 April 2001 Peritek Corporation 5550 Redwood Road Oakland, CA 94619 (510) 531-6500 FAX (510) 530-8563

Peritek GLP Manual

38

Pk_pixelinfo

This structure is used to represent information that describes the structure of a pixel for a particular pixel format.

int format

This member is the id of the specific pixel format. This id is specific to the particular graphics controller that the pixel info was derived for.

int psize

This member is the width in bits of a pixel. Generally it is either 1, 2, 4, 8, 16, 24, or 32. It represents the number of bits of memory that the pixel occupies which may be greater than the number of bits that contain useful data.

unsigned int mask

This member is a mask that can be used to extract just the pixel bits from a word that has been adjusted so that pixel bit zero is in bit zero of the word. It is almost always equivalent to ((1 << psize) - 1).

int pindexed

This flag is true if the primary planes of the pixel data are indexed through a colormap.

int pwidth

This member is the width of the primary planes portion of the pixel data. For pixel formats that don't include overlay data this is generally the same as the pixel size.

int pshift

This is the number of bits of non-primary pixel data that are in the least significant bits of the pixel data.

unsigned int pmask

This is a mask that can be used to extract just the primary pixel data out of a pixel.

unsigned int pdmask

This is a mask that can be used to extract just the primary pixel bits from a word that possibly contains multiple pixels.

int rsize

This is the width of the red field for non-indexed pixels or the index field for indexed pixels.

int rshift

This is the number of bits from the least significant bit of the pixel to the least significant bit of the red field.

unsigned int rmask

This is a mask that can be used to extract just the red field from the pixel data.

int gsize

Page 39: Version 2.0 PRELIMINARY · PMC and PCI Graphics Version 2.0 PRELIMINARY 10 April 2001 Peritek Corporation 5550 Redwood Road Oakland, CA 94619 (510) 531-6500 FAX (510) 530-8563

The libPK library

39

This is the width of the green field of non-indexed pixels. For indexed pixels this field must be zero.

int gshift

This is the number of bits from the least significant bit of the pixel to the least significant bit of the green field.

unsigned int gmask

This is a mask that can be used to extract just the green field from the pixel data.

int bsize

This is the width of the green field of non-indexed pixels. For indexed pixels this field must be zero.

int bshift

This is the number of bits from the least significant bit of the pixel to the least significant bit of the blue field.

unsigned int bmask

This is a mask that can be used to extract just the blue field from the pixel data.

int oindexed

This field is true if the overlay portion of the pixel data is indexed.

int owidth

This field is the width of the overlay data. It must be zero if the pixel format does not include overlay data.

int oshift

This is the number of bits of non-overlay pixel data that are in the least significant bits of the pixel data.

unsigned int omaskunsigned int odmaskint orsizeint orshiftunsigned int ormaskint ogsizeint ogshiftunsigned int ogmaskint obsizeint obshiftunsigned int obmask

These fields have the same meaning as the respective field for the primary pixel data, except these are used to describe the overlay pixel data.

Pk_video_input_device

This structure has no members that are accessible to the user. It is used to represent a specific video input device. For the VFG-M it contains information necessary to access one of the two Conexant Bt848A video capture controllers. The

Page 40: Version 2.0 PRELIMINARY · PMC and PCI Graphics Version 2.0 PRELIMINARY 10 April 2001 Peritek Corporation 5550 Redwood Road Oakland, CA 94619 (510) 531-6500 FAX (510) 530-8563

Peritek GLP Manual

40

pk_create_video_input_device function returns a pointer to a Pk_video_input_device object. After calling pk_destroy_video_input_device no further use should be made of the object.

Pk_video_capture_info

This structure has no members that are accessible to the user. It is used to describe the parameters that affect the video capture process. A number of methods allow the parameters to be changed. If a particular Pk_video_capture_info instance is being used to capture continuous video frames then changes will take place immediately.

3.2 Pk_board Methods pk_create_board int pk_create_board(char *devname, int bus, int dev, int func, int

*errcode);

This function takes as parameters the information necessary to specify a particular Peritek PCI or PMC graphics board in a system and returns a pointer to an object that can be used to access that board. The information necessary to specify a particular board is the device file name, if any, and the device's bus number, device number and function number. The bus, device, and function numbers are physical properties of the PCI bus. The bus and device numbers are system specific. The Peritek VFX-M and VCQ-M boards are single function devices, according to the terminology of the PCI standard, and have a function number of 0. Returns 0 on error.

pk_get_boardinfo int pk_get_boardinfo(Pk_board *board, int info, unsigned int *value);

Query specific properties of the graphics board. The following values for info are supported for all boards. PK_BOARD_INFO_BOARDTYPE

Get type of graphics board referenced by this Pk_board object. The result returned in the location pointed to by value will be one of the following constants. PK_BOARD_TYPE_HOSTMEMPK_BOARD_TYPE_VFX

PK_BOARD_TYPE_VCQM

Returns 0 on error.

pk_set_framebuffer int pk_set_framebuffer(Pk_board *board, int width, int height, int

freq, int vwidth, int vheight, int pixformat, int doublebuf);

Page 41: Version 2.0 PRELIMINARY · PMC and PCI Graphics Version 2.0 PRELIMINARY 10 April 2001 Peritek Corporation 5550 Redwood Road Oakland, CA 94619 (510) 531-6500 FAX (510) 530-8563

The libPK library

41

This method sets the frame buffer geometry, allocates space out of the video memory array for the frame buffer, allocates the optional back buffer, programs the video timing registers, PLL’s and RAMDAC control registers. Width and height are the size of the visible area that is to be displayed on the monitor. The granularity of control over the width of the visible display area varies by graphics board type, configuration, and pixel format. The current worst case resolution is 16-pixels in 8bpp mode on the VFX-M. If the value of the width parameter is not a multiple of the granularity then the width will be rounded up to the next value that is a multiple of the granularity.

Freq is the display frame rate in 1/1000 Hertz increments. For a 60Hz refresh rate the freq parameter should be 60,000.

Vwidth and vheight are the width and height of the virtual frame buffer. They control the amount of video memory allocated for the frame buffer. They must always be greater than or equal to the size of the display area. If they are greater than the size of the display area then the pan methods may be used to pan the displayed region within the virtual frame buffer.

Pixformat is a numeric value that controls the format of pixels in the frame buffer. See the section for your particular graphics card for a list of pixel formats that are supported.

Doublebuf controls whether an optional back buffer is allocated out of video memory. If this parameter is non-zero then the back buffer will be allocated, otherwise it will not be. The displayed buffer can be changed with the pk_swap_buffers method. Returns 0 on error.

pk_get_videosize int pk_get_videosize(Pk_board *board, int *width, int *height);

Returns the width and height of displayed video memory in pixels. The values are returned in the locations pointed to by the width and height parameters. Returns non-zero if a valid width and height are returned. Otherwise, zero is returned. Zero will be returned if no call has been made to pk_set_framebuffer.

pk_get_drawable Pk_drawable *pk_get_drawable(Pk_board *board);

Returns a pointer to the special drawable that represents the displayable video memory of a board. This drawable always represents the primary planes. The

Page 42: Version 2.0 PRELIMINARY · PMC and PCI Graphics Version 2.0 PRELIMINARY 10 April 2001 Peritek Corporation 5550 Redwood Road Oakland, CA 94619 (510) 531-6500 FAX (510) 530-8563

Peritek GLP Manual

42

drawable for the overlay planes can be found by calling pk_overlay_drawable on the returned drawable. If display memory has not yet been configured with a call to pk_set_framebuffer, a null pointer is returned.

pk_get_errorcode int pk_get_errorcode(Pk_board *board);

Most functions do not return specific error status, either no error indication is returned at all, or a zero or negative one (-1) is returned to indicate that an error occurred. The pk_get_errorcode function allows for a more specific error indication to be returned. Depending upon the error code that is returned additional error status may be available.

pk_set_errorcode void pk_set_errorcode(Pk_board *board, int code);

This function sets the current error code. The error code can be queried with the pk_get_errorcode function.

pk_create_drawable Pk_drawable *pk_create_drawable(Pk_board *board, int width, int height,

int pixformat, int memspace);

This function is used to create an off screen drawable. The width and height parameters control the size of the off screen drawable. The pixformat parameter is specific to the graphics board in use; the section for the specific graphics board should be consulted. For boards that have multiple memories that can be rendered in (i. e. the VFX-M has both 8MB of VRAM and 64MB of DRAM) the memspace parameter specifies the memory out of which to allocate the off screen drawable. If there is insufficient space to allocate the off screen drawable, then a null pointer will be returned. The drawable should released when it is no longer needed by calling pk_destroy_drawable.

pk_get_cursordrawable

int pk_get_cursordrawable(Pk_board *board);

Returns a pointer to the cursor drawable. Returns 0 on error.

pk_set_cursorhotspot

int pk_set_cursorhotspot(Pk_board *board, int x, int y);

Page 43: Version 2.0 PRELIMINARY · PMC and PCI Graphics Version 2.0 PRELIMINARY 10 April 2001 Peritek Corporation 5550 Redwood Road Oakland, CA 94619 (510) 531-6500 FAX (510) 530-8563

The libPK library

43

Sets the location of the cursor hot spot. This is the point in the cursor that will be positioned by the pk_position_cursor method. The hot spot is relative to the upper left hand corner of the cursor image. Returns 0 on error.

pk_position_cursor

int pk_position_cursor(Pk_board *board, int x, int y);

Positions the cursor hot spot to the display coordinates (x, y). Returns 0 on error. pk_create_truetype_font Pk_font *pk_create_truetype_font(Pk_board *board, char *filename);

This function is used to create a font object. The font information will come from the TrueType font file named filename. The returned font object will have methods that are specific to both the graphics board and TrueType fonts.

pk_create_ti_font Pk_font *pk_create_ti_font(Pk_board *board, char *filename);

Return a font object for the TI font data located in the file named filename. pk_create_ti_font_mem Pk_font *pk_create_ti_font_mem(Pk_board *board, unsigned char *font,

int fontlen);

Returns a font object for the TI font data located in memory at location font. The font data is fontlen bytes long.

pk_video_enable void pk_video_enable(Pk_board *board, int onoff);

The onoff parameter controls whether video output is enabled (on) or disabled (off). When video is disabled, horizontal and vertical syncs may or may not be disabled depending upon the model of the graphics board.

pk_swap_buffers void pk_swap_buffers(Pk_board *board, int wait);

The displayed buffer is swapped between the front buffer and the back buffer. If the front buffer is currently displayed then the back buffer will be displayed upon return. If the back buffer is currently displayed then the front buffer will be displayed upon

Page 44: Version 2.0 PRELIMINARY · PMC and PCI Graphics Version 2.0 PRELIMINARY 10 April 2001 Peritek Corporation 5550 Redwood Road Oakland, CA 94619 (510) 531-6500 FAX (510) 530-8563

Peritek GLP Manual

44

return. The wait parameter controls whether it is necessary to wait for vertical sync prior to swapping the buffers.

pk_pan_absolute void pk_pan_absolute(Pk_board *board, int x, int y);

If the width or height of the displayed drawable is larger than the width or height of the display, then the display may be panned within the area of the display drawable.

The x parameter is the pan offset in pixels along the x-axis. Adjusting the pan position from 16 to 32 causes the display to appear to move to the left. The x-axis pan increment may be granular in which case the display position can only be adjusted in multiples of some number of pixels, this is usually a power of two.

The y parameter is the pan offset in pixels along the y-axis. Adjusting the pan position from 1 to 2 causes the display to appear to move up.

pk_pan_relative void pk_pan_relative(Pk_board *board, int deltax, int deltay);

This function is similar pk_pan_absolute, except that they x and y-axis offsets are relative to the current pan position.

pk_get_pixelinfo Pk_pixelinfo *pk_get_pixelinfo(Pk_board *board, int pixformat);

A pixelinfo structure is returned for the pixel format specified by pixformat. The pixel information returned is graphics board specific. The layout of the pixelinfo structures was described earlier. A null pointer is returned if the pixel format is not supported.

pk_read_flash

int pk_read_flash(Pk_board *board, int offset, unsigned char *buf, intlen);

The contents of the boards BIOS flash memory beginning at offset are copied into the buffer buf. Up to len bytes are copied. The number of bytes actually copied is returned.

pk_write_flash int pk_write_flash(Pk_board *board, int offset, unsigned char *buf, int

len);

Page 45: Version 2.0 PRELIMINARY · PMC and PCI Graphics Version 2.0 PRELIMINARY 10 April 2001 Peritek Corporation 5550 Redwood Road Oakland, CA 94619 (510) 531-6500 FAX (510) 530-8563

The libPK library

45

The contents of the boards BIOS flash memory beginning at offset are programmed from the contents of the buffer buf. Up to len bytes are programmed. The number of bytes actually programmed is returned.

Board Type BIOS flash memory size VFX-M 128Kb VCQ-M 128Kb

pk_read_seeprom int pk_read_seeprom(Pk_board *board, int offset, unsigned char *buf,

int len);

The contents of the boards serial EEPROM memory beginning at offset are copied into the buffer buf. Up to len bytes are copied. The number of bytes actually copied is returned.

pk_write_seeprom int pk_write_seeprom(Pk_board *board, int offset, unsigned char *buf,

int len);

The contents of the boards serial EEPROM memory beginning at offset are programmed from the contents of the buffer buf. Up to len bytes are programmed. The number of bytes actually programmed is returned.

Board Type Serial EEPROM memory size VFX-M 256 bytes VCQ-M 256 bytes

3.3 Pk_colormap Methods pk_lookup_color

unsigned int pk_lookup_color(Pk_colormap *cmap, int r, int g, int b);

Returns the index of the color cell that contains the color closest to the requested color. The r, g, and b fields specify the pixel colors and must contain value between zero and 65535. Zero represents 0% of the color, 65535 represents 100% of the color.

pk_allocate_color

unsigned int pk_allocate_color(Pk_colormap *cmap, int r, int g, int b);

Returns the index of a color cell that contains the specified red, green, and blue values. The color in the color cell can not be changed while the colorcell is in use.

Page 46: Version 2.0 PRELIMINARY · PMC and PCI Graphics Version 2.0 PRELIMINARY 10 April 2001 Peritek Corporation 5550 Redwood Road Oakland, CA 94619 (510) 531-6500 FAX (510) 530-8563

Peritek GLP Manual

46

pk_allocate_closest_color

unsigned int pk_allocate_closest_color(Pk_colormap *cmap, int r, int g,int b);

Returns the index of a color cell that contains either the specified red, green, and blue values or red, green and blue values that are “close” to the specified color. The color in the color cell can not be changed while the colorcell is in use.

pk_allocate_colorcell

unsigned int pk_allocate_colorcell(Pk_colormap *cmap);

Returns the index of an uninitialized color cell. pk_set_color can be used to set the color of the color cell. The returned color cell will not be reused by pk_allocate_color or pk_allocate_closest_color.

pk_allocate_colorcells

unsigned int pk_allocate_colorcells(Pk_colormap *cmap, int numcells);

Same as pk_allocate_colorcell except that multiple contiguous colorcells are allocated in a single call.

pk_release_color

int pk_release_color(Pk_colormap *cmap, unsigned int index);

Releases a color cell allocated with pk_allocate_color, pk_allocate_closest_color, or pk_allocate_colorcell. Returns 0 on error.

pk_release_colors

int pk_release_colors(Pk_colormap *cmap, unsigned int index, intnumcolors);

Releases a contiguous set of colorcells that were allocated with a call to pk_allocate_colorcells. Returns 0 on error.

pk_allocate_colorplanes

unsigned int pk_allocate_colorplanes(Pk_colormap *cmap, int numred, intnumgreen, int numblue);

Allocates one or more bits of the pixel data.

pk_release_colorplanes

Page 47: Version 2.0 PRELIMINARY · PMC and PCI Graphics Version 2.0 PRELIMINARY 10 April 2001 Peritek Corporation 5550 Redwood Road Oakland, CA 94619 (510) 531-6500 FAX (510) 530-8563

The libPK library

47

int pk_release_colorplanes(Pk_colormap *cmap, unsigned int planes);

Releases one or more bits of pixel data that were allocated with pk_allocate_colorplanes. Returns 0 on error.

pk_set_color

int pk_set_color(Pk_colormap *cmap, unsigned int index, int r, int g,int b);

Changes the color stored in a color cell allocated with pk_allocate_colorcell, pk_allocate_colorcells, or pk_allocate_colorplanes. Returns 0 on error.

pk_set_colors

int pk_set_colors(Pk_colormap *cmap, unsigned int index, int num, short*r, short *g, short *b);

Changes the colors stored in one or more contiguous color cells allocated with pk_allocate_colorcells. The values in location 0 to num – 1 in the arrays r, g and b will be mapped to pixel values index to index + num – 1. Returns 0 on error.

pk_set_colors_random

int pk_set_colors_random(Pk_colormap *cmap, int num, unsigned int*index, short *r, short *g, short *b);

Changes the color stored in one or more color cells allocated with pk_allocate_colorcell, pk_allocate_colorcells, or pk_allocate_colorplanes. The num pixel values returned in the array index are mapped to the values from 0 to num – 1 in the arrays r, g and b. Returns 0 on error.

pk_get_color

int pk_get_color(Pk_colormap *cmap, unsigned int index, short *r, short*g, short *b);

Returns the red, green and blue values stored in a color cell in r, gand b. Returns 0 on error.

pk_get_colors

int pk_get_colors(Pk_colormap *cmap, unsigned int index, int num, short*r, short *g, short *b);

Returns the colors stored in one or more contiguous color cells. Returns 0 on error.

pk_get_colors_random

Page 48: Version 2.0 PRELIMINARY · PMC and PCI Graphics Version 2.0 PRELIMINARY 10 April 2001 Peritek Corporation 5550 Redwood Road Oakland, CA 94619 (510) 531-6500 FAX (510) 530-8563

Peritek GLP Manual

48

int pk_get_colors_random(Pk_colormap *cmap, int num, unsigned int*index, short *r, short *g, short *b);

Returns the colors stored in one or more color cells. The index array contains the indices of the color cells that should be used to retrieve the r, g and b values. Returns 0 on error.

3.4 Pk_drawable Methods pk_get_board Pk_board *pk_get_board(Pk_drawable *drawable);

Returns a pointer to the board associated with a drawable.

pk_front_drawable

Pk_drawable *pk_front_drawable(Pk_drawable *drawable);

Returns a pointer to the drawable itself, if it is a front drawable, or to the associated front drawable. Used when double buffering.

pk_back_drawable

Pk_drawable *pk_back_drawable(Pk_drawable *drawable);

Returns a pointer to the drawable itself, if it is a back drawable, or to the associated back drawable. Used when double buffering.

pk_primary_drawable

Pk_drawable *pk_primary_drawable(Pk_drawable *drawable);

Returns a pointer to the drawable itself, if it is a primary drawable, or to the associated primary drawable if the input drawable is an overlay drawable.

pk_overlay_drawable

Pk_drawable *pk_overlay_drawable(Pk_drawable *drawable);

Returns a pointer to the drawable itself, if it is an overlay drawable, or to the overlay display drawable associated with the input primary drawable, if any.

pk_create_front_drawable

Pk_drawable *pk_create_front_drawable(Pk_drawable *drawable);

Page 49: Version 2.0 PRELIMINARY · PMC and PCI Graphics Version 2.0 PRELIMINARY 10 April 2001 Peritek Corporation 5550 Redwood Road Oakland, CA 94619 (510) 531-6500 FAX (510) 530-8563

The libPK library

49

Create a front drawable from the input drawable. Returns NULL on failure.

pk_create_back_drawable

Pk_drawable *pk_create_back_drawable(Pk_drawable *drawable);

Creates a back drawable from the input drawable. Returns NULL on failure.

pk_create_primary_drawable

Pk_drawable *pk_create_primary_drawable(Pk_drawable *drawable); Create a primary display drawable from the input drawable. Returns NULL on failure.

pk_create_overlay_drawable

Pk_drawable *pk_create_overlay_drawable(Pk_drawable *drawable);

Create an overlay display drawable from the input drawable. Returns NULL on failure.

pk_destroy_drawable

void pk_destroy_drawable(Pk_drawable *drawable);

Destroys the input drawable; the pointer to the drawable should not be referenced after this call.

pk_get_size

int pk_get_size(Pk_drawable *drawable, int *width, int *height);

Sets width and height to point to the width and height of the drawable in pixels. Returns 0 on error.

pk_get_cliprect

int pk_get_cliprect(Pk_drawable *drawable, int *left, int *top, int*right, int *bottom);

Sets left, top, right and bottom to point to the bounds of the clipping rectangle associated with the drawable. Returns 0 on error.

pk_get_pixformat

int pk_get_pixformat(Pk_drawable *drawable);

Page 50: Version 2.0 PRELIMINARY · PMC and PCI Graphics Version 2.0 PRELIMINARY 10 April 2001 Peritek Corporation 5550 Redwood Road Oakland, CA 94619 (510) 531-6500 FAX (510) 530-8563

Peritek GLP Manual

50

Returns the pixel format in use on the drawable. Pixel formats available for each board are described in the section for that board.

pk_get_depth

int pk_get_depth(Pk_drawable *drawable);

Returns the pixel size in use on the drawable.

pk_get_memspace

int pk_get_memspace(Pk_drawable *drawable);

Returns the memory space in use for the drawable. Memory space designations are board specific and described in the sections Error! Reference source not found. and 5.2.

pk_set_cliprect

void pk_set_cliprect(Pk_drawable *drawable, int left, int top, intright, int bottom);

Sets the clipping rectangle for the drawable to the bounds left, top, right and bottom..

pk_make_color

unsigned int pk_make_color(Pk_drawable *drawable, int r, int g, int b);

Returns the pixel value to use for the red/green/blue value r, g, b with the input drawable. Red, green and blue values should be in the range 0 to 65535.

pk_extract_color

void pk_extract_color(Pk_drawable *drawable, unsigned int pixel, short*r, short *g, short *b);

Returns the rgb value assigned to the pixel value for the input drawable..

pk_read_pixel

int pk_read_pixel(Pk_drawable *drawable, int x, int y, unsigned int*color);

Returns the value of the pixel at the location (x, y) in the input drawable in the integer pointed to by color. Returns 0 on error.

Page 51: Version 2.0 PRELIMINARY · PMC and PCI Graphics Version 2.0 PRELIMINARY 10 April 2001 Peritek Corporation 5550 Redwood Road Oakland, CA 94619 (510) 531-6500 FAX (510) 530-8563

The libPK library

51

pk_draw_pixel

void pk_draw_pixel(Pk_drawable *drawable, int x, int y, unsigned intcolor);

Draws a pixel of the input color at location (x, y).

pk_draw_line

void pk_draw_line(Pk_drawable *drawable, int x0, int y0, int x1, inty1, unsigned int color);

Draws a line of the input color from (x0, y0) to (x1, y1). The pixels at (x0, y0) and (x1, y1) will both be drawn.

pk_draw_triangle

void pk_draw_triangle(Pk_drawable *drawable, int x0, int y0, int x1,int y1, int x2, int y2, unsigned int color);

Draws a triangle of the input color with vertices (x0, y0), (x1, y1), and (x2, y2).

pk_draw_rectangle

void pk_draw_rectangle(Pk_drawable *drawable, int left, int top, intright, int bottom, unsigned int color);

Draws a rectangle of the input color with bounds left, top, right, and bottom.

pk_draw_polygon

void pk_draw_polygon(Pk_drawable *drawable, int npoints, short *x,short *y, unsigned int color);

Draws a polygon of the input color with npoints vertices; the x-coordinates of the vertices are in the array x, the y-coordinates of the vertices are in the array y.

pk_draw_polyline

void pk_draw_polyline(Pk_drawable *drawable, int npoints, short *x,short *y, unsigned int color);

Draws a polyline of the input color between npoints points; the x-coordinates of the points are in the array x, the y-coordinates of the points are in the array y..

pk_draw_linesegs

void pk_draw_linesegs(Pk_drawable *drawable, int nsegs, short *x, short*y, unsigned int color);

Page 52: Version 2.0 PRELIMINARY · PMC and PCI Graphics Version 2.0 PRELIMINARY 10 April 2001 Peritek Corporation 5550 Redwood Road Oakland, CA 94619 (510) 531-6500 FAX (510) 530-8563

Peritek GLP Manual

52

Draws nsegs line segments of the input color. The 2 * nsegs x-coordinates of the segment endpoints are in the array x, the 2 * nsegs y-coordinates of the segment endpoints are in the array y..

pk_draw_circle

void pk_draw_circle(Pk_drawable *drawable, int x, int y, int radius,unsigned int color);

Draws a circle of the input color with radius radius and center (x, y).

pk_draw_ellipse

void pk_draw_ellipse(Pk_drawable *drawable, int x, int y, int width,int height, unsigned int color);

Draws an ellipse of the input color with horizontal axis of width width and vertical axis of height height and center (x,y).

pk_draw_arc

void pk_draw_arc(Pk_drawable *drawable, int x, int y, int width, intheight, int theta, int arc, unsigned int color);

The starting angle, theta, is measured from the center of the right side of the enclosing rectangle, is expressed in degrees, and is treated modulo 360. Positive angles are in the clockwise direction. The arc extent specifies the number of degrees (positive or negative) spanned by the arc; if the absolute value of arc is greater than or equal to 360, the entire ellipse is drawn.[Under construction, contact Peritek if you need this function.] .

pk_draw_piearc

void pk_draw_piearc(Pk_drawable *drawable, int x, int y, int width, intheight, int theta, int arc, unsigned int color);

Draws an arc, with parameters as for pk_draw_arc, and connects the endpoints of the arc to the center (x, y). [Under construction, contact Peritek if you need this function.]

pk_fill_triangle

void pk_fill_triangle(Pk_drawable *drawable, int x0, int y0, int x1,int y1, int x2, int y2, unsigned int color);

Draws a filled triangle with vertices (x0, y0), (x1, y1), and (x2, y2) with the input color.

Page 53: Version 2.0 PRELIMINARY · PMC and PCI Graphics Version 2.0 PRELIMINARY 10 April 2001 Peritek Corporation 5550 Redwood Road Oakland, CA 94619 (510) 531-6500 FAX (510) 530-8563

The libPK library

53

pk_fill_rectangle

void pk_fill_rectangle(Pk_drawable *drawable, int left, int top, int

right, int bottom, unsigned int color);

Draws a filled rectangle with bounds left, top, right, and bottom with the input color.

pk_fill_polygon

void pk_fill_polygon(Pk_drawable *drawable, int npoints, short *x,short *y, unsigned int color);

Draws a filled polygon of npoints vertices with the input color; the npoints x-coordinates of the vertices are in the array x, the npoints y-coordinates of the vertices are in the array y.

pk_fill_circle

void pk_fill_circle(Pk_drawable *drawable, int x, int y, int radius,unsigned int color);

Draws a filled circle with radius radius and center (x, y) with the input color.

pk_fill_ellipse

void pk_fill_ellipse(Pk_drawable *drawable, int x, int y, int width,int height, unsigned int color);

Draws a filled ellipse with horizontal axis of width width and vertical axis of height height and center (x,y) with the input color.

pk_fill_piearc

void pk_fill_piearc(Pk_drawable *drawable, int x, int y, int width, intheight, int theta, int arc, unsigned int color);

Draws a filled pie arc, with parameters as for pk_draw_piearc, with the input color. [Under construction, contact Peritek if you need this function.]

pk_create_colormap

Pk_colormap *pk_create_colormap(Pk_drawable *drawable);

Returns a pointer to a colormap that has been created and associated with the input drawable. Returns NULL on failure.

Page 54: Version 2.0 PRELIMINARY · PMC and PCI Graphics Version 2.0 PRELIMINARY 10 April 2001 Peritek Corporation 5550 Redwood Road Oakland, CA 94619 (510) 531-6500 FAX (510) 530-8563

Peritek GLP Manual

54

pk_get_colormap

Pk_colormap *pk_get_colormap(Pk_drawable *drawable);

Returns a pointer to the colormap associated with a drawable.

pk_destroy_colormap

void pk_destroy_colormap(Pk_drawable *drawable);

Destroys the colormap; the pointer should not be used after this call.

pk_draw_char

int pk_draw_char(Pk_drawable *drawable, Pk_font *font, int x, int y,unsigned int ch, unsigned int color);

Draws character ch, in font font, at location (x, y) using pixel value color as determined by the colormap of the drawable. Returns 0 on error.

pk_draw_text

int pk_draw_text(Pk_drawable *drawable, Pk_font *font, int x, int y,char *buf, int len, unsigned int color);

Draws len characters (from an 8-bit character set) from the buffer buf, in font font, at location (x, y) using pixel value color as determined by the colormap of the drawable. Returns 0 on error.

pk_draw_text16

int pk_draw_text16(Pk_drawable *drawable, Pk_font *font, int x, int y,short *buf, int len, unsigned int color);

Draws len characters (from a 16-bit character set) from the buffer buf, in font font, at location (x, y) using pixel value color as determined by the colormap of the drawable. Returns 0 on error.

pk_draw_text32

int pk_draw_text32(Pk_drawable *drawable, Pk_font *font, int x, int y,int *buf, int len, unsigned int color);

Draws len characters (from a 32-bit character set) from the buffer buf, in font font, at location (x, y) using pixel value color as determined by the colormap of the drawable. Returns 0 on error.

Page 55: Version 2.0 PRELIMINARY · PMC and PCI Graphics Version 2.0 PRELIMINARY 10 April 2001 Peritek Corporation 5550 Redwood Road Oakland, CA 94619 (510) 531-6500 FAX (510) 530-8563

The libPK library

55

pk_draw_string

int pk_draw_string(Pk_drawable *drawable, Pk_font *font, int x, int y,char *str, unsigned int color);

Draws characters (from an 8-bit character set) from the null-terminated string str, in font font, at location (x,y) using pixel value color as determined by the colormap of the drawable. Returns 0 on error.

pk_draw_string16

int pk_draw_string16(Pk_drawable *drawable, Pk_font *font, int x, inty, short *str, unsigned int color);

Draws characters (from a 16-bit character set) from the null-terminated string str, in font font, at location (x,y) using pixel value color as determined by the colormap of the drawable. Returns 0 on error.

pk_draw_string32

int pk_draw_string32(Pk_drawable *drawable, Pk_font *font, int x, inty, int *str, unsigned int color);

Draws characters (from a 32-bit character set) from the null-terminated string str, in font font, at location (x,y) using pixel value color as determined by the colormap of the drawable. Returns 0 on error.

pk_bitblt

void pk_bitblt(Pk_drawable *src, int sx, int sy, Pk_drawable *dest, intdx, int dy, int width, int height, int op);

Applies the logical operation op to pixels from the src and dest drawables and places the result in the dest drawable. For i from 0 to width – 1, j from 0 to height – 1, take the pixel value S at location (sx + i, sy + j) in the src drawable, combine it with pixel value D at location (dx + i, dy + j) in the dest drawable, getting the result as shown in the following table and placing it at location (dx + i, dy + j) in the dest drawable. If any of the locations are out of range for the drawable referenced, nothing is done to the destination drawable for that (i, j).

Constant name op Destination pixel value PK_ROP_CLEAR all 0’s PK_ROP_NOR ~(S | D) PK_ROP_ANDINV ~S & D PK_ROP_COPYINV ~S PK_ROP_ANDREV S & ~D PK_ROP_INV ~D PK_ROP_XOR S ^ D

Page 56: Version 2.0 PRELIMINARY · PMC and PCI Graphics Version 2.0 PRELIMINARY 10 April 2001 Peritek Corporation 5550 Redwood Road Oakland, CA 94619 (510) 531-6500 FAX (510) 530-8563

Peritek GLP Manual

56

PK_ROP_NAND ~(S & D) PK_ROP_AND S & D PK_ROP_EQUIV ~(S ^ D) PK_ROP_NOP D PK_ROP_ORINV ~S | D PK_ROP_COPY S PK_ROP_ORREV S | ~D PK_ROP_OR S | D PK_ROP_SET all 1’s

pk_block_copy

void pk_block_copy(Pk_drawable *src, int sx, int sy, Pk_drawable *dest,

int dx, int dy, int width, int height);

Copies pixels from the src drawable and places the result in the dest drawable. For i from 0 to width – 1, j from 0 to height – 1, put the pixel value S from location (sx + i, sy + j) in the src drawable at location (dx + i, dy + j) in the dest drawable. If any of the locations are out of range for the drawable referenced, nothing is done to the destination drawable for that (i, j).

pk_shaded_line

void pk_shaded_line(Pk_drawable *drawable, int x0, int y0, int r0, intg0, int b0, int x1, int y1, int r1, int g1, int b1);

Draws a line from (x0, y0) to (x1, y1) in the drawable, shading it from rgb color (r0, g0, b0) to color (r1, g1, b1).

pk_shaded_triangle

void pk_shaded_triangle(Pk_drawable *drawable, int x0, int y0, int r0,int g0, int b0, int x1, int y1, int r1, int g1, int b1, int x2,int y2, int r2, int g2, int b2);

Draws a shaded triangle, with vertex (x0, y0) having color (r0, g0, b0), vertex (x1, y1) having color (r1, g1, b1) and vertex (x2, y2) having color (r2, g2, b2).

pk_read_span

int pk_read_span(Pk_drawable *drawable, int x, int y, int width, void*buf);

Reads a horizontal span of width pixels, starting at location (x, y) from the drawable into the buffer buf. The type of buf should be either unsigned char, unsigned

short or unsigned int depending on the pixel size. For pixel sizes eight bits or less the type should be unsigned char, for nine to 16 bits, the type should be unsigned short, and for 17 to 32 bits, unsigned int. Returns 0 on error.

Page 57: Version 2.0 PRELIMINARY · PMC and PCI Graphics Version 2.0 PRELIMINARY 10 April 2001 Peritek Corporation 5550 Redwood Road Oakland, CA 94619 (510) 531-6500 FAX (510) 530-8563

The libPK library

57

pk_write_span

int pk_write_span(Pk_drawable *drawable, int x, int y, int width, void

*buf);

Writes a horizontal span of width pixels, starting at location (x, y) into the drawable from the buffer buf. See pk_read_span for a description of the type of the array buf. Returns 0 on error.

pk_read_pixmap

int pk_read_pixmap(Pk_drawable *drawable, int x, int y, int width, intheight, int pitch, void *buf);

Reads an area of width by height pixels with upper left corner at location (x, y) in the drawable, and copies it into a buffer buf with pitch pitch. The pitch of the buffer is the increment to use for the width of a row in the buf whenever the y coordinate is incremented when copying the pixels. The buffer buf is logically a two-dimensional array of a data type the same size as a pixel; the array may have rows wider than width, and must have at least height rows. See pk_read_span for a description of the type of the array buf. Returns 0 on error.

pk_write_pixmap

int pk_write_pixmap(Pk_drawable *drawable, int x, int y, int width, intheight, int pitch, void *buf);

Writes an area of width by height pixels with upper left corner at location (x, y) into the drawable, getting the data from a buffer buf with pitch pitch. The pitch of the buffer is the increment to use for the width of a row in the buf whenever the y coordinate is incremented when copying the pixels. The buffer buf is logically a two-dimensional array of a data type the same size as a pixel; the array may have rows wider than width, and must have at least height rows. See pk_read_span for a description of the type of the array buf. Returns 0 on error.

pk_flush

void pk_flush(Pk_drawable *drawable);

Flushes any caches associated with the drawable. Pixels written to a drawable may not appear on the screen until afterpk_flush has been called.

3.5 Pk_font Methods pk_destroy_font

void pk_destroy_font(Pk_font *font);

Page 58: Version 2.0 PRELIMINARY · PMC and PCI Graphics Version 2.0 PRELIMINARY 10 April 2001 Peritek Corporation 5550 Redwood Road Oakland, CA 94619 (510) 531-6500 FAX (510) 530-8563

Peritek GLP Manual

58

Destroys a font object that was originally created by pk_create_ti_font, pk_create_ti_font_mem, or pk_create_truetype_font..

pk_get_ascent

int pk_get_ascent(Pk_font *font);

Returns the distance in pixels from the base line to the topmost pixel drawn for any character in the font..

pk_get_descent

int pk_get_descent(Pk_font *font);

Returns the distance in pixels from the base line to the lowest pixel drawn for any character in the font.

pk_get_spacing

int pk_get_spacing(Pk_font *font);

Returns the vertical spacing for the font..

pk_glyph_info

int pk_glyph_info(Pk_font *font, unsigned int ch, Pk_glyph_info *info);

Returns a variety of information about the glyph for the character ch in the font. See the description of Pk_glyph_info.

3.6 Pk_video_input_device

pk_create_video_input_device Pk_video_input_device *pk_create_video_input_device(char *devname, int

bus, int dev, int func, int *errcode);

This function takes as parameters the information necessary to specify a particular Peritek PCI or PMC video input device in a system and returns a pointer to an object that can be used to access that device. The information necessary to specify a particular device is the device file name, if any, and the device’s bus number, device number and function nember. The bus, device, and function numbers are physical properties of the PCI bus. The bus and device numbers are system specific. The Peritek VFG-M board’s Bt848A is a multi function device. Function zero (0) of this device is the video capture funcion and thus the func argument should always be 0

Page 59: Version 2.0 PRELIMINARY · PMC and PCI Graphics Version 2.0 PRELIMINARY 10 April 2001 Peritek Corporation 5550 Redwood Road Oakland, CA 94619 (510) 531-6500 FAX (510) 530-8563

The libPK library

59

for this device. Function one (1) of this device is the audio capture function and is not supported on the Peritek VFG-M.

pk_capture_single_frame int pk_capture_single_frame(Pk_video_input_device *device);

This function enables a single frame to be captured and output onto the drawable. pk_capture_multiple_frames int pk_capture_multiple_frames(Pk_video_input_device *device, int

numframes);

This funtion enables multiple frames to be captured. numframes should be less than 925.

pk_capture_continuous int pk_capture_continuous(Pk_video_input_device *device);

This function enables the incoming video signal to be captured coninuously.

3.7 Pk_video_capture_info Currently this set of routines exists only as a lower-level library, bt848_, supporting video capture on the VFG-M under Tornado 1 & 2 (VxWorks 5.3 and 5.4). pk_set_source int pk_set_source(Pk_video_capture_info *info, int source);

This function enables the user to change the source of video input. A value of 0 for source defines MUX0 (VGA pin 1: red), 1 is MUX1 (VGA pin 14: vsync), 2 is MUX2 (VGA pin 2: green) and 3 is MUX3 (VGA pin 3: blue).

pk_get_source int pk_get_source(Pk_video_capture_info *info, int *source);

pk_set_video_format int pk_set_video_format(Pk_video_capture_info *info, int format);

This function allows the user to activate various formats of video input. The user should enter as the format parameter a value of 0 for Auto format detection, 1 for NTSC (M), 2 for NTSC w/o pedestal (Japan), 3 for PAL (B, D, G, H, I), 4 for PAL (M), 5 for PAL (N), 6 for SECAM, and 7 for PAL (N-combination).

Page 60: Version 2.0 PRELIMINARY · PMC and PCI Graphics Version 2.0 PRELIMINARY 10 April 2001 Peritek Corporation 5550 Redwood Road Oakland, CA 94619 (510) 531-6500 FAX (510) 530-8563

Peritek GLP Manual

60

pk_get_video_format int pk_get_video_format(Pk_video_capture_info *info, int *format);

pk_set_xt int pk_set_xt(Pk_video_capture_info *info, int xt);

This function enables the user to manually change the clock source. XTAL0 is for NTSC, XTAL1 is for PAL/SECAM.

pk_get_xt int pk_get_xt(Pk_video_capture_info *info, int *xt);

pk_set_horz_scaling int pk_set_horz_scaling(Pk_video_capture_info *info, int factor);

This function sets the amount by which the original image is scaled down. E.g. a value of 2 for factor would produce an image with half the original width.

pk_get_horz_scaling int pk_get_horz_scaling(Pk_video_capture_info *info, int *factor);

pk_set_vert_scaling int pk_set_vert_scaling(Pk_video_capture_info *info, int factor);

This function sets the amount by which the original image is scaled down. E.g. a value of 2 for factor would produce an image with half the original height.

pk_get_vert_scaling int pk_get_vert_scaling(Pk_video_capture_info *info, int *factor);

pk_set_cropping int pk_set_cropping(Pk_video_capture_info *info, int left, int top, int

right, int bottom);

This function produces the portion of the original image inside a rectangle defined by the coordinate values of left, top, right, and bottom. The point (0, 0) is the upper-left corner of the screen.

pk_get_cropping

Page 61: Version 2.0 PRELIMINARY · PMC and PCI Graphics Version 2.0 PRELIMINARY 10 April 2001 Peritek Corporation 5550 Redwood Road Oakland, CA 94619 (510) 531-6500 FAX (510) 530-8563

The libPK library

61

int pk_get_cropping(Pk_video_capture_info *info, int *left, int *top,int *right, int *bottom);

pk_set_display_location int pk_set_display_location(Pk_video_capture_info *info, int display_x,

int display_y);

This function sets the location of the video image within the drawable where it is being displayed. The default location is (0, 0): the upper-left corner of the screen.

pk_get_display_location int pk_get_display_location(Pk_video_capture_info *info, int

*display_x, int *display_y);

pk_set_decimation int pk_set_decimation(Pk_video_capture_info *info, double percent);

This function determines the number of fields or frames dropped per second to compensate for bandwidth and system restrictions. Whether fields or frames are decimated is determined by the value of the DEC_FIELD bit on the Bt848.

pk_get_decimation int pk_get_decimation(Pk_video_capture_info *info, double *percent);

pk_set_contrast int pk_set_contrast(Pk_video_capture_info *info, double percent);

This function enables the user to manually adjust the contrast within a range of 0.00% to 235.06% of the original value. The default is 100.00%.

pk_get_contrast int pk_get_contrast(Pk_video_capture_info *info, double *percent);

pk_set_hue int pk_set_hue(Pk_video_capture_info *info, double degrees);

This function enables the user to manually adjust the hue of the decoded signal in NTSC. The hue can be shifted within a range of –90.0° to +89.3°, with a default of 0.0°. Hue adjustments can not be made when decoding PAL/SECAM.

pk_get_contrast

Page 62: Version 2.0 PRELIMINARY · PMC and PCI Graphics Version 2.0 PRELIMINARY 10 April 2001 Peritek Corporation 5550 Redwood Road Oakland, CA 94619 (510) 531-6500 FAX (510) 530-8563

Peritek GLP Manual

62

int pk_get_contrast(Pk_video_capture_info *info, double *degrees);

pk_set_u_saturation int pk_set_u_saturation(Pk_video_capture_info *info, double percent);

This function enables the user to manually adjust the U component of the incoming video signal within a range of 0.00% to 199.29% of the original value. The default is 100.00%

pk_get_u_saturation int pk_get_u_saturation(Pk_video_capture_info *info, double *percent);

pk_set_v_saturation int pk_set_v_saturation(Pk_video_capture_info *info, double percent);

This function enables the user to manually adjust the V component of the incoming video signal within a range of 0.00% to 286.17% of the original value. The default is 100.00%

pk_get_v_saturation int pk_get_v_saturation(Pk_video_capture_info *info, double *percent);

pk_set_brightness int pk_set_brightness(Pk_video_capture_info *info, double degrees);

This function enables the user to manually adjust the brightness of the incoming video signal within a range of 0.00% to 199.25% of the original value. The default is 100.00%

pk_get_brightness int pk_get_brightness(Pk_video_capture_info *info, double *degrees);

pk_set_coring int pk_set_coring(Pk_video_capture_info *info, int level);

Four coring values can be determined by the level input parameter: 0, 8, 16, or 32. If the total luminance level of the incoming signal is below the selected limit, the luminance signal is truncated to the black value.

pk_get_coring int pk_get_coring(Pk_video_capture_info *info, int *level);

Page 63: Version 2.0 PRELIMINARY · PMC and PCI Graphics Version 2.0 PRELIMINARY 10 April 2001 Peritek Corporation 5550 Redwood Road Oakland, CA 94619 (510) 531-6500 FAX (510) 530-8563

The libPK library

63

3.8 PCI access functions These functions are used in board initialization functions, and are primarily useful to the users of the GLP as an aide in installation and troubleshooting on Tornado 2 systems. show_pci_devices int show_pci_devices(int bus);

Currently tested only for Tornado 2 systems. Shows the contents of the PCI configuration header for the PCI device with the given bus number, device number and function number. Peritek graphics cards have function number 0.

pci_show_device_config void pci_show_device_config(char *devname, int bus, int dev, int func);

Shows the contents of the PCI configuration header for the PCI device with the given bus numberbus, device number dev and function number func. Peritek graphics cards have function number 0. On systems with drivers the device name is used as well

pci_read_config int pci_read_config(char *devname, int bus, int dev, int func, int

offset);

Returns the 32-bit integer value at integer-aligned byte-offset offset in the PCI configuration header for the PCI device at bus number bus, device number dev and function number func. Peritek graphics cards have function number 0. On systems with drivers the device name is used as well.

pci_write_config void pci_write_config(char *devname, int bus, int dev, int func, int

offset, int data);

Writes the 32-bit integer value data at integer-aligned byte-offset offset in the PCI configuration header for the PCI device at bus number bus, device number dev and function number func. Peritek graphics cards have function number 0. On systems with drivers the device name is used as well.

Page 64: Version 2.0 PRELIMINARY · PMC and PCI Graphics Version 2.0 PRELIMINARY 10 April 2001 Peritek Corporation 5550 Redwood Road Oakland, CA 94619 (510) 531-6500 FAX (510) 530-8563

Peritek GLP Manual

64

4 The libVFX library

This library implements specializations of the libPK library data structures and methods for the VFX-M. These structures and methods should generally be accessed using the functions from the libPK library. The libWs library, or for the time being, function pk_create_board, can be used to associate the appropriate methods with the Pk_board structure. In this section, information is given about the pixel formats available for this graphics board, the memory spaces that may be used for creating drawables, and the kinds of information about this board that may be obtained from pk_get_boardinfo, as well as about VFX-M specific functions.

No documentation is provided for most of the methods in libVFX. If you wish to program at that level, you must be prepared to spend time reading source code and the VFX-M Graphics Board User’s Manual. In addition to the VFX-M methods used by the libPK library, a full set of macros for reading and writing the registers of the Imagine 128 Number 9 graphics chip and the TVP3030 DAC is provided. See the header file vfx.h in the Peritek GLP distribution. Caution must be exercised in mixing direct hardware access with libPK calls. Contact Peritek for more information.

4.1 Pixel format The VFX-M provides a rich set of pixel formats. The following table shows the constant names designating the formats; include the header file vfx.h for the definitions. These constants may be used as the pixformat argument in calls to pk_set_framebuffer, pk_create_drawable, and Pk_pixelinfo. The latter function will give you more information about a given pixel format, see the description of Pk_pixelinfo in section 3.1.

pixformat Description VFX_PIXFORMAT_8BIT Eight bit pixel VFX_PIXFORMAT_16BIT_1555 16-bit pixel, 1 overlay, 5 red, 5 green, 5 blue VFX_PIXFORMAT_16BIT_4444 16-bit pixel, 4 red, 4 green, 4 blue, 4 overlay VFX_PIXFORMAT_16BIT_565 16-bit pixel, 5 red, 6 green, 5 blue VFX_PIXFORMAT_16BIT_664 16-bit pixel, 6 red, 6 green, 4 blue VFX_PIXFORMAT_24BIT_1888 24-bit pixel, 8 bits each color, 5 pixels per 16

bytes, 1 byte unused VFX_PIXFORMAT_24BIT_888 24-bit pixel, 8 bits each color, 16 pixels per 48

bytes, none unused VFX_PIXFORMAT_32BIT 32 bit pixel, 8 unused, 8 red, 8 green, 8 blue VFX_PIXFORMAT_32BIT_8888 32 bit pixel, 8 overlay, 8 red, 8 green, 8 blue

The colormap is used for looking up overlay colors in 16BIT_4444, 16BIT_1555,and 32BIT_8888 formats. The colormap is used for gamma correction in 16BIT_664, 16BIT_565, 24BIT_1888, 24BIT_888, and 32BIT modes. The colormap is used for color lookup in 8BIT mode

Page 65: Version 2.0 PRELIMINARY · PMC and PCI Graphics Version 2.0 PRELIMINARY 10 April 2001 Peritek Corporation 5550 Redwood Road Oakland, CA 94619 (510) 531-6500 FAX (510) 530-8563

The libVFX library

65

4.2 Memory spaces The VFX-M has three memory spaces; two of them can be used to create off-screen drawables.

memspace constant Usage

VFX_MEMSPACE_VMEMUsed for creating drawables in video memory.

VFX_MEMSPACE_DMEMUsed for creating drawables in off screen DRAM.

VFX_MEMSPACE_MMEMUsed to indicate mask memory. Drawable can not be created in mask memory.

4.3 Board info The following constants, defined in vfx.h, may be used as the info parameter with pk_get_boardinfo to get more information about your VFX-M. Board info constant Returned in value Notes VFX_BOARDINFO_MW0SIZE Size of memory window

zero. Likely to by 16 Mbytes, available for user applications.

VFX_BOARDINFO_MW1SIZE Size of memory window one.

Likely to be 32 Mbytes, used by the libVFX rendering functions;

VFX_BOARDINFO_XYWASIZE Size of XY window A. Likely to be 4 Mbytes, used by the libVFX rendering functions;

VFX_BOARDINFO_XYWBSIZE Size of XY window B. Likely to be 4 Mbytes, not usable.

VFX_BOARDINFO_RBASESIZE Size of control register space.

Should be 64Kbytes.

VFX_BOARDINFO_VMEMSIZE Size of installed video memory.

Usually 8 Mbytes.

VFX_BOARDINFO_DMEMSIZE Size of installed DRAM. Usually 64 Mbytes VFX_BOARDINFO_MMEMSIZE Size of installed mask

buffer DRAM. Usually 2 Mbytes.

VFX_BOARDINFO_VMEMFREE Video memory not currently allocated to drawables.

VFX_BOARDINFO_DMEMFREE DRAM not currently allocated to drawables.

VFX_BOARDINFO_MMEMFREE Mask memory DRAM not

Page 66: Version 2.0 PRELIMINARY · PMC and PCI Graphics Version 2.0 PRELIMINARY 10 April 2001 Peritek Corporation 5550 Redwood Road Oakland, CA 94619 (510) 531-6500 FAX (510) 530-8563

Peritek GLP Manual

66

currently allocated for fonts or patterns.

Memory window zero is the one available for use by user applications. Care should be taken when using this window with DRAM that the bank select control bit is set and restored properly. XY window B is not fully implemented on the Number Nine i128 series 2 part, and is therefore not usable. See the VFX-M Graphics Board User’s Manual for more information about memory windows on the i128. 4.4 VFX-M specific functions vfx_configure int vfx_configure(char *devname, int bus, int dev, int pcimembase, int

pciiobase, int interrupt_line);

Programs the VFX-M and Eclipse 2 the PCI configuration headers on systems where they are not correctly programmed on boot by the firmware or operating system. Programs the base address registers and interrupt line in the configuration header of the Imagine I128 chip. The address pcimembase should be a PCI memory space address, at a location with room for all the Peritek cards memory space requirements; the address pciiobase should be a PCI IO space address. See Section 2.4 and Figure 2-2 for more information.

vfx_load_timing

int vfx_load_timing(Vfx *vfx, double vfreq, double vblank, doublevfporch, double vsync, double hblank, double hfporch, doublehsync, int width, int height, int buswidth, int bitsperpixel, intpixelformat);

Allows more precise control over the setting of video timing. This function can be used after calling pk_set_framebuffer or it may be used without calling pk_set_framebuffer if care is taken to set up the primary drawable with a call to pk_create_drawable. vfreq is the vertical refresh frequency in hertz. vblank is the vertical blanking interval in seconds. vfporch is the interval between the start of blanking and the start of vertical sync in seconds. vsync is the duration of vertical sync in seconds. hblank is the hortizontal blanking interval in seconds. vfporch is the interval between the start of blanking and the start of horizontal sync in seconds. hsync is the duration of horizontal sync in seconds. width is the width of the display in pixels. height is the height of the display in scanlines. buswidth is the width the video memory bus in bits and should always be 64. bitsperpixel is the number of bits per pixel for the requested pixel format. pixelformat is the graphics board specific pixel format constant. Returns 0 on error.

vfx_show_timing

Page 67: Version 2.0 PRELIMINARY · PMC and PCI Graphics Version 2.0 PRELIMINARY 10 April 2001 Peritek Corporation 5550 Redwood Road Oakland, CA 94619 (510) 531-6500 FAX (510) 530-8563

The libVFX library

67

int vfx_show_timing(double vfreq, double vblank, double vfporch, doublevsync, double hblank, double hfporch, double hsync, int width,int height, int buswidth, int bitsperpixel, int pixelformat)

Display the computed timing information and control register values for the requested display timing. It should be used to verify that the VFX-M can adequately support your custom display timing. Parameter values are as for vfx_show_timing. Returns 0 on error.

vfx_adjust_timing

int vfx_adjust_timing(Vfx *vfx, int in_vfreq, int in_vblank, intin_vfporch, int in_vsync, int in_hblank, int in_hfporch, intin_hsync);

Adjust detailed timing parameters after the board has already been initialized to a particular resolution. Calls vfx_load_timing, so vfx_adjust_sync must be called after this if monitor does not use default sync set-up. Used to experiment with timing parameters on VxWorks, where the target shell does not support multiple double arguments. Once parameters are determined, vfx_load_timing should be used in the application.

vfx_adjust_sync

void vfx_adjust_sync(Vfx *vfx, int syncongreen, int hspolarity, intvspolarity, int compositesync, int pedestal)

Adjust the nature of the sync signals being sent to the monitor. The default set-up,set by calls to vfx_load_timing, is for no sync on green, separate rather than composite sync, active-low horizontal and vertical sync polarity, and enabled pedestal. To set sync on green, both the syncongreen and the compositesync parameters must be set to 1. A value of 0 for hspolarity or vspolarity makes the corresponding horizontal or vertical sync signal active-low (the default); a value of 1 makes the signal active-high. A value of 1 for pedestal enables it, 0 disables.

vfx_write_palette

void vfx_write_palette(Vfx *board, int index, int r, int g, int b);

This provides an alternate method of writing directly to the VFX-M color palette without going through the Pk_colormap methods. Care should be taken to use either one or the other of the two mechanisms. It is recommended that you use the Pk_colormap methods if at all possible since they are more likely to optimized in the future. vfx_write_palette does provide raw access to the color palette for those applications that require it.

Page 68: Version 2.0 PRELIMINARY · PMC and PCI Graphics Version 2.0 PRELIMINARY 10 April 2001 Peritek Corporation 5550 Redwood Road Oakland, CA 94619 (510) 531-6500 FAX (510) 530-8563

Peritek GLP Manual

68

5 The libVCQM library

This library implements specializations of the libPK library data structures and methods for the VCQ-M. These structures and methods should generally be accessed using the functions from the libPK library. The libWs library, or for the time being, function pk_create_board, can be used to associate the appropriate methods with the Pk_board structure.

A VCQ-M has four Cirrus Logic GD7555 graphics controllers; each of these is configured as a separate graphics “board” and may use different resolutions and pixel formats. In this section, information is given about the pixel formats, the memory spaces that may be used for creating drawables, and the kinds of information about this board that may be obtained from pk_get_boardinfo, as well as the VCQ-M specific functions in the library..

In addition to the VCQ-M methods used by the libPK library, a full set of macros for reading and writing the registers of the Cirrus Logic GD7555 graphics controllers are provided for those who wish to program the hardware directly. See the header file vcqm.h in the Peritek GLP distribution, and the VCQ-M Graphics Board User’s Manual. Caution must be exercised in mixing direct hardware access with libPK calls. Contact Peritek for more information. 5.1 Pixel format

The following table shows the constant names designating the VCQ-M pixel formats; include the header file vcqm.h for the definitions. These constants may be used as the pixformat argument in calls to pk_set_frame_buffer, pk_create_drawable, and pk_get_pixelinfo. The latter function will give you more information about a given pixel format, see the description of Pk_pixelinfo in section 3.1.

pixformat Description VCQM_PIXFORMAT_8BIT 8-bit pixel VCQM_PIXFORMAT_8BIT_GREY 8-bit pixel, grey scale VCQM_PIXFORMAT_16BIT 16-bit pixel, 5 red, 6 green, 5 blue

VCQM_PIXFORMAT_16BIT_55 16-bit pixel, 1 unused, 55 green, 5 blue

VCQM_PIXFORMAT_24BIT 24-bit pixel, 8 red, 8 gre8 blue

5.2 Memory spaces The VCQ-M has only a single memory space per Cirrus Logic GD7555 graphics controller, though each of the four controllers is mapped into a different region of the processor’s address space. Either of the memory space designators PK_MEMSPACE_VMEM or VCQM_MEMSPACE_MEM can be used in calls to pk_create_drawable. 5.3 Board info

Page 69: Version 2.0 PRELIMINARY · PMC and PCI Graphics Version 2.0 PRELIMINARY 10 April 2001 Peritek Corporation 5550 Redwood Road Oakland, CA 94619 (510) 531-6500 FAX (510) 530-8563

The libVCQM library

69

The following constants, defined in vcqm.h, may be used as the info parameter with pk_get_boardinfo to get more information about any of the “boards” (Cirrus Logic GD7555 graphics controllers) on your VCQ-M. Board info constant Returned in value Notes VCQM_BOARDINFO_MWSIZE Size of the display memory

window Always 4Mbytes.

VCQM_BOARDINFO_MEMSIZE Size of display memory. Probed by pk_create_board, generally 4Mbytes.

VCQM_BOARDINFO_MEMFREE The number of bytes of display memory not allocated to drawables at the present time

5.4 VCQ-M specific functions

vcqm_access_registers

void vcqm_access_registers(Vcqm *vcqm);

Provides an interactive tool to view and modify the contents of the VCQ-M control registers. This is used primarily for development of libVCQM.

vcqm_configure

int vcqm_configure(char *devname, int bus, int dev, int *secbus, int*pcimembase, int *pcimemsize)

Configures the VCQ-M and VFG-M graphics controllers in systems where they are not configured by the system firmware or operating system. The parameters devname, bus and dev identify the VCQ-M on-board TI PCI2031 PCI-PCI bridge chip. The parameters secbus, pcimembase and pcimemsize are pointers to the secondary bus number, the base address of unallocated PCI memory, and the size of unallocated PCI memory, respectively. Upon return these variables are updated to reflect the amount of PCI address space consumed by the VCQ-M and the allocation of a single bus number. Returns 0 on error. See Section 2.4 and Figure 2-2 for more information.

vcqm_load_timing

int vcqm_load_timing(Vcqm *vcqm, double vfreq, double vblank, doublevfporch, double vsync, double hblank, double hfporch, doublehsync, int width, int height, int buswidth, int bitsperpixel, intpixelformat);

Page 70: Version 2.0 PRELIMINARY · PMC and PCI Graphics Version 2.0 PRELIMINARY 10 April 2001 Peritek Corporation 5550 Redwood Road Oakland, CA 94619 (510) 531-6500 FAX (510) 530-8563

Peritek GLP Manual

70

Allows more precise control over the setting of video timing. This function can be used after calling pk_set_framebuffer or it may be used without calling pk_set_framebuffer if care is taken to setup the primary drawable with a call to pk_create_drawable. vfreq is the vertical refresh frequency in hertz. vblank is the vertical blanking interval in seconds. vfporch is the interval between the start of blanking and the start of vertical sync in seconds. vsync is the duration of vertical sync in seconds. hblank is the hortizontal blanking interval in seconds. vfporch is the interval between the start of blanking and the start of horizontal sync in seconds. hsync is the duration of horizontal sync in seconds. width is the width of the display in pixels. height is the height of the display in scanlines. buswidth is the width the video memory bus in bits and should always be 64. bitsperpixel is the number of bits per pixel for the requested pixel format. pixelformat is the graphics board specific pixel format constant. Returns 0 on error.

vcqm_show_timing

int vcqm_show_timing(double vfreq, double vblank, double vfporch,double vsync, double hblank, double hfporch, double hsync, intwidth, int height, int buswidth, int bitsperpixel, intpixelformat)

Display the computed timing information and control register values for the requested display timing. It should be used to verify that the VCQ-M can adequately support your custom display timing. Parameter values are as for vcqm_load_timing. Returns 0 on error.

vcqm_write_palette

void vcqm_write_palette(Vcqm *board, int index, int r, int g, int b);

This provides an alternate method of writing directly to the VCQ-M color palette without going through the Pk_colormap methods. Care should be taken to use either one or the other of the two mechanisms. It is recommended that you use the Pk_colormap methods if at all possible since they are more likely to optimized in the future. vcqm_write_palette does provide raw access to the color palette for those applications that require it.

vcqm_write_cursor_color void vcqm_write_cursor_color(Vcqm *vcqm, int index, int r, int g, int

b);

Provides an alternate method of writing directly to the VCQ-M cursor color palette. The VCQ-M hardware cursor is a two bit cursor. The cursor values are 0 for transparent, 1 for exclusive-or of normal video data, 2 for the background cursor color, and 3 for the foreground cursor color. Only cursor colors 2 and 3 can be used as the index and modified with the function. The preferred mechanism is to use the Pk_colormap associated with the cursor.

Page 71: Version 2.0 PRELIMINARY · PMC and PCI Graphics Version 2.0 PRELIMINARY 10 April 2001 Peritek Corporation 5550 Redwood Road Oakland, CA 94619 (510) 531-6500 FAX (510) 530-8563

The libVCQM library

71

Pk_drawable *cursor_drawable = pk_get_cursordrawable(board);Pk_colormap *cursor_colormap = pk_get_colormap(cursor_drawable);unsigned int background =

pk_allocate_color(cursor_colormap, bred, bgreen, bblue);unsigned int foreground =

pk_allocate_color(cursor_colormap, fred, fgreen, fblue);

The color numbers background and foreground can then be used for drawing on the cursor drawable. Currently these will be the values 2 and 3 but it is preferable not to depend upon this fact in order to aid compatibility with future revisions of libVCQM.

Page 72: Version 2.0 PRELIMINARY · PMC and PCI Graphics Version 2.0 PRELIMINARY 10 April 2001 Peritek Corporation 5550 Redwood Road Oakland, CA 94619 (510) 531-6500 FAX (510) 530-8563

Peritek GLP Manual

72

6 The libPKMesa library The Mesa 3-D Graphics Library is a publicly available software package that implements the OpenGL API. Peritek has ported this package to our boards to support applications using the OpenGL API. See the Mesa 3-D website, http://www.mesa3d.org for a description of this library and documentation of the data structures and functions available from the package. Their web page includes many pointers to other information about the OpenGL API.

The structures and functions in this library have been used in libPkGLU and libGLUT (see sections 8 and 9), Peritek’s implementation of the GLU (GL Utilities) and GLUT (GL Utilities Toolkit) interfaces. Most users will probably wish to use those standard utilities to access the OpenGL API rather than setting up the data structures in this library directly. 6.1 Data structures

See Mesa documentation for further details. PKMesaVisual

Peritek specific container for GLvisual objects. PKMesaBuffer

Peritek specific container for GLframebuffer objects. PKMesaContext

Peritek specific container for GLcontext objects.

6.2 Functions

PKMesaCreateVisual PKMesaDestroyVisual

PKMesaVisual PKMesaCreateVisual(GLboolean rgb_mode, GLboolean dbFlag,

GLint depthSize, GLint stencilSize, GLint accumSize;

void PKMesaDestroyVisual(PKMesaVisual visual);

It is necessary to call PKMesaCreateVisual to construct a PKMesaVisual object prior to calling PKMesaCreateContext. When the associated context is destroyed PKMesaDestroyVisual can be called to destroy the PKMesaVisual object and release its associated resources. dbFlag should be GL_TRUE if double buffering is required and GL_FALSE otherwise. rgb_mode should be GL_TRUE for direct RGB pixel formats and GL_FALSE for color indexed pixel formats. depthSize should be 16 if needed and 0 otherwise. stencilSize should be 8 if needed and 0 otherwise. accumSize should be 16 if needed and 0 otherwise.

Page 73: Version 2.0 PRELIMINARY · PMC and PCI Graphics Version 2.0 PRELIMINARY 10 April 2001 Peritek Corporation 5550 Redwood Road Oakland, CA 94619 (510) 531-6500 FAX (510) 530-8563

libPKMesa and libGL libraries

73

PKMesaCreateBuffer PKMesaDestroyBuffer

PKMesaBuffer PKMesaCreateBuffer(PKMesaVisual visual, Pk_drawable *buf);

void PKMesaDestroyBuffer(PKMesaBuffer buffer);

A PKMesaBuffer object is returned by PKMesaCreateBuffer. When this object is no longer needed it can be destroyed with PKMesaDestroyBuffer. visual is a PKMesaVisual object created previously with PKMesaCreateVisual. buf is a libPK drawable object either from pk_get_drawable or pk_create_drawable.

PKMesaCreateContext PKMesaDestroyContext

PKMesaContext PKMesaCreateContext(PKMesaVisual visual, PKMesaContextsharelist);

void PKMesaDestroyContext(PKMesaContext context);

PKMesaCreateContext makes a PKMesaContext object; visual is a PKMesaVisual object that has been previously created with PKMesaCreateVisual. sharelist should be NULL.

PKMesaMakeCurrent

void PKMesaMakeCurrent(PKMesaContext context, PKMesaBuffer buffer);

Makes context and buffer the current GL rendering context. This function must be called prior to calling any of the libGL functions.

PKMesaSwapBuffers

void PKMesaSwapBuffers(PKMesaBuffer buffer);

Swap the front and back buffers.

7 The libMesa library The following Mesa functions using the OpenGL API are provided. Consult the OpenGL references listed below for specifics on the OpenGL API. OpenGL Programming Guide OpenGL Architecture Review Board Silicon Graphics, Inc. 1993 Addison Wesley, Menlo Park, California

Page 74: Version 2.0 PRELIMINARY · PMC and PCI Graphics Version 2.0 PRELIMINARY 10 April 2001 Peritek Corporation 5550 Redwood Road Oakland, CA 94619 (510) 531-6500 FAX (510) 530-8563

Peritek GLP Manual

74

OpenGL Reference Manual, Second Edition OpenGL Architecture Review Board Silicon Graphics, Inc. 1997 Addison Wesley, Menlo Park, California OpenGL Programming for the X Window System Mark J. Kilgard, 1996 Addison Wesley, Menlo Park, California Base OpenGL functions glAccumglAlphaFuncglAreTexturesResidentglArrayElementglBeginglBindTextureglBitmapglBlendFuncglCallListglCallListsglClearglClearAccumglClearColorglClearDepthglClearIndexglClearStencilglClipPlaneglColor3bglColor3bvglColor3dglColor3dvglColor3fglColor3fvglColor3iglColor3ivglColor3sglColor3svglColor3ubglColor3ubvglColor3uiglColor3uivglColor3usglColor3usvglColor4bglColor4bvglColor4dglColor4dvglColor4fglColor4fvglColor4iglColor4ivglColor4sglColor4sv

glColor4ubglColor4ubvglColor4uiglColor4uivglColor4usglColor4usvglColorMaskglColorMaterialglColorPointerglCopyPixelsglCopyTexImage1DglCopyTexImage2DglCopyTexSubImage1DglCopyTexSubImage2DglCopyTexSubImage3DglCullFaceglDeleteListsglDeleteTexturesglDepthFuncglDepthMaskglDepthRangeglDisableglDisableClientStateglDrawArraysglDrawBufferglDrawElementsglDrawPixelsglDrawRangeElementsglEdgeFlagglEdgeFlagPointerglEdgeFlagvglEnableglEnableClientStateglEndglEndListglEvalCoord1dglEvalCoord1dvglEvalCoord1fglEvalCoord1fvglEvalCoord2dglEvalCoord2dvglEvalCoord2fglEvalCoord2fv

glEvalMesh1glEvalMesh2glEvalPoint1glEvalPoint2glFeedbackBufferglFinishglFlushglFogfglFogfvglFogiglFogivglFrontFaceglFrustumglGenListsglGenTexturesglGetBooleanvglGetClipPlaneglGetDoublevglGetErrorglGetFloatvglGetIntegervglGetLightfvglGetLightivglGetMapdvglGetMapfvglGetMapivglGetMaterialfvglGetMaterialivglGetPixelMapfvglGetPixelMapuivglGetPixelMapusvglGetPointervglGetPolygonStippleglGetStringglGetTexEnvfvglGetTexEnvivglGetTexGendvglGetTexGenfvglGetTexGenivglGetTexImageglGetTexLevelParameterfvglGetTexLevelParameterivglGetTexParameterfv

Page 75: Version 2.0 PRELIMINARY · PMC and PCI Graphics Version 2.0 PRELIMINARY 10 April 2001 Peritek Corporation 5550 Redwood Road Oakland, CA 94619 (510) 531-6500 FAX (510) 530-8563

libPKMesa and libGL libraries

75

glGetTexParameterivglHintglIndexMaskglIndexPointerglIndexdglIndexdvglIndexfglIndexfvglIndexiglIndexivglIndexsglIndexsvglIndexubglIndexubvglInitNamesglInterleavedArraysglIsEnabledglIsListglIsTextureglLightModelfglLightModelfvglLightModeliglLightModelivglLightfglLightfvglLightiglLightivglLineStippleglLineWidthglListBaseglLoadIdentityglLoadMatrixdglLoadMatrixfglLoadNameglLogicOpglMap1dglMap1fglMap2dglMap2fglMapGrid1dglMapGrid1fglMapGrid2dglMapGrid2fglMaterialfglMaterialfvglMaterialiglMaterialivglMatrixModeglMultMatrixdglMultMatrixfglNewListglNormal3bglNormal3bvglNormal3dglNormal3dvglNormal3fglNormal3fv

glNormal3iglNormal3ivglNormal3sglNormal3svglNormalPointerglOrthoglPassThroughglPixelMapfvglPixelMapuivglPixelMapusvglPixelStorefglPixelStoreiglPixelTransferfglPixelTransferiglPixelZoomglPointSizeglPolygonModeglPolygonOffsetglPolygonStippleglPopAttribglPopClientAttribglPopMatrixglPopNameglPrioritizeTexturesglPushAttribglPushClientAttribglPushMatrixglPushNameglRasterPos2dglRasterPos2dvglRasterPos2fglRasterPos2fvglRasterPos2iglRasterPos2ivglRasterPos2sglRasterPos2svglRasterPos3dglRasterPos3dvglRasterPos3fglRasterPos3fvglRasterPos3iglRasterPos3ivglRasterPos3sglRasterPos3svglRasterPos4dglRasterPos4dvglRasterPos4fglRasterPos4fvglRasterPos4iglRasterPos4ivglRasterPos4sglRasterPos4svglReadBufferglReadPixelsglRectdglRectdvglRectf

glRectfvglRectiglRectivglRectsglRectsvglRenderModeglRotatedglRotatefglScaledglScalefglScissorglSelectBufferglShadeModelglStencilFuncglStencilMaskglStencilOpglTexCoord1dglTexCoord1dvglTexCoord1fglTexCoord1fvglTexCoord1iglTexCoord1ivglTexCoord1sglTexCoord1svglTexCoord2dglTexCoord2dvglTexCoord2fglTexCoord2fvglTexCoord2iglTexCoord2ivglTexCoord2sglTexCoord2svglTexCoord3dglTexCoord3dvglTexCoord3fglTexCoord3fvglTexCoord3iglTexCoord3ivglTexCoord3sglTexCoord3svglTexCoord4dglTexCoord4dvglTexCoord4fglTexCoord4fvglTexCoord4iglTexCoord4ivglTexCoord4sglTexCoord4svglTexCoordPointerglTexEnvfglTexEnvfvglTexEnviglTexEnvivglTexGendglTexGendvglTexGenfglTexGenfv

Page 76: Version 2.0 PRELIMINARY · PMC and PCI Graphics Version 2.0 PRELIMINARY 10 April 2001 Peritek Corporation 5550 Redwood Road Oakland, CA 94619 (510) 531-6500 FAX (510) 530-8563

Peritek GLP Manual

76

glTexGeniglTexGenivglTexImage1DglTexImage2DglTexImage3DglTexParameterfglTexParameterfvglTexParameteriglTexParameterivglTexSubImage1DglTexSubImage2DglTexSubImage3DglTranslatedglTranslatef

glVertex2dglVertex2dvglVertex2fglVertex2fvglVertex2iglVertex2ivglVertex2sglVertex2svglVertex3dglVertex3dvglVertex3fglVertex3fvglVertex3iglVertex3iv

glVertex3sglVertex3svglVertex4dglVertex4dvglVertex4fglVertex4fvglVertex4iglVertex4ivglVertex4sglVertex4svglVertexPointerglViewport

OpenGL extensions glAreTexturesResidentEXTglArrayElementEXTglBindTextureEXTglBlendColorEXTglBlendEquationEXTglColorPointerEXTglColorSubTableEXTglColorTableEXTglCopyTexSubImage3DEXTglDeleteTexturesEXTglDrawArraysEXTglEdgeFlagPointerEXTglGenTexturesEXTglGetColorTableEXTglGetColorTableParameterfvEXTglGetColorTableParameterivEXTglGetPointervEXTglIndexPointerEXTglInterleavedTextureCoordSetsEXTglIsTextureEXTglMultiTexCoord1dEXTglMultiTexCoord1dvEXTglMultiTexCoord1fEXTglMultiTexCoord1fvEXTglMultiTexCoord1iEXTglMultiTexCoord1ivEXTglMultiTexCoord1sEXTglMultiTexCoord1svEXTglMultiTexCoord2dEXTglMultiTexCoord2dvEXTglMultiTexCoord2fEXTglMultiTexCoord2fvEXT

glMultiTexCoord2iEXTglMultiTexCoord2ivEXTglMultiTexCoord2sEXTglMultiTexCoord2svEXTglMultiTexCoord3dEXTglMultiTexCoord3dvEXTglMultiTexCoord3fEXTglMultiTexCoord3fvEXTglMultiTexCoord3iEXTglMultiTexCoord3ivEXTglMultiTexCoord3sEXTglMultiTexCoord3svEXTglMultiTexCoord4dEXTglMultiTexCoord4dvEXTglMultiTexCoord4fEXTglMultiTexCoord4fvEXTglMultiTexCoord4iEXTglMultiTexCoord4ivEXTglMultiTexCoord4sEXTglMultiTexCoord4svEXTglNormalPointerEXTglPointParameterfEXTglPointParameterfvEXTglPolygonOffsetEXTglPrioritizeTexturesEXTglSelectTextureCoordSetEXTglSelectTextureEXTglSelectTextureTransformEXTglTexCoordPointerEXTglTexImage3DEXTglTexSubImage3DEXTglVertexPointerEXT

Mesa specific OpenGL extensions

glResizeBuffersMESAglWindowPos2dMESAglWindowPos2dvMESAglWindowPos2fMESAglWindowPos2fvMESA

glWindowPos2iMESAglWindowPos2ivMESAglWindowPos2sMESAglWindowPos2svMESAglWindowPos3dMESA

glWindowPos3dvMESAglWindowPos3fMESAglWindowPos3fvMESAglWindowPos3iMESAglWindowPos3ivMESA

Page 77: Version 2.0 PRELIMINARY · PMC and PCI Graphics Version 2.0 PRELIMINARY 10 April 2001 Peritek Corporation 5550 Redwood Road Oakland, CA 94619 (510) 531-6500 FAX (510) 530-8563

libPKMesa and libGL libraries

77

glWindowPos3sMESAglWindowPos3svMESAglWindowPos4dMESA

glWindowPos4dvMESAglWindowPos4fMESAglWindowPos4fvMESA

glWindowPos4iMESAglWindowPos4ivMESAglWindowPos4sMESA

glWindowPos4svMESA

SGI OpenGL extensions

glMultiTexCoord1dSGISglMultiTexCoord1dvSGISglMultiTexCoord1fSGISglMultiTexCoord1fvSGISglMultiTexCoord1iSGISglMultiTexCoord1ivSGISglMultiTexCoord1sSGISglMultiTexCoord1svSGISglMultiTexCoord2dSGISglMultiTexCoord2dvSGISglMultiTexCoord2fSGISglMultiTexCoord2fvSGISglMultiTexCoord2iSGISglMultiTexCoord2ivSGISglMultiTexCoord2sSGISglMultiTexCoord2svSGISglMultiTexCoord3dSGISglMultiTexCoord3dvSGISglMultiTexCoord3fSGIS

glMultiTexCoord3fvSGISglMultiTexCoord3iSGISglMultiTexCoord3ivSGISglMultiTexCoord3sSGISglMultiTexCoord3svSGISglMultiTexCoord4dSGISglMultiTexCoord4dvSGISglMultiTexCoord4fSGISglMultiTexCoord4fvSGISglMultiTexCoord4iSGISglMultiTexCoord4ivSGISglMultiTexCoord4sSGISglMultiTexCoord4svSGISglMultiTexCoordPointerSGISglSelectTextureCoordSetSGISglSelectTextureSGIS

8 The libGLU library A preliminary version of the GLU functions based on the Mesa library has been implemented. Here is a list of the GLU API and their status in the Peritek library. Functions with no annotation are currently compiled into the library. gluBeginCurvegluBeginPolygon OBSOLETEgluBeginSurfacegluBeginTrimgluBuild1DMipmapLevels NEW not included in this librarygluBuild1DMipmapsgluBuild2DMipmapLevels NEW not included in this librarygluBuild2DMipmapsgluBuild3DMipmapLevels NEW not included in this librarygluBuild3DMipmaps NEW not included in this librarygluCheckExtension NEW not included in this librarygluCylindergluDeleteNurbsRenderergluDeleteQuadricgluDeleteTessgluDiskgluEndCurvegluEndPolygon OBSOLETEgluEndSurfacegluEndTrimgluErrorStringgluGetNurbsPropertygluGetStringgluGetTessProperty NEW not included in this library

Page 78: Version 2.0 PRELIMINARY · PMC and PCI Graphics Version 2.0 PRELIMINARY 10 April 2001 Peritek Corporation 5550 Redwood Road Oakland, CA 94619 (510) 531-6500 FAX (510) 530-8563

Peritek GLP Manual

78

gluLoadSamplingMatricesgluLookAtgluNewNurbsRenderergluNewQuadricgluNewTessgluNextContourgluNurbsCallbackgluNurbsCallbackData NEW not included in this librarygluNurbsCurvegluNurbsPropertygluNurbsSurfacegluOrth2DgluPartialDiskgluPerspectivegluPickMatrixgluProjectgluPwlCurvegluQuadricCallbackgluQuadricDrawStylegluQuadricNormalsgluQuadricOrientationgluQuadricTexturegluScaleImagegluSpheregluTessBeginContour NEW not included in this librarygluTessBeginPolygon NEW not included in this librarygluTessCallbackgluTessEndContour NEW not included in this librarygluTessEndPolygon NEW not included in this librarygluTessNormal NEW not included in this librarygluTessVertexgluUnProjectgluUnProject4 NEW not included in this library

9 The libGLUT library A preliminary version of the GLUT functions based on the Mesa library has been implemented. Only a single window is currently used, and mouse and keyboard functions are not yet supported. The implementation is primarily useful in allowing standard examples to be run. Here is the current status of the implementation:

Status Function name (Alphabetical) Dummy glutAddMenuEntryDummy glutAddSubMenuDummy glutAttachMenuImplemented glutBitmap8By13;Implemented glutBitmap9By15;Implemented glutBitmapCharacterImplemented glutBitmapHelvetica10;Implemented glutBitmapHelvetica12;Implemented glutBitmapHelvetica18;Implemented glutBitmapTimesRoman10;Implemented glutBitmapTimesRoman24;Implemented glutBitmapWidth

Page 79: Version 2.0 PRELIMINARY · PMC and PCI Graphics Version 2.0 PRELIMINARY 10 April 2001 Peritek Corporation 5550 Redwood Road Oakland, CA 94619 (510) 531-6500 FAX (510) 530-8563

libPKMesa and libGL libraries

79

Dummy glutButtonBoxFuncDummy glutChangeToMenuEntryDummy glutChangeToSubMenuDummy glutCopyColormapDummy glutCreateMenuDummy glutCreateSubWindowDummy glutCreateWindowDummy glutDestroyMenuDummy glutDestroyWindowDummy glutDetachMenuDummy glutDeviceGetDummy glutDialsFuncImplemented glutDisplayFuncDummy glutEntryFuncDummy glutEstablishOverlayDummy glutExtensionSupportedDummy glutFullScreenDummy glutGetDummy glutGetColorDummy glutGetMenuDummy glutGetWindowDummy glutHideOverlayDummy glutHideWindowDummy glutIconifyWindowDummy glutIdleFuncImplemented glutInitImplemented glutInitDisplayModeDummy glutInitWindowPositionDummy glutInitWindowSizeDummy glutKeyboardFuncDummy glutLayerGetImplemented glutMainLoopDummy glutMenuStateFuncDummy glutMenuStatusFuncDummy glutMotionFuncDummy glutMouseFuncDummy glutOverlayDisplayFuncDummy glutPassiveMotionFuncDummy glutPopWindowDummy glutPositionWindowDummy glutPostOverlayRedisplayDummy glutPostRedisplayDummy glutPushWindowDummy glutRemoveMenuItemDummy glutRemoveOverlayImplemented glutReshapeFuncDummy glutReshapeWindowDummy glutSetColorDummy glutSetCursorDummy glutSetIconTitleDummy glutSetMenuDummy glutSetWindowDummy glutSetWindowTitleDummy glutShowOverlayDummy glutShowWindowImplemented glutSolidConeImplemented glutSolidCube

Page 80: Version 2.0 PRELIMINARY · PMC and PCI Graphics Version 2.0 PRELIMINARY 10 April 2001 Peritek Corporation 5550 Redwood Road Oakland, CA 94619 (510) 531-6500 FAX (510) 530-8563

Peritek GLP Manual

80

Implemented glutSolidDodecahedronImplemented glutSolidIcosahedronImplemented glutSolidOctahedronImplemented glutSolidSphereImplemented glutSolidTeapotImplemented glutSolidTetrahedronImplemented glutSolidTorusDummy glutSpaceballButtonFuncDummy glutSpaceballMotionFuncDummy glutSpaceballRotateFuncDummy glutSpecialFuncImplemented glutStrokeMonoRoman;Implemented glutStrokeRoman;Implemented glutStrokeWidthImplemented glutSwapBuffersDummy glutTabletButtonFuncDummy glutTabletMotionFuncDummy glutTimerFuncDummy glutUseLayerDummy glutVisibilityFuncImplemented glutWireConeImplemented glutWireCubeImplemented glutWireDodecahedronImplemented glutWireIcosadedronImplemented glutWireOctahedronImplemented glutWireSphereImplemented glutWireTeapotImplemented glutWireTetrahedronImplemented glutWireTorus

Page 81: Version 2.0 PRELIMINARY · PMC and PCI Graphics Version 2.0 PRELIMINARY 10 April 2001 Peritek Corporation 5550 Redwood Road Oakland, CA 94619 (510) 531-6500 FAX (510) 530-8563

Index

81

Index

board structure

pk_create_board, 36, 40 pk_destroy_board, 36 pk_get_board, 40, 48 pk_get_boardinfo, 40, 63 pk_set_framebuffer, 40, 41, 42

colormap pk_allocate_closest_color, 46 pk_allocate_color, 45, 46, 47 pk_allocate_colorcell, 46, 47 pk_allocate_colorcells, 46, 47 pk_allocate_colorplanes, 46, 47 pk_create_colormap, 53 pk_destroy_colormap, 54 pk_get_color, 47, 48, 54 pk_get_colormap, 54 pk_get_colors, 47, 48 pk_get_colors_random, 47, 48 pk_lookup_color, 45 pk_release_color, 46, 47 pk_release_colorplanes, 46, 47 pk_release_colors, 46 pk_set_color, 46, 47 pk_set_colors, 47 pk_set_colors_random, 47

cursor pk_get_cursordrawable, 42 pk_position_cursor, 43 pk_set_cursorhotspot, 42

double buffering pk_swap_buffers, 41, 43

drawable pk_back_drawable, 48 pk_create_back_drawable, 49 pk_create_colormap, 53 pk_create_drawable, 42 pk_create_front_drawable, 48 pk_create_overlay_drawable, 49 pk_create_primary_drawable, 49 pk_destroy_colormap, 54 pk_destroy_drawable, 42, 49 pk_destroy_drawable, 49 pk_front_drawable, 48 pk_get_colormap, 54 pk_get_drawable, 41 pk_get_size, 49 pk_overlay_drawable, 42, 48 pk_primary_drawable, 48

drawing methods pk_bitblt, 55 pk_block_copy, 56

pk_draw_arc, 52 pk_draw_char, 54 pk_draw_circle, 52 pk_draw_ellipse, 52 pk_draw_line, 51 pk_draw_linesegs, 51 pk_draw_piearc, 52 pk_draw_pixel, 51 pk_draw_polygon, 51 pk_draw_polyline, 51 pk_draw_rectangle, 51 pk_draw_triangle, 51 pk_fill_circle, 53 pk_fill_ellipse, 53 pk_fill_piearc, 53 pk_fill_polygon, 53 pk_fill_rectangle, 53 pk_fill_triangle, 52 pk_read_span, 56 pk_shaded_line, 56 pk_shaded_triangle, 56 pk_write_span, 57

errors pk_get_errorcode, 42 pk_set_errorcode, 42

font pk_create_ti_font, 43 pk_create_ti_font_mem, 43 pk_create_truetype_font, 43 pk_destroy_font, 57 pk_draw_char, 54 pk_draw_string, 55 pk_draw_string16, 55 pk_draw_string32, 55 pk_draw_text, 54 pk_draw_text16, 54 pk_draw_text32, 54 pk_get_ascent, 58 pk_get_descent, 58 pk_get_spacing, 58 pk_glyph_info, 58

libPK data structures Pk_board, 36 Pk_colormap, 36 Pk_drawable, 36 Pk_font, 37 Pk_glyph_info, 37 Pk_pixelinfo, 38

libVFX, 64 LynxOS, 18, 21, 22 pan

Page 82: Version 2.0 PRELIMINARY · PMC and PCI Graphics Version 2.0 PRELIMINARY 10 April 2001 Peritek Corporation 5550 Redwood Road Oakland, CA 94619 (510) 531-6500 FAX (510) 530-8563

Peritek GLP Manual

82

pk_pan_absolute, 44 pk_pan_relative, 44

PCI access functions pci_read_config, 63 pci_show_device_config, 63 pci_write_config, 63 show_pci_devices, 63

pci_read_config, 63 pci_show_device_config, 63 pci_write_config, 63 pixel format

VFX-M, 64 pixmaps

pk_read_pixmap, 57 pk_write_pixmap, 57

pk_allocate_closest_color, 46 pk_allocate_color, 45, 46, 47 pk_allocate_colorcell, 46, 47 pk_allocate_colorcells, 46, 47 pk_allocate_colorplanes, 46, 47 pk_back_drawable, 48 pk_bitblt, 55 pk_block_copy, 56 Pk_board, 36 Pk_colormap, 36 pk_create_back_drawable, 49 pk_create_board, 36, 40 pk_create_colormap, 53 pk_create_drawable, 42 pk_create_front_drawable, 48 pk_create_overlay_drawable, 49 pk_create_primary_drawable, 49 pk_create_ti_font, 43 pk_create_ti_font_mem, 43 pk_create_truetype_font, 43 pk_destroy_board, 36 pk_destroy_colormap, 54 pk_destroy_drawable, 42, 49 pk_destroy_font, 57 pk_draw_arc, 52 pk_draw_char, 54 pk_draw_circle, 52 pk_draw_ellipse, 52 pk_draw_line, 51 pk_draw_linesegs, 51 pk_draw_piearc, 52 pk_draw_pixel, 51 pk_draw_polygon, 51 pk_draw_polyline, 51 pk_draw_rectangle, 51 pk_draw_string, 55 pk_draw_string16, 55 pk_draw_string32, 55 pk_draw_text, 54 pk_draw_text16, 54 pk_draw_text32, 54

pk_draw_triangle, 51 Pk_drawable, 36 pk_extract_color, 50 pk_fill_circle, 53 pk_fill_ellipse, 53 pk_fill_piearc, 53 pk_fill_polygon, 53 pk_fill_rectangle, 53 pk_fill_triangle, 52 pk_flush, 57 Pk_font, 37 pk_front_drawable, 48 pk_get_ascent, 58 pk_get_boardinfo, 40, 63 pk_get_cliprect, 49 pk_get_color, 47, 48, 54 pk_get_colormap, 54 pk_get_colors, 47, 48 pk_get_colors_random, 47, 48 pk_get_cursordrawable, 42 pk_get_depth, 50 pk_get_descent, 58 pk_get_drawable, 41 pk_get_errorcode, 42 pk_get_memspace, 50 pk_get_pixelinfo, 44 pk_get_pixformat, 49 pk_get_size, 49 pk_get_spacing, 58 pk_get_videosize, 41 pk_glyph_info, 58 Pk_glyph_info, 37, 58 pk_lookup_color, 45 pk_make_color, 50 pk_overlay_drawable, 42, 48 pk_pan_absolute, 44 pk_pan_relative, 44 Pk_pixelinfo, 38, 64 pk_position_cursor, 43 pk_primary_drawable, 48 pk_read_flash, 44 pk_read_pixel, 50 pk_read_pixmap, 57 pk_read_seeprom, 45 pk_read_span, 56 pk_release_color, 46, 47 pk_release_colorplanes, 46, 47 pk_release_colors, 46 pk_set_cliprect, 50 pk_set_color, 46, 47 pk_set_colors, 47 pk_set_colors_random, 47 pk_set_cursorhotspot, 42 pk_set_errorcode, 42 pk_set_framebuffer, 40, 41, 42 pk_shaded_line, 56

Page 83: Version 2.0 PRELIMINARY · PMC and PCI Graphics Version 2.0 PRELIMINARY 10 April 2001 Peritek Corporation 5550 Redwood Road Oakland, CA 94619 (510) 531-6500 FAX (510) 530-8563

Index

83

pk_shaded_triangle, 56 pk_swap_buffers, 41, 43 pk_video_enable, 43 pk_write_flash, 44 pk_write_pixmap, 57 pk_write_seeprom, 45 pk_write_span, 57 programmable memory

pk_read_flash, 44 pk_read_seeprom, 45 pk_write_flash, 44 pk_write_seeprom, 45

show_pci_devices, 63 Solaris, 22 SPARC, 22 supported configurations, 10 VCQ-M, 21, 24, 68 VCQ-M specific functions

vcqm_access_registers, 69 vcqm_configure, 69 vcqm_cursor_color, 70

vcqm_load_timing, 69 vcqm_show_timing, 70 vcqm_write_palette, 70

VFG-M, 22, 24, 35, 59 vfx_adjust_sync, 67 vfx_adjust_timing, 67 vfx_configure, 66 vfx_load_timing, 66 vfx_show_entry, 67 vfx_show_timing, 66 vfx_write_palette, 67 VFX-M, 20, 23, 64 VFX-M specific functions

vfx_adjust_sync, 67 vfx_adjust_timing, 67 vfx_configure, 66 vfx_load_timing, 66 vfx_show_timing, 66 vfx_write_palette, 67

video capture, 35, 59