Skip to contentSkip to conversation

tests/gem_ctx_exec: fix destroy ioctl number

PATCH In review Mika Kuoppala 2 participants 4 messages Feb 4, 2013 – Feb 5, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tests/gem_ctx_exec: fix destroy ioctl number

Destroy was never called properly

---
 tests/gem_ctx_exec.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/gem_ctx_exec.c +1 -1
index 423f1ee..0288fe8 100644
@@ -57,7 +57,7 @@ struct local_drm_i915_gem_context_destroy {
 };
 
 #define CONTEXT_CREATE_IOCTL DRM_IOWR(DRM_COMMAND_BASE + 0x2d, struct local_drm_i915_gem_context_create)
-#define CONTEXT_DESTROY_IOCTL DRM_IOWR(DRM_COMMAND_BASE + 0x23, struct local_drm_i915_gem_context_destroy)
+#define CONTEXT_DESTROY_IOCTL DRM_IOWR(DRM_COMMAND_BASE + 0x2e, struct local_drm_i915_gem_context_destroy)
 
 static uint32_t context_create(int fd)
 {
Signature · 1 line
1.7.9.5
#1 lore raw
Quoted 3 lines · Mika Kuoppala

Destroy was never called properly

Oops, that's a bit a goof-up, nice catch. While at it, can you please augment the test to check whether a destroyed context doesn't work any more for batchbuffers? It looks like gem_ctx_exec.c should be easy to extend with this.
-Daniel

Quoted 24 lines
---
 tests/gem_ctx_exec.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/gem_ctx_exec.c +1 -1
index 423f1ee..0288fe8 100644
@@ -57,7 +57,7 @@ struct local_drm_i915_gem_context_destroy {
 };
 
 #define CONTEXT_CREATE_IOCTL DRM_IOWR(DRM_COMMAND_BASE + 0x2d, struct local_drm_i915_gem_context_create)
-#define CONTEXT_DESTROY_IOCTL DRM_IOWR(DRM_COMMAND_BASE + 0x23, struct local_drm_i915_gem_context_destroy)
+#define CONTEXT_DESTROY_IOCTL DRM_IOWR(DRM_COMMAND_BASE + 0x2e, struct local_drm_i915_gem_context_destroy)
 
 static uint32_t context_create(int fd)
 {
Signature · 6 lines
1.7.9.5

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#2 lore raw

PATCH 1/1 tests/gem_ctx_exec: properly test destroy_ctx ioctl

Call context destroy with proper ioctl number and add test to verify that we can't post batchbuffers with destroyed context.

---
 tests/gem_ctx_exec.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
tests/gem_ctx_exec.c +3 -1
index 423f1ee..b0362cc 100644
@@ -57,7 +57,7 @@ struct local_drm_i915_gem_context_destroy {
 };
 
 #define CONTEXT_CREATE_IOCTL DRM_IOWR(DRM_COMMAND_BASE + 0x2d, struct local_drm_i915_gem_context_create)
-#define CONTEXT_DESTROY_IOCTL DRM_IOWR(DRM_COMMAND_BASE + 0x23, struct local_drm_i915_gem_context_destroy)
+#define CONTEXT_DESTROY_IOCTL DRM_IOWR(DRM_COMMAND_BASE + 0x2e, struct local_drm_i915_gem_context_destroy)
 
 static uint32_t context_create(int fd)
 {
@@ -135,5 +135,7 @@ int main(int argc, char *argv[])
 	assert(exec(fd, handle, I915_EXEC_RENDER, ctx_id) == 0);
 	context_destroy(fd, ctx_id);
 
+	assert(exec(fd, handle, I915_EXEC_RENDER, ctx_id) < 0);
+
 	exit(EXIT_SUCCESS);
 }
Signature · 1 line
1.7.9.5
#3 lore raw

Re: [PATCH] tests/gem_ctx_exec: properly test destroy_ctx ioctl

Quoted 5 lines · Mika Kuoppala

Call context destroy with proper ioctl number and add test to verify that we can't post batchbuffers with destroyed context.

Merged, thanks for the patch.
-Daniel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch