diff mbox

intel: Don't print messages to stderr if context creation fails.

Message ID 1342122322-13938-1-git-send-email-kenneth@whitecape.org (mailing list archive)
State New, archived
Headers show

Commit Message

Kenneth Graunke July 12, 2012, 7:45 p.m. UTC
Since there is no getparam for hardware context support, Mesa always
tries to obtain a context by calling drm_intel_gem_context_create and
NULL-checking the result.  On an older kernel without context support,
this caused libdrm to print an unwanted message to stderr:

DRM_IOCTL_I915_GEM_CONTEXT_CREATE failed: Invalid argument

In fact, this caused every Piglit test to fail with a "warn" status due
to the unrecognized error message.

Simply delete the message.  It's OK for context creation to fail.

Cc: Ben Widawsky <ben@bwidawsk.net>
Cc: Paul Berry <stereotype441@gmail.com>
Cc: mesa-devel@lists.freedesktop.org
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
---
 intel/intel_bufmgr_gem.c |    5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

Comments

Ben Widawsky July 12, 2012, 8:11 p.m. UTC | #1
On Thu, 12 Jul 2012 12:45:22 -0700
Kenneth Graunke <kenneth@whitecape.org> wrote:

> Since there is no getparam for hardware context support, Mesa always
> tries to obtain a context by calling drm_intel_gem_context_create and
> NULL-checking the result.  On an older kernel without context support,
> this caused libdrm to print an unwanted message to stderr:
> 
> DRM_IOCTL_I915_GEM_CONTEXT_CREATE failed: Invalid argument
> 
> In fact, this caused every Piglit test to fail with a "warn" status due
> to the unrecognized error message.
> 
> Simply delete the message.  It's OK for context creation to fail.

Change it to DBG() and you have my:
Reviewed-by: Ben Widawsky <ben@bwidawsk.net>

> 
> Cc: Ben Widawsky <ben@bwidawsk.net>
> Cc: Paul Berry <stereotype441@gmail.com>
> Cc: mesa-devel@lists.freedesktop.org
> Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
> ---
>  intel/intel_bufmgr_gem.c |    5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/intel/intel_bufmgr_gem.c b/intel/intel_bufmgr_gem.c
> index a957c28..1b4ac78 100644
> --- a/intel/intel_bufmgr_gem.c
> +++ b/intel/intel_bufmgr_gem.c
> @@ -2850,11 +2850,8 @@ drm_intel_gem_context_create(drm_intel_bufmgr *bufmgr)
>  	int tmp = 0, ret;
>  
>  	ret = drmIoctl(bufmgr_gem->fd, DRM_IOCTL_I915_GEM_CONTEXT_CREATE, &create);
> -	if (ret != 0) {
> -		fprintf(stderr, "DRM_IOCTL_I915_GEM_CONTEXT_CREATE failed: %s\n",
> -			strerror(errno));
> +	if (ret != 0)
>  		return NULL;
> -	}
>  
>  	context = calloc(1, sizeof(*context));
>  	context->ctx_id = create.ctx_id;
Ben Widawsky July 17, 2012, 11:03 p.m. UTC | #2
On Thu, 12 Jul 2012 12:45:22 -0700
Kenneth Graunke <kenneth@whitecape.org> wrote:

> Since there is no getparam for hardware context support, Mesa always
> tries to obtain a context by calling drm_intel_gem_context_create and
> NULL-checking the result.  On an older kernel without context support,
> this caused libdrm to print an unwanted message to stderr:
> 
> DRM_IOCTL_I915_GEM_CONTEXT_CREATE failed: Invalid argument
> 
> In fact, this caused every Piglit test to fail with a "warn" status due
> to the unrecognized error message.
> 
> Simply delete the message.  It's OK for context creation to fail.

Change it to DBG() and you have my:
Reviewed-by: Ben Widawsky <ben@bwidawsk.net>

