Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/solaris/native/sun/jdga/jdga.h
32287 views
/*1* Copyright (c) 1998, 2001, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425/*26* The JDGA interface enables "Direct Graphics Access" to the pixels27* of X11 drawables for the Java runtime graphics implementation.28*29* This include file defines the external interface that the30* Solaris X11 port of the Java(tm) 2D API uses to communicate31* with a dynamically loadable object library to obtain information32* for rendering directly to the memory mapped surfaces that store33* the pixel information for an X11 Window (or technically any X1134* Drawable).35*36* The 2D graphics library will link to an object file, either37* through direct linking at compile time or through dynamic38* loading at runtime, and use an entry point defined as39*40* JDgaLibInitFunc JDgaLibInit;41*42* to initialize the library and obtain a copy of a JDgaLibInfo43* structure that will be used to communicate with the library44* to obtain information about X11 Drawable IDs and the memory45* used to store their pixels.46*47* Some parts of this interface use interfaces and structures48* defined by the JNI native interface technology.49*/5051#ifndef HEADLESS52/*53*54*/55#define JDGALIB_MAJOR_VERSION 156#define JDGALIB_MINOR_VERSION 05758/*59* Definitions for the return status codes for most of the JDGA60* access functions.61*/62#ifndef _DEFINE_JDGASTATUS_63#define _DEFINE_JDGASTATUS_64typedef enum {65JDGA_SUCCESS = 0, /* operation succeeded */66JDGA_FAILED = 1, /* unable to complete operation */67JDGA_UNAVAILABLE = 2 /* DGA not available on attached devices */68} JDgaStatus;69#endif7071/*72* This structure defines the location and size of a rectangular73* region of a drawing surface.74*75* lox, loy - coordinates that point to the pixel just inside76* the top left-hand corner of the region.77* hix, hiy - coordinates that point to the pixel just beyond78* the bottom right-hand corner of the region.79*80* Thus, the region is a rectangle containing (hiy-loy) rows of81* (hix-lox) columns of pixels.82*/83typedef struct {84jint lox;85jint loy;86jint hix;87jint hiy;88} JDgaBounds;8990typedef struct {91/*92* Information describing the global memory partition containing93* the pixel information for the window.94*/95void *basePtr; /* Base address of memory partition. */96jint surfaceScan; /* Number of pixels from one row to the next */97jint surfaceWidth; /* Total accessible pixels across */98jint surfaceHeight; /* Total accessible pixels down */99jint surfaceDepth; /* Mapped depth */100101/*102* Location and size information of the entire window (may include103* portions outside of the memory partition).104*105* The coordinates are relative to the "basePtr" origin of the screen.106*/107JDgaBounds window;108109/*110* Location and size information of the visible portion of the111* window (includes only portions that are inside the writable112* portion of the memory partition and not covered by other windows)113*114* This rectangle may represent a subset of the rendering115* rectangle supplied in the JDgaGetLock function if that116* rectangle is partially clipped and the remaining visible117* portion is exactly rectangular.118*119* The coordinates are relative to the "basePtr" origin of the screen.120*/121JDgaBounds visible;122123} JDgaSurfaceInfo;124125typedef struct _JDgaLibInfo JDgaLibInfo;126127/*128* This function is called to initialize the JDGA implementation129* library for access to the given X11 Display.130* This function stores a pointer to a structure that holds function131* pointers for the rest of the requests as well as any additinoal132* data that that library needs to track the indicated display.133*134* @return135* JDGA_SUCCESS if library was successfully initialized136* JDGA_FAILED if library is unable to perform operations137* on the given X11 Display.138*/139typedef JDgaStatus140JDgaLibInitFunc(JNIEnv *env, JDgaLibInfo *ppInfo);141142/*143* This function is called to lock the given X11 Drawable into144* a locally addressable memory location and to return specific145* rendering information about the location and geometry of the146* display memory that the Drawable occupies.147*148* Information provided to this function includes:149*150* lox, loy - the X and Y coordinates of the pixel just inside151* the upper left corner of the region to be rendered152* hix, hiy - the X and Y coordinates of the pixel just beyond153* the lower right corner of the region to be rendered154*155* Information obtained via this function includes:156*157* *pSurface - A pointer to a JDgaSurfaceInfo structure which is158* filled in with information about the drawing area for159* the specified Drawable.160*161* The return value indicates whether or not the library was able162* to successfully lock the drawable into memory and obtain the163* specific geometry information required to render to the Drawable's164* pixel memory. Failure indicates only a temporary inability to165* lock down the memory for this Drawable and does not imply a general166* inability to lock this or other Drawable's at a later time.167*168* If the indicated rendering region is not visible at all then this169* function should indicate JDGA_SUCCESS and return an empty170* "visible" rectangle.171* If the indicated rendering region has a visible portion that cannot172* be expressed as a single rectangle in the JDgaSurfaceInfo structure173* then JDGA_FAILED should be indicated so that the rendering library174* can back off to another rendering mechanism.175*176* @return177* JDGA_SUCCESS memory successfully locked and described178* JDGA_FAILED temporary failure to lock the specified Drawable179*/180typedef JDgaStatus181JDgaGetLockFunc(JNIEnv *env, Display *display, void **dgaDev,182Drawable d, JDgaSurfaceInfo *pSurface,183jint lox, jint loy, jint hix, jint hiy);184185/*186* This function is called to unlock the locally addressable memory187* associated with the given X11 Drawable until the next rendering188* operation. The JDgaSurfaceInfo structure supplied is the same189* structure that was supplied in the dga_get_lock function and190* can be used to determine implementation specific data needed to191* manage the access lock for the indicated drawable.192*193* The return value indicates whether or not the library was able194* to successfully remove its lock. Typically failure indicates195* only that the lock had been invalidated through external means196* before the rendering library completed its work and is for197* informational purposes only, though it could also mean that198* the rendering library asked to unlock a Drawable that it had199* never locked.200*201* @return202* JDGA_SUCCESS lock successfully released203* JDGA_FAILED unable to release lock for some reason,204* typically the lock was already invalid205*/206typedef JDgaStatus207JDgaReleaseLockFunc(JNIEnv *env, void *dgaDev, Drawable d);208209/*210* This function is called to inform the JDGA library that the211* AWT rendering library has enqueued an X11 request for the212* indicated Drawable. The JDGA library will have to synchronize213* the X11 output buffer with the server before this drawable214* is again locked in order to prevent race conditions between215* the rendering operations in the X11 queue and the rendering216* operations performed directly between calls to the GetLockFunc217* and the ReleaseLockFunc.218*/219typedef void220JDgaXRequestSentFunc(JNIEnv *env, void *dgaDev, Drawable d);221222/*223* This function is called to shut down a JDGA library implementation224* and dispose of any resources that it is using for a given display.225*226*/227228typedef void229JDgaLibDisposeFunc(JNIEnv *env);230231struct _JDgaLibInfo {232/*233* The X11 display structure that this instance of JDgaLibInfo234* structure is tracking.235*/236Display *display;237238/*239* Pointers to the utility functions to query information about240* X11 drawables and perform synchronization on them.241*/242JDgaGetLockFunc *pGetLock;243JDgaReleaseLockFunc *pReleaseLock;244JDgaXRequestSentFunc *pXRequestSent;245JDgaLibDisposeFunc *pLibDispose;246247/*248* Since the JDGA library is responsible for allocating this249* structure, implementation specific information can be tracked250* by the library by declaring its own structure that contains251* data following the above members.252*/253};254#endif /* !HEADLESS */255256257