From 2b7453f47862b0ae8032ba269b40830a34a6fb43 Mon Sep 17 00:00:00 2001 From: Rob Clark Date: Tue, 21 Mar 2017 10:01:02 -0400 Subject: freedreno: fix potential use-after-free on a5xx+ Something that valgrind spotted: ==8441== Invalid read of size 4 ==8441== at 0x5DEE168: msm_ringbuffer_emit_reloc (msm_ringbuffer.c:506) ==8441== by 0x5B48F0F: OUT_RELOCW (freedreno_util.h:241) ==8441== by 0x5B48F0F: fd5_emit_blit (fd5_emit.h:131) ==8441== by 0x5B48F0F: emit_gmem2mem_surf.isra.12 (fd5_gmem.c:450) ==8441== by 0x5B4910F: fd5_emit_tile_gmem2mem (fd5_gmem.c:477) ==8441== by 0x5B14943: render_tiles (freedreno_gmem.c:342) ==8441== by 0x5B14943: fd_gmem_render_tiles (freedreno_gmem.c:416) ==8441== by 0x5B0FBA7: batch_flush (freedreno_batch.c:281) ==8441== by 0x5B0FBA7: fd_batch_flush (freedreno_batch.c:306) ==8441== by 0x5B11FE7: fd_context_flush (freedreno_context.c:52) ==8441== by 0x58AD783: st_glFlush (st_cb_flush.c:121) ==8441== by 0x5751EE7: _mesa_make_current (context.c:1652) ==8441== by 0x58E6A97: st_api_make_current (st_manager.c:811) ==8441== by 0x5A2CE43: dri_unbind_context (dri_context.c:207) ==8441== by 0x5A2C77F: driUnbindContext (dri_util.c:589) ==8441== by 0x4AC8A67: MakeContextCurrent (glxcurrent.c:214) ==8441== Address 0x6f5eb1c is 204 bytes inside a block of size 240 free'd ==8441== at 0x4868F44: realloc (vg_replace_malloc.c:785) ==8441== by 0x5DEE143: msm_ringbuffer_emit_reloc (msm_ringbuffer.c:502) ==8441== by 0x5B48F0F: OUT_RELOCW (freedreno_util.h:241) ==8441== by 0x5B48F0F: fd5_emit_blit (fd5_emit.h:131) ==8441== by 0x5B48F0F: emit_gmem2mem_surf.isra.12 (fd5_gmem.c:450) ==8441== by 0x5B4910F: fd5_emit_tile_gmem2mem (fd5_gmem.c:477) ==8441== by 0x5B14943: render_tiles (freedreno_gmem.c:342) ==8441== by 0x5B14943: fd_gmem_render_tiles (freedreno_gmem.c:416) ==8441== by 0x5B0FBA7: batch_flush (freedreno_batch.c:281) ==8441== by 0x5B0FBA7: fd_batch_flush (freedreno_batch.c:306) ==8441== by 0x5B11FE7: fd_context_flush (freedreno_context.c:52) ==8441== by 0x58AD783: st_glFlush (st_cb_flush.c:121) ==8441== by 0x5751EE7: _mesa_make_current (context.c:1652) ==8441== by 0x58E6A97: st_api_make_current (st_manager.c:811) ==8441== by 0x5A2CE43: dri_unbind_context (dri_context.c:207) ==8441== by 0x5A2C77F: driUnbindContext (dri_util.c:589) ==8441== Block was alloc'd at ==8441== at 0x4868F44: realloc (vg_replace_malloc.c:785) ==8441== by 0x5DEE08B: msm_ringbuffer_emit_reloc (msm_ringbuffer.c:481) ==8441== by 0x5B48F0F: OUT_RELOCW (freedreno_util.h:241) ==8441== by 0x5B48F0F: fd5_emit_blit (fd5_emit.h:131) ==8441== by 0x5B48F0F: emit_gmem2mem_surf.isra.12 (fd5_gmem.c:450) ==8441== by 0x5B4909F: fd5_emit_tile_gmem2mem (fd5_gmem.c:465) ==8441== by 0x5B14943: render_tiles (freedreno_gmem.c:342) ==8441== by 0x5B14943: fd_gmem_render_tiles (freedreno_gmem.c:416) ==8441== by 0x5B0FBA7: batch_flush (freedreno_batch.c:281) ==8441== by 0x5B0FBA7: fd_batch_flush (freedreno_batch.c:306) ==8441== by 0x5B11FE7: fd_context_flush (freedreno_context.c:52) ==8441== by 0x58AD783: st_glFlush (st_cb_flush.c:121) ==8441== by 0x5751EE7: _mesa_make_current (context.c:1652) ==8441== by 0x58E6A97: st_api_make_current (st_manager.c:811) ==8441== by 0x5A2CE43: dri_unbind_context (dri_context.c:207) ==8441== by 0x5A2C77F: driUnbindContext (dri_util.c:589) Signed-off-by: Rob Clark --- freedreno/msm/msm_ringbuffer.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'freedreno') diff --git a/freedreno/msm/msm_ringbuffer.c b/freedreno/msm/msm_ringbuffer.c index 17194f4c..c3b2eded 100644 --- a/freedreno/msm/msm_ringbuffer.c +++ b/freedreno/msm/msm_ringbuffer.c @@ -496,11 +496,16 @@ static void msm_ringbuffer_emit_reloc(struct fd_ringbuffer *ring, if (ring->pipe->gpu_id >= 500) { struct drm_msm_gem_submit_reloc *reloc_hi; + /* NOTE: grab reloc_idx *before* APPEND() since that could + * realloc() meaning that 'reloc' ptr is no longer valid: + */ + uint32_t reloc_idx = reloc->reloc_idx; + idx = APPEND(cmd, relocs); reloc_hi = &cmd->relocs[idx]; - reloc_hi->reloc_idx = reloc->reloc_idx; + reloc_hi->reloc_idx = reloc_idx; reloc_hi->reloc_offset = r->offset; reloc_hi->or = r->orhi; reloc_hi->shift = r->shift - 32; -- cgit v1.2.3-54-g00ecf From d0dae26ca4e743933f50c1bf4a742e0db8e1994b Mon Sep 17 00:00:00 2001 From: Rob Clark Date: Tue, 21 Mar 2017 19:44:57 -0400 Subject: freedreno: valgrind support Signed-off-by: Rob Clark --- freedreno/Makefile.am | 1 + freedreno/freedreno_bo.c | 12 ++++++++- freedreno/freedreno_bo_cache.c | 4 ++- freedreno/freedreno_priv.h | 56 ++++++++++++++++++++++++++++++++++++++++++ freedreno/kgsl/kgsl_device.c | 2 ++ freedreno/msm/msm_device.c | 2 ++ 6 files changed, 75 insertions(+), 2 deletions(-) (limited to 'freedreno') diff --git a/freedreno/Makefile.am b/freedreno/Makefile.am index 0771d146..cbb0d031 100644 --- a/freedreno/Makefile.am +++ b/freedreno/Makefile.am @@ -5,6 +5,7 @@ AM_CFLAGS = \ $(WARN_CFLAGS) \ -I$(top_srcdir) \ $(PTHREADSTUBS_CFLAGS) \ + $(VALGRIND_CFLAGS) \ -I$(top_srcdir)/include/drm libdrm_freedreno_la_LTLIBRARIES = libdrm_freedreno.la diff --git a/freedreno/freedreno_bo.c b/freedreno/freedreno_bo.c index 996d6b95..10949ebf 100644 --- a/freedreno/freedreno_bo.c +++ b/freedreno/freedreno_bo.c @@ -102,6 +102,8 @@ fd_bo_new(struct fd_device *dev, uint32_t size, uint32_t flags) bo->bo_reuse = TRUE; pthread_mutex_unlock(&table_lock); + VG_BO_ALLOC(bo); + return bo; } @@ -118,6 +120,8 @@ fd_bo_from_handle(struct fd_device *dev, uint32_t handle, uint32_t size) bo = bo_from_handle(dev, size, handle); + VG_BO_ALLOC(bo); + out_unlock: pthread_mutex_unlock(&table_lock); @@ -147,6 +151,8 @@ fd_bo_from_dmabuf(struct fd_device *dev, int fd) bo = bo_from_handle(dev, size, handle); + VG_BO_ALLOC(bo); + out_unlock: pthread_mutex_unlock(&table_lock); @@ -177,8 +183,10 @@ struct fd_bo * fd_bo_from_name(struct fd_device *dev, uint32_t name) goto out_unlock; bo = bo_from_handle(dev, req.size, req.handle); - if (bo) + if (bo) { set_name(bo, name); + VG_BO_ALLOC(bo); + } out_unlock: pthread_mutex_unlock(&table_lock); @@ -213,6 +221,8 @@ out: /* Called under table_lock */ drm_private void bo_del(struct fd_bo *bo) { + VG_BO_FREE(bo); + if (bo->map) drm_munmap(bo->map, bo->size); diff --git a/freedreno/freedreno_bo_cache.c b/freedreno/freedreno_bo_cache.c index 7becb0d6..d922f3a9 100644 --- a/freedreno/freedreno_bo_cache.c +++ b/freedreno/freedreno_bo_cache.c @@ -33,7 +33,6 @@ #include "freedreno_drmif.h" #include "freedreno_priv.h" - drm_private void bo_del(struct fd_bo *bo); drm_private extern pthread_mutex_t table_lock; @@ -102,6 +101,7 @@ fd_bo_cache_cleanup(struct fd_bo_cache *cache, time_t time) if (time && ((time - bo->free_time) <= 1)) break; + VG_BO_OBTAIN(bo); list_del(&bo->list); bo_del(bo); } @@ -177,6 +177,7 @@ retry: *size = bucket->size; bo = find_in_bucket(bucket, flags); if (bo) { + VG_BO_OBTAIN(bo); if (bo->funcs->madvise(bo, TRUE) <= 0) { /* we've lost the backing pages, delete and try again: */ pthread_mutex_lock(&table_lock); @@ -207,6 +208,7 @@ fd_bo_cache_free(struct fd_bo_cache *cache, struct fd_bo *bo) clock_gettime(CLOCK_MONOTONIC, &time); bo->free_time = time.tv_sec; + VG_BO_RELEASE(bo); list_addtail(&bo->list, &bucket->list); fd_bo_cache_cleanup(cache, time.tv_sec); diff --git a/freedreno/freedreno_priv.h b/freedreno/freedreno_priv.h index 32170391..8dd3ee69 100644 --- a/freedreno/freedreno_priv.h +++ b/freedreno/freedreno_priv.h @@ -102,6 +102,9 @@ struct fd_device { struct fd_bo_cache bo_cache; int closefd; /* call close(fd) upon destruction */ + + /* just for valgrind: */ + int bo_size; }; drm_private void fd_bo_cache_init(struct fd_bo_cache *cache, int coarse); @@ -196,4 +199,57 @@ offset_bytes(void *end, void *start) return ((char *)end) - ((char *)start); } +#ifdef HAVE_VALGRIND +# include + +/* + * For tracking the backing memory (if valgrind enabled, we force a mmap + * for the purposes of tracking) + */ +static inline void VG_BO_ALLOC(struct fd_bo *bo) +{ + if (bo && RUNNING_ON_VALGRIND) { + VALGRIND_MALLOCLIKE_BLOCK(fd_bo_map(bo), bo->size, 0, 1); + } +} + +static inline void VG_BO_FREE(struct fd_bo *bo) +{ + VALGRIND_FREELIKE_BLOCK(bo->map, 0); +} + +/* + * For tracking bo structs that are in the buffer-cache, so that valgrind + * doesn't attribute ownership to the first one to allocate the recycled + * bo. + * + * Note that the list_head in fd_bo is used to track the buffers in cache + * so disable error reporting on the range while they are in cache so + * valgrind doesn't squawk about list traversal. + * + */ +static inline void VG_BO_RELEASE(struct fd_bo *bo) +{ + if (RUNNING_ON_VALGRIND) { + VALGRIND_DISABLE_ADDR_ERROR_REPORTING_IN_RANGE(bo, bo->dev->bo_size); + VALGRIND_MAKE_MEM_NOACCESS(bo, bo->dev->bo_size); + VALGRIND_FREELIKE_BLOCK(bo->map, 0); + } +} +static inline void VG_BO_OBTAIN(struct fd_bo *bo) +{ + if (RUNNING_ON_VALGRIND) { + VALGRIND_MAKE_MEM_DEFINED(bo, bo->dev->bo_size); + VALGRIND_ENABLE_ADDR_ERROR_REPORTING_IN_RANGE(bo, bo->dev->bo_size); + VALGRIND_MALLOCLIKE_BLOCK(bo->map, bo->size, 0, 1); + } +} +#else +static inline void VG_BO_ALLOC(struct fd_bo *bo) {} +static inline void VG_BO_FREE(struct fd_bo *bo) {} +static inline void VG_BO_RELEASE(struct fd_bo *bo) {} +static inline void VG_BO_OBTAIN(struct fd_bo *bo) {} +#endif + + #endif /* FREEDRENO_PRIV_H_ */ diff --git a/freedreno/kgsl/kgsl_device.c b/freedreno/kgsl/kgsl_device.c index 175e8378..958e8a72 100644 --- a/freedreno/kgsl/kgsl_device.c +++ b/freedreno/kgsl/kgsl_device.c @@ -61,5 +61,7 @@ drm_private struct fd_device * kgsl_device_new(int fd) dev = &kgsl_dev->base; dev->funcs = &funcs; + dev->bo_size = sizeof(struct kgsl_bo); + return dev; } diff --git a/freedreno/msm/msm_device.c b/freedreno/msm/msm_device.c index 727baa44..c454938d 100644 --- a/freedreno/msm/msm_device.c +++ b/freedreno/msm/msm_device.c @@ -64,5 +64,7 @@ drm_private struct fd_device * msm_device_new(int fd) fd_bo_cache_init(&msm_dev->ring_cache, TRUE); + dev->bo_size = sizeof(struct msm_bo); + return dev; } -- cgit v1.2.3-54-g00ecf From a07ae97c75ca45c08327b53df5d8d53e56a46a8a Mon Sep 17 00:00:00 2001 From: Rob Clark Date: Thu, 23 Mar 2017 14:58:38 -0400 Subject: freedreno: fix device close issues Move closing the fd to after subclass ->destroy() (since it might want to delete gem bo's, etc), and actually free() the fd_device object. Signed-off-by: Rob Clark --- freedreno/freedreno_device.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'freedreno') diff --git a/freedreno/freedreno_device.c b/freedreno/freedreno_device.c index fcbf1402..dba7ec47 100644 --- a/freedreno/freedreno_device.c +++ b/freedreno/freedreno_device.c @@ -115,9 +115,10 @@ static void fd_device_del_impl(struct fd_device *dev) fd_bo_cache_cleanup(&dev->bo_cache, 0); drmHashDestroy(dev->handle_table); drmHashDestroy(dev->name_table); + dev->funcs->destroy(dev); if (dev->closefd) close(dev->fd); - dev->funcs->destroy(dev); + free(dev); } drm_private void fd_device_del_locked(struct fd_device *dev) -- cgit v1.2.3-54-g00ecf From f45853802e910fd472f368a2d461708491fedfa3 Mon Sep 17 00:00:00 2001 From: Rob Clark Date: Sat, 15 Apr 2017 14:43:17 -0400 Subject: freedreno: fix double-free on exit Fixes: a07ae97 ("freedreno: fix device close issues") Signed-off-by: Rob Clark --- freedreno/freedreno_device.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'freedreno') diff --git a/freedreno/freedreno_device.c b/freedreno/freedreno_device.c index dba7ec47..12b95fd0 100644 --- a/freedreno/freedreno_device.c +++ b/freedreno/freedreno_device.c @@ -112,13 +112,13 @@ struct fd_device * fd_device_ref(struct fd_device *dev) static void fd_device_del_impl(struct fd_device *dev) { + int close_fd = dev->closefd ? dev->fd : -1; fd_bo_cache_cleanup(&dev->bo_cache, 0); drmHashDestroy(dev->handle_table); drmHashDestroy(dev->name_table); dev->funcs->destroy(dev); - if (dev->closefd) - close(dev->fd); - free(dev); + if (close_fd >= 0) + close(close_fd); } drm_private void fd_device_del_locked(struct fd_device *dev) -- cgit v1.2.3-54-g00ecf From ac2b806c4556c8339f5eb95578884278b1925acb Mon Sep 17 00:00:00 2001 From: Eric Engestrom Date: Sun, 30 Jul 2017 21:27:38 +0100 Subject: freedreno: remove dead error path `pipe` cannot be non-null, so the label reduces to a simple return. Then, there is no point initialising `pipe` just to overwrite it before anyone reads it. Signed-off-by: Eric Engestrom Reviewed-by: Rob Clark --- freedreno/freedreno_pipe.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'freedreno') diff --git a/freedreno/freedreno_pipe.c b/freedreno/freedreno_pipe.c index 3f8c8342..e69cb28c 100644 --- a/freedreno/freedreno_pipe.c +++ b/freedreno/freedreno_pipe.c @@ -36,18 +36,18 @@ struct fd_pipe * fd_pipe_new(struct fd_device *dev, enum fd_pipe_id id) { - struct fd_pipe *pipe = NULL; + struct fd_pipe *pipe; uint64_t val; if (id > FD_PIPE_MAX) { ERROR_MSG("invalid pipe id: %d", id); - goto fail; + return NULL; } pipe = dev->funcs->pipe_new(dev, id); if (!pipe) { ERROR_MSG("allocation failed"); - goto fail; + return NULL; } pipe->dev = dev; @@ -57,10 +57,6 @@ fd_pipe_new(struct fd_device *dev, enum fd_pipe_id id) pipe->gpu_id = val; return pipe; -fail: - if (pipe) - fd_pipe_del(pipe); - return NULL; } void fd_pipe_del(struct fd_pipe *pipe) -- cgit v1.2.3-54-g00ecf From 6338e452c907a5e8024b2f3615795ac68dcf0a35 Mon Sep 17 00:00:00 2001 From: Eric Engestrom Date: Sun, 30 Jul 2017 21:27:39 +0100 Subject: freedreno/msm: remove dead error path `ring` cannot be non-null, so the label reduces to a simple return. Then, there is no point initialising `ring` just to overwrite it before anyone reads it. Signed-off-by: Eric Engestrom Reviewed-by: Rob Clark --- freedreno/msm/msm_ringbuffer.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'freedreno') diff --git a/freedreno/msm/msm_ringbuffer.c b/freedreno/msm/msm_ringbuffer.c index c3b2eded..5b28feaa 100644 --- a/freedreno/msm/msm_ringbuffer.c +++ b/freedreno/msm/msm_ringbuffer.c @@ -589,12 +589,12 @@ drm_private struct fd_ringbuffer * msm_ringbuffer_new(struct fd_pipe *pipe, uint32_t size) { struct msm_ringbuffer *msm_ring; - struct fd_ringbuffer *ring = NULL; + struct fd_ringbuffer *ring; msm_ring = calloc(1, sizeof(*msm_ring)); if (!msm_ring) { ERROR_MSG("allocation failed"); - goto fail; + return NULL; } if (size == 0) { @@ -614,8 +614,4 @@ drm_private struct fd_ringbuffer * msm_ringbuffer_new(struct fd_pipe *pipe, ring_cmd_new(ring, size); return ring; -fail: - if (ring) - fd_ringbuffer_del(ring); - return NULL; } -- cgit v1.2.3-54-g00ecf From ceb70a6b1015be5ccc7858c4d3e29c13acbf71b7 Mon Sep 17 00:00:00 2001 From: Eric Engestrom Date: Sun, 30 Jul 2017 21:27:40 +0100 Subject: freedreno: prevent deadlock in error path Signed-off-by: Eric Engestrom Reviewed-by: Rob Clark --- freedreno/freedreno_bo.c | 1 + 1 file changed, 1 insertion(+) (limited to 'freedreno') diff --git a/freedreno/freedreno_bo.c b/freedreno/freedreno_bo.c index 10949ebf..7f8ea59c 100644 --- a/freedreno/freedreno_bo.c +++ b/freedreno/freedreno_bo.c @@ -138,6 +138,7 @@ fd_bo_from_dmabuf(struct fd_device *dev, int fd) pthread_mutex_lock(&table_lock); ret = drmPrimeFDToHandle(dev->fd, fd, &handle); if (ret) { + pthread_mutex_unlock(&table_lock); return NULL; } -- cgit v1.2.3-54-g00ecf From 76418c244d4c52a8dd20809e3e8b4e70501fc76f Mon Sep 17 00:00:00 2001 From: Eric Engestrom Date: Thu, 14 Sep 2017 10:56:01 +0100 Subject: freedreno/kgsl: fix pointer-to-int cast Fixes this warning: freedreno/kgsl/kgsl_ringbuffer.c: In function ‘kgsl_ringbuffer_flush’: freedreno/kgsl/kgsl_ringbuffer.c:149:19: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] req.timestamp = (uint32_t)kgsl_ring->bo->hostptr; ^ Signed-off-by: Eric Engestrom Reviewed-by: Rob Clark --- freedreno/kgsl/kgsl_ringbuffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'freedreno') diff --git a/freedreno/kgsl/kgsl_ringbuffer.c b/freedreno/kgsl/kgsl_ringbuffer.c index e4696b1b..f09c433b 100644 --- a/freedreno/kgsl/kgsl_ringbuffer.c +++ b/freedreno/kgsl/kgsl_ringbuffer.c @@ -146,7 +146,7 @@ static int kgsl_ringbuffer_flush(struct fd_ringbuffer *ring, uint32_t *last_star ibdesc.gpuaddr = kgsl_ring->bo->gpuaddr; ibdesc.hostptr = kgsl_ring->bo->hostptr; ibdesc.sizedwords = 0x145; - req.timestamp = (uint32_t)kgsl_ring->bo->hostptr; + req.timestamp = (uintptr_t)kgsl_ring->bo->hostptr; } do { -- cgit v1.2.3-54-g00ecf From 62e0767b816cb52b35226d439090ef580bd60b01 Mon Sep 17 00:00:00 2001 From: Rob Clark Date: Wed, 23 Aug 2017 15:00:12 -0400 Subject: freedreno: sync uapi header (driver version 1.3.0) Signed-off-by: Rob Clark --- freedreno/msm/msm_drm.h | 40 ++++++++++++++++++++++++++++++++++------ 1 file changed, 34 insertions(+), 6 deletions(-) (limited to 'freedreno') diff --git a/freedreno/msm/msm_drm.h b/freedreno/msm/msm_drm.h index ed4c8d47..dac49e59 100644 --- a/freedreno/msm/msm_drm.h +++ b/freedreno/msm/msm_drm.h @@ -73,6 +73,8 @@ struct drm_msm_timespec { #define MSM_PARAM_CHIP_ID 0x03 #define MSM_PARAM_MAX_FREQ 0x04 #define MSM_PARAM_TIMESTAMP 0x05 +#define MSM_PARAM_GMEM_BASE 0x06 +#define MSM_PARAM_NR_RINGS 0x07 struct drm_msm_param { __u32 pipe; /* in, MSM_PIPE_x */ @@ -104,10 +106,14 @@ struct drm_msm_gem_new { __u32 handle; /* out */ }; +#define MSM_INFO_IOVA 0x01 + +#define MSM_INFO_FLAGS (MSM_INFO_IOVA) + struct drm_msm_gem_info { __u32 handle; /* in */ - __u32 pad; - __u64 offset; /* out, offset to pass to mmap() */ + __u32 flags; /* in - combination of MSM_INFO_* flags */ + __u64 offset; /* out, mmap() offset or iova */ }; #define MSM_PREP_READ 0x01 @@ -167,7 +173,7 @@ struct drm_msm_gem_submit_cmd { __u32 size; /* in, cmdstream size */ __u32 pad; __u32 nr_relocs; /* in, number of submit_reloc's */ - __u64 __user relocs; /* in, ptr to array of submit_reloc's */ + __u64 relocs; /* in, ptr to array of submit_reloc's */ }; /* Each buffer referenced elsewhere in the cmdstream submit (ie. the @@ -211,9 +217,10 @@ struct drm_msm_gem_submit { __u32 fence; /* out */ __u32 nr_bos; /* in, number of submit_bo's */ __u32 nr_cmds; /* in, number of submit_cmd's */ - __u64 __user bos; /* in, ptr to array of submit_bo's */ - __u64 __user cmds; /* in, ptr to array of submit_cmd's */ + __u64 bos; /* in, ptr to array of submit_bo's */ + __u64 cmds; /* in, ptr to array of submit_cmd's */ __s32 fence_fd; /* in/out fence fd (see MSM_SUBMIT_FENCE_FD_IN/OUT) */ + __u32 queueid; /* in, submitqueue id */ }; /* The normal way to synchronize with the GPU is just to CPU_PREP on @@ -227,6 +234,7 @@ struct drm_msm_wait_fence { __u32 fence; /* in */ __u32 pad; struct drm_msm_timespec timeout; /* in */ + __u32 queueid; /* in, submitqueue id */ }; /* madvise provides a way to tell the kernel in case a buffers contents @@ -250,6 +258,20 @@ struct drm_msm_gem_madvise { __u32 retained; /* out, whether backing store still exists */ }; +/* + * Draw queues allow the user to set specific submission parameter. Command + * submissions specify a specific submitqueue to use. ID 0 is reserved for + * backwards compatibility as a "default" submitqueue + */ + +#define MSM_SUBMITQUEUE_FLAGS (0) + +struct drm_msm_submitqueue { + __u32 flags; /* in, MSM_SUBMITQUEUE_x */ + __u32 prio; /* in, Priority level */ + __u32 id; /* out, identifier */ +}; + #define DRM_MSM_GET_PARAM 0x00 /* placeholder: #define DRM_MSM_SET_PARAM 0x01 @@ -261,7 +283,11 @@ struct drm_msm_gem_madvise { #define DRM_MSM_GEM_SUBMIT 0x06 #define DRM_MSM_WAIT_FENCE 0x07 #define DRM_MSM_GEM_MADVISE 0x08 -#define DRM_MSM_NUM_IOCTLS 0x09 +/* placeholder: +#define DRM_MSM_GEM_SVM_NEW 0x09 + */ +#define DRM_MSM_SUBMITQUEUE_NEW 0x0A +#define DRM_MSM_SUBMITQUEUE_CLOSE 0x0B #define DRM_IOCTL_MSM_GET_PARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_MSM_GET_PARAM, struct drm_msm_param) #define DRM_IOCTL_MSM_GEM_NEW DRM_IOWR(DRM_COMMAND_BASE + DRM_MSM_GEM_NEW, struct drm_msm_gem_new) @@ -271,6 +297,8 @@ struct drm_msm_gem_madvise { #define DRM_IOCTL_MSM_GEM_SUBMIT DRM_IOWR(DRM_COMMAND_BASE + DRM_MSM_GEM_SUBMIT, struct drm_msm_gem_submit) #define DRM_IOCTL_MSM_WAIT_FENCE DRM_IOW (DRM_COMMAND_BASE + DRM_MSM_WAIT_FENCE, struct drm_msm_wait_fence) #define DRM_IOCTL_MSM_GEM_MADVISE DRM_IOWR(DRM_COMMAND_BASE + DRM_MSM_GEM_MADVISE, struct drm_msm_gem_madvise) +#define DRM_IOCTL_MSM_SUBMITQUEUE_NEW DRM_IOWR(DRM_COMMAND_BASE + DRM_MSM_SUBMITQUEUE_NEW, struct drm_msm_submitqueue) +#define DRM_IOCTL_MSM_SUBMITQUEUE_CLOSE DRM_IOW (DRM_COMMAND_BASE + DRM_MSM_SUBMITQUEUE_CLOSE, __u32) #if defined(__cplusplus) } -- cgit v1.2.3-54-g00ecf From 7064b2eae9c136162e5c7f25571d63f71d066887 Mon Sep 17 00:00:00 2001 From: Rob Clark Date: Wed, 23 Aug 2017 17:08:39 -0400 Subject: freedreno: submit-queue context priority With a new-enough kernel to support prioritized submit-queues, we can expose priority level support to mesa. Open a submit queue associated with the fd_pipe and pass it's id back to SUBMIT ioctl. Signed-off-by: Rob Clark --- freedreno/freedreno_drmif.h | 3 +++ freedreno/freedreno_pipe.c | 19 +++++++++++++++++-- freedreno/freedreno_priv.h | 3 ++- freedreno/kgsl/kgsl_pipe.c | 3 ++- freedreno/kgsl/kgsl_priv.h | 2 +- freedreno/msm/msm_pipe.c | 41 ++++++++++++++++++++++++++++++++++++++++- freedreno/msm/msm_priv.h | 3 ++- freedreno/msm/msm_ringbuffer.c | 1 + 8 files changed, 68 insertions(+), 7 deletions(-) (limited to 'freedreno') diff --git a/freedreno/freedreno_drmif.h b/freedreno/freedreno_drmif.h index 7a8073ff..c3b0d02a 100644 --- a/freedreno/freedreno_drmif.h +++ b/freedreno/freedreno_drmif.h @@ -61,6 +61,7 @@ enum fd_param_id { FD_CHIP_ID, FD_MAX_FREQ, FD_TIMESTAMP, + FD_NR_RINGS, /* # of rings == # of distinct priority levels */ }; /* bo flags: */ @@ -93,6 +94,7 @@ enum fd_version { FD_VERSION_MADVISE = 1, /* kernel supports madvise */ FD_VERSION_UNLIMITED_CMDS = 1, /* submits w/ >4 cmd buffers (growable ringbuffer) */ FD_VERSION_FENCE_FD = 2, /* submit command supports in/out fences */ + FD_VERSION_SUBMIT_QUEUES = 3, /* submit queues and multiple priority levels */ }; enum fd_version fd_device_version(struct fd_device *dev); @@ -100,6 +102,7 @@ enum fd_version fd_device_version(struct fd_device *dev); */ struct fd_pipe * fd_pipe_new(struct fd_device *dev, enum fd_pipe_id id); +struct fd_pipe * fd_pipe_new2(struct fd_device *dev, enum fd_pipe_id id, uint32_t prio); void fd_pipe_del(struct fd_pipe *pipe); int fd_pipe_get_param(struct fd_pipe *pipe, enum fd_param_id param, uint64_t *value); diff --git a/freedreno/freedreno_pipe.c b/freedreno/freedreno_pipe.c index e69cb28c..1540474b 100644 --- a/freedreno/freedreno_pipe.c +++ b/freedreno/freedreno_pipe.c @@ -33,8 +33,12 @@ #include "freedreno_drmif.h" #include "freedreno_priv.h" +/** + * priority of zero is highest priority, and higher numeric values are + * lower priorities + */ struct fd_pipe * -fd_pipe_new(struct fd_device *dev, enum fd_pipe_id id) +fd_pipe_new2(struct fd_device *dev, enum fd_pipe_id id, uint32_t prio) { struct fd_pipe *pipe; uint64_t val; @@ -44,7 +48,12 @@ fd_pipe_new(struct fd_device *dev, enum fd_pipe_id id) return NULL; } - pipe = dev->funcs->pipe_new(dev, id); + if ((prio != 1) && (fd_device_version(dev) < FD_VERSION_SUBMIT_QUEUES)) { + ERROR_MSG("invalid priority!"); + return NULL; + } + + pipe = dev->funcs->pipe_new(dev, id, prio); if (!pipe) { ERROR_MSG("allocation failed"); return NULL; @@ -59,6 +68,12 @@ fd_pipe_new(struct fd_device *dev, enum fd_pipe_id id) return pipe; } +struct fd_pipe * +fd_pipe_new(struct fd_device *dev, enum fd_pipe_id id) +{ + return fd_pipe_new2(dev, id, 1); +} + void fd_pipe_del(struct fd_pipe *pipe) { pipe->funcs->destroy(pipe); diff --git a/freedreno/freedreno_priv.h b/freedreno/freedreno_priv.h index 8dd3ee69..27307472 100644 --- a/freedreno/freedreno_priv.h +++ b/freedreno/freedreno_priv.h @@ -66,7 +66,8 @@ struct fd_device_funcs { uint32_t flags, uint32_t *handle); struct fd_bo * (*bo_from_handle)(struct fd_device *dev, uint32_t size, uint32_t handle); - struct fd_pipe * (*pipe_new)(struct fd_device *dev, enum fd_pipe_id id); + struct fd_pipe * (*pipe_new)(struct fd_device *dev, enum fd_pipe_id id, + unsigned prio); void (*destroy)(struct fd_device *dev); }; diff --git a/freedreno/kgsl/kgsl_pipe.c b/freedreno/kgsl/kgsl_pipe.c index 8a39eb49..80bd1313 100644 --- a/freedreno/kgsl/kgsl_pipe.c +++ b/freedreno/kgsl/kgsl_pipe.c @@ -52,6 +52,7 @@ static int kgsl_pipe_get_param(struct fd_pipe *pipe, return 0; case FD_MAX_FREQ: case FD_TIMESTAMP: + case FD_NR_RINGS: /* unsupported on kgsl */ return -1; default: @@ -210,7 +211,7 @@ static int getprop(int fd, enum kgsl_property_type type, drm_private struct fd_pipe * kgsl_pipe_new(struct fd_device *dev, - enum fd_pipe_id id) + enum fd_pipe_id id, uint32_t prio) { static const char *paths[] = { [FD_PIPE_3D] = "/dev/kgsl-3d0", diff --git a/freedreno/kgsl/kgsl_priv.h b/freedreno/kgsl/kgsl_priv.h index 6ab64965..41b13920 100644 --- a/freedreno/kgsl/kgsl_priv.h +++ b/freedreno/kgsl/kgsl_priv.h @@ -103,7 +103,7 @@ drm_private void kgsl_pipe_post_submit(struct kgsl_pipe *pipe, drm_private void kgsl_pipe_process_pending(struct kgsl_pipe *pipe, uint32_t timestamp); drm_private struct fd_pipe * kgsl_pipe_new(struct fd_device *dev, - enum fd_pipe_id id); + enum fd_pipe_id id, uint32_t prio); drm_private struct fd_ringbuffer * kgsl_ringbuffer_new(struct fd_pipe *pipe, uint32_t size); diff --git a/freedreno/msm/msm_pipe.c b/freedreno/msm/msm_pipe.c index f872e245..7395e573 100644 --- a/freedreno/msm/msm_pipe.c +++ b/freedreno/msm/msm_pipe.c @@ -71,6 +71,8 @@ static int msm_pipe_get_param(struct fd_pipe *pipe, return query_param(pipe, MSM_PARAM_MAX_FREQ, value); case FD_TIMESTAMP: return query_param(pipe, MSM_PARAM_TIMESTAMP, value); + case FD_NR_RINGS: + return query_param(pipe, MSM_PARAM_NR_RINGS, value); default: ERROR_MSG("invalid param id: %d", param); return -1; @@ -83,6 +85,7 @@ static int msm_pipe_wait(struct fd_pipe *pipe, uint32_t timestamp, struct fd_device *dev = pipe->dev; struct drm_msm_wait_fence req = { .fence = timestamp, + .queueid = to_msm_pipe(pipe)->queue_id, }; int ret; @@ -97,9 +100,42 @@ static int msm_pipe_wait(struct fd_pipe *pipe, uint32_t timestamp, return 0; } +static int open_submitqueue(struct fd_device *dev, uint32_t prio, + uint32_t *queue_id) +{ + struct drm_msm_submitqueue req = { + .flags = 0, + .prio = prio, + }; + int ret; + + if (fd_device_version(dev) < FD_VERSION_SUBMIT_QUEUES) { + *queue_id = 0; + return 0; + } + + ret = drmCommandWriteRead(dev->fd, DRM_MSM_SUBMITQUEUE_NEW, &req, sizeof(req)); + if (ret) { + ERROR_MSG("could not create submitqueue! %d (%s)", ret, strerror(errno)); + return ret; + } + + *queue_id = req.id; + return 0; +} + +static void close_submitqueue(struct fd_device *dev, uint32_t queue_id) +{ + if (fd_device_version(dev) < FD_VERSION_SUBMIT_QUEUES) + return; + + drmCommandWrite(dev->fd, DRM_MSM_SUBMITQUEUE_CLOSE, &queue_id, sizeof(queue_id)); +} + static void msm_pipe_destroy(struct fd_pipe *pipe) { struct msm_pipe *msm_pipe = to_msm_pipe(pipe); + close_submitqueue(pipe->dev, msm_pipe->queue_id); free(msm_pipe); } @@ -122,7 +158,7 @@ static uint64_t get_param(struct fd_pipe *pipe, uint32_t param) } drm_private struct fd_pipe * msm_pipe_new(struct fd_device *dev, - enum fd_pipe_id id) + enum fd_pipe_id id, uint32_t prio) { static const uint32_t pipe_id[] = { [FD_PIPE_3D] = MSM_PIPE_3D0, @@ -157,6 +193,9 @@ drm_private struct fd_pipe * msm_pipe_new(struct fd_device *dev, INFO_MSG(" Chip-id: 0x%08x", msm_pipe->chip_id); INFO_MSG(" GMEM size: 0x%08x", msm_pipe->gmem); + if (open_submitqueue(dev, prio, &msm_pipe->queue_id)) + goto fail; + return pipe; fail: if (pipe) diff --git a/freedreno/msm/msm_priv.h b/freedreno/msm/msm_priv.h index 6d670aab..88ac3aa4 100644 --- a/freedreno/msm/msm_priv.h +++ b/freedreno/msm/msm_priv.h @@ -56,6 +56,7 @@ struct msm_pipe { uint32_t gpu_id; uint32_t gmem; uint32_t chip_id; + uint32_t queue_id; }; static inline struct msm_pipe * to_msm_pipe(struct fd_pipe *x) @@ -64,7 +65,7 @@ static inline struct msm_pipe * to_msm_pipe(struct fd_pipe *x) } drm_private struct fd_pipe * msm_pipe_new(struct fd_device *dev, - enum fd_pipe_id id); + enum fd_pipe_id id, uint32_t prio); drm_private struct fd_ringbuffer * msm_ringbuffer_new(struct fd_pipe *pipe, uint32_t size); diff --git a/freedreno/msm/msm_ringbuffer.c b/freedreno/msm/msm_ringbuffer.c index 5b28feaa..c75bb169 100644 --- a/freedreno/msm/msm_ringbuffer.c +++ b/freedreno/msm/msm_ringbuffer.c @@ -401,6 +401,7 @@ static int msm_ringbuffer_flush(struct fd_ringbuffer *ring, uint32_t *last_start struct msm_ringbuffer *msm_ring = to_msm_ringbuffer(ring); struct drm_msm_gem_submit req = { .flags = to_msm_pipe(ring->pipe)->pipe, + .queueid = to_msm_pipe(ring->pipe)->queue_id, }; uint32_t i; int ret; -- cgit v1.2.3-54-g00ecf From cfe0ae53556261250a08b625e020a7e0712bc59e Mon Sep 17 00:00:00 2001 From: Emil Velikov Date: Tue, 7 Nov 2017 11:21:32 +0000 Subject: freedreno: add the API fd_pipe_new2 to the symbol test As kindly spotted by `make check' Signed-off-by: Emil Velikov --- freedreno/freedreno-symbol-check | 1 + 1 file changed, 1 insertion(+) (limited to 'freedreno') diff --git a/freedreno/freedreno-symbol-check b/freedreno/freedreno-symbol-check index 42f2c439..6b81040c 100755 --- a/freedreno/freedreno-symbol-check +++ b/freedreno/freedreno-symbol-check @@ -33,6 +33,7 @@ fd_device_version fd_pipe_del fd_pipe_get_param fd_pipe_new +fd_pipe_new2 fd_pipe_wait fd_pipe_wait_timeout fd_ringbuffer_cmd_count -- cgit v1.2.3-54-g00ecf From 5f7deb50787b82038cc35fb1e31b761e33e5a341 Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Wed, 13 Sep 2017 11:46:13 -0700 Subject: Add meson build system This patch adds a complete meson build system, including tests and install. It has the necessary hooks to allow it be used as a subproject for other meson based builds such as mesa. Signed-off-by: Dylan Baker Reviewed-and-tested-by: Igor Gnatenko Reviewed-by: Eric Engestrom --- .editorconfig | 4 + amdgpu/.editorconfig | 4 + amdgpu/meson.build | 65 ++++++++ data/meson.build | 27 ++++ etnaviv/meson.build | 59 +++++++ exynos/meson.build | 53 +++++++ freedreno/meson.build | 76 +++++++++ intel/meson.build | 105 +++++++++++++ libkms/meson.build | 74 +++++++++ man/meson.build | 67 ++++++++ meson.build | 367 ++++++++++++++++++++++++++++++++++++++++++++ meson_options.txt | 143 +++++++++++++++++ nouveau/meson.build | 58 +++++++ omap/meson.build | 53 +++++++ radeon/meson.build | 63 ++++++++ tegra/meson.build | 52 +++++++ tests/amdgpu/meson.build | 34 ++++ tests/etnaviv/meson.build | 45 ++++++ tests/exynos/meson.build | 54 +++++++ tests/kms/meson.build | 49 ++++++ tests/kmstest/meson.build | 30 ++++ tests/meson.build | 86 +++++++++++ tests/modeprint/meson.build | 29 ++++ tests/modetest/meson.build | 29 ++++ tests/nouveau/meson.build | 30 ++++ tests/proptest/meson.build | 28 ++++ tests/radeon/meson.build | 27 ++++ tests/tegra/meson.build | 27 ++++ tests/util/meson.build | 28 ++++ tests/vbltest/meson.build | 28 ++++ vc4/meson.build | 28 ++++ 31 files changed, 1822 insertions(+) create mode 100644 amdgpu/meson.build create mode 100644 data/meson.build create mode 100644 etnaviv/meson.build create mode 100644 exynos/meson.build create mode 100644 freedreno/meson.build create mode 100644 intel/meson.build create mode 100644 libkms/meson.build create mode 100644 man/meson.build create mode 100644 meson.build create mode 100644 meson_options.txt create mode 100644 nouveau/meson.build create mode 100644 omap/meson.build create mode 100644 radeon/meson.build create mode 100644 tegra/meson.build create mode 100644 tests/amdgpu/meson.build create mode 100644 tests/etnaviv/meson.build create mode 100644 tests/exynos/meson.build create mode 100644 tests/kms/meson.build create mode 100644 tests/kmstest/meson.build create mode 100644 tests/meson.build create mode 100644 tests/modeprint/meson.build create mode 100644 tests/modetest/meson.build create mode 100644 tests/nouveau/meson.build create mode 100644 tests/proptest/meson.build create mode 100644 tests/radeon/meson.build create mode 100644 tests/tegra/meson.build create mode 100644 tests/util/meson.build create mode 100644 tests/vbltest/meson.build create mode 100644 vc4/meson.build (limited to 'freedreno') diff --git a/.editorconfig b/.editorconfig index 893b7be0..29b4f393 100644 --- a/.editorconfig +++ b/.editorconfig @@ -17,3 +17,7 @@ indent_style = tab [*.m4] indent_style = space indent_size = 2 + +[{meson.build,meson_options.txt}] +indent_style = space +indent_size = 2 diff --git a/amdgpu/.editorconfig b/amdgpu/.editorconfig index 2528d675..426273fd 100644 --- a/amdgpu/.editorconfig +++ b/amdgpu/.editorconfig @@ -7,3 +7,7 @@ indent_style = tab indent_size = 8 tab_width = 8 insert_final_newline = true + +[meson.build] +indent_style = space +indent_size = 2 diff --git a/amdgpu/meson.build b/amdgpu/meson.build new file mode 100644 index 00000000..55ab9d1d --- /dev/null +++ b/amdgpu/meson.build @@ -0,0 +1,65 @@ +# Copyright © 2017-2018 Intel Corporation + +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: + +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + + +datadir_amdgpu = join_paths(get_option('datadir'), 'libdrm', 'amdgpu.ids') + +libdrm_amdgpu = shared_library( + 'drm_amdgpu', + [ + files( + 'amdgpu_asic_id.c', 'amdgpu_bo.c', 'amdgpu_cs.c', 'amdgpu_device.c', + 'amdgpu_gpu_info.c', 'amdgpu_vamgr.c', 'amdgpu_vm.c', 'util_hash.c', + 'util_hash_table.c', + ), + config_file, + ], + c_args : [ + warn_c_args, + '-DAMDGPU_ASIC_ID_TABLE="@0@"'.format(datadir_amdgpu), + ], + include_directories : [inc_root, inc_drm], + link_with : libdrm, + dependencies : dep_pthread_stubs, + version : '1.0.0', + install : true, +) + +install_headers('amdgpu.h', subdir : 'libdrm') + +pkg.generate( + name : 'libdrm_amdgpu', + libraries : libdrm_amdgpu, + subdirs : ['.', 'libdrm'], + version : meson.project_version(), + requires_private : 'libdrm', + description : 'Userspace interface to kernel DRM services for amdgpu', +) + +ext_libdrm_amdgpu = declare_dependency( + link_with : [libdrm, libdrm_amdgpu], + include_directories : [inc_drm, include_directories('.')], +) + +test( + 'amdgpu-symbol-check', + prog_bash, + args : [files('amdgpu-symbol-check'), libdrm_amdgpu] +) diff --git a/data/meson.build b/data/meson.build new file mode 100644 index 00000000..9c26b66e --- /dev/null +++ b/data/meson.build @@ -0,0 +1,27 @@ +# Copyright © 2017-2018 Intel Corporation + +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: + +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +if with_amdgpu + install_data( + 'amdgpu.ids', + install_mode : 'rw-r--r--', + install_dir : datadir_amdgpu, + ) +endif diff --git a/etnaviv/meson.build b/etnaviv/meson.build new file mode 100644 index 00000000..1767733b --- /dev/null +++ b/etnaviv/meson.build @@ -0,0 +1,59 @@ +# Copyright © 2017-2018 Intel Corporation + +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: + +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + + +libdrm_etnaviv = shared_library( + 'drm_etnaviv', + [ + files( + 'etnaviv_device.c', 'etnaviv_gpu.c', 'etnaviv_bo.c', 'etnaviv_bo_cache.c', + 'etnaviv_perfmon.c', 'etnaviv_pipe.c', 'etnaviv_cmd_stream.c', + ), + config_file + ], + include_directories : [inc_root, inc_drm], + link_with : libdrm, + c_args : warn_c_args, + dependencies : [dep_pthread_stubs, dep_rt], + version : '1.0.0', + install : true, +) + +install_headers('etnaviv_drmif.h', subdir : 'libdrm') + +pkg.generate( + name : 'libdrm_etnaviv', + libraries : libdrm_etnaviv, + subdirs : ['.', 'libdrm'], + version : meson.project_version(), + requires_private : 'libdrm', + description : 'Userspace interface to Tegra kernel DRM services', +) + +ext_libdrm_etnaviv = declare_dependency( + link_with : [libdrm, libdrm_etnaviv], + include_directories : [inc_drm, include_directories('.')], +) + +test( + 'etnaviv-symbol-check', + prog_bash, + args : [files('etnaviv-symbol-check'), libdrm_etnaviv] +) diff --git a/exynos/meson.build b/exynos/meson.build new file mode 100644 index 00000000..c96ad4e0 --- /dev/null +++ b/exynos/meson.build @@ -0,0 +1,53 @@ +# Copyright © 2017-2018 Intel Corporation + +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: + +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +libdrm_exynos = shared_library( + 'drm_exynos', + [files('exynos_drm.c', 'exynos_fimg2d.c'), config_file], + c_args : warn_c_args, + include_directories : [inc_root, inc_drm], + link_with : libdrm, + dependencies : [dep_pthread_stubs], + version : '1.0.0', + install : true, +) + +install_headers('exynos_drmif.h', subdir : 'libdrm') +install_headers('exynos_drm.h', 'exynos_fimg2d.h', subdir : 'exynos') + +ext_libdrm_exynos = declare_dependency( + link_with : [libdrm, libdrm_exynos], + include_directories : [inc_drm, include_directories('.')], +) + +pkg.generate( + name : 'libdrm_exynos', + libraries : libdrm_exynos, + subdirs : ['.', 'libdrm', 'exynos'], + version : '0.7', + requires_private : 'libdrm', + description : 'Userspace interface to exynos kernel DRM services', +) + +test( + 'exynos-symbol-check', + prog_bash, + args : [files('exynos-symbol-check'), libdrm_exynos] +) diff --git a/freedreno/meson.build b/freedreno/meson.build new file mode 100644 index 00000000..b4035e19 --- /dev/null +++ b/freedreno/meson.build @@ -0,0 +1,76 @@ +# Copyright © 2017-2018 Intel Corporation + +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: + +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +files_freedreno = files( + 'freedreno_device.c', + 'freedreno_pipe.c', + 'freedreno_ringbuffer.c', + 'freedreno_bo.c', + 'freedreno_bo_cache.c', + 'msm/msm_bo.c', + 'msm/msm_device.c', + 'msm/msm_pipe.c', + 'msm/msm_ringbuffer.c', +) + +if with_freedreno_kgsl + files_freedreno += files( + 'kgsl/kgsl_bo.c', + 'kgsl/kgsl_device.c', + 'kgsl/kgsl_pipe.c', + 'kgsl/kgsl_ringbuffer.c', + ) +endif + +libdrm_freedreno = shared_library( + 'drm_freedreno', + [files_freedreno, config_file], + c_args : warn_c_args, + include_directories : [inc_root, inc_drm], + dependencies : [dep_valgrind, dep_pthread_stubs, dep_rt], + link_with : libdrm, + version : '1.0.0', + install : true, +) + +ext_libdrm_freedreno = declare_dependency( + link_with : [libdrm, libdrm_freedreno], + include_directories : [inc_drm, include_directories('.')], +) + +install_headers( + 'freedreno_drmif.h', 'freedreno_ringbuffer.h', + subdir : 'freedreno' +) + +pkg.generate( + name : 'libdrm_freedreno', + libraries : libdrm_freedreno, + subdirs : ['.', 'libdrm', 'freedreno'], + version : '0.7', + requires_private : 'libdrm', + description : 'Userspace interface to freedreno kernel DRM services', +) + +test( + 'freedreno-symbol-check', + prog_bash, + args : [files('freedreno-symbol-check'), libdrm_freedreno] +) diff --git a/intel/meson.build b/intel/meson.build new file mode 100644 index 00000000..ad877274 --- /dev/null +++ b/intel/meson.build @@ -0,0 +1,105 @@ +# Copyright © 2017-2018 Intel Corporation + +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: + +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +libdrm_intel = shared_library( + 'drm_intel', + [ + files( + 'intel_bufmgr.c', 'intel_bufmgr_fake.c', 'intel_bufmgr_gem.c', + 'intel_decode.c', 'mm.c', + ), + config_file, + ], + include_directories : [inc_root, inc_drm], + link_with : libdrm, + dependencies : [dep_pciaccess, dep_pthread_stubs, dep_rt, dep_valgrind], + c_args : warn_c_args, + version : '1.0.0', + install : true, +) + +ext_libdrm_intel = declare_dependency( + link_with : [libdrm, libdrm_intel], + include_directories : [inc_drm, include_directories('.')], +) + +install_headers( + 'intel_bufmgr.h', 'intel_aub.h', 'intel_debug.h', + subdir : 'libdrm', +) + +pkg.generate( + name : 'libdrm_intel', + libraries : libdrm_intel, + subdirs : ['.', 'libdrm'], + version : meson.project_version(), + requires : 'libdrm', + description : 'Userspace interface to intel kernel DRM services', +) + +test_decode = executable( + 'test_decode', + files('test_decode.c'), + include_directories : [inc_root, inc_drm], + link_with : [libdrm, libdrm_intel], + c_args : warn_c_args, +) + +test( + 'gen4-3d.batch', + prog_bash, + args : files('tests/gen4-3d.batch.sh'), + workdir : meson.current_build_dir(), +) +test( + 'gen45-3d.batch', + prog_bash, + args : files('tests/gm45-3d.batch.sh'), + workdir : meson.current_build_dir(), +) +test( + 'gen5-3d.batch', + prog_bash, + args : files('tests/gen5-3d.batch.sh'), + workdir : meson.current_build_dir(), +) +test( + 'gen6-3d.batch', + prog_bash, + args : files('tests/gen6-3d.batch.sh'), + workdir : meson.current_build_dir(), +) +test( + 'gen7-3d.batch', + prog_bash, + args : files('tests/gen7-3d.batch.sh'), + workdir : meson.current_build_dir(), +) +test( + 'gen7-2d-copy.batch', + prog_bash, + args : files('tests/gen7-2d-copy.batch.sh'), + workdir : meson.current_build_dir(), +) +test( + 'intel-symbol-check', + prog_bash, + args : [files('intel-symbol-check'), libdrm_intel] +) diff --git a/libkms/meson.build b/libkms/meson.build new file mode 100644 index 00000000..9eff4313 --- /dev/null +++ b/libkms/meson.build @@ -0,0 +1,74 @@ +# Copyright © 2017-2018 Intel Corporation + +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: + +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +libkms_include = [inc_root, inc_drm] +files_libkms = files( + 'linux.c', + 'dumb.c', + 'api.c', +) +if with_vmwgfx + files_libkms += files('vmwgfx.c') +endif +if with_intel + files_libkms += files('intel.c') +endif +if with_nouveau + files_libkms += files('nouveau.c') +endif +if with_radeon + files_libkms += files('radeon.c') +endif +if with_exynos + files_libkms += files('exynos.c') + libkms_include += include_directories('../exynos') +endif + +libkms = shared_library( + 'kms', + [files_libkms, config_file], + c_args : warn_c_args, + include_directories : libkms_include, + link_with : libdrm, + version : '1.0.0', + install : true, +) + +ext_libkms = declare_dependency( + link_with : [libdrm, libkms], + include_directories : [libkms_include], +) + +install_headers('libkms.h', subdir : 'libkms') + +pkg.generate( + name : 'libkms', + libraries : libkms, + subdirs : ['libkms'], + version : '1.0.0', + requires_private : 'libdrm', + description : 'Library that abstracts away the different mm interfaces for kernel drivers', +) + +test( + 'kms-symbol-check', + prog_bash, + args : [files('kms-symbol-check'), libkms] +) diff --git a/man/meson.build b/man/meson.build new file mode 100644 index 00000000..45eaeda0 --- /dev/null +++ b/man/meson.build @@ -0,0 +1,67 @@ +# Copyright © 2017-2018 Intel Corporation + +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: + +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +xsltproc_args = [ + '--stringparam', 'man.authors.section.enabled', '0', + '--stringparam', 'man.copyright.section.enabled', '0', + '--stringparam', 'funcsynopsis.style', 'ansi', + '--stringparam', 'man.output.quietly', '1', + '--nonet', manpage_style, +] + +xmls = [ + ['drm', '7'], ['drm-kms', '7'], ['drm-memory', '7'], ['drmAvailable', '3'], + ['drmHandleEvent', '3'], ['drmModeGetResources', '3'] +] +foreach x : xmls + m = x[0] + s = x[1] + custom_target( + m, + input : files('@0@.xml'.format(m)), + output : '@0@.@1@'.format(m, s), + command : [prog_xslt, '-o', '@OUTPUT@', xsltproc_args, '@INPUT0@'], + install : true, + install_dir : join_paths(get_option('mandir'), 'man@0@'.format(s)), + build_by_default : true, + ) +endforeach + +foreach x : ['drm-mm', 'drm-gem', 'drm-ttm'] + gen = custom_target( + 'gen-@0@'.format(x), + input : 'drm-memory.xml', + output : '@0@.xml'.format(x), + command : [ + prog_sed, '-e', 's@^\.so \([a-z_]\+\)\.\([0-9]\)$$@\.so man\2\/\1\.\2@', + '@INPUT@', + ], + capture : true, + ) + custom_target( + '@0@.7'.format(x), + input : gen, + output : '@0@.7'.format(x, '7'), + command : [prog_xslt, '-o', '@OUTPUT@', xsltproc_args, '@INPUT@'], + install : true, + install_dir : join_paths(get_option('mandir'), 'man7'), + build_by_default : true, + ) +endforeach diff --git a/meson.build b/meson.build new file mode 100644 index 00000000..05566081 --- /dev/null +++ b/meson.build @@ -0,0 +1,367 @@ +# Copyright © 2017-2018 Intel Corporation + +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: + +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +project( + 'libdrm', + ['c'], + version : '2.4.89', + license : 'MIT', + meson_version : '>= 0.42', + default_options : ['buildtype=debugoptimized', 'c_std=gnu99'], +) + +pkg = import('pkgconfig') + +with_udev = get_option('udev') +with_freedreno_kgsl = get_option('freedreno-kgsl') +with_install_tests = get_option('install-test-programs') +with_cairo_tests = get_option('cairo-tests') +with_valgrind = get_option('valgrind') + +config = configuration_data() + +# TODO: openbsd is guess, the others are correct +if ['freebsd', 'dragonfly', 'netbsd', 'openbsd'].contains(host_machine.system()) + dep_pthread_stubs = dependency('pthread-stubs', version : '>= 0.4') +else + dep_pthread_stubs = [] +endif +dep_threads = dependency('threads') + +cc = meson.get_compiler('c') + +# Check for atomics +intel_atomics = false +lib_atomics = false + +if cc.compiles(''' + int atomic_add(int *i) { return __sync_add_and_fetch (i, 1); } + int atomic_cmpxchg(int *i, int j, int k) { return __sync_val_compare_and_swap (i, j, k); } + ''', + name : 'Intel Atomics') + intel_atomics = true + with_atomics = true +elif cc.has_header('atomic_ops.h') + lib_atomics = true + with_atomics = true +elif cc.has_function('atomic_cas_uint') + with_atomics = true +else + with_atomics = false +endif + +config.set10('HAVE_LIBDRM_ATOMIC_PRIMITIVES', intel_atomics) +config.set10('HAVE_LIB_ATOMIC_OPS', lib_atomics) + +with_intel = false +_intel = get_option('intel') +if _intel != 'false' + if _intel == 'true' and not with_atomics + error('libdrm_intel requires atomics.') + else + with_intel = _intel == 'true' or host_machine.cpu_family().startswith('x86') + endif +endif + +with_radeon = false +_radeon = get_option('radeon') +if _radeon != 'false' + if _radeon == 'true' and not with_atomics + error('libdrm_radeon requires atomics.') + endif + with_radeon = true +endif + +with_amdgpu = false +_amdgpu = get_option('amdgpu') +if _amdgpu != 'false' + if _amdgpu == 'true' and not with_atomics + error('libdrm_amdgpu requires atomics.') + endif + with_amdgpu = true +endif + +with_nouveau = false +_nouveau = get_option('nouveau') +if _nouveau != 'false' + if _nouveau == 'true' and not with_atomics + error('libdrm_nouveau requires atomics.') + endif + with_nouveau = true +endif + +with_vmwgfx = false +_vmwgfx = get_option('vmwgfx') +if _vmwgfx != 'false' + with_vmwgfx = true +endif + +with_omap = false +_omap = get_option('omap') +if _omap == 'true' + if not with_atomics + error('libdrm_omap requires atomics.') + endif + with_omap = true +endif + +with_freedreno = false +_freedreno = get_option('freedreno') +if _freedreno != 'false' + if _freedreno == 'true' and not with_atomics + error('libdrm_freedreno requires atomics.') + else + with_freedreno = _freedreno == 'true' or ['arm', 'aarch64'].contains(host_machine.cpu_family()) + endif +endif + +with_tegra = false +_tegra = get_option('tegra') +if _tegra == 'true' + if not with_atomics + error('libdrm_tegra requires atomics.') + endif + with_tegra = true +endif + +with_etnaviv = false +_etnaviv = get_option('etnaviv') +if _etnaviv == 'true' + if not with_atomics + error('libdrm_etnaviv requires atomics.') + endif + with_etnaviv = true +endif + +with_exynos = get_option('exynos') == 'true' + +with_vc4 = false +_vc4 = get_option('vc4') +if _vc4 != 'false' + with_vc4 = _vc4 == 'true' or ['arm', 'aarch64'].contains(host_machine.cpu_family()) +endif + +# XXX: Aparently only freebsd and dragonfly bsd actually need this (and +# gnu/kfreebsd), not openbsd and netbsd +with_libkms = false +_libkms = get_option('libkms') +if _libkms != 'false' + with_libkms = _libkms == 'true' or ['linux', 'freebsd', 'dragonfly'].contains(host_machine.system()) +endif + +if with_udev + dep_udev = dependency('udev') + config.set10('UDEV', true) +else + dep_udev = [] +endif + +# Among others FreeBSD does not have a separate dl library. +if not cc.has_function('dlsym') + dep_dl = cc.find_library('dl', required : with_nouveau) +else + dep_dl = [] +endif +# clock_gettime might require -rt, or it might not. find out +if not cc.has_function('clock_gettime', prefix : '#define _GNU_SOURCE\n#include ') + # XXX: untested + dep_rt = cc.find_library('rt') +else + dep_rt = [] +endif +dep_m = cc.find_library('m', required : false) +if cc.has_header('sys/sysctl.h') + config.set10('HAVE_SYS_SYSCTL_H', true) +endif +if cc.has_header('sys/select.h') + config.set10('HAVE_SYS_SELECT_H', true) +endif +if cc.has_header_symbol('sys/sysmacros.h', 'major') + config.set10('MAJOR_IN_SYSMACROS', true) +elif cc.has_header_symbol('sys/mkdev.h', 'major') + config.set10('MAJOR_IN_MKDEV', true) +endif +if cc.has_function('open_memstream') + config.set10('HAVE_OPEN_MEMSTREAM', true) +endif + +warn_c_args = [] +foreach a : ['-Wall', '-Wextra', '-Wsign-compare', + '-Werror-implicit-function-declaration', '-Wpointer-arith', + '-Wwrite-strings', '-Wstrict-prototypes', '-Wmissing-prototypes', + '-Wmissing-declarations', '-Wnested-externs', '-Wpacked', + '-Wswitch-enum', '-Wmissing-format-attribute', + '-Wstrict-aliasing=2', '-Winit-self', '-Winline', '-Wshadow', + '-Wdeclaration-after-statement', '-Wold-style-definition'] + if cc.has_argument(a) + warn_c_args += a + endif +endforeach +# GCC will never error for -Wno-*, so check for -W* then add -Wno-* to the list +# of options +foreach a : ['unused-parameter', 'attributes', 'long-long', + 'missing-field-initializers'] + if cc.has_argument('-W@0@'.format(a)) + warn_c_args += '-Wno-@0@'.format(a) + endif +endforeach + + +dep_pciaccess = dependency('pciaccess', version : '>= 0.10', required : with_intel) +dep_cunit = dependency('cunit', version : '>= 2.1', required : false) +dep_cairo = dependency('cairo', required : with_cairo_tests == 'true') +dep_valgrind = dependency('valgrind', required : with_valgrind == 'true') + +with_man_pages = get_option('man-pages') +prog_xslt = find_program('xsltproc', required : with_man_pages == 'true') +prog_sed = find_program('sed', required : with_man_pages == 'true') +manpage_style = 'http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl' +if prog_xslt.found() + if run_command(prog_xslt, '--nonet', manpage_style).returncode() != 0 + if with_man_pages == 'true' + error('Manpage style sheet cannot be found') + endif + with_man_pages = 'false' + endif +endif +with_man_pages = with_man_pages != 'false' and prog_xslt.found() and prog_sed.found() + +# Used for tets +prog_bash = find_program('bash') + +if cc.compiles('''int foo_hidden(void) __attribute__((visibility(("hidden"))));''', + name : 'compiler supports __attribute__(("hidden"))') + config.set10('HAVE_VISIBILITY', true) +endif + +foreach t : [[with_intel, 'INTEL'], [with_vmwgfx, 'VMWGFX'], + [with_nouveau, 'NOUVEAU'], [with_omap, 'OMAP'], + [with_exynos, 'EXYNOS'], [with_freedreno, 'FREEDRENO'], + [with_tegra, 'TEGRA'], [with_vc4, 'VC4'], + [with_etnaviv, 'ETNAVIV']] + if t[0] + config.set10('HAVE_@0@'.format(t[1]), true) + endif +endforeach +if with_freedreno_kgsl + if not with_freedreno + error('cannot enable freedreno-kgsl without freedreno support') + endif + config.set10('HAVE_FREEDRENO_KGSL', true) +endif +if dep_cairo.found() + config.set10('HAVE_CAIRO', true) +endif +if dep_valgrind.found() + config.set10('HAVE_VALGRIND', true) +endif + +config.set10('_GNU_SOURCE', true) +config_file = configure_file( + configuration : config, + output : 'config.h', +) +add_project_arguments('-DHAVE_CONFIG_H', language : 'c') + +inc_root = include_directories('.') +inc_drm = include_directories('include/drm') + +libdrm = shared_library( + 'drm', + [files( + 'xf86drm.c', 'xf86drmHash.c', 'xf86drmRandom.c', 'xf86drmSL.c', + 'xf86drmMode.c' + ), + config_file, + ], + c_args : warn_c_args, + dependencies : [dep_udev, dep_valgrind, dep_rt, dep_m], + include_directories : inc_drm, + version : '2.4.0', + install : true, +) + +ext_libdrm = declare_dependency( + link_with : libdrm, + include_directories : inc_drm, +) + +install_headers('libsync.h', 'xf86drm.h', 'xf86drmMode.h') +install_headers( + 'include/drm/drm.h', 'include/drm/drm_fourcc.h', 'include/drm/drm_mode.h', + 'include/drm/drm_sarea.h', 'include/drm/i915_drm.h', + 'include/drm/mach64_drm.h', 'include/drm/mga_drm.h', + 'include/drm/nouveau_drm.h', 'include/drm/qxl_drm.h', + 'include/drm/r128_drm.h', 'include/drm/radeon_drm.h', + 'include/drm/amdgpu_drm.h', 'include/drm/savage_drm.h', + 'include/drm/sis_drm.h', 'include/drm/tegra_drm.h', 'include/drm/vc4_drm.h', + 'include/drm/via_drm.h', 'include/drm/virtgpu_drm.h', + subdir : 'libdrm', +) +if with_vmwgfx + install_headers('include/drm/vmwgfx_drm.h', subdir : 'libdrm') +endif + +pkg.generate( + name : 'libdrm', + libraries : libdrm, + subdirs : ['.', 'libdrm'], + version : meson.project_version(), + description : 'Userspace interface to kernel DRM services', +) + +if with_libkms + subdir('libkms') +endif +if with_intel + subdir('intel') +endif +if with_nouveau + subdir('nouveau') +endif +if with_radeon + subdir('radeon') +endif +if with_amdgpu + subdir('amdgpu') +endif +if with_omap + subdir('omap') +endif +if with_exynos + subdir('exynos') +endif +if with_freedreno + subdir('freedreno') +endif +if with_tegra + subdir('tegra') +endif +if with_vc4 + subdir('vc4') +endif +if with_etnaviv + subdir('etnaviv') +endif +if with_man_pages + subdir('man') +endif +subdir('data') +subdir('tests') diff --git a/meson_options.txt b/meson_options.txt new file mode 100644 index 00000000..8af33f1c --- /dev/null +++ b/meson_options.txt @@ -0,0 +1,143 @@ +# Copyright © 2017 Intel Corporation + +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: + +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +option( + 'libkms', + type : 'combo', + value : 'auto', + choices : ['true', 'false', 'auto'], + description : 'Build libkms mm abstraction library.', +) +option( + 'intel', + type : 'combo', + value : 'auto', + choices : ['true', 'false', 'auto'], + description : '''Enable support for Intel's KMS API.''', +) +option( + 'radeon', + type : 'combo', + value : 'auto', + choices : ['true', 'false', 'auto'], + description : '''Enable support for radeons's KMS API.''', +) +option( + 'amdgpu', + type : 'combo', + value : 'auto', + choices : ['true', 'false', 'auto'], + description : '''Enable support for amdgpu's KMS API.''', +) +option( + 'nouveau', + type : 'combo', + value : 'auto', + choices : ['true', 'false', 'auto'], + description : '''Enable support for nouveau's KMS API.''', +) +option( + 'vmwgfx', + type : 'combo', + value : 'true', + choices : ['true', 'false', 'auto'], + description : '''Enable support for vmgfx's KMS API.''', +) +option( + 'omap', + type : 'combo', + value : 'false', + choices : ['true', 'false', 'auto'], + description : '''Enable support for OMAP's experimental KMS API.''', +) +option( + 'exynos', + type : 'combo', + value : 'false', + choices : ['true', 'false', 'auto'], + description : '''Enable support for EXYNOS's experimental KMS API.''', +) +option( + 'freedreno', + type : 'combo', + value : 'auto', + choices : ['true', 'false', 'auto'], + description : '''Enable support for freedreno's KMS API.''', +) +option( + 'tegra', + type : 'combo', + value : 'false', + choices : ['true', 'false', 'auto'], + description : '''Enable support for Tegra's experimental KMS API.''', +) +option( + 'vc4', + type : 'combo', + value : 'auto', + choices : ['true', 'false', 'auto'], + description : '''Enable support for vc4's KMS API.''', +) +option( + 'etnaviv', + type : 'combo', + value : 'false', + choices : ['true', 'false', 'auto'], + description : '''Enable support for etnaviv's experimental KMS API.''', +) +option( + 'cairo-tests', + type : 'combo', + value : 'auto', + choices : ['true', 'false', 'auto'], + description : 'Enable support for Cairo rendering in tests.', +) +option( + 'man-pages', + type : 'combo', + value : 'auto', + choices : ['true', 'false', 'auto'], + description : 'Enable manpage generation and installation.', +) +option( + 'valgrind', + type : 'combo', + value : 'auto', + choices : ['true', 'false', 'auto'], + description : 'Build libdrm with valgrind support.', +) +option( + 'freedreno-kgsl', + type : 'boolean', + value : false, + description : 'Enable support for freedreno to use downstream android kernel API.', +) +option( + 'install-test-programs', + type : 'boolean', + value : false, + description : 'Install test programs.', +) +option( + 'udev', + type : 'boolean', + value : false, + description : 'Enable support for using udev instead of mknod.', +) diff --git a/nouveau/meson.build b/nouveau/meson.build new file mode 100644 index 00000000..bfecf84b --- /dev/null +++ b/nouveau/meson.build @@ -0,0 +1,58 @@ +# Copyright © 2017-2018 Intel Corporation + +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: + +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + + +libdrm_nouveau = shared_library( + 'drm_nouveau', + [files( 'nouveau.c', 'pushbuf.c', 'bufctx.c', 'abi16.c'), config_file], + c_args : warn_c_args, + include_directories : [inc_root, inc_drm], + link_with : libdrm, + dependencies : dep_threads, + version : '2.0.0', + install : true, +) + +ext_libdrm_nouveau = declare_dependency( + link_with : [libdrm, libdrm_nouveau], + include_directories : [inc_drm, include_directories('.')], +) + +install_headers('nouveau.h', subdir : 'libdrm/nouveau') +install_headers( + 'nvif/class.h', 'nvif/cl0080.h', 'nvif/cl9097.h', 'nvif/if0002.h', + 'nvif/if0003.h', 'nvif/ioctl.h', 'nvif/unpack.h', + subdir : 'libdrm/nouveau/nvif' +) + +pkg.generate( + name : 'libdrm_nouveau', + libraries : libdrm_nouveau, + subdirs : ['.', 'nouveau'], + version : meson.project_version(), + requires_private : 'libdrm', + description : 'Userspace interface to nouveau kernel DRM services', +) + +test( + 'nouveau-symbol-check', + prog_bash, + args : [files('nouveau-symbol-check'), libdrm_nouveau] +) diff --git a/omap/meson.build b/omap/meson.build new file mode 100644 index 00000000..1881087f --- /dev/null +++ b/omap/meson.build @@ -0,0 +1,53 @@ +# Copyright © 2017 Intel Corporation + +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: + +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +libdrm_omap = shared_library( + 'drm_omap', + [files('omap_drm.c'), config_file], + include_directories : [inc_root, inc_drm], + c_args : warn_c_args, + link_with : libdrm, + dependencies : [dep_pthread_stubs], + version : '1.0.0', + install : true, +) + +ext_libdrm_omap = declare_dependency( + link_with : [libdrm, libdrm_omap], + include_directories : [inc_drm, include_directories('.')], +) + +install_headers('omap_drmif.h', subdir : 'libdrm') +install_headers('omap_drm.h', subdir : 'omap') + +pkg.generate( + name : 'libdrm_omap', + libraries : libdrm_omap, + subdirs : ['.', 'libdrm', 'omap'], + version : '0.6', + requires_private : 'libdrm', + description : 'Userspace interface to omap kernel DRM services', +) + +test( + 'omap-symbol-check', + prog_bash, + args : [files('omap-symbol-check'), libdrm_omap] +) diff --git a/radeon/meson.build b/radeon/meson.build new file mode 100644 index 00000000..b02166fe --- /dev/null +++ b/radeon/meson.build @@ -0,0 +1,63 @@ +# Copyright © 2017-2018 Intel Corporation + +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: + +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + + +libdrm_radeon = shared_library( + 'drm_radeon', + [ + files( + 'radeon_bo_gem.c', 'radeon_cs_gem.c', 'radeon_cs_space.c', 'radeon_bo.c', + 'radeon_cs.c', 'radeon_surface.c', + ), + config_file, + ], + c_args : warn_c_args, + include_directories : [inc_root, inc_drm], + link_with : libdrm, + dependencies : [dep_pthread_stubs], + version : '1.0.1', + install : true, +) + +ext_libdrm_radeon = declare_dependency( + link_with : [libdrm, libdrm_radeon], + include_directories : [inc_drm, include_directories('.')], +) + +install_headers( + 'radeon_bo.h', 'radeon_cs.h', 'radeon_surface.h', 'radeon_bo_gem.h', + 'radeon_cs_gem.h', 'radeon_bo_int.h', 'radeon_cs_int.h', 'r600_pci_ids.h', + subdir : 'libdrm' +) + +pkg.generate( + name : 'libdrm_radeon', + libraries : libdrm_radeon, + subdirs : ['.', 'libdrm'], + version : meson.project_version(), + requires_private : 'libdrm', + description : 'Userspace interface to kernel DRM services for radeon', +) + +test( + 'radeon-symbol-check', + prog_bash, + args : [files('radeon-symbol-check'), libdrm_radeon] +) diff --git a/tegra/meson.build b/tegra/meson.build new file mode 100644 index 00000000..99fdd194 --- /dev/null +++ b/tegra/meson.build @@ -0,0 +1,52 @@ +# Copyright © 2017-2018 Intel Corporation + +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: + +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +libdrm_tegra = shared_library( + 'drm_tegra', + [files('tegra.c'), config_file], + include_directories : [inc_root, inc_drm], + link_with : libdrm, + dependencies : [dep_pthread_stubs], + c_args : warn_c_args, + version : '0.0.0', + install : true, +) + +ext_libdrm_tegra = declare_dependency( + link_with : [libdrm, libdrm_tegra], + include_directories : [inc_drm, include_directories('.')], +) + +install_headers('tegra.h', subdir : 'libdrm') + +pkg.generate( + name : 'libdrm_tegra', + libraries : libdrm_tegra, + subdirs : ['.', 'libdrm'], + version : meson.project_version(), + requires_private : 'libdrm', + description : 'Userspace interface to Tegra kernel DRM services', +) + +test( + 'tegra-symbol-check', + prog_bash, + args : [files('tegra-symbol-check'), libdrm_tegra] +) diff --git a/tests/amdgpu/meson.build b/tests/amdgpu/meson.build new file mode 100644 index 00000000..4c1237c6 --- /dev/null +++ b/tests/amdgpu/meson.build @@ -0,0 +1,34 @@ +# Copyright © 2017-2018 Intel Corporation + +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: + +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +if dep_cunit.found() + amdgpu_test = executable( + 'amdgpu_test', + files( + 'amdgpu_test.c', 'basic_tests.c', 'bo_tests.c', 'cs_tests.c', + 'vce_tests.c', 'uvd_enc_tests.c', 'vcn_tests.c', 'deadlock_tests.c', + 'vm_tests.c', + ), + dependencies : [dep_cunit, dep_threads], + include_directories : [inc_root, inc_drm, include_directories('../../amdgpu')], + link_with : [libdrm, libdrm_amdgpu], + install : with_install_tests, + ) +endif diff --git a/tests/etnaviv/meson.build b/tests/etnaviv/meson.build new file mode 100644 index 00000000..8b4a3cfb --- /dev/null +++ b/tests/etnaviv/meson.build @@ -0,0 +1,45 @@ +# Copyright © 2017-2018 Intel Corporation + +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: + +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +inc_etnaviv_tests = [inc_root, inc_drm, include_directories('../../etnaviv')] + +etnaviv_2d_test = executable( + 'etnaviv_2d_test', + files('etnaviv_2d_test.c', 'write_bmp.c'), + include_directories : inc_etnaviv_tests, + link_with : [libdrm, libdrm_etnaviv], + install : with_install_tests, +) + +etnaviv_cmd_stream_test = executable( + 'etnaviv_cmd_stream_test', + files('etnaviv_cmd_stream_test.c'), + include_directories : inc_etnaviv_tests, + link_with : [libdrm, libdrm_etnaviv], + install : with_install_tests, +) + +etnaviv_bo_cache_test = executable( + 'etnaviv_bo_cache_test', + files('etnaviv_bo_cache_test.c'), + include_directories : inc_etnaviv_tests, + link_with : [libdrm, libdrm_etnaviv], + install : with_install_tests, +) diff --git a/tests/exynos/meson.build b/tests/exynos/meson.build new file mode 100644 index 00000000..940c3ce4 --- /dev/null +++ b/tests/exynos/meson.build @@ -0,0 +1,54 @@ +# Copyright © 2017 Intel Corporation + +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: + +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +inc_exynos = include_directories('../../exynos') + +if with_libkms + exynos_fimg2d_test = executable( + 'exynos_fimg2d_test', + files('exynos_fimg2d_test.c'), + c_args : warn_c_args, + include_directories : [inc_root, inc_drm, inc_exynos, + include_directories('../../libkms')], + link_with : [libdrm, libkms, libdrm_exynos], + dependencies : dep_threads, + install : with_install_tests, + ) +endif + +exynos_fimg2d_perf = executable( + 'exynos_fimg2d_perf', + files('exynos_fimg2d_perf.c'), + c_args : warn_c_args, + include_directories : [inc_root, inc_drm, inc_exynos], + link_with : [libdrm, libdrm_exynos], + dependencies : dep_threads, + install : with_install_tests, +) + +exynos_fimg2d_event = executable( + 'exynos_fimg2d_event', + files('exynos_fimg2d_event.c'), + c_args : warn_c_args, + include_directories : [inc_root, inc_drm, inc_exynos], + link_with : [libdrm, libdrm_exynos], + dependencies : dep_threads, + install : with_install_tests, +) diff --git a/tests/kms/meson.build b/tests/kms/meson.build new file mode 100644 index 00000000..1f7f724d --- /dev/null +++ b/tests/kms/meson.build @@ -0,0 +1,49 @@ +# Copyright © 2017-2018 Intel Corporation + +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: + +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + + +libkms_test = static_library( + 'kms-test', + files( + 'libkms-test-crtc.c', 'libkms-test-device.c', 'libkms-test-framebuffer.c', + 'libkms-test-plane.c', 'libkms-test-screen.c', + ), + include_directories : [inc_root, inc_tests, inc_drm], + link_with : libdrm, + c_args : warn_c_args, +) + +kms_steal_crtc = executable( + 'kms-steal-crtc', + files('kms-steal-crtc.c'), + dependencies : dep_cairo, + include_directories : [inc_root, inc_tests, inc_drm], + link_with : [libkms_test, libutil], + install : with_install_tests, +) + +kms_universal_planes = executable( + 'kms-universal-planes', + files('kms-universal-planes.c'), + dependencies : dep_cairo, + include_directories : [inc_root, inc_tests, inc_drm], + link_with : [libkms_test], + install : with_install_tests, +) diff --git a/tests/kmstest/meson.build b/tests/kmstest/meson.build new file mode 100644 index 00000000..a47d4951 --- /dev/null +++ b/tests/kmstest/meson.build @@ -0,0 +1,30 @@ +# Copyright © 2017 Intel Corporation + +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: + +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +kmstest = executable( + 'kmstest', + files('main.c'), + c_args : warn_c_args, + include_directories : [ + inc_root, inc_tests, include_directories('../../libkms'), inc_drm, + ], + link_with : [libutil, libkms, libdrm], + install : with_install_tests, +) diff --git a/tests/meson.build b/tests/meson.build new file mode 100644 index 00000000..fdf950b7 --- /dev/null +++ b/tests/meson.build @@ -0,0 +1,86 @@ +# Copyright © 2017-2018 Intel Corporation + +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: + +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +inc_tests = include_directories('.') + +subdir('util') +subdir('kms') +subdir('modeprint') +subdir('proptest') +subdir('modetest') +subdir('vbltest') +if with_libkms + subdir('kmstest') +endif +if with_radeon + subdir('radeon') +endif +if with_amdgpu + subdir('amdgpu') +endif +if with_exynos + subdir('exynos') +endif +if with_tegra + subdir('tegra') +endif +if with_etnaviv + subdir('etnaviv') +endif +if with_nouveau + subdir('nouveau') +endif + +drmsl = executable( + 'drmsl', + files('drmsl.c'), + include_directories : [inc_root, inc_drm], + link_with : libdrm, + c_args : warn_c_args, +) + +hash = executable( + 'hash', + files('hash.c'), + include_directories : [inc_root, inc_drm], + link_with : libdrm, + c_args : warn_c_args, +) + +random = executable( + 'random', + files('random.c'), + include_directories : [inc_root, inc_drm], + link_with : libdrm, + c_args : warn_c_args, +) + +drmdevice = executable( + 'drmdevice', + files('drmdevice.c'), + include_directories : [inc_root, inc_drm], + link_with : libdrm, + c_args : warn_c_args, +) + +test('random', random, timeout : 240) +test('hash', hash) +test('drmsl', drmsl) +test('drmdevice', drmdevice) diff --git a/tests/modeprint/meson.build b/tests/modeprint/meson.build new file mode 100644 index 00000000..5f0eb24b --- /dev/null +++ b/tests/modeprint/meson.build @@ -0,0 +1,29 @@ +# Copyright © 2017 Intel Corporation + +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: + +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +modeprint = executable( + 'modeprint', + files('modeprint.c'), + c_args : warn_c_args, + include_directories : [inc_root, inc_tests, inc_drm], + link_with : libdrm, + dependencies : dep_threads, + install : with_install_tests, +) diff --git a/tests/modetest/meson.build b/tests/modetest/meson.build new file mode 100644 index 00000000..2a081845 --- /dev/null +++ b/tests/modetest/meson.build @@ -0,0 +1,29 @@ +# Copyright © 2018 Intel Corporation + +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: + +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +modetest = executable( + 'modetest', + files('buffers.c', 'cursor.c', 'modetest.c'), + c_args : [warn_c_args, '-Wno-pointer-arith'], + include_directories : [inc_root, inc_tests, inc_drm], + dependencies : [dep_threads, dep_cairo], + link_with : [libdrm, libutil], + install : with_install_tests, +) diff --git a/tests/nouveau/meson.build b/tests/nouveau/meson.build new file mode 100644 index 00000000..f5d73c1e --- /dev/null +++ b/tests/nouveau/meson.build @@ -0,0 +1,30 @@ +# Copyright © 2017 Intel Corporation + +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: + +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +threaded = executable( + 'threaded', + files('threaded.c'), + dependencies : [dep_dl, dep_threads], + include_directories : [inc_root, inc_drm, include_directories('../../nouveau')], + link_with : [libdrm, libdrm_nouveau], + c_args : warn_c_args, +) + +test('threaded', threaded) diff --git a/tests/proptest/meson.build b/tests/proptest/meson.build new file mode 100644 index 00000000..22d7473e --- /dev/null +++ b/tests/proptest/meson.build @@ -0,0 +1,28 @@ +# Copyright © 2017 Intel Corporation + +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: + +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +proptest = executable( + 'proptest', + files('proptest.c'), + c_args : warn_c_args, + include_directories : [inc_root, inc_tests, inc_drm], + link_with : [libdrm, libutil], + install : with_install_tests, +) diff --git a/tests/radeon/meson.build b/tests/radeon/meson.build new file mode 100644 index 00000000..9e4f916e --- /dev/null +++ b/tests/radeon/meson.build @@ -0,0 +1,27 @@ +# Copyright © 2017 Intel Corporation + +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: + +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +radeon_ttm = executable( + 'radeon_ttm', + files('rbo.c', 'radeon_ttm.c'), + include_directories : [inc_root, inc_drm], + link_with : libdrm, + c_args : warn_c_args, +) diff --git a/tests/tegra/meson.build b/tests/tegra/meson.build new file mode 100644 index 00000000..9c74ac4a --- /dev/null +++ b/tests/tegra/meson.build @@ -0,0 +1,27 @@ +# Copyright © 2017 Intel Corporation + +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: + +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +openclose = executable( + 'openclose', + files('openclose.c'), + include_directories : [inc_root, inc_drm, include_directories('../../tegra')], + c_args : warn_c_args, + link_with : [libdrm, libdrm_tegra], +) diff --git a/tests/util/meson.build b/tests/util/meson.build new file mode 100644 index 00000000..7fa1a4b7 --- /dev/null +++ b/tests/util/meson.build @@ -0,0 +1,28 @@ +# Copyright © 2017-2018 Intel Corporation + +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: + +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + + +libutil = static_library( + 'util', + [files('format.c', 'kms.c', 'pattern.c'), config_file], + include_directories : [inc_root, inc_drm], + link_with : libdrm, + dependencies : dep_cairo +) diff --git a/tests/vbltest/meson.build b/tests/vbltest/meson.build new file mode 100644 index 00000000..ae52ab88 --- /dev/null +++ b/tests/vbltest/meson.build @@ -0,0 +1,28 @@ +# Copyright © 2017-2018 Intel Corporation + +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: + +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +vbltest = executable( + 'vbltest', + files('vbltest.c'), + c_args : warn_c_args, + include_directories : [inc_root, inc_tests, inc_drm], + link_with : [libdrm, libutil], + install : with_install_tests, +) diff --git a/vc4/meson.build b/vc4/meson.build new file mode 100644 index 00000000..0136987b --- /dev/null +++ b/vc4/meson.build @@ -0,0 +1,28 @@ +# Copyright © 2017 Intel Corporation + +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: + +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +install_headers('vc4_packet.h', 'vc4_qpu_defines.h', subdir : 'libdrm') + +pkg.generate( + name : 'libdrm_vc4', + version : meson.project_version(), + requires_private : 'libdrm', + description : 'Userspace interface to vc4 kernel DRM services', +) -- cgit v1.2.3-54-g00ecf From 7e28d73af018d02b5e1827769d61e04f73e50d69 Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Fri, 12 Jan 2018 11:51:17 -0800 Subject: meson: set proper pkg-config version for libdrm_freedreno Copy and paste error from exynos. Signed-off-by: Dylan Baker Reviewed-by: Emil Velikov Reviewed-by: Eric Engestrom --- freedreno/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'freedreno') diff --git a/freedreno/meson.build b/freedreno/meson.build index b4035e19..de6a413f 100644 --- a/freedreno/meson.build +++ b/freedreno/meson.build @@ -64,7 +64,7 @@ pkg.generate( name : 'libdrm_freedreno', libraries : libdrm_freedreno, subdirs : ['.', 'libdrm', 'freedreno'], - version : '0.7', + version : meson.project_version(), requires_private : 'libdrm', description : 'Userspace interface to freedreno kernel DRM services', ) -- cgit v1.2.3-54-g00ecf From 6f0f6cee5e9be1dcf816c144e05d26352c85a9e8 Mon Sep 17 00:00:00 2001 From: Rob Clark Date: Wed, 24 Jan 2018 15:08:46 -0500 Subject: freedreno: clamp priority based on # of rings In case of a kernel that is new enough to support multiple submit- queues, but with an adreno generation which doesn't support multiple prioritized ringbuffers, we'd attempt to open a submit-queue with prio=1 (medium), which is rejected by the kernel. This could happen either w/ an older mesa (which uses fd_pipe_new()) or a newer mesa which defaults to prio=1 if no pipe context priority flags are set. The simple answer to fix both cases is to clamp the requested priority according to the number of rings. This might not do exactly what you want, if we hypothetically had 2 rings (it would result in requested medium priority being high priority instead of low priority). But the number of rings (for hw gen's that support this) is purely a software construct, so the easy answer there is to have the kernel advertise at least 3 rings if it supports more than one. There isn't really any reason to do otherwise. Signed-off-by: Rob Clark --- freedreno/freedreno_priv.h | 2 +- freedreno/msm/msm_pipe.c | 28 +++++++++++++++++----------- 2 files changed, 18 insertions(+), 12 deletions(-) (limited to 'freedreno') diff --git a/freedreno/freedreno_priv.h b/freedreno/freedreno_priv.h index 27307472..199ccb94 100644 --- a/freedreno/freedreno_priv.h +++ b/freedreno/freedreno_priv.h @@ -49,6 +49,7 @@ #include "xf86atomic.h" #include "util_double_list.h" +#include "util_math.h" #include "freedreno_drmif.h" #include "freedreno_ringbuffer.h" @@ -173,7 +174,6 @@ struct fd_bo { time_t free_time; /* time when added to bucket-list */ }; -#define ALIGN(v,a) (((v) + (a) - 1) & ~((a) - 1)) #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) #define enable_debug 0 /* TODO make dynamic */ diff --git a/freedreno/msm/msm_pipe.c b/freedreno/msm/msm_pipe.c index 7395e573..12e4be59 100644 --- a/freedreno/msm/msm_pipe.c +++ b/freedreno/msm/msm_pipe.c @@ -100,42 +100,48 @@ static int msm_pipe_wait(struct fd_pipe *pipe, uint32_t timestamp, return 0; } -static int open_submitqueue(struct fd_device *dev, uint32_t prio, - uint32_t *queue_id) +static int open_submitqueue(struct fd_pipe *pipe, uint32_t prio) { struct drm_msm_submitqueue req = { .flags = 0, .prio = prio, }; + uint64_t nr_rings = 1; int ret; - if (fd_device_version(dev) < FD_VERSION_SUBMIT_QUEUES) { - *queue_id = 0; + if (fd_device_version(pipe->dev) < FD_VERSION_SUBMIT_QUEUES) { + to_msm_pipe(pipe)->queue_id = 0; return 0; } - ret = drmCommandWriteRead(dev->fd, DRM_MSM_SUBMITQUEUE_NEW, &req, sizeof(req)); + msm_pipe_get_param(pipe, FD_NR_RINGS, &nr_rings); + + req.prio = MIN2(req.prio, MAX2(nr_rings, 1) - 1); + + ret = drmCommandWriteRead(pipe->dev->fd, DRM_MSM_SUBMITQUEUE_NEW, + &req, sizeof(req)); if (ret) { ERROR_MSG("could not create submitqueue! %d (%s)", ret, strerror(errno)); return ret; } - *queue_id = req.id; + to_msm_pipe(pipe)->queue_id = req.id; return 0; } -static void close_submitqueue(struct fd_device *dev, uint32_t queue_id) +static void close_submitqueue(struct fd_pipe *pipe, uint32_t queue_id) { - if (fd_device_version(dev) < FD_VERSION_SUBMIT_QUEUES) + if (fd_device_version(pipe->dev) < FD_VERSION_SUBMIT_QUEUES) return; - drmCommandWrite(dev->fd, DRM_MSM_SUBMITQUEUE_CLOSE, &queue_id, sizeof(queue_id)); + drmCommandWrite(pipe->dev->fd, DRM_MSM_SUBMITQUEUE_CLOSE, + &queue_id, sizeof(queue_id)); } static void msm_pipe_destroy(struct fd_pipe *pipe) { struct msm_pipe *msm_pipe = to_msm_pipe(pipe); - close_submitqueue(pipe->dev, msm_pipe->queue_id); + close_submitqueue(pipe, msm_pipe->queue_id); free(msm_pipe); } @@ -193,7 +199,7 @@ drm_private struct fd_pipe * msm_pipe_new(struct fd_device *dev, INFO_MSG(" Chip-id: 0x%08x", msm_pipe->chip_id); INFO_MSG(" GMEM size: 0x%08x", msm_pipe->gmem); - if (open_submitqueue(dev, prio, &msm_pipe->queue_id)) + if (open_submitqueue(pipe, prio)) goto fail; return pipe; -- cgit v1.2.3-54-g00ecf From ec53f4808c8ccd73cd2dbed8b53a4e961e3a2b76 Mon Sep 17 00:00:00 2001 From: Eric Engestrom Date: Fri, 26 Jan 2018 15:19:03 +0000 Subject: always define HAVE_FREEDRENO_KGSL Signed-off-by: Eric Engestrom Reviewed-by: Emil Velikov Reviewed-by: Dylan Baker --- configure.ac | 2 ++ freedreno/freedreno_bo.c | 2 +- freedreno/freedreno_device.c | 2 +- meson.build | 8 +++----- 4 files changed, 7 insertions(+), 7 deletions(-) (limited to 'freedreno') diff --git a/configure.ac b/configure.ac index 32ceba69..e19fdc99 100644 --- a/configure.ac +++ b/configure.ac @@ -395,6 +395,8 @@ fi AM_CONDITIONAL(HAVE_FREEDRENO_KGSL, [test "x$FREEDRENO_KGSL" = xyes]) if test "x$FREEDRENO_KGSL" = xyes; then AC_DEFINE(HAVE_FREEDRENO_KGSL, 1, [Have freedreno support for KGSL kernel interface]) +else + AC_DEFINE(HAVE_FREEDRENO_KGSL, 0) fi AM_CONDITIONAL(HAVE_RADEON, [test "x$RADEON" = xyes]) diff --git a/freedreno/freedreno_bo.c b/freedreno/freedreno_bo.c index 7f8ea59c..df35c36a 100644 --- a/freedreno/freedreno_bo.c +++ b/freedreno/freedreno_bo.c @@ -326,7 +326,7 @@ void fd_bo_cpu_fini(struct fd_bo *bo) bo->funcs->cpu_fini(bo); } -#ifndef HAVE_FREEDRENO_KGSL +#if !HAVE_FREEDRENO_KGSL struct fd_bo * fd_bo_from_fbdev(struct fd_pipe *pipe, int fbfd, uint32_t size) { return NULL; diff --git a/freedreno/freedreno_device.c b/freedreno/freedreno_device.c index 12b95fd0..a0334bf4 100644 --- a/freedreno/freedreno_device.c +++ b/freedreno/freedreno_device.c @@ -65,7 +65,7 @@ struct fd_device * fd_device_new(int fd) dev = msm_device_new(fd); dev->version = version->version_minor; -#ifdef HAVE_FREEDRENO_KGSL +#if HAVE_FREEDRENO_KGSL } else if (!strcmp(version->name, "kgsl")) { DEBUG_MSG("kgsl DRM device"); dev = kgsl_device_new(fd); diff --git a/meson.build b/meson.build index 7298f741..c7245dda 100644 --- a/meson.build +++ b/meson.build @@ -255,14 +255,12 @@ foreach t : [[with_intel, 'INTEL'], [with_vmwgfx, 'VMWGFX'], [with_nouveau, 'NOUVEAU'], [with_exynos, 'EXYNOS'], [with_vc4, 'VC4'], + [with_freedreno_kgsl, 'FREEDRENO_KGSL'], [with_radeon, 'RADEON']] config.set10('HAVE_@0@'.format(t[1]), t[0]) endforeach -if with_freedreno_kgsl - if not with_freedreno - error('cannot enable freedreno-kgsl without freedreno support') - endif - config.set10('HAVE_FREEDRENO_KGSL', true) +if with_freedreno_kgsl and not with_freedreno + error('cannot enable freedreno-kgsl without freedreno support') endif if dep_cairo.found() config.set10('HAVE_CAIRO', true) -- cgit v1.2.3-54-g00ecf From 1d7bbf852094481a8f514ed786b7a7a8af67e5fe Mon Sep 17 00:00:00 2001 From: Eric Engestrom Date: Fri, 26 Jan 2018 15:08:39 +0000 Subject: always define HAVE_VALGRIND Signed-off-by: Eric Engestrom Reviewed-by: Emil Velikov Reviewed-by: Dylan Baker --- configure.ac | 2 ++ freedreno/freedreno_priv.h | 2 +- intel/intel_bufmgr_gem.c | 4 ++-- meson.build | 5 +---- 4 files changed, 6 insertions(+), 7 deletions(-) (limited to 'freedreno') diff --git a/configure.ac b/configure.ac index 993c2a27..a0246fe5 100644 --- a/configure.ac +++ b/configure.ac @@ -509,6 +509,8 @@ if test "x$VALGRIND" = "xyes"; then AC_MSG_ERROR([Valgrind support required but not present]) fi AC_DEFINE([HAVE_VALGRIND], 1, [Use valgrind intrinsics to suppress false warnings]) +else + AC_DEFINE([HAVE_VALGRIND], 0) fi AC_MSG_RESULT([$VALGRIND]) diff --git a/freedreno/freedreno_priv.h b/freedreno/freedreno_priv.h index 199ccb94..81ad6092 100644 --- a/freedreno/freedreno_priv.h +++ b/freedreno/freedreno_priv.h @@ -200,7 +200,7 @@ offset_bytes(void *end, void *start) return ((char *)end) - ((char *)start); } -#ifdef HAVE_VALGRIND +#if HAVE_VALGRIND # include /* diff --git a/intel/intel_bufmgr_gem.c b/intel/intel_bufmgr_gem.c index 71f140f5..386da30e 100644 --- a/intel/intel_bufmgr_gem.c +++ b/intel/intel_bufmgr_gem.c @@ -66,7 +66,7 @@ #include "i915_drm.h" #include "uthash.h" -#ifdef HAVE_VALGRIND +#if HAVE_VALGRIND #include #include #define VG(x) x @@ -1629,7 +1629,7 @@ int drm_intel_gem_bo_map_unsynchronized(drm_intel_bo *bo) { drm_intel_bufmgr_gem *bufmgr_gem = (drm_intel_bufmgr_gem *) bo->bufmgr; -#ifdef HAVE_VALGRIND +#if HAVE_VALGRIND drm_intel_bo_gem *bo_gem = (drm_intel_bo_gem *) bo; #endif int ret; diff --git a/meson.build b/meson.build index 15a1d405..76a081a9 100644 --- a/meson.build +++ b/meson.build @@ -257,16 +257,13 @@ foreach t : [[with_intel, 'INTEL'], [with_vmwgfx, 'VMWGFX'], [with_vc4, 'VC4'], [with_freedreno_kgsl, 'FREEDRENO_KGSL'], [dep_cairo.found(), 'CAIRO'], + [dep_valgrind.found(), 'VALGRIND'], [with_radeon, 'RADEON']] config.set10('HAVE_@0@'.format(t[1]), t[0]) endforeach if with_freedreno_kgsl and not with_freedreno error('cannot enable freedreno-kgsl without freedreno support') endif -if dep_valgrind.found() - config.set10('HAVE_VALGRIND', true) -endif - config.set10('_GNU_SOURCE', true) config_file = configure_file( configuration : config, -- cgit v1.2.3-54-g00ecf From 4f08bfe96da1542f336589edf310d06ebce3cf20 Mon Sep 17 00:00:00 2001 From: Heiko Becker Date: Mon, 19 Feb 2018 15:13:15 +0000 Subject: *-symbol-check: Don't hard-code nm executable Helpful if your nm executable has a prefix based on the architecture, for example. Signed-off-by: Heiko Becker Cc: Timo Gurr [Eric: v2: rebase and add Meson support] Signed-off-by: Eric Engestrom Reviewed-by: Eric Anholt Reviewed-by: Emil Velikov --- amdgpu/amdgpu-symbol-check | 2 +- amdgpu/meson.build | 1 + configure.ac | 1 + exynos/exynos-symbol-check | 2 +- exynos/meson.build | 1 + freedreno/freedreno-symbol-check | 2 +- freedreno/meson.build | 1 + intel/intel-symbol-check | 2 +- intel/meson.build | 1 + libkms/kms-symbol-check | 2 +- libkms/meson.build | 1 + meson.build | 3 +++ nouveau/meson.build | 1 + nouveau/nouveau-symbol-check | 2 +- omap/meson.build | 1 + omap/omap-symbol-check | 2 +- radeon/meson.build | 1 + radeon/radeon-symbol-check | 2 +- tegra/meson.build | 1 + tegra/tegra-symbol-check | 2 +- 20 files changed, 22 insertions(+), 9 deletions(-) (limited to 'freedreno') diff --git a/amdgpu/amdgpu-symbol-check b/amdgpu/amdgpu-symbol-check index 17de0c3b..90b7a1d6 100755 --- a/amdgpu/amdgpu-symbol-check +++ b/amdgpu/amdgpu-symbol-check @@ -3,7 +3,7 @@ # The following symbols (past the first five) are taken from the public headers. # A list of the latter should be available Makefile.am/libdrm_amdgpuinclude_HEADERS -FUNCS=$(nm -D --format=bsd --defined-only ${1-.libs/libdrm_amdgpu.so} | awk '{print $3}' | while read func; do +FUNCS=$($NM -D --format=bsd --defined-only ${1-.libs/libdrm_amdgpu.so} | awk '{print $3}' | while read func; do ( grep -q "^$func$" || echo $func ) < --- freedreno/freedreno_bo.c | 10 ++++++++++ freedreno/freedreno_drmif.h | 3 +++ freedreno/freedreno_priv.h | 1 + freedreno/msm/msm_bo.c | 13 +++++++++++++ 4 files changed, 27 insertions(+) (limited to 'freedreno') diff --git a/freedreno/freedreno_bo.c b/freedreno/freedreno_bo.c index df35c36a..331b8227 100644 --- a/freedreno/freedreno_bo.c +++ b/freedreno/freedreno_bo.c @@ -195,6 +195,16 @@ out_unlock: return bo; } +uint64_t fd_bo_get_iova(struct fd_bo *bo) +{ + return bo->funcs->iova(bo); +} + +void fd_bo_put_iova(struct fd_bo *bo) +{ + /* currently a no-op */ +} + struct fd_bo * fd_bo_ref(struct fd_bo *bo) { atomic_inc(&bo->refcnt); diff --git a/freedreno/freedreno_drmif.h b/freedreno/freedreno_drmif.h index c3b0d02a..2711518b 100644 --- a/freedreno/freedreno_drmif.h +++ b/freedreno/freedreno_drmif.h @@ -95,6 +95,7 @@ enum fd_version { FD_VERSION_UNLIMITED_CMDS = 1, /* submits w/ >4 cmd buffers (growable ringbuffer) */ FD_VERSION_FENCE_FD = 2, /* submit command supports in/out fences */ FD_VERSION_SUBMIT_QUEUES = 3, /* submit queues and multiple priority levels */ + FD_VERSION_BO_IOVA = 3, /* supports fd_bo_get/put_iova() */ }; enum fd_version fd_device_version(struct fd_device *dev); @@ -123,6 +124,8 @@ struct fd_bo *fd_bo_from_handle(struct fd_device *dev, uint32_t handle, uint32_t size); struct fd_bo * fd_bo_from_name(struct fd_device *dev, uint32_t name); struct fd_bo * fd_bo_from_dmabuf(struct fd_device *dev, int fd); +uint64_t fd_bo_get_iova(struct fd_bo *bo); +void fd_bo_put_iova(struct fd_bo *bo); struct fd_bo * fd_bo_ref(struct fd_bo *bo); void fd_bo_del(struct fd_bo *bo); int fd_bo_get_name(struct fd_bo *bo, uint32_t *name); diff --git a/freedreno/freedreno_priv.h b/freedreno/freedreno_priv.h index 81ad6092..a0957fad 100644 --- a/freedreno/freedreno_priv.h +++ b/freedreno/freedreno_priv.h @@ -157,6 +157,7 @@ struct fd_bo_funcs { int (*cpu_prep)(struct fd_bo *bo, struct fd_pipe *pipe, uint32_t op); void (*cpu_fini)(struct fd_bo *bo); int (*madvise)(struct fd_bo *bo, int willneed); + uint64_t (*iova)(struct fd_bo *bo); void (*destroy)(struct fd_bo *bo); }; diff --git a/freedreno/msm/msm_bo.c b/freedreno/msm/msm_bo.c index 72471df6..281c5aa7 100644 --- a/freedreno/msm/msm_bo.c +++ b/freedreno/msm/msm_bo.c @@ -108,6 +108,18 @@ static int msm_bo_madvise(struct fd_bo *bo, int willneed) return req.retained; } +static uint64_t msm_bo_iova(struct fd_bo *bo) +{ + struct drm_msm_gem_info req = { + .handle = bo->handle, + .flags = MSM_INFO_IOVA, + }; + + drmCommandWriteRead(bo->dev->fd, DRM_MSM_GEM_INFO, &req, sizeof(req)); + + return req.offset; +} + static void msm_bo_destroy(struct fd_bo *bo) { struct msm_bo *msm_bo = to_msm_bo(bo); @@ -120,6 +132,7 @@ static const struct fd_bo_funcs funcs = { .cpu_prep = msm_bo_cpu_prep, .cpu_fini = msm_bo_cpu_fini, .madvise = msm_bo_madvise, + .iova = msm_bo_iova, .destroy = msm_bo_destroy, }; -- cgit v1.2.3-54-g00ecf From 28370370afb2b291a2cfe6a5478a29d9a1b1c28f Mon Sep 17 00:00:00 2001 From: Eric Engestrom Date: Tue, 6 Mar 2018 15:37:55 +0000 Subject: freedreno: add missing symbols to symbol-check Fixes: 1384c081233751569473 "freedreno: add interface to get buffer address" Signed-off-by: Eric Engestrom Reviewed-by: Emil Velikov Reviewed-by: Christian Gmeiner --- freedreno/freedreno-symbol-check | 2 ++ 1 file changed, 2 insertions(+) (limited to 'freedreno') diff --git a/freedreno/freedreno-symbol-check b/freedreno/freedreno-symbol-check index 56e3d3ee..3b119528 100755 --- a/freedreno/freedreno-symbol-check +++ b/freedreno/freedreno-symbol-check @@ -18,10 +18,12 @@ fd_bo_from_dmabuf fd_bo_from_fbdev fd_bo_from_handle fd_bo_from_name +fd_bo_get_iova fd_bo_get_name fd_bo_handle fd_bo_map fd_bo_new +fd_bo_put_iova fd_bo_ref fd_bo_size fd_device_del -- cgit v1.2.3-54-g00ecf From 5236de6cc1ee3759567e0fd8cd6260386b8d5b7e Mon Sep 17 00:00:00 2001 From: Eric Engestrom Date: Wed, 7 Feb 2018 14:20:52 +0000 Subject: meson: use pkg-config to detect libatomic_ops Signed-off-by: Eric Engestrom Reviewed-by: Emil Velikov --- amdgpu/meson.build | 2 +- etnaviv/meson.build | 2 +- freedreno/meson.build | 2 +- intel/meson.build | 2 +- meson.build | 4 +++- nouveau/meson.build | 2 +- omap/meson.build | 2 +- radeon/meson.build | 2 +- tegra/meson.build | 2 +- 9 files changed, 11 insertions(+), 9 deletions(-) (limited to 'freedreno') diff --git a/amdgpu/meson.build b/amdgpu/meson.build index 518b8504..f39d7bf6 100644 --- a/amdgpu/meson.build +++ b/amdgpu/meson.build @@ -37,7 +37,7 @@ libdrm_amdgpu = shared_library( ], include_directories : [inc_root, inc_drm], link_with : libdrm, - dependencies : dep_pthread_stubs, + dependencies : [dep_pthread_stubs, dep_atomic_ops], version : '1.0.0', install : true, ) diff --git a/etnaviv/meson.build b/etnaviv/meson.build index 1767733b..ca2aa544 100644 --- a/etnaviv/meson.build +++ b/etnaviv/meson.build @@ -31,7 +31,7 @@ libdrm_etnaviv = shared_library( include_directories : [inc_root, inc_drm], link_with : libdrm, c_args : warn_c_args, - dependencies : [dep_pthread_stubs, dep_rt], + dependencies : [dep_pthread_stubs, dep_rt, dep_atomic_ops], version : '1.0.0', install : true, ) diff --git a/freedreno/meson.build b/freedreno/meson.build index 741b3b6a..015b7fb1 100644 --- a/freedreno/meson.build +++ b/freedreno/meson.build @@ -44,7 +44,7 @@ libdrm_freedreno = shared_library( [files_freedreno, config_file], c_args : warn_c_args, include_directories : [inc_root, inc_drm], - dependencies : [dep_valgrind, dep_pthread_stubs, dep_rt], + dependencies : [dep_valgrind, dep_pthread_stubs, dep_rt, dep_atomic_ops], link_with : libdrm, version : '1.0.0', install : true, diff --git a/intel/meson.build b/intel/meson.build index aa5a1349..53c7fce4 100644 --- a/intel/meson.build +++ b/intel/meson.build @@ -29,7 +29,7 @@ libdrm_intel = shared_library( ], include_directories : [inc_root, inc_drm], link_with : libdrm, - dependencies : [dep_pciaccess, dep_pthread_stubs, dep_rt, dep_valgrind], + dependencies : [dep_pciaccess, dep_pthread_stubs, dep_rt, dep_valgrind, dep_atomic_ops], c_args : warn_c_args, version : '1.0.0', install : true, diff --git a/meson.build b/meson.build index c803f709..df6f2bd2 100644 --- a/meson.build +++ b/meson.build @@ -48,6 +48,7 @@ cc = meson.get_compiler('c') intel_atomics = false lib_atomics = false +dep_atomic_ops = dependency('atomic_ops', required : false) if cc.compiles(''' int atomic_add(int *i) { return __sync_add_and_fetch (i, 1); } int atomic_cmpxchg(int *i, int j, int k) { return __sync_val_compare_and_swap (i, j, k); } @@ -55,7 +56,8 @@ if cc.compiles(''' name : 'Intel Atomics') intel_atomics = true with_atomics = true -elif cc.has_header('atomic_ops.h') + dep_atomic_ops = [] +elif dep_atomic_ops.found() lib_atomics = true with_atomics = true elif cc.has_function('atomic_cas_uint') diff --git a/nouveau/meson.build b/nouveau/meson.build index 80a8678c..51c9a712 100644 --- a/nouveau/meson.build +++ b/nouveau/meson.build @@ -25,7 +25,7 @@ libdrm_nouveau = shared_library( c_args : warn_c_args, include_directories : [inc_root, inc_drm], link_with : libdrm, - dependencies : dep_threads, + dependencies : [dep_threads, dep_atomic_ops], version : '2.0.0', install : true, ) diff --git a/omap/meson.build b/omap/meson.build index 8adb2213..e57b8f5d 100644 --- a/omap/meson.build +++ b/omap/meson.build @@ -24,7 +24,7 @@ libdrm_omap = shared_library( include_directories : [inc_root, inc_drm], c_args : warn_c_args, link_with : libdrm, - dependencies : [dep_pthread_stubs], + dependencies : [dep_pthread_stubs, dep_atomic_ops], version : '1.0.0', install : true, ) diff --git a/radeon/meson.build b/radeon/meson.build index a4171b41..b08c7442 100644 --- a/radeon/meson.build +++ b/radeon/meson.build @@ -31,7 +31,7 @@ libdrm_radeon = shared_library( c_args : warn_c_args, include_directories : [inc_root, inc_drm], link_with : libdrm, - dependencies : [dep_pthread_stubs], + dependencies : [dep_pthread_stubs, dep_atomic_ops], version : '1.0.1', install : true, ) diff --git a/tegra/meson.build b/tegra/meson.build index 7c671cd5..1f5c74b3 100644 --- a/tegra/meson.build +++ b/tegra/meson.build @@ -23,7 +23,7 @@ libdrm_tegra = shared_library( [files('tegra.c'), config_file], include_directories : [inc_root, inc_drm], link_with : libdrm, - dependencies : [dep_pthread_stubs], + dependencies : [dep_pthread_stubs, dep_atomic_ops], c_args : warn_c_args, version : '0.0.0', install : true, -- cgit v1.2.3-54-g00ecf From 0926f0af54d654b1a95826066edcae30b8052581 Mon Sep 17 00:00:00 2001 From: Eric Engestrom Date: Thu, 1 Feb 2018 11:12:05 +0000 Subject: meson,configure: include config.h automatically This will prevent any more missing `#include "config.h"` bug, at the cost of having to recompile some files that didn't need to be when changing build options. Signed-off-by: Eric Engestrom Reviewed-by: Emil Velikov --- amdgpu/amdgpu_asic_id.c | 4 ---- amdgpu/amdgpu_bo.c | 4 ---- amdgpu/amdgpu_cs.c | 4 ---- amdgpu/amdgpu_device.c | 4 ---- amdgpu/amdgpu_gpu_info.c | 4 ---- amdgpu/amdgpu_internal.h | 4 ---- amdgpu/amdgpu_vamgr.c | 4 ---- amdgpu/amdgpu_vm.c | 4 ---- amdgpu/util_hash.c | 4 ---- amdgpu/util_hash.h | 4 ---- amdgpu/util_hash_table.c | 4 ---- amdgpu/util_hash_table.h | 4 ---- configure.ac | 2 ++ etnaviv/etnaviv_bo.c | 4 ---- etnaviv/etnaviv_bo_cache.c | 4 ---- etnaviv/etnaviv_cmd_stream.c | 4 ---- etnaviv/etnaviv_device.c | 4 ---- etnaviv/etnaviv_gpu.c | 4 ---- etnaviv/etnaviv_perfmon.c | 4 ---- etnaviv/etnaviv_pipe.c | 4 ---- exynos/exynos_drm.c | 4 ---- exynos/exynos_fimg2d.c | 4 ---- freedreno/freedreno_bo.c | 4 ---- freedreno/freedreno_bo_cache.c | 4 ---- freedreno/freedreno_device.c | 4 ---- freedreno/freedreno_pipe.c | 4 ---- freedreno/freedreno_priv.h | 4 ---- freedreno/freedreno_ringbuffer.c | 4 ---- freedreno/kgsl/kgsl_bo.c | 4 ---- freedreno/kgsl/kgsl_device.c | 4 ---- freedreno/kgsl/kgsl_pipe.c | 4 ---- freedreno/kgsl/kgsl_ringbuffer.c | 4 ---- freedreno/msm/msm_bo.c | 4 ---- freedreno/msm/msm_device.c | 4 ---- freedreno/msm/msm_pipe.c | 4 ---- freedreno/msm/msm_ringbuffer.c | 4 ---- intel/intel_bufmgr.c | 4 ---- intel/intel_bufmgr_fake.c | 4 ---- intel/intel_bufmgr_gem.c | 4 ---- intel/intel_decode.c | 4 ---- intel/mm.c | 4 ---- intel/mm.h | 4 ---- intel/test_decode.c | 4 ---- libkms/api.c | 4 ---- libkms/dumb.c | 4 ---- libkms/exynos.c | 4 ---- libkms/intel.c | 4 ---- libkms/internal.h | 4 ---- libkms/linux.c | 4 ---- libkms/nouveau.c | 4 ---- libkms/radeon.c | 4 ---- libkms/vmwgfx.c | 4 ---- meson.build | 2 +- nouveau/abi16.c | 4 ---- nouveau/bufctx.c | 4 ---- nouveau/nouveau.c | 4 ---- nouveau/pushbuf.c | 4 ---- omap/omap_drm.c | 4 ---- radeon/radeon_bo.c | 3 --- radeon/radeon_bo_gem.c | 3 --- radeon/radeon_cs.c | 3 --- radeon/radeon_cs_gem.c | 3 --- radeon/radeon_cs_space.c | 3 --- radeon/radeon_surface.c | 3 --- tegra/tegra.c | 4 ---- tests/amdgpu/amdgpu_test.c | 4 ---- tests/amdgpu/basic_tests.c | 4 ---- tests/amdgpu/bo_tests.c | 4 ---- tests/amdgpu/cs_tests.c | 4 ---- tests/amdgpu/deadlock_tests.c | 4 ---- tests/amdgpu/uvd_enc_tests.c | 4 ---- tests/amdgpu/vce_tests.c | 4 ---- tests/amdgpu/vcn_tests.c | 4 ---- tests/amdgpu/vm_tests.c | 4 ---- tests/etnaviv/etnaviv_2d_test.c | 4 ---- tests/etnaviv/etnaviv_bo_cache_test.c | 4 ---- tests/exynos/exynos_fimg2d_test.c | 4 ---- tests/kms/kms-steal-crtc.c | 4 ---- tests/kms/kms-universal-planes.c | 4 ---- tests/kms/libkms-test-crtc.c | 4 ---- tests/kms/libkms-test-device.c | 4 ---- tests/kms/libkms-test-framebuffer.c | 4 ---- tests/kms/libkms-test-plane.c | 4 ---- tests/kms/libkms-test-screen.c | 4 ---- tests/modetest/buffers.c | 4 ---- tests/modetest/cursor.c | 4 ---- tests/modetest/modetest.c | 4 ---- tests/nouveau/threaded.c | 4 ---- tests/tegra/openclose.c | 4 ---- tests/util/format.c | 4 ---- tests/util/kms.c | 4 ---- tests/util/pattern.c | 4 ---- tests/vbltest/vbltest.c | 4 ---- xf86atomic.h | 4 ---- xf86drm.c | 3 --- xf86drmMode.c | 4 ---- 96 files changed, 3 insertions(+), 370 deletions(-) (limited to 'freedreno') diff --git a/amdgpu/amdgpu_asic_id.c b/amdgpu/amdgpu_asic_id.c index 62459c09..a5007ffc 100644 --- a/amdgpu/amdgpu_asic_id.c +++ b/amdgpu/amdgpu_asic_id.c @@ -22,10 +22,6 @@ * */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include #include #include diff --git a/amdgpu/amdgpu_bo.c b/amdgpu/amdgpu_bo.c index 3853fd03..cb255cb0 100644 --- a/amdgpu/amdgpu_bo.c +++ b/amdgpu/amdgpu_bo.c @@ -22,10 +22,6 @@ * */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include #include #include diff --git a/amdgpu/amdgpu_cs.c b/amdgpu/amdgpu_cs.c index 4ac9bac7..3c9be6c2 100644 --- a/amdgpu/amdgpu_cs.c +++ b/amdgpu/amdgpu_cs.c @@ -21,10 +21,6 @@ * */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include #include #include diff --git a/amdgpu/amdgpu_device.c b/amdgpu/amdgpu_device.c index fb2cfb57..d81efcf8 100644 --- a/amdgpu/amdgpu_device.c +++ b/amdgpu/amdgpu_device.c @@ -28,10 +28,6 @@ * */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include #include #include diff --git a/amdgpu/amdgpu_gpu_info.c b/amdgpu/amdgpu_gpu_info.c index 1efffc6f..b68e1c4f 100644 --- a/amdgpu/amdgpu_gpu_info.c +++ b/amdgpu/amdgpu_gpu_info.c @@ -22,10 +22,6 @@ * */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include #include diff --git a/amdgpu/amdgpu_internal.h b/amdgpu/amdgpu_internal.h index aeb5d651..99b8ce0b 100644 --- a/amdgpu/amdgpu_internal.h +++ b/amdgpu/amdgpu_internal.h @@ -25,10 +25,6 @@ #ifndef _AMDGPU_INTERNAL_H_ #define _AMDGPU_INTERNAL_H_ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include #include diff --git a/amdgpu/amdgpu_vamgr.c b/amdgpu/amdgpu_vamgr.c index ac1202de..1de9f952 100644 --- a/amdgpu/amdgpu_vamgr.c +++ b/amdgpu/amdgpu_vamgr.c @@ -21,10 +21,6 @@ * */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include #include #include diff --git a/amdgpu/amdgpu_vm.c b/amdgpu/amdgpu_vm.c index 5ba7c082..da9d07f8 100644 --- a/amdgpu/amdgpu_vm.c +++ b/amdgpu/amdgpu_vm.c @@ -21,10 +21,6 @@ * */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include "amdgpu.h" #include "amdgpu_drm.h" #include "xf86drm.h" diff --git a/amdgpu/util_hash.c b/amdgpu/util_hash.c index 87cb671b..7e590419 100644 --- a/amdgpu/util_hash.c +++ b/amdgpu/util_hash.c @@ -30,10 +30,6 @@ * Zack Rusin */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include "util_hash.h" #include diff --git a/amdgpu/util_hash.h b/amdgpu/util_hash.h index 01a4779b..6eed1569 100644 --- a/amdgpu/util_hash.h +++ b/amdgpu/util_hash.h @@ -44,10 +44,6 @@ #ifndef UTIL_HASH_H #define UTIL_HASH_H -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include #include "libdrm_macros.h" diff --git a/amdgpu/util_hash_table.c b/amdgpu/util_hash_table.c index fa7f6eab..89a8bf9b 100644 --- a/amdgpu/util_hash_table.c +++ b/amdgpu/util_hash_table.c @@ -38,10 +38,6 @@ */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include "util_hash_table.h" #include "util_hash.h" diff --git a/amdgpu/util_hash_table.h b/amdgpu/util_hash_table.h index e0001289..5e295a81 100644 --- a/amdgpu/util_hash_table.h +++ b/amdgpu/util_hash_table.h @@ -34,10 +34,6 @@ #ifndef U_HASH_TABLE_H_ #define U_HASH_TABLE_H_ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include "libdrm_macros.h" /** diff --git a/configure.ac b/configure.ac index 0e36336c..619af497 100644 --- a/configure.ac +++ b/configure.ac @@ -541,6 +541,8 @@ else AC_DEFINE(HAVE_VISIBILITY, 0) fi +CFLAGS="$CFLAGS -include config.h" + AC_SUBST(WARN_CFLAGS) AC_CONFIG_FILES([ Makefile diff --git a/etnaviv/etnaviv_bo.c b/etnaviv/etnaviv_bo.c index 78b9cd27..32f7b348 100644 --- a/etnaviv/etnaviv_bo.c +++ b/etnaviv/etnaviv_bo.c @@ -24,10 +24,6 @@ * Christian Gmeiner */ -#ifdef HAVE_CONFIG_H -# include -#endif - #include "etnaviv_priv.h" #include "etnaviv_drmif.h" diff --git a/etnaviv/etnaviv_bo_cache.c b/etnaviv/etnaviv_bo_cache.c index 6208230d..c81de262 100644 --- a/etnaviv/etnaviv_bo_cache.c +++ b/etnaviv/etnaviv_bo_cache.c @@ -24,10 +24,6 @@ * Christian Gmeiner */ -#ifdef HAVE_CONFIG_H -# include -#endif - #include "etnaviv_priv.h" #include "etnaviv_drmif.h" diff --git a/etnaviv/etnaviv_cmd_stream.c b/etnaviv/etnaviv_cmd_stream.c index e8c58cd5..13730168 100644 --- a/etnaviv/etnaviv_cmd_stream.c +++ b/etnaviv/etnaviv_cmd_stream.c @@ -24,10 +24,6 @@ * Christian Gmeiner */ -#ifdef HAVE_CONFIG_H -# include -#endif - #include #include "etnaviv_drmif.h" diff --git a/etnaviv/etnaviv_device.c b/etnaviv/etnaviv_device.c index 3ce92030..d83e8d3e 100644 --- a/etnaviv/etnaviv_device.c +++ b/etnaviv/etnaviv_device.c @@ -24,10 +24,6 @@ * Christian Gmeiner */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include #include #include diff --git a/etnaviv/etnaviv_gpu.c b/etnaviv/etnaviv_gpu.c index bc355e8f..f7efa028 100644 --- a/etnaviv/etnaviv_gpu.c +++ b/etnaviv/etnaviv_gpu.c @@ -24,10 +24,6 @@ * Christian Gmeiner */ -#ifdef HAVE_CONFIG_H -# include -#endif - #include "etnaviv_priv.h" #include "etnaviv_drmif.h" diff --git a/etnaviv/etnaviv_perfmon.c b/etnaviv/etnaviv_perfmon.c index aa5130a6..5f408a7b 100644 --- a/etnaviv/etnaviv_perfmon.c +++ b/etnaviv/etnaviv_perfmon.c @@ -25,10 +25,6 @@ * Christian Gmeiner */ -#ifdef HAVE_CONFIG_H -# include -#endif - #include "etnaviv_priv.h" static int etna_perfmon_query_signals(struct etna_perfmon *pm, struct etna_perfmon_domain *dom) diff --git a/etnaviv/etnaviv_pipe.c b/etnaviv/etnaviv_pipe.c index 94c5d377..53954aa3 100644 --- a/etnaviv/etnaviv_pipe.c +++ b/etnaviv/etnaviv_pipe.c @@ -24,10 +24,6 @@ * Christian Gmeiner */ -#ifdef HAVE_CONFIG_H -# include -#endif - #include "etnaviv_priv.h" int etna_pipe_wait(struct etna_pipe *pipe, uint32_t timestamp, uint32_t ms) diff --git a/exynos/exynos_drm.c b/exynos/exynos_drm.c index f6204f1c..e1afef65 100644 --- a/exynos/exynos_drm.c +++ b/exynos/exynos_drm.c @@ -24,10 +24,6 @@ * Inki Dae */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include #include #include diff --git a/exynos/exynos_fimg2d.c b/exynos/exynos_fimg2d.c index 5658a48e..bca884b9 100644 --- a/exynos/exynos_fimg2d.c +++ b/exynos/exynos_fimg2d.c @@ -23,10 +23,6 @@ * OTHER DEALINGS IN THE SOFTWARE. */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include #include #include diff --git a/freedreno/freedreno_bo.c b/freedreno/freedreno_bo.c index 331b8227..34c285fb 100644 --- a/freedreno/freedreno_bo.c +++ b/freedreno/freedreno_bo.c @@ -26,10 +26,6 @@ * Rob Clark */ -#ifdef HAVE_CONFIG_H -# include -#endif - #include "freedreno_drmif.h" #include "freedreno_priv.h" diff --git a/freedreno/freedreno_bo_cache.c b/freedreno/freedreno_bo_cache.c index d922f3a9..3b737159 100644 --- a/freedreno/freedreno_bo_cache.c +++ b/freedreno/freedreno_bo_cache.c @@ -26,10 +26,6 @@ * Rob Clark */ -#ifdef HAVE_CONFIG_H -# include -#endif - #include "freedreno_drmif.h" #include "freedreno_priv.h" diff --git a/freedreno/freedreno_device.c b/freedreno/freedreno_device.c index a0334bf4..0b42561a 100644 --- a/freedreno/freedreno_device.c +++ b/freedreno/freedreno_device.c @@ -26,10 +26,6 @@ * Rob Clark */ -#ifdef HAVE_CONFIG_H -# include -#endif - #include #include #include diff --git a/freedreno/freedreno_pipe.c b/freedreno/freedreno_pipe.c index 1540474b..77b160e7 100644 --- a/freedreno/freedreno_pipe.c +++ b/freedreno/freedreno_pipe.c @@ -26,10 +26,6 @@ * Rob Clark */ -#ifdef HAVE_CONFIG_H -# include -#endif - #include "freedreno_drmif.h" #include "freedreno_priv.h" diff --git a/freedreno/freedreno_priv.h b/freedreno/freedreno_priv.h index a0957fad..6c9e509f 100644 --- a/freedreno/freedreno_priv.h +++ b/freedreno/freedreno_priv.h @@ -29,10 +29,6 @@ #ifndef FREEDRENO_PRIV_H_ #define FREEDRENO_PRIV_H_ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include #include #include diff --git a/freedreno/freedreno_ringbuffer.c b/freedreno/freedreno_ringbuffer.c index 7310f1fd..3834b51b 100644 --- a/freedreno/freedreno_ringbuffer.c +++ b/freedreno/freedreno_ringbuffer.c @@ -26,10 +26,6 @@ * Rob Clark */ -#ifdef HAVE_CONFIG_H -# include -#endif - #include #include "freedreno_drmif.h" diff --git a/freedreno/kgsl/kgsl_bo.c b/freedreno/kgsl/kgsl_bo.c index ab3485e3..c6d2d499 100644 --- a/freedreno/kgsl/kgsl_bo.c +++ b/freedreno/kgsl/kgsl_bo.c @@ -26,10 +26,6 @@ * Rob Clark */ -#ifdef HAVE_CONFIG_H -# include -#endif - #include "kgsl_priv.h" #include diff --git a/freedreno/kgsl/kgsl_device.c b/freedreno/kgsl/kgsl_device.c index 958e8a72..914f3412 100644 --- a/freedreno/kgsl/kgsl_device.c +++ b/freedreno/kgsl/kgsl_device.c @@ -26,10 +26,6 @@ * Rob Clark */ -#ifdef HAVE_CONFIG_H -# include -#endif - #include #include #include diff --git a/freedreno/kgsl/kgsl_pipe.c b/freedreno/kgsl/kgsl_pipe.c index 80bd1313..0a8b6586 100644 --- a/freedreno/kgsl/kgsl_pipe.c +++ b/freedreno/kgsl/kgsl_pipe.c @@ -26,10 +26,6 @@ * Rob Clark */ -#ifdef HAVE_CONFIG_H -# include -#endif - #include "kgsl_priv.h" diff --git a/freedreno/kgsl/kgsl_ringbuffer.c b/freedreno/kgsl/kgsl_ringbuffer.c index f09c433b..a756deda 100644 --- a/freedreno/kgsl/kgsl_ringbuffer.c +++ b/freedreno/kgsl/kgsl_ringbuffer.c @@ -26,10 +26,6 @@ * Rob Clark */ -#ifdef HAVE_CONFIG_H -# include -#endif - #include #include "freedreno_ringbuffer.h" diff --git a/freedreno/msm/msm_bo.c b/freedreno/msm/msm_bo.c index 281c5aa7..8b3d0bcb 100644 --- a/freedreno/msm/msm_bo.c +++ b/freedreno/msm/msm_bo.c @@ -26,10 +26,6 @@ * Rob Clark */ -#ifdef HAVE_CONFIG_H -# include -#endif - #include "msm_priv.h" static int bo_allocate(struct msm_bo *msm_bo) diff --git a/freedreno/msm/msm_device.c b/freedreno/msm/msm_device.c index c454938d..7bb57677 100644 --- a/freedreno/msm/msm_device.c +++ b/freedreno/msm/msm_device.c @@ -26,10 +26,6 @@ * Rob Clark */ -#ifdef HAVE_CONFIG_H -# include -#endif - #include #include #include diff --git a/freedreno/msm/msm_pipe.c b/freedreno/msm/msm_pipe.c index 12e4be59..f28778ef 100644 --- a/freedreno/msm/msm_pipe.c +++ b/freedreno/msm/msm_pipe.c @@ -26,10 +26,6 @@ * Rob Clark */ -#ifdef HAVE_CONFIG_H -# include -#endif - #include "msm_priv.h" static int query_param(struct fd_pipe *pipe, uint32_t param, diff --git a/freedreno/msm/msm_ringbuffer.c b/freedreno/msm/msm_ringbuffer.c index c75bb169..a87e1b9a 100644 --- a/freedreno/msm/msm_ringbuffer.c +++ b/freedreno/msm/msm_ringbuffer.c @@ -26,10 +26,6 @@ * Rob Clark */ -#ifdef HAVE_CONFIG_H -# include -#endif - #include #include diff --git a/intel/intel_bufmgr.c b/intel/intel_bufmgr.c index a2853400..bede0a21 100644 --- a/intel/intel_bufmgr.c +++ b/intel/intel_bufmgr.c @@ -25,10 +25,6 @@ * */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include #include #include diff --git a/intel/intel_bufmgr_fake.c b/intel/intel_bufmgr_fake.c index 641df6a1..3b24b81b 100644 --- a/intel/intel_bufmgr_fake.c +++ b/intel/intel_bufmgr_fake.c @@ -34,10 +34,6 @@ * the bugs in the old texture manager. */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include #include #include diff --git a/intel/intel_bufmgr_gem.c b/intel/intel_bufmgr_gem.c index 386da30e..5c47a46f 100644 --- a/intel/intel_bufmgr_gem.c +++ b/intel/intel_bufmgr_gem.c @@ -34,10 +34,6 @@ * Dave Airlie */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include #include #include diff --git a/intel/intel_decode.c b/intel/intel_decode.c index 3a81500f..bc7b04b8 100644 --- a/intel/intel_decode.c +++ b/intel/intel_decode.c @@ -21,10 +21,6 @@ * IN THE SOFTWARE. */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include #include #include diff --git a/intel/mm.c b/intel/mm.c index 954e9dcb..79d8719d 100644 --- a/intel/mm.c +++ b/intel/mm.c @@ -22,10 +22,6 @@ * */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include #include diff --git a/intel/mm.h b/intel/mm.h index 8d83743f..1b0f84fc 100644 --- a/intel/mm.h +++ b/intel/mm.h @@ -29,10 +29,6 @@ #ifndef MM_H #define MM_H -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include "libdrm_macros.h" struct mem_block { diff --git a/intel/test_decode.c b/intel/test_decode.c index 68f777b0..b9f5b927 100644 --- a/intel/test_decode.c +++ b/intel/test_decode.c @@ -21,10 +21,6 @@ * IN THE SOFTWARE. */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include #include #include diff --git a/libkms/api.c b/libkms/api.c index 354d8a2e..22dd32d7 100644 --- a/libkms/api.c +++ b/libkms/api.c @@ -26,10 +26,6 @@ **************************************************************************/ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include #include #include diff --git a/libkms/dumb.c b/libkms/dumb.c index b95a072c..17efc10a 100644 --- a/libkms/dumb.c +++ b/libkms/dumb.c @@ -26,10 +26,6 @@ **************************************************************************/ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include #include #include diff --git a/libkms/exynos.c b/libkms/exynos.c index c20b6b05..ef64a668 100644 --- a/libkms/exynos.c +++ b/libkms/exynos.c @@ -25,10 +25,6 @@ * SOFTWARE. */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include #include #include diff --git a/libkms/intel.c b/libkms/intel.c index 3d8ca055..859e7a0f 100644 --- a/libkms/intel.c +++ b/libkms/intel.c @@ -26,10 +26,6 @@ **************************************************************************/ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include #include #include diff --git a/libkms/internal.h b/libkms/internal.h index 905f5b17..8b386db6 100644 --- a/libkms/internal.h +++ b/libkms/internal.h @@ -29,10 +29,6 @@ #ifndef INTERNAL_H_ #define INTERNAL_H_ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include "libdrm_macros.h" #include "libkms.h" diff --git a/libkms/linux.c b/libkms/linux.c index 1431eb10..56205054 100644 --- a/libkms/linux.c +++ b/libkms/linux.c @@ -29,10 +29,6 @@ * going from fd to pci id via fstat and udev. */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif #include #include #include diff --git a/libkms/nouveau.c b/libkms/nouveau.c index d10e0fdb..7fe23db3 100644 --- a/libkms/nouveau.c +++ b/libkms/nouveau.c @@ -26,10 +26,6 @@ **************************************************************************/ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include #include #include diff --git a/libkms/radeon.c b/libkms/radeon.c index aaeeaf31..2cb2b11f 100644 --- a/libkms/radeon.c +++ b/libkms/radeon.c @@ -26,10 +26,6 @@ **************************************************************************/ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include #include #include diff --git a/libkms/vmwgfx.c b/libkms/vmwgfx.c index 6a24fd4d..f0e40be7 100644 --- a/libkms/vmwgfx.c +++ b/libkms/vmwgfx.c @@ -26,10 +26,6 @@ **************************************************************************/ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include #include #include diff --git a/meson.build b/meson.build index 100a59fa..74a541e8 100644 --- a/meson.build +++ b/meson.build @@ -280,7 +280,7 @@ config_file = configure_file( configuration : config, output : 'config.h', ) -add_project_arguments('-DHAVE_CONFIG_H', language : 'c') +add_project_arguments('-include', 'config.h', language : 'c') inc_root = include_directories('.') inc_drm = include_directories('include/drm') diff --git a/nouveau/abi16.c b/nouveau/abi16.c index ee38c0cb..ba2501ea 100644 --- a/nouveau/abi16.c +++ b/nouveau/abi16.c @@ -22,10 +22,6 @@ * Authors: Ben Skeggs */ -#ifdef HAVE_CONFIG_H -# include -#endif - #include #include #include diff --git a/nouveau/bufctx.c b/nouveau/bufctx.c index 4f76e5df..67b7570e 100644 --- a/nouveau/bufctx.c +++ b/nouveau/bufctx.c @@ -22,10 +22,6 @@ * Authors: Ben Skeggs */ -#ifdef HAVE_CONFIG_H -#include -#endif - #include #include #include diff --git a/nouveau/nouveau.c b/nouveau/nouveau.c index e113a8fe..55593517 100644 --- a/nouveau/nouveau.c +++ b/nouveau/nouveau.c @@ -22,10 +22,6 @@ * Authors: Ben Skeggs */ -#ifdef HAVE_CONFIG_H -#include -#endif - #include #include #include diff --git a/nouveau/pushbuf.c b/nouveau/pushbuf.c index 035e3019..445c966e 100644 --- a/nouveau/pushbuf.c +++ b/nouveau/pushbuf.c @@ -22,10 +22,6 @@ * Authors: Ben Skeggs */ -#ifdef HAVE_CONFIG_H -#include -#endif - #include #include #include diff --git a/omap/omap_drm.c b/omap/omap_drm.c index 08ba64eb..417d522c 100644 --- a/omap/omap_drm.c +++ b/omap/omap_drm.c @@ -26,10 +26,6 @@ * Rob Clark */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include #include #include diff --git a/radeon/radeon_bo.c b/radeon/radeon_bo.c index 447f9280..821807bc 100644 --- a/radeon/radeon_bo.c +++ b/radeon/radeon_bo.c @@ -29,9 +29,6 @@ * Dave Airlie * Jérôme Glisse */ -#ifdef HAVE_CONFIG_H -#include -#endif #include #include #include diff --git a/radeon/radeon_bo_gem.c b/radeon/radeon_bo_gem.c index fbd453d9..774b26e4 100644 --- a/radeon/radeon_bo_gem.c +++ b/radeon/radeon_bo_gem.c @@ -29,9 +29,6 @@ * Dave Airlie * Jérôme Glisse */ -#ifdef HAVE_CONFIG_H -#include -#endif #include #include #include diff --git a/radeon/radeon_cs.c b/radeon/radeon_cs.c index dffb869f..eb7859e5 100644 --- a/radeon/radeon_cs.c +++ b/radeon/radeon_cs.c @@ -1,6 +1,3 @@ -#ifdef HAVE_CONFIG_H -#include -#endif #include "libdrm_macros.h" #include #include "radeon_cs.h" diff --git a/radeon/radeon_cs_gem.c b/radeon/radeon_cs_gem.c index f3dccb6c..4d5fc13a 100644 --- a/radeon/radeon_cs_gem.c +++ b/radeon/radeon_cs_gem.c @@ -29,9 +29,6 @@ * Nicolai Haehnle * Jérôme Glisse */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif #include #include #include diff --git a/radeon/radeon_cs_space.c b/radeon/radeon_cs_space.c index 69287be5..8531c345 100644 --- a/radeon/radeon_cs_space.c +++ b/radeon/radeon_cs_space.c @@ -25,9 +25,6 @@ */ /* */ -#ifdef HAVE_CONFIG_H -#include -#endif #include #include #include diff --git a/radeon/radeon_surface.c b/radeon/radeon_surface.c index 04df77d6..3cafcfcb 100644 --- a/radeon/radeon_surface.c +++ b/radeon/radeon_surface.c @@ -26,9 +26,6 @@ * Authors: * Jérôme Glisse */ -#ifdef HAVE_CONFIG_H -#include -#endif #include #include #include diff --git a/tegra/tegra.c b/tegra/tegra.c index f7dc89ad..1d7268e5 100644 --- a/tegra/tegra.c +++ b/tegra/tegra.c @@ -22,10 +22,6 @@ * OTHER DEALINGS IN THE SOFTWARE. */ -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - #include #include #include diff --git a/tests/amdgpu/amdgpu_test.c b/tests/amdgpu/amdgpu_test.c index e49f4a6c..96fcd687 100644 --- a/tests/amdgpu/amdgpu_test.c +++ b/tests/amdgpu/amdgpu_test.c @@ -21,10 +21,6 @@ * */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include #include #include diff --git a/tests/amdgpu/basic_tests.c b/tests/amdgpu/basic_tests.c index 0ea010a8..1adbddd9 100644 --- a/tests/amdgpu/basic_tests.c +++ b/tests/amdgpu/basic_tests.c @@ -21,10 +21,6 @@ * */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include #include #include diff --git a/tests/amdgpu/bo_tests.c b/tests/amdgpu/bo_tests.c index 24698bcb..9d4da4af 100644 --- a/tests/amdgpu/bo_tests.c +++ b/tests/amdgpu/bo_tests.c @@ -21,10 +21,6 @@ * */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include #include "CUnit/Basic.h" diff --git a/tests/amdgpu/cs_tests.c b/tests/amdgpu/cs_tests.c index a5361cd5..7ad0f0dc 100644 --- a/tests/amdgpu/cs_tests.c +++ b/tests/amdgpu/cs_tests.c @@ -21,10 +21,6 @@ * */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include #include "CUnit/Basic.h" diff --git a/tests/amdgpu/deadlock_tests.c b/tests/amdgpu/deadlock_tests.c index 96c99c96..1eb5761a 100644 --- a/tests/amdgpu/deadlock_tests.c +++ b/tests/amdgpu/deadlock_tests.c @@ -21,10 +21,6 @@ * */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include #include #include diff --git a/tests/amdgpu/uvd_enc_tests.c b/tests/amdgpu/uvd_enc_tests.c index 0377c1a5..b4251bcf 100644 --- a/tests/amdgpu/uvd_enc_tests.c +++ b/tests/amdgpu/uvd_enc_tests.c @@ -21,10 +21,6 @@ * */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include #include diff --git a/tests/amdgpu/vce_tests.c b/tests/amdgpu/vce_tests.c index 75821bbb..25c0b1fb 100644 --- a/tests/amdgpu/vce_tests.c +++ b/tests/amdgpu/vce_tests.c @@ -21,10 +21,6 @@ * */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include #include diff --git a/tests/amdgpu/vcn_tests.c b/tests/amdgpu/vcn_tests.c index 2eb8c434..d9f05af8 100644 --- a/tests/amdgpu/vcn_tests.c +++ b/tests/amdgpu/vcn_tests.c @@ -21,10 +21,6 @@ * */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include #include diff --git a/tests/amdgpu/vm_tests.c b/tests/amdgpu/vm_tests.c index 502a9405..7b6dc5d6 100644 --- a/tests/amdgpu/vm_tests.c +++ b/tests/amdgpu/vm_tests.c @@ -21,10 +21,6 @@ * */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include "CUnit/Basic.h" #include "amdgpu_test.h" diff --git a/tests/etnaviv/etnaviv_2d_test.c b/tests/etnaviv/etnaviv_2d_test.c index 10751c73..8dd77b66 100644 --- a/tests/etnaviv/etnaviv_2d_test.c +++ b/tests/etnaviv/etnaviv_2d_test.c @@ -24,10 +24,6 @@ * Christian Gmeiner */ -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - #include #include #include diff --git a/tests/etnaviv/etnaviv_bo_cache_test.c b/tests/etnaviv/etnaviv_bo_cache_test.c index fb01f8d3..7fb06293 100644 --- a/tests/etnaviv/etnaviv_bo_cache_test.c +++ b/tests/etnaviv/etnaviv_bo_cache_test.c @@ -24,10 +24,6 @@ * Christian Gmeiner */ -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - #undef NDEBUG #include diff --git a/tests/exynos/exynos_fimg2d_test.c b/tests/exynos/exynos_fimg2d_test.c index dcb2e35a..99bb9233 100644 --- a/tests/exynos/exynos_fimg2d_test.c +++ b/tests/exynos/exynos_fimg2d_test.c @@ -23,10 +23,6 @@ * OTHER DEALINGS IN THE SOFTWARE. */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include #include #include diff --git a/tests/kms/kms-steal-crtc.c b/tests/kms/kms-steal-crtc.c index 4b830d27..cd40758d 100644 --- a/tests/kms/kms-steal-crtc.c +++ b/tests/kms/kms-steal-crtc.c @@ -21,10 +21,6 @@ * IN THE SOFTWARE. */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include #include #include diff --git a/tests/kms/kms-universal-planes.c b/tests/kms/kms-universal-planes.c index 89057bb5..2163c987 100644 --- a/tests/kms/kms-universal-planes.c +++ b/tests/kms/kms-universal-planes.c @@ -21,10 +21,6 @@ * IN THE SOFTWARE. */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include #include #include diff --git a/tests/kms/libkms-test-crtc.c b/tests/kms/libkms-test-crtc.c index 3adb4903..2c28face 100644 --- a/tests/kms/libkms-test-crtc.c +++ b/tests/kms/libkms-test-crtc.c @@ -21,10 +21,6 @@ * IN THE SOFTWARE. */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include "libkms-test.h" struct kms_crtc *kms_crtc_create(struct kms_device *device, uint32_t id) diff --git a/tests/kms/libkms-test-device.c b/tests/kms/libkms-test-device.c index 042ae05d..d3bb11ce 100644 --- a/tests/kms/libkms-test-device.c +++ b/tests/kms/libkms-test-device.c @@ -21,10 +21,6 @@ * IN THE SOFTWARE. */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include #include #include diff --git a/tests/kms/libkms-test-framebuffer.c b/tests/kms/libkms-test-framebuffer.c index c9e5ad3c..9bb2d95b 100644 --- a/tests/kms/libkms-test-framebuffer.c +++ b/tests/kms/libkms-test-framebuffer.c @@ -21,10 +21,6 @@ * IN THE SOFTWARE. */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include #include diff --git a/tests/kms/libkms-test-plane.c b/tests/kms/libkms-test-plane.c index 8eb78af1..6c40a3c9 100644 --- a/tests/kms/libkms-test-plane.c +++ b/tests/kms/libkms-test-plane.c @@ -21,10 +21,6 @@ * IN THE SOFTWARE. */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include #include diff --git a/tests/kms/libkms-test-screen.c b/tests/kms/libkms-test-screen.c index 33690222..bbe972a0 100644 --- a/tests/kms/libkms-test-screen.c +++ b/tests/kms/libkms-test-screen.c @@ -21,10 +21,6 @@ * IN THE SOFTWARE. */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include #include diff --git a/tests/modetest/buffers.c b/tests/modetest/buffers.c index 4fd310b9..9b635c0c 100644 --- a/tests/modetest/buffers.c +++ b/tests/modetest/buffers.c @@ -24,10 +24,6 @@ * IN THE SOFTWARE. */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include #include #include diff --git a/tests/modetest/cursor.c b/tests/modetest/cursor.c index 6de82a4a..829bced1 100644 --- a/tests/modetest/cursor.c +++ b/tests/modetest/cursor.c @@ -22,10 +22,6 @@ * IN THE SOFTWARE. */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include #include #include diff --git a/tests/modetest/modetest.c b/tests/modetest/modetest.c index fb9f15fc..62957d84 100644 --- a/tests/modetest/modetest.c +++ b/tests/modetest/modetest.c @@ -38,10 +38,6 @@ * the mode has been programmed, along with possible test patterns. */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include #include #include diff --git a/tests/nouveau/threaded.c b/tests/nouveau/threaded.c index 281af460..3669bcd3 100644 --- a/tests/nouveau/threaded.c +++ b/tests/nouveau/threaded.c @@ -20,10 +20,6 @@ * OTHER DEALINGS IN THE SOFTWARE. */ -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - #include #include #include diff --git a/tests/tegra/openclose.c b/tests/tegra/openclose.c index 881d8aa4..f80f52d4 100644 --- a/tests/tegra/openclose.c +++ b/tests/tegra/openclose.c @@ -20,10 +20,6 @@ * OTHER DEALINGS IN THE SOFTWARE. */ -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - #include #include #include diff --git a/tests/util/format.c b/tests/util/format.c index 043cfe7f..15ac5e1e 100644 --- a/tests/util/format.c +++ b/tests/util/format.c @@ -23,10 +23,6 @@ * IN THE SOFTWARE. */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include #include #include diff --git a/tests/util/kms.c b/tests/util/kms.c index 028cc8d9..8b3e7878 100644 --- a/tests/util/kms.c +++ b/tests/util/kms.c @@ -37,10 +37,6 @@ * the mode has been programmed, along with possible test patterns. */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include #include #include diff --git a/tests/util/pattern.c b/tests/util/pattern.c index 75a458d4..9fa0a417 100644 --- a/tests/util/pattern.c +++ b/tests/util/pattern.c @@ -23,10 +23,6 @@ * IN THE SOFTWARE. */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include #include #include diff --git a/tests/vbltest/vbltest.c b/tests/vbltest/vbltest.c index 3f6b803a..48708d20 100644 --- a/tests/vbltest/vbltest.c +++ b/tests/vbltest/vbltest.c @@ -24,10 +24,6 @@ * IN THE SOFTWARE. */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include #include #include diff --git a/xf86atomic.h b/xf86atomic.h index 70e91866..2d733bd5 100644 --- a/xf86atomic.h +++ b/xf86atomic.h @@ -34,10 +34,6 @@ #ifndef LIBDRM_ATOMICS_H #define LIBDRM_ATOMICS_H -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #if HAVE_LIBDRM_ATOMIC_PRIMITIVES #define HAS_ATOMIC_OPS 1 diff --git a/xf86drm.c b/xf86drm.c index 9328bf5a..689e8fe9 100644 --- a/xf86drm.c +++ b/xf86drm.c @@ -31,9 +31,6 @@ * DEALINGS IN THE SOFTWARE. */ -#ifdef HAVE_CONFIG_H -# include -#endif #include #include #include diff --git a/xf86drmMode.c b/xf86drmMode.c index bd59ef25..cf8e1eac 100644 --- a/xf86drmMode.c +++ b/xf86drmMode.c @@ -38,10 +38,6 @@ * platforms find which headers to include to get uint32_t */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include #include #include -- cgit v1.2.3-54-g00ecf