> 
> Cc: Ben Widawsky <ben@bwidawsk.net>
> Cc: Paul Berry <stereotype441@gmail.com>
> Cc: mesa-devel@lists.freedesktop.org
> Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
> ---
>  intel/intel_bufmgr_gem.c |    5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/intel/intel_bufmgr_gem.c b/intel/intel_bufmgr_gem.c
> index a957c28..1b4ac78 100644
> --- a/intel/intel_bufmgr_gem.c
> +++ b/intel/intel_bufmgr_gem.c
> @@ -2850,11 +2850,8 @@ drm_intel_gem_context_create(drm_intel_bufmgr *bufmgr)
>  	int tmp = 0, ret;
>  
>  	ret = drmIoctl(bufmgr_gem->fd, DRM_IOCTL_I915_GEM_CONTEXT_CREATE, &create);
> -	if (ret != 0) {
> -		fprintf(stderr, "DRM_IOCTL_I915_GEM_CONTEXT_CREATE failed: %s\n",
> -			strerror(errno));
> +	if (ret != 0)
>  		return NULL;
> -	}
>  
>  	context = calloc(1, sizeof(*context));
>  	context->ctx_id = create.ctx_id;
Ben Widawsky July 17, 2012, 11:06 p.m. UTC | #3
On Thu, 12 Jul 2012 12:45:22 -0700
Kenneth Graunke <kenneth@whitecape.org> wrote:

> Since there is no getparam for hardware context support, Mesa always
> tries to obtain a context by calling drm_intel_gem_context_create and
> NULL-checking the result.  On an older kernel without context support,
> this caused libdrm to print an unwanted message to stderr:
> 
> DRM_IOCTL_I915_GEM_CONTEXT_CREATE failed: Invalid argument
> 
> In fact, this caused every Piglit test to fail with a "warn" status due
> to the unrecognized error message.
> 
> Simply delete the message.  It's OK for context creation to fail.

Change it to DBG() and you have my:
Reviewed-by: Ben Widawsky <ben@bwidawsk.net>

> 
> Cc: Ben Widawsky <ben@bwidawsk.net>
> Cc: Paul Berry <stereotype441@gmail.com>
> Cc: mesa-devel@lists.freedesktop.org
> Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
> ---
>  intel/intel_bufmgr_gem.c |    5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/intel/intel_bufmgr_gem.c b/intel/intel_bufmgr_gem.c
> index a957c28..1b4ac78 100644
> --- a/intel/intel_bufmgr_gem.c
> +++ b/intel/intel_bufmgr_gem.c
> @@ -2850,11 +2850,8 @@ drm_intel_gem_context_create(drm_intel_bufmgr *bufmgr)
>  	int tmp = 0, ret;
>  
>  	ret = drmIoctl(bufmgr_gem->fd, DRM_IOCTL_I915_GEM_CONTEXT_CREATE, &create);
> -	if (ret != 0) {
> -		fprintf(stderr, "DRM_IOCTL_I915_GEM_CONTEXT_CREATE failed: %s\n",
> -			strerror(errno));
> +	if (ret != 0)
>  		return NULL;
> -	}
>  
>  	context = calloc(1, sizeof(*context));
>  	context->ctx_id = create.ctx_id;
diff mbox

Patch

diff --git a/intel/intel_bufmgr_gem.c b/intel/intel_bufmgr_gem.c
index a957c28..1b4ac78 100644
--- a/intel/intel_bufmgr_gem.c
+++ b/intel/intel_bufmgr_gem.c
@@ -2850,11 +2850,8 @@  drm_intel_gem_context_create(drm_intel_bufmgr *bufmgr)
 	int tmp = 0, ret;
 
 	ret = drmIoctl(bufmgr_gem->fd, DRM_IOCTL_I915_GEM_CONTEXT_CREATE, &create);
-	if (ret != 0) {
-		fprintf(stderr, "DRM_IOCTL_I915_GEM_CONTEXT_CREATE failed: %s\n",
-			strerror(errno));
+	if (ret != 0)
 		return NULL;
-	}
 
 	context = calloc(1, sizeof(*context));
 	context->ctx_id = create.ctx_id;