Re: [Mesa-dev] [PATCH] gallium: Correctly handle no config context creation

2018-09-05 Thread Ilia Mirkin
On Wed, Sep 5, 2018 at 1:04 PM, Elie Tournier  wrote:
> This patch fixes the following Piglit test:
> spec@egl_mesa_configless_context@basic
> It also fixes few test in a virgl guest.
>
> Suggested-by: Emil Velikov 
> Signed-off-by: Elie Tournier 
> ---
> I cc'ed some Gallium driver people.
> Can you check if this patch doesn't introduce any bug on your HW?
> Sorry for the spam.
> Cheers.
>  src/gallium/include/state_tracker/st_api.h  | 2 ++
>  src/gallium/state_trackers/dri/dri_screen.c | 4 +++-
>  src/mesa/state_tracker/st_manager.c | 9 -
>  3 files changed, 13 insertions(+), 2 deletions(-)
>
> diff --git a/src/gallium/include/state_tracker/st_api.h 
> b/src/gallium/include/state_tracker/st_api.h
> index 61152e3546..2b63b8a3d2 100644
> --- a/src/gallium/include/state_tracker/st_api.h
> +++ b/src/gallium/include/state_tracker/st_api.h
> @@ -190,6 +190,8 @@ struct st_egl_image
>   */
>  struct st_visual
>  {
> +   bool no_config;
> +
> /**
>  * Available buffers.  Bitfield of ST_ATTACHMENT_*_MASK bits.
>  */
> diff --git a/src/gallium/state_trackers/dri/dri_screen.c 
> b/src/gallium/state_trackers/dri/dri_screen.c
> index 027e85024f..308e23685e 100644
> --- a/src/gallium/state_trackers/dri/dri_screen.c
> +++ b/src/gallium/state_trackers/dri/dri_screen.c
> @@ -308,8 +308,10 @@ dri_fill_st_visual(struct st_visual *stvis,
>  {
> memset(stvis, 0, sizeof(*stvis));
>
> -   if (!mode)
> +   if (!mode) {
> +  stvis->no_config = true;
>return;
> +   }
>
> /* Deduce the color format. */
> switch (mode->redMask) {
> diff --git a/src/mesa/state_tracker/st_manager.c 
> b/src/mesa/state_tracker/st_manager.c
> index 69286b5791..c1e647b30e 100644
> --- a/src/mesa/state_tracker/st_manager.c
> +++ b/src/mesa/state_tracker/st_manager.c
> @@ -834,6 +834,7 @@ st_api_create_context(struct st_api *stapi, struct 
> st_manager *smapi,
> struct st_context *shared_ctx = (struct st_context *) shared_stctxi;
> struct st_context *st;
> struct pipe_context *pipe;
> +   struct gl_config* mode_ptr;
> struct gl_config mode;
> gl_api api;
> bool no_error = false;
> @@ -893,7 +894,13 @@ st_api_create_context(struct st_api *stapi, struct 
> st_manager *smapi,
> }
>
> st_visual_to_context_mode(>visual, );
> -   st = st_create_context(api, pipe, , shared_ctx,
> +
> +   if (>visual.no_config)

Did you mean attribs->visual.no_config? Otherwise this will be always-true..

> +  mode_ptr = NULL;
> +   else
> +  mode_ptr = 
> +
> +   st = st_create_context(api, pipe, mode_ptr, shared_ctx,
>>options, no_error);
> if (!st) {
>*error = ST_CONTEXT_ERROR_NO_MEMORY;
> --
> 2.18.0
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] gallium: Correctly handle no config context creation

2018-09-05 Thread Elie Tournier
This patch fixes the following Piglit test:
spec@egl_mesa_configless_context@basic
It also fixes few test in a virgl guest.

Suggested-by: Emil Velikov 
Signed-off-by: Elie Tournier 
---
I cc'ed some Gallium driver people.
Can you check if this patch doesn't introduce any bug on your HW?
Sorry for the spam.
Cheers.
 src/gallium/include/state_tracker/st_api.h  | 2 ++
 src/gallium/state_trackers/dri/dri_screen.c | 4 +++-
 src/mesa/state_tracker/st_manager.c | 9 -
 3 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/src/gallium/include/state_tracker/st_api.h 
b/src/gallium/include/state_tracker/st_api.h
index 61152e3546..2b63b8a3d2 100644
--- a/src/gallium/include/state_tracker/st_api.h
+++ b/src/gallium/include/state_tracker/st_api.h
@@ -190,6 +190,8 @@ struct st_egl_image
  */
 struct st_visual
 {
+   bool no_config;
+
/**
 * Available buffers.  Bitfield of ST_ATTACHMENT_*_MASK bits.
 */
diff --git a/src/gallium/state_trackers/dri/dri_screen.c 
b/src/gallium/state_trackers/dri/dri_screen.c
index 027e85024f..308e23685e 100644
--- a/src/gallium/state_trackers/dri/dri_screen.c
+++ b/src/gallium/state_trackers/dri/dri_screen.c
@@ -308,8 +308,10 @@ dri_fill_st_visual(struct st_visual *stvis,
 {
memset(stvis, 0, sizeof(*stvis));
 
-   if (!mode)
+   if (!mode) {
+  stvis->no_config = true;
   return;
+   }
 
/* Deduce the color format. */
switch (mode->redMask) {
diff --git a/src/mesa/state_tracker/st_manager.c 
b/src/mesa/state_tracker/st_manager.c
index 69286b5791..c1e647b30e 100644
--- a/src/mesa/state_tracker/st_manager.c
+++ b/src/mesa/state_tracker/st_manager.c
@@ -834,6 +834,7 @@ st_api_create_context(struct st_api *stapi, struct 
st_manager *smapi,
struct st_context *shared_ctx = (struct st_context *) shared_stctxi;
struct st_context *st;
struct pipe_context *pipe;
+   struct gl_config* mode_ptr;
struct gl_config mode;
gl_api api;
bool no_error = false;
@@ -893,7 +894,13 @@ st_api_create_context(struct st_api *stapi, struct 
st_manager *smapi,
}
 
st_visual_to_context_mode(>visual, );
-   st = st_create_context(api, pipe, , shared_ctx,
+
+   if (>visual.no_config)
+  mode_ptr = NULL;
+   else
+  mode_ptr = 
+
+   st = st_create_context(api, pipe, mode_ptr, shared_ctx,
   >options, no_error);
if (!st) {
   *error = ST_CONTEXT_ERROR_NO_MEMORY;
-- 
2.18.0

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev