Skip to contentSkip to conversation

vbltest: fix variable shadowing warning

PATCH In review Emil Velikov 4 participants 33 messages Aug 24, 2015 – Sep 4, 2015 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/17 vbltest: fix variable shadowing warning

Just remove the second (shadowing) declaration of ret.

---
 tests/vbltest/vbltest.c | 1 -
 1 file changed, 1 deletion(-)
tests/vbltest/vbltest.c +0 -1
index 4200adb..e27f45c 100644
@@ -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);
Signature · 6 lines
2.5.0

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#1 lore raw

PATCH 2/17 modetest: fix shadowing warnings

No real issue here, but let's fix these so that real issues don't get lost in the spam.

---
 tests/modetest/modetest.c | 3 ---
 1 file changed, 3 deletions(-)
tests/modetest/modetest.c +0 -3
index 3a545c3..3b01918 100644
@@ -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);
Signature · 6 lines
2.5.0

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#2 lore raw

PATCH 3/17 intel: resolve shadowing warnings

In reply to Emil Velikov
---
 intel/intel_bufmgr_fake.c | 2 +-
 intel/intel_bufmgr_gem.c  | 7 +++----
 intel/intel_decode.c      | 7 ++-----
 3 files changed, 6 insertions(+), 10 deletions(-)
intel/intel_bufmgr_fake.c +1 -1
index 75387b7..551e05d 100644
@@ -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;
intel/intel_bufmgr_gem.c +3 -4
index 2723e21..cf55a53 100644
@@ -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;
 
@@ -2186,6 +2185,7 @@ 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;
@@ -2260,8 +2260,7 @@ 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;
+		bo_gem = (drm_intel_bo_gem *) bufmgr_gem->exec_bos[i];
 
 		bo_gem->idle = false;
 
