[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

libdrm: Changes to 'upstream-unstable'



 Makefile.am                      |    2 
 amdgpu/Android.mk                |   18 +
 amdgpu/Makefile.am               |   20 --
 amdgpu/Makefile.sources          |   14 +
 amdgpu/amdgpu_bo.c               |   11 -
 amdgpu/amdgpu_cs.c               |   13 -
 amdgpu/amdgpu_device.c           |    2 
 amdgpu/amdgpu_internal.h         |    3 
 configure.ac                     |    6 
 freedreno/freedreno-symbol-check |    1 
 freedreno/freedreno_bo.c         |   38 ++--
 freedreno/freedreno_device.c     |    5 
 freedreno/freedreno_drmif.h      |    1 
 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 
 include/drm/drm.h                |    1 
 include/drm/drm_fourcc.h         |   93 +++++++++
 include/drm/drm_mode.h           |   11 +
 intel/intel_bufmgr_fake.c        |    2 
 intel/intel_bufmgr_gem.c         |   31 +--
 intel/intel_decode.c             |   10 -
 libkms/linux.c                   |    2 
 nouveau/abi16.c                  |   13 +
 nouveau/nouveau.c                |    6 
 omap/omap_drm.c                  |    1 
 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/Makefile.am                |    2 
 tests/amdgpu/amdgpu_test.c       |   32 ++-
 tests/amdgpu/basic_tests.c       |    3 
 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        |    7 
 tests/vbltest/vbltest.c          |    1 
 xf86drm.c                        |  368 ++++++++++++++++++++++++++++++++++++++-
 xf86drm.h                        |   34 +++
 xf86drmMode.c                    |    4 
 49 files changed, 714 insertions(+), 160 deletions(-)

New commits:
commit c3496167637e35cf8a52d5e7e53a412e79d80db0
Author: Rob Clark <robclark@freedesktop.org>
Date:   Wed Sep 16 09:03:40 2015 -0400

    Bump version for release
    
    Signed-off-by: Rob Clark <robclark@freedesktop.org>

diff --git a/configure.ac b/configure.ac
index 1d7bd5b..cf10ef2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -20,7 +20,7 @@
 
 AC_PREREQ([2.63])
 AC_INIT([libdrm],
-        [2.4.64],
+        [2.4.65],
         [https://bugs.freedesktop.org/enter_bug.cgi?product=DRI],
         [libdrm])
 

commit 94ecdcb8b11dd3eb6b047ad72030d775014aadee
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date:   Sun Sep 6 09:34:31 2015 -0700

    Include <alloca.h> when needed before calling alloca
    
    Fixes "error: implicit declaration of function 'alloca'" failures
    when building on Solaris
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
    Reviewed-by: Marek Olšák <marek.olsak@amd.com>

diff --git a/amdgpu/amdgpu_cs.c b/amdgpu/amdgpu_cs.c
index c7910ad..4da9821 100644
--- a/amdgpu/amdgpu_cs.c
+++ b/amdgpu/amdgpu_cs.c
@@ -32,6 +32,9 @@
 #include <pthread.h>
 #include <sched.h>
 #include <sys/ioctl.h>
+#ifdef HAVE_ALLOCA_H
+# include <alloca.h>
+#endif
 
 #include "xf86drm.h"
 #include "amdgpu_drm.h"
diff --git a/tests/amdgpu/basic_tests.c b/tests/amdgpu/basic_tests.c
index 7874039..e489e6e 100644
--- a/tests/amdgpu/basic_tests.c
+++ b/tests/amdgpu/basic_tests.c
@@ -28,6 +28,9 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
+#ifdef HAVE_ALLOCA_H
+# include <alloca.h>
+#endif
 
 #include "CUnit/Basic.h"
 

commit 8983fe5497e89a3ffaba3ad1ee06a30a1c7e6daf
Author: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Date:   Mon Aug 3 10:48:03 2015 +0100

    libdrm: Add framebuffer modifiers uapi
    
    Sync up with new kernel features as per commits:
    
    e3eb3250d84ef97b766312345774367b6a310db8
    93b81f5102a7cd270a305c2741b17c8d44bb0629
    b5ff6e1637b683d5996ae11ac29afe406c0bee90
    8c4f83fb1e8bf317e894f62d17a63c32b7a6b75e
    570655b09b065d2fff1b8ab9bdb8308f4c5a05a3
    
    Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
    Cc: dri-devel@lists.freedesktop.org
    Cc: Rob Clark <robdclark@gmail.com>
    Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
    Signed-off-by: Rob Clark <robclark@freedesktop.org>

diff --git a/include/drm/drm.h b/include/drm/drm.h
index 167b7b8..a950b58 100644
--- a/include/drm/drm.h
+++ b/include/drm/drm.h
@@ -816,6 +816,7 @@ struct drm_event_vblank {
 #define DRM_CAP_PRIME 0x5
 #define DRM_CAP_TIMESTAMP_MONOTONIC 0x6
 #define DRM_CAP_ASYNC_PAGE_FLIP 0x7
+#define DRM_CAP_ADDFB2_MODIFIERS	0x10
 
 #define DRM_PRIME_CAP_IMPORT 0x1
 #define DRM_PRIME_CAP_EXPORT 0x2
diff --git a/include/drm/drm_fourcc.h b/include/drm/drm_fourcc.h
index 85facb0..63a80ca 100644
--- a/include/drm/drm_fourcc.h
+++ b/include/drm/drm_fourcc.h
@@ -127,4 +127,97 @@
 #define DRM_FORMAT_YUV444	fourcc_code('Y', 'U', '2', '4') /* non-subsampled Cb (1) and Cr (2) planes */
 #define DRM_FORMAT_YVU444	fourcc_code('Y', 'V', '2', '4') /* non-subsampled Cr (1) and Cb (2) planes */
 
+
+/*
+ * Format Modifiers:
+ *
+ * Format modifiers describe, typically, a re-ordering or modification
+ * of the data in a plane of an FB.  This can be used to express tiled/
+ * swizzled formats, or compression, or a combination of the two.
+ *
+ * The upper 8 bits of the format modifier are a vendor-id as assigned
+ * below.  The lower 56 bits are assigned as vendor sees fit.
+ */
+
+/* Vendor Ids: */
+#define DRM_FORMAT_MOD_NONE           0
+#define DRM_FORMAT_MOD_VENDOR_INTEL   0x01
+#define DRM_FORMAT_MOD_VENDOR_AMD     0x02
+#define DRM_FORMAT_MOD_VENDOR_NV      0x03
+#define DRM_FORMAT_MOD_VENDOR_SAMSUNG 0x04
+#define DRM_FORMAT_MOD_VENDOR_QCOM    0x05
+/* add more to the end as needed */
+
+#define fourcc_mod_code(vendor, val) \
+	((((u64)DRM_FORMAT_MOD_VENDOR_## vendor) << 56) | (val & 0x00ffffffffffffffULL))
+
+/*
+ * Format Modifier tokens:
+ *
+ * When adding a new token please document the layout with a code comment,
+ * similar to the fourcc codes above. drm_fourcc.h is considered the
+ * authoritative source for all of these.
+ */
+
+/* Intel framebuffer modifiers */
+
+/*
+ * Intel X-tiling layout
+ *
+ * This is a tiled layout using 4Kb tiles (except on gen2 where the tiles 2Kb)
+ * in row-major layout. Within the tile bytes are laid out row-major, with
+ * a platform-dependent stride. On top of that the memory can apply
+ * platform-depending swizzling of some higher address bits into bit6.
+ *
+ * This format is highly platforms specific and not useful for cross-driver
+ * sharing. It exists since on a given platform it does uniquely identify the
+ * layout in a simple way for i915-specific userspace.
+ */
+#define I915_FORMAT_MOD_X_TILED	fourcc_mod_code(INTEL, 1)
+
+/*
+ * Intel Y-tiling layout
+ *
+ * This is a tiled layout using 4Kb tiles (except on gen2 where the tiles 2Kb)
+ * in row-major layout. Within the tile bytes are laid out in OWORD (16 bytes)
+ * chunks column-major, with a platform-dependent height. On top of that the
+ * memory can apply platform-depending swizzling of some higher address bits
+ * into bit6.
+ *
+ * This format is highly platforms specific and not useful for cross-driver
+ * sharing. It exists since on a given platform it does uniquely identify the
+ * layout in a simple way for i915-specific userspace.
+ */
+#define I915_FORMAT_MOD_Y_TILED	fourcc_mod_code(INTEL, 2)
+
+/*
+ * Intel Yf-tiling layout
+ *
+ * This is a tiled layout using 4Kb tiles in row-major layout.
+ * Within the tile pixels are laid out in 16 256 byte units / sub-tiles which
+ * are arranged in four groups (two wide, two high) with column-major layout.
+ * Each group therefore consits out of four 256 byte units, which are also laid
+ * out as 2x2 column-major.
+ * 256 byte units are made out of four 64 byte blocks of pixels, producing
+ * either a square block or a 2:1 unit.
+ * 64 byte blocks of pixels contain four pixel rows of 16 bytes, where the width
+ * in pixel depends on the pixel depth.
+ */
+#define I915_FORMAT_MOD_Yf_TILED fourcc_mod_code(INTEL, 3)
+
+/*
+ * Tiled, NV12MT, grouped in 64 (pixels) x 32 (lines) -sized macroblocks
+ *
+ * Macroblocks are laid in a Z-shape, and each pixel data is following the
+ * standard NV12 style.
+ * As for NV12, an image is the result of two frame buffers: one for Y,
+ * one for the interleaved Cb/Cr components (1/2 the height of the Y buffer).
+ * Alignment requirements are (for each buffer):
+ * - multiple of 128 pixels for the width
+ * - multiple of  32 pixels for the height
+ *
+ * For more information: see http://linuxtv.org/downloads/v4l-dvb-apis/re32.html
+ */
+#define DRM_FORMAT_MOD_SAMSUNG_64_32_TILE	fourcc_mod_code(SAMSUNG, 1)
+
 #endif /* DRM_FOURCC_H */
diff --git a/include/drm/drm_mode.h b/include/drm/drm_mode.h
index 69c1ac3..115f36e 100644
--- a/include/drm/drm_mode.h
+++ b/include/drm/drm_mode.h
@@ -322,7 +322,8 @@ struct drm_mode_fb_cmd {
 	__u32 handle;
 };
 
-#define DRM_MODE_FB_INTERLACED (1<<0) /* for interlaced framebuffers */
+#define DRM_MODE_FB_INTERLACED	(1<<0) /* for interlaced framebuffers */
+#define DRM_MODE_FB_MODIFIERS	(1<<1) /* enables ->modifer[] */
 
 struct drm_mode_fb_cmd2 {
 	__u32 fb_id;
@@ -343,10 +344,18 @@ struct drm_mode_fb_cmd2 {
 	 * So it would consist of Y as offset[0] and UV as
 	 * offset[1].  Note that offset[0] will generally
 	 * be 0.
+	 *
+	 * To accommodate tiled, compressed, etc formats, a per-plane
+	 * modifier can be specified.  The default value of zero
+	 * indicates "native" format as specified by the fourcc.
+	 * Vendor specific modifier token.  This allows, for example,
+	 * different tiling/swizzling pattern on different planes.
+	 * See discussion above of DRM_FORMAT_MOD_xxx.
 	 */
 	__u32 handles[4];
 	__u32 pitches[4]; /* pitch for each plane */
 	__u32 offsets[4]; /* offset of each plane */
+	__u64 modifier[4]; /* ie, tiling, compressed (per plane) */
 };
 
 #define DRM_MODE_FB_DIRTY_ANNOTATE_COPY 0x01

commit a814152187ab4130544319c0d9b7eb4f16791cf4
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Mon Sep 7 19:02:14 2015 +0900

    tests: Add -lm to LDADD for dristat
    
    Fixes build failure due to unresolved log2.
    
    Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
    Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>

diff --git a/tests/Makefile.am b/tests/Makefile.am
index 9a2d932..a511d28 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -33,6 +33,8 @@ check_PROGRAMS = \
 	dristat \
 	drmstat
 
+dristat_LDADD = -lm
+
 if HAVE_NOUVEAU
 SUBDIRS += nouveau
 endif

commit 7faedc9efcff12e7620f3a679cff33b1f818b539
Author: Emil Velikov <emil.l.velikov@gmail.com>
Date:   Sat Aug 15 17:00:37 2015 +0100

    configure: remove -Wno-missing-field-initializers
    
    Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>

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 <emil.l.velikov@gmail.com>
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 <emil.l.velikov@gmail.com>

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 <emil.l.velikov@gmail.com>
Date:   Sat Aug 15 18:01:53 2015 +0100

    nouveau: use designated initializers
    
    Cc: nouveau@lists.freedesktop.org
    Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>

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 <emil.l.velikov@gmail.com>
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 <leo.liu@amd.com>
    Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

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 <emil.l.velikov@gmail.com>
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 <leo.liu@amd.com>
    Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

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 <emil.l.velikov@gmail.com>
Date:   Sat Aug 15 17:25:21 2015 +0100

    tests/amdgpu: annotate the uvd message templates as const data
    
    Cc: Leo Liu <leo.liu@amd.com>
    Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

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 <emil.l.velikov@gmail.com>
Date:   Sat Aug 15 17:24:21 2015 +0100

    tests/amdgpu: reference the correct variable for memcpy
    
    Cc: Leo Liu <leo.liu@amd.com>
    Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

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 <emil.l.velikov@gmail.com>
Date:   Sat Aug 15 17:17:52 2015 +0100

    freedreno: annotate the device/bo/pipe/ringbuffer funcs as const data
    
    Cc: freedreno@lists.freedesktop.org
    Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>

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 <emil.l.velikov@gmail.com>
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 <emil.l.velikov@gmail.com>
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

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 <emil.l.velikov@gmail.com>
Date:   Sat Aug 15 17:01:55 2015 +0100

    libkms: use static const for good measure
    
    Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>

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 <emil.l.velikov@gmail.com>
Date:   Sat Aug 15 17:00:56 2015 +0100


Reply to: