[Mesa-dev] [PATCH 08/12] i915: Remove i965 paths from i915_update_drawbuffer() and i830's too.

Chad Versace chad at chad-versace.us
Wed Jul 13 16:17:51 PDT 2011


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 07/12/2011 03:22 PM, Eric Anholt wrote:
> ---
>  src/mesa/drivers/dri/i915/i830_vtbl.c |   46 +++++++-------------------------
>  src/mesa/drivers/dri/i915/i915_vtbl.c |   47 +++++++--------------------------
>  2 files changed, 20 insertions(+), 73 deletions(-)
> 
> diff --git a/src/mesa/drivers/dri/i915/i830_vtbl.c b/src/mesa/drivers/dri/i915/i830_vtbl.c
> index 7dba135..2a97c6f 100644
> --- a/src/mesa/drivers/dri/i915/i830_vtbl.c
> +++ b/src/mesa/drivers/dri/i915/i830_vtbl.c
> @@ -825,12 +825,7 @@ i830_update_draw_buffer(struct intel_context *intel)

Here you should add this delta.

- -   bool fb_has_hiz = intel_framebuffer_has_hiz(fb);

- -   /*
- -    * If intel_context is using separate stencil, but the depth attachment
- -    * (gl_framebuffer.Attachment[BUFFER_DEPTH]) has a packed depth/stencil
- -    * format, then we must install the real depth buffer at fb->_DepthBuffer
- -    * and set fb->_DepthBuffer->Wrapped before calling _mesa_update_framebuffer.
- -    * Otherwise, _mesa_update_framebuffer will create and install a swras
- -    * depth wrapper instead.
- -    *
- -    * Ditto for stencil.
- -    */
    irbDepth = intel_get_renderbuffer(fb, BUFFER_DEPTH);
- -   if (irbDepth && irbDepth->Base.Format == MESA_FORMAT_X8_Z24) {
- -      _mesa_reference_renderbuffer(&fb->_DepthBuffer, &irbDepth->Base);
- -      irbDepth->Base.Wrapped = fb->Attachment[BUFFER_DEPTH].Renderbuffer;
- -   }
- -
   irbStencil = intel_get_renderbuffer(fb, BUFFER_STENCIL);
- -   if (irbStencil && irbStencil->Base.Format == MESA_FORMAT_S8) {
- -      _mesa_reference_renderbuffer(&fb->_StencilBuffer, &irbStencil->Base);
- -      irbStencil->Base.Wrapped = fb->Attachment[BUFFER_STENCIL].Renderbuffer;
- -   }

