Module: Mesa
Branch: gallium-resources
Commit: c6c7e6746cbc7af59f7972719ed76f43e8ac16fc
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=c6c7e6746cbc7af59f7972719ed76f43e8ac16fc

Author: Roland Scheidegger <srol...@vmware.com>
Date:   Tue Mar 30 20:24:26 2010 +0200

gallium: more bind change compile fixes

---

 src/gallium/drivers/cell/ppu/cell_texture.c        |   12 ++++----
 src/gallium/state_trackers/egl/kms/native_kms.c    |    4 +-
 src/gallium/state_trackers/vega/mask.c             |    8 +++---
 src/gallium/state_trackers/xorg/xorg_crtc.c        |    4 +-
 src/gallium/state_trackers/xorg/xorg_dri2.c        |    2 +-
 src/gallium/state_trackers/xorg/xorg_exa.c         |   25 +++++++++++--------
 src/gallium/state_trackers/xorg/xorg_renderer.c    |   12 ++++----
 src/gallium/state_trackers/xorg/xorg_xv.c          |    2 +-
 src/gallium/state_trackers/xorg/xvmc/surface.c     |    5 +--
 .../winsys/drm/radeon/core/radeon_drm_buffer.c     |   10 +++++--
 10 files changed, 45 insertions(+), 39 deletions(-)

