st/vega: adapt to interface changes
authorRoland Scheidegger <sroland@vmware.com>
Mon, 17 May 2010 19:33:37 +0000 (21:33 +0200)
committerRoland Scheidegger <sroland@vmware.com>
Mon, 17 May 2010 19:33:37 +0000 (21:33 +0200)
src/gallium/state_trackers/vega/image.c
src/gallium/state_trackers/vega/renderer.c
src/gallium/state_trackers/vega/vg_context.c
src/gallium/state_trackers/vega/vg_manager.c

index 9c323b1809cc4646f83bccde6cf71bd7522372d5..7c421dfcd4e028e314c90a8a1281ed398a84fbb7 100644 (file)
@@ -270,7 +270,7 @@ struct vg_image * image_create(VGImageFormat format,
    image->sampler.normalized_coords = 1;
 
    assert(screen->is_format_supported(screen, pformat, PIPE_TEXTURE_2D,
-                                      PIPE_BIND_SAMPLER_VIEW, 0));
+                                      0, PIPE_BIND_SAMPLER_VIEW, 0));
 
    memset(&pt, 0, sizeof(pt));
    pt.target = PIPE_TEXTURE_2D;
@@ -576,7 +576,7 @@ void image_set_pixels(VGint dx, VGint dy,
    pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE, NULL);
 
    surf = screen->get_tex_surface(screen, image_texture(src),  0, 0, 0,
-                                  PIPE_BIND_BLIT_SOURCE);
+                                  0 /* no bind flags as surf isn't actually used??? */);
 
    vg_copy_surface(ctx, strb->surface, dx, dy,
                    surf, sx+src->x, sy+src->y, width, height);
@@ -601,7 +601,7 @@ void image_get_pixels(struct vg_image *dst, VGint dx, VGint dy,
    pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE, NULL);
 
    surf = screen->get_tex_surface(screen, image_texture(dst),  0, 0, 0,
-                                  PIPE_BIND_BLIT_SOURCE);
+                                  0 /* no bind flags as surf isn't actually used??? */);
 
    vg_copy_surface(ctx, surf, dst->x + dx, dst->y + dy,
                    strb->surface, sx, sy, width, height);
index e6aea482a761ca4b5ecea8d02a7a426516ba1e9b..fe0f166e88532bfb6e847d131069a303ba69a4ea 100644 (file)
@@ -308,7 +308,7 @@ void renderer_copy_texture(struct renderer *ctx,
 #endif
 
    assert(screen->is_format_supported(screen, dst_surf->format, PIPE_TEXTURE_2D,
-                                      PIPE_BIND_RENDER_TARGET, 0));
+                                      0, PIPE_BIND_RENDER_TARGET, 0));
 
    /* save state (restored below) */
    cso_save_blend(ctx->cso);
@@ -415,7 +415,7 @@ void renderer_copy_surface(struct renderer *ctx,
    struct pipe_sampler_view view_templ;
    struct pipe_sampler_view *view;
    struct pipe_resource texTemp, *tex;
-   struct pipe_surface *texSurf;
+   struct pipe_subresource subsrc, subdst;
    struct pipe_framebuffer_state fb;
    struct st_framebuffer *stfb = ctx->owner->draw_buffer;
    const int srcW = abs(srcX1 - srcX0);
@@ -441,11 +441,11 @@ void renderer_copy_surface(struct renderer *ctx,
    }
 
    assert(screen->is_format_supported(screen, src->format, PIPE_TEXTURE_2D,
-                                      PIPE_BIND_SAMPLER_VIEW, 0));
+                                      0, PIPE_BIND_SAMPLER_VIEW, 0));
    assert(screen->is_format_supported(screen, dst->format, PIPE_TEXTURE_2D,
-                                      PIPE_BIND_SAMPLER_VIEW, 0));
+                                      0, PIPE_BIND_SAMPLER_VIEW, 0));
    assert(screen->is_format_supported(screen, dst->format, PIPE_TEXTURE_2D,
-                                      PIPE_BIND_RENDER_TARGET, 0));
+                                      0, PIPE_BIND_RENDER_TARGET, 0));
 
    /*
     * XXX for now we're always creating a temporary texture.
@@ -460,6 +460,7 @@ void renderer_copy_surface(struct renderer *ctx,
    texTemp.width0 = srcW;
    texTemp.height0 = srcH;
    texTemp.depth0 = 1;
+   texTemp.bind = PIPE_BIND_SAMPLER_VIEW;
 
    tex = screen->resource_create(screen, &texTemp);
    if (!tex)
@@ -471,24 +472,15 @@ void renderer_copy_surface(struct renderer *ctx,
    if (!view)
       return;
 
-   texSurf = screen->get_tex_surface(screen, tex, 0, 0, 0,
-                                     PIPE_BIND_RENDER_TARGET);
-
-   /* load temp texture */
-   if (pipe->surface_copy) {
-      pipe->surface_copy(pipe,
-                         texSurf, 0, 0,   /* dest */
-                         src, srcLeft, srcTop, /* src */
-                         srcW, srcH);     /* size */
-   } else {
-      util_surface_copy(pipe, FALSE,
-                        texSurf, 0, 0,   /* dest */
-                        src, srcLeft, srcTop, /* src */
-                        srcW, srcH);     /* size */
-   }
+   subdst.face = 0;
+   subdst.level = 0;
+   subsrc.face = src->face;
+   subsrc.level = src->level;
 
