示例#1
0
static inline void
exchangebufs(DrawablePtr pDraw, DRI2BufferPtr a, DRI2BufferPtr b)
{
	struct ARMSOCDRI2BufferRec *aa = ARMSOCBUF(a);
	struct ARMSOCDRI2BufferRec *bb = ARMSOCBUF(b);

	exchange(a->name, b->name);
	exchange(aa->bo, bb->bo);
}
static inline DrawablePtr
dri2draw(DrawablePtr pDraw, DRI2BufferPtr buf)
{
	if (buf->attachment == DRI2BufferFrontLeft)
		return pDraw;
	else {
		const unsigned curPix = ARMSOCBUF(buf)->currentPixmap;
		return &(ARMSOCBUF(buf)->pPixmaps[curPix]->drawable);
	}
}
static void
ARMSOCDRI2ReferenceBuffer(DRI2BufferPtr buffer)
{
	struct ARMSOCDRI2BufferRec *buf = ARMSOCBUF(buffer);

	buf->refcnt++;
}
/**
 * Destroy Buffer
 */
static void
ARMSOCDRI2DestroyBuffer(DrawablePtr pDraw, DRI2BufferPtr buffer)
{
	struct ARMSOCDRI2BufferRec *buf = ARMSOCBUF(buffer);
	ScreenPtr pScreen;
	ScrnInfoPtr pScrn;
	/* Note: pDraw may already be deleted, so use the pPixmap here
	 * instead (since it is at least refcntd)
	 */
	if (NULL == buf->pPixmaps || NULL == buf->pPixmaps[0]) {
		if (--buf->refcnt == 0)
			free(buf);
		return;
	}

	pScreen = buf->pPixmaps[0]->drawable.pScreen;
	pScrn = xf86ScreenToScrn(pScreen);

	DEBUG_MSG("pDraw=%p, DRIbuffer=%p", pDraw, buffer);

	if (destroy_buffer(pDraw, buf)) {
		free(buf->pPixmaps);
		free(buf);
	}
}
示例#5
0
static void
ARMSOCDRI2CopyRegion(DrawablePtr pDraw, RegionPtr pRegion,
		DRI2BufferPtr pDstBuffer, DRI2BufferPtr pSrcBuffer)
{
	ScreenPtr pScreen = pDraw->pScreen;
	ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
	RegionPtr pCopyClip;
	GCPtr pGC;
        PixmapPtr pScratchPixmap;
        struct ARMSOCDRI2BufferRec *src = ARMSOCBUF(pSrcBuffer);

	DEBUG_MSG("pDraw=%p, pDstBuffer=%p pSrcBuffer=%p",
			pDraw, pDstBuffer, pSrcBuffer);

	pGC = GetScratchGC(pDraw->depth, pScreen);
	if (!pGC)
		return;

	pCopyClip = REGION_CREATE(pScreen, NULL, 0);
	RegionCopy(pCopyClip, pRegion);
	(*pGC->funcs->ChangeClip) (pGC, CT_REGION, pCopyClip, 0);
	ValidateGC(pDraw, pGC);

	/* If the dst is the framebuffer, and we had a way to
	 * schedule a deferred blit synchronized w/ vsync, that
	 * would be a nice thing to do utilize here to avoid
	 * tearing..  when we have sync object support for GEM
	 * buffers, I think we could do something more clever
	 * here.
	 */

        pScratchPixmap = GetScratchPixmapHeader(pScreen,
		armsoc_bo_width(src->bo), armsoc_bo_height(src->bo),
		armsoc_bo_depth(src->bo), armsoc_bo_bpp(src->bo),
		armsoc_bo_pitch(src->bo), armsoc_bo_map(src->bo));
		

	pGC->ops->CopyArea((DrawablePtr) pScratchPixmap, pDraw, pGC,
			0, 0, pDraw->width, pDraw->height, 0, 0);
	FreeScratchPixmapHeader(pScratchPixmap);
	FreeScratchGC(pGC);
}
示例#6
0
/**
 * Destroy Buffer
 */
static void
ARMSOCDRI2DestroyBuffer(DrawablePtr pDraw, DRI2BufferPtr buffer)
{
	struct ARMSOCDRI2BufferRec *buf = ARMSOCBUF(buffer);
	struct armsoc_bo *bo;

	if (--buf->refcnt > 0)
		return;

	bo = buf->bo;
	if (pDraw->type == DRAWABLE_PIXMAP && armsoc_bo_refcnt(bo) == 1) {
		/* We're about to destroy the bo behind a migrated pixmap.
		 * Restore original devKind/devPrivate.ptr.
		 */
		PixmapPtr pPixmap = (PixmapPtr) pDraw;
		armsoc_bo_get_backup(bo, &pPixmap->devKind, &pPixmap->devPrivate.ptr);
	}

	armsoc_bo_unreference(bo);
	free(buf);
}