Example #1
0
bool VMware::DrawLine(SrvBitmap* pcBitmap, const os::IRect& cClipRect,
	const os::IPoint& cPnt1, const os::IPoint& cPnt2,
	const os::Color32_s& sColor, int nMode)
{
	if(!pcBitmap->m_bVideoMem)
	{
		/* Off-screen */
		return DisplayDriver::DrawLine(pcBitmap, cClipRect, cPnt1, cPnt2,
										sColor, nMode);
	}

	int x1 = cPnt1.x;
	int y1 = cPnt1.y;
	int x2 = cPnt2.x;
	int y2 = cPnt2.y;
	int dstX, dstY;
	int width, height;

	if(!DisplayDriver::ClipLine(cClipRect, &x1, &y1, &x2, &y2))
	{
		return false;
	}

	if(x1 < x2)
	{
		dstX = x1;
		width = x2 - x1 + 1;
	}
	else
	{
		dstX = x2;
		width = x1 - x2 + 1;
	}

	if(y1 < y2)
	{
		dstY = y1;
		height = y2 - y1 + 1;
	}
	else
	{
		dstY = y2;
		height = y1 - y2 + 1;
	}


	// ACQUIRE lock
	m_cGELock.Lock();

	if(m_bFifoCmds)
		FifoSync();

	DisplayDriver::DrawLine(pcBitmap, cClipRect, cPnt1, cPnt2, sColor, nMode);
	Fifo_UpdateRect(dstX, dstY, width, height);

	// RELEASE lock
	m_cGELock.Unlock();
	return true;
}
Example #2
0
bool VMware::BltBitmap(SrvBitmap *pcDstBitmap, SrvBitmap *pcSrcBitmap,
	IRect cSrcRect, IRect cDstRect, int nMode, int nAlpha)
{
	if(((!pcDstBitmap->m_bVideoMem) && (!pcSrcBitmap->m_bVideoMem)) || nMode != DM_COPY || cSrcRect.Size() != cDstRect.Size())
	{
		// Off-screen to off-screen
		return DisplayDriver::BltBitmap(pcDstBitmap, pcSrcBitmap, cSrcRect,
										cDstRect, nMode, nAlpha);
	}

	IPoint cDstPos = cDstRect.LeftTop();
	int srcX = cSrcRect.left;
	int srcY = cSrcRect.top;
	int dstX = cDstPos.x;
	int dstY = cDstPos.y;
	int width = cSrcRect.Width() + 1;
	int height = cSrcRect.Height() + 1;

	bool accelDmCopy = false;
	if((pcDstBitmap->m_bVideoMem) && (pcSrcBitmap->m_bVideoMem))
	{
		if(nMode == DM_COPY)
			accelDmCopy = m_regCapabilities & SVGA_CAP_RECT_COPY;
		else if(nMode == DM_OVER)
			dbprintf("VMware::BltBitmap() - Screen to screen DM_OVER\n");
		else if(nMode == DM_BLEND)
			dbprintf("VMware::BltBitmap() - Screen to screen DM_BLEND\n");
		else
			dbprintf("VMware::BltBitmap() - Unknown nMode = %d\n", nMode);
	}

	// ACQUIRE lock
	m_cGELock.Lock();

	if(accelDmCopy)
	{
		// Accelerated screen to screen DM_COPY
		Fifo_RectCopy(srcX, srcY, dstX, dstY, width, height);
		m_bFifoCmds = true;
	}
	else
	{
		if(m_bFifoCmds)
			FifoSync();

		DisplayDriver::BltBitmap(pcDstBitmap, pcSrcBitmap, cSrcRect,
									cDstRect, nMode, nAlpha);

		if(pcDstBitmap->m_bVideoMem)
			Fifo_UpdateRect(dstX, dstY, width, height);
	}

	// RELEASE lock
	m_cGELock.Unlock();
	return true;
}
Example #3
0
File: Fifo.c Project: DonCN/haiku
void
FifoWrite(uint32 value)
{
	uint32 *fifo = gSi->fifo;
	uint32 fifoCapacity = fifo[SVGA_FIFO_MAX] - fifo[SVGA_FIFO_MIN];

	/* If the fifo is full, sync it */
	if (fifo[SVGA_FIFO_STOP] == fifo[SVGA_FIFO_NEXT_CMD] + 4 ||
		fifo[SVGA_FIFO_STOP] + fifoCapacity == fifo[SVGA_FIFO_NEXT_CMD] + 4)
		FifoSync();

	fifo[gSi->fifoNext / 4] = value;
	gSi->fifoNext = fifo[SVGA_FIFO_MIN] +
		(gSi->fifoNext + 4 - fifo[SVGA_FIFO_MIN]) % fifoCapacity;
}
Example #4
0
void VMware::UnlockBitmap( SrvBitmap* pcDstBitmap, SrvBitmap* pcSrcBitmap, os::IRect cSrc, os::IRect cDst )
{
	if( pcDstBitmap->m_bVideoMem == false )
		return;
		
	// ACQUIRE lock
	m_cGELock.Lock();

	if(m_bFifoCmds)
		FifoSync();
	
	Fifo_UpdateRect(cDst.left, cDst.top, cDst.Width()+1,
					cDst.Height()+1);
		
	// RELEASE lock
	m_cGELock.Unlock();
}
Example #5
0
bool VMware::FillRect(SrvBitmap *pcBitmap, const IRect& cRect,
	const Color32_s& sColor, int nMode)
{
	if(!pcBitmap->m_bVideoMem || nMode != DM_COPY)
	{
		/* Off-screen */
		return DisplayDriver::FillRect(pcBitmap, cRect, sColor, nMode);
	}

	int dstX = cRect.left;
	int dstY = cRect.top;
	int width = cRect.Width() + 1;
	int height = cRect.Height() + 1;
	int nColor;

	if (pcBitmap->m_eColorSpc == CS_RGB32)
		nColor = COL_TO_RGB32(sColor);
	else
		nColor = COL_TO_RGB16(sColor);

	bool accelOp = false;
	// accelOp = m_regCapabilities & SVGA_CAP_RECT_FILL;

	// ACQUIRE lock
	m_cGELock.Lock();

	if(accelOp)
	{
		/* Accelerated on-screen RectFill */
		Fifo_RectFill(dstX, dstY, width, height, nColor);
		m_bFifoCmds = true;
	}
	else
	{
		if(m_bFifoCmds)
			FifoSync();

		DisplayDriver::FillRect(pcBitmap, cRect, sColor, nMode);
		Fifo_UpdateRect(dstX, dstY, width, height);
	}

	// RELEASE lock
	m_cGELock.Unlock();
	return true;
}
void
SCREEN_TO_SCREEN_BLIT(engine_token *et, blit_params *list, uint32 count)
{
	uint32 i;
	blit_params *b;

	FifoBeginWrite();
	for (i = 0; i < count; i++) {
		b = &list[i];
#if 0
		TRACE("BLIT %dx%d, %dx%d->%dx%d\n", b->width + 1, b->height + 1,
			b->src_left, b->src_top, b->dest_left, b->dest_top);
#endif
		FifoWrite(SVGA_CMD_RECT_COPY);
		FifoWrite(b->src_left);
		FifoWrite(b->src_top);
		FifoWrite(b->dest_left);
		FifoWrite(b->dest_top);
		FifoWrite(b->width + 1);
		FifoWrite(b->height + 1);
	}
	FifoEndWrite();
	FifoSync();
}
Example #7
0
void
WAIT_ENGINE_IDLE()
{
	FifoSync();
}