>  
>     /* Check for stencil fallback. */
>     if (irbStencil && irbStencil->region) {
> -      if (!intel->has_separate_stencil)
> -	 assert(irbStencil->Base.Format == MESA_FORMAT_S8_Z24);
> -      if (fb_has_hiz || intel->must_use_separate_stencil)
> -	 assert(irbStencil->Base.Format == MESA_FORMAT_S8);
> -      if (irbStencil->Base.Format == MESA_FORMAT_S8)
> -	 assert(intel->has_separate_stencil);
> +      assert(irbStencil->Base.Format == MESA_FORMAT_S8_Z24);
>        FALLBACK(intel, INTEL_FALLBACK_STENCIL_BUFFER, GL_FALSE);
>     } else if (irbStencil && !irbStencil->region) {
>        FALLBACK(intel, INTEL_FALLBACK_STENCIL_BUFFER, GL_TRUE);
> @@ -850,50 +845,29 @@ i830_update_draw_buffer(struct intel_context *intel)
>     /*
>      * Update depth and stencil test state
>      */
> -   if (ctx->Driver.Enable) {
> -      ctx->Driver.Enable(ctx, GL_DEPTH_TEST,
> -                         (ctx->Depth.Test && fb->Visual.depthBits > 0));
> -      ctx->Driver.Enable(ctx, GL_STENCIL_TEST,
> -                         (ctx->Stencil.Enabled && fb->Visual.stencilBits > 0));
> -   }
> -   else {
> -      /* Mesa's Stencil._Enabled field is updated when
> -       * _NEW_BUFFERS | _NEW_STENCIL, but i965 code assumes that the value
> -       * only changes with _NEW_STENCIL (which seems sensible).  So flag it
> -       * here since this is the _NEW_BUFFERS path.
> -       */
> -      intel->NewGLState |= (_NEW_DEPTH | _NEW_STENCIL);
> -   }
> +   ctx->Driver.Enable(ctx, GL_DEPTH_TEST,
> +		      (ctx->Depth.Test && fb->Visual.depthBits > 0));
> +   ctx->Driver.Enable(ctx, GL_STENCIL_TEST,
> +		      (ctx->Stencil.Enabled && fb->Visual.stencilBits > 0));
>  
>     intel->vtbl.set_draw_region(intel, colorRegions, depthRegion,
>                                 fb->_NumColorDrawBuffers);
>     intel->NewGLState |= _NEW_BUFFERS;
>  
>     /* update viewport since it depends on window size */
> -#ifdef I915
>     intelCalcViewport(ctx);
> -#else
> -   intel->NewGLState |= _NEW_VIEWPORT;
> -#endif
> +
>     /* Set state we know depends on drawable parameters:
>      */
> -   if (ctx->Driver.Scissor)
> -      ctx->Driver.Scissor(ctx, ctx->Scissor.X, ctx->Scissor.Y,
> -			  ctx->Scissor.Width, ctx->Scissor.Height);
> -   intel->NewGLState |= _NEW_SCISSOR;
> +   ctx->Driver.Scissor(ctx, ctx->Scissor.X, ctx->Scissor.Y,
> +		       ctx->Scissor.Width, ctx->Scissor.Height);
>  
> -   if (ctx->Driver.DepthRange)
> -      ctx->Driver.DepthRange(ctx,
> -			     ctx->Viewport.Near,
> -			     ctx->Viewport.Far);
> +   ctx->Driver.DepthRange(ctx, ctx->Viewport.Near, ctx->Viewport.Far);
>  
>     /* Update culling direction which changes depending on the
>      * orientation of the buffer:
>      */
> -   if (ctx->Driver.FrontFace)
> -      ctx->Driver.FrontFace(ctx, ctx->Polygon.FrontFace);
> -   else
> -      intel->NewGLState |= _NEW_POLYGON;
> +   ctx->Driver.FrontFace(ctx, ctx->Polygon.FrontFace);
>  }
>  
>  /* This isn't really handled at the moment.
> diff --git a/src/mesa/drivers/dri/i915/i915_vtbl.c b/src/mesa/drivers/dri/i915/i915_vtbl.c
> index c3df2aa..dd030da 100644
> --- a/src/mesa/drivers/dri/i915/i915_vtbl.c
> +++ b/src/mesa/drivers/dri/i915/i915_vtbl.c
> @@ -797,12 +797,7 @@ i915_update_draw_buffer(struct intel_context *intel)
>  

Same change needed here as in i830.

>     /* Check for stencil fallback. */
>     if (irbStencil && irbStencil->region) {
> -      if (!intel->has_separate_stencil)
> -	 assert(irbStencil->Base.Format == MESA_FORMAT_S8_Z24);
> -      if (fb_has_hiz || intel->must_use_separate_stencil)
> -	 assert(irbStencil->Base.Format == MESA_FORMAT_S8);
> -      if (irbStencil->Base.Format == MESA_FORMAT_S8)
> -	 assert(intel->has_separate_stencil);
> +      assert(irbStencil->Base.Format == MESA_FORMAT_S8_Z24);
>        FALLBACK(intel, INTEL_FALLBACK_STENCIL_BUFFER, GL_FALSE);
>     } else if (irbStencil && !irbStencil->region) {
>        FALLBACK(intel, INTEL_FALLBACK_STENCIL_BUFFER, GL_TRUE);
> @@ -822,50 +817,28 @@ i915_update_draw_buffer(struct intel_context *intel)
>     /*
>      * Update depth and stencil test state
>      */
> -   if (ctx->Driver.Enable) {
> -      ctx->Driver.Enable(ctx, GL_DEPTH_TEST,
> -                         (ctx->Depth.Test && fb->Visual.depthBits > 0));
> -      ctx->Driver.Enable(ctx, GL_STENCIL_TEST,
> -                         (ctx->Stencil.Enabled && fb->Visual.stencilBits > 0));
> -   }
> -   else {
> -      /* Mesa's Stencil._Enabled field is updated when
> -       * _NEW_BUFFERS | _NEW_STENCIL, but i965 code assumes that the value
> -       * only changes with _NEW_STENCIL (which seems sensible).  So flag it
> -       * here since this is the _NEW_BUFFERS path.
> -       */
> -      intel->NewGLState |= (_NEW_DEPTH | _NEW_STENCIL);
> -   }
> +   ctx->Driver.Enable(ctx, GL_DEPTH_TEST,
> +		      (ctx->Depth.Test && fb->Visual.depthBits > 0));
> +   ctx->Driver.Enable(ctx, GL_STENCIL_TEST,
> +		      (ctx->Stencil.Enabled && fb->Visual.stencilBits > 0));
>  
>     intel->vtbl.set_draw_region(intel, colorRegions, depthRegion,
>                                 fb->_NumColorDrawBuffers);
>     intel->NewGLState |= _NEW_BUFFERS;
>  
>     /* update viewport since it depends on window size */
> -#ifdef I915
>     intelCalcViewport(ctx);
> -#else
> -   intel->NewGLState |= _NEW_VIEWPORT;
> -#endif
> +
>     /* Set state we know depends on drawable parameters:
>      */
> -   if (ctx->Driver.Scissor)
> -      ctx->Driver.Scissor(ctx, ctx->Scissor.X, ctx->Scissor.Y,
> -			  ctx->Scissor.Width, ctx->Scissor.Height);
> -   intel->NewGLState |= _NEW_SCISSOR;
> -
> -   if (ctx->Driver.DepthRange)
> -      ctx->Driver.DepthRange(ctx,
> -			     ctx->Viewport.Near,
> -			     ctx->Viewport.Far);
> +   ctx->Driver.Scissor(ctx, ctx->Scissor.X, ctx->Scissor.Y,
> +		       ctx->Scissor.Width, ctx->Scissor.Height);
> +   ctx->Driver.DepthRange(ctx, ctx->Viewport.Near, ctx->Viewport.Far);
>  
>     /* Update culling direction which changes depending on the
>      * orientation of the buffer:
>      */
> -   if (ctx->Driver.FrontFace)
> -      ctx->Driver.FrontFace(ctx, ctx->Polygon.FrontFace);
> -   else
> -      intel->NewGLState |= _NEW_POLYGON;
> +   ctx->Driver.FrontFace(ctx, ctx->Polygon.FrontFace);
>  }
>  
>  static void

