Beispiel #1
0
static int
intel_present_get_ust_msc(RRCrtcPtr crtc, CARD64 *ust, CARD64 *msc)
{
	xf86CrtcPtr             xf86_crtc = crtc->devPrivate;
	ScreenPtr               screen = crtc->pScreen;
	ScrnInfoPtr             scrn = xf86ScreenToScrn(screen);

	return intel_get_crtc_msc_ust(scrn, xf86_crtc, msc, ust);
}
Beispiel #2
0
static void TegraDRI2CopyRegion(DrawablePtr drawable, RegionPtr region,
                                DRI2BufferPtr target, DRI2BufferPtr source)
{
    ScrnInfoPtr pScrn = xf86ScreenToScrn(drawable->pScreen);

    xf86DrvMsg(pScrn->scrnIndex, X_INFO, "> %s(drawable=%p, region=%p, target=%p, source=%p)\n",
               __func__, drawable, region, target, source);
    xf86DrvMsg(pScrn->scrnIndex, X_INFO, "< %s()\n", __func__);
}
void RADEONInitVideo(ScreenPtr pScreen)
{
    ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
    RADEONInfoPtr    info = RADEONPTR(pScrn);
    RADEONEntPtr pRADEONEnt = RADEONEntPriv(pScrn);
    XF86VideoAdaptorPtr *adaptors, *newAdaptors = NULL;
    XF86VideoAdaptorPtr texturedAdaptor = NULL;
    int num_adaptors;

    /* no overlay or 3D on RN50 */
    if (info->ChipFamily == CHIP_FAMILY_RV100 && !pRADEONEnt->HasCRTC2)
	    return;

    num_adaptors = xf86XVListGenericAdaptors(pScrn, &adaptors);
    newAdaptors = malloc((num_adaptors + 2) * sizeof(XF86VideoAdaptorPtr *));
    if (newAdaptors == NULL)
	return;

    memcpy(newAdaptors, adaptors, num_adaptors * sizeof(XF86VideoAdaptorPtr));
    adaptors = newAdaptors;

    if (info->use_glamor) {
        texturedAdaptor = radeon_glamor_xv_init(pScreen, 16);
	if (texturedAdaptor != NULL) {
	    adaptors[num_adaptors++] = texturedAdaptor;
	    xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Set up textured video (glamor)\n");
	} else
	    xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Failed to set up textured video (glamor)\n");
    } else if ((info->ChipFamily < CHIP_FAMILY_RS400)
	|| (info->directRenderingEnabled)
	) {
	texturedAdaptor = RADEONSetupImageTexturedVideo(pScreen);
	if (texturedAdaptor != NULL) {
	    adaptors[num_adaptors++] = texturedAdaptor;
	    xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Set up textured video\n");
	} else
	    xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Failed to set up textured video\n");
    } else
	xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Textured video requires CP on R5xx/R6xx/R7xx/IGP\n");

    if(num_adaptors)
	xf86XVScreenInit(pScreen, adaptors, num_adaptors);

    if(texturedAdaptor) {
	XF86MCAdaptorPtr xvmcAdaptor = RADEONCreateAdaptorXvMC(pScreen, (char *)texturedAdaptor->name);
	if(xvmcAdaptor) {
	    if(!xf86XvMCScreenInit(pScreen, 1, &xvmcAdaptor))
		xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "[XvMC] Failed to initialize extension.\n");
	    else
		xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[XvMC] Extension initialized.\n");
	}
    }

    if(newAdaptors)
	free(newAdaptors);

}
Beispiel #4
0
Bool gma_uxa_init(gma500Ptr gma, ScreenPtr screen)
{
	ScrnInfoPtr scrn = xf86ScreenToScrn (screen);
	gma->uxa = uxa_driver_alloc();
	if (gma->uxa == NULL)
		return FALSE;

#if HAS_DIXREGISTERPRIVATEKEY
	if (!dixRegisterPrivateKey (&uxa_pixmap_index, PRIVATE_PIXMAP, 0))
		return FALSE;
#else
	if (!dixRequestPrivate (&uxa_pixmap_index, 0))
		return FALSE;
#endif

	gma->uxa->uxa_major = 1;
	gma->uxa->uxa_minor = 0;

	/* Access */
	gma->uxa->prepare_access = gma_uxa_prepare_access;
	gma->uxa->finish_access = gma_uxa_finish_access;
	gma->uxa->pixmap_is_offscreen = gma_uxa_pixmap_is_offscreen;

	/* Migration */
	gma->uxa->put_image = gma_uxa_put_image;

	/* Solid */
	gma->uxa->check_solid = gma_uxa_check_solid;
	gma->uxa->prepare_solid = gma_uxa_prepare_solid;
	gma->uxa->solid = gma_uxa_solid;
	gma->uxa->done_solid = gma_uxa_done_solid;

	/* Copy */
	gma->uxa->check_copy = gma_uxa_check_copy;
	gma->uxa->prepare_copy = gma_uxa_prepare_copy;
	gma->uxa->copy = gma_uxa_copy;
	gma->uxa->done_copy = gma_uxa_done_copy;

	/* Composite */
	gma->uxa->check_composite = gma_uxa_check_composite;

	screen->SetScreenPixmap = gma_uxa_set_screen_pixmap;
	screen->CreatePixmap = gma_uxa_create_pixmap;
	screen->DestroyPixmap = gma_uxa_destroy_pixmap;

	gma->cs_bo = gma_bo_create(gma->fd, 4096, GMA_BO_BLIT, 0);
	gma_bo_mmap(gma->fd, gma->cs_bo);

	if (!uxa_driver_init(screen, gma->uxa)) {
		xf86DrvMsg (scrn->scrnIndex, X_ERROR,
			    "UXA initialization failed\n");
		return FALSE;
	}

	return TRUE;
}
Beispiel #5
0
static Bool
ExaModifyPixmapHeader(PixmapPtr pPixmap, int width, int height,
		      int depth, int bitsPerPixel, int devKind,
		      pointer pPixData)
{
    ScreenPtr pScreen = pPixmap->drawable.pScreen;
    ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
    struct exa_pixmap_priv *priv = exaGetPixmapDriverPrivate(pPixmap);
    modesettingPtr ms = modesettingPTR(pScrn);
    struct exa_context *exa = ms->exa;

    if (!priv || pPixData)
	return FALSE;

    if (0) {
       debug_printf("%s pixmap %p sz %dx%dx%d devKind %d\n",
                    __FUNCTION__, pPixmap, width, height, bitsPerPixel, devKind);
       
       if (priv->tex)
          debug_printf("  ==> old texture %dx%d\n",
                       priv->tex->width0, 
                       priv->tex->height0);
    }


    if (depth <= 0)
	depth = pPixmap->drawable.depth;

    if (bitsPerPixel <= 0)
	bitsPerPixel = pPixmap->drawable.bitsPerPixel;

    if (width <= 0)
	width = pPixmap->drawable.width;

    if (height <= 0)
	height = pPixmap->drawable.height;

    if (width <= 0 || height <= 0 || depth <= 0)
	return FALSE;

    miModifyPixmapHeader(pPixmap, width, height, depth,
			     bitsPerPixel, devKind, NULL);

    priv->width = width;
    priv->height = height;

    /* Deal with screen resize */
    if ((exa->accel || priv->flags) &&
        (!priv->tex ||
         !size_match(width, priv->tex->width0) ||
         !size_match(height, priv->tex->height0) ||
         priv->tex_flags != priv->flags)) {
	struct pipe_resource *texture = NULL;
	struct pipe_resource template;

	memset(&template, 0, sizeof(template));
static void
AlpDone(PixmapPtr pPixmap)
{
    ScreenPtr pScreen = pPixmap->drawable.pScreen;
    ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
    CirPtr pCir = CIRPTR(pScrn);
#ifdef ALP_DEBUG
    ErrorF("AlpDone\n");
#endif
}
static Bool
can_sync_to_vblank(DrawablePtr draw)
{
	ScrnInfoPtr scrn = xf86ScreenToScrn(draw->pScreen);
	NVPtr pNv = NVPTR(scrn);

	return pNv->glx_vblank &&
		nv_window_belongs_to_crtc(scrn, draw->x, draw->y,
					  draw->width, draw->height);
}
Beispiel #8
0
/* Screen funcs */
static Bool
VGAarbiterCloseScreen(ScreenPtr pScreen)
{
    Bool val;
    ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
    VGAarbiterScreenPtr pScreenPriv =
        (VGAarbiterScreenPtr) dixLookupPrivate(&pScreen->devPrivates,
                                               VGAarbiterScreenKey);
    miPointerScreenPtr PointPriv =
        (miPointerScreenPtr) dixLookupPrivate(&pScreen->devPrivates,
                                              miPointerScreenKey);
    PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);

    UNWRAP_SCREEN(CreateGC);
    UNWRAP_SCREEN(CloseScreen);
    UNWRAP_SCREEN(GetImage);
    UNWRAP_SCREEN(GetSpans);
    UNWRAP_SCREEN(SourceValidate);
    UNWRAP_SCREEN(CopyWindow);
    UNWRAP_SCREEN(ClearToBackground);
    UNWRAP_SCREEN(SaveScreen);
    UNWRAP_SCREEN(StoreColors);
    UNWRAP_SCREEN(DisplayCursor);
    UNWRAP_SCREEN(RealizeCursor);
    UNWRAP_SCREEN(UnrealizeCursor);
    UNWRAP_SCREEN(RecolorCursor);
    UNWRAP_SCREEN(SetCursorPosition);
    UNWRAP_PICT(Composite);
    UNWRAP_PICT(Glyphs);
    UNWRAP_PICT(CompositeRects);
    UNWRAP_SCREEN_INFO(AdjustFrame);
    UNWRAP_SCREEN_INFO(SwitchMode);
    UNWRAP_SCREEN_INFO(EnterVT);
    UNWRAP_SCREEN_INFO(LeaveVT);
    UNWRAP_SCREEN_INFO(FreeScreen);
    UNWRAP_SPRITE;

    free((void *) pScreenPriv);
    xf86VGAarbiterLock(xf86ScreenToScrn(pScreen));
    val = (*pScreen->CloseScreen) (pScreen);
    xf86VGAarbiterUnlock(xf86ScreenToScrn(pScreen));
    return val;
}
Beispiel #9
0
static int TegraDRI2GetMSC(DrawablePtr drawable, CARD64 *ust, CARD64 *msc)
{
    ScrnInfoPtr pScrn = xf86ScreenToScrn(drawable->pScreen);
    int ret = 0;

    xf86DrvMsg(pScrn->scrnIndex, X_INFO, "> %s(drawable=%p, ust=%p, msc=%p)\n",
               __func__, drawable, ust, msc);
    xf86DrvMsg(pScrn->scrnIndex, X_INFO, "< %s() = %d\n", __func__, ret);
    return ret;
}
void
radeon_glamor_exchange_buffers(PixmapPtr src,
			       PixmapPtr dst)
{
	RADEONInfoPtr info = RADEONPTR(xf86ScreenToScrn(dst->drawable.pScreen));

	if (!info->use_glamor)
		return;
	glamor_egl_exchange_buffers(src, dst);
}
Beispiel #11
0
void
xf86RotateCloseScreen(ScreenPtr screen)
{
    ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
    xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
    int c;

    for (c = 0; c < xf86_config->num_crtc; c++)
        xf86RotateDestroy(xf86_config->crtc[c]);
}
Beispiel #12
0
/*
 * Flush our batch buffer when requested by the Present extension.
 */
static void
intel_present_flush(WindowPtr window)
{
	ScreenPtr                               screen = window->drawable.pScreen;
	ScrnInfoPtr                             scrn = xf86ScreenToScrn(screen);
	intel_screen_private                    *intel = intel_get_screen_private(scrn);

	if (intel->flush_rendering)
		intel->flush_rendering(intel);
}
void
nouveau_present_fini(ScreenPtr screen)
{
	ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
	NVPtr pNv = NVPTR(scrn);
	if (pNv->present) {
		free(pNv->present);
		pNv->present = NULL;
	}
}
Beispiel #14
0
static void
ExaCopy(PixmapPtr pDstPixmap, int srcX, int srcY, int dstX, int dstY,
	int width, int height)
{
   ScrnInfoPtr pScrn = xf86ScreenToScrn(pDstPixmap->drawable.pScreen);
   modesettingPtr ms = modesettingPTR(pScrn);
   struct exa_context *exa = ms->exa;
   struct pipe_box src_box;

   exa_debug_printf("\tExaCopy(srcx=%d, srcy=%d, dstX=%d, dstY=%d, w=%d, h=%d)\n",
                srcX, srcY, dstX, dstY, width, height);

   debug_assert(exaGetPixmapDriverPrivate(pDstPixmap) == exa->copy.dst);

   u_box_2d(srcX, srcY, width, height, &src_box);

   /* If source and destination overlap, we have to copy to/from a scratch
    * pixmap.
    */
   if (exa->copy.dst == exa->copy.src &&
       !((dstX + width) < srcX || dstX > (srcX + width) ||
	 (dstY + height) < srcY || dstY > (srcY + height))) {
      struct exa_pixmap_priv *tmp_priv;

      if (!exa->copy.tmp_pix) {
         exa->copy.tmp_pix = pScrn->pScreen->CreatePixmap(pScrn->pScreen,
                                                         pDstPixmap->drawable.width,
                                                         pDstPixmap->drawable.height,
                                                         pDstPixmap->drawable.depth,
                                                         pDstPixmap->drawable.width);
         exaMoveInPixmap(exa->copy.tmp_pix);
      }

      tmp_priv = exaGetPixmapDriverPrivate(exa->copy.tmp_pix);

      exa->pipe->resource_copy_region( exa->pipe,
                                       tmp_priv->tex,
                                       0,
                                       srcX, srcY, 0,
                                       exa->copy.src->tex,
                                       0, &src_box);
      exa->pipe->resource_copy_region( exa->pipe,
                                       exa->copy.dst->tex,
                                       0,
                                       dstX, dstY, 0,
                                       tmp_priv->tex,
                                       0, &src_box);
   } else
      exa->pipe->resource_copy_region( exa->pipe,
                                       exa->copy.dst->tex,
                                       0,
                                       dstX, dstY, 0,
                                       exa->copy.src->tex,
                                       0, &src_box);
}
static XF86VideoAdaptorPtr 
CHIPSSetupImageVideo(ScreenPtr pScreen)
{
    ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
    CHIPSPtr cPtr = CHIPSPTR(pScrn);
    XF86VideoAdaptorPtr adapt;
    CHIPSPortPrivPtr pPriv;

    if(!(adapt = calloc(1, sizeof(XF86VideoAdaptorRec) +
			   sizeof(CHIPSPortPrivRec) +
			   sizeof(DevUnion))))
	return NULL;

    adapt->type = XvWindowMask | XvInputMask | XvImageMask;
    adapt->flags = VIDEO_OVERLAID_IMAGES | VIDEO_CLIP_TO_VIEWPORT;
    adapt->name = "Chips and Technologies Backend Scaler";
    adapt->nEncodings = 1;
    adapt->pEncodings = DummyEncoding;
    adapt->nFormats = NUM_FORMATS;
    adapt->pFormats = Formats;
    adapt->nPorts = 1;
    adapt->pPortPrivates = (DevUnion*)(&adapt[1]);
    pPriv = (CHIPSPortPrivPtr)(&adapt->pPortPrivates[1]);
    adapt->pPortPrivates[0].ptr = (pointer)(pPriv);
    adapt->pAttributes = Attributes;
    adapt->nImages = NUM_IMAGES;
    adapt->nAttributes = NUM_ATTRIBUTES;
    adapt->pImages = Images;
    adapt->PutVideo = NULL;
    adapt->PutStill = NULL;
    adapt->GetVideo = NULL;
    adapt->GetStill = NULL;
    adapt->StopVideo = CHIPSStopVideo;
    adapt->SetPortAttribute = CHIPSSetPortAttribute;
    adapt->GetPortAttribute = CHIPSGetPortAttribute;
    adapt->QueryBestSize = CHIPSQueryBestSize;
    adapt->PutImage = CHIPSPutImage;
    adapt->QueryImageAttributes = CHIPSQueryImageAttributes;

    pPriv->colorKey = cPtr->videoKey;
    pPriv->videoStatus = 0;
    pPriv->manualDoubleBuffer = FALSE;
    pPriv->currentBuffer	= 0;

    /* gotta uninit this someplace */
    REGION_NULL(pScreen, &pPriv->clip);

    cPtr->adaptor = adapt;

    xvColorKey   = MAKE_ATOM("XV_COLORKEY");

    CHIPSResetVideo(pScrn);

    return adapt;
}
static Bool
nouveau_dri2_swap_limit_validate(DrawablePtr draw, int swap_limit)
{
	ScrnInfoPtr scrn = xf86ScreenToScrn(draw->pScreen);
	NVPtr pNv = NVPTR(scrn);

	if ((swap_limit < 1 ) || (swap_limit > pNv->max_swap_limit))
		return FALSE;

	return TRUE;
}
Beispiel #17
0
static void
radeon_glamor_add_traps(PicturePtr pPicture,
		    INT16 x_off, INT16 y_off, int ntrap, xTrap *traps)
{
	ScrnInfoPtr scrn = xf86ScreenToScrn(pPicture->pDrawable->pScreen);

	if (radeon_glamor_picture_prepare_access_cpu_rw(scrn, pPicture)) {
		fbAddTraps(pPicture, x_off, y_off, ntrap, traps);
		radeon_glamor_picture_finish_access_cpu(pPicture);
	}
}
static Bool
AlpPrepareSolid(PixmapPtr pPixmap, int alu, Pixel planemask, Pixel fg)
{
    ScreenPtr pScreen = pPixmap->drawable.pScreen;
    ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
    CirPtr pCir = CIRPTR(pScrn);
    AlpPtr pAlp = ALPPTR(pCir);
    int pitch = pCir->pitch;
    
#ifdef ALP_DEBUG
    ErrorF("AlpSetupForSolidFill color=%x alu=%x planemask=%x\n",
	   fg, alu, planemask);
#endif
    WAIT;
    
    SetupForRop(alu);
    
    switch (pCir -> Chipset) {
      case PCI_CHIP_GD7548:
	/* The GD7548 does not (apparently) support solid filling
	   directly, it always need an actual source.
	   We therefore use it as a pattern fill with a solid
	   pattern */
      {
	  int source = pAlp->monoPattern8x8;
	  /* source = 8x8 solid mono pattern */
	  outw(pCir->PIOReg, ((source << 8) & 0xff00) | 0x2C);
	  outw(pCir->PIOReg, ((source) & 0xff00) | 0x2D);
	  outw(pCir->PIOReg, ((source >> 8) & 0x3f00) | 0x2E);
	  /* memset() may not be the fastest */
	  memset((char *)pCir->FbBase + pAlp->monoPattern8x8, 0xFF, 8);
	  write_mem_barrier();
	  break;
      }
      default:
	/* GR33 = 0x04 => does not exist on GD7548 */
	outw(pCir->PIOReg, 0x0433);
    }
    
    /* GR30 = color expansion, pattern copy */
    /* Choses 8bpp / 16bpp color expansion */
    outw(pCir->PIOReg, 0xC030 |((pScrn->bitsPerPixel - 8) << 9));
    
    outw(pCir->PIOReg, ((fg << 8) & 0xff00) | 0x01);
    outw(pCir->PIOReg, ((fg) & 0xff00) | 0x11);
    outw(pCir->PIOReg, ((fg >> 8) & 0xff00) | 0x13);
    outw(pCir->PIOReg, 0x15);
    
    /* Set dest pitch */
    outw(pCir->PIOReg, ((pitch << 8) & 0xff00) | 0x24);
    outw(pCir->PIOReg, ((pitch) & 0x1f00) | 0x25);
    
    return TRUE;
}
static void
nouveau_dri2_flip_event_handler(unsigned int frame, unsigned int tv_sec,
				unsigned int tv_usec, void *event_data)
{
	struct nouveau_dri2_vblank_state *flip = event_data;
	DrawablePtr draw;
	ScreenPtr screen;
	ScrnInfoPtr scrn;
	int status;

	status = dixLookupDrawable(&draw, flip->draw, serverClient,
				   M_ANY, DixWriteAccess);
	if (status != Success) {
		free(flip);
		return;
	}

	screen = draw->pScreen;
	scrn = xf86ScreenToScrn(screen);

	/* We assume our flips arrive in order, so we don't check the frame */
	switch (flip->action) {
	case SWAP:
		/* Check for too small vblank count of pageflip completion,
		 * taking wraparound into account. This usually means some
		 * defective kms pageflip completion, causing wrong (msc, ust)
		 * return values and possible visual corruption.
		 * Skip test for frame == 0, as this is a valid constant value
		 * reported by all Linux kernels at least up to Linux 3.0.
		 */
		if ((frame != 0) &&
		    (frame < flip->frame) && (flip->frame - frame < 5)) {
			xf86DrvMsg(scrn->scrnIndex, X_WARNING,
				   "%s: Pageflip has impossible msc %d < target_msc %d\n",
				   __func__, frame, flip->frame);
			/* All-Zero values signal failure of (msc, ust)
			 * timestamping to client.
			 */
			frame = tv_sec = tv_usec = 0;
		}

		DRI2SwapComplete(flip->client, draw, frame, tv_sec, tv_usec,
				 DRI2_FLIP_COMPLETE, flip->func,
				 flip->data);
		break;
	default:
		xf86DrvMsg(scrn->scrnIndex, X_WARNING,
			   "%s: unknown vblank event received\n", __func__);
		/* Unknown type */
		break;
	}

	free(flip);
}
Beispiel #20
0
static Bool
viaUseHWCursorARGB(ScreenPtr pScreen, CursorPtr pCurs)
{
    ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
    VIAPtr pVia = VIAPTR(pScrn);

    return (pVia->hwcursor
            && pVia->CursorARGBSupported
            && pCurs->bits->width <= pVia->CursorMaxWidth
            && pCurs->bits->height <= pVia->CursorMaxHeight);
}
static void
nouveau_dri2_finish_swap(DrawablePtr draw, unsigned int frame,
			 unsigned int tv_sec, unsigned int tv_usec,
			 struct nouveau_dri2_vblank_state *s)
{
	ScrnInfoPtr scrn = xf86ScreenToScrn(draw->pScreen);
	NVPtr pNv = NVPTR(scrn);
	PixmapPtr dst_pix;
	PixmapPtr src_pix = nouveau_dri2_buffer(s->src)->ppix;
	struct nouveau_bo *dst_bo;
	struct nouveau_bo *src_bo = nouveau_pixmap_bo(src_pix);
	struct nouveau_pushbuf *push = pNv->pushbuf;
	RegionRec reg;
	int type, ret;
	Bool front_updated, will_exchange;
	xf86CrtcPtr ref_crtc;

	REGION_INIT(0, &reg, (&(BoxRec){ 0, 0, draw->width, draw->height }), 0);
	REGION_TRANSLATE(0, &reg, draw->x, draw->y);

	/* Main crtc for this drawable shall finally deliver pageflip event. */
	ref_crtc = nouveau_pick_best_crtc(scrn, FALSE, draw->x, draw->y,
                                      draw->width, draw->height);

	/* Update frontbuffer pixmap and name: Could have changed due to
	 * window (un)redirection as part of compositing.
	 */
	front_updated = update_front(draw, s->dst);

	/* Assign frontbuffer pixmap, after update in update_front() */
	dst_pix = nouveau_dri2_buffer(s->dst)->ppix;
	dst_bo = nouveau_pixmap_bo(dst_pix);

	/* Throttle on the previous frame before swapping */
	nouveau_bo_wait(dst_bo, NOUVEAU_BO_RD, push->client);

	/* Swap by buffer exchange possible? */
	will_exchange = front_updated && can_exchange(draw, dst_pix, src_pix);

	/* Only emit a wait for vblank pushbuf here if this is a copy-swap, or
	 * if it is a kms pageflip-swap on an old kernel. Pure exchange swaps
	 * don't need sync to vblank. kms pageflip-swaps on Linux 3.13+ are
	 * synced to vblank in the kms driver, so we must not sync here, or
	 * framerate will be cut in half!
	 */
	if (can_sync_to_vblank(draw) &&
		(!will_exchange ||
		(!pNv->has_async_pageflip && nouveau_exa_pixmap_is_onscreen(dst_pix)))) {
		/* Reference the back buffer to sync it to vblank */
		nouveau_pushbuf_refn(push, &(struct nouveau_pushbuf_refn) {
					   src_bo,
					   NOUVEAU_BO_VRAM | NOUVEAU_BO_RD
				     }, 1);
Bool
radeon_glamor_create_textured_pixmap(PixmapPtr pixmap, struct radeon_pixmap *priv)
{
	ScrnInfoPtr scrn = xf86ScreenToScrn(pixmap->drawable.pScreen);
	RADEONInfoPtr info = RADEONPTR(scrn);

	if ((info->use_glamor) == 0)
		return TRUE;

	return glamor_egl_create_textured_pixmap(pixmap, priv->bo->handle,
						 pixmap->devKind);
}
Beispiel #23
0
static int TegraDRI2ScheduleWaitMSC(ClientPtr client, DrawablePtr drawable,
                                    CARD64 msc, CARD64 divisor,
                                    CARD64 remainder)
{
    ScrnInfoPtr pScrn = xf86ScreenToScrn(drawable->pScreen);
    int ret = 0;

    xf86DrvMsg(pScrn->scrnIndex, X_INFO, "> %s(client=%p, drawable=%p, msc=%" PRIu64 ", divisor=%" PRIu64 ", remainder=%" PRIu64")\n",
               __func__, client, drawable, msc, divisor, remainder);
    xf86DrvMsg(pScrn->scrnIndex, X_INFO, "< %s() = %d\n", __func__, ret);
    return ret;
}
Beispiel #24
0
/*
 * Flush our batch buffer when requested by the Present extension.
 */
static void
ms_present_flush(WindowPtr window)
{
#ifdef GLAMOR
    ScreenPtr screen = window->drawable.pScreen;
    ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
    modesettingPtr ms = modesettingPTR(scrn);

    if (ms->drmmode.glamor)
        glamor_block_handler(screen);
#endif
}
static void
AlpCopy(PixmapPtr pDstPixmap, int srcX, int srcY, int dstX, int dstY, 
	int width, int height)
{
    ScreenPtr pScreen = pDstPixmap->drawable.pScreen;
    ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
    CirPtr pCir = CIRPTR(pScrn);
    int source, dest;
    int  hh, ww;
    int decrement = 0;
    int pitch = pCir->pitch;
    
    ww = (width * pScrn->bitsPerPixel / 8) - 1;
    hh = height - 1;
    dest = dstY * pitch + dstX * pScrn->bitsPerPixel / 8;
    source = srcY * pitch + srcX * pScrn->bitsPerPixel / 8;
    if (dest > source) {
	decrement = 1 << 8;
	dest += hh * pitch + ww;
	source += hh * pitch + ww;
    }
    
    WAIT;
    
    outw(pCir->PIOReg, decrement | 0x30);
    
    /* Width */
    outw(pCir->PIOReg, ((ww << 8) & 0xff00) | 0x20);
    outw(pCir->PIOReg, ((ww) & 0x1f00) | 0x21);
    /* Height */
    outw(pCir->PIOReg, ((hh << 8) & 0xff00) | 0x22);
    outw(pCir->PIOReg, ((hh) & 0x0700) | 0x23);
    
    
    /* source */
    outw(pCir->PIOReg, ((source << 8) & 0xff00) | 0x2C);
    outw(pCir->PIOReg, ((source) & 0xff00) | 0x2D);
    outw(pCir->PIOReg, ((source >> 8) & 0x3f00)| 0x2E);
    
    /* dest */
    outw(pCir->PIOReg, ((dest  << 8) & 0xff00) | 0x28);
    outw(pCir->PIOReg, ((dest) & 0xff00) | 0x29);
    outw(pCir->PIOReg, ((dest >> 8) & 0x3f00) | 0x2A);
    if (!pCir->chip.alp->autoStart)
	outw(pCir->PIOReg, 0x0231);
    
#ifdef ALP_DEBUG
    ErrorF("AlpCopy x1=%d y1=%d x2=%d y2=%d w=%d h=%d\n",
	   srcX, srcY, dstX, dstY, width, height);
    ErrorF("AlpSCopy s=%d d=%d ww=%d hh=%d\n",
	   source, dest, ww, hh);
#endif
}
static Bool
TegraCreateScreenResources(ScreenPtr pScreen)
{
    ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
    TegraPtr tegra = TegraPTR(pScrn);
    PixmapPtr rootPixmap;
    Bool ret;
    void *pixels;

    pScreen->CreateScreenResources = tegra->createScreenResources;
    ret = pScreen->CreateScreenResources(pScreen);
    pScreen->CreateScreenResources = TegraCreateScreenResources;

    if (!drmmode_set_desired_modes(pScrn, &tegra->drmmode))
      return FALSE;

    drmmode_uevent_init(pScrn, &tegra->drmmode);

    if (!tegra->drmmode.want_sw_cursor)
        drmmode_map_cursor_bos(pScrn, &tegra->drmmode);

    pixels = drmmode_map_front_bo(&tegra->drmmode);
    if (!pixels)
        return FALSE;

    rootPixmap = pScreen->GetScreenPixmap(pScreen);

    if (tegra->drmmode.shadow_enable)
        pixels = tegra->drmmode.shadow_fb;

    if (!pScreen->ModifyPixmapHeader(rootPixmap, -1, -1, -1, -1, -1, pixels))
        FatalError("Couldn't adjust screen pixmap\n");

    if (tegra->drmmode.shadow_enable) {
        if (!shadowAdd(pScreen, rootPixmap, shadowUpdatePackedWeak(),
                       TegraShadowWindow, 0, 0))
            return FALSE;
    }

    tegra->damage = DamageCreate(NULL, NULL, DamageReportNone, TRUE, pScreen,
                                 rootPixmap);
    if (tegra->damage) {
        DamageRegister(&rootPixmap->drawable, tegra->damage);
        tegra->dirty_enabled = TRUE;
        xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Damage tracking initialized\n");
    } else {
        xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
                   "Failed to create screen damage record\n");
        return FALSE;
    }

    return ret;
}
Beispiel #27
0
static PixmapPtr intel_dri3_pixmap_from_fd(ScreenPtr screen,
					   int fd,
					   CARD16 width,
					   CARD16 height,
					   CARD16 stride,
					   CARD8 depth,
					   CARD8 bpp)
{
	ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
	intel_screen_private *intel = intel_get_screen_private(scrn);
	struct intel_uxa_pixmap *priv;
	PixmapPtr pixmap;
	dri_bo *bo;

	if (depth < 8)
		return NULL;

	switch (bpp) {
	case 8:
	case 16:
	case 32:
		break;
	default:
		return NULL;
	}

	pixmap = fbCreatePixmap(screen, 0, 0, depth, 0);
	if (!pixmap)
		return NULL;

	if (!screen->ModifyPixmapHeader(pixmap, width, height, 0, 0, stride, NULL))
		goto free_pixmap;

	bo = drm_intel_bo_gem_create_from_prime(intel->bufmgr,
						fd, (uint32_t)height * stride);
	if (bo == NULL)
		goto free_pixmap;

	intel_uxa_set_pixmap_bo(pixmap, bo);
	dri_bo_unreference(bo);

	priv = intel_uxa_get_pixmap_private(pixmap);
	if (priv == NULL)
		goto free_pixmap;

	priv->pinned |= PIN_DRI3;

	return pixmap;

free_pixmap:
	fbDestroyPixmap(pixmap);
	return NULL;
}
static Bool
nouveau_present_flip_check(RRCrtcPtr rrcrtc, WindowPtr window,
			   PixmapPtr pixmap, Bool sync_flip)
{
	ScrnInfoPtr scrn = xf86ScreenToScrn(window->drawable.pScreen);
	xf86CrtcPtr crtc = rrcrtc->devPrivate;

	if (!scrn->vtSema || !crtc->enabled)
		return FALSE;

	return TRUE;
}
Beispiel #29
0
void
xf86RotateCloseScreen(ScreenPtr screen)
{
    ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
    xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
    int c;

    /* This has already been destroyed when the root window was destroyed */
    xf86_config->rotation_damage = NULL;
    for (c = 0; c < xf86_config->num_crtc; c++)
        xf86RotateDestroy(xf86_config->crtc[c]);
}
static void
AlpSync(ScreenPtr pScreen, int marker)
{
    ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
    CirPtr pCir = CIRPTR(pScrn);

#ifdef ALP_DEBUG
    ErrorF("AlpSync\n");
#endif
    WAIT_1;
    return;
}