diff --git a/src/gallium/drivers/cell/ppu/cell_texture.c 
b/src/gallium/drivers/cell/ppu/cell_texture.c
index 1f0fff4..48e0dc3 100644
--- a/src/gallium/drivers/cell/ppu/cell_texture.c
+++ b/src/gallium/drivers/cell/ppu/cell_texture.c
@@ -130,9 +130,9 @@ cell_resource_create(struct pipe_screen *screen,
    /* Create both a displaytarget (linear) and regular texture
     * (twiddled).  Convert twiddled->linear at flush_frontbuffer time.
     */
-   if (ct->base.tex_usage & (PIPE_BIND_DISPLAY_TARGET |
-                             PIPE_BIND_SCANOUT |
-                             PIPE_BIND_SHARED)) {
+   if (ct->base.bind & (PIPE_BIND_DISPLAY_TARGET |
+                        PIPE_BIND_SCANOUT |
+                        PIPE_BIND_SHARED)) {
       if (!cell_displaytarget_layout(screen, ct))
          goto fail;
    }
@@ -562,8 +562,8 @@ cell_flush_frontbuffer(struct pipe_screen *_screen,
     */
    {
       unsigned *map = winsys->displaytarget_map(winsys, ct->dt,
-                                                (PIPE_BUFFER_USAGE_CPU_READ |
-                                                 PIPE_BUFFER_USAGE_CPU_WRITE));
+                                                (PIPE_TRANSFER_READ |
+                                                 PIPE_TRANSFER_WRITE));
       unsigned *src = (unsigned *)(ct->data + 
ct->level_offset[surface->level]);
 
       untwiddle_image_uint(surface->width,
@@ -599,7 +599,7 @@ cell_user_buffer_create(struct pipe_screen *screen,
    pipe_reference_init(&buffer->base.reference, 1);
    buffer->base.screen = screen;
    buffer->base.format = PIPE_FORMAT_R8_UNORM; /* ?? */
-   buffer->base.bind = PIPE_TRANSFER_READ | bind_flags;
+   buffer->base.bind = PIPE_BIND_TRANSFER_READ | bind_flags;
    buffer->base._usage = PIPE_USAGE_IMMUTABLE;
    buffer->base.flags = 0;
    buffer->base.width0 = bytes;
diff --git a/src/gallium/state_trackers/egl/kms/native_kms.c 
b/src/gallium/state_trackers/egl/kms/native_kms.c
index 5ff2f44..b6d92d9 100644
--- a/src/gallium/state_trackers/egl/kms/native_kms.c
+++ b/src/gallium/state_trackers/egl/kms/native_kms.c
@@ -53,9 +53,9 @@ kms_surface_validate(struct native_surface *nsurf, uint 
attachment_mask,
       templ.height0 = ksurf->height;
       templ.depth0 = 1;
       templ.format = ksurf->color_format;
-      templ.tex_usage = PIPE_BIND_RENDER_TARGET;
+      templ.bind = PIPE_BIND_RENDER_TARGET;
       if (ksurf->type == KMS_SURFACE_TYPE_SCANOUT)
-         templ.tex_usage |= PIPE_BIND_SCANOUT;
+         templ.bind |= PIPE_BIND_SCANOUT;
    }
 
    /* create textures */
diff --git a/src/gallium/state_trackers/vega/mask.c 
b/src/gallium/state_trackers/vega/mask.c
index 30c00ba..6d627b0 100644
--- a/src/gallium/state_trackers/vega/mask.c
+++ b/src/gallium/state_trackers/vega/mask.c
@@ -143,7 +143,7 @@ static void read_alpha_mask(void * data, VGint dataStride,
       struct pipe_surface *surf;
 
       surf = screen->get_tex_surface(screen, strb->texture,  0, 0, 0,
-                                     PIPE_BUFFER_USAGE_CPU_READ);
+                                     PIPE_BIND_TRANSFER_READ);
 
       /* Do a row at a time to flip image data vertically */
       for (i = 0; i < height; i++) {
@@ -496,7 +496,7 @@ struct vg_mask_layer * mask_layer_create(VGint width, VGint 
height)
       pt.width0 = width;
       pt.height0 = height;
       pt.depth0 = 1;
-      pt.tex_usage = PIPE_BIND_SAMPLER_VIEW;
+      pt.bind = PIPE_BIND_SAMPLER_VIEW;
       pt.compressed = 0;
 
       texture = screen->resource_create(screen, &pt);
@@ -537,7 +537,7 @@ void mask_layer_fill(struct vg_mask_layer *layer,
    surface = ctx->pipe->screen->get_tex_surface(
       ctx->pipe->screen, layer->sampler_view->texture,
       0, 0, 0,
-      PIPE_BUFFER_USAGE_GPU_WRITE);
+      PIPE_BIND_RENDER_TARGET);
 
    surface_fill(surface,
                 layer->width, layer->height,
@@ -573,7 +573,7 @@ static void mask_layer_render_to(struct vg_mask_layer 
*layer,
    struct pipe_surface *surface;
 
    surface = screen->get_tex_surface(screen, layer->sampler_view->texture,  0, 
0, 0,
-                                     PIPE_BUFFER_USAGE_GPU_WRITE);
+                                     PIPE_BIND_RENDER_TARGET);
 
    cso_save_framebuffer(ctx->cso_context);
    cso_save_fragment_shader(ctx->cso_context);
diff --git a/src/gallium/state_trackers/xorg/xorg_crtc.c 
b/src/gallium/state_trackers/xorg/xorg_crtc.c
index e8b6d79..669bd9e 100644
--- a/src/gallium/state_trackers/xorg/xorg_crtc.c
+++ b/src/gallium/state_trackers/xorg/xorg_crtc.c
@@ -201,8 +201,8 @@ crtc_load_cursor_argb_ga3d(xf86CrtcPtr crtc, CARD32 * image)
        struct winsys_handle whandle;
 
        memset(&templat, 0, sizeof(templat));
-       templat.tex_usage |= PIPE_BIND_RENDER_TARGET;
-       templat.tex_usage |= PIPE_BIND_SCANOUT;
+       templat.bind |= PIPE_BIND_RENDER_TARGET;
+       templat.bind |= PIPE_BIND_SCANOUT;
        templat.target = PIPE_TEXTURE_2D;
        templat.last_level = 0;
        templat.depth0 = 1;
diff --git a/src/gallium/state_trackers/xorg/xorg_dri2.c 
b/src/gallium/state_trackers/xorg/xorg_dri2.c
index 71d8f86..d469585 100644
--- a/src/gallium/state_trackers/xorg/xorg_dri2.c
+++ b/src/gallium/state_trackers/xorg/xorg_dri2.c
@@ -128,7 +128,7 @@ dri2_do_create_buffer(DrawablePtr pDraw, DRI2BufferPtr 
buffer, unsigned int form
            template.height0 = pDraw->height;
            template.depth0 = 1;
            template.last_level = 0;
-           template.tex_usage = PIPE_BIND_DEPTH_STENCIL |
+           template.bind = PIPE_BIND_DEPTH_STENCIL |
                PIPE_BIND_SHARED;
            tex = ms->screen->resource_create(ms->screen, &template);
            pipe_resource_reference(&exa_priv->depth_stencil_tex, tex);
diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c 
b/src/gallium/state_trackers/xorg/xorg_exa.c
index 44f5516..d5a1be8 100644
--- a/src/gallium/state_trackers/xorg/xorg_exa.c
+++ b/src/gallium/state_trackers/xorg/xorg_exa.c
@@ -453,13 +453,13 @@ ExaPrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr 
pDstPixmap, int xdir,
           exa->scrn->get_tex_surface( exa->scrn,
                                       exa->copy.src->tex,
                                       0, 0, 0,
-                                      PIPE_BUFFER_USAGE_GPU_READ);
+                                      PIPE_BIND_BLIT_SOURCE);
 
        exa->copy.dst_surface =
           exa->scrn->get_tex_surface( exa->scrn, 
                                       exa->copy.dst->tex,
                                       0, 0, 0, 
-                                      PIPE_BUFFER_USAGE_GPU_WRITE );
+                                      PIPE_BIND_BLIT_DESTINATION );
     }
     else {
        exa->copy.use_surface_copy = FALSE;
@@ -475,7 +475,7 @@ ExaPrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, 
int xdir,
           exa->scrn->get_tex_surface(exa->scrn,
                                      exa->copy.dst->tex,
                                      0, 0, 0,
-                                     PIPE_BUFFER_USAGE_GPU_WRITE);
+                                     PIPE_BIND_BLIT_DESTINATION);
 
 
        renderer_copy_prepare(exa->renderer, 
@@ -884,7 +884,7 @@ ExaModifyPixmapHeader(PixmapPtr pPixmap, int width, int 
height,
 
        template.depth0 = 1;
        template.last_level = 0;
-       template.tex_usage = PIPE_BIND_RENDER_TARGET | priv->flags;
+       template.bind = PIPE_BIND_RENDER_TARGET | priv->flags;
        priv->tex_flags = priv->flags;
        texture = exa->scrn->resource_create(exa->scrn, &template);
 
@@ -893,7 +893,7 @@ ExaModifyPixmapHeader(PixmapPtr pPixmap, int width, int 
height,
            struct pipe_surface *src_surf;
 
            dst_surf = exa->scrn->get_tex_surface(
-               exa->scrn, texture, 0, 0, 0, PIPE_BUFFER_USAGE_GPU_WRITE);
+               exa->scrn, texture, 0, 0, 0, PIPE_BIND_BLIT_DESTINATION);
            src_surf = xorg_gpu_surface(exa->pipe->screen, priv);
             if (exa->pipe->surface_copy) {
                exa->pipe->surface_copy(exa->pipe, dst_surf, 0, 0, src_surf,
@@ -940,7 +940,7 @@ xorg_exa_set_texture(PixmapPtr pPixmap, struct  
pipe_resource *tex)
        return FALSE;
 
     pipe_resource_reference(&priv->tex, tex);
-    priv->tex_flags = tex->tex_usage & mask;
+    priv->tex_flags = tex->bind & mask;
 
     return TRUE;
 }
@@ -962,9 +962,9 @@ xorg_exa_create_root_texture(ScrnInfoPtr pScrn,
     template.height0 = height;
     template.depth0 = 1;
     template.last_level = 0;
-    template.tex_usage |= PIPE_BIND_RENDER_TARGET;
-    template.tex_usage |= PIPE_BIND_SCANOUT;
-    template.tex_usage |= PIPE_BIND_SHARED;
+    template.bind |= PIPE_BIND_RENDER_TARGET;
+    template.bind |= PIPE_BIND_SCANOUT;
+    template.bind |= PIPE_BIND_SHARED;
 
     return exa->scrn->resource_create(exa->scrn, &template);
 }
@@ -1073,9 +1073,12 @@ out_err:
 struct pipe_surface *
 xorg_gpu_surface(struct pipe_screen *scrn, struct exa_pixmap_priv *priv)
 {
+   
+   /* seems to get called both for blits and render target usage */
    return scrn->get_tex_surface(scrn, priv->tex, 0, 0, 0,
-                                PIPE_BUFFER_USAGE_GPU_READ |
-                                PIPE_BUFFER_USAGE_GPU_WRITE);
+                                PIPE_BIND_BLIT_SOURCE |
+                                PIPE_BIND_BLIT_DESTINATION |
+                                PIPE_BIND_RENDER_TARGET);
 
 }
 
diff --git a/src/gallium/state_trackers/xorg/xorg_renderer.c 
b/src/gallium/state_trackers/xorg/xorg_renderer.c
index 53bdcb0..13fa561 100644
--- a/src/gallium/state_trackers/xorg/xorg_renderer.c
+++ b/src/gallium/state_trackers/xorg/xorg_renderer.c
@@ -50,8 +50,8 @@ renderer_buffer_create(struct xorg_renderer *r)
                               r->buffer,
                               sizeof(float)*
                               r->buffer_size,
-                             (PIPE_BUFFER_USAGE_PIXEL |
-                              PIPE_BUFFER_USAGE_GPU_WRITE));
+/* XXX was: PIPE_BUFFER_USAGE_PIXEL/PIPE_BUFFER_USAGE_GPU_WRITE even though 
this is a vertex buffer??? */
+                             PIPE_BIND_VERTEX_BUFFER);
    r->buffer_size = 0;
 
    return buf;
@@ -427,7 +427,7 @@ void renderer_set_constants(struct xorg_renderer *r,
       &r->fs_const_buffer;
 
    pipe_resource_reference(cbuf, NULL);
-   *cbuf = pipe_buffer_create(r->pipe->screen, 16,
+   *cbuf = pipe_buffer_create(r->pipe->screen,
                               PIPE_BIND_CONSTANT_BUFFER,
                               param_bytes);
 
@@ -536,7 +536,7 @@ renderer_clone_texture(struct xorg_renderer *r,
    templ.width0 = src->width0;
    templ.height0 = src->height0;
    templ.depth0 = 1;
-   templ.tex_usage = PIPE_BIND_SAMPLER_VIEW;
+   templ.bind = PIPE_BIND_SAMPLER_VIEW;
 
    pt = screen->resource_create(screen, &templ);
 
@@ -548,9 +548,9 @@ renderer_clone_texture(struct xorg_renderer *r,
    {
       /* copy source framebuffer surface into texture */
       struct pipe_surface *ps_read = screen->get_tex_surface(
-         screen, src, 0, 0, 0, PIPE_BUFFER_USAGE_GPU_READ);
+         screen, src, 0, 0, 0, PIPE_BIND_BLIT_SOURCE);
       struct pipe_surface *ps_tex = screen->get_tex_surface(
-         screen, pt, 0, 0, 0, PIPE_BUFFER_USAGE_GPU_WRITE );
+         screen, pt, 0, 0, 0, PIPE_BIND_BLIT_DESTINATION );
       if (pipe->surface_copy) {
          pipe->surface_copy(pipe,
                 ps_tex, /* dest */
diff --git a/src/gallium/state_trackers/xorg/xorg_xv.c 
b/src/gallium/state_trackers/xorg/xorg_xv.c
index fc12aee..a221594 100644
--- a/src/gallium/state_trackers/xorg/xorg_xv.c
+++ b/src/gallium/state_trackers/xorg/xorg_xv.c
@@ -171,7 +171,7 @@ create_component_texture(struct pipe_context *pipe,
    templ.width0 = width;
    templ.height0 = height;
    templ.depth0 = 1;
-   templ.tex_usage = PIPE_BIND_SAMPLER_VIEW;
+   templ.bind = PIPE_BIND_SAMPLER_VIEW;
 
    tex = screen->resource_create(screen, &templ);
 
diff --git a/src/gallium/state_trackers/xorg/xvmc/surface.c 
b/src/gallium/state_trackers/xorg/xvmc/surface.c
index 5f98ca3..9362cf8 100644
--- a/src/gallium/state_trackers/xorg/xvmc/surface.c
+++ b/src/gallium/state_trackers/xorg/xvmc/surface.c
@@ -106,15 +106,14 @@ CreateOrResizeBackBuffer(struct pipe_video_context 
*vpipe, unsigned int width, u
    template.width0 = width;
    template.height0 = height;
    template.depth0 = 1;
-   template.tex_usage = PIPE_BIND_SHARED;
+   template.bind = PIPE_BIND_SHARED;
 
    tex = vpipe->screen->resource_create(vpipe->screen, &template);
    if (!tex)
       return false;
 
    *backbuffer = vpipe->screen->get_tex_surface(vpipe->screen, tex, 0, 0, 0,
-                                                PIPE_BUFFER_USAGE_GPU_READ |
-                                                PIPE_BUFFER_USAGE_GPU_WRITE);
+                                                PIPE_BIND_RENDER_TARGET);
    pipe_resource_reference(&tex, NULL);
 
    if (!*backbuffer)
diff --git a/src/gallium/winsys/drm/radeon/core/radeon_drm_buffer.c 
b/src/gallium/winsys/drm/radeon/core/radeon_drm_buffer.c
index 520a17b..9040b16 100644
--- a/src/gallium/winsys/drm/radeon/core/radeon_drm_buffer.c
+++ b/src/gallium/winsys/drm/radeon/core/radeon_drm_buffer.c
@@ -148,12 +148,16 @@ static uint32_t radeon_domain_from_usage(unsigned usage)
 {
     uint32_t domain = 0;
 
-    if (usage & PIPE_BUFFER_USAGE_GPU_WRITE) {
+    if (usage & PIPE_BIND_RENDER_TARGET) {
         domain |= RADEON_GEM_DOMAIN_VRAM;
     }
-    if (usage & PIPE_BUFFER_USAGE_PIXEL) {
+    if (usage & PIPE_BIND_DEPTH_STENCIL) {
         domain |= RADEON_GEM_DOMAIN_VRAM;
     }
+    if (usage & PIPE_BIND_SAMPLER_VIEW) {
+        domain |= RADEON_GEM_DOMAIN_VRAM;
+    }
+    /* also need BIND_BLIT_SOURCE/DESTINATION ? */
     if (usage & PIPE_BIND_VERTEX_BUFFER) {
         domain |= RADEON_GEM_DOMAIN_GTT;
     }
@@ -187,7 +191,7 @@ struct pb_buffer 
*radeon_drm_bufmgr_create_buffer_from_handle(struct pb_manager
 
     pipe_reference_init(&buf->base.base.reference, 1);
     buf->base.base.alignment = 0;
-    buf->base.base.usage = PIPE_BUFFER_USAGE_PIXEL;
+    buf->base.base.usage = PIPE_BIND_SAMPLER_VIEW;
     buf->base.base.size = 0;
     buf->base.vtbl = &radeon_drm_buffer_vtbl;
     buf->mgr = mgr;

_______________________________________________
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to