intel/intel_decode.c +2 -5
index 2b902a3..345d457 100644
@@ -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;
 }
 
 /**
Signature · 6 lines
2.5.0

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#3 lore raw

PATCH v2 1/1 intel: resolve shadowing warnings

v2: keep the bo_gem declaration in exec2() within the loop (Chris)

---
 intel/intel_bufmgr_fake.c | 2 +-
 intel/intel_bufmgr_gem.c  | 7 +++----
 intel/intel_decode.c      | 7 ++-----
 3 files changed, 6 insertions(+), 10 deletions(-)
intel/intel_bufmgr_fake.c +1 -1
index 75387b7..551e05d 100644
@@ -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;
intel/intel_bufmgr_gem.c +3 -4
index 2723e21..7303903 100644
@@ -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;
 
intel/intel_decode.c +2 -5
index 2b902a3..345d457 100644
@@ -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;
 }
 
 /**
Signature · 6 lines
2.5.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v2 1/1
#4 lore raw

Re: [PATCH libdrm v2] intel: resolve shadowing warnings

Quoted 5 lines · Emil Velikov

v2: keep the bo_gem declaration in exec2() within the loop (Chris)

-Chris

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#5 lore raw

PATCH 4/17 intel: error out on has_error in exec2

In reply to Emil Velikov

Just like we do for the original exec()

---
 intel/intel_bufmgr_gem.c | 3 +++
 1 file changed, 3 insertions(+)
intel/intel_bufmgr_gem.c +3 -0
index cf55a53..5287419 100644
@@ -2190,6 +2190,9 @@ do_exec2(drm_intel_bo *bo, int used, drm_intel_context *ctx,
 	int ret = 0;
 	int i;
 
+	if (bo_gem->has_error)
+		return -ENOMEM;
+
 	switch (flags & 0x7) {
 	default:
 		return -EINVAL;
Signature · 6 lines
2.5.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#6 lore raw

PATCH v2 1/1 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.

---
 intel/intel_bufmgr_gem.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
intel/intel_bufmgr_gem.c +5 -2
index 7303903..5287419 100644
@@ -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;
 
Signature · 6 lines
2.5.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#7 lore raw

Re: [PATCH libdrm v2] intel: error out on has_error in exec2

Quoted 31 lines · Emil Velikov

Just like we do for the original exec()

v2: move bo_gem declaration to the top of the function.

---
 intel/intel_bufmgr_gem.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
intel/intel_bufmgr_gem.c +4 -0
index 7303903..5287419 100644
@@ -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;

intel/intel_bufmgr_gem.c skip_execution: · line 2266

Quoted 6 lines
intel/intel_bufmgr_gem.c +1 -2
@@ -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];

Reusing bo_gem here is a little worrying as it would be very easy for someone to add code to the end of the function thinking that bo_gem still was the batch.

If we had

static inline drm_intel_bo_gem *to_bo_gem(drm_intel_bo *bo)

{
	return (drm_intel_bo_gem *)bo;
}

then we can start doing one offs like

if (to_bo_gem(bo)->has_error) return -ENOMEM;

and of course

	for (i = 0; i < bufmgr_gem->exec_count; i++) {
		drm_intel_bo_gem *bo_gem = to_bo_gem(bufmgr_gem->exec_bos[i]);

-Chris

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#8 lore raw

Re: [PATCH libdrm v2] intel: error out on has_error in exec2

Quoted 34 lines · Chris Wilson
Quoted 33 lines · Emil Velikov

Just like we do for the original exec()

v2: move bo_gem declaration to the top of the function.

---
 intel/intel_bufmgr_gem.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
intel/intel_bufmgr_gem.c +4 -0
index 7303903..5287419 100644
@@ -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);
 
Quoted 9 lines

intel/intel_bufmgr_gem.c skip_execution: · line 2266

Quoted 4 lines
intel/intel_bufmgr_gem.c +1 -2
      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];

Reusing bo_gem here is a little worrying as it would be very easy for someone to add code to the end of the function thinking that bo_gem still was the batch.

Doesn't this concert apply to drm_intel_gem_bo_exec() as well ?

Quoted 7 lines

If we had

static inline drm_intel_bo_gem *to_bo_gem(drm_intel_bo *bo)

{
        return (drm_intel_bo_gem *)bo;
}
Quoted 7 lines

then we can start doing one offs like

if (to_bo_gem(bo)->has_error) return -ENOMEM;

and of course

        for (i = 0; i < bufmgr_gem->exec_count; i++) {
                drm_intel_bo_gem *bo_gem = to_bo_gem(bufmgr_gem->exec_bos[i]);

How about we do this as a follow up patch (4.1/17) that covers both functions ?

Thanks again,
Emil
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#9 lore raw

Re: [PATCH libdrm v2] intel: error out on has_error in exec2

Quoted 5 lines · Emil Velikov
Quoted 4 lines

Reusing bo_gem here is a little worrying as it would be very easy for someone to add code to the end of the function thinking that bo_gem still was the batch.

Doesn't this concert apply to drm_intel_gem_bo_exec() as well ?

Probably. Haven't looked at that in years. :p

Quoted 9 lines
Quoted 9 lines

If we had

static inline drm_intel_bo_gem *to_bo_gem(drm_intel_bo *bo)

{
        return (drm_intel_bo_gem *)bo;
}

then we can start doing one offs like

Quoted 7 lines
Quoted 5 lines

if (to_bo_gem(bo)->has_error) return -ENOMEM;

and of course

        for (i = 0; i < bufmgr_gem->exec_count; i++) {
                drm_intel_bo_gem *bo_gem = to_bo_gem(bufmgr_gem->exec_bos[i]);

How about we do this as a follow up patch (4.1/17) that covers both functions ?

If you are quick...
-Chris

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#10 lore raw

PATCH 1/1 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.

---
 intel/intel_bufmgr_gem.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)
intel/intel_bufmgr_gem.c +9 -6
index 5287419..63122d0 100644
@@ -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;
 
Signature · 6 lines
2.5.0

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#11 lore raw

Re: [PATCH libdrm 4.1/17] intel: introduce to_bo_gem() helper

Quoted 9 lines · Emil Velikov

...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.

Reviewed-by Chris Wilson <[email protected]> (And may as well take that as r-b for the preceding patch then) -Chris

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#12 lore raw

PATCH 5/17 configure: enable -Wshadow when available

In reply to Emil Velikov
---
 configure.ac | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
configure.ac +1 -1
index f07507b..c2a8ed1 100644
@@ -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
Signature · 6 lines
2.5.0

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#13 lore raw

PATCH 6/17 amdgpu: remove unneeded -Wno-switch-enum flag

In reply to Emil Velikov
---
 amdgpu/Makefile.am | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
amdgpu/Makefile.am +1 -1
index 37f7198..cf7bc1b 100644
@@ -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
Signature · 6 lines
2.5.0

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v1 6/17
#14 lore raw

Re: [PATCH libdrm 06/17] amdgpu: remove unneeded -Wno-switch-enum flag

Quoted 1 line · Emil Velikov
Quoted 20 lines
---
 amdgpu/Makefile.am | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
amdgpu/Makefile.am +1 -2
index 37f7198..cf7bc1b 100644
@@ -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
--

2.5.0

Quoted 4 lines

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#15 lore raw

PATCH 7/17 modetest: annotate const data as such for good measure

In reply to Emil Velikov
---
 tests/modetest/cursor.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
tests/modetest/cursor.c +5 -5
index 62a50ef..d8a19bd 100644
@@ -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++) {
Signature · 6 lines
2.5.0

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#16 lore raw

PATCH 8/17 libkms: use static const for good measure

In reply to Emil Velikov
---
 libkms/linux.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
libkms/linux.c +1 -1
index b735527..6e0da83 100644
@@ -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 */
Signature · 6 lines
2.5.0

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#17 lore raw

PATCH 9/17 radeon: cleanup bo/cs func tables

In reply to Emil Velikov

Annotate the data as static const and use C99 designated initializers.

---
 radeon/radeon_bo_gem.c | 23 ++++++++++++-----------
 radeon/radeon_bo_int.h |  2 +-
 radeon/radeon_cs_gem.c | 20 ++++++++++----------
 radeon/radeon_cs_int.h |  2 +-
 4 files changed, 24 insertions(+), 23 deletions(-)
radeon/radeon_bo_gem.c +12 -11
index 7fdd437..c9fe19f 100644
@@ -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)
radeon/radeon_bo_int.h +1 -1
index 9589ead..de981b0 100644
@@ -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;
 };
 
radeon/radeon_cs_gem.c +10 -10
index 1962e91..cdec64e 100644
@@ -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)
radeon/radeon_cs_int.h +1 -1
index 6cee574..d906ad4 100644
@@ -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;
Signature · 6 lines
2.5.0

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v1 9/17
#18 lore raw

Re: [PATCH libdrm 09/17] radeon: cleanup bo/cs func tables

Quoted 3 lines · Emil Velikov

Annotate the data as static const and use C99 designated initializers.

Quoted 101 lines
---
 radeon/radeon_bo_gem.c | 23 ++++++++++++-----------
 radeon/radeon_bo_int.h |  2 +-
 radeon/radeon_cs_gem.c | 20 ++++++++++----------
 radeon/radeon_cs_int.h |  2 +-
 4 files changed, 24 insertions(+), 23 deletions(-)
radeon/radeon_bo_gem.c +12 -11
index 7fdd437..c9fe19f 100644
@@ -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)
radeon/radeon_bo_int.h +1 -1
index 9589ead..de981b0 100644
@@ -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;
 };
 
radeon/radeon_cs_gem.c +10 -10
index 1962e91..cdec64e 100644
@@ -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)
radeon/radeon_cs_int.h +1 -2
index 6cee574..d906ad4 100644
@@ -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;
--

2.5.0

Quoted 4 lines

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#19 lore raw

PATCH 10/17 freedreno: annotate the device/bo/pipe/ringbuffer funcs as const data

In reply to Emil Velikov
---
 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 +-
 10 files changed, 12 insertions(+), 12 deletions(-)
freedreno/freedreno_priv.h +3 -3
index 1dddcc3..4e442e4 100644
@@ -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 */
freedreno/freedreno_ringbuffer.h +1 -1
index a5e1d03..578cdb2 100644
@@ -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;
 };
freedreno/kgsl/kgsl_bo.c +1 -1
index 3407c76..b8ac102 100644
@@ -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,
freedreno/kgsl/kgsl_device.c +1 -1
index 8352d60..175e837 100644
@@ -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,
freedreno/kgsl/kgsl_pipe.c +1 -1
index e2fd65c..58b3b4d 100644
@@ -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,
freedreno/kgsl/kgsl_ringbuffer.c +1 -1
index f013307..6f68f2f 100644
@@ -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,
freedreno/msm/msm_bo.c +1 -1
index fd94413..ee668ab 100644
@@ -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,
freedreno/msm/msm_device.c +1 -1
index 81077e1..25c097c 100644
@@ -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,
freedreno/msm/msm_pipe.c +1 -1
index e1edffe..aa0866b 100644
@@ -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,
freedreno/msm/msm_ringbuffer.c +1 -1
index 5ddea57..ee6af0b 100644
@@ -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,
Signature · 6 lines
2.5.0

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#20 lore raw

PATCH 11/17 tests/amdgpu: reference the correct variable for memcpy

In reply to Emil Velikov
---
 tests/amdgpu/cs_tests.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tests/amdgpu/cs_tests.c +2 -2
index 416f36b..dfbf5af 100644
@@ -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;
 
Signature · 6 lines
2.5.0

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v1 11/17
#21 lore raw

Re: [PATCH libdrm 11/17] tests/amdgpu: reference the correct variable for memcpy

Quoted 3 lines · Emil Velikov
Quoted 29 lines
---
 tests/amdgpu/cs_tests.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tests/amdgpu/cs_tests.c +2 -3
index 416f36b..dfbf5af 100644
@@ -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;
 
--

2.5.0

Quoted 4 lines

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#22 lore raw

PATCH 12/17 tests/amdgpu: annotate the uvd message templates as const data

In reply to Emil Velikov
---
 tests/amdgpu/uvd_messages.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
tests/amdgpu/uvd_messages.h +5 -5
index 44bcacc..00235cb 100644
@@ -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,
Signature · 6 lines
2.5.0

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v1 12/17
#23 lore raw

Re: [PATCH libdrm 12/17] tests/amdgpu: annotate the uvd message templates as const data

Quoted 3 lines · Emil Velikov
Quoted 56 lines
---
 tests/amdgpu/uvd_messages.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
tests/amdgpu/uvd_messages.h +5 -6
index 44bcacc..00235cb 100644
@@ -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,
--

2.5.0

Quoted 4 lines

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#24 lore raw

PATCH 13/17 tests/amdgpu: annotate (most of) the vce templates as const data

In reply to Emil Velikov

The remaining two templates are modified on the fly, depending on the type of test to be performed.

---
 tests/amdgpu/vce_ib.h | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)
tests/amdgpu/vce_ib.h +12 -12
index c5afed0..bd0bf94 100644
@@ -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,
 };
Signature · 6 lines
2.5.0

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v1 13/17
#25 lore raw

Re: [PATCH libdrm 13/17] tests/amdgpu: annotate (most of) the vce templates as const data

Quoted 6 lines · Emil Velikov

The remaining two templates are modified on the fly, depending on the type of test to be performed.

Quoted 116 lines
---
 tests/amdgpu/vce_ib.h | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)
tests/amdgpu/vce_ib.h +12 -13
index c5afed0..bd0bf94 100644
@@ -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,
 };
--

2.5.0

Quoted 4 lines

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#26 lore raw

PATCH 14/17 tests/amdgpu: ensure tests work by using c99 initializers

In reply to Emil Velikov

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).

---
 tests/amdgpu/amdgpu_test.c | 32 ++++++++++++++++++++++++--------
 1 file changed, 24 insertions(+), 8 deletions(-)
tests/amdgpu/amdgpu_test.c +24 -8
index 6568990..71f357c 100644
@@ -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,
 };
 
Signature · 6 lines
2.5.0

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v1 14/17
#27 lore raw

Re: [PATCH libdrm 14/17] tests/amdgpu: ensure tests work by using c99 initializers

Quoted 10 lines · Emil Velikov

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).

Quoted 50 lines
---
 tests/amdgpu/amdgpu_test.c | 32 ++++++++++++++++++++++++--------
 1 file changed, 24 insertions(+), 8 deletions(-)
tests/amdgpu/amdgpu_test.c +24 -9
index 6568990..71f357c 100644
@@ -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,
 };
 
--

2.5.0

Quoted 4 lines

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#28 lore raw

Re: [PATCH libdrm 14/17] tests/amdgpu: ensure tests work by using c99 initializers

Quoted 8 lines · Alex Deucher
Quoted 7 lines · Emil Velikov

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).

Quoted 5 lines
Quoted 3 lines

Any plans to push this?

Thanks,

Alex

Quoted 48 lines
Quoted 48 lines
---
 tests/amdgpu/amdgpu_test.c | 32 ++++++++++++++++++++++++--------
 1 file changed, 24 insertions(+), 8 deletions(-)
tests/amdgpu/amdgpu_test.c +24 -8
index 6568990..71f357c 100644
@@ -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,
 };
 
Quoted 7 lines
Quoted 7 lines

--
2.5.0

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#29 lore raw

Re: [PATCH libdrm 14/17] tests/amdgpu: ensure tests work by using c99 initializers

Quoted 9 lines · Alex Deucher
Quoted 8 lines · Alex Deucher
Quoted 7 lines · Emil Velikov

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).

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

Any plans to push this?

Oops, I thought I did just after Chris's feedback. Thanks for the reminder, they're in definitely in master now.

-Emil
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#30 lore raw

PATCH 16/17 intel: ignore missing-field-initializers warnings

In reply to Emil Velikov

We're about to remove the -Wno flag from configure.ac which will lead to a lot of unnecessary spam.

---
 intel/intel_decode.c | 3 +++
 1 file changed, 3 insertions(+)
intel/intel_decode.c +3 -0
index 345d457..e7aef74 100644
@@ -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. */
Signature · 6 lines
2.5.0

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#31 lore raw

PATCH 17/17 configure: remove -Wno-missing-field-initializers

In reply to Emil Velikov
---
 configure.ac | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
configure.ac +1 -1
index c2a8ed1..1d7bd5b 100644
@@ -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
Signature · 6 lines
2.5.0

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

A message that is not in the archive (sent off-list or not yet received): 1440434060-31347-1-git-send-email-emil.l.velikov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#33 lore raw

PATCH 15/17 nouveau: use designated initializers

---
 nouveau/abi16.c   | 13 ++++++++++---
 nouveau/nouveau.c |  6 +++---
 2 files changed, 13 insertions(+), 6 deletions(-)
nouveau/abi16.c +10 -3
index 4ca0bfb..59bc436 100644
@@ -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;
nouveau/nouveau.c +3 -3
index 7393474..97fd77b 100644
@@ -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);
Signature · 6 lines
2.5.0

_______________________________________________
Nouveau mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau