<div dir="ltr">Checking fill_caps, which I believe is the point of truth, caps->v1.bset.conditional_render followed the fill_caps_gles and set to false if gles is detected.<div>Why we have two different path for filling the have_ and caps?</div></div><br><div class="gmail_quote"><div dir="ltr">On Wed, Jul 18, 2018 at 1:12 PM David Riley <<a href="mailto:davidriley@chromium.org">davidriley@chromium.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Wed, Jul 18, 2018 at 1:10 PM Po-Hsien Wang <<a href="mailto:pwang@chromium.org" target="_blank">pwang@chromium.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Shouldn't <span style="font-size:small;text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">have_gl_conditiona</span><span style="font-size:small;text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">l_render deps on !gles? </span></div></blockquote><div><br></div><div>To expand on this, the change as posted still fails for me with the same fuzzing input, but adding a !gles check to the have_gl_conditional_render assignment fixed the failure in question.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br><div class="gmail_quote"><div dir="ltr">On Wed, Jul 18, 2018 at 1:04 AM Erik Faye-Lund <<a href="mailto:erik.faye-lund@collabora.com" target="_blank">erik.faye-lund@collabora.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Otherwise, it'd be possible to generate evil commands from a rouge<br>
guest-driver that can crash the VM.<br>
<br>
This is a bit trickier than the previous one, because we were already<br>
mixing calls to the OpenGL 3.0 version and the GL_NV_conditional_render<br>
version, which indicates that this was previously only safe if *both*<br>
were supported, that is OpenGL 3.0 *with* GL_NV_conditional_render. Now<br>
this code should match the caps we generate, which shouldn't give any<br>
percieved feature-regressions or gl-versions supported.<br>
<br>
Signed-off-by: Erik Faye-Lund <<a href="mailto:erik.faye-lund@collabora.com" target="_blank">erik.faye-lund@collabora.com</a>><br>
---<br>
So this is a little bit tric<br>
<br>
 src/vrend_renderer.c | 30 ++++++++++++++++++++++++------<br>
 1 file changed, 24 insertions(+), 6 deletions(-)<br>
<br>
diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c<br>
index 564807a..f34a58f 100644<br>
--- a/src/vrend_renderer.c<br>
+++ b/src/vrend_renderer.c<br>
@@ -109,6 +109,8 @@ struct global_renderer_state {<br>
    bool have_ms_scaled_blit;<br>
    bool have_nv_prim_restart;<br>
    bool have_gl_prim_restart;<br>
+   bool have_gl_conditional_render;<br>
+   bool have_nv_conditional_render;<br>
    bool have_bit_encoding;<br>
    bool have_gles31_vertex_attrib_binding;<br>
    bool have_tf2;<br>
@@ -4523,6 +4525,10 @@ int vrend_renderer_init(struct vrend_if_cbs *cbs, uint32_t flags)<br>
       vrend_state.have_gl_prim_restart = true;<br>
    else if (epoxy_has_gl_extension("GL_NV_primitive_restart"))<br>
       vrend_state.have_nv_prim_restart = true;<br>
+   if (gl_ver >= 30)<br>
+      vrend_state.have_gl_conditional_render = true;<br>
+   else if (epoxy_has_gl_extension("GL_NV_conditional_render"))<br>
+      vrend_state.have_nv_conditional_render = true;<br>
    if (gl_ver >= 40 || (gles && gl_ver >= 30) ||<br>
        epoxy_has_gl_extension("GL_ARB_transform_feedback2")) {<br>
       vrend_state.have_tf2 = true;<br>
@@ -7008,11 +7014,18 @@ static void vrend_pause_render_condition(struct vrend_context *ctx, bool pause)<br>
 {<br>
    if (pause) {<br>
       if (ctx->sub->cond_render_q_id)<br>
-         glEndConditionalRenderNV();<br>
+         if (vrend_state.have_gl_conditional_render)<br>
+            glEndConditionalRender();<br>
+         else if (vrend_state.have_nv_conditional_render)<br>
+            glEndConditionalRenderNV();<br>
    } else {<br>
       if (ctx->sub->cond_render_q_id)<br>
-         glBeginConditionalRender(ctx->sub->cond_render_q_id,<br>
-                                  ctx->sub->cond_render_gl_mode);<br>
+         if (vrend_state.have_gl_conditional_render)<br>
+            glBeginConditionalRender(ctx->sub->cond_render_q_id,<br>
+                                     ctx->sub->cond_render_gl_mode);<br>
+         else if (vrend_state.have_nv_conditional_render)<br>
+            glBeginConditionalRenderNV(ctx->sub->cond_render_q_id,<br>
+                                       ctx->sub->cond_render_gl_mode);<br>
    }<br>
 }<br>
<br>
@@ -7025,7 +7038,10 @@ void vrend_render_condition(struct vrend_context *ctx,<br>
    GLenum glmode = 0;<br>
<br>
    if (handle == 0) {<br>
-      glEndConditionalRenderNV();<br>
+      if (vrend_state.have_gl_conditional_render)<br>
+         glEndConditionalRender();<br>
+      else if (vrend_state.have_nv_conditional_render)<br>
+         glEndConditionalRenderNV();<br>
       ctx->sub->cond_render_q_id = 0;<br>
       ctx->sub->cond_render_gl_mode = 0;<br>
       return;<br>
@@ -7054,8 +7070,10 @@ void vrend_render_condition(struct vrend_context *ctx,<br>
<br>
    ctx->sub->cond_render_q_id = q->id;<br>
    ctx->sub->cond_render_gl_mode = glmode;<br>
-   glBeginConditionalRender(q->id, glmode);<br>
-<br>
+   if (vrend_state.have_gl_conditional_render)<br>
+      glBeginConditionalRender(q->id, glmode);<br>
+   if (vrend_state.have_nv_conditional_render)<br>
+      glBeginConditionalRenderNV(q->id, glmode);<br>
 }<br>
<br>
 int vrend_create_so_target(struct vrend_context *ctx,<br>
-- <br>
2.18.0.rc2<br>
<br>
</blockquote></div>
_______________________________________________<br>
virglrenderer-devel mailing list<br>
<a href="mailto:virglrenderer-devel@lists.freedesktop.org" target="_blank">virglrenderer-devel@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/virglrenderer-devel" rel="noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/virglrenderer-devel</a><br>
</blockquote></div></div>
</blockquote></div>