drm: Branch 'master' - 18 commits
[email protected] (Emil Velikov)
| Newsgroups | gmane.comp.video.dri.patches |
|---|---|
| Message-ID | <[email protected]> |
amdgpu/Makefile.am | 2 +- configure.ac | 4 ++-- freedreno/freedreno_priv.h | 6 +++--- freedreno/freedreno_ringbuffer.h | 2 +- freedreno/kgsl/kgsl_bo.c | 2 +- freedreno/kgsl/kgsl_device.c | 2 +- freedreno/kgsl/kgsl_pipe.c | 2 +- freedreno/kgsl/kgsl_ringbuffer.c | 2 +- freedreno/msm/msm_bo.c | 2 +- freedreno/msm/msm_device.c | 2 +- freedreno/msm/msm_pipe.c | 2 +- freedreno/msm/msm_ringbuffer.c | 2 +- intel/intel_bufmgr_fake.c | 2 +- intel/intel_bufmgr_gem.c | 17 +++++++++++------ intel/intel_decode.c | 10 +++++----- libkms/linux.c | 2 +- nouveau/abi16.c | 13 ++++++++++--- nouveau/nouveau.c | 6 +++--- radeon/radeon_bo_gem.c | 23 ++++++++++++----------- radeon/radeon_bo_int.h | 2 +- radeon/radeon_cs_gem.c | 20 ++++++++++---------- radeon/radeon_cs_int.h | 2 +- tests/amdgpu/amdgpu_test.c | 32 ++++++++++++++++++++++++-------- tests/amdgpu/cs_tests.c | 4 ++-- tests/amdgpu/uvd_messages.h | 10 +++++----- tests/amdgpu/vce_ib.h | 24 ++++++++++++------------ tests/modetest/cursor.c | 10 +++++----- tests/modetest/modetest.c | 3 --- tests/vbltest/vbltest.c | 1 - 29 files changed, 118 insertions(+), 93 deletions(-) New commits: commit 7faedc9efcff12e7620f3a679cff33b1f818b539 Author: Emil Velikov <[email protected]> Date: Sat Aug 15 17:00:37 2015 +0100 configure: remove -Wno-missing-field-initializers Signed-off-by: Emil Velikov <[email protected]> diff --git a/configure.ac b/configure.ac index c2a8ed1..1d7bd5b 100644 --- a/configure.ac +++ b/configure.ac @@ -173,7 +173,7 @@ MAYBE_WARN="-Wall -Wextra \ -Wpacked -Wswitch-enum -Wmissing-format-attribute \ -Wstrict-aliasing=2 -Winit-self \ -Wdeclaration-after-statement -Wold-style-definition \ --Wno-missing-field-initializers -Wno-unused-parameter \ +-Wno-unused-parameter \ -Wno-attributes -Wno-long-long -Winline -Wshadow" # invalidate cached value if MAYBE_WARN has changed commit 23667f566a5622490237d753cc514d4f95cf10ff Author: Emil Velikov <[email protected]> Date: Sun Aug 23 14:20:17 2015 +0100 intel: ignore missing-field-initializers warnings We're about to remove the -Wno flag from configure.ac which will lead to a lot of unnecessary spam. Signed-off-by: Emil Velikov <[email protected]> diff --git a/intel/intel_decode.c b/intel/intel_decode.c index 345d457..e7aef74 100644 --- a/intel/intel_decode.c +++ b/intel/intel_decode.c @@ -38,6 +38,9 @@ #include "intel_chipset.h" #include "intel_bufmgr.h" +/* The compiler throws ~90 warnings. Do not spam the build, until we fix them. */ +#pragma GCC diagnostic ignored "-Wmissing-field-initializers" + /* Struct for tracking drm_intel_decode state. */ struct drm_intel_decode { /** stdio file where the output should land. Defaults to stdout. */ commit a9e5880b3e93f2fc981c910d16a9eab2ca81c7a0 Author: Emil Velikov <[email protected]> Date: Sat Aug 15 18:01:53 2015 +0100 nouveau: use designated initializers Cc: [email protected] Signed-off-by: Emil Velikov <[email protected]> diff --git a/nouveau/abi16.c b/nouveau/abi16.c index 4ca0bfb..59bc436 100644 --- a/nouveau/abi16.c +++ b/nouveau/abi16.c @@ -38,7 +38,10 @@ abi16_chan_nv04(struct nouveau_object *obj) { struct nouveau_device *dev = (struct nouveau_device *)obj->parent; struct nv04_fifo *nv04 = obj->data; - struct drm_nouveau_channel_alloc req = {nv04->vram, nv04->gart}; + struct drm_nouveau_channel_alloc req = { + .fb_ctxdma_handle = nv04->vram, + .tt_ctxdma_handle = nv04->gart + }; int ret; ret = drmCommandWriteRead(dev->fd, DRM_NOUVEAU_CHANNEL_ALLOC, @@ -105,7 +108,9 @@ drm_private int abi16_engobj(struct nouveau_object *obj) { struct drm_nouveau_grobj_alloc req = { - obj->parent->handle, obj->handle, obj->oclass + .channel = obj->parent->handle, + .handle = obj->handle, + .class = obj->oclass, }; struct nouveau_device *dev; int ret; @@ -125,7 +130,9 @@ abi16_ntfy(struct nouveau_object *obj) { struct nv04_notify *ntfy = obj->data; struct drm_nouveau_notifierobj_alloc req = { - obj->parent->handle, ntfy->object->handle, ntfy->length + .channel = obj->parent->handle, + .handle = ntfy->object->handle, + .size = ntfy->length, }; struct nouveau_device *dev; int ret; diff --git a/nouveau/nouveau.c b/nouveau/nouveau.c index 7393474..97fd77b 100644 --- a/nouveau/nouveau.c +++ b/nouveau/nouveau.c @@ -177,7 +177,7 @@ nouveau_device_del(struct nouveau_device **pdev) int nouveau_getparam(struct nouveau_device *dev, uint64_t param, uint64_t *value) { - struct drm_nouveau_getparam r = { param, 0 }; + struct drm_nouveau_getparam r = { .param = param }; int fd = dev->fd, ret = drmCommandWriteRead(fd, DRM_NOUVEAU_GETPARAM, &r, sizeof(r)); *value = r.value; @@ -187,7 +187,7 @@ nouveau_getparam(struct nouveau_device *dev, uint64_t param, uint64_t *value) int nouveau_setparam(struct nouveau_device *dev, uint64_t param, uint64_t value) { - struct drm_nouveau_setparam r = { param, value }; + struct drm_nouveau_setparam r = { .param = param, .value = value }; return drmCommandWrite(dev->fd, DRM_NOUVEAU_SETPARAM, &r, sizeof(r)); } @@ -348,7 +348,7 @@ nouveau_bo_del(struct nouveau_bo *bo) { struct nouveau_device_priv *nvdev = nouveau_device(bo->device); struct nouveau_bo_priv *nvbo = nouveau_bo(bo); - struct drm_gem_close req = { bo->handle }; + struct drm_gem_close req = { .handle = bo->handle }; if (nvbo->head.next) { pthread_mutex_lock(&nvdev->lock); commit ae2cf4507c32f0e16fdb41472ac68d72bfb007ac Author: Emil Velikov <[email protected]> Date: Sun Aug 23 14:44:55 2015 +0100 tests/amdgpu: ensure tests work by using c99 initializers In the latest version of CUnit the fourth parameter of the CU_SuiteInfo struct is pSetUpFunc rather than *pTests. Seems like the CUnit ABI broke at some point, so let's the the robust thing and use c99 designated initializers to correctly populate the struct(s). Cc: Leo Liu <[email protected]> Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Alex Deucher <[email protected]> diff --git a/tests/amdgpu/amdgpu_test.c b/tests/amdgpu/amdgpu_test.c index 6568990..71f357c 100644 --- a/tests/amdgpu/amdgpu_test.c +++ b/tests/amdgpu/amdgpu_test.c @@ -58,14 +58,30 @@ int drm_amdgpu[MAX_CARDS_SUPPORTED]; /** The table of all known test suites to run */ static CU_SuiteInfo suites[] = { - { "Basic Tests", suite_basic_tests_init, - suite_basic_tests_clean, basic_tests }, - { "BO Tests", suite_bo_tests_init, - suite_bo_tests_clean, bo_tests }, - { "CS Tests", suite_cs_tests_init, - suite_cs_tests_clean, cs_tests }, - { "VCE Tests", suite_vce_tests_init, - suite_vce_tests_clean, vce_tests }, + { + .pName = "Basic Tests", + .pInitFunc = suite_basic_tests_init, + .pCleanupFunc = suite_basic_tests_clean, + .pTests = basic_tests, + }, + { + .pName = "BO Tests", + .pInitFunc = suite_bo_tests_init, + .pCleanupFunc = suite_bo_tests_clean, + .pTests = bo_tests, + }, + { + .pName = "CS Tests", + .pInitFunc = suite_cs_tests_init, + .pCleanupFunc = suite_cs_tests_clean, + .pTests = cs_tests, + }, + { + .pName = "VCE Tests", + .pInitFunc = suite_vce_tests_init, + .pCleanupFunc = suite_vce_tests_clean, + .pTests = vce_tests, + }, CU_SUITE_INFO_NULL, }; commit f7568777365abbdd8079c2b51b2e68d603391816 Author: Emil Velikov <[email protected]> Date: Sat Aug 15 17:35:58 2015 +0100 tests/amdgpu: annotate (most of) the vce templates as const data The remaining two templates are modified on the fly, depending on the type of test to be performed. Cc: Leo Liu <[email protected]> Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Alex Deucher <[email protected]> diff --git a/tests/amdgpu/vce_ib.h b/tests/amdgpu/vce_ib.h index c5afed0..bd0bf94 100644 --- a/tests/amdgpu/vce_ib.h +++ b/tests/amdgpu/vce_ib.h @@ -24,7 +24,7 @@ #ifndef _vce_ib_h_ #define _vce_ib_h_ -static uint32_t vce_session[3] = { +static const uint32_t vce_session[] = { 0x0000000c, 0x00000001, 0x400c0001, @@ -41,7 +41,7 @@ static uint32_t vce_taskinfo[8] = { 0x00000000, }; -static uint32_t vce_create[12] = { +static const uint32_t vce_create[] = { 0x00000030, 0x01000001, 0x00000000, @@ -56,7 +56,7 @@ static uint32_t vce_create[12] = { 0x00000000, }; -static uint32_t vce_rate_ctrl[28] = { +static const uint32_t vce_rate_ctrl[] = { 0x00000070, 0x04000005, 0x00000000, @@ -87,13 +87,13 @@ static uint32_t vce_rate_ctrl[28] = { 0x00000000, }; -static uint32_t vce_config_ext[3] = { +static const uint32_t vce_config_ext[] = { 0x0000000c, 0x04000001, 0x00000003, }; -static uint32_t vce_motion_est[26] = { +static const uint32_t vce_motion_est[] = { 0x00000068, 0x04000007, 0x00000001, @@ -122,7 +122,7 @@ static uint32_t vce_motion_est[26] = { 0x00000000, }; -static uint32_t vce_rdo[19] = { +static const uint32_t vce_rdo[] = { 0x0000004c, 0x04000008, 0x00000000, @@ -144,7 +144,7 @@ static uint32_t vce_rdo[19] = { 0x00000000, }; -static uint32_t vce_pic_ctrl[29] = { +static const uint32_t vce_pic_ctrl[] = { 0x00000074, 0x04000002, 0x00000000, @@ -176,7 +176,7 @@ static uint32_t vce_pic_ctrl[29] = { 0x00000000, }; -static uint32_t vce_feedback[5] = { +static const uint32_t vce_feedback[] = { 0x00000014, 0x05000005, 0x00000000, @@ -184,14 +184,14 @@ static uint32_t vce_feedback[5] = { 0x00000001, }; -static uint32_t vce_context_buffer[4] = { +static const uint32_t vce_context_buffer[] = { 0x00000010, 0x05000001, 0x00000000, 0xffffffff, }; -static uint32_t vce_bs_buffer[5] = { +static const uint32_t vce_bs_buffer[] = { 0x00000014, 0x05000004, 0x00000000, @@ -199,7 +199,7 @@ static uint32_t vce_bs_buffer[5] = { 0x00154000, }; -static uint32_t vce_aux_buffer[18] = { +static const uint32_t vce_aux_buffer[] = { 0x00000048, 0x05000002, 0x0000f000, @@ -311,7 +311,7 @@ static uint32_t vce_encode[88] = { 0x00000000, }; -static uint32_t vce_destroy[2] = { +static const uint32_t vce_destroy[] = { 0x00000008, 0x02000001, }; commit 05185fa054c21e212ca4ab5075c72d62f7ec2108 Author: Emil Velikov <[email protected]> Date: Sat Aug 15 17:25:21 2015 +0100 tests/amdgpu: annotate the uvd message templates as const data Cc: Leo Liu <[email protected]> Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Alex Deucher <[email protected]> diff --git a/tests/amdgpu/uvd_messages.h b/tests/amdgpu/uvd_messages.h index 44bcacc..00235cb 100644 --- a/tests/amdgpu/uvd_messages.h +++ b/tests/amdgpu/uvd_messages.h @@ -24,7 +24,7 @@ #ifndef _UVD_MESSAGES_H_ #define _UVD_MESSAGES_H_ -static uint8_t uvd_create_msg[] = { +static const uint8_t uvd_create_msg[] = { 0xe4,0x0d,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x44,0x40,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x03,0x00,0x00, 0xe0,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xf9,0xf2,0x00,0x00,0x00,0x00,0x00, @@ -250,7 +250,7 @@ static uint8_t uvd_create_msg[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, }; -static uint8_t uvd_bitstream[] ={ +static const uint8_t uvd_bitstream[] ={ 0x00,0x00,0x01,0x25,0xb8,0x20,0x20,0x21,0x44,0xc5,0x00,0x01,0x57,0x9b,0xef,0xbe, 0xfb,0xef,0xbe,0xfb,0xef,0xbe,0xfb,0xef,0xbe,0xfb,0xef,0xbe,0xfb,0xef,0xbe,0xfb, 0xef,0xbe,0xfb,0xef,0xbe,0xfb,0xef,0xbe,0xfb,0xef,0xbe,0xfb,0xef,0xbe,0xfb,0xef, @@ -341,7 +341,7 @@ static uint8_t uvd_bitstream[] ={ 0xeb,0xae,0xba,0xf0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, }; -static uint8_t uvd_decode_msg[] = { +static const uint8_t uvd_decode_msg[] = { 0xe4,0x0d,0x00,0x00,0x01,0x00,0x00,0x00,0x03,0x00,0x44,0x40,0x01,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x60,0x03,0x00,0x00,0xe0,0x01,0x00,0x00, 0x00,0x00,0x00,0x00,0x80,0xf9,0xf2,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, @@ -567,7 +567,7 @@ static uint8_t uvd_decode_msg[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, }; -static uint8_t uvd_destroy_msg[] = { +static const uint8_t uvd_destroy_msg[] = { 0xe4,0x0d,0x00,0x00,0x02,0x00,0x00,0x00,0x03,0x00,0x44,0x40,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, @@ -793,7 +793,7 @@ static uint8_t uvd_destroy_msg[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, }; -static uint8_t uvd_it_scaling_table[] = { +static const uint8_t uvd_it_scaling_table[] = { 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, commit 150ebe49ac0db2e0bb4dc194b0a6f0329c18f3fa Author: Emil Velikov <[email protected]> Date: Sat Aug 15 17:24:21 2015 +0100 tests/amdgpu: reference the correct variable for memcpy Cc: Leo Liu <[email protected]> Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Alex Deucher <[email protected]> diff --git a/tests/amdgpu/cs_tests.c b/tests/amdgpu/cs_tests.c index 416f36b..dfbf5af 100644 --- a/tests/amdgpu/cs_tests.c +++ b/tests/amdgpu/cs_tests.c @@ -266,7 +266,7 @@ static void amdgpu_cs_uvd_decode(void) r = amdgpu_bo_cpu_map(buf_handle, (void **)&ptr); CU_ASSERT_EQUAL(r, 0); - memcpy(ptr, uvd_decode_msg, sizeof(uvd_create_msg)); + memcpy(ptr, uvd_decode_msg, sizeof(uvd_decode_msg)); if (family_id >= AMDGPU_FAMILY_VI) ptr[0x10] = 7; @@ -362,7 +362,7 @@ static void amdgpu_cs_uvd_destroy(void) r = amdgpu_bo_cpu_map(buf_handle, &msg); CU_ASSERT_EQUAL(r, 0); - memcpy(msg, uvd_destroy_msg, sizeof(uvd_create_msg)); + memcpy(msg, uvd_destroy_msg, sizeof(uvd_destroy_msg)); if (family_id >= AMDGPU_FAMILY_VI) ((uint8_t*)msg)[0x10] = 7; commit 6a6d668fad9833350deaddc61e917de3dcb38262 Author: Emil Velikov <[email protected]> Date: Sat Aug 15 17:17:52 2015 +0100 freedreno: annotate the device/bo/pipe/ringbuffer funcs as const data Cc: [email protected] Signed-off-by: Emil Velikov <[email protected]> diff --git a/freedreno/freedreno_priv.h b/freedreno/freedreno_priv.h index 1dddcc3..4e442e4 100644 --- a/freedreno/freedreno_priv.h +++ b/freedreno/freedreno_priv.h @@ -83,7 +83,7 @@ struct fd_device { */ void *handle_table, *name_table; - struct fd_device_funcs *funcs; + const struct fd_device_funcs *funcs; struct fd_bo_bucket cache_bucket[14 * 4]; int num_buckets; @@ -107,7 +107,7 @@ struct fd_pipe_funcs { struct fd_pipe { struct fd_device *dev; enum fd_pipe_id id; - struct fd_pipe_funcs *funcs; + const struct fd_pipe_funcs *funcs; }; struct fd_ringmarker { @@ -141,7 +141,7 @@ struct fd_bo { int fd; /* dmabuf handle */ void *map; atomic_t refcnt; - struct fd_bo_funcs *funcs; + const struct fd_bo_funcs *funcs; int bo_reuse; struct list_head list; /* bucket-list entry */ diff --git a/freedreno/freedreno_ringbuffer.h b/freedreno/freedreno_ringbuffer.h index a5e1d03..578cdb2 100644 --- a/freedreno/freedreno_ringbuffer.h +++ b/freedreno/freedreno_ringbuffer.h @@ -44,7 +44,7 @@ struct fd_ringbuffer { int size; uint32_t *cur, *end, *start, *last_start; struct fd_pipe *pipe; - struct fd_ringbuffer_funcs *funcs; + const struct fd_ringbuffer_funcs *funcs; uint32_t last_timestamp; struct fd_ringbuffer *parent; }; diff --git a/freedreno/kgsl/kgsl_bo.c b/freedreno/kgsl/kgsl_bo.c index 3407c76..b8ac102 100644 --- a/freedreno/kgsl/kgsl_bo.c +++ b/freedreno/kgsl/kgsl_bo.c @@ -123,7 +123,7 @@ static void kgsl_bo_destroy(struct fd_bo *bo) } -static struct fd_bo_funcs funcs = { +static const struct fd_bo_funcs funcs = { .offset = kgsl_bo_offset, .cpu_prep = kgsl_bo_cpu_prep, .cpu_fini = kgsl_bo_cpu_fini, diff --git a/freedreno/kgsl/kgsl_device.c b/freedreno/kgsl/kgsl_device.c index 8352d60..175e837 100644 --- a/freedreno/kgsl/kgsl_device.c +++ b/freedreno/kgsl/kgsl_device.c @@ -42,7 +42,7 @@ static void kgsl_device_destroy(struct fd_device *dev) free(kgsl_dev); } -static struct fd_device_funcs funcs = { +static const struct fd_device_funcs funcs = { .bo_new_handle = kgsl_bo_new_handle, .bo_from_handle = kgsl_bo_from_handle, .pipe_new = kgsl_pipe_new, diff --git a/freedreno/kgsl/kgsl_pipe.c b/freedreno/kgsl/kgsl_pipe.c index e2fd65c..58b3b4d 100644 --- a/freedreno/kgsl/kgsl_pipe.c +++ b/freedreno/kgsl/kgsl_pipe.c @@ -108,7 +108,7 @@ static void kgsl_pipe_destroy(struct fd_pipe *pipe) free(kgsl_pipe); } -static struct fd_pipe_funcs funcs = { +static const struct fd_pipe_funcs funcs = { .ringbuffer_new = kgsl_ringbuffer_new, .get_param = kgsl_pipe_get_param, .wait = kgsl_pipe_wait, diff --git a/freedreno/kgsl/kgsl_ringbuffer.c b/freedreno/kgsl/kgsl_ringbuffer.c index f013307..6f68f2f 100644 --- a/freedreno/kgsl/kgsl_ringbuffer.c +++ b/freedreno/kgsl/kgsl_ringbuffer.c @@ -191,7 +191,7 @@ static void kgsl_ringbuffer_destroy(struct fd_ringbuffer *ring) free(kgsl_ring); } -static struct fd_ringbuffer_funcs funcs = { +static const struct fd_ringbuffer_funcs funcs = { .hostptr = kgsl_ringbuffer_hostptr, .flush = kgsl_ringbuffer_flush, .emit_reloc = kgsl_ringbuffer_emit_reloc, diff --git a/freedreno/msm/msm_bo.c b/freedreno/msm/msm_bo.c index fd94413..ee668ab 100644 --- a/freedreno/msm/msm_bo.c +++ b/freedreno/msm/msm_bo.c @@ -96,7 +96,7 @@ static void msm_bo_destroy(struct fd_bo *bo) } -static struct fd_bo_funcs funcs = { +static const struct fd_bo_funcs funcs = { .offset = msm_bo_offset, .cpu_prep = msm_bo_cpu_prep, .cpu_fini = msm_bo_cpu_fini, diff --git a/freedreno/msm/msm_device.c b/freedreno/msm/msm_device.c index 81077e1..25c097c 100644 --- a/freedreno/msm/msm_device.c +++ b/freedreno/msm/msm_device.c @@ -42,7 +42,7 @@ static void msm_device_destroy(struct fd_device *dev) free(msm_dev); } -static struct fd_device_funcs funcs = { +static const struct fd_device_funcs funcs = { .bo_new_handle = msm_bo_new_handle, .bo_from_handle = msm_bo_from_handle, .pipe_new = msm_pipe_new, diff --git a/freedreno/msm/msm_pipe.c b/freedreno/msm/msm_pipe.c index e1edffe..aa0866b 100644 --- a/freedreno/msm/msm_pipe.c +++ b/freedreno/msm/msm_pipe.c @@ -80,7 +80,7 @@ static void msm_pipe_destroy(struct fd_pipe *pipe) free(msm_pipe); } -static struct fd_pipe_funcs funcs = { +static const struct fd_pipe_funcs funcs = { .ringbuffer_new = msm_ringbuffer_new, .get_param = msm_pipe_get_param, .wait = msm_pipe_wait, diff --git a/freedreno/msm/msm_ringbuffer.c b/freedreno/msm/msm_ringbuffer.c index 5ddea57..ee6af0b 100644 --- a/freedreno/msm/msm_ringbuffer.c +++ b/freedreno/msm/msm_ringbuffer.c @@ -356,7 +356,7 @@ static void msm_ringbuffer_destroy(struct fd_ringbuffer *ring) free(msm_ring); } -static struct fd_ringbuffer_funcs funcs = { +static const struct fd_ringbuffer_funcs funcs = { .hostptr = msm_ringbuffer_hostptr, .flush = msm_ringbuffer_flush, .reset = msm_ringbuffer_reset, commit ec2b105492cae093cc78003239e9b6816d1a7384 Author: Emil Velikov <[email protected]> Date: Sat Aug 15 17:12:13 2015 +0100 radeon: cleanup bo/cs func tables Annotate the data as static const and use C99 designated initializers. Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Alex Deucher <[email protected]> diff --git a/radeon/radeon_bo_gem.c b/radeon/radeon_bo_gem.c index 7fdd437..c9fe19f 100644 --- a/radeon/radeon_bo_gem.c +++ b/radeon/radeon_bo_gem.c @@ -270,17 +270,18 @@ static int bo_get_tiling(struct radeon_bo_int *boi, uint32_t *tiling_flags, return r; } -static struct radeon_bo_funcs bo_gem_funcs = { - bo_open, - bo_ref, - bo_unref, - bo_map, - bo_unmap, - bo_wait, - NULL, - bo_set_tiling, - bo_get_tiling, - bo_is_busy, +static const struct radeon_bo_funcs bo_gem_funcs = { + .bo_open = bo_open, + .bo_ref = bo_ref, + .bo_unref = bo_unref, + .bo_map = bo_map, + .bo_unmap = bo_unmap, + .bo_wait = bo_wait, + .bo_is_static = NULL, + .bo_set_tiling = bo_set_tiling, + .bo_get_tiling = bo_get_tiling, + .bo_is_busy = bo_is_busy, + .bo_is_referenced_by_cs = NULL, }; struct radeon_bo_manager *radeon_bo_manager_gem_ctor(int fd) diff --git a/radeon/radeon_bo_int.h b/radeon/radeon_bo_int.h index 9589ead..de981b0 100644 --- a/radeon/radeon_bo_int.h +++ b/radeon/radeon_bo_int.h @@ -2,7 +2,7 @@ #define RADEON_BO_INT struct radeon_bo_manager { - struct radeon_bo_funcs *funcs; + const struct radeon_bo_funcs *funcs; int fd; }; diff --git a/radeon/radeon_cs_gem.c b/radeon/radeon_cs_gem.c index 1962e91..cdec64e 100644 --- a/radeon/radeon_cs_gem.c +++ b/radeon/radeon_cs_gem.c @@ -514,16 +514,16 @@ static void cs_gem_print(struct radeon_cs_int *cs, FILE *file) } } -static struct radeon_cs_funcs radeon_cs_gem_funcs = { - cs_gem_create, - cs_gem_write_reloc, - cs_gem_begin, - cs_gem_end, - cs_gem_emit, - cs_gem_destroy, - cs_gem_erase, - cs_gem_need_flush, - cs_gem_print, +static const struct radeon_cs_funcs radeon_cs_gem_funcs = { + .cs_create = cs_gem_create, + .cs_write_reloc = cs_gem_write_reloc, + .cs_begin = cs_gem_begin, + .cs_end = cs_gem_end, + .cs_emit = cs_gem_emit, + .cs_destroy = cs_gem_destroy, + .cs_erase = cs_gem_erase, + .cs_need_flush = cs_gem_need_flush, + .cs_print = cs_gem_print, }; static int radeon_get_device_id(int fd, uint32_t *device_id) diff --git a/radeon/radeon_cs_int.h b/radeon/radeon_cs_int.h index 6cee574..d906ad4 100644 --- a/radeon/radeon_cs_int.h +++ b/radeon/radeon_cs_int.h @@ -58,7 +58,7 @@ struct radeon_cs_funcs { }; struct radeon_cs_manager { - struct radeon_cs_funcs *funcs; + const struct radeon_cs_funcs *funcs; int fd; int32_t vram_limit, gart_limit; int32_t vram_write_used, gart_write_used; commit aecd5a1879b39bc2b9b46a0a217aa4ce3d97bc8c Author: Emil Velikov <[email protected]> Date: Sat Aug 15 17:01:55 2015 +0100 libkms: use static const for good measure Signed-off-by: Emil Velikov <[email protected]> diff --git a/libkms/linux.c b/libkms/linux.c index b735527..6e0da83 100644 --- a/libkms/linux.c +++ b/libkms/linux.c @@ -149,7 +149,7 @@ struct create_record int (*func)(int fd, struct kms_driver **out); }; -static struct create_record table[] = { +static const struct create_record table[] = { { 0x8086, 0x2a42, intel_create }, /* i965 */ #ifdef HAVE_VMWGFX { 0x15ad, 0x0405, vmwgfx_create }, /* VMware vGPU */ commit 04e243262d1d71cc8e0ac42ea96fff72af9f711d Author: Emil Velikov <[email protected]> Date: Sat Aug 15 17:00:56 2015 +0100 modetest: annotate const data as such for good measure Signed-off-by: Emil Velikov <[email protected]> diff --git a/tests/modetest/cursor.c b/tests/modetest/cursor.c index 62a50ef..d8a19bd 100644 --- a/tests/modetest/cursor.c +++ b/tests/modetest/cursor.c @@ -70,7 +70,7 @@ static int cursor_running; */ struct cursor_step { - void (*run)(struct cursor *cursor, struct cursor_step *step); + void (*run)(struct cursor *cursor, const struct cursor_step *step); uint32_t msec; uint32_t repeat; int arg; @@ -78,7 +78,7 @@ struct cursor_step { static uint32_t indx, count; -static void set_cursor(struct cursor *cursor, struct cursor_step *step) +static void set_cursor(struct cursor *cursor, const struct cursor_step *step) { int enabled = (step->arg ^ count) & 0x1; uint32_t handle = 0; @@ -91,7 +91,7 @@ static void set_cursor(struct cursor *cursor, struct cursor_step *step) drmModeSetCursor(cursor->fd, cursor->crtc_id, handle, cursor->w, cursor->h); } -static void move_cursor(struct cursor *cursor, struct cursor_step *step) +static void move_cursor(struct cursor *cursor, const struct cursor_step *step) { int x = cursor->x; int y = cursor->y; @@ -126,7 +126,7 @@ static void move_cursor(struct cursor *cursor, struct cursor_step *step) drmModeMoveCursor(cursor->fd, cursor->crtc_id, x, y); } -static struct cursor_step steps[] = { +static const struct cursor_step steps[] = { { set_cursor, 10, 0, 1 }, /* enable */ { move_cursor, 1, 100, 1 }, { move_cursor, 1, 10, 10 }, @@ -145,7 +145,7 @@ static struct cursor_step steps[] = { static void *cursor_thread_func(void *data) { while (cursor_running) { - struct cursor_step *step = &steps[indx % ARRAY_SIZE(steps)]; + const struct cursor_step *step = &steps[indx % ARRAY_SIZE(steps)]; int i; for (i = 0; i < ncursors; i++) { commit 6894f2340b9c7c0a695ecb92d547766226c9fdde Author: Emil Velikov <[email protected]> Date: Sat Aug 15 15:53:26 2015 +0100 amdgpu: remove unneeded -Wno-switch-enum flag Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Alex Deucher <[email protected]> diff --git a/amdgpu/Makefile.am b/amdgpu/Makefile.am index 37f7198..cf7bc1b 100644 --- a/amdgpu/Makefile.am +++ b/amdgpu/Makefile.am @@ -25,7 +25,7 @@ include Makefile.sources AM_CFLAGS = \ - $(WARN_CFLAGS) -Wno-switch-enum \ + $(WARN_CFLAGS) \ -I$(top_srcdir) \ $(PTHREADSTUBS_CFLAGS) \ -I$(top_srcdir)/include/drm commit 598294dde8e86c894fbaa3ac97e15f346d76e323 Author: Emil Velikov <[email protected]> Date: Sat Aug 15 15:13:41 2015 +0100 configure: enable -Wshadow when available Signed-off-by: Emil Velikov <[email protected]> diff --git a/configure.ac b/configure.ac index f07507b..c2a8ed1 100644 --- a/configure.ac +++ b/configure.ac @@ -174,7 +174,7 @@ MAYBE_WARN="-Wall -Wextra \ -Wstrict-aliasing=2 -Winit-self \ -Wdeclaration-after-statement -Wold-style-definition \ -Wno-missing-field-initializers -Wno-unused-parameter \ --Wno-attributes -Wno-long-long -Winline" +-Wno-attributes -Wno-long-long -Winline -Wshadow" # invalidate cached value if MAYBE_WARN has changed if test "x$libdrm_cv_warn_maybe" != "x$MAYBE_WARN"; then commit 0ec7f4423dcb6f80bee020f98fd319b092f90581 Author: Emil Velikov <[email protected]> Date: Mon Aug 31 20:38:54 2015 +0100 intel: introduce to_bo_gem() helper ...to minimise misuse of bo_gem. If the variable is declared at the top of the function and then used for two (or more) different contexts this can cause confusion and errors. Just introduce a wrapper, which can be used in a once off situations. Suggested-by: Chris Wilson <[email protected]> Signed-off-by: Emil Velikov <[email protected]> Reviewed-by Chris Wilson <[email protected]> diff --git a/intel/intel_bufmgr_gem.c b/intel/intel_bufmgr_gem.c index 5287419..63122d0 100644 --- a/intel/intel_bufmgr_gem.c +++ b/intel/intel_bufmgr_gem.c @@ -276,6 +276,11 @@ static void drm_intel_gem_bo_unreference(drm_intel_bo *bo); static void drm_intel_gem_bo_free(drm_intel_bo *bo); +static inline drm_intel_bo_gem *to_bo_gem(drm_intel_bo *bo) +{ + return (drm_intel_bo_gem *)bo; +} + static unsigned long drm_intel_gem_bo_tile_size(drm_intel_bufmgr_gem *bufmgr_gem, unsigned long size, uint32_t *tiling_mode) @@ -2116,11 +2121,10 @@ drm_intel_gem_bo_exec(drm_intel_bo *bo, int used, drm_clip_rect_t * cliprects, int num_cliprects, int DR4) { drm_intel_bufmgr_gem *bufmgr_gem = (drm_intel_bufmgr_gem *) bo->bufmgr; - drm_intel_bo_gem *bo_gem = (drm_intel_bo_gem *) bo; struct drm_i915_gem_execbuffer execbuf; int ret, i; - if (bo_gem->has_error) + if (to_bo_gem(bo)->has_error) return -ENOMEM; pthread_mutex_lock(&bufmgr_gem->lock); @@ -2165,7 +2169,7 @@ drm_intel_gem_bo_exec(drm_intel_bo *bo, int used, drm_intel_gem_dump_validation_list(bufmgr_gem); for (i = 0; i < bufmgr_gem->exec_count; i++) { - bo_gem = (drm_intel_bo_gem *) bufmgr_gem->exec_bos[i]; + drm_intel_bo_gem *bo_gem = to_bo_gem(bufmgr_gem->exec_bos[i]); bo_gem->idle = false; @@ -2185,12 +2189,11 @@ do_exec2(drm_intel_bo *bo, int used, drm_intel_context *ctx, unsigned int flags) { drm_intel_bufmgr_gem *bufmgr_gem = (drm_intel_bufmgr_gem *)bo->bufmgr; - drm_intel_bo_gem *bo_gem = (drm_intel_bo_gem *) bo; struct drm_i915_gem_execbuffer2 execbuf; int ret = 0; int i; - if (bo_gem->has_error) + if (to_bo_gem(bo)->has_error) return -ENOMEM; switch (flags & 0x7) { @@ -2263,7 +2266,7 @@ skip_execution: drm_intel_gem_dump_validation_list(bufmgr_gem); for (i = 0; i < bufmgr_gem->exec_count; i++) { - bo_gem = (drm_intel_bo_gem *) bufmgr_gem->exec_bos[i]; + drm_intel_bo_gem *bo_gem = to_bo_gem(bufmgr_gem->exec_bos[i]); bo_gem->idle = false; commit 94425f627221c0f67503a9aa4dff3502725905b3 Author: Emil Velikov <[email protected]> Date: Sat Aug 15 15:43:46 2015 +0100 intel: error out on has_error in exec2 Just like we do for the original exec() v2: move bo_gem declaration to the top of the function. Cc: [email protected] Signed-off-by: Emil Velikov <[email protected]> Reviewed-by Chris Wilson <[email protected]> diff --git a/intel/intel_bufmgr_gem.c b/intel/intel_bufmgr_gem.c index 7303903..5287419 100644 --- a/intel/intel_bufmgr_gem.c +++ b/intel/intel_bufmgr_gem.c @@ -2185,10 +2185,14 @@ do_exec2(drm_intel_bo *bo, int used, drm_intel_context *ctx, unsigned int flags) { drm_intel_bufmgr_gem *bufmgr_gem = (drm_intel_bufmgr_gem *)bo->bufmgr; + drm_intel_bo_gem *bo_gem = (drm_intel_bo_gem *) bo; struct drm_i915_gem_execbuffer2 execbuf; int ret = 0; int i; + if (bo_gem->has_error) + return -ENOMEM; + switch (flags & 0x7) { default: return -EINVAL; @@ -2259,8 +2263,7 @@ skip_execution: drm_intel_gem_dump_validation_list(bufmgr_gem); for (i = 0; i < bufmgr_gem->exec_count; i++) { - drm_intel_bo_gem *bo_gem = - (drm_intel_bo_gem *) bufmgr_gem->exec_bos[i]; + bo_gem = (drm_intel_bo_gem *) bufmgr_gem->exec_bos[i]; bo_gem->idle = false; commit cf7e32bdf99740ae3249f100b5cb2f0de54a20ef Author: Emil Velikov <[email protected]> Date: Sat Aug 15 15:42:34 2015 +0100 intel: resolve shadowing warnings v2: keep the bo_gem declaration in exec2() within the loop (Chris) Cc: [email protected] Signed-off-by: Emil Velikov <[email protected]> Reviewed-by Chris Wilson <[email protected]> diff --git a/intel/intel_bufmgr_fake.c b/intel/intel_bufmgr_fake.c index 75387b7..551e05d 100644 --- a/intel/intel_bufmgr_fake.c +++ b/intel/intel_bufmgr_fake.c @@ -1460,7 +1460,7 @@ restart: assert(ret == 0); if (bufmgr_fake->exec != NULL) { - int ret = bufmgr_fake->exec(bo, used, bufmgr_fake->exec_priv); + ret = bufmgr_fake->exec(bo, used, bufmgr_fake->exec_priv); if (ret != 0) { pthread_mutex_unlock(&bufmgr_fake->lock); return ret; diff --git a/intel/intel_bufmgr_gem.c b/intel/intel_bufmgr_gem.c index 2723e21..7303903 100644 --- a/intel/intel_bufmgr_gem.c +++ b/intel/intel_bufmgr_gem.c @@ -2165,8 +2165,7 @@ drm_intel_gem_bo_exec(drm_intel_bo *bo, int used, drm_intel_gem_dump_validation_list(bufmgr_gem); for (i = 0; i < bufmgr_gem->exec_count; i++) { - drm_intel_bo *bo = bufmgr_gem->exec_bos[i]; - drm_intel_bo_gem *bo_gem = (drm_intel_bo_gem *) bo; + bo_gem = (drm_intel_bo_gem *) bufmgr_gem->exec_bos[i]; bo_gem->idle = false; @@ -2260,8 +2259,8 @@ skip_execution: drm_intel_gem_dump_validation_list(bufmgr_gem); for (i = 0; i < bufmgr_gem->exec_count; i++) { - drm_intel_bo *bo = bufmgr_gem->exec_bos[i]; - drm_intel_bo_gem *bo_gem = (drm_intel_bo_gem *)bo; + drm_intel_bo_gem *bo_gem = + (drm_intel_bo_gem *) bufmgr_gem->exec_bos[i]; bo_gem->idle = false; diff --git a/intel/intel_decode.c b/intel/intel_decode.c index 2b902a3..345d457 100644 --- a/intel/intel_decode.c +++ b/intel/intel_decode.c @@ -3630,7 +3630,6 @@ decode_3d_965(struct drm_intel_decode *ctx) case 0x7a00: if (IS_GEN6(devid) || IS_GEN7(devid)) { - unsigned int i; if (len != 4 && len != 5) fprintf(out, "Bad count in PIPE_CONTROL\n"); @@ -3732,8 +3731,6 @@ decode_3d_965(struct drm_intel_decode *ctx) if (opcode_3d->func) { return opcode_3d->func(ctx); } else { - unsigned int i; - instr_out(ctx, 0, "%s\n", opcode_3d->name); for (i = 1; i < len; i++) { @@ -3883,9 +3880,9 @@ drm_intel_decode_set_head_tail(struct drm_intel_decode *ctx, void drm_intel_decode_set_output_file(struct drm_intel_decode *ctx, - FILE *out) + FILE *output) { - ctx->out = out; + ctx->out = output; } /** commit 99722bfec6f1bbfc5148701f85ac145140d46afb Author: Emil Velikov <[email protected]> Date: Sat Aug 15 15:20:37 2015 +0100 modetest: fix shadowing warnings No real issue here, but let's fix these so that real issues don't get lost in the spam. Signed-off-by: Emil Velikov <[email protected]> diff --git a/tests/modetest/modetest.c b/tests/modetest/modetest.c index 3a545c3..3b01918 100644 --- a/tests/modetest/modetest.c +++ b/tests/modetest/modetest.c @@ -589,7 +589,6 @@ static struct resources *get_resources(struct device *dev) #define get_resource(_res, __res, type, Type) \ do { \ - int i; \ for (i = 0; i < (int)(_res)->__res->count_##type##s; ++i) { \ (_res)->type##s[i].type = \ drmModeGet##Type(dev->fd, (_res)->__res->type##s[i]); \ @@ -616,7 +615,6 @@ static struct resources *get_resources(struct device *dev) #define get_properties(_res, __res, type, Type) \ do { \ - int i; \ for (i = 0; i < (int)(_res)->__res->count_##type##s; ++i) { \ struct type *obj = &res->type##s[i]; \ unsigned int j; \ @@ -1301,7 +1299,6 @@ static void test_page_flip(struct device *dev, struct pipe_arg *pipes, unsigned #else struct timeval timeout = { .tv_sec = 3, .tv_usec = 0 }; fd_set fds; - int ret; FD_ZERO(&fds); FD_SET(0, &fds); commit 687cc66d469c8ab4b8a044c01305653f92008215 Author: Emil Velikov <[email protected]> Date: Sat Aug 15 15:12:36 2015 +0100 vbltest: fix variable shadowing warning Just remove the second (shadowing) declaration of ret. Signed-off-by: Emil Velikov <[email protected]> diff --git a/tests/vbltest/vbltest.c b/tests/vbltest/vbltest.c index 4200adb..e27f45c 100644 --- a/tests/vbltest/vbltest.c +++ b/tests/vbltest/vbltest.c @@ -177,7 +177,6 @@ int main(int argc, char **argv) while (1) { struct timeval timeout = { .tv_sec = 3, .tv_usec = 0 }; fd_set fds; - int ret; FD_ZERO(&fds); FD_SET(0, &fds); ------------------------------------------------------------------------------ --