[Mesa-dev] [PATCH] i965/miptree: Fail gracefully when make_surface returns NULL

Nanley Chery nanleychery at gmail.com
Tue May 22 18:42:08 UTC 2018


On Tue, May 22, 2018 at 10:45:55AM -0700, Ian Romanick wrote:
> On 05/22/2018 09:03 AM, Nanley Chery wrote:
> > On Wed, Jan 03, 2018 at 10:41:43AM -0800, Ian Romanick wrote:
> >> From: Ian Romanick <ian.d.romanick at intel.com>
> >>
> >> Every other caller of make_surface does something sensible when NULL is
> >> returned.
> >>
> >> Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
> >> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104214
> > 
> > I think it'd be helpful to add/use this tag which shows the specific
> > issue out in the wild:
> > 
> > Bug: https://bugs.launchpad.net/ubuntu/+source/gnome-shell/+bug/1760415
> > 
> >> Tested-by: Cyril <cyril.duez at gmail.com>
> >> Cc: "17.3" <mesa-stable at lists.freedesktop.org>
> > 
> > I think this fixes tag should catch all relevant stable releases:
> > 
> > Fixes: 67b53ee4183 "i965: Represent depth surfaces with isl"
> 
> Okay... we previously had a case where make_surface would return NULL,
> but we determined that this was because of a problem elsewhere.  This
> was fixed by 897c54d522ab9 (loader/dri3: Avoid freeing renderbuffers in
> use).
> 

Right.

> Based on this fixes tag, am I correct that another scenario where
> make_surface could fail was added later? Assuming that's correct, is
> this actually the right fix or, as before, is it just papering over
> the real issue?
> 

Good question. I did some git blaming and didn't find any modifications
to make_surface after 897c54d522ab9. This patch protects against the OOM
case. Whether or not that is causing the gnome-shell bug, I don't know.

-Nanley

> > With at least the fixes tag, this patch is
> > Reviewed-by: Nanley Chery <nanley.g.chery at intel.com>
> > 
> >> ---
> >>  src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 3 +++
> >>  1 file changed, 3 insertions(+)
> >>
> >> diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
> >> index ead0c35..0079a08 100644
> >> --- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
> >> +++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
> >> @@ -719,6 +719,9 @@ miptree_create(struct brw_context *brw,
> >>           ISL_SURF_USAGE_DEPTH_BIT | ISL_SURF_USAGE_TEXTURE_BIT,
> >>           BO_ALLOC_BUSY, 0, NULL);
> >>  
> >> +      if (mt == NULL)
> >> +         return NULL;
> >> +
> >>        if (needs_separate_stencil(brw, mt, format) &&
> >>            !make_separate_stencil_surface(brw, mt)) {
> >>           intel_miptree_release(&mt);
> >> -- 
> >> 2.9.5
> >>
> >> _______________________________________________
> >> mesa-dev mailing list
> >> mesa-dev at lists.freedesktop.org
> >> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list