예제 #1
0
void radeon_lock_hardware(radeonContextPtr radeon
#ifndef NDEBUG
		,const char* function
		,const char* file
		,const int line
#endif
		)
{
	char ret = 0;
	struct radeon_framebuffer *rfb = NULL;
	struct radeon_renderbuffer *rrb = NULL;

	if (radeon_get_drawable(radeon)) {
		rfb = radeon_get_drawable(radeon)->driverPrivate;

		if (rfb)
			rrb = radeon_get_renderbuffer(&rfb->base,
						      rfb->base._ColorDrawBufferIndexes[0]);
	}

	if (!radeon->radeonScreen->driScreen->dri2.enabled) {
		if (ATOMIC_INC_AND_FETCH(radeon->dri.hwLockCount) > 1)
		{
#ifndef NDEBUG
			if ( RADEON_DEBUG & RADEON_SANITY )
				fprintf(stderr, "*** %d times of recursive call to %s ***\n"
						"Original call was from %s (file: %s line: %d)\n"
						"Now call is coming from %s (file: %s line: %d)\n"
						, radeon->dri.hwLockCount, __FUNCTION__
						, ldebug.function, ldebug.file, ldebug.line
						, function, file, line
					   );
#endif
			return;
		}
		DRM_CAS(radeon->dri.hwLock, radeon->dri.hwContext,
			 (DRM_LOCK_HELD | radeon->dri.hwContext), ret );
		if (ret)
			radeonGetLock(radeon, 0);
#ifndef NDEBUG
		ldebug.function = function;
		ldebug.file = file;
		ldebug.line = line;
#endif
	}
}
예제 #2
0
static void radeon_cleanup_renderbuffers(struct radeon_framebuffer *rfb)
{
	struct radeon_renderbuffer *rb;

	rb = rfb->color_rb[0];
	if (rb && rb->bo) {
		radeon_bo_unref(rb->bo);
		rb->bo = NULL;
	}
	rb = rfb->color_rb[1];
	if (rb && rb->bo) {
		radeon_bo_unref(rb->bo);
		rb->bo = NULL;
	}
	rb = radeon_get_renderbuffer(&rfb->base, BUFFER_DEPTH);
	if (rb && rb->bo) {
		radeon_bo_unref(rb->bo);
		rb->bo = NULL;
	}
}