Re: [PATCH 16/18] drm/i915: Remove duplicate golden render state init from execlists

Joonas Lahtinen
2016-07-22T09:53:43Z

On to, 2016-07-21 at 17:37 +0100, Chris Wilson wrote:
> On Thu, Jul 21, 2016 at 05:27:06PM +0100, Chris Wilson wrote:
> >
> > On Thu, Jul 21, 2016 at 05:18:17PM +0300, Joonas Lahtinen wrote:
> > >
> > > On ke, 2016-07-20 at 14:12 +0100, Chris Wilson wrote:
> > > >
> > > >  static const struct intel_renderstate_rodata *
> > > >  render_state_get_rodata(const int gen)
> > > >  {
> > > > @@ -51,6 +60,7 @@ static int render_state_init(struct render_state *so,
> > > >   int ret;
> > > >
> > > >   so->gen = INTEL_GEN(dev_priv);
> > > > + so->ggtt_offset = 0;
> > > Previousy not done, does it address a bug? It's going to get
> > > overwritten or the render_state has failed to initialize and is
> > > forgotten, no? If it fixes bug, I think the site fondling uninitialized
> > > object should be fixed.
> > No, nothing is using it indeed. I can't remember why I added it.
> Oh, because of gcc.
>
> drivers/gpu/drm/i915/i915_gem_render_state.c: In function ‘i915_gem_render_state_init’:
> drivers/gpu/drm/i915/i915_gem_render_state.c:246:6: error: ‘so.ggtt_offset’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
>   ret = req->engine->emit_bb_start(req, so.ggtt_offset,

Right, GCC doesn't notice the matching rodata == NULL tests. So I guess
this is the easiest way to get rid of the warning.

Or we could treat rodata == NULL as an ENOENT to make GCC shut up. And
then in i915_gem_render_state check for ENOENT? That would simplify the
code too.

Regards, Joonas

>
--
Joonas Lahtinen
Open Source Technology Center
Intel Corporation