-   /* free the surface, update the texture if necessary.*/
-   screen->tex_surface_destroy(texSurf);
+   pipe->resource_copy_region(pipe,
+                              tex, subdst, 0, 0, 0,  /* dest */
+                              src->texture, subsrc, srcLeft, srcTop, src->zslice, /* src */
+                              srcW, srcH);     /* size */
 
    /* save state (restored below) */
    cso_save_blend(ctx->cso);
index 1a8952ce34aefe2456e7891332b5b35c29fdc6f0..b55a2b57bed8411c58ca6c4ec95e9f79c9d3d6b7 100644 (file)
@@ -451,8 +451,7 @@ void vg_prepare_blend_surface(struct vg_context *ctx)
    dest_surface = pipe->screen->get_tex_surface(pipe->screen,
                                                 stfb->blend_texture_view->texture,
                                                 0, 0, 0,
-                                                PIPE_BIND_BLIT_DESTINATION |
-                                               PIPE_BIND_RENDER_TARGET);
+                                                PIPE_BIND_RENDER_TARGET);
    /* flip it, because we want to use it as a sampler */
    util_blit_pixels_tex(ctx->blit,
                         view,
@@ -488,8 +487,7 @@ void vg_prepare_blend_surface_from_mask(struct vg_context *ctx)
    dest_surface = pipe->screen->get_tex_surface(pipe->screen,
                                                 stfb->blend_texture_view->texture,
                                                 0, 0, 0,
-                                                PIPE_BIND_BLIT_DESTINATION |
-                                               PIPE_BIND_RENDER_TARGET);
+                                                PIPE_BIND_RENDER_TARGET);
 
    /* flip it, because we want to use it as a sampler */
    util_blit_pixels_tex(ctx->blit,
index aecac28e7ee736bd9e99097f6813a4f2d712bc04..8a62a191207280eadb0183fb70360e12ffbdd8ae 100644 (file)
@@ -122,28 +122,22 @@ setup_new_alpha_mask(struct vg_context *ctx, struct st_framebuffer *stfb)
 
    /* if we had an old surface copy it over */
    if (old_sampler_view) {
-      struct pipe_surface *surface = pipe->screen->get_tex_surface(
-         pipe->screen,
-         stfb->alpha_mask_view->texture,
-         0, 0, 0,
-         PIPE_BIND_RENDER_TARGET |
-         PIPE_BIND_BLIT_DESTINATION);
-      struct pipe_surface *old_surface = pipe->screen->get_tex_surface(
-         pipe->screen,
-         old_sampler_view->texture,
-         0, 0, 0,
-         PIPE_BIND_BLIT_SOURCE);
-      pipe->surface_copy(pipe,
-                         surface,
-                         0, 0,
-                         old_surface,
-                         0, 0,
-                         MIN2(old_surface->width, surface->width),
-                         MIN2(old_surface->height, surface->height));
-      if (surface)
-         pipe_surface_reference(&surface, NULL);
-      if (old_surface)
-         pipe_surface_reference(&old_surface, NULL);
+      struct pipe_subresource subsurf, subold_surf;
+      subsurf.face = 0;
+      subsurf.level = 0;
+      subold_surf.face = 0;
+      subold_surf.level = 0;
+      pipe->resource_copy_region(pipe,
+                                 stfb->alpha_mask_view->texture,
+                                 subsurf,
+                                 0, 0, 0,
+                                 old_sampler_view->texture,
+                                 subold_surf,
+                                 0, 0, 0,
+                                 MIN2(old_sampler_view->texture->width0,
+                                      stfb->alpha_mask_view->texture->width0),
+                                 MIN2(old_sampler_view->texture->height0,
+                                      stfb->alpha_mask_view->texture->height0));
    }
 
    /* Free the old texture
@@ -170,9 +164,7 @@ vg_context_update_depth_stencil_rb(struct vg_context * ctx,
 
    /* Probably need dedicated flags for surface usage too:
     */
-   surface_usage = (PIPE_BIND_RENDER_TARGET |
-                    PIPE_BIND_BLIT_SOURCE |
-                    PIPE_BIND_BLIT_DESTINATION);
+   surface_usage = PIPE_BIND_DEPTH_STENCIL; /* XXX: was: RENDER_TARGET */
 
    dsrb->texture = create_texture(pipe, dsrb->format, width, height);
    if (!dsrb->texture)
@@ -214,9 +206,7 @@ vg_context_update_color_rb(struct vg_context *ctx, struct pipe_resource *pt)
 
    strb->texture = pt;
    strb->surface = screen->get_tex_surface(screen, strb->texture, 0, 0, 0,
-         PIPE_BIND_RENDER_TARGET |
-         PIPE_BIND_BLIT_SOURCE |
-         PIPE_BIND_BLIT_DESTINATION);
+                                           PIPE_BIND_RENDER_TARGET);
    if (!strb->surface) {
       pipe_resource_reference(&strb->texture, NULL);
       return TRUE;