mirror of
				https://github.com/tiagovignatti/intel-gpu-tools.git
				synced 2025-11-04 12:07:12 +00:00 
			
		
		
		
	lib: helper to convert gem_hanlde to drm_intel_bo
This commit is contained in:
		
							parent
							
								
									9d1a3587ac
								
							
						
					
					
						commit
						df7edaab90
					
				@ -45,6 +45,23 @@
 | 
			
		||||
/* This file contains a bunch of wrapper functions to directly use gem ioctls.
 | 
			
		||||
 * Mostly useful to write kernel tests. */
 | 
			
		||||
 | 
			
		||||
drm_intel_bo *
 | 
			
		||||
gem_handle_to_libdrm_bo(drm_intel_bufmgr *bufmgr, int fd, const char *name, uint32_t handle)
 | 
			
		||||
{
 | 
			
		||||
	struct drm_gem_flink flink;
 | 
			
		||||
	int ret;
 | 
			
		||||
	drm_intel_bo *bo;
 | 
			
		||||
 | 
			
		||||
	flink.handle = handle;
 | 
			
		||||
	ret = ioctl(fd, DRM_IOCTL_GEM_FLINK, &flink);
 | 
			
		||||
	assert(ret == 0);
 | 
			
		||||
 | 
			
		||||
	bo = drm_intel_bo_gem_create_from_name(bufmgr, name, flink.name);
 | 
			
		||||
	assert(bo);
 | 
			
		||||
 | 
			
		||||
	return bo;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int
 | 
			
		||||
is_intel(int fd)
 | 
			
		||||
{
 | 
			
		||||
@ -768,7 +785,6 @@ unsigned int kmstest_create_fb(int fd, int width, int height, int bpp,
 | 
			
		||||
	cairo_status_t status;
 | 
			
		||||
	cairo_t *cr;
 | 
			
		||||
	char buf[128];
 | 
			
		||||
	int ret;
 | 
			
		||||
	unsigned int fb_id;
 | 
			
		||||
 | 
			
		||||
	surface = paint_allocate_surface(fd, width, height, depth, bpp,
 | 
			
		||||
 | 
			
		||||
@ -37,6 +37,9 @@
 | 
			
		||||
#include "xf86drmMode.h"
 | 
			
		||||
#include "intel_batchbuffer.h"
 | 
			
		||||
 | 
			
		||||
drm_intel_bo * gem_handle_to_libdrm_bo(drm_intel_bufmgr *bufmgr, int fd,
 | 
			
		||||
				       const char *name, uint32_t handle);
 | 
			
		||||
 | 
			
		||||
int drm_get_card(int master);
 | 
			
		||||
int drm_open_any(void);
 | 
			
		||||
int drm_open_any_master(void);
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user