[Mesa-dev] [PATCH] st/mesa: Check after _mesa_create_context()
In some cases _mesa_create_context() can return NULL an in the mesa state tracker, we do not concider the case, which may cause issues within st_create_context_priv() This patch adds a simple check (similar to the one in the dri drivers) v2 Do not zero-out the funcs table Signed-off-by: Emil Velikov emil.l.veli...@gmail.com --- src/mesa/state_tracker/st_context.c |3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c index 6eddbfc..6d4bc54 100644 --- a/src/mesa/state_tracker/st_context.c +++ b/src/mesa/state_tracker/st_context.c @@ -179,6 +179,9 @@ struct st_context *st_create_context(gl_api api, struct pipe_context *pipe, st_init_driver_functions(funcs); ctx = _mesa_create_context(api, visual, shareCtx, funcs, NULL); + if (!ctx) { + return NULL; + } /* XXX: need a capability bit in gallium to query if the pipe * driver prefers DP4 or MUL/MAD for vertex transformation. -- 1.7.6 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] st/mesa: Check after _mesa_create_context()
On 07/11/2011 08:42 AM, Emil Velikov wrote: In some cases _mesa_create_context() can return NULL an in the mesa state tracker, we do not concider the case, which may cause issues within st_create_context_priv() This patch adds a simple check (similar to the one in the dri drivers) v2 Do not zero-out the funcs table Signed-off-by: Emil Velikovemil.l.veli...@gmail.com --- src/mesa/state_tracker/st_context.c |3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c index 6eddbfc..6d4bc54 100644 --- a/src/mesa/state_tracker/st_context.c +++ b/src/mesa/state_tracker/st_context.c @@ -179,6 +179,9 @@ struct st_context *st_create_context(gl_api api, struct pipe_context *pipe, st_init_driver_functions(funcs); ctx = _mesa_create_context(api, visual, shareCtx,funcs, NULL); + if (!ctx) { + return NULL; + } /* XXX: need a capability bit in gallium to query if the pipe * driver prefers DP4 or MUL/MAD for vertex transformation. Pushed. Thanks. -Brian ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] st/mesa: Check after _mesa_create_context()
In some cases _mesa_create_context() can return NULL an in the mesa state tracker, we do not concider the case, which may cause issues within st_create_context_priv() This patch adds a simple check (similar to the one in the dri drivers), as well as clears the function table 'funcs' Signed-off-by: Emil Velikov emil.l.veli...@gmail.com --- src/mesa/state_tracker/st_context.c |4 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c index 6eddbfc..d021d64 100644 --- a/src/mesa/state_tracker/st_context.c +++ b/src/mesa/state_tracker/st_context.c @@ -179,6 +179,10 @@ struct st_context *st_create_context(gl_api api, struct pipe_context *pipe, st_init_driver_functions(funcs); ctx = _mesa_create_context(api, visual, shareCtx, funcs, NULL); + if (!ctx) { + memset(funcs, 0, sizeof(funcs)); + return NULL; + } /* XXX: need a capability bit in gallium to query if the pipe * driver prefers DP4 or MUL/MAD for vertex transformation. -- 1.7.6 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] st/mesa: Check after _mesa_create_context()
On 07/09/2011 06:56 AM, Emil Velikov wrote: In some cases _mesa_create_context() can return NULL an in the mesa state tracker, we do not concider the case, which may cause issues within st_create_context_priv() This patch adds a simple check (similar to the one in the dri drivers), as well as clears the function table 'funcs' Signed-off-by: Emil Velikovemil.l.veli...@gmail.com --- src/mesa/state_tracker/st_context.c |4 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c index 6eddbfc..d021d64 100644 --- a/src/mesa/state_tracker/st_context.c +++ b/src/mesa/state_tracker/st_context.c @@ -179,6 +179,10 @@ struct st_context *st_create_context(gl_api api, struct pipe_context *pipe, st_init_driver_functions(funcs); ctx = _mesa_create_context(api, visual, shareCtx,funcs, NULL); + if (!ctx) { + memset(funcs, 0, sizeof(funcs)); + return NULL; + } /* XXX: need a capability bit in gallium to query if the pipe * driver prefers DP4 or MUL/MAD for vertex transformation. I don't see the need to zero-out the funcs table. Otherwise, looks good. -Brian ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev