Mesa (master): svga: check return value of define_query_vgpu{9,10}

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Nov 5 16:24:16 UTC 2019


Module: Mesa
Branch: master
Commit: 38e706656d0ea99a893dcf469e8658ca78c5ffd8
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=38e706656d0ea99a893dcf469e8658ca78c5ffd8

Author: Philipp Sieweck <psieweck at posteo.de>
Date:   Tue Oct 15 21:45:39 2019 +0200

svga: check return value of define_query_vgpu{9,10}

Reviewed-by: Charmaine Lee <charmainel at vmware.com>

---

 src/gallium/drivers/svga/svga_pipe_query.c | 31 ++++++++++++++++++++++--------
 1 file changed, 23 insertions(+), 8 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_pipe_query.c b/src/gallium/drivers/svga/svga_pipe_query.c
index 8922ef56e59..1b9b17e2a8e 100644
--- a/src/gallium/drivers/svga/svga_pipe_query.c
+++ b/src/gallium/drivers/svga/svga_pipe_query.c
@@ -670,6 +670,7 @@ svga_create_query(struct pipe_context *pipe,
 {
    struct svga_context *svga = svga_context(pipe);
    struct svga_query *sq;
+   enum pipe_error ret;
 
    assert(query_type < SVGA_QUERY_MAX);
 
@@ -689,7 +690,10 @@ svga_create_query(struct pipe_context *pipe,
    case PIPE_QUERY_OCCLUSION_COUNTER:
       sq->svga_type = SVGA3D_QUERYTYPE_OCCLUSION;
       if (svga_have_vgpu10(svga)) {
-         define_query_vgpu10(svga, sq, sizeof(SVGADXOcclusionQueryResult));
+         ret = define_query_vgpu10(svga, sq,
+                                   sizeof(SVGADXOcclusionQueryResult));
+         if (ret != PIPE_OK)
+            goto fail;
 
          /**
           * In OpenGL, occlusion counter query can be used in conditional
@@ -703,17 +707,24 @@ svga_create_query(struct pipe_context *pipe,
          sq->predicate = svga_create_query(pipe, PIPE_QUERY_OCCLUSION_PREDICATE, index);
 
       } else {
-         define_query_vgpu9(svga, sq);
+         ret = define_query_vgpu9(svga, sq);
+         if (ret != PIPE_OK)
+            goto fail;
       }
       break;
    case PIPE_QUERY_OCCLUSION_PREDICATE:
    case PIPE_QUERY_OCCLUSION_PREDICATE_CONSERVATIVE:
       if (svga_have_vgpu10(svga)) {
          sq->svga_type = SVGA3D_QUERYTYPE_OCCLUSIONPREDICATE;
-         define_query_vgpu10(svga, sq, sizeof(SVGADXOcclusionPredicateQueryResult));
+         ret = define_query_vgpu10(svga, sq,
+                                   sizeof(SVGADXOcclusionPredicateQueryResult));
+         if (ret != PIPE_OK)
+            goto fail;
       } else {
          sq->svga_type = SVGA3D_QUERYTYPE_OCCLUSION;
-         define_query_vgpu9(svga, sq);
+         ret = define_query_vgpu9(svga, sq);
+         if (ret != PIPE_OK)
+            goto fail;
       }
       break;
    case PIPE_QUERY_PRIMITIVES_GENERATED:
@@ -721,14 +732,18 @@ svga_create_query(struct pipe_context *pipe,
    case PIPE_QUERY_SO_STATISTICS:
       assert(svga_have_vgpu10(svga));
       sq->svga_type = SVGA3D_QUERYTYPE_STREAMOUTPUTSTATS;
-      define_query_vgpu10(svga, sq,
-                          sizeof(SVGADXStreamOutStatisticsQueryResult));
+      ret = define_query_vgpu10(svga, sq,
+                                sizeof(SVGADXStreamOutStatisticsQueryResult));
+      if (ret != PIPE_OK)
+         goto fail;
       break;
    case PIPE_QUERY_TIMESTAMP:
       assert(svga_have_vgpu10(svga));
       sq->svga_type = SVGA3D_QUERYTYPE_TIMESTAMP;
-      define_query_vgpu10(svga, sq,
-                          sizeof(SVGADXTimestampQueryResult));
+      ret = define_query_vgpu10(svga, sq,
+                                sizeof(SVGADXTimestampQueryResult));
+      if (ret != PIPE_OK)
+         goto fail;
       break;
    case SVGA_QUERY_NUM_DRAW_CALLS:
    case SVGA_QUERY_NUM_FALLBACKS:




More information about the mesa-commit mailing list