static Bool fbdevHWSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode, Bool check) { fbdevHWPtr fPtr = FBDEVHWPTR(pScrn); struct fb_var_screeninfo req_var = fPtr->var, set_var; xfree2fbdev_fblayout(pScrn, &req_var); xfree2fbdev_timing(mode, &req_var); #if DEBUG print_xfree_mode("init", mode); print_fbdev_mode("init", &req_var); #endif set_var = req_var; if (check) set_var.activate = FB_ACTIVATE_TEST; if (0 != ioctl(fPtr->fd, FBIOPUT_VSCREENINFO, (void *) (&set_var))) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "FBIOPUT_VSCREENINFO: %s\n", strerror(errno)); return FALSE; } if (!fbdev_modes_equal(&set_var, &req_var)) { if (!check) xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "FBIOPUT_VSCREENINFO succeeded but modified " "mode\n"); #if DEBUG print_fbdev_mode("returned", &set_var); #endif return FALSE; } if (!check) fPtr->var = set_var; return TRUE; }
Bool xf86SetDefaultVisual(ScrnInfoPtr scrp, int visual) { MessageType visualFrom = X_DEFAULT; if (defaultColorVisualClass >= 0) { scrp->defaultVisual = defaultColorVisualClass; visualFrom = X_CMDLINE; } else if (scrp->display->defaultVisual >= 0) { scrp->defaultVisual = scrp->display->defaultVisual; visualFrom = X_CONFIG; } else if (visual >= 0) { scrp->defaultVisual = visual; } else { if (scrp->depth == 1) scrp->defaultVisual = StaticGray; else if (scrp->depth == 4) scrp->defaultVisual = StaticColor; else if (scrp->depth <= MAX_PSEUDO_DEPTH) scrp->defaultVisual = PseudoColor; else scrp->defaultVisual = TrueColor; } switch (scrp->defaultVisual) { case StaticGray: case GrayScale: case StaticColor: case PseudoColor: case TrueColor: case DirectColor: xf86DrvMsg(scrp->scrnIndex, visualFrom, "Default visual is %s\n", xf86VisualNames[scrp->defaultVisual]); return TRUE; default: xf86DrvMsg(scrp->scrnIndex, X_ERROR, "Invalid default visual class (%d)\n", scrp->defaultVisual); return FALSE; } }
void ViaCheckCardId(ScrnInfoPtr pScrn) { struct ViaCardIdStruct *Id; VIAPtr pVia = VIAPTR(pScrn); for (Id = ViaCardId; Id->String; Id++) { if ((Id->Chip == pVia->Chipset) && (Id->Vendor == pVia->PciInfo->subsysVendor) && (Id->Device == pVia->PciInfo->subsysCard)) { xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Detected %s.\n", Id->String); pVia->Id = Id; return; } } xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Unknown Card-Ids (%4X|%4X), report this to [email protected] ASAP\n" , pVia->PciInfo->subsysVendor, pVia->PciInfo->subsysCard); pVia->Id = NULL; }
static void print_input_features(int scrnIndex, struct disp_features *c) { if (DIGITAL(c->input_type)) xf86DrvMsg(scrnIndex,X_INFO,"Digital Display Input\n"); else { xf86DrvMsg(scrnIndex,X_INFO,"Analog Display Input, "); xf86ErrorF("Input Voltage Level: "); switch (c->input_voltage){ case V070: xf86ErrorF("0.700/0.300 V\n"); break; case V071: xf86ErrorF("0.714/0.286 V\n"); break; case V100: xf86ErrorF("1.000/0.400 V\n"); break; case V007: xf86ErrorF("0.700/0.700 V\n"); break; default: xf86ErrorF("undefined\n"); } if (SIG_SETUP(c->input_setup)) xf86DrvMsg(scrnIndex,X_INFO,"Signal levels configurable\n"); xf86DrvMsg(scrnIndex,X_INFO,"Sync:"); if (SEP_SYNC(c->input_sync)) xf86ErrorF(" Separate"); if (COMP_SYNC(c->input_sync)) xf86ErrorF(" Composite"); if (SYNC_O_GREEN(c->input_sync)) xf86ErrorF(" SyncOnGreen"); if (SYNC_SERR(c->input_sync)) xf86ErrorF("Serration on. " "V.Sync Pulse req. if CompSync or SyncOnGreen\n"); else xf86ErrorF("\n"); } }
Bool radeon_glamor_init(ScreenPtr screen) { ScrnInfoPtr scrn = xf86ScreenToScrn(screen); if (!glamor_init(screen, GLAMOR_INVERTED_Y_AXIS | GLAMOR_USE_EGL_SCREEN | #ifdef GLAMOR_NO_DRI3 GLAMOR_NO_DRI3 | #endif GLAMOR_USE_SCREEN | GLAMOR_USE_PICTURE_SCREEN)) { xf86DrvMsg(scrn->scrnIndex, X_ERROR, "Failed to initialize glamor.\n"); return FALSE; } if (!glamor_egl_init_textured_pixmap(screen)) { xf86DrvMsg(scrn->scrnIndex, X_ERROR, "Failed to initialize textured pixmap of screen for glamor.\n"); return FALSE; } #if HAS_DIXREGISTERPRIVATEKEY if (!dixRegisterPrivateKey(&glamor_pixmap_index, PRIVATE_PIXMAP, 0)) #else if (!dixRequestPrivate(&glamor_pixmap_index, 0)) #endif return FALSE; screen->CreatePixmap = radeon_glamor_create_pixmap; screen->DestroyPixmap = radeon_glamor_destroy_pixmap; #ifdef RADEON_PIXMAP_SHARING screen->SharePixmapBacking = radeon_glamor_share_pixmap_backing; screen->SetSharedPixmapBacking = radeon_glamor_set_shared_pixmap_backing; #endif xf86DrvMsg(scrn->scrnIndex, X_INFO, "Use GLAMOR acceleration.\n"); return TRUE; }
int rk_show_window(void *self) { rk_xvideo *par = (rk_xvideo *)self; if (par->enabled) { return 0; } int enabled = 1; if (ioctl(par->rkfb->ovl_fd, RK_FBIOSET_ENABLE, &enabled)) { xf86DrvMsg(par->rkfb->pScreen->myNum, X_INFO, "FBIOSET_ENABLE\n"); } par->enabled = TRUE; }
Bool fbdevHWUnmapVidmem(ScrnInfoPtr pScrn) { fbdevHWPtr fPtr = FBDEVHWPTR(pScrn); if (NULL != fPtr->fbmem) { if (-1 == munmap(fPtr->fbmem, fPtr->fbmem_len)) xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "munmap fbmem: %s\n", strerror(errno)); fPtr->fbmem = NULL; } return TRUE; }
static int fbdev_open(int scrnIndex, char *dev, char **namep) { struct fb_fix_screeninfo fix; int fd; /* try argument (from XF86Config) first */ if (dev) { fd = open(dev, O_RDWR, 0); } else { /* second: environment variable */ dev = getenv("FRAMEBUFFER"); if ((NULL == dev) || ((fd = open(dev, O_RDWR, 0)) == -1)) { /* last try: default device */ dev = "/dev/fb0"; fd = open(dev, O_RDWR, 0); } } if (fd == -1) { xf86DrvMsg(scrnIndex, X_ERROR, "open %s: %s\n", dev, strerror(errno)); return -1; } if (namep) { if (-1 == ioctl(fd, FBIOGET_FSCREENINFO, (void *) (&fix))) { *namep = NULL; xf86DrvMsg(scrnIndex, X_ERROR, "FBIOGET_FSCREENINFO: %s\n", strerror(errno)); return -1; } else { *namep = xnfalloc(16); strncpy(*namep, fix.id, 16); } } return fd; }
void uda1380_shutdown(UDA1380Ptr t) { CARD8 data[3]; Bool ret; /* Power control */ data[0] = 0x02; data[1] = 0; data[2] = 0; ret = I2C_WriteRead(&(t->d), data, 3, NULL, 0); if (ret == FALSE) xf86DrvMsg(t->d.pI2CBus->scrnIndex,X_INFO,"UDA1380 failed to shutdown\n"); }
Bool fbdevHWModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) { fbdevHWPtr fPtr = FBDEVHWPTR(pScrn); pScrn->vtSema = TRUE; /* set */ if (!fbdevHWSetMode(pScrn, mode, FALSE)) return FALSE; /* read back */ if (0 != ioctl(fPtr->fd,FBIOGET_FSCREENINFO,(void*)(&fPtr->fix))) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "FBIOGET_FSCREENINFO: %s\n", strerror(errno)); return FALSE; } if (0 != ioctl(fPtr->fd,FBIOGET_VSCREENINFO,(void*)(&fPtr->var))) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "FBIOGET_VSCREENINFO: %s\n", strerror(errno)); return FALSE; } if (pScrn->defaultVisual == TrueColor || pScrn->defaultVisual == DirectColor) { /* XXX: This is a hack, but it should be a NOP for all the setups that * worked before and actually seems to fix some others... */ pScrn->offset.red = fPtr->var.red.offset; pScrn->offset.green = fPtr->var.green.offset; pScrn->offset.blue = fPtr->var.blue.offset; pScrn->mask.red = ((1 << fPtr->var.red.length) - 1) << fPtr->var.red.offset; pScrn->mask.green = ((1 << fPtr->var.green.length) - 1) << fPtr->var.green.offset; pScrn->mask.blue = ((1 << fPtr->var.blue.length) - 1) << fPtr->var.blue.offset; } return TRUE; }
/* Allocate pool space that isn't pre-allocated */ Bool I830DoPoolAllocation(ScrnInfoPtr pScrn, I830MemPool *pool) { I830Ptr pI830 = I830PTR(pScrn); DPRINTF(PFX, "I830DoPoolAllocation\n"); if (!pool) return FALSE; /* * Sanity check: there shouldn't be an allocation required when * there is only stolen memory. */ if (pI830->StolenOnly && (pool->Total.Size > pool->Fixed.Size)) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "I830DoPoolAllocation(): pool size is greater than the " "preallocated size,\n\t" "and there is no allocatable memory.\n"); return FALSE; } if (pool->Total.Size > pool->Fixed.Size) { pool->Allocated.Size = pool->Total.Size - pool->Fixed.Size; pool->Allocated.Key = xf86AllocateGARTMemory(pScrn->scrnIndex, pool->Allocated.Size, 0, NULL); if (pool->Allocated.Key == -1) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Pool allocation failed\n"); return FALSE; } pool->Allocated.Start = pool->Fixed.End; pool->Allocated.End = pool->Total.Size; pool->Allocated.Offset = pool->Allocated.Start; } else pool->Allocated.Key = -1; return TRUE; }
int armsoc_bo_resize(struct armsoc_bo *bo, uint32_t new_width, uint32_t new_height) { uint32_t new_size; uint32_t new_pitch; assert(bo != NULL); assert(new_width > 0); assert(new_height > 0); /* The caller must remove the fb object before * attempting to resize. */ assert(bo->fb_id == 0); assert(bo->refcnt > 0); xf86DrvMsg(-1, X_INFO, "Resizing bo from %dx%d to %dx%d\n", bo->width, bo->height, new_width, new_height); /* TODO: MIDEGL-1563: Get pitch from DRM as * only DRM knows the ideal pitch and alignment * requirements * */ new_pitch = new_width * ((armsoc_bo_bpp(bo)+7)/8); /* Align pitch to 64 byte */ new_pitch = ALIGN(new_pitch, 64); new_size = (((new_height-1) * new_pitch) + (new_width * ((armsoc_bo_bpp(bo)+7)/8))); if (new_size <= bo->original_size) { bo->width = new_width; bo->height = new_height; bo->pitch = new_pitch; bo->size = new_size; return 0; } xf86DrvMsg(-1, X_ERROR, "Failed to resize buffer\n"); return -1; }
static Bool ms_pci_probe(DriverPtr driver, int entity_num, struct pci_device *dev, intptr_t match_data) { ScrnInfoPtr scrn = NULL; scrn = xf86ConfigPciEntity(scrn, 0, entity_num, NULL, NULL, NULL, NULL, NULL, NULL); if (scrn) { const char *devpath; GDevPtr devSection = xf86GetDevFromEntity(scrn->entityList[0], scrn->entityInstanceList[0]); devpath = xf86FindOptionValue(devSection->options, "kmsdev"); if (probe_hw_pci(devpath, dev)) { scrn->driverVersion = 1; scrn->driverName = "modesetting"; scrn->name = "modeset"; scrn->Probe = NULL; scrn->PreInit = PreInit; scrn->ScreenInit = ScreenInit; scrn->SwitchMode = SwitchMode; scrn->AdjustFrame = AdjustFrame; scrn->EnterVT = EnterVT; scrn->LeaveVT = LeaveVT; scrn->FreeScreen = FreeScreen; scrn->ValidMode = ValidMode; xf86DrvMsg(scrn->scrnIndex, X_CONFIG, "claimed PCI slot %d@%d:%d:%d\n", dev->bus, dev->domain, dev->dev, dev->func); xf86DrvMsg(scrn->scrnIndex, X_INFO, "using %s\n", devpath ? devpath : "default device"); } else scrn = NULL; } return scrn != NULL; }
int FI1236_AFC(FI1236Ptr f) { #if 0 xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "AFC: f=%p f->count=%d f->original_frequency=%d f->afc_delta=%d\n", f, f->afc_count, f->original_frequency, f->afc_delta); #endif f->afc_count++; if(f->type==TUNER_TYPE_MT2032) { f->last_afc_hint=MT2032_get_afc_hint(f); xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "AFC: afc_hint=%d\n", f->last_afc_hint); if(f->last_afc_hint==TUNER_TUNED)return 0; if(f->afc_count>3)f->last_afc_hint=TUNER_OFF; if(f->last_afc_hint==TUNER_OFF) { f->afc_delta=0; } else f->afc_delta+=f->last_afc_hint; xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "AFC: Setting tuner frequency to %g\n", (0.5*(2*f->original_frequency+f->afc_delta))/16.0); MT2032_tune(f, (1.0*f->original_frequency+0.5*f->afc_delta)/16.0, 0.03125); if(f->last_afc_hint==TUNER_OFF)return 0; return 1; /* call me again */ } else { f->last_afc_hint=FI1236_get_afc_hint(f); if(f->last_afc_hint==TUNER_TUNED)return 0; if(f->afc_count>3)f->last_afc_hint=TUNER_OFF; if(f->last_afc_hint==TUNER_OFF) { f->afc_delta=0; } else f->afc_delta+=f->last_afc_hint; xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "AFC: Setting tuner frequency to %g\n", (0.5*(2*f->original_frequency+f->afc_delta))/16.0); FI1236_tune(f, f->original_frequency+f->afc_delta); if(f->last_afc_hint==TUNER_OFF)return 0; return 1; /* call me again */ } return 0; /* done */ }
void NestedPrintPscreen(ScrnInfoPtr p) { /* XXX: finish implementing this someday? */ xf86DrvMsg(p->scrnIndex, X_INFO, "Printing pScrn:\n"); xf86DrvMsg(p->scrnIndex, X_INFO, "driverVersion: %d\n", p->driverVersion); xf86DrvMsg(p->scrnIndex, X_INFO, "driverName: %s\n", p->driverName); xf86DrvMsg(p->scrnIndex, X_INFO, "pScreen: %p\n", p->pScreen); xf86DrvMsg(p->scrnIndex, X_INFO, "scrnIndex: %d\n", p->scrnIndex); xf86DrvMsg(p->scrnIndex, X_INFO, "configured: %d\n", p->configured); xf86DrvMsg(p->scrnIndex, X_INFO, "origIndex: %d\n", p->origIndex); xf86DrvMsg(p->scrnIndex, X_INFO, "imageByteOrder: %d\n", p->imageByteOrder); /*xf86DrvMsg(p->scrnIndex, X_INFO, "bitmapScanlineUnit: %d\n"); xf86DrvMsg(p->scrnIndex, X_INFO, "bitmapScanlinePad: %d\n"); xf86DrvMsg(p->scrnIndex, X_INFO, "bitmapBitOrder: %d\n"); xf86DrvMsg(p->scrnIndex, X_INFO, "numFormats: %d\n"); xf86DrvMsg(p->scrnIndex, X_INFO, "formats[]: 0x%x\n"); xf86DrvMsg(p->scrnIndex, X_INFO, "fbFormat: 0x%x\n"); */ xf86DrvMsg(p->scrnIndex, X_INFO, "bitsPerPixel: %d\n", p->bitsPerPixel); /*xf86DrvMsg(p->scrnIndex, X_INFO, "pixmap24: 0x%x\n"); */ xf86DrvMsg(p->scrnIndex, X_INFO, "depth: %d\n", p->depth); NestedPrintMode(p, p->currentMode); /*xf86DrvMsg(p->scrnIndex, X_INFO, "depthFrom: %\n"); xf86DrvMsg(p->scrnIndex, X_INFO, "\n");*/ }
/** * Query the last display change request. * * @returns boolean success indicator. * @param pScrn Pointer to the X screen info structure. * @param pcx Where to store the horizontal pixel resolution (0 = do not change). * @param pcy Where to store the vertical pixel resolution (0 = do not change). * @param pcBits Where to store the bits per pixel (0 = do not change). * @param iDisplay Where to store the display number the request was for - 0 for the * primary display, 1 for the first secondary, etc. */ Bool vboxGetDisplayChangeRequest(ScrnInfoPtr pScrn, uint32_t *pcx, uint32_t *pcy, uint32_t *pcBits, uint32_t *piDisplay) { VBOXPtr pVBox = pScrn->driverPrivate; TRACE_ENTRY(); if (!pVBox->useDevice) return FALSE; int rc = VbglR3GetDisplayChangeRequest(pcx, pcy, pcBits, piDisplay, false); if (RT_SUCCESS(rc)) return TRUE; xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Failed to obtain the last resolution requested by the guest, rc=%d.\n", rc); return FALSE; }
static void drmmode_load_cursor_argb (xf86CrtcPtr crtc, CARD32 *image) { drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; int ret; /* cursor should be mapped already */ ret = dri_bo_subdata(drmmode_crtc->cursor, 0, 64*64*4, image); if (ret) xf86DrvMsg(crtc->scrn->scrnIndex, X_ERROR, "failed to set cursor: %s", strerror(-ret)); return; }
static Bool NestedCreateScreenResources(ScreenPtr pScreen) { xf86DrvMsg(pScreen->myNum, X_INFO, "NestedCreateScreenResources\n"); ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; NestedPrivatePtr pNested = PNESTED(pScrn); Bool ret; pScreen->CreateScreenResources = pNested->CreateScreenResources; ret = pScreen->CreateScreenResources(pScreen); pScreen->CreateScreenResources = NestedCreateScreenResources; shadowAdd(pScreen, pScreen->GetScreenPixmap(pScreen), pNested->update, /*pNested->window*/ 0, 0, 0); }
static Bool NestedCloseScreen(int scrnIndex, ScreenPtr pScreen) { ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; xf86DrvMsg(scrnIndex, X_INFO, "NestedCloseScreen\n"); shadowRemove(pScreen, pScreen->GetScreenPixmap(pScreen)); TimerFree(PNESTED(pScrn)->timer); NestedClientCloseScreen(PCLIENTDATA(pScrn)); pScreen->CloseScreen = PNESTED(pScrn)->CloseScreen; return (*pScreen->CloseScreen)(scrnIndex, pScreen); }
/* * VT1625 knows composite, s-video, RGB and YCBCR. */ static Bool VT1625DACSense(ScrnInfoPtr pScrn) { VIABIOSInfoPtr pBIOSInfo = VIAPTR(pScrn)->pBIOSInfo; CARD8 sense; DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VT1625DACSense\n")); sense = VT1625DACSenseI2C(pBIOSInfo->TVI2CDev); switch (sense) { case 0x00: /* DAC A,B,C,D,E,F */ pBIOSInfo->TVOutput = TVOUTPUT_RGB; xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "VT1625: RGB connected.\n"); return TRUE; case 0x07: /* DAC A,B,C */ pBIOSInfo->TVOutput = TVOUTPUT_SC; xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "VT1625: S-Video & Composite connected.\n"); return TRUE; case 0x37: /* DAC C */ pBIOSInfo->TVOutput = TVOUTPUT_COMPOSITE; xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "VT1625: Composite connected.\n"); return TRUE; case 0x38: /* DAC D,E,F */ pBIOSInfo->TVOutput = TVOUTPUT_YCBCR; xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "VT1625: YCbCr connected.\n"); return TRUE; case 0x0F: /* DAC A,B */ pBIOSInfo->TVOutput = TVOUTPUT_SVIDEO; xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "VT1625: S-Video connected.\n"); return TRUE; case 0x3F: pBIOSInfo->TVOutput = TVOUTPUT_NONE; xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "VT1625: Nothing connected.\n"); return FALSE; default: pBIOSInfo->TVOutput = TVOUTPUT_NONE; xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "VT1625: Unknown cable combination: 0x0%2X.\n", sense); return FALSE; } }
AgpInfoPtr xf86GetAGPInfo(int screenNum) { struct _agp_info agpinf; AgpInfoPtr info; if (!GARTInit(screenNum)) return NULL; if ((info = calloc(sizeof(AgpInfo), 1)) == NULL) { xf86DrvMsg(screenNum, X_ERROR, "xf86GetAGPInfo: Failed to allocate AgpInfo\n"); return NULL; } memset((char*)&agpinf, 0, sizeof(agpinf)); if (ioctl(gartFd, AGPIOC_INFO, &agpinf) != 0) { xf86DrvMsg(screenNum, X_ERROR, "xf86GetAGPInfo: AGPIOC_INFO failed (%s)\n", strerror(errno)); return NULL; } info->bridgeId = agpinf.bridge_id; info->agpMode = agpinf.agp_mode; info->base = agpinf.aper_base; info->size = agpinf.aper_size; info->totalPages = agpinf.pg_total; info->systemPages = agpinf.pg_system; info->usedPages = agpinf.pg_used; xf86DrvMsg(screenNum, X_INFO, "Kernel reported %zu total, %zu used\n", agpinf.pg_total, agpinf.pg_used); return info; }
struct armsoc_bo *armsoc_bo_new_with_dim(struct armsoc_device *dev, uint32_t width, uint32_t height, uint8_t depth, uint8_t bpp, enum armsoc_buf_type buf_type) { struct armsoc_create_gem create_gem; struct armsoc_bo *new_buf; int res; new_buf = malloc(sizeof(*new_buf)); if (!new_buf) return NULL; create_gem.name = 0; create_gem.buf_type = buf_type; create_gem.height = height; create_gem.width = width; create_gem.bpp = bpp; res = dev->create_custom_gem(dev->fd, &create_gem); if (res) { free(new_buf); xf86DrvMsg(-1, X_ERROR, "_CREATE_GEM({height: %d, width: %d, bpp: %d buf_type: 0x%X}) failed. errno: %d - %s\n", height, width, bpp, buf_type, errno, strerror(errno)); return NULL; } new_buf->dev = dev; new_buf->handle = create_gem.handle; new_buf->size = create_gem.size; new_buf->map_addr = NULL; new_buf->pDraw = NULL; new_buf->fb_id = 0; new_buf->pitch = create_gem.pitch; new_buf->width = create_gem.width; new_buf->height = create_gem.height; new_buf->original_size = create_gem.size; new_buf->depth = depth; new_buf->bpp = create_gem.bpp; new_buf->refcnt = 1; new_buf->dmabuf = -1; if (create_gem.name) new_buf->name = create_gem.name; else new_buf->name = 0; return new_buf; }
static void ViaSetTVClockSource(xf86CrtcPtr crtc) { drmmode_crtc_private_ptr iga = crtc->driver_private; ScrnInfoPtr pScrn = crtc->scrn; VIAPtr pVia = VIAPTR(pScrn); VIABIOSInfoPtr pBIOSInfo = pVia->pBIOSInfo; vgaHWPtr hwp = VGAHWPTR(pScrn); DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "ViaSetTVClockSource\n")); switch(pBIOSInfo->TVEncoder) { case VIA_VT1625: /* External TV: */ switch(pVia->Chipset) { case VIA_CX700: case VIA_VX800: case VIA_VX855: /* IGA1 */ if (!iga->index) { if(pBIOSInfo->TVDIPort == VIA_DI_PORT_DVP1) ViaCrtcMask(hwp, 0x6C, 0xB0, 0xF0); else if(pBIOSInfo->TVDIPort == VIA_DI_PORT_DVP0) ViaCrtcMask(hwp, 0x6C, 0x90, 0xF0); } else { /* IGA2 */ if(pBIOSInfo->TVDIPort == VIA_DI_PORT_DVP1) ViaCrtcMask(hwp, 0x6C, 0x0B, 0x0F); else if(pBIOSInfo->TVDIPort == VIA_DI_PORT_DVP0) ViaCrtcMask(hwp, 0x6C, 0x09, 0x0F); } break; default: if (!iga->index) ViaCrtcMask(hwp, 0x6C, 0x21, 0x21); else ViaCrtcMask(hwp, 0x6C, 0xA1, 0xA1); break; } break; default: if (!iga->index) ViaCrtcMask(hwp, 0x6C, 0x50, 0xF0); else ViaCrtcMask(hwp, 0x6C, 0x05, 0x0F); break; } }
/* * Open /dev/agpgart. Keep it open until xf86GARTCloseScreen is called. */ static Bool GARTInit(int screenNum) { if (initDone) return gartFd != -1; if (gartFd == -1) gartFd = open(AGP_DEVICE, O_RDWR); else return FALSE; if (gartFd == -1) { xf86DrvMsg(screenNum, X_ERROR, "GARTInit: Unable to open " AGP_DEVICE " (%s)\n", strerror(errno)); return FALSE; } initDone = TRUE; xf86DrvMsg(screenNum, X_INFO, "GARTInit: " AGP_DEVICE " opened successfully\n"); return TRUE; }
/* * Close /dev/agpgart. This frees all associated memory allocated during * this server generation. */ Bool xf86GARTCloseScreen(int screenNum) { if (gartFd != -1) { close(gartFd); acquiredScreen = -1; gartFd = -1; initDone = FALSE; xf86DrvMsg(screenNum, X_INFO, "xf86GARTCloseScreen: device closed successfully\n"); } return TRUE; }
Bool xf86DeallocateGARTMemory(int screenNum, int key) { if (!GARTInit(screenNum) || (acquiredScreen != screenNum)) return FALSE; if (ioctl(gartFd, AGPIOC_DEALLOCATE, (int *)key) != 0) { xf86DrvMsg(screenNum, X_WARNING, "xf86DeAllocateGARTMemory: " "deallocation of gart memory with key %d failed\n" "\t(%s)\n", key, strerror(errno)); return FALSE; } return TRUE; }
static void AddSeatId(CallbackListPtr *pcbl, void *data, void *screen) { ScreenPtr pScreen = screen; Atom SeatAtom = MakeAtom(SEAT_ATOM_NAME, sizeof(SEAT_ATOM_NAME) - 1, TRUE); int err; err = dixChangeWindowProperty(serverClient, pScreen->root, SeatAtom, XA_STRING, 8, PropModeReplace, strlen(data) + 1, data, FALSE); if (err != Success) xf86DrvMsg(pScreen->myNum, X_WARNING, "Failed to register seat property\n"); }
XF86MCAdaptorPtr vlCreateAdaptorXvMC(ScreenPtr pScreen, char *xv_adaptor_name) { XF86MCAdaptorPtr adaptor; ScrnInfoPtr pScrn; assert(pScreen); assert(xv_adaptor_name); pScrn = xf86Screens[pScreen->myNum]; adaptor = xf86XvMCCreateAdaptorRec(); if (!adaptor) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "[XvMC] Memory allocation failed.\n"); return NULL; } *adaptor = adaptor_template; adaptor->name = xv_adaptor_name; xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[XvMC] Associated with %s.\n", xv_adaptor_name); return adaptor; }
Bool imxDisplayFinishScreenInit(int scrnIndex, ScreenPtr pScreen) { /* Completes the screen initialization for outputs and CRTCs */ if (!xf86CrtcScreenInit(pScreen)) { xf86DrvMsg(scrnIndex, X_ERROR, "xf86CrtcScreenInit failed\n"); return FALSE; } /* All DPMS mode switching will be managed by using the dpms */ /* DPMS functions provided by the outputs and CRTCs */ xf86DPMSInit(pScreen, xf86DPMSSet, 0); return TRUE; }
static void GlamoOutputCommit(xf86OutputPtr output) { int fd = open(display_state_switch_path, O_WRONLY); if (fd != -1) { if(output->crtc->mode.HDisplay == 240 && output->crtc->mode.VDisplay == 320) write(fd, display_state_qvga, strlen(display_state_qvga)); else write(fd, display_state_vga, strlen(display_state_vga)); close(fd); } else { xf86DrvMsg(output->scrn->scrnIndex, X_ERROR, "Couldn't open %s to change display resolution: %s\n", display_state_switch_path, strerror(errno)); } }