With deltas added,
Reviewed-by: Chad Versace <chad at chad-versace.us>

- -- 
Chad Versace
chad at chad-versace.us
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJOHiefAAoJEAIvNt057x8i4OEP/3lRS8KaFnhOiezKLIpuZiY9
l5N1mzandFZszsMWy1tncWWRRJ/Tgl6y1PEcz00AW4HHJMgQdbU/c4VeFE9+CgxM
pRBWGM6gueB4zV9iNLalXkpk7szHPo9YlNS6XAuuPVIABVkH/abopWCqyaJ1L6Ai
lg/51peiHjDeZe06zjRZAm2LJ7xMSPnCa10+lZeCIrJKaSKkBcsTdjca0RS3kB3a
rtth6tJUfn2EZcGqaMHNjI43Z0ubwuguNDJkCA0U2yzb55lgKkUi3MknFfsVPZ2m
C5etVXfXlIGang8Lb9F8gWSFI2d/NXfHKS5AY42bKKjEXBU+/scxVA22WhZeeT4X
0ioqYOqMXJQxuu/3ESaJ3jFT9h+V9+0u2lbjutZFAsRekRvaXsoetmQthSm4+G6I
0PMOevFI3AQrJje/C3uU0MBvKWx8yP73LzA9Ptp1BEpzC+NnSKr0/29M8FEthGT6
nTNOkpJzRUEisiqBkmz40PY2GttcczqO2yzAdiomcU7F2u6Ks0aLTMsw4nAuxyRz
GFMwkwe53H7HWZVntUaKn/y5VIUyGlUUOSdYX/F7EQNGO4SJbQvtirju0ZqAdWmT
uwYjCorE9f3EqxyIj0cNSsGIyzmeUS5uBJWLRWcCtPfKOhccg5YIFBjGKFe/eDT+
Txf8AEZN6QmbQQ+rFc/Y
=4CjN
-----END PGP SIGNATURE-----


More information about the mesa-dev mailing list