From 611f09890ee73f9275b99bff1215a91297fe5d5b Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Fri, 12 Sep 2014 16:53:48 +0800 Subject: 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(-) (limited to 'src') diff --git a/src/gallium/drivers/ilo/ilo_gpe_gen6.c b/src/gallium/drivers/ilo/ilo_gpe_gen6.c index c3ba9e37147..4dd5f13982a 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 3d3953713da..6f7399b7f42 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: * -- cgit v1.2.3