X Server Device Developer's Guide
只搜尋這本書
以 PDF 格式下載這本書

DDX Porting Overview

1

The OpenWindows server is based on the X11R6 sample server from The Open Group. The OpenWindows server dynamically loads DDX handler modules at run time. This enables you, an Independent Hardware Vendor (IHV), to develop DDX modules that can be delivered as separate components.
Sun also provides DDX utility libraries to help you port the server to new graphics devices. These libraries contain functions common across devices.
See "Related Books" on page xix for recommended reading on the DDX layer.

Note - All porting interfaces documented in this manual are uncommitted interfaces; therefore, they might change in future releases in ways that could require you to change your DDX port.

The DDX Interface

As shown in Figure 1-1 on page 2, the DDX interface is quite extensive: the Screen structure alone contains approximately 70 functions.

圖形

Figure 1-1

Many of these functions do not need to be specialized for every device. Table 1-1 on page 2 describes general-purpose utility libraries that can be used to simplify your DDX handler implementation. The MI, CFB, and MFB libraries are from The Open Group.
Table 1-1
Utility LibraryDescription
MIMachine independent, high-level
CFBMemory-mapped color frame buffers
MFBMonochrome frame buffers
OVLTransparent window overlay
DGADirect graphics access for client and DDX handler
SUNSun-specific ioctls for frame buffers
Table 1-1 (Continued)
Utility LibraryDescription
MPGMultiple plane groups and multiple hardware colormaps
WIDWindow Identification that is part of the MPG library
CMAPHardware colormap control

The Loadable DDX

The loadable DDX allows the server to dynamically load DDX modules at runtime instead of having to relink the server to add support for new devices. A DDX module is a shared object that is loaded by the server at runtime through an explicit call to dlopen(3X). The location of the DDX modules and their mappings between devices is determined by the OWconfig (OpenWindows configuration) file.
See Appendix A, "The OWconfig File" for more information about the OWconfig file.

Simple Frame Buffer Support

The OpenWindows server provides a set of general-purpose support routines for simple memory-mapped frame buffers. This includes the MFB library for monochrome frame buffers and the CFB library for color frame buffers.

Note - Although CFB code can be compiled to support depths of 2, 4, 8, 16, and 32 bits, only the 8, 16 and 32-bit depths are supported in this release.

Multiple-Plane Group Support

For devices with multiple-plane groups there is a utility library that provides most of the management functions necessary for MPG devices. This library also includes functions to minimize exposure events between windows that reside in different plane groups. The MPG interface is designed so that the CFB and MFB libraries can be used to render and manipulate windows.

Performance Enhancements

If you NFS mount the window server, mount it setuid allowable. This enables the server to take advantage of performance features in the Solaris operating system.

x86 In-line Assembly Language Note

The SunPro(TM) C Compilation system includes in-line assembly language provides direct access to x86 I/O instructions, as well as optimized in-line expansion templates. See the manual pages for cc(1) and inline(1), and SunPro's ProCompiler C 2.0.1 Programmer's Guide for more information.
If you want to include in-line assembly language in your code, place the in-line assembly definition file (with the .il extension) first in the cc command line:

  cc -O inline.il bitblt.c  

Common in-line examples are included in the file below.

  ///////////////////////////////////////////////////////////////  
  / File: inline.il  
  /  
  ///////////////////////////////////////////////////////////////  
  / in and out  
  /       int ioaddr = 0x3c4;  
  /  
  /       Called as:  
  /               char data;  
  /               data = inb(ioaddr);  
  /  
          .inline inb,4  
          movl    (%esp), %edx  
          xorl    %eax, %eax  
          inb     (%dx)  
          .end  
  
  /       Called as:  
  /               short data;  
  /               data = inw(ioaddr);  
  /  
          .inline inw,4  


          movl    (%esp), %edx  
          xorl    %eax, %eax  
          inw     (%dx)  
          .end  
  
  /       Called as:  
  /               int data;  
  /               data = inl(ioaddr);  
  /  
          .inline inl,4  
          movl    (%esp), %edx  
          xorl    %eax, %eax  
          inl     (%dx)  
          .end  
  
  /       Called as:  
  /               char data;  
  /               outb(ioaddr,data);  
  /  
          .inline outb,8  
          movl    (%esp), %edx  
          movl    4(%esp), %eax  
          outb    (%dx)  
          .end  
  
  /       Called as:  
  /               short data;  
  /               outw(ioaddr,data);  
  /  
          .inline outw,8  
          movl    (%esp), %edx  
          movl    4(%esp), %eax  
          outw    (%dx)  
          .end  
  
  /       Called as:  
  /               int data;  
  /               outl(ioaddr,data);  
  /  
          .inline outl,8  
          movl    (%esp), %edx  
          movl    4(%esp), %eax  
          outl    (%dx)  
          .end  


  ///////////////////////////////////////////////////////////////  
  / Set and clear direction flags  
  /  
  
  /       Called as:  cld();  
  /  
          .inline cld,0  
          cld  
          .end  
  
  /       Called as:  std();  
  /  
          .inline std,0  
          std  
          .end  

DPS Extension Graphics Rendering

Due to a bug in this release of the DPS code, pixmaps used by DPS must have their pPixmap->devKind field equal to the width of the pixmap in bytes. This means that frame buffers that cache pixmaps in off-screen video memory need to use regular memory under certain conditions.
A flag has been added to inform DDX handlers when they should force pixmaps into regular memory. Make the following declaration in your DDX handler's pScreen->CreatePixmap routine:

  extern int sunCreateDFBPixmap  

Check this variable before creating a pixmap in off-screen memory. If the variable is TRUE, your DDX handler should force the pixmap into regular processor memory.

Note - This DPS bug workaround is unchanged from OpenWindows 3.4.

Test/Verify Recommendation

To test and verify a DDX handler, it is recommended that you run the UniSoft Test Suite. This test suite is available from The Open Group.
You can access The Open Group information if your system is connected to the Internet. The URL is http://www.rdg.opengroup.org Use the File Transfer Protocol (ftp) to download files from this system. If you need help using ftp, refer to the ftp(1) man page. To determine if your system is connected to the Internet, see your system administrator.