943N/A/* Copyright (c) 1993, 1998, Oracle and/or its affiliates. All rights reserved. 830N/A * Permission is hereby granted, free of charge, to any person obtaining a 919N/A * copy of this software and associated documentation files (the "Software"), 919N/A * to deal in the Software without restriction, including without limitation 919N/A * the rights to use, copy, modify, merge, publish, distribute, sublicense, 919N/A * and/or sell copies of the Software, and to permit persons to whom the 919N/A * Software is furnished to do so, subject to the following conditions: 919N/A * The above copyright notice and this permission notice (including the next 919N/A * paragraph) shall be included in all copies or substantial portions of the 919N/A * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 919N/A * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 919N/A * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 919N/A * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 919N/A * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 919N/A * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 919N/A * DEALINGS IN THE SOFTWARE. 830N/A * @@@@ @@@@@ @ @ @@@@ @@@@ @@@ @@@@ 830N/A * @ @ @ @@ @ @ @ @ @ @ @ @ 830N/A * @@@@ @ @ @ @ @ @@@ @@@@ @@@@@ @@@@ 830N/A * @ @ @ @ @@ @ @ @ @ @ @ @ @ 830N/A * @ @ @ @ @ @@@@@ @@@@ @ @ @ @ @@@@ 830N/A * DGA shared retained window access routines 830N/A * dga_rtn_active(clientp) 830N/A * dga_rtn_cached(clientp) 830N/A * dga_rtn_devinfo(clientp) 830N/A * dga_rtn_devtype(clientp, type, name) 830N/A * dga_rtn_dimensions(clientp, width, height, linebytes) 830N/A * dga_rtn_grab(clientp) 830N/A * dga_rtn_pixels(clientp) 830N/A * dga_rtn_ungrab(clientp) 830N/A * _dga_rtn_map(clientp) 830N/A * _dga_rtn_unmap(clientp) 830N/A * DGA Retained Windows Active. This function is called to determine 830N/A * if DGA to the retained portion of the specified dga_window is currently 830N/A * active. Since the server can drop support for this functionality at 830N/A * any time, the client should always call this function when a change has 830N/A * been has been recorded in the retained window information. This function 830N/A * should be called prior to accessing any other retained window information. 830N/A * The function returns a non-zero result if DGA to the retained portion 830N/A * of the window is active. A zero result is returned if support has 830N/A * Inputs: Dga_window - Pointer to the client structure. 830N/A * Outputs: 0 - DGA Retained window support has been dropped. 830N/A * -1 - DGA Retained window support continues. 830N/A * DGA Retained HW Cache status. This function returns a non-zero 830N/A * value if the retained raster is cached in hardware. If set to 830N/A * DGA_RTN_NEW_DEV then the server has re-cached the retained 830N/A * raster from one device to another. If set to DGA_RTN_SAME_DEV 830N/A * the raster remains cached in the same device as previously 830N/A * recorded. If the retained raster is not cached in hw then the 830N/A * function returns DGA_RTN_NOT_CACHED (0). 830N/A * Inputs: Dga_window - Pointer to the client structure. 830N/A * Outputs: DGA_RTN_NOT_CACHED - not cached in hw 830N/A * DGA_RTN_SAME_DEV - cached in the same hw device 830N/A * DGA_RTN_NEW_DEV - cached in the new hw device 830N/A * Externals: RTN_INFOP() Internal MACRO 830N/A * dga_rtn_devinfop() <---external interface just to be consistent 830N/A * DGA Retained Device Info. This function returns a pointer to 830N/A * the shared device specific retained raster information when 830N/A * the retained raster is cached in hw. The pointer is invalid 830N/A * if the retained raster isn't cached in hw. 830N/A * Inputs: Dga_window - Pointer to the client structure. 830N/A * Outputs: void * - Pointer to the device specific information 830N/A * Externals: RTN_INFOP() Internal MACRO 830N/A /* This is the internal interface */ 830N/A * DGA Retained Device Type. This function is used to obtain 830N/A * the retained raster hardware cache device type and name. 830N/A * Inputs: Dga_window - Pointer to the client structure. 830N/A * Unsign8 * - Pointer to location to store device type. 830N/A * char ** - Pointer to location to store name string pointer. 830N/A * Externals: RTN_INFOP() Internal MACRO 830N/A * DGA Retained Raster Dimensions. This function is used to obtain 830N/A * the retained raster's dimensions. 830N/A * Inputs: Dga_window - Pointer to the client structure. 830N/A * short * - Pointer to location to store the width. 830N/A * short * - Pointer to location to store the height. 830N/A * u_int * - Pointer to the location to store the linebytes. 830N/A * Externals: RTN_INFOP() Internal MACRO 830N/A * DGA Retained Window Grab. This function creates the shared memory 830N/A * interface to allow the calling process Direct Graphics Access (DGA) 830N/A * to the retained raster associated with the specified DGA window. 830N/A * A request to allow DGA access to the retained raster is sent to the 830N/A * X/NeWS server. Should the server honor this request, shared memory 830N/A * mappings within the calling process's address space are then created. 830N/A * Should any of these steps fail, 0 is returned and the calling process 830N/A * is not allowed DGA to the retained raster. A non-zero result is 830N/A * returned upon success. 830N/A * Inputs: Dga_window - Pointer to the Dga_window for which DGA 830N/A * to the retained raster is desired. 830N/A * Externals: XDgaGrabRetainedWindow() 830N/A * XDgaUnGrabRetainedWindow() 830N/A * Check for an invalid Dga_window 830N/A /* Determine the window associated with this clientp */ 830N/A /* Check to see if backing store has been turned on for thw window */ 830N/A /* Map the shared memory into the calling process's address space.*/ 830N/A /* Ungrab the retained raster */ 830N/A * If the retained raster has already been grabbed. Don't 830N/A * Find out if this is an X window. If so get the Display and window 830N/A * id. These are used to determine the name of the shared retained 830N/A * info file. NOTE: DGA to retained rasters are currently supported 830N/A /* Check to see if backing store is turned on for this window; if not 830N/A * Request the server to allow DGA to the retained raster associated 830N/A * with this Dga_window. 830N/A * Now map the shared memory into the calling process's address 830N/A * Ungrab the retained raster 830N/A * DGA Retained Pixel Memory . This function returns a pointer 830N/A * to the shared retained pixel memory. 830N/A * Inputs: Dga_window - Pointer to the client structure. 830N/A * Outputs: u_char * - Pointer to retained pixel memory. 830N/A * DGA Retained Window Ungrab. This function frees the resources 830N/A * associated with a DGA retained retained raster. The shared 830N/A * memory mappings in the calling process's address space are 830N/A * unmapped, the shared info file is closed, and the server is 830N/A * notified through a protocol extension to free all its resources 830N/A * associated with the DGA retained raster. Should any of these 830N/A * steps fail, 0 is returned. A non-zero result is returned upon 830N/A * Inputs: Dga_window - Pointer to the Dga_window for which DGA 830N/A * to the retained raster is desired. 830N/A * Externals: DisplayString() X11 MACRO 830N/A * XDgaUnGrabRetainedWindow() 830N/A * Check for an invalid Dga_window 830N/A * If the retained window has not been grabbed then don't 830N/A * Unmap the calling process's resources if present. 830N/A * Set the dga_window retained window server sequence counter pointer 830N/A * to reflect that the retained raster has NOT been grabbed. 830N/A /* Determine the window associated with this clientp */ 830N/A * Find out if this is an X window. If so get the Display and window 830N/A * id. These are used to determine the name of the shared retained 830N/A * info file. NOTE: DGA to retained rasters is currently supported 830N/A * Tell the server to deallocate its retained window 830N/A * resources.if there are no other clients grabbing this window 830N/A * DGA Retained Window Map. This function maps the retained window 830N/A * shared memory into the clients address space after determining 830N/A * the path to the retained window information file. The shared 830N/A * retained info structure is mapped followed by the actual pixel 830N/A * array used when the pixels are not cached in hardware. The 830N/A * address of the shared retained info structure is then place in 830N/A * the dga_window structure along with the client dependent information. 830N/A * Should any operation fail, a NULL pointer is placed in the dga_window 830N/A * structure and 0 is returned. 830N/A * Inputs: Dga_window - Pointer to the dga_window structure 830N/A * Externals: DisplayString() X11 MACRO 830N/A * XDgaGetRetainedPath() 830N/A * getpagesize() SUNOS ONLY 830N/A * Check for a non-zero pointer. 830N/A * If the shared retained information has already been mapped don't 830N/A /* Determine the window associated with this clientp */ 830N/A /* Initialise clientp's retained info structure - refer dga.h */ 830N/A * Find out if this is an X window. If so get the Display and window 830N/A * id. These are used to determine the name of the shared retained 830N/A * info file. NOTE: DGA to retained rasters are currently supported 830N/A * Now locate the shared retained info file within the file system. 830N/A * This file is located in /tmp by default, but through a server 830N/A * command line option, can be located anywhere on the system in 830N/A * question. Get the path from the server using the protocol 830N/A * extension. Then create the filename using the display string 830N/A * If the path is equal to "", then use the default directory 830N/A * Now get the port number for this display 830N/A * Combine the port number and the window id with the path 830N/A * Now unlink the file to guarantee that it will disappear 830N/A * should the client or server crash. 830N/A * Check the state of the file. If the size of the file 830N/A * is insufficient to contain the first page of the shared 830N/A * retained info structure (ie < pagesize) report a failure. 830N/A * Map the SHARED_RETAINED_INFO structure 830N/A * If the file is not actually a shared retained information file 830N/A * or its the wrong version, unmap the shared memory, close the 830N/A * file and return the error status. 830N/A * Set the fields of the client information. 830N/A * DGA Retained Window Unmap. This function unmaps the retained window 830N/A * shared memory from the clients address space given the pointer to the 830N/A * dga_window structure. The pixel array associated with the retained info 830N/A * structure is unmapped first followed by the shared retained info 830N/A * structure. The pointer to the shared memory info structure within the 830N/A * dga_window structure is set to NULL and the shared memory file is then 830N/A * closed. Should any operation fail zero is returned. 830N/A * Inputs: Dga_window - Pointer to the dga_window structure for which 830N/A * the the shared retained info structure is to 830N/A * getpagesize() SUNOS ONLY 830N/A * DGA Retained Info Structure Dump. This function prints out the contents 830N/A * of the shared retained info structure found at the specified address. 830N/A * Inputs: SHARED_RETAINED_INFO * - Pointer to the structure to dump. 830N/A (
void)
printf(
"NULL info pointer passed to _dga_rtn_dump\n");