Mesa (master): ilo: careful with empty fb state in ilo_gpe_set_fb()

Chia-I Wu olv at kemper.freedesktop.org
Fri Sep 12 09:02:24 UTC 2014


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

Author: Chia-I Wu <olvaffe at gmail.com>
Date:   Fri Sep 12 16:53:48 2014 +0800

ilo: careful with empty fb state in ilo_gpe_set_fb()

We cannot pass 0 as the width or height to ilo_gpe_init_view_surface_null().

---

 src/gallium/drivers/ilo/ilo_gpe_gen6.c |    5 ++++-
 src/gallium/drivers/ilo/ilo_gpe_gen7.c |    2 ++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/ilo/ilo_gpe_gen6.c b/src/gallium/drivers/ilo/ilo_gpe_gen6.c
index c3ba9e3..4dd5f13 100644
--- a/src/gallium/drivers/ilo/ilo_gpe_gen6.c
+++ b/src/gallium/drivers/ilo/ilo_gpe_gen6.c
@@ -1684,6 +1684,8 @@ ilo_gpe_init_view_surface_null_gen6(const struct ilo_dev_info *dev,
 
    ILO_GPE_VALID_GEN(dev, 6, 6);
 
+   assert(width >= 1 && height >= 1 && depth >= 1);
+
    /*
     * From the Sandy Bridge PRM, volume 4 part 1, page 71:
     *
@@ -2359,7 +2361,8 @@ ilo_gpe_set_fb(const struct ilo_dev_info *dev,
    util_copy_framebuffer_state(&fb->state, state);
 
    ilo_gpe_init_view_surface_null(dev,
-         state->width, state->height,
+         (state->width) ? state->width : 1,
+         (state->height) ? state->height : 1,
          1, 0, &fb->null_rt);
 
    first = NULL;
diff --git a/src/gallium/drivers/ilo/ilo_gpe_gen7.c b/src/gallium/drivers/ilo/ilo_gpe_gen7.c
index 3d39537..6f7399b 100644
--- a/src/gallium/drivers/ilo/ilo_gpe_gen7.c
+++ b/src/gallium/drivers/ilo/ilo_gpe_gen7.c
@@ -243,6 +243,8 @@ ilo_gpe_init_view_surface_null_gen7(const struct ilo_dev_info *dev,
 
    ILO_GPE_VALID_GEN(dev, 7, 7.5);
 
+   assert(width >= 1 && height >= 1 && depth >= 1);
+
    /*
     * From the Ivy Bridge PRM, volume 4 part 1, page 62:
     *




More information about the mesa-commit mailing list