st/dri: refactor dri_msaa_resolve
authorMarek Olšák <maraeo@gmail.com>
Fri, 31 May 2013 19:43:50 +0000 (21:43 +0200)
committerMarek Olšák <maraeo@gmail.com>
Thu, 13 Jun 2013 01:54:14 +0000 (03:54 +0200)
The generic blit will be used by the following commit.

Reviewed-by: Brian Paul <brianp@vmware.com>
src/gallium/state_trackers/dri/common/dri_drawable.c
src/gallium/state_trackers/dri/common/dri_drawable.h
src/gallium/state_trackers/dri/drm/dri2.c

index f784ee65ea9fcaf46caca43670ab629f7007fff7..ff04d57a258879cf0dde54d35bfe386f4640ddb9 100644 (file)
@@ -359,13 +359,10 @@ swap_fences_unref(struct dri_drawable *draw)
 }
 
 void
-dri_msaa_resolve(struct dri_context *ctx,
-                 struct dri_drawable *drawable,
-                 enum st_attachment_type att)
+dri_pipe_blit(struct pipe_context *pipe,
+              struct pipe_resource *dst,
+              struct pipe_resource *src)
 {
-   struct pipe_context *pipe = ctx->st->pipe;
-   struct pipe_resource *dst = drawable->textures[att];
-   struct pipe_resource *src = drawable->msaa_textures[att];
    struct pipe_blit_info blit;
 
    if (!dst || !src)
@@ -437,9 +434,12 @@ dri_flush(__DRIcontext *cPriv,
    /* Flush the drawable. */
    if ((flags & __DRI2_FLUSH_DRAWABLE) &&
        drawable->textures[ST_ATTACHMENT_BACK_LEFT]) {
-      /* Resolve MSAA buffers. */
       if (drawable->stvis.samples > 1) {
-         dri_msaa_resolve(ctx, drawable, ST_ATTACHMENT_BACK_LEFT);
+         /* Resolve the MSAA back buffer. */
+         dri_pipe_blit(ctx->st->pipe,
+                       drawable->textures[ST_ATTACHMENT_BACK_LEFT],
+                       drawable->msaa_textures[ST_ATTACHMENT_BACK_LEFT]);
+
          /* FRONT_LEFT is resolved in drawable->flush_frontbuffer. */
       }
 
index 56f8a4073a3d34d12620fb52ed63a8c010522647..50e5cc4cd670b3408493d44e5c63135011fb8799 100644 (file)
@@ -110,9 +110,9 @@ dri_drawable_get_format(struct dri_drawable *drawable,
                         unsigned *bind);
 
 void
-dri_msaa_resolve(struct dri_context *ctx,
-                 struct dri_drawable *drawable,
-                 enum st_attachment_type att);
+dri_pipe_blit(struct pipe_context *pipe,
+              struct pipe_resource *dst,
+              struct pipe_resource *src);
 
 void
 dri_flush(__DRIcontext *cPriv,
index 4117a9f09ddaa47e70fdc17a7045f6d38bf51f22..50628a618e7258626a74604972ea078343b614a2 100644 (file)
@@ -470,7 +470,10 @@ dri2_flush_frontbuffer(struct dri_context *ctx,
    if (drawable->stvis.samples > 1) {
       struct pipe_context *pipe = ctx->st->pipe;
 
-      dri_msaa_resolve(ctx, drawable, ST_ATTACHMENT_FRONT_LEFT);
+      /* Resolve the front buffer. */
+      dri_pipe_blit(ctx->st->pipe,
+                    drawable->textures[ST_ATTACHMENT_FRONT_LEFT],
+                    drawable->msaa_textures[ST_ATTACHMENT_FRONT_LEFT]);
       pipe->flush(pipe, NULL, 0);
    }