Correct a pointless longstanding difference in ioctl numbering between

linux and add back struct members.

Avoids diffs in inteldrm, libdrm and Mesa >= 17.2.

ok kettenis@
This commit is contained in:
jsg 2018-02-28 00:45:06 +00:00
parent 5397eac377
commit 4a71c37370
2 changed files with 1 additions and 37 deletions

View File

@ -240,19 +240,12 @@ typedef struct _drm_i915_sarea {
#define DRM_I915_GEM_SET_TILING 0x21
#define DRM_I915_GEM_GET_TILING 0x22
#define DRM_I915_GEM_GET_APERTURE 0x23
#ifdef __OpenBSD__
#define DRM_I915_GEM_EXECBUFFER2 0x24
#define DRM_I915_GEM_MADVISE 0x25
#define DRM_I915_GEM_MMAP_GTT 0x26
#define DRM_I915_GET_PIPE_FROM_CRTC_ID 0x29
#else
#define DRM_I915_GEM_MMAP_GTT 0x24
#define DRM_I915_GET_PIPE_FROM_CRTC_ID 0x25
#define DRM_I915_GEM_MADVISE 0x26
#define DRM_I915_GEM_EXECBUFFER2 0x29
#endif
#define DRM_I915_OVERLAY_PUT_IMAGE 0x27
#define DRM_I915_OVERLAY_ATTRS 0x28
#define DRM_I915_GEM_EXECBUFFER2 0x29
#define DRM_I915_GEM_EXECBUFFER2_WR DRM_I915_GEM_EXECBUFFER2
#define DRM_I915_GET_SPRITE_COLORKEY 0x2a
#define DRM_I915_SET_SPRITE_COLORKEY 0x2b
@ -675,7 +668,6 @@ struct drm_i915_gem_relocation_entry {
#define I915_GEM_DOMAIN_GTT 0x00000040
/** @} */
#ifndef __OpenBSD__
struct drm_i915_gem_exec_object {
/**
* User's handle for a buffer to be bound into the GTT for this
@ -725,7 +717,6 @@ struct drm_i915_gem_execbuffer {
/** This is a struct drm_clip_rect *cliprects */
__u64 cliprects_ptr;
};
#endif
struct drm_i915_gem_exec_object2 {
/**
@ -804,13 +795,11 @@ struct drm_i915_gem_execbuffer2 {
__u32 batch_start_offset;
/** Bytes used in batchbuffer from batch_start_offset */
__u32 batch_len;
#ifndef __OpenBSD__
__u32 DR1;
__u32 DR4;
__u32 num_cliprects;
/** This is a struct drm_clip_rect *cliprects */
__u64 cliprects_ptr;
#endif
#define I915_EXEC_RING_MASK (7<<0)
#define I915_EXEC_DEFAULT (0<<0)
#define I915_EXEC_RENDER (1<<0)

View File

@ -118,9 +118,7 @@ typedef struct _drm_intel_bufmgr_gem {
pthread_mutex_t lock;
#ifndef __OpenBSD__
struct drm_i915_gem_exec_object *exec_objects;
#endif
struct drm_i915_gem_exec_object2 *exec2_objects;
drm_intel_bo **exec_bos;
int exec_size;
@ -477,7 +475,6 @@ drm_intel_gem_bo_reference(drm_intel_bo *bo)
atomic_inc(&bo_gem->refcount);
}
#ifndef __OpenBSD__
/**
* Adds the given buffer to the list of buffers to be validated (moved into the
* appropriate memory type) with the next batch submission.
@ -523,7 +520,6 @@ drm_intel_add_validate_buffer(drm_intel_bo *bo)
bufmgr_gem->exec_bos[index] = bo;
bufmgr_gem->exec_count++;
}
#endif
static void
drm_intel_add_validate_buffer2(drm_intel_bo *bo, int need_fence)
@ -1910,9 +1906,7 @@ drm_intel_bufmgr_gem_destroy(drm_intel_bufmgr *bufmgr)
int i, ret;
free(bufmgr_gem->exec2_objects);
#ifndef __OpenBSD__
free(bufmgr_gem->exec_objects);
#endif
free(bufmgr_gem->exec_bos);
pthread_mutex_destroy(&bufmgr_gem->lock);
@ -2166,7 +2160,6 @@ drm_intel_gem_bo_clear_relocs(drm_intel_bo *bo, int start)
}
#ifndef __OpenBSD__
/**
* Walk the tree of relocations rooted at BO and accumulate the list of
* validations to be performed and update the relocation buffers with
@ -2196,7 +2189,6 @@ drm_intel_gem_bo_process_reloc(drm_intel_bo *bo)
drm_intel_add_validate_buffer(target_bo);
}
}
#endif
static void
drm_intel_gem_bo_process_reloc2(drm_intel_bo *bo)
@ -2239,7 +2231,6 @@ drm_intel_gem_bo_process_reloc2(drm_intel_bo *bo)
}
#ifndef __OpenBSD__
static void
drm_intel_update_buffer_offsets(drm_intel_bufmgr_gem *bufmgr_gem)
{
@ -2262,7 +2253,6 @@ drm_intel_update_buffer_offsets(drm_intel_bufmgr_gem *bufmgr_gem)
}
}
}
#endif
static void
drm_intel_update_buffer_offsets2 (drm_intel_bufmgr_gem *bufmgr_gem)
@ -2299,7 +2289,6 @@ drm_intel_gem_bo_aub_dump_bmp(drm_intel_bo *bo,
{
}
#ifndef __OpenBSD__
static int
drm_intel_gem_bo_exec(drm_intel_bo *bo, int used,
drm_clip_rect_t * cliprects, int num_cliprects, int DR4)
@ -2366,7 +2355,6 @@ drm_intel_gem_bo_exec(drm_intel_bo *bo, int used,
return ret;
}
#endif
static int
do_exec2(drm_intel_bo *bo, int used, drm_intel_context *ctx,
@ -2416,12 +2404,10 @@ do_exec2(drm_intel_bo *bo, int used, drm_intel_context *ctx,
execbuf.buffer_count = bufmgr_gem->exec_count;
execbuf.batch_start_offset = 0;
execbuf.batch_len = used;
#ifndef __OpenBSD__
execbuf.cliprects_ptr = (uintptr_t)cliprects;
execbuf.num_cliprects = num_cliprects;
execbuf.DR1 = 0;
execbuf.DR4 = DR4;
#endif
execbuf.flags = flags;
if (ctx == NULL)
i915_execbuffer2_set_context_id(execbuf, 0);
@ -3620,9 +3606,7 @@ drm_intel_bufmgr_gem_init(int fd, int batch_size)
struct drm_i915_gem_get_aperture aperture;
drm_i915_getparam_t gp;
int ret, tmp;
#ifndef __OpenBSD__
bool exec2 = false;
#endif
pthread_mutex_lock(&bufmgr_list_mutex);
@ -3698,12 +3682,10 @@ drm_intel_bufmgr_gem_init(int fd, int batch_size)
memclear(gp);
gp.value = &tmp;
#ifndef __OpenBSD__
gp.param = I915_PARAM_HAS_EXECBUF2;
ret = drmIoctl(bufmgr_gem->fd, DRM_IOCTL_I915_GETPARAM, &gp);
if (!ret)
exec2 = true;
#endif
gp.param = I915_PARAM_HAS_BSD;
ret = drmIoctl(bufmgr_gem->fd, DRM_IOCTL_I915_GETPARAM, &gp);
@ -3806,19 +3788,12 @@ drm_intel_bufmgr_gem_init(int fd, int batch_size)
bufmgr_gem->bufmgr.bo_get_tiling = drm_intel_gem_bo_get_tiling;
bufmgr_gem->bufmgr.bo_set_tiling = drm_intel_gem_bo_set_tiling;
bufmgr_gem->bufmgr.bo_flink = drm_intel_gem_bo_flink;
#ifndef __OpenBSD__
/*
* Only the new one is available on OpenBSD
*/
/* Use the new one if available */
if (exec2) {
#endif
bufmgr_gem->bufmgr.bo_exec = drm_intel_gem_bo_exec2;
bufmgr_gem->bufmgr.bo_mrb_exec = drm_intel_gem_bo_mrb_exec2;
#ifndef __OpenBSD__
} else
bufmgr_gem->bufmgr.bo_exec = drm_intel_gem_bo_exec;
#endif
bufmgr_gem->bufmgr.bo_busy = drm_intel_gem_bo_busy;
bufmgr_gem->bufmgr.bo_madvise = drm_intel_gem_bo_madvise;
bufmgr_gem->bufmgr.destroy = drm_intel_bufmgr_gem_unref;