本文整理汇总了C++中ErrorF函数的典型用法代码示例。如果您正苦于以下问题:C++ ErrorF函数的具体用法?C++ ErrorF怎么用?C++ ErrorF使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ErrorF函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: XkbWriteRulesProp
Bool
XkbWriteRulesProp(ClientPtr client, pointer closure)
{
int len,out;
Atom name;
char * pval;
if (rulesDefined && (!XkbRulesFile))
return False;
len= (XkbRulesFile?strlen(XkbRulesFile):strlen(XKB_DFLT_RULES_FILE));
len+= (XkbModelUsed?strlen(XkbModelUsed):0);
len+= (XkbLayoutUsed?strlen(XkbLayoutUsed):0);
len+= (XkbVariantUsed?strlen(XkbVariantUsed):0);
len+= (XkbOptionsUsed?strlen(XkbOptionsUsed):0);
if (len<1)
return True;
len+= 5; /* trailing NULs */
name= MakeAtom(_XKB_RF_NAMES_PROP_ATOM,strlen(_XKB_RF_NAMES_PROP_ATOM),1);
if (name==None) {
ErrorF("Atom error: %s not created\n",_XKB_RF_NAMES_PROP_ATOM);
return True;
}
pval= (char*) ALLOCATE_LOCAL(len);
if (!pval) {
ErrorF("Allocation error: %s proprerty not created\n",
_XKB_RF_NAMES_PROP_ATOM);
return True;
}
out= 0;
if (XkbRulesFile) {
strcpy(&pval[out],XkbRulesFile);
out+= strlen(XkbRulesFile);
} else {
strcpy(&pval[out],XKB_DFLT_RULES_FILE);
out+= strlen(XKB_DFLT_RULES_FILE);
}
pval[out++]= '\0';
if (XkbModelUsed) {
strcpy(&pval[out],XkbModelUsed);
out+= strlen(XkbModelUsed);
}
pval[out++]= '\0';
if (XkbLayoutUsed) {
strcpy(&pval[out],XkbLayoutUsed);
out+= strlen(XkbLayoutUsed);
}
pval[out++]= '\0';
if (XkbVariantUsed) {
strcpy(&pval[out],XkbVariantUsed);
out+= strlen(XkbVariantUsed);
}
pval[out++]= '\0';
if (XkbOptionsUsed) {
strcpy(&pval[out],XkbOptionsUsed);
out+= strlen(XkbOptionsUsed);
}
pval[out++]= '\0';
if (out!=len) {
ErrorF("Internal Error! bad size (%d!=%d) for _XKB_RULES_NAMES\n",
out,len);
}
ChangeWindowProperty(WindowTable[0],name,XA_STRING,8,PropModeReplace,
len,pval,True);
DEALLOCATE_LOCAL(pval);
return True;
}
开发者ID:narenas,项目名称:nx-libs,代码行数:68,代码来源:xkbInit.c
示例2: winUseMsg
static void
winUseMsg (void)
{
ErrorF("\n");
ErrorF("\n");
ErrorF(EXECUTABLE_NAME " Device Dependent Usage:\n");
ErrorF("\n");
#ifdef XWIN_CLIPBOARD
ErrorF ("-[no]clipboard\n"
"\tEnable [disable] the clipboard integration. Default is enabled.\n");
#endif
ErrorF ("-clipupdates num_boxes\n"
"\tUse a clipping region to constrain shadow update blits to\n"
"\tthe updated region when num_boxes, or more, are in the\n"
"\tupdated region.\n");
#ifdef XWIN_XF86CONFIG
ErrorF ("-config\n"
"\tSpecify a configuration file.\n");
ErrorF ("-configdir\n"
"\tSpecify a configuration directory.\n");
#endif
ErrorF ("-depth bits_per_pixel\n"
"\tSpecify an optional bitdepth to use in fullscreen mode\n"
"\twith a DirectDraw engine.\n");
ErrorF ("-emulate3buttons [timeout]\n"
"\tEmulate 3 button mouse with an optional timeout in\n"
"\tmilliseconds.\n");
#ifdef XWIN_EMULATEPSEUDO
ErrorF ("-emulatepseudo\n"
"\tCreate a depth 8 PseudoColor visual when running in\n"
"\tdepths 15, 16, 24, or 32, collectively known as TrueColor\n"
"\tdepths. The PseudoColor visual does not have correct colors,\n"
"\tand it may crash, but it at least allows you to run your\n"
"\tapplication in TrueColor modes.\n");
#endif
ErrorF ("-engine engine_type_id\n"
"\tOverride the server's automatically selected engine type:\n"
"\t\t1 - Shadow GDI\n"
"\t\t2 - Shadow DirectDraw\n"
"\t\t4 - Shadow DirectDraw4 Non-Locking\n"
#ifdef XWIN_NATIVEGDI
"\t\t16 - Native GDI - experimental\n"
#endif
);
ErrorF ("-fullscreen\n"
"\tRun the server in fullscreen mode.\n");
ErrorF ("-ignoreinput\n"
"\tIgnore keyboard and mouse input.\n");
#ifdef XWIN_MULTIWINDOWEXTWM
ErrorF ("-internalwm\n"
"\tRun the internal window manager.\n");
#endif
#ifdef XWIN_XF86CONFIG
ErrorF ("-keyboard\n"
"\tSpecify a keyboard device from the configuration file.\n");
#endif
ErrorF ("-[no]keyhook\n"
"\tGrab special Windows keypresses like Alt-Tab or the Menu "
"key.\n");
ErrorF ("-lesspointer\n"
"\tHide the windows mouse pointer when it is over any\n"
"\t" EXECUTABLE_NAME " window. This prevents ghost cursors appearing when\n"
"\tthe Windows cursor is drawn on top of the X cursor\n");
ErrorF ("-logfile filename\n"
"\tWrite log messages to <filename>.\n");
ErrorF ("-logverbose verbosity\n"
"\tSet the verbosity of log messages. [NOTE: Only a few messages\n"
"\trespect the settings yet]\n"
"\t\t0 - only print fatal error.\n"
"\t\t1 - print additional configuration information.\n"
"\t\t2 - print additional runtime information [default].\n"
"\t\t3 - print debugging and tracing information.\n");
ErrorF ("-[no]multimonitors or -[no]multiplemonitors\n"
"\tUse the entire virtual screen if multiple\n"
"\tmonitors are present.\n");
#ifdef XWIN_MULTIWINDOW
ErrorF ("-multiwindow\n"
"\tRun the server in multi-window mode.\n");
#endif
#ifdef XWIN_MULTIWINDOWEXTWM
ErrorF ("-mwextwm\n"
//.........这里部分代码省略.........
开发者ID:Agnarr,项目名称:xserver,代码行数:101,代码来源:InitOutput.c
示例3: DRICreatePixmap
/*
* This creates a shared memory buffer for use with GLXPixmaps
* and AppleSGLX.
*/
Bool
DRICreatePixmap(ScreenPtr pScreen, Drawable id,
DrawablePtr pDrawable, char *path,
size_t pathmax)
{
DRIPixmapBufferPtr shared;
PixmapPtr pPix;
if (pDrawable->type != DRAWABLE_PIXMAP)
return FALSE;
pPix = (PixmapPtr)pDrawable;
shared = malloc(sizeof(*shared));
if (NULL == shared) {
FatalError("failed to allocate DRIPixmapBuffer in %s\n", __func__);
}
shared->pDrawable = pDrawable;
shared->refCount = 1;
if (pDrawable->bitsPerPixel >= 24) {
shared->bytesPerPixel = 4;
}
else if (pDrawable->bitsPerPixel <= 16) {
shared->bytesPerPixel = 2;
}
shared->width = pDrawable->width;
shared->height = pDrawable->height;
if (-1 == snprintf(shared->shmPath, sizeof(shared->shmPath),
"%d_0x%lx", getpid(),
(unsigned long)id)) {
FatalError("buffer overflow in %s\n", __func__);
}
shared->fd = shm_open(shared->shmPath,
O_RDWR | O_EXCL | O_CREAT,
S_IRUSR | S_IWUSR | S_IROTH | S_IWOTH);
if (-1 == shared->fd) {
free(shared);
return FALSE;
}
shared->length = shared->width * shared->height * shared->bytesPerPixel;
if (-1 == ftruncate(shared->fd, shared->length)) {
ErrorF("failed to ftruncate (extend) file.");
shm_unlink(shared->shmPath);
close(shared->fd);
free(shared);
return FALSE;
}
shared->buffer = mmap(NULL, shared->length,
PROT_READ | PROT_WRITE,
MAP_FILE | MAP_SHARED, shared->fd, 0);
if (MAP_FAILED == shared->buffer) {
ErrorF("failed to mmap shared memory.");
shm_unlink(shared->shmPath);
close(shared->fd);
free(shared);
return FALSE;
}
strlcpy(path, shared->shmPath, pathmax);
dixSetPrivate(&pPix->devPrivates, DRIPixmapBufferPrivKey, shared);
AddResource(id, DRIDrawablePrivResType, (pointer)pDrawable);
return TRUE;
}
开发者ID:LeadHyperion,项目名称:RaspberryPiXServer,代码行数:80,代码来源:dri.c
示例4: KdUseMsg
void
KdUseMsg(void)
{
ErrorF("\nTinyX Device Dependent Usage:\n");
ErrorF
("-screen WIDTH[/WIDTHMM]xHEIGHT[/HEIGHTMM][@ROTATION][X][Y][xDEPTH/BPP[xFREQ]] Specify screen characteristics\n");
ErrorF
("-rgba rgb/bgr/vrgb/vbgr/none Specify subpixel ordering for LCD panels\n");
ErrorF
("-mouse driver [,n,,options] Specify the pointer driver and its options (n is the number of buttons)\n");
ErrorF
("-keybd driver [,,options] Specify the keyboard driver and its options\n");
ErrorF("-zaphod Disable cursor screen switching\n");
ErrorF("-2button Emulate 3 button mouse\n");
ErrorF("-3button Disable 3 button mouse emulation\n");
ErrorF
("-rawcoord Don't transform pointer coordinates on rotation\n");
ErrorF("-dumb Disable hardware acceleration\n");
ErrorF("-softCursor Force software cursor\n");
ErrorF("-videoTest Start the server, pause momentarily and exit\n");
ErrorF
("-origin X,Y Locates the next screen in the the virtual screen (Xinerama)\n");
ErrorF("-switchCmd Command to execute on vt switch\n");
ErrorF("-zap Terminate server on Ctrl+Alt+Backspace\n");
ErrorF
("vtxx Use virtual terminal xx instead of the next available\n");
}
开发者ID:csulmone,项目名称:X11,代码行数:27,代码来源:kdrive.c
示例5: winCheckDisplayNumber
static Bool
winCheckDisplayNumber (void)
{
int nDisp;
HANDLE mutex;
char name[MAX_PATH];
char * pszPrefix = '\0';
OSVERSIONINFO osvi = {0};
/* Check display range */
nDisp = atoi (display);
if (nDisp < 0 || nDisp > 65535)
{
ErrorF ("winCheckDisplayNumber - Bad display number: %d\n", nDisp);
return FALSE;
}
/* Set first character of mutex name to null */
name[0] = '\0';
/* Get operating system version information */
osvi.dwOSVersionInfoSize = sizeof (osvi);
GetVersionEx (&osvi);
/* Want a mutex shared among all terminals on NT > 4.0 */
if (osvi.dwPlatformId == VER_PLATFORM_WIN32_NT
&& osvi.dwMajorVersion >= 5)
{
pszPrefix = "Global\\";
}
/* Setup Cygwin/X specific part of name */
snprintf (name, sizeof(name), "%sCYGWINX_DISPLAY:%d", pszPrefix, nDisp);
/* Windows automatically releases the mutex when this process exits */
mutex = CreateMutex (NULL, FALSE, name);
if (!mutex)
{
LPVOID lpMsgBuf;
/* Display a fancy error message */
FormatMessage (FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
GetLastError (),
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR) &lpMsgBuf,
0, NULL);
ErrorF ("winCheckDisplayNumber - CreateMutex failed: %s\n",
(LPSTR)lpMsgBuf);
LocalFree (lpMsgBuf);
return FALSE;
}
if (GetLastError () == ERROR_ALREADY_EXISTS)
{
ErrorF ("winCheckDisplayNumber - "
PROJECT_NAME " is already running on display %d\n",
nDisp);
return FALSE;
}
return TRUE;
}
开发者ID:Agnarr,项目名称:xserver,代码行数:65,代码来源:InitOutput.c
示例6: winAllocateFBShadowDDNL
Bool
winAllocateFBShadowDDNL (ScreenPtr pScreen)
{
winScreenPriv(pScreen);
winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
HRESULT ddrval = DD_OK;
DDSURFACEDESC2 ddsdShadow;
char *lpSurface = NULL;
DDPIXELFORMAT ddpfPrimary;
#if CYGDEBUG
winDebug ("winAllocateFBShadowDDNL - w %d h %d d %d\n",
pScreenInfo->dwWidth, pScreenInfo->dwHeight, pScreenInfo->dwDepth);
#endif
/* Allocate memory for our shadow surface */
lpSurface = malloc (pScreenInfo->dwPaddedWidth * pScreenInfo->dwHeight);
if (lpSurface == NULL)
{
ErrorF ("winAllocateFBShadowDDNL - Could not allocate bits\n");
return FALSE;
}
/*
* Initialize the framebuffer memory so we don't get a
* strange display at startup
*/
ZeroMemory (lpSurface, pScreenInfo->dwPaddedWidth * pScreenInfo->dwHeight);
/* Create a clipper */
ddrval = (*g_fpDirectDrawCreateClipper) (0,
&pScreenPriv->pddcPrimary,
NULL);
if (FAILED (ddrval))
{
ErrorF ("winAllocateFBShadowDDNL - Could not attach clipper: %08x\n",
(unsigned int) ddrval);
return FALSE;
}
#if CYGDEBUG
winDebug ("winAllocateFBShadowDDNL - Created a clipper\n");
#endif
/* Get a device context for the screen */
pScreenPriv->hdcScreen = GetDC (pScreenPriv->hwndScreen);
/* Attach the clipper to our display window */
ddrval = IDirectDrawClipper_SetHWnd (pScreenPriv->pddcPrimary,
0,
pScreenPriv->hwndScreen);
if (FAILED (ddrval))
{
ErrorF ("winAllocateFBShadowDDNL - Clipper not attached "
"to window: %08x\n",
(unsigned int) ddrval);
return FALSE;
}
#if CYGDEBUG
winDebug ("winAllocateFBShadowDDNL - Attached clipper to window\n");
#endif
/* Create a DirectDraw object, store the address at lpdd */
ddrval = (*g_fpDirectDrawCreate) (NULL,
(LPDIRECTDRAW*) &pScreenPriv->pdd,
NULL);
if (FAILED (ddrval))
{
ErrorF ("winAllocateFBShadowDDNL - Could not start "
"DirectDraw: %08x\n",
(unsigned int) ddrval);
return FALSE;
}
#if CYGDEBUG
winDebug ("winAllocateFBShadowDDNL - Created and initialized DD\n");
#endif
/* Get a DirectDraw4 interface pointer */
ddrval = IDirectDraw_QueryInterface (pScreenPriv->pdd,
&IID_IDirectDraw4,
(LPVOID*) &pScreenPriv->pdd4);
if (FAILED (ddrval))
{
ErrorF ("winAllocateFBShadowDDNL - Failed DD4 query: %08x\n",
(unsigned int) ddrval);
return FALSE;
}
/* Are we full screen? */
if (pScreenInfo->fFullScreen)
{
DDSURFACEDESC2 ddsdCurrent;
DWORD dwRefreshRateCurrent = 0;
HDC hdc = NULL;
/* Set the cooperative level to full screen */
ddrval = IDirectDraw4_SetCooperativeLevel (pScreenPriv->pdd4,
pScreenPriv->hwndScreen,
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:dri-ex-svn,代码行数:101,代码来源:winshadddnl.c
示例7: winInitVisualsShadowDDNL
static Bool
winInitVisualsShadowDDNL (ScreenPtr pScreen)
{
winScreenPriv(pScreen);
winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
DWORD dwRedBits, dwGreenBits, dwBlueBits;
/* Count the number of ones in each color mask */
dwRedBits = winCountBits (pScreenPriv->dwRedMask);
dwGreenBits = winCountBits (pScreenPriv->dwGreenMask);
dwBlueBits = winCountBits (pScreenPriv->dwBlueMask);
/* Store the maximum number of ones in a color mask as the bitsPerRGB */
if (dwRedBits == 0 || dwGreenBits == 0 || dwBlueBits == 0)
pScreenPriv->dwBitsPerRGB = 8;
else if (dwRedBits > dwGreenBits && dwRedBits > dwBlueBits)
pScreenPriv->dwBitsPerRGB = dwRedBits;
else if (dwGreenBits > dwRedBits && dwGreenBits > dwBlueBits)
pScreenPriv->dwBitsPerRGB = dwGreenBits;
else
pScreenPriv->dwBitsPerRGB = dwBlueBits;
winDebug ("winInitVisualsShadowDDNL - Masks %08x %08x %08x BPRGB %d d %d "
"bpp %d\n",
(unsigned int) pScreenPriv->dwRedMask,
(unsigned int) pScreenPriv->dwGreenMask,
(unsigned int) pScreenPriv->dwBlueMask,
(int) pScreenPriv->dwBitsPerRGB,
(int) pScreenInfo->dwDepth,
(int) pScreenInfo->dwBPP);
/* Create a single visual according to the Windows screen depth */
switch (pScreenInfo->dwDepth)
{
case 24:
case 16:
case 15:
#if defined(XFree86Server)
/* Setup the real visual */
if (!miSetVisualTypesAndMasks (pScreenInfo->dwDepth,
TrueColorMask,
pScreenPriv->dwBitsPerRGB,
-1,
pScreenPriv->dwRedMask,
pScreenPriv->dwGreenMask,
pScreenPriv->dwBlueMask))
{
ErrorF ("winInitVisualsShadowDDNL - miSetVisualTypesAndMasks "
"failed for TrueColor\n");
return FALSE;
}
#ifdef XWIN_EMULATEPSEUDO
if (!pScreenInfo->fEmulatePseudo)
break;
/* Setup a pseudocolor visual */
if (!miSetVisualTypesAndMasks (8,
PseudoColorMask,
8,
-1,
0,
0,
0))
{
ErrorF ("winInitVisualsShadowDDNL - miSetVisualTypesAndMasks "
"failed for PseudoColor\n");
return FALSE;
}
#endif
#else /* XFree86Server */
/* Setup the real visual */
if (!fbSetVisualTypesAndMasks (pScreenInfo->dwDepth,
TrueColorMask,
pScreenPriv->dwBitsPerRGB,
pScreenPriv->dwRedMask,
pScreenPriv->dwGreenMask,
pScreenPriv->dwBlueMask))
{
ErrorF ("winInitVisualsShadowDDNL - fbSetVisualTypesAndMasks "
"failed for TrueColor\n");
return FALSE;
}
#ifdef XWIN_EMULATEPSEUDO
if (!pScreenInfo->fEmulatePseudo)
break;
/* Setup a pseudocolor visual */
if (!fbSetVisualTypesAndMasks (8,
PseudoColorMask,
8,
0,
0,
0))
{
ErrorF ("winInitVisualsShadowDDNL - fbSetVisualTypesAndMasks "
"failed for PseudoColor\n");
return FALSE;
}
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:dri-ex-svn,代码行数:101,代码来源:winshadddnl.c
示例8: lnx_savefont
Bool
lnx_savefont(void)
{
unsigned char *fontdata;
#if CHECK_OS_VERSION
char kernel_version[VERSION_LEN + 1];
int k_major, k_minor, k_release;
#endif
int size;
int fd;
int width = 32, height = 32, charcount = 2048;
#ifdef DEBUG
ErrorF("SAVE font\n");
#endif
#if CHECK_OS_VERSION
/* Check if the kernel has full support for this */
if ((fd = open ("/proc/sys/kernel/osrelease",O_RDONLY)) == -1) {
close (fd);
return TRUE;
}
size = read(fd, kernel_version, VERSION_LEN);
close (fd);
if (size < 0)
return TRUE;
size = sscanf(kernel_version, "%d.%d.%d",&k_major,&k_minor,&k_release);
if (size < 3
|| (k_major < 2)
|| ((k_major == 2)
&& ((k_minor < 6)
|| ( k_minor == 6
&& k_release < 11))))
return TRUE;
#endif
/* if we are in fbdev mode we don't bother saving fonts */
if ((fd = open ("/dev/fb0",O_RDWR)) != -1) {
close (fd);
return TRUE;
}
if (!getfont(&width, &height, &charcount, NULL)) {
xf86Msg(X_WARNING,
"lnx_savefont: cannot obtain font info\n");
goto error;
} else if (charcount == 2048) {
xf86Msg(X_WARNING, "lnx_savefont: "
"kernel bug: kernel doesn't report font info\n");
return FALSE;
}
size = (width + 7)/8 * 32 * charcount;
fontdata = (unsigned char *)xnfalloc(size);
if (!fontdata) {
xf86Msg(X_WARNING,
"lnx_savefont: cannot allocate memory to save font\n");
goto error;
}
if (!getfont(&width, &height, &charcount, fontdata)) {
xf86Msg(X_WARNING,"lnx_savefont: cannot read font data\n");
goto error;
}
lnxfont.width = width;
lnxfont.height = height;
lnxfont.charcount = charcount;
lnxfont.data = fontdata;
return TRUE;
error:
return FALSE;
}
开发者ID:Magister,项目名称:x11rdp_xorg71,代码行数:76,代码来源:lnx_font.c
示例9: getfont
static Bool
getfont(int *width, int *height,
int *charcount, unsigned char *data)
{
struct console_font_op op;
struct consolefontdesc ds;
int result;
op.op = KD_FONT_OP_GET;
op.width = *width;
op.height = *height;
op.charcount = *charcount;
op.data = data;
op.flags = 0;
SYSCALL(result = ioctl(xf86Info.consoleFd, KDFONTOP, &op));
#ifdef DEBUG
ErrorF("Console font read: h: %i count: %i\n",op.height,op.charcount);
#endif
if (!result) {
*width = op.width;
*height = op.height;
*charcount = op.charcount;
return TRUE;
}
if (errno != ENOSYS && errno != EINVAL)
return FALSE;
/* GIO_FONTX fallback */
ds.charcount = *charcount;
ds.charheight = *height;
ds.chardata = (char *)data;
*width = 8;
SYSCALL(result = ioctl(xf86Info.consoleFd, GIO_FONTX, &ds));
if (!result) {
*charcount = ds.charcount;
*height = ds.charheight;
return TRUE;
}
if (errno != ENOSYS && errno != EINVAL)
return FALSE;
/* GIO_FONT fallback */
if (*charcount < 256)
return FALSE;
SYSCALL(result = ioctl(xf86Info.consoleFd, GIO_FONT, data));
if (!result) {
*height = 0;
*charcount = 512;
return TRUE;
}
return FALSE;
}
开发者ID:Magister,项目名称:x11rdp_xorg71,代码行数:66,代码来源:lnx_font.c
示例10: XdmcpWarning
static void
XdmcpWarning(const char *str)
{
ErrorF("XDMCP warning: %s\n", str);
}
开发者ID:OpenInkpot-archive,项目名称:iplinux-xorg-server,代码行数:5,代码来源:xdmcp.c
示例11: timeout
static void
timeout(void)
{
timeOutRtx++;
if (state == XDM_AWAIT_ALIVE_RESPONSE && timeOutRtx >= XDM_KA_RTX_LIMIT )
{
XdmcpDeadSession ("too many keepalive retransmissions");
return;
}
else if (timeOutRtx >= XDM_RTX_LIMIT)
{
/* Quit if "-once" specified, otherwise reset and try again. */
if (OneSession) {
dispatchException |= DE_TERMINATE;
ErrorF("XDM: too many retransmissions\n");
} else {
XdmcpDeadSession("too many retransmissions");
}
return;
}
#if defined(IPv6) && defined(AF_INET6)
if (state == XDM_COLLECT_QUERY || state == XDM_COLLECT_INDIRECT_QUERY) {
/* Try next address */
for (mgrAddr = mgrAddr->ai_next; ; mgrAddr = mgrAddr->ai_next) {
if (mgrAddr == NULL) {
mgrAddr = mgrAddrFirst;
}
if (mgrAddr->ai_family == AF_INET
|| mgrAddr->ai_family == AF_INET6)
break;
}
#ifndef SIN6_LEN
ManagerAddressLen = mgrAddr->ai_addrlen;
#endif
memcpy(&ManagerAddress, mgrAddr->ai_addr, mgrAddr->ai_addrlen);
}
#endif
switch (state) {
case XDM_COLLECT_QUERY:
state = XDM_QUERY;
break;
case XDM_COLLECT_BROADCAST_QUERY:
state = XDM_BROADCAST;
break;
#if defined(IPv6) && defined(AF_INET6)
case XDM_COLLECT_MULTICAST_QUERY:
state = XDM_MULTICAST;
break;
#endif
case XDM_COLLECT_INDIRECT_QUERY:
state = XDM_INDIRECT;
break;
case XDM_AWAIT_REQUEST_RESPONSE:
state = XDM_START_CONNECTION;
break;
case XDM_AWAIT_MANAGE_RESPONSE:
state = XDM_MANAGE;
break;
case XDM_AWAIT_ALIVE_RESPONSE:
state = XDM_KEEPALIVE;
break;
default:
break;
}
send_packet();
}
开发者ID:OpenInkpot-archive,项目名称:iplinux-xorg-server,代码行数:68,代码来源:xdmcp.c
示例12: tridentSetMMIO
void
tridentSetMMIO (TridentCardInfo *tridentc)
{
int tries;
CARD8 v;
#ifdef TRI_DEBUG
fprintf (stderr, "Set MMIO\n");
#endif
/* enable config port writes */
for (tries = 0; tries < 3; tries++)
{
/* enable direct read when GE busy, enable PCI retries */
tridentWriteIndex (tridentc, 0x3d4, 0x62,
tridentc->save.reg_3d4_62 | 0x70);
/* make sure the chip is in new mode */
tridentReadIndex (tridentc, 0x3c4, 0xb);
/* enable access to upper registers */
tridentWriteIndex (tridentc, 0x3c4, 0xe,
tridentc->save.reg_3c4_0e | 0x80);
v = tridentReadIndex (tridentc, 0x3c4, 0xe);
if (!(v & 0x80))
{
fprintf (stderr, "Trident GE not enabled 0x%x\n", v);
continue;
}
/* enable screen */
tridentWriteIndex (tridentc, 0x3ce, 0x21, 0x80);
#ifdef USE_PCI
/* enable burst r/w, enable memory mapped ports */
tridentWriteIndex (tridentc, 0x3d4, 0x39, 7);
tridentc->mmio = TRUE;
/* reset GE, enable GE, set GE to pci 1 */
tridentWriteIndex (tridentc, 0x3d4, 0x36, 0x90);
#else
/* enable burst r/w, disable memory mapped ports */
tridentWriteIndex (tridentc, 0x3d4, 0x39, 0x6);
/* reset GE, enable GE, set GE to 0xbff00 */
tridentWriteIndex (tridentc, 0x3d4, 0x36, 0x92);
#endif
/* set clock */
if (trident_clk)
{
CARD8 a, b;
a = tridentReadIndex (tridentc, 0x3c4, 0x18);
b = tridentReadIndex (tridentc, 0x3c4, 0x19);
ErrorF ("old clock 0x%x 0x%x %d\n",
a, b, CLK_FREQ(a,b));
tridentSetCLK (trident_clk, &a, &b);
ErrorF ("clk %d-> 0x%x 0x%x %d\n", trident_clk, a, b,
CLK_FREQ(a,b));
#if 1
tridentWriteIndex (tridentc, 0x3c4, 0x18, a);
tridentWriteIndex (tridentc, 0x3c4, 0x19, b);
#endif
}
if (trident_mclk)
{
CARD8 a, b;
tridentSetMCLK (trident_mclk, &a, &b);
ErrorF ("mclk %d -> 0x%x 0x%x\n", trident_mclk, a, b);
#if 0
tridentWriteIndex (tridentc, 0x3c4, 0x16, a);
tridentWriteIndex (tridentc, 0x3c4, 0x17, b);
#endif
}
if (trident_clk || trident_mclk)
{
CARD8 mode;
mode = tridentReadReg (tridentc, 0x3cc);
ErrorF ("old mode 0x%x\n", mode);
mode = (mode & 0xf3) | 0x08;
ErrorF ("new mode 0x%x\n", mode);
#if 1
tridentWriteReg (tridentc, 0x3c2, mode);
#endif
}
#ifdef TRI_DEBUG
fprintf (stderr, "0x36: 0x%02x\n",
tridentReadIndex (tridentc, 0x3d4, 0x36));
#endif
if (tridentc->cop->status != 0xffffffff)
break;
}
#ifdef TRI_DEBUG
fprintf (stderr, "COP status 0x%x\n", tridentc->cop->status);
#endif
if (tridentc->cop->status == 0xffffffff)
FatalError ("Trident COP not visible\n");
}
开发者ID:dikerex,项目名称:theqvd,代码行数:93,代码来源:trident.c
示例13: with
//.........这里部分代码省略.........
unsigned long M, N, P; /* M=feedback, N=prescale, P=postscale */
unsigned long fINTREF;
unsigned long fVCO;
unsigned long ActualClock;
long Error;
unsigned long LowestError = 1000000;
unsigned int bFoundFreq = FALSE;
int cInnerLoopIterations = 0;
int LoopCount;
unsigned long ClosestClock = 0;
ReqClock*=10; /* convert into 100Hz units */
RefClock*=10; /* convert into 100Hz units */
for(P = 0; P <= 5; ++P)
{
unsigned long fVCOLowest, fVCOHighest;
/* it is pointless going through the main loop if all values of
N produce an fVCO outside the acceptable range */
N = 1;
M = (N * (1UL << P) * ReqClock) / (2 * RefClock);
fVCOLowest = (2 * RefClock * M) / N;
N = 255;
M = (N * (1UL << P) * ReqClock) / (2 * RefClock);
fVCOHighest = (2 * RefClock * M) / N;
if(fVCOHighest < fMinVCO || fVCOLowest > fMaxVCO)
{
continue;
}
for(N = 1; N <= 255; ++N, ++cInnerLoopIterations)
{
fINTREF = RefClock / N;
if(fINTREF < fMinINTREF || fINTREF > fMaxINTREF)
{
if(fINTREF > fMaxINTREF)
{
/* hopefully we will get into range as the prescale
value increases */
continue;
}
else
{
/* already below minimum and it will only get worse:
move to the next postscale value */
break;
}
}
M = (N * (1UL << P) * ReqClock) / (2 * RefClock);
if(M > 255)
{
/* M, N & P registers are only 8 bits wide */
break;
}
/* we can expect rounding errors in calculating M, which
will always be rounded down. So we will checkout our
calculated value of M along with (M+1) */
for(LoopCount = (M == 255) ? 1 : 2; --LoopCount >= 0; ++M)
{
fVCO = (2 * RefClock * M) / N;
if(fVCO >= fMinVCO && fVCO <= fMaxVCO)
{
ActualClock = fVCO / (1UL << P);
Error = ActualClock - ReqClock;
if(Error < 0)
Error = -Error;
if(Error < LowestError)
{
bFoundFreq = TRUE;
LowestError = Error;
ClosestClock = ActualClock;
*prescale = N;
*feedback = M;
*postscale = P;
if(Error == 0)
goto Done;
}
}
}
}
}
Done:
if(bFoundFreq)
ActualClock = ClosestClock;
else
ActualClock = 0;
#if 0
ErrorF("PM3DAC_CalculateClock: Got prescale=%d, feedback=%d, postscale=%d, WantedClock = %d00 ActualClock = %d00 (Error %d00)\n",
*prescale, *feedback, *postscale, ReqClock, ActualClock, LowestError);
#endif
return(ActualClock);
}
开发者ID:marioaugustorama,项目名称:tropix-xwindow,代码行数:101,代码来源:pm3_dac.c
示例14: XkbInitDevice
void
XkbInitDevice(DeviceIntPtr pXDev)
{
int i;
XkbSrvInfoPtr xkbi;
XkbChangesRec changes;
SrvXkmInfo file;
unsigned check;
XkbEventCauseRec cause;
file.dev= pXDev;
file.file=NULL;
bzero(&file.xkbinfo,sizeof(XkbFileInfo));
bzero(&changes,sizeof(XkbChangesRec));
if (XkbAutoLoad && (XkbInitialMap!=NULL)) {
if ((file.file=XkbDDXOpenConfigFile(XkbInitialMap,NULL,0))!=NULL) {
XkmReadFile(file.file,0,XkmKeymapLegal,&file.xkbinfo);
if (file.xkbinfo.xkb==NULL) {
LogMessage(X_ERROR,
"Error loading keymap file %s (%s in %s)\n"
"\treverting to defaults\n",
XkbInitialMap, _XkbErrMessages[_XkbErrCode],
(_XkbErrLocation?_XkbErrLocation:"unknown"));
fclose(file.file);
file.file= NULL;
bzero(&file.xkbinfo,sizeof(XkbFileInfo));
}
else {
if (_XkbInitFileInfo!=NULL) {
XkbDescPtr tmp;
if ((tmp=_XkbInitFileInfo->xkb)!=NULL) {
XkbFreeKeyboard(tmp,XkbAllComponentsMask,True);
_XkbInitFileInfo->xkb= NULL;
}
}
_XkbInitFileInfo= &file.xkbinfo;
}
}
else {
LogMessage(X_ERROR, "Error opening keymap file %s, reverting to defaults\n",
XkbInitialMap);
}
}
pXDev->key->xkbInfo= xkbi= _XkbTypedCalloc(1,XkbSrvInfoRec);
if ( xkbi ) {
XkbDescPtr xkb;
if ((_XkbInitFileInfo!=NULL)&&(_XkbInitFileInfo->xkb!=NULL)) {
file.xkbinfo= *_XkbInitFileInfo;
xkbi->desc= _XkbInitFileInfo->xkb;
_XkbInitFileInfo= NULL;
}
else {
xkbi->desc= XkbAllocKeyboard();
if (!xkbi->desc)
FatalError("Couldn't allocate keyboard description\n");
xkbi->desc->min_key_code = pXDev->key->curKeySyms.minKeyCode;
xkbi->desc->max_key_code = pXDev->key->curKeySyms.maxKeyCode;
}
xkb= xkbi->desc;
if (xkb->min_key_code == 0)
xkb->min_key_code = pXDev->key->curKeySyms.minKeyCode;
if (xkb->max_key_code == 0)
xkb->max_key_code = pXDev->key->curKeySyms.maxKeyCode;
if ((pXDev->key->curKeySyms.minKeyCode!=xkbi->desc->min_key_code)||
(pXDev->key->curKeySyms.maxKeyCode!=xkbi->desc->max_key_code)) {
/* 12/9/95 (ef) -- XXX! Maybe we should try to fix up one or */
/* the other here, but for now just complain */
/* can't just update the core range without */
/* reallocating the KeySymsRec (pain) */
ErrorF("Internal Error!! XKB and core keymap have different range\n");
}
if (XkbAllocClientMap(xkb,XkbAllClientInfoMask,0)!=Success)
FatalError("Couldn't allocate client map in XkbInitDevice\n");
i= XkbNumKeys(xkb)/3+1;
if (XkbAllocServerMap(xkb,XkbAllServerInfoMask,i)!=Success)
FatalError("Couldn't allocate server map in XkbInitDevice\n");
xkbi->dfltPtrDelta=1;
xkbi->device = pXDev;
file.xkbinfo.xkb= xkb;
XkbInitSemantics(xkb,&file);
XkbInitNames(xkbi,&file);
XkbInitRadioGroups(xkbi,&file);
/* 12/31/94 (ef) -- XXX! Should check if state loaded from file */
bzero(&xkbi->state,sizeof(XkbStateRec));
XkbInitControls(pXDev,xkbi,&file);
if (file.xkbinfo.defined&XkmSymbolsMask)
memcpy(pXDev->key->modifierMap,xkb->map->modmap,xkb->max_key_code+1);
else
memcpy(xkb->map->modmap,pXDev->key->modifierMap,xkb->max_key_code+1);
XkbInitIndicatorMap(xkbi,&file);
XkbDDXInitDevice(pXDev);
if (!(file.xkbinfo.defined&XkmSymbolsMask)) {
//.........这里部分代码省略.........
开发者ID:narenas,项目名称:nx-libs,代码行数:101,代码来源:xkbInit.c
示例15: winBltExposedRegionsShadowDDNL
static Bool
winBltExposedRegionsShadowDDNL (ScreenPtr pScreen)
{
winScreenPriv(pScreen);
winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
RECT rcSrc, rcDest;
POINT ptOrigin;
HDC hdcUpdate;
PAINTSTRUCT ps;
HRESULT ddrval = DD_OK;
Bool fReturn = TRUE;
int i;
/* Quite common case. The primary surface was lost (maybe because of depth
* change). Try to create a new primary surface. Bail out if this fails */
if (pScreenPriv->pddsPrimary4 == NULL && pScreenPriv->fRetryCreateSurface &&
!winCreatePrimarySurfaceShadowDDNL(pScreen))
{
Sleep(100);
return FALSE;
}
if (pScreenPriv->pddsPrimary4 == NULL)
return FALSE;
/* BeginPaint gives us an hdc that clips to the invalidated region */
hdcUpdate = BeginPaint (pScreenPriv->hwndScreen, &ps);
if (hdcUpdate == NULL)
{
fReturn = FALSE;
ErrorF ("winBltExposedRegionsShadowDDNL - BeginPaint () returned "
"a NULL device context handle. Aborting blit attempt.\n");
goto winBltExposedRegionsShadowDDNL_Exit;
}
/* Get the origin of the window in the screen coords */
ptOrigin.x = pScreenInfo->dwXOffset;
ptOrigin.y = pScreenInfo->dwYOffset;
MapWindowPoints (pScreenPriv->hwndScreen,
HWND_DESKTOP,
(LPPOINT)&ptOrigin, 1);
rcDest.left = ptOrigin.x;
rcDest.right = ptOrigin.x + pScreenInfo->dwWidth;
rcDest.top = ptOrigin.y;
rcDest.bottom = ptOrigin.y + pScreenInfo->dwHeight;
/* Source can be entire shadow surface, as Blt should clip for us */
rcSrc.left = 0;
rcSrc.top = 0;
rcSrc.right = pScreenInfo->dwWidth;
rcSrc.bottom = pScreenInfo->dwHeight;
/* Try to regain the primary surface and blit again if we've lost it */
for (i = 0; i <= WIN_REGAIN_SURFACE_RETRIES; ++i)
{
/* Our Blt should be clipped to the invalidated region */
ddrval = IDirectDrawSurface4_Blt (pScreenPriv->pddsPrimary4,
&rcDest,
pScreenPriv->pddsShadow4,
&rcSrc,
DDBLT_WAIT,
NULL);
if (ddrval == DDERR_SURFACELOST)
{
/* Surface was lost */
winErrorFVerb (1, "winBltExposedRegionsShadowDDNL - "
"IDirectDrawSurface4_Blt reported that the primary "
"surface was lost, trying to restore, retry: %d\n", i + 1);
/* Try to restore the surface, once */
ddrval = IDirectDrawSurface4_Restore (pScreenPriv->pddsPrimary4);
winDebug ("winBltExposedRegionsShadowDDNL - "
"IDirectDrawSurface4_Restore returned: ");
if (ddrval == DD_OK)
winDebug ("DD_OK\n");
else if (ddrval == DDERR_WRONGMODE)
winDebug ("DDERR_WRONGMODE\n");
else if (ddrval == DDERR_INCOMPATIBLEPRIMARY)
winDebug ("DDERR_INCOMPATIBLEPRIMARY\n");
else if (ddrval == DDERR_UNSUPPORTED)
winDebug ("DDERR_UNSUPPORTED\n");
else if (ddrval == DDERR_INVALIDPARAMS)
winDebug ("DDERR_INVALIDPARAMS\n");
else if (ddrval == DDERR_INVALIDOBJECT)
winDebug ("DDERR_INVALIDOBJECT\n");
else
winDebug ("unknown error: %08x\n", (unsigned int) ddrval);
/* Loop around to try the blit one more time */
continue;
}
else if (FAILED (ddrval))
{
fReturn = FALSE;
winErrorFVerb (1, "winBltExposedRegionsShadowDDNL - "
"IDirectDrawSurface4_Blt failed, but surface not "
"lost: %08x %d\n",
(unsigned int) ddrval, (int) ddrval);
goto winBltExposedRegionsShadowDDNL_Exit;
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:dri-ex-svn,代码行数:101,代码来源:winshadddnl.c
示例16: _glamor_upload_bits_to_pixmap_texture
static Bool
_glamor_upload_bits_to_pixmap_texture(PixmapPtr pixmap, GLenum format,
GLenum type, int no_alpha, int revert,
int swap_rb, int x, int y, int w, int h,
int stride, void *bits, int pbo)
{
ScreenPtr screen = pixmap->drawable.pScreen;
glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap);
glamor_screen_private *glamor_priv =
glamor_get_screen_private(pixmap->drawable.pScreen);
float dst_xscale, dst_yscale;
GLuint tex = 0;
int need_free_bits = 0;
if (bits == NULL)
goto ready_to_upload;
if (revert > REVERT_NORMAL) {
/* XXX if we are restoring the pixmap, then we may not need to allocate
* new buffer */
void *converted_bits;
if (pixmap->drawable.depth == 1)
stride = (((w * 8 + 7) / 8) + 3) & ~3;
converted_bits = xallocarray(h, stride);
if (converted_bits == NULL)
return FALSE;
bits = glamor_color_convert_to_bits(bits, converted_bits, w, h,
stride, no_alpha, revert, swap_rb);
if (bits == NULL) {
free(converted_bits);
ErrorF("Failed to convert pixmap no_alpha %d,"
"revert mode %d, swap mode %d\n", no_alpha, revert, swap_rb);
return FALSE;
}
no_alpha = 0;
revert = REVERT_NONE;
swap_rb = SWAP_NONE_UPLOADING;
need_free_bits = TRUE;
}
ready_to_upload:
/* Try fast path firstly, upload the pixmap to the texture attached
* to the fbo directly. */
if (no_alpha == 0
&& revert == REVERT_NONE && swap_rb == SWAP_NONE_UPLOADING
#ifdef WALKAROUND_LARGE_TEXTURE_MAP
&& glamor_pixmap_priv_is_small(pixmap_priv)
#endif
) {
int fbo_x_off, fbo_y_off;
assert(pixmap_priv->fbo->tex);
pixmap_priv_get_fbo_off(pixmap_priv, &fbo_x_off, &fbo_y_off);
assert(x + fbo_x_off >= 0 && y + fbo_y_off >= 0);
assert(x + fbo_x_off + w <= pixmap_priv->fbo->width);
assert(y + fbo_y_off + h <= pixmap_priv->fbo->height);
if (!__glamor_upload_pixmap_to_texture(pixmap, &pixmap_priv->fbo->tex,
format, type,
x + fbo_x_off, y + fbo_y_off,
w, h,
bits, pbo)) {
if (need_free_bits)
free(bits);
return FALSE;
}
} else {
static const float texcoords_inv[8] = { 0, 0,
1, 0,
1, 1,
0, 1
};
GLfloat *v;
char *vbo_offset;
v = glamor_get_vbo_space(screen, 16 * sizeof(GLfloat), &vbo_offset);
pixmap_priv_get_dest_scale(pixmap, pixmap_priv, &dst_xscale, &dst_yscale);
glamor_set_normalize_vcoords(pixmap_priv, dst_xscale,
dst_yscale,
x, y,
x + w, y + h,
v);
/* Slow path, we need to flip y or wire alpha to 1. */
glamor_make_current(glamor_priv);
if (!__glamor_upload_pixmap_to_texture(pixmap, &tex,
format, type, 0, 0, w, h, bits,
pbo)) {
if (need_free_bits)
free(bits);
return FALSE;
}
memcpy(&v[8], texcoords_inv, 8 * sizeof(GLfloat));
//.........这里部分代码省略.........
开发者ID:ChristophHaag,项目名称:xserver-prime-sync,代码行数:101,代码来源:glamor_picture.c
示例17: winCreatePrimarySurfaceShadowDDNL
static Bool
winCreatePrimarySurfaceShadowDDNL (ScreenPtr pScreen)
{
winScreenPriv(pScreen);
HRESULT ddrval = DD_OK;
DDSURFACEDESC2 ddsd;
winDebug ("winCreatePrimarySurfaceShadowDDNL - Creating primary surface\n");
/* Describe the primary surface */
ZeroMemory (&ddsd, sizeof (ddsd));
ddsd.dwSize = sizeof (ddsd);
ddsd.dwFlags = DDSD_CAPS;
ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
/* Create the primary surface */
ddrval = IDirectDraw4_CreateSurface (pScreenPriv->pdd4,
&ddsd,
&pScreenPriv->pddsPrimary4,
NULL);
pScreenPriv->fRetryCreateSurface = FALSE;
if (FAILED (ddrval))
{
if (ddrval == DDERR_NOEXCLUSIVEMODE)
{
/* Recreating the surface failed. Mark screen to retry later */
pScreenPriv->fRetryCreateSurface = TRUE;
winDebug ("winCreatePrimarySurfaceShadowDDNL - Could not create "
"primary surface: DDERR_NOEXCLUSIVEMODE\n");
}
else
{
ErrorF ("winCreatePrimarySurfaceShadowDDNL - Could not create "
"primary surface: %08x\n", (unsigned int) ddrval);
}
return FALSE;
}
#if 1
winDebug ("winCreatePrimarySurfaceShadowDDNL - Created primary surface\n");
#endif
/* Attach our clipper to our primary surface handle */
ddrval = IDirectDrawSurface4_SetClipper (pScreenPriv->pddsPrimary4,
pScreenPriv->pddcPrimary)
|
请发表评论