[Mesa-dev] [PATCH 05/15] intel: Set num samples for winsys renderbuffers

Chad Versace chad.versace at linux.intel.com
Sat Jul 21 17:36:44 PDT 2012


Add a new param, num_samples, to intel_create_renderbuffer and
intel_create_private_renderbuffer. The caller, intelCreateBuffer, passes
in the value of gl_config::NumSamples.

No multisample GL config is yet advertised, so the value of num_samples is
currently 0.

For server-owned winsys buffers, gl_renderbuffer::NumSamples is not yet
used.

CC: Eric Anholt <eric at anholt.net>
CC: Paul Berry <stereotype441 at gmail.com>
Signed-off-by: Chad Versace <chad.versace at linux.intel.com>
---
 src/mesa/drivers/dri/intel/intel_fbo.c    | 11 ++++++++---
 src/mesa/drivers/dri/intel/intel_fbo.h    |  8 ++++++--
 src/mesa/drivers/dri/intel/intel_screen.c | 17 +++++++++++------
 3 files changed, 25 insertions(+), 11 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c b/src/mesa/drivers/dri/intel/intel_fbo.c
index eb95014..a410df6 100644
--- a/src/mesa/drivers/dri/intel/intel_fbo.c
+++ b/src/mesa/drivers/dri/intel/intel_fbo.c
@@ -361,7 +361,9 @@ intel_nop_alloc_storage(struct gl_context * ctx, struct gl_renderbuffer *rb,
  * not a user-created renderbuffer.
  */
 struct intel_renderbuffer *
-intel_create_renderbuffer(gl_format format)
+intel_create_renderbuffer(struct intel_screen *screen,
+                          gl_format format,
+                          unsigned num_samples)
 {
    struct intel_renderbuffer *irb;
    struct gl_renderbuffer *rb;
@@ -381,6 +383,7 @@ intel_create_renderbuffer(gl_format format)
    rb->_BaseFormat = _mesa_get_format_base_format(format);
    rb->Format = format;
    rb->InternalFormat = rb->_BaseFormat;
+   rb->NumSamples = intel_quantize_num_samples(screen, num_samples);
 
    /* intel-specific methods */
    rb->Delete = intel_delete_renderbuffer;
@@ -396,11 +399,13 @@ intel_create_renderbuffer(gl_format format)
  * may be called at intel_update_renderbuffers() time.
  */
 struct intel_renderbuffer *
-intel_create_private_renderbuffer(gl_format format)
+intel_create_private_renderbuffer(struct intel_screen *screen,
+                                  gl_format format,
+                                  unsigned num_samples)
 {
    struct intel_renderbuffer *irb;
 
-   irb = intel_create_renderbuffer(format);
+   irb = intel_create_renderbuffer(screen, format, num_samples);
    irb->Base.Base.AllocStorage = intel_alloc_renderbuffer_storage;
 
    return irb;
diff --git a/src/mesa/drivers/dri/intel/intel_fbo.h b/src/mesa/drivers/dri/intel/intel_fbo.h
index 02bda1e..c497c1b 100644
--- a/src/mesa/drivers/dri/intel/intel_fbo.h
+++ b/src/mesa/drivers/dri/intel/intel_fbo.h
@@ -130,10 +130,14 @@ intel_rb_format(const struct intel_renderbuffer *rb)
 }
 
 extern struct intel_renderbuffer *
-intel_create_renderbuffer(gl_format format);
+intel_create_renderbuffer(struct intel_screen *screen,
+                          gl_format format,
+                          unsigned num_samples);
 
 struct intel_renderbuffer *
-intel_create_private_renderbuffer(gl_format format);
+intel_create_private_renderbuffer(struct intel_screen *screen,
+                                  gl_format format,
+                                  unsigned num_samples);
 
 struct gl_renderbuffer*
 intel_create_wrapped_renderbuffer(struct gl_context * ctx,
diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c
index 9a93ac2..4a12b67 100644
--- a/src/mesa/drivers/dri/intel/intel_screen.c
+++ b/src/mesa/drivers/dri/intel/intel_screen.c
@@ -577,6 +577,7 @@ intelCreateBuffer(__DRIscreen * driScrnPriv,
    struct intel_renderbuffer *rb;
    struct intel_screen *screen = (struct intel_screen*) driScrnPriv->driverPrivate;
    gl_format rgbFormat;
+   unsigned num_samples = mesaVis->samples;
    struct gl_framebuffer *fb;
 
    if (isPixmap)
@@ -596,11 +597,11 @@ intelCreateBuffer(__DRIscreen * driScrnPriv,
       rgbFormat = MESA_FORMAT_ARGB8888;
 
    /* setup the hardware-based renderbuffers */
-   rb = intel_create_renderbuffer(rgbFormat);
+   rb = intel_create_renderbuffer(screen, rgbFormat, num_samples);
    _mesa_add_renderbuffer(fb, BUFFER_FRONT_LEFT, &rb->Base.Base);
 
    if (mesaVis->doubleBufferMode) {
-      rb = intel_create_renderbuffer(rgbFormat);
+      rb = intel_create_renderbuffer(screen, rgbFormat, num_samples);
       _mesa_add_renderbuffer(fb, BUFFER_BACK_LEFT, &rb->Base.Base);
    }
 
@@ -613,23 +614,27 @@ intelCreateBuffer(__DRIscreen * driScrnPriv,
       assert(mesaVis->stencilBits == 8);
 
       if (screen->hw_has_separate_stencil) {
-         rb = intel_create_private_renderbuffer(MESA_FORMAT_X8_Z24);
+         rb = intel_create_private_renderbuffer(screen, MESA_FORMAT_X8_Z24,
+                                                num_samples);
          _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &rb->Base.Base);
-         rb = intel_create_private_renderbuffer(MESA_FORMAT_S8);
+         rb = intel_create_private_renderbuffer(screen, MESA_FORMAT_S8,
+                                                num_samples);
          _mesa_add_renderbuffer(fb, BUFFER_STENCIL, &rb->Base.Base);
       } else {
          /*
           * Use combined depth/stencil. Note that the renderbuffer is
           * attached to two attachment points.
           */
-         rb = intel_create_private_renderbuffer(MESA_FORMAT_S8_Z24);
+         rb = intel_create_private_renderbuffer(screen, MESA_FORMAT_S8_Z24,
+                                                num_samples);
          _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &rb->Base.Base);
          _mesa_add_renderbuffer(fb, BUFFER_STENCIL, &rb->Base.Base);
       }
    }
    else if (mesaVis->depthBits == 16) {
       assert(mesaVis->stencilBits == 0);
-      rb = intel_create_private_renderbuffer(MESA_FORMAT_Z16);
+      rb = intel_create_private_renderbuffer(screen, MESA_FORMAT_Z16,
+                                             num_samples);
       _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &rb->Base.Base);
    }
    else {
-- 
1.7.11.2



More information about the mesa-dev mailing list