1568N/A/* Copyright (c) 1993, 2015, 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 * Shared colormap synchronization routines. 830N/A * dga_cm_grab(devfd, filesuffix) 830N/A * unsigned long filesuffix ; 830N/A * Grab a colormap. 'filesuffix' is the handle returned by 830N/A * XDgaGrabColormap. 'devfd' is the file descriptor of the frame buffer 830N/A * if any, -1 otherwise. If you specify -1, dga_cm_grab will open 830N/A * the frame buffer. The frame buffer fd may be inquired from 830N/A * the returned dga_cmap structure. 830N/A * Returns a pointer to a dga_cmap structure on success, 830N/A * dga_cm_ungrab(cginfo,cflag) 830N/A * Release a colormap. All resources allocated by dga_cm_grab are 830N/A * freed. The application should call XDgaUnGrabColormap after calling 830N/A * dga_cm_ungrab() so that the server may free the colormap info page 830N/A * if cflag is nonzero, the framebuffr fd described in the info page 830N/A * is also closed. The info page is invalid after this call and 830N/A * references to it will probably result in a SIGSEGV. 830N/A * dga_cm_get(cginfo,index,count, red,green,blue) 830N/A * u_char *red, *green, *blue ; 830N/A * Read colormap values and return them to the application. 830N/A * dga_cm_put(cginfo,index,count, red,green,blue) 830N/A * u_char *red, *green, *blue ; 830N/A * Write colormap to hardware if colormap is installed, otherwise 830N/A * save them in shared memory. 830N/A * dga_cm_write(cginfo,index,count, red,green,blue, putfunc) 830N/A * u_char *red, *green, *blue ; 830N/A * Write colormap to hardware by calling the user supplied putfunc 830N/A * if colormap is installed, otherwise save them in shared memory. 830N/A * dga_cm_read(cginfo,index,count, red,green,blue) 830N/A * u_char *red, *green, *blue ; 830N/A * Read colormap values and return them to the application 830N/A * dga_cm_get_devfd(cginfo) 830N/A * Return the fd of the device associated with cginfo 830N/A * dga_cm_get_devinfo(cginfo) 830N/A * Returns pointer to the device specific info associated with 830N/A * cginfo. Used to communicate info bet server and client 830N/A * dga_cm_set_client_infop(cginfo, client_info_ptr) 830N/A * void* client_info_ptr; 830N/A * Sets pointer to client specificr-data associated with cginfo. 830N/A * dga_cm_get_client_infop(cginfo) 830N/A * Returns the client specific data pointer associated with cginfo 830N/A unsigned char *
red;
/* pointer to red table */ 830N/A unsigned char *
green;
/* pointer to green table */ 830N/A unsigned char *
blue;
/* pointer to blue table */ 830N/A /* first and foremost, is this a nested grab? */ 830N/A /* open the file. Read in enough data to find out long it is. */ 830N/A /* map the colormap info area */ 830N/A /* we're all done with infofd now. If the info file becomes 830N/A * subject to growth later, we'll want to keep it open. 830N/A /* Open framebuffer if not provided by caller */ 830N/A /* if lockdevice explicitly specified by server, we need to 830N/A * open it here, even if the calling routine has opened the 830N/A * framebuffer for us. Otherwise, we use the framebuffer device. 830N/A /* map the lock page */ 830N/A /* map the unlock page */ 830N/A /* fill in the misc stuff */ 830N/A * Read colormap from shared memory. 830N/A * Shared memory should always be in sync 830N/A * with server's idea of this X11 colormap's 830N/A /* REMIND: Currently, we don't need to test for any changes in the 830N/A * shared memory page; but if we did, right here is where we'd do 830N/A * it. We compare infop->cm_count against cginfo->c_chngcnt and 830N/A * react if there was a difference. After handling the change, 830N/A * we'd copy infop->cm_count to cginfo->c_chngcnt. 830N/A /* copy from shared memory */ 830N/A/* This is the new interface that will be publicly exposed */ 830N/A/* write colormap to shared memory, and to DACS if appropriate. */ 830N/A /* copy to shared memory shadow of grabbed color map */ 830N/A /* "stutter" the 8-bit values into 16 bits */ 830N/A /* We no longer need the hw shadow cmap but have to keep 830N/A * the structures the same size and so we will just stop 830N/A /* copy to shared memory shadow of hardware color map */ 830N/A /* Note from V4 on, SUnwindows include files, support no 830N/A * longer exist. I am commenting out the code instead of 830N/A * removing it only for completeness. After Mars, time to 830N/A * move away from sunwindows.... 830N/A /* Adjust SUNWINDOWS cms segment 1st colr != last color */ 830N/A /* Adjust SUNWINDOWS cms segment 1st colr != last color */ 830N/A routines here; just fall 830N/A through to device ioctl 830N/A#
endif /* FBIOPUTCMAPI */ 830N/A /* try FB_CLUTPOST ioctl */ 830N/A /* We've changed the shared memory page, flag this fact to 830N/A * the server and to any other clients 830N/A/* This is the interfce that will be publicly exposed */ 830N/A /* copy to shared memory shadow of grabbed color map */ 830N/A /* "stutter" the 8-bit values into 16 bits */ 830N/A /* We dont need to update thie any more */ 830N/A /* copy to shared memory shadow of hardware color map */ 830N/A /* Now call the user supplied function for actually 830N/A /* We've changed the shared memory page, flag this fact to 830N/A * the server and to any other clients 830N/A/* Interfaces that will be exposed to the public */ 830N/A/* This device info is shared between the server and client */ 830N/A/* Each client may store private info in the client info ptr */ 830N/A * part of the C library someday. 830N/A /* structure for allocating lock contexts. The identification 830N/A * should be provided as the offset for mmap(2). The offset is 830N/A * the byte-offset relative to the start of the page returned 830N/A#
endif /* WINLOCKALLOC */ 830N/A /* return non-zero if fail */