[Mesa-dev] [PATCH 2/6] intel: Convert to using private depth/stencil buffers.

Chad Versace chad.versace at linux.intel.com
Mon Jul 9 11:39:21 PDT 2012


On 07/04/2012 10:52 AM, Eric Anholt wrote:
> This means that GLX buffer sharing of these no longer works.  On the
> other hand, just *look* at this code reduction.

I enjoy seeing all this code die ;) I wish we had decided earlier to break GLX
sharing before the ugly handshake code was written.



> @@ -994,8 +902,7 @@ intel_query_dri2_buffers_no_separate_stencil(struct intel_context *intel,
>  /**
>   * \brief Assign a DRI buffer's DRM region to a renderbuffer.
>   *
> - * This is called from intel_update_renderbuffers().  It is used only if
> - * either the hardware or the X driver lacks separate stencil support.
> + * This is called from intel_update_renderbuffers().
>   *
>   * \par Note:
>   *    DRI buffers whose attachment point is DRI2BufferStencil or

The "\par Note" above needs to be updated too.


> @@ -1008,14 +915,12 @@ intel_query_dri2_buffers_no_separate_stencil(struct intel_context *intel,
>   * \see intel_region_alloc_for_handle()
>   */
>  static void
> -intel_process_dri2_buffer_no_separate_stencil(struct intel_context *intel,
> -					      __DRIdrawable *drawable,
> -					      __DRIbuffer *buffer,
> -					      struct intel_renderbuffer *rb,
> -					      const char *buffer_name)
> +intel_process_dri2_buffer(struct intel_context *intel,
> +			  __DRIdrawable *drawable,
> +			  __DRIbuffer *buffer,
> +			  struct intel_renderbuffer *rb,
> +			  const char *buffer_name)
>  {
> -   assert(!intel->must_use_separate_stencil);
> -
>     struct gl_framebuffer *fb = drawable->driverPrivate;
>     struct intel_renderbuffer *depth_rb = NULL;

Even after this patch, intel_process_dri2_buffer() contains a lot of
depth/stencil code. It looks dead to me and I think it should all be removed.



> @@ -557,16 +558,10 @@ intelCreateBuffer(__DRIscreen * driScrnPriv,
>        if (mesaVis->depthBits == 24) {
>  	 assert(mesaVis->stencilBits == 8);
>  
> -	 if (screen->hw_has_separate_stencil
> -	     && screen->dri2_has_hiz != INTEL_DRI2_HAS_HIZ_FALSE) {
> -	    /*
> -	     * Request a separate stencil buffer even if we do not yet know if
> -	     * the screen supports it. (See comments for
> -	     * enum intel_dri2_has_hiz).
> -	     */
> -	    rb = intel_create_renderbuffer(MESA_FORMAT_X8_Z24);
> +	 if (screen->hw_has_separate_stencil) {
> +	    rb = intel_create_private_renderbuffer(MESA_FORMAT_X8_Z24);
>  	    _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &rb->Base.Base);
> -	    rb = intel_create_renderbuffer(MESA_FORMAT_S8);
> +	    rb = intel_create_private_renderbuffer(MESA_FORMAT_S8);
>  	    _mesa_add_renderbuffer(fb, BUFFER_STENCIL, &rb->Base.Base);
>  	 } else {
>  	    /*

Have you tested this on pre-gen6? I expect the else branch to be broken there,
because it's not converted to use intel_create_private_renderbuffer().


More information about the mesa-dev mailing list