aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/state_trackers')
-rw-r--r--src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp23
-rw-r--r--src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h95
-rw-r--r--src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h72
-rw-r--r--src/gallium/state_trackers/dri/common/dri_screen.c3
-rw-r--r--src/gallium/state_trackers/dri/common/dri_screen.h3
-rw-r--r--src/gallium/state_trackers/dri/drm/dri2.c8
-rw-r--r--src/gallium/state_trackers/dri/sw/drisw.c26
-rw-r--r--src/gallium/state_trackers/egl/common/egl_g3d.h3
-rw-r--r--src/gallium/state_trackers/egl/common/egl_g3d_api.c13
-rw-r--r--src/gallium/state_trackers/egl/common/egl_g3d_image.c10
-rw-r--r--src/gallium/state_trackers/egl/common/egl_g3d_st.c4
-rw-r--r--src/gallium/state_trackers/egl/common/native_helper.c20
-rw-r--r--src/gallium/state_trackers/egl/x11/native_dri2.c1
-rw-r--r--src/gallium/state_trackers/glx/xlib/xm_st.c34
-rw-r--r--src/gallium/state_trackers/python/p_context.i55
-rw-r--r--src/gallium/state_trackers/python/p_state.i6
-rw-r--r--src/gallium/state_trackers/python/p_texture.i18
-rw-r--r--src/gallium/state_trackers/python/st_device.c3
-rw-r--r--src/gallium/state_trackers/python/st_device.h15
-rw-r--r--src/gallium/state_trackers/python/st_sample.c3
-rw-r--r--src/gallium/state_trackers/vega/api_filters.c8
-rw-r--r--src/gallium/state_trackers/vega/api_images.c6
-rw-r--r--src/gallium/state_trackers/vega/image.c40
-rw-r--r--src/gallium/state_trackers/vega/mask.c24
-rw-r--r--src/gallium/state_trackers/vega/paint.c5
-rw-r--r--src/gallium/state_trackers/vega/renderer.c21
-rw-r--r--src/gallium/state_trackers/vega/vg_context.c49
-rw-r--r--src/gallium/state_trackers/vega/vg_manager.c13
-rw-r--r--src/gallium/state_trackers/wgl/stw_framebuffer.c14
-rw-r--r--src/gallium/state_trackers/wgl/stw_framebuffer.h4
-rw-r--r--src/gallium/state_trackers/wgl/stw_st.c58
-rw-r--r--src/gallium/state_trackers/wgl/stw_winsys.h7
-rw-r--r--src/gallium/state_trackers/xorg/xorg_composite.c4
-rw-r--r--src/gallium/state_trackers/xorg/xorg_crtc.c7
-rw-r--r--src/gallium/state_trackers/xorg/xorg_dri2.c1
-rw-r--r--src/gallium/state_trackers/xorg/xorg_exa.c64
-rw-r--r--src/gallium/state_trackers/xorg/xorg_exa.h2
-rw-r--r--src/gallium/state_trackers/xorg/xorg_renderer.c16
-rw-r--r--src/gallium/state_trackers/xorg/xorg_xv.c21
39 files changed, 381 insertions, 398 deletions
diff --git a/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp b/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp
index c246fc5ef76..a54324a04f2 100644
--- a/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp
+++ b/src/gallium/state_trackers/d3d1x/dxgi/src/dxgi_native.cpp
@@ -1159,8 +1159,15 @@ struct GalliumDXGISwapChain : public GalliumDXGIObject<IDXGISwapChain, GalliumDX
unsigned blit_x, blit_y, blit_w, blit_h;
float black[4] = {0, 0, 0, 0};
- if(!formats_compatible || src->width0 != dst_w || src->height0 != dst_h)
- dst_surface = pipe->screen->get_tex_surface(pipe->screen, dst, 0, 0, 0, PIPE_BIND_RENDER_TARGET);
+ if(!formats_compatible || src->width0 != dst_w || src->height0 != dst_h) {
+ struct pipe_surface templat;
+ templat.usage = PIPE_BIND_RENDER_TARGET;
+ templat.format = dst->format;
+ templat.u.tex.level = 0;
+ templat.u.tex.first_layer = 0;
+ templat.u.tex.last_layer = 0;
+ dst_surface = pipe->create_surface(pipe, dst, &templat);
+ }
if(preserve_aspect_ratio)
{
@@ -1199,10 +1206,12 @@ struct GalliumDXGISwapChain : public GalliumDXGIObject<IDXGISwapChain, GalliumDX
if(formats_compatible && blit_w == src->width0 && blit_h == src->height0)
{
- pipe_subresource sr;
- sr.face = 0;
- sr.level = 0;
- pipe->resource_copy_region(pipe, dst, sr, rect.left, rect.top, 0, src, sr, 0, 0, 0, blit_w, blit_h);
+ pipe_box box;
+ box.x = box.y = box.z;
+ box.width = blit_w;
+ box.height = blit_h;
+ box.z = 1;
+ pipe->resource_copy_region(pipe, dst, 0, rect.left, rect.top, 0, src, 0, &box);
}
else
{
@@ -1218,7 +1227,7 @@ struct GalliumDXGISwapChain : public GalliumDXGIObject<IDXGISwapChain, GalliumDX
}
if(dst_surface)
- pipe->screen->tex_surface_destroy(dst_surface);
+ pipe->surface_destroy(pipe, dst_surface);
pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_FRAME, 0);
diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h
index 36110595c20..e1ba6c184fd 100644
--- a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h
+++ b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h
@@ -1416,23 +1416,33 @@ changed:
*out_predicate_value = render_predicate_value;
}
- static pipe_subresource d3d11_to_pipe_subresource(struct pipe_resource* resource, unsigned subresource)
+ static unsigned d3d11_subresource_to_level(struct pipe_resource* resource, unsigned subresource)
{
- pipe_subresource sr;
if(subresource <= resource->last_level)
{
- sr.level = subresource;
- sr.face = 0;
+ return subresource;
}
else
{
unsigned levels = resource->last_level + 1;
- sr.level = subresource % levels;
- sr.face = subresource / levels;
+ return subresource % levels;
}
- return sr;
}
+ static unsigned d3d11_subresource_to_face(struct pipe_resource* resource, unsigned subresource)
+ {
+ if(subresource <= resource->last_level)
+ {
+ return 0;
+ }
+ else
+ {
+ unsigned levels = resource->last_level + 1;
+ return subresource / levels;
+ }
+ }
+
+
/* TODO: deferred contexts will need a different implementation of this,
* because we can't put the transfer info into the resource itself.
* Also, there are very different restrictions, for obvious reasons.
@@ -1448,8 +1458,10 @@ changed:
GalliumD3D11Resource<>* resource = (GalliumD3D11Resource<>*)iresource;
if(resource->transfers.count(subresource))
return E_FAIL;
- pipe_subresource sr = d3d11_to_pipe_subresource(resource->resource, subresource);
- pipe_box box = d3d11_to_pipe_box(resource->resource, sr.level, 0);
+ unsigned level = d3d11_subresource_to_level(resource->resource, subresource);
+ unsigned face = d3d11_subresource_to_face(resource->resource, subresource);
+ pipe_box box = d3d11_to_pipe_box(resource->resource, level, 0);
+ /* XXX the translation from subresource to level/face(zslice/array layer) isn't quite right */
unsigned usage = 0;
if(map_type == D3D11_MAP_READ)
usage = PIPE_TRANSFER_READ;
@@ -1465,7 +1477,7 @@ changed:
return E_INVALIDARG;
if(map_type & D3D10_MAP_FLAG_DO_NOT_WAIT)
usage |= PIPE_TRANSFER_DONTBLOCK;
- struct pipe_transfer* transfer = pipe->get_transfer(pipe, resource->resource, sr, usage, &box);
+ struct pipe_transfer* transfer = pipe->get_transfer(pipe, resource->resource, level, usage, &box);
if(!transfer) {
if(map_type & D3D10_MAP_FLAG_DO_NOT_WAIT)
return DXGI_ERROR_WAS_STILL_DRAWING;
@@ -1475,7 +1487,7 @@ changed:
resource->transfers[subresource] = transfer;
mapped_resource->pData = pipe->transfer_map(pipe, transfer);
mapped_resource->RowPitch = transfer->stride;
- mapped_resource->DepthPitch = transfer->slice_stride;
+ mapped_resource->DepthPitch = transfer->layer_stride;
return S_OK;
}
@@ -1507,15 +1519,16 @@ changed:
SYNCHRONIZED;
GalliumD3D11Resource<>* dst = (GalliumD3D11Resource<>*)dst_resource;
GalliumD3D11Resource<>* src = (GalliumD3D11Resource<>*)src_resource;
- pipe_subresource subdst = d3d11_to_pipe_subresource(dst->resource, dst_subresource);
- pipe_subresource subsrc = d3d11_to_pipe_subresource(src->resource, src_subresource);
- pipe_box box = d3d11_to_pipe_box(src->resource, subsrc.level, src_box);
- for(unsigned i = 0; i < box.depth; ++i)
+ unsigned dst_level = d3d11_subresource_to_level(dst->resource, dst_subresource);
+ unsigned dst_face = d3d11_subresource_to_face(dst->resource, dst_subresource);
+ unsigned src_level = d3d11_subresource_to_level(src->resource, src_subresource);
+ unsigned src_face = d3d11_subresource_to_face(src->resource, src_subresource);
+ /* XXX the translation from subresource to level/face(zslice/array layer) isn't quite right */
+ pipe_box box = d3d11_to_pipe_box(src->resource, src_level, src_box);
{
pipe->resource_copy_region(pipe,
- dst->resource, subdst, dst_x, dst_y, dst_z + i,
- src->resource, subsrc, box.x, box.y, box.z + i,
- box.width, box.height);
+ dst->resource, dst_level, dst_x, dst_y, dst_z,
+ src->resource, src_level, &box);
}
}
@@ -1526,24 +1539,23 @@ changed:
SYNCHRONIZED;
GalliumD3D11Resource<>* dst = (GalliumD3D11Resource<>*)dst_resource;
GalliumD3D11Resource<>* src = (GalliumD3D11Resource<>*)src_resource;
- pipe_subresource sr;
- unsigned faces = dst->resource->target == PIPE_TEXTURE_CUBE ? 6 : 1;
-
- for(sr.face = 0; sr.face < faces; ++sr.face)
+ unsigned level;
+ for(level = 0; level <= dst->resource->last_level; ++level)
{
- for(sr.level = 0; sr.level <= dst->resource->last_level; ++sr.level)
- {
- unsigned w = u_minify(dst->resource->width0, sr.level);
- unsigned h = u_minify(dst->resource->height0, sr.level);
- unsigned d = u_minify(dst->resource->depth0, sr.level);
- for(unsigned i = 0; i < d; ++i)
- {
- pipe->resource_copy_region(pipe,
- dst->resource, sr, 0, 0, i,
- src->resource, sr, 0, 0, i,
- w, h);
- }
- }
+ unsigned layers = 1;
+ pipe_box box;
+ if (dst->resource->target == PIPE_TEXTURE_CUBE)
+ layers = 6;
+ else if (dst->resource->target == PIPE_TEXTURE_3D)
+ layers = u_minify(dst->resource->depth0, level);
+ /* else layers = dst->resource->array_size; */
+ box.x = box.y = box.z = 0;
+ box.width = u_minify(dst->resource->width0, level);
+ box.height = u_minify(dst->resource->height0, level);
+ box.depth = layers;
+ pipe->resource_copy_region(pipe,
+ dst->resource, level, 0, 0, 0,
+ src->resource, level, &box);
}
}
@@ -1557,9 +1569,10 @@ changed:
{
SYNCHRONIZED;
GalliumD3D11Resource<>* dst = (GalliumD3D11Resource<>*)dst_resource;
- pipe_subresource subdst = d3d11_to_pipe_subresource(dst->resource, dst_subresource);
- pipe_box box = d3d11_to_pipe_box(dst->resource, subdst.level, pDstBox);
- pipe->transfer_inline_write(pipe, dst->resource, subdst, PIPE_TRANSFER_WRITE, &box, pSrcData, src_row_pitch, src_depth_pitch);
+ unsigned dst_level = d3d11_subresource_to_level(dst->resource, dst_subresource);
+ /* XXX the translation from subresource to level/face(zslice/array layer) isn't quite right */
+ pipe_box box = d3d11_to_pipe_box(dst->resource, dst_level, pDstBox);
+ pipe->transfer_inline_write(pipe, dst->resource, dst_level, PIPE_TRANSFER_WRITE, &box, pSrcData, src_row_pitch, src_depth_pitch);
}
#if API >= 11
@@ -1714,9 +1727,9 @@ changed:
SYNCHRONIZED;
GalliumD3D11Resource<>* dst = (GalliumD3D11Resource<>*)dst_resource;
GalliumD3D11Resource<>* src = (GalliumD3D11Resource<>*)src_resource;
- pipe_subresource subdst = d3d11_to_pipe_subresource(dst->resource, dst_subresource);
- pipe_subresource subsrc = d3d11_to_pipe_subresource(src->resource, src_subresource);
- pipe->resource_resolve(pipe, dst->resource, subdst, src->resource, subsrc);
+ unsigned dst_layer = d3d11_subresource_to_face(dst->resource, dst_subresource);
+ unsigned src_layer = d3d11_subresource_to_face(src->resource, src_subresource);
+ pipe->resource_resolve(pipe, dst->resource, dst_layer, src->resource, src_layer);
}
#if API >= 11
diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h
index 95ea4e00fc1..9cfdc837d8e 100644
--- a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h
+++ b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h
@@ -718,15 +718,13 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen
{
for(unsigned level = 0; level <= templat.last_level; ++level)
{
- struct pipe_subresource sr;
- sr.level = level;
- sr.face = slice;
struct pipe_box box;
- box.x = box.y = box.z = 0;
+ box.x = box.y = 0;
+ box.z = slice;
box.width = u_minify(width, level);
box.height = u_minify(height, level);
- box.depth = u_minify(depth, level);
- immediate_pipe->transfer_inline_write(immediate_pipe, resource, sr, PIPE_TRANSFER_WRITE | PIPE_TRANSFER_DISCARD | PIPE_TRANSFER_UNSYNCHRONIZED, &box, initial_data->pSysMem, initial_data->SysMemPitch, initial_data->SysMemSlicePitch);
+ box.depth = 1;
+ immediate_pipe->transfer_inline_write(immediate_pipe, resource, level, PIPE_TRANSFER_WRITE | PIPE_TRANSFER_DISCARD | PIPE_TRANSFER_UNSYNCHRONIZED, &box, initial_data->pSysMem, initial_data->SysMemPitch, initial_data->SysMemSlicePitch);
++initial_data;
}
}
@@ -978,8 +976,8 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen
case D3D11_SRV_DIMENSION_TEXTURE1DARRAY:
case D3D11_SRV_DIMENSION_TEXTURE2DARRAY:
/* yes, this works for all of these types (but TODO: texture arrays) */
- templat.first_level = desc->Texture1D.MostDetailedMip;
- templat.last_level = templat.first_level + desc->Texture1D.MipLevels - 1;
+ templat.u.tex.first_level = desc->Texture1D.MostDetailedMip;
+ templat.u.tex.last_level = templat.u.tex.first_level + desc->Texture1D.MipLevels - 1;
break;
case D3D11_SRV_DIMENSION_BUFFER:
case D3D11_SRV_DIMENSION_TEXTURE2DMS:
@@ -1054,30 +1052,34 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen
desc = &def_desc;
}
- unsigned zslice = 0;
- unsigned face = 0;
- unsigned level;
- enum pipe_format format;
+ struct pipe_surface templat;
+ memset(&templat, 0, sizeof(templat));
if(invalid(desc->format >= DXGI_FORMAT_COUNT))
return E_INVALIDARG;
- format = dxgi_to_pipe_format[desc->Format];
- if(!format)
+ templat.format = dxgi_to_pipe_format[desc->Format];
+ if(!templat.format)
return E_NOTIMPL;
+ templat.usage = PIPE_BIND_RENDER_TARGET;
+ templat.texture = ((GalliumD3D11Resource<>*)iresource)->resource;
switch(desc->ViewDimension)
{
case D3D11_RTV_DIMENSION_TEXTURE1D:
case D3D11_RTV_DIMENSION_TEXTURE2D:
- level = desc->Texture1D.MipSlice;
+ templat.u.tex.level = desc->Texture1D.MipSlice;
break;
case D3D11_RTV_DIMENSION_TEXTURE3D:
- level = desc->Texture3D.MipSlice;
- zslice = desc->Texture3D.FirstWSlice;
+ templat.u.tex.level = desc->Texture3D.MipSlice;
+ templat.u.tex.first_layer = desc->Texture3D.FirstWSlice;
+ /* XXX FIXME */
+ templat.u.tex.last_layer = desc->Texture3D.FirstWSlice;
break;
case D3D11_RTV_DIMENSION_TEXTURE1DARRAY:
case D3D11_RTV_DIMENSION_TEXTURE2DARRAY:
- level = desc->Texture1DArray.MipSlice;
- face = desc->Texture1DArray.FirstArraySlice;
+ templat.u.tex.level = desc->Texture1DArray.MipSlice;
+ templat.u.tex.first_layer = desc->Texture1DArray.FirstArraySlice;
+ /* XXX FIXME */
+ templat.u.tex.last_layer = desc->Texture1DArray.FirstArraySlice;
break;
case D3D11_RTV_DIMENSION_BUFFER:
case D3D11_RTV_DIMENSION_TEXTURE2DMS:
@@ -1090,13 +1092,9 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen
if(!out_rtv)
return S_FALSE;
- struct pipe_surface* surface = screen->get_tex_surface(screen,
- ((GalliumD3D11Resource<>*)iresource)->resource,
- face, level, zslice, PIPE_BIND_RENDER_TARGET);
+ struct pipe_surface* surface = immediate_pipe->create_surface(immediate_pipe, templat.texture, &templat);
if(!surface)
return E_FAIL;
- /* muhahahahaha, let's hope this actually works */
- surface->format = format;
*out_rtv = new GalliumD3D11RenderTargetView(this, (GalliumD3D11Resource<>*)iresource, surface, *desc);
return S_OK;
}
@@ -1134,26 +1132,28 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen
desc = &def_desc;
}
- unsigned zslice = 0;
- unsigned face = 0;
- unsigned level;
- enum pipe_format format;
+ struct pipe_surface templat;
+ memset(&templat, 0, sizeof(templat));
if(invalid(desc->format >= DXGI_FORMAT_COUNT))
return E_INVALIDARG;
- format = dxgi_to_pipe_format[desc->Format];
- if(!format)
+ templat.format = dxgi_to_pipe_format[desc->Format];
+ if(!templat.format)
return E_NOTIMPL;
+ templat.usage = PIPE_BIND_DEPTH_STENCIL;
+ templat.texture = ((GalliumD3D11Resource<>*)iresource)->resource;
switch(desc->ViewDimension)
{
case D3D11_DSV_DIMENSION_TEXTURE1D:
case D3D11_DSV_DIMENSION_TEXTURE2D:
- level = desc->Texture1D.MipSlice;
+ templat.u.tex.level = desc->Texture1D.MipSlice;
break;
case D3D11_DSV_DIMENSION_TEXTURE1DARRAY:
case D3D11_DSV_DIMENSION_TEXTURE2DARRAY:
- level = desc->Texture1DArray.MipSlice;
- face = desc->Texture1DArray.FirstArraySlice;
+ templat.u.tex.level = desc->Texture1DArray.MipSlice;
+ templat.u.tex.first_layer = desc->Texture1DArray.FirstArraySlice;
+ /* XXX FIXME */
+ templat.u.tex.last_layer = desc->Texture1DArray.FirstArraySlice;
break;
case D3D11_DSV_DIMENSION_TEXTURE2DMS:
case D3D11_DSV_DIMENSION_TEXTURE2DMSARRAY:
@@ -1165,13 +1165,9 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen
if(!out_depth_stencil_view)
return S_FALSE;
- struct pipe_surface* surface = screen->get_tex_surface(screen,
- ((GalliumD3D11Resource<>*)iresource)->resource,
- face, level, zslice, PIPE_BIND_DEPTH_STENCIL);
+ struct pipe_surface* surface = immediate_pipe->create_surface(immediate_pipe, templat.texture, &templat);
if(!surface)
return E_FAIL;
- /* muhahahahaha, let's hope this actually works */
- surface->format = format;
*out_depth_stencil_view = new GalliumD3D11DepthStencilView(this, (GalliumD3D11Resource<>*)iresource, surface, *desc);
return S_OK;
}
diff --git a/src/gallium/state_trackers/dri/common/dri_screen.c b/src/gallium/state_trackers/dri/common/dri_screen.c
index 1302e9bc013..f6e22c74b4e 100644
--- a/src/gallium/state_trackers/dri/common/dri_screen.c
+++ b/src/gallium/state_trackers/dri/common/dri_screen.c
@@ -304,9 +304,8 @@ dri_get_egl_image(struct st_manager *smapi,
stimg->texture = NULL;
pipe_resource_reference(&stimg->texture, img->texture);
- stimg->face = img->face;
stimg->level = img->level;
- stimg->zslice = img->zslice;
+ stimg->layer = img->layer;
return TRUE;
}
diff --git a/src/gallium/state_trackers/dri/common/dri_screen.h b/src/gallium/state_trackers/dri/common/dri_screen.h
index 0da9b5510fc..8cb0a102c8d 100644
--- a/src/gallium/state_trackers/dri/common/dri_screen.h
+++ b/src/gallium/state_trackers/dri/common/dri_screen.h
@@ -83,9 +83,8 @@ dri_screen(__DRIscreen * sPriv)
struct __DRIimageRec {
struct pipe_resource *texture;
- unsigned face;
unsigned level;
- unsigned zslice;
+ unsigned layer;
void *loader_private;
};
diff --git a/src/gallium/state_trackers/dri/drm/dri2.c b/src/gallium/state_trackers/dri/drm/dri2.c
index 3c5b0756174..a9d05a80fbd 100644
--- a/src/gallium/state_trackers/dri/drm/dri2.c
+++ b/src/gallium/state_trackers/dri/drm/dri2.c
@@ -200,6 +200,7 @@ dri2_drawable_process_buffers(struct dri_drawable *drawable,
templ.width0 = dri_drawable->w;
templ.height0 = dri_drawable->h;
templ.depth0 = 1;
+ templ.array_size = 1;
memset(&whandle, 0, sizeof(whandle));
@@ -348,6 +349,7 @@ dri2_create_image_from_name(__DRIscreen *_screen,
templ.width0 = width;
templ.height0 = height;
templ.depth0 = 1;
+ templ.array_size = 1;
memset(&whandle, 0, sizeof(whandle));
whandle.handle = name;
@@ -360,9 +362,8 @@ dri2_create_image_from_name(__DRIscreen *_screen,
return NULL;
}
- img->face = 0;
img->level = 0;
- img->zslice = 0;
+ img->layer = 0;
img->loader_private = loaderPrivate;
return img;
@@ -430,9 +431,8 @@ dri2_create_image(__DRIscreen *_screen,
return NULL;
}
- img->face = 0;
img->level = 0;
- img->zslice = 0;
+ img->layer = 0;
img->loader_private = loaderPrivate;
return img;
diff --git a/src/gallium/state_trackers/dri/sw/drisw.c b/src/gallium/state_trackers/dri/sw/drisw.c
index c48cc440367..30088b09685 100644
--- a/src/gallium/state_trackers/dri/sw/drisw.c
+++ b/src/gallium/state_trackers/dri/sw/drisw.c
@@ -87,40 +87,17 @@ drisw_put_image(struct dri_drawable *drawable,
put_image(dPriv, data, width, height);
}
-static struct pipe_surface *
-drisw_get_pipe_surface(struct dri_drawable *drawable, struct pipe_resource *ptex)
-{
- struct pipe_screen *pipe_screen = dri_screen(drawable->sPriv)->base.screen;
- struct pipe_surface *psurf = drawable->drisw_surface;
-
- if (!psurf || psurf->texture != ptex) {
- pipe_surface_reference(&drawable->drisw_surface, NULL);
-
- drawable->drisw_surface = pipe_screen->get_tex_surface(pipe_screen,
- ptex, 0, 0, 0, 0/* no bind flag???*/);
-
- psurf = drawable->drisw_surface;
- }
-
- return psurf;
-}
-
static INLINE void
drisw_present_texture(__DRIdrawable *dPriv,
struct pipe_resource *ptex)
{
struct dri_drawable *drawable = dri_drawable(dPriv);
struct dri_screen *screen = dri_screen(drawable->sPriv);
- struct pipe_surface *psurf;
if (swrast_no_present)
return;
- psurf = drisw_get_pipe_surface(drawable, ptex);
- if (!psurf)
- return;
-
- screen->base.screen->flush_frontbuffer(screen->base.screen, psurf, drawable);
+ screen->base.screen->flush_frontbuffer(screen->base.screen, ptex, 0, 0, drawable);
}
static INLINE void
@@ -220,6 +197,7 @@ drisw_allocate_textures(struct dri_drawable *drawable,
templ.width0 = width;
templ.height0 = height;
templ.depth0 = 1;
+ templ.array_size = 1;
templ.last_level = 0;
for (i = 0; i < count; i++) {
diff --git a/src/gallium/state_trackers/egl/common/egl_g3d.h b/src/gallium/state_trackers/egl/common/egl_g3d.h
index 72c14f0ac49..9873fee6ec2 100644
--- a/src/gallium/state_trackers/egl/common/egl_g3d.h
+++ b/src/gallium/state_trackers/egl/common/egl_g3d.h
@@ -92,9 +92,8 @@ struct egl_g3d_config {
struct egl_g3d_image {
_EGLImage base;
struct pipe_resource *texture;
- unsigned face;
unsigned level;
- unsigned zslice;
+ unsigned layer;
};
/* standard typecasts */
diff --git a/src/gallium/state_trackers/egl/common/egl_g3d_api.c b/src/gallium/state_trackers/egl/common/egl_g3d_api.c
index fd7dc8f8149..f505220222e 100644
--- a/src/gallium/state_trackers/egl/common/egl_g3d_api.c
+++ b/src/gallium/state_trackers/egl/common/egl_g3d_api.c
@@ -30,6 +30,7 @@
#include "pipe/p_screen.h"
#include "util/u_memory.h"
#include "util/u_inlines.h"
+#include "util/u_box.h"
#include "egl_g3d.h"
#include "egl_g3d_api.h"
@@ -665,15 +666,11 @@ egl_g3d_copy_buffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf,
ptex = get_pipe_resource(gdpy->native, nsurf, NATIVE_ATTACHMENT_FRONT_LEFT);
if (ptex) {
struct pipe_resource *psrc = gsurf->render_texture;
- struct pipe_subresource subsrc, subdst;
- subsrc.face = 0;
- subsrc.level = 0;
- subdst.face = 0;
- subdst.level = 0;
-
+ struct pipe_box src_box;
+ u_box_origin_2d(ptex->width0, ptex->height0, &src_box);
if (psrc) {
- gdpy->pipe->resource_copy_region(gdpy->pipe, ptex, subdst, 0, 0, 0,
- gsurf->render_texture, subsrc, 0, 0, 0, ptex->width0, ptex->height0);
+ gdpy->pipe->resource_copy_region(gdpy->pipe, ptex, 0, 0, 0, 0,
+ gsurf->render_texture, 0, &src_box);
nsurf->present(nsurf, NATIVE_ATTACHMENT_FRONT_LEFT, FALSE, 0);
}
diff --git a/src/gallium/state_trackers/egl/common/egl_g3d_image.c b/src/gallium/state_trackers/egl/common/egl_g3d_image.c
index 6a1f8cc697b..38627a52ec2 100644
--- a/src/gallium/state_trackers/egl/common/egl_g3d_image.c
+++ b/src/gallium/state_trackers/egl/common/egl_g3d_image.c
@@ -191,7 +191,7 @@ egl_g3d_create_image(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx,
{
struct pipe_resource *ptex;
struct egl_g3d_image *gimg;
- unsigned face = 0, level = 0, zslice = 0;
+ unsigned level = 0, layer = 0;
gimg = CALLOC_STRUCT(egl_g3d_image);
if (!gimg) {
@@ -231,7 +231,7 @@ egl_g3d_create_image(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx,
FREE(gimg);
return NULL;
}
- if (zslice > ptex->depth0) {
+ if (layer >= (u_minify(ptex->depth0, level) + ptex->array_size - 1)) {
_eglError(EGL_BAD_PARAMETER, "eglCreateEGLImageKHR");
pipe_resource_reference(&gimg->texture, NULL);
FREE(gimg);
@@ -240,9 +240,8 @@ egl_g3d_create_image(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx,
/* transfer the ownership to the image */
gimg->texture = ptex;
- gimg->face = face;
gimg->level = level;
- gimg->zslice = zslice;
+ gimg->layer = layer;
return &gimg->base;
}
@@ -288,9 +287,8 @@ egl_g3d_create_drm_image(_EGLDriver *drv, _EGLDisplay *dpy,
/* transfer the ownership to the image */
gimg->texture = ptex;
- gimg->face = 0;
gimg->level = 0;
- gimg->zslice = 0;
+ gimg->layer = 0;
return &gimg->base;
}
diff --git a/src/gallium/state_trackers/egl/common/egl_g3d_st.c b/src/gallium/state_trackers/egl/common/egl_g3d_st.c
index 25e2999590c..2b944b521a4 100644
--- a/src/gallium/state_trackers/egl/common/egl_g3d_st.c
+++ b/src/gallium/state_trackers/egl/common/egl_g3d_st.c
@@ -72,9 +72,8 @@ egl_g3d_st_manager_get_egl_image(struct st_manager *smapi,
out->texture = NULL;
pipe_resource_reference(&out->texture, gimg->texture);
- out->face = gimg->face;
out->level = gimg->level;
- out->zslice = gimg->zslice;
+ out->layer = gimg->layer;
_eglUnlockMutex(&gsmapi->display->Mutex);
@@ -140,6 +139,7 @@ pbuffer_allocate_render_texture(struct egl_g3d_surface *gsurf)
templ.width0 = gsurf->base.Width;
templ.height0 = gsurf->base.Height;
templ.depth0 = 1;
+ templ.array_size = 1;
templ.format = gsurf->stvis.color_format;
templ.bind = PIPE_BIND_RENDER_TARGET;
diff --git a/src/gallium/state_trackers/egl/common/native_helper.c b/src/gallium/state_trackers/egl/common/native_helper.c
index 7832b2b693f..0f2d02032b5 100644
--- a/src/gallium/state_trackers/egl/common/native_helper.c
+++ b/src/gallium/state_trackers/egl/common/native_helper.c
@@ -40,7 +40,6 @@ struct resource_surface {
uint bind;
struct pipe_resource *resources[NUM_NATIVE_ATTACHMENTS];
- struct pipe_surface *present_surfaces[NUM_NATIVE_ATTACHMENTS];
uint resource_mask;
uint width, height;
};
@@ -67,8 +66,6 @@ resource_surface_free_resources(struct resource_surface *rsurf)
int i;
for (i = 0; i < NUM_NATIVE_ATTACHMENTS; i++) {
- if (rsurf->present_surfaces[i])
- pipe_surface_reference(&rsurf->present_surfaces[i], NULL);
if (rsurf->resources[i])
pipe_resource_reference(&rsurf->resources[i], NULL);
}
@@ -130,6 +127,7 @@ resource_surface_add_resources(struct resource_surface *rsurf,
templ.width0 = rsurf->width;
templ.height0 = rsurf->height;
templ.depth0 = 1;
+ templ.array_size = 1;
for (i = 0; i < NUM_NATIVE_ATTACHMENTS; i++) {
if (resource_mask & (1 <<i)) {
@@ -193,8 +191,6 @@ resource_surface_swap_buffers(struct resource_surface *rsurf,
pointer_swap((const void **) &rsurf->resources[buf1],
(const void **) &rsurf->resources[buf2]);
- pointer_swap((const void **) &rsurf->present_surfaces[buf1],
- (const void **) &rsurf->present_surfaces[buf2]);
/* swap mask bits */
mask = rsurf->resource_mask & ~(buf1_bit | buf2_bit);
@@ -212,24 +208,12 @@ resource_surface_present(struct resource_surface *rsurf,
void *winsys_drawable_handle)
{
struct pipe_resource *pres = rsurf->resources[which];
- struct pipe_surface *psurf = rsurf->present_surfaces[which];
if (!pres)
return TRUE;
- if (!psurf) {
- psurf = rsurf->screen->get_tex_surface(rsurf->screen,
- pres, 0, 0, 0, PIPE_BIND_DISPLAY_TARGET);
- if (!psurf)
- return FALSE;
-
- rsurf->present_surfaces[which] = psurf;
- }
-
- assert(psurf->texture == pres);
-
rsurf->screen->flush_frontbuffer(rsurf->screen,
- psurf, winsys_drawable_handle);
+ pres, 0, 0, winsys_drawable_handle);
return TRUE;
}
diff --git a/src/gallium/state_trackers/egl/x11/native_dri2.c b/src/gallium/state_trackers/egl/x11/native_dri2.c
index 331a7de432a..8108ce45865 100644
--- a/src/gallium/state_trackers/egl/x11/native_dri2.c
+++ b/src/gallium/state_trackers/egl/x11/native_dri2.c
@@ -136,6 +136,7 @@ dri2_surface_process_drawable_buffers(struct native_surface *nsurf,
templ.width0 = dri2surf->width;
templ.height0 = dri2surf->height;
templ.depth0 = 1;
+ templ.array_size = 1;
templ.format = dri2surf->color_format;
templ.bind = PIPE_BIND_RENDER_TARGET;
diff --git a/src/gallium/state_trackers/glx/xlib/xm_st.c b/src/gallium/state_trackers/glx/xlib/xm_st.c
index e7466bdbee5..6bfe8b0788c 100644
--- a/src/gallium/state_trackers/glx/xlib/xm_st.c
+++ b/src/gallium/state_trackers/glx/xlib/xm_st.c
@@ -42,7 +42,7 @@ struct xmesa_st_framebuffer {
unsigned texture_width, texture_height, texture_mask;
struct pipe_resource *textures[ST_ATTACHMENT_COUNT];
- struct pipe_surface *display_surface;
+ struct pipe_resource *display_resource;
};
static INLINE struct xmesa_st_framebuffer *
@@ -60,25 +60,19 @@ xmesa_st_framebuffer_display(struct st_framebuffer_iface *stfbi,
{
struct xmesa_st_framebuffer *xstfb = xmesa_st_framebuffer(stfbi);
struct pipe_resource *ptex = xstfb->textures[statt];
- struct pipe_surface *psurf;
+ struct pipe_resource *pres;
if (!ptex)
return TRUE;
- psurf = xstfb->display_surface;
+ pres = xstfb->display_resource;
/* (re)allocate the surface for the texture to be displayed */
- if (!psurf || psurf->texture != ptex) {
- pipe_surface_reference(&xstfb->display_surface, NULL);
-
- psurf = xstfb->screen->get_tex_surface(xstfb->screen,
- ptex, 0, 0, 0, PIPE_BIND_DISPLAY_TARGET);
- if (!psurf)
- return FALSE;
-
- xstfb->display_surface = psurf;
+ if (!pres || pres != ptex) {
+ pipe_resource_reference(&xstfb->display_resource, ptex);
+ pres = xstfb->display_resource;
}
- xstfb->screen->flush_frontbuffer(xstfb->screen, psurf, &xstfb->buffer->ws);
+ xstfb->screen->flush_frontbuffer(xstfb->screen, pres, 0, 0, &xstfb->buffer->ws);
return TRUE;
}
@@ -96,7 +90,7 @@ xmesa_st_framebuffer_copy_textures(struct st_framebuffer_iface *stfbi,
struct xmesa_st_framebuffer *xstfb = xmesa_st_framebuffer(stfbi);
struct pipe_resource *src_ptex = xstfb->textures[src_statt];
struct pipe_resource *dst_ptex = xstfb->textures[dst_statt];
- struct pipe_subresource subsrc, subdst;
+ struct pipe_box src_box;
struct pipe_context *pipe;
if (!src_ptex || !dst_ptex)
@@ -110,14 +104,11 @@ xmesa_st_framebuffer_copy_textures(struct st_framebuffer_iface *stfbi,
xstfb->display->pipe = pipe;
}
- subsrc.face = 0;
- subsrc.level = 0;
- subdst.face = 0;
- subdst.level = 0;
+ u_box_2d(x, y, width, height, &src_box);
if (src_ptex && dst_ptex)
- pipe->resource_copy_region(pipe, dst_ptex, subdst, x, y, 0,
- src_ptex, subsrc, x, y, 0, width, height);
+ pipe->resource_copy_region(pipe, dst_ptex, 0, x, y, 0,
+ src_ptex, 0, &src_box);
}
/**
@@ -144,6 +135,7 @@ xmesa_st_framebuffer_validate_textures(struct st_framebuffer_iface *stfbi,
templ.width0 = width;
templ.height0 = height;
templ.depth0 = 1;
+ templ.array_size = 1;
templ.last_level = 0;
for (i = 0; i < ST_ATTACHMENT_COUNT; i++) {
@@ -321,7 +313,7 @@ xmesa_destroy_st_framebuffer(struct st_framebuffer_iface *stfbi)
struct xmesa_st_framebuffer *xstfb = xmesa_st_framebuffer(stfbi);
int i;
- pipe_surface_reference(&xstfb->display_surface, NULL);
+ pipe_resource_reference(&xstfb->display_resource, NULL);
for (i = 0; i < ST_ATTACHMENT_COUNT; i++)
pipe_resource_reference(&xstfb->textures[i], NULL);
diff --git a/src/gallium/state_trackers/python/p_context.i b/src/gallium/state_trackers/python/p_context.i
index 40c4603fb9d..5bdeaa8e4ea 100644
--- a/src/gallium/state_trackers/python/p_context.i
+++ b/src/gallium/state_trackers/python/p_context.i
@@ -132,6 +132,8 @@ struct st_context {
enum pipe_format format = PIPE_FORMAT_NONE,
unsigned first_level = 0,
unsigned last_level = ~0,
+ unsigned first_layer = 0,
+ unsigned last_layer = ~0,
unsigned swizzle_r = 0,
unsigned swizzle_g = 1,
unsigned swizzle_b = 2,
@@ -146,9 +148,10 @@ struct st_context {
} else {
templat.format = format;
}
- templat.last_level = MIN2(last_level, texture->last_level);
- templat.first_level = first_level;
- templat.last_level = last_level;
+ templat.u.tex.last_level = MIN2(last_level, texture->last_level);
+ templat.u.tex.first_level = first_level;
+ templat.u.tex.first_layer = first_layer;
+ templat.u.tex.last_layer = last_layer;
templat.swizzle_r = swizzle_r;
templat.swizzle_g = swizzle_g;
templat.swizzle_b = swizzle_b;
@@ -412,17 +415,15 @@ error1:
*/
void resource_copy_region(struct pipe_resource *dst,
- struct pipe_subresource subdst,
+ unsigned dst_level,
unsigned dstx, unsigned dsty, unsigned dstz,
struct pipe_resource *src,
- struct pipe_subresource subsrc,
- unsigned srcx, unsigned srcy, unsigned srcz,
- unsigned width, unsigned height)
+ unsigned src_level,
+ const struct pipe_box *src_box)
{
$self->pipe->resource_copy_region($self->pipe,
- dst, subdst, dstx, dsty, dstz,
- src, subsrc, srcx, srcy, srcz,
- width, height);
+ dst, dst_level, dstx, dsty, dstz,
+ src, src_level, src_box);
}
@@ -433,7 +434,7 @@ error1:
{
struct pipe_surface *_dst = NULL;
- _dst = st_pipe_surface(dst, PIPE_BIND_RENDER_TARGET);
+ _dst = st_pipe_surface($self->pipe, dst, PIPE_BIND_RENDER_TARGET);
if(!_dst)
SWIG_exception(SWIG_ValueError, "couldn't acquire destination surface for writing");
@@ -452,7 +453,7 @@ error1:
{
struct pipe_surface *_dst = NULL;
- _dst = st_pipe_surface(dst, PIPE_BIND_DEPTH_STENCIL);
+ _dst = st_pipe_surface($self->pipe, dst, PIPE_BIND_DEPTH_STENCIL);
if(!_dst)
SWIG_exception(SWIG_ValueError, "couldn't acquire destination surface for writing");
@@ -482,9 +483,8 @@ error1:
transfer = pipe_get_transfer(pipe,
surface->texture,
- surface->face,
surface->level,
- surface->zslice,
+ surface->layer,
PIPE_TRANSFER_READ,
x, y, w, h);
if(transfer) {
@@ -511,9 +511,8 @@ error1:
transfer = pipe_get_transfer(pipe,
surface->texture,
- surface->face,
surface->level,
- surface->zslice,
+ surface->layer,
PIPE_TRANSFER_WRITE,
x, y, w, h);
if(!transfer)
@@ -535,9 +534,8 @@ error1:
struct pipe_transfer *transfer;
transfer = pipe_get_transfer(pipe,
surface->texture,
- surface->face,
surface->level,
- surface->zslice,
+ surface->layer,
PIPE_TRANSFER_READ,
x, y, w, h);
if(transfer) {
@@ -555,9 +553,8 @@ error1:
struct pipe_transfer *transfer;
transfer = pipe_get_transfer(pipe,
surface->texture,
- surface->face,
surface->level,
- surface->zslice,
+ surface->layer,
PIPE_TRANSFER_WRITE,
x, y, w, h);
if(transfer) {
@@ -597,9 +594,8 @@ error1:
transfer = pipe_get_transfer(pipe,
surface->texture,
- surface->face,
surface->level,
- surface->zslice,
+ surface->layer,
PIPE_TRANSFER_READ,
x, y, w, h);
if(transfer) {
@@ -624,9 +620,8 @@ error1:
struct pipe_transfer *transfer;
transfer = pipe_get_transfer(pipe,
surface->texture,
- surface->face,
surface->level,
- surface->zslice,
+ surface->layer,
PIPE_TRANSFER_READ,
x, y, w, h);
if(transfer) {
@@ -644,9 +639,8 @@ error1:
struct pipe_transfer *transfer;
transfer = pipe_get_transfer(pipe,
surface->texture,
- surface->face,
surface->level,
- surface->zslice,
+ surface->layer,
PIPE_TRANSFER_WRITE,
x, y, w, h);
if(transfer) {
@@ -681,9 +675,8 @@ error1:
transfer = pipe_get_transfer(pipe,
surface->texture,
- surface->face,
surface->level,
- surface->zslice,
+ surface->layer,
PIPE_TRANSFER_READ,
x, y, w, h);
if(!transfer) {
@@ -715,16 +708,16 @@ error1:
%cstring_input_binary(const char *STRING, unsigned LENGTH);
void
transfer_inline_write(struct pipe_resource *resource,
- struct pipe_subresource *sr,
+ unsigned level,
unsigned usage,
const struct pipe_box *box,
const char *STRING, unsigned LENGTH,
unsigned stride,
- unsigned slice_stride)
+ unsigned layer_stride)
{
struct pipe_context *pipe = $self->pipe;
- pipe->transfer_inline_write(pipe, resource, *sr, usage, box, STRING, stride, slice_stride);
+ pipe->transfer_inline_write(pipe, resource, level, usage, box, STRING, stride, layer_stride);
}
%cstring_output_allocate_size(char **STRING, int *LENGTH, free(*$1));
diff --git a/src/gallium/state_trackers/python/p_state.i b/src/gallium/state_trackers/python/p_state.i
index c1e6ea1b43c..0537557661d 100644
--- a/src/gallium/state_trackers/python/p_state.i
+++ b/src/gallium/state_trackers/python/p_state.i
@@ -114,7 +114,8 @@
SWIG_exception(SWIG_ValueError, "index out of bounds");
if(surface) {
- _surface = st_pipe_surface(surface, PIPE_BIND_RENDER_TARGET);
+ /* XXX need a context here */
+ _surface = st_pipe_surface(NULL, surface, PIPE_BIND_RENDER_TARGET);
if(!_surface)
SWIG_exception(SWIG_ValueError, "couldn't acquire surface for writing");
}
@@ -131,7 +132,8 @@
struct pipe_surface *_surface = NULL;
if(surface) {
- _surface = st_pipe_surface(surface, PIPE_BIND_DEPTH_STENCIL);
+ /* XXX need a context here */
+ _surface = st_pipe_surface(NULL, surface, PIPE_BIND_DEPTH_STENCIL);
if(!_surface)
SWIG_exception(SWIG_ValueError, "couldn't acquire surface for writing");
}
diff --git a/src/gallium/state_trackers/python/p_texture.i b/src/gallium/state_trackers/python/p_texture.i
index ae506944c45..1f4b4fd596b 100644
--- a/src/gallium/state_trackers/python/p_texture.i
+++ b/src/gallium/state_trackers/python/p_texture.i
@@ -42,9 +42,8 @@
%ignore pipe_resource::screen;
%immutable st_surface::texture;
-%immutable st_surface::face;
%immutable st_surface::level;
-%immutable st_surface::zslice;
+%immutable st_surface::layer;
%newobject pipe_resource::get_surface;
@@ -73,25 +72,23 @@
/** Get a surface which is a "view" into a texture */
struct st_surface *
- get_surface(unsigned face=0, unsigned level=0, unsigned zslice=0)
+ get_surface(unsigned level=0, unsigned layer=0)
{
struct st_surface *surface;
- if(face >= ($self->target == PIPE_TEXTURE_CUBE ? 6U : 1U))
- SWIG_exception(SWIG_ValueError, "face out of bounds");
if(level > $self->last_level)
SWIG_exception(SWIG_ValueError, "level out of bounds");
- if(zslice >= u_minify($self->depth0, level))
- SWIG_exception(SWIG_ValueError, "zslice out of bounds");
+ if(layer >= ($self->target == PIPE_TEXTURE_3D ?
+ u_minify($self->depth0, level) : $self->depth0))
+ SWIG_exception(SWIG_ValueError, "layer out of bounds");
surface = CALLOC_STRUCT(st_surface);
if(!surface)
return NULL;
pipe_resource_reference(&surface->texture, $self);
- surface->face = face;
surface->level = level;
- surface->zslice = zslice;
+ surface->layer = layer;
return surface;
@@ -113,9 +110,8 @@ struct st_surface
%immutable;
struct pipe_resource *texture;
- unsigned face;
unsigned level;
- unsigned zslice;
+ unsigned layer;
};
diff --git a/src/gallium/state_trackers/python/st_device.c b/src/gallium/state_trackers/python/st_device.c
index 29813456b5f..d0a4295c7a2 100644
--- a/src/gallium/state_trackers/python/st_device.c
+++ b/src/gallium/state_trackers/python/st_device.c
@@ -240,6 +240,7 @@ st_context_create(struct st_device *st_dev)
templat.width0 = 1;
templat.height0 = 1;
templat.depth0 = 1;
+ templat.array_size = 1;
templat.last_level = 0;
templat.bind = PIPE_BIND_SAMPLER_VIEW;
@@ -252,7 +253,7 @@ st_context_create(struct st_device *st_dev)
pipe->transfer_inline_write(pipe,
st_ctx->default_texture,
- u_subresource(0,0),
+ 0,
PIPE_TRANSFER_WRITE,
&box,
&zero,
diff --git a/src/gallium/state_trackers/python/st_device.h b/src/gallium/state_trackers/python/st_device.h
index 2dca7a1974e..53e2556cb0d 100644
--- a/src/gallium/state_trackers/python/st_device.h
+++ b/src/gallium/state_trackers/python/st_device.h
@@ -41,9 +41,8 @@ struct st_winsys;
struct st_surface
{
struct pipe_resource *texture;
- unsigned face;
unsigned level;
- unsigned zslice;
+ unsigned layer;
};
@@ -83,11 +82,17 @@ struct st_device
static INLINE struct pipe_surface *
-st_pipe_surface(struct st_surface *surface, unsigned usage)
+st_pipe_surface(struct pipe_context *pipe, struct st_surface *surface, unsigned usage)
{
struct pipe_resource *texture = surface->texture;
- struct pipe_screen *screen = texture->screen;
- return screen->get_tex_surface(screen, texture, surface->face, surface->level, surface->zslice, usage);
+ struct pipe_surface surf_tmpl;
+ memset(&surf_tmpl, 0, sizeof(surf_tmpl));
+ surf_tmpl.format = texture->format;
+ surf_tmpl.usage = usage;
+ surf_tmpl.u.tex.level = surface->level;
+ surf_tmpl.u.tex.first_layer = surface->layer;
+ surf_tmpl.u.tex.last_layer = surface->layer;
+ return pipe->create_surface(pipe, texture, &surf_tmpl);
}
struct st_context *
diff --git a/src/gallium/state_trackers/python/st_sample.c b/src/gallium/state_trackers/python/st_sample.c
index 25bfbf1ab73..cac9a1a6204 100644
--- a/src/gallium/state_trackers/python/st_sample.c
+++ b/src/gallium/state_trackers/python/st_sample.c
@@ -555,9 +555,8 @@ st_sample_surface(struct pipe_context *pipe,
transfer = pipe_get_transfer(pipe,
surface->texture,
- surface->face,
surface->level,
- surface->zslice,
+ surface->layer,
PIPE_TRANSFER_WRITE,
0, 0,
width,
diff --git a/src/gallium/state_trackers/vega/api_filters.c b/src/gallium/state_trackers/vega/api_filters.c
index 384554a574b..95f900f4a93 100644
--- a/src/gallium/state_trackers/vega/api_filters.c
+++ b/src/gallium/state_trackers/vega/api_filters.c
@@ -41,7 +41,6 @@
#include "util/u_sampler.h"
#include "util/u_string.h"
-
#include "asm_filters.h"
@@ -72,6 +71,7 @@ static INLINE struct pipe_resource *create_texture_1d(struct vg_context *ctx,
templ.width0 = color_data_len;
templ.height0 = 1;
templ.depth0 = 1;
+ templ.array_size = 1;
templ.bind = PIPE_BIND_SAMPLER_VIEW;
tex = screen->resource_create(screen, &templ);
@@ -79,9 +79,9 @@ static INLINE struct pipe_resource *create_texture_1d(struct vg_context *ctx,
{ /* upload color_data */
struct pipe_transfer *transfer =
pipe_get_transfer(pipe, tex,
- 0, 0, 0,
- PIPE_TRANSFER_READ_WRITE ,
- 0, 0, tex->width0, tex->height0);
+ 0, 0,
+ PIPE_TRANSFER_READ_WRITE ,
+ 0, 0, tex->width0, tex->height0);
void *map = pipe->transfer_map(pipe, transfer);
memcpy(map, color_data, sizeof(VGint)*color_data_len);
pipe->transfer_unmap(pipe, transfer);
diff --git a/src/gallium/state_trackers/vega/api_images.c b/src/gallium/state_trackers/vega/api_images.c
index 60f9db60e94..ad95409cd00 100644
--- a/src/gallium/state_trackers/vega/api_images.c
+++ b/src/gallium/state_trackers/vega/api_images.c
@@ -447,9 +447,9 @@ void vegaReadPixels(void * data, VGint dataStride,
VGint y = (stfb->height - sy) - 1, yStep = -1;
struct pipe_transfer *transfer;
- transfer = pipe_get_transfer(pipe, strb->texture, 0, 0, 0,
- PIPE_TRANSFER_READ,
- 0, 0, sx + width, stfb->height - sy);
+ transfer = pipe_get_transfer(pipe, strb->texture, 0, 0,
+ PIPE_TRANSFER_READ,
+ 0, 0, sx + width, stfb->height - sy);
/* Do a row at a time to flip image data vertically */
for (i = 0; i < height; i++) {
diff --git a/src/gallium/state_trackers/vega/image.c b/src/gallium/state_trackers/vega/image.c
index a20b6d582fd..164af30ef3b 100644
--- a/src/gallium/state_trackers/vega/image.c
+++ b/src/gallium/state_trackers/vega/image.c
@@ -42,6 +42,7 @@
#include "util/u_memory.h"
#include "util/u_math.h"
#include "util/u_sampler.h"
+#include "util/u_surface.h"
static enum pipe_format vg_format_to_pipe(VGImageFormat format)
{
@@ -135,11 +136,11 @@ static void vg_copy_texture(struct vg_context *ctx,
if (src_loc[2] >= 0 && src_loc[3] >= 0 &&
dst_loc[2] >= 0 && dst_loc[3] >= 0) {
- struct pipe_surface *surf;
+ struct pipe_surface *surf, surf_tmpl;
/* get the destination surface */
- surf = ctx->pipe->screen->get_tex_surface(ctx->pipe->screen,
- dst, 0, 0, 0, PIPE_BIND_RENDER_TARGET);
+ u_surface_default_template(&surf_tmpl, dst, PIPE_BIND_RENDER_TARGET);
+ surf = ctx->pipe->create_surface(ctx->pipe, dst, &surf_tmpl);
if (surf && renderer_copy_begin(ctx->renderer, surf, VG_TRUE, src)) {
renderer_copy(ctx->renderer,
dst_loc[0], dst_loc[1], dst_loc[2], dst_loc[3],
@@ -265,6 +266,7 @@ struct vg_image * image_create(VGImageFormat format,
pt.width0 = width;
pt.height0 = height;
pt.depth0 = 1;
+ pt.array_size = 1;
pt.bind = PIPE_BIND_SAMPLER_VIEW;
newtex = screen->resource_create(screen, &pt);
@@ -415,7 +417,7 @@ void image_sub_data(struct vg_image *image,
{ /* upload color_data */
struct pipe_transfer *transfer = pipe_get_transfer(
- pipe, texture, 0, 0, 0,
+ pipe, texture, 0, 0,
PIPE_TRANSFER_WRITE, 0, 0, texture->width0, texture->height0);
src += (dataStride * yoffset);
for (i = 0; i < height; i++) {
@@ -446,11 +448,11 @@ void image_get_sub_data(struct vg_image * image,
{
struct pipe_transfer *transfer =
pipe_get_transfer(pipe,
- image->sampler_view->texture, 0, 0, 0,
- PIPE_TRANSFER_READ,
- 0, 0,
- image->x + image->width,
- image->y + image->height);
+ image->sampler_view->texture, 0, 0,
+ PIPE_TRANSFER_READ,
+ 0, 0,
+ image->x + image->width,
+ image->y + image->height);
/* Do a row at a time to flip image data vertically */
for (i = 0; i < height; i++) {
#if 0
@@ -566,20 +568,21 @@ void image_set_pixels(VGint dx, VGint dy,
{
struct vg_context *ctx = vg_current_context();
struct pipe_context *pipe = ctx->pipe;
- struct pipe_screen *screen = pipe->screen;
- struct pipe_surface *surf;
+ struct pipe_surface *surf, surf_tmpl;
struct st_renderbuffer *strb = ctx->draw_buffer->strb;
/* make sure rendering has completed */
pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE, NULL);
- surf = screen->get_tex_surface(screen, image_texture(src), 0, 0, 0,
- 0 /* no bind flags as surf isn't actually used??? */);
+ memset(&surf_tmpl, 0, sizeof(surf_tmpl));
+ u_surface_default_template(&surf_tmpl, image_texture(src),
+ 0 /* no bind flag - not a surface*/);
+ surf = pipe->create_surface(pipe, image_texture(src), &surf_tmpl);
vg_copy_surface(ctx, strb->surface, dx, dy,
surf, sx+src->x, sy+src->y, width, height);
- screen->tex_surface_destroy(surf);
+ pipe->surface_destroy(pipe, surf);
}
void image_get_pixels(struct vg_image *dst, VGint dx, VGint dy,
@@ -588,8 +591,7 @@ void image_get_pixels(struct vg_image *dst, VGint dx, VGint dy,
{
struct vg_context *ctx = vg_current_context();
struct pipe_context *pipe = ctx->pipe;
- struct pipe_screen *screen = pipe->screen;
- struct pipe_surface *surf;
+ struct pipe_surface *surf, surf_tmpl;
struct st_renderbuffer *strb = ctx->draw_buffer->strb;
/* flip the y coordinates */
@@ -598,8 +600,10 @@ void image_get_pixels(struct vg_image *dst, VGint dx, VGint dy,
/* make sure rendering has completed */
pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE, NULL);
- surf = screen->get_tex_surface(screen, image_texture(dst), 0, 0, 0,
- 0 /* no bind flags as surf isn't actually used??? */);
+ memset(&surf_tmpl, 0, sizeof(surf_tmpl));
+ u_surface_default_template(&surf_tmpl, image_texture(dst),
+ PIPE_BIND_RENDER_TARGET);
+ surf = pipe->create_surface(pipe, image_texture(dst), &surf_tmpl);
vg_copy_surface(ctx, surf, dst->x + dx, dst->y + dy,
strb->surface, sx, sy, width, height);
diff --git a/src/gallium/state_trackers/vega/mask.c b/src/gallium/state_trackers/vega/mask.c
index 8431e1b84b5..d8dc85fc096 100644
--- a/src/gallium/state_trackers/vega/mask.c
+++ b/src/gallium/state_trackers/vega/mask.c
@@ -37,6 +37,7 @@
#include "util/u_inlines.h"
#include "util/u_format.h"
#include "util/u_memory.h"
+#include "util/u_surface.h"
#include "util/u_sampler.h"
struct vg_mask_layer {
@@ -99,7 +100,6 @@ static void read_alpha_mask(void * data, VGint dataStride,
{
struct vg_context *ctx = vg_current_context();
struct pipe_context *pipe = ctx->pipe;
- struct pipe_screen *screen = pipe->screen;
struct st_framebuffer *stfb = ctx->draw_buffer;
struct st_renderbuffer *strb = stfb->alpha_mask;
@@ -130,8 +130,8 @@ 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_BIND_TRANSFER_READ);
+ surf = pipe->create_surface(pipe, strb->texture, 0, 0, 0,
+ PIPE_BIND_TRANSFER_READ);
/* Do a row at a time to flip image data vertically */
for (i = 0; i < height; i++) {
@@ -400,11 +400,13 @@ void mask_copy(struct vg_mask_layer *layer,
{
struct vg_context *ctx = vg_current_context();
struct pipe_sampler_view *src = vg_get_surface_mask(ctx);
- struct pipe_surface *surf;
+ struct pipe_surface *surf, surf_tmpl;
/* get the destination surface */
- surf = ctx->pipe->screen->get_tex_surface(ctx->pipe->screen,
- layer->sampler_view->texture, 0, 0, 0, PIPE_BIND_RENDER_TARGET);
+ u_surface_default_template(&surf_tmpl, layer->sampler_view->texture,
+ PIPE_BIND_RENDER_TARGET);
+ surf = ctx->pipe->create_surface(ctx->pipe, layer->sampler_view->texture,
+ &surf_tmpl);
if (surf && renderer_copy_begin(ctx->renderer, surf, VG_FALSE, src)) {
/* layer should be flipped when used as a texture */
sy += height;
@@ -424,13 +426,13 @@ static void mask_layer_render_to(struct vg_mask_layer *layer,
VGbitfield paint_modes)
{
struct vg_context *ctx = vg_current_context();
- struct pipe_screen *screen = ctx->pipe->screen;
+ struct pipe_context *pipe = ctx->pipe;
struct pipe_sampler_view *view = vg_get_surface_mask(ctx);
struct matrix *mat = &ctx->state.vg.path_user_to_surface_matrix;
- struct pipe_surface *surf;
-
- surf = screen->get_tex_surface(screen, view->texture,
- 0, 0, 0, PIPE_BIND_RENDER_TARGET);
+ struct pipe_surface *surf, surf_tmpl;
+ u_surface_default_template(&surf_tmpl, view->texture,
+ PIPE_BIND_RENDER_TARGET);
+ surf = pipe->create_surface(pipe, view->texture, &surf_tmpl);
renderer_validate_for_mask_rendering(ctx->renderer, surf);
diff --git a/src/gallium/state_trackers/vega/paint.c b/src/gallium/state_trackers/vega/paint.c
index 31c17842cf1..2db8cbcf7c8 100644
--- a/src/gallium/state_trackers/vega/paint.c
+++ b/src/gallium/state_trackers/vega/paint.c
@@ -154,14 +154,15 @@ static INLINE struct pipe_resource *create_gradient_texture(struct vg_paint *p)
templ.width0 = 1024;
templ.height0 = 1;
templ.depth0 = 1;
+ templ.array_size = 1;
templ.bind = PIPE_BIND_SAMPLER_VIEW;
tex = screen->resource_create(screen, &templ);
{ /* upload color_data */
struct pipe_transfer *transfer =
- pipe_get_transfer(p->base.ctx->pipe, tex, 0, 0, 0,
- PIPE_TRANSFER_WRITE, 0, 0, 1024, 1);
+ pipe_get_transfer(p->base.ctx->pipe, tex, 0, 0,
+ PIPE_TRANSFER_WRITE, 0, 0, 1024, 1);
void *map = pipe->transfer_map(pipe, transfer);
memcpy(map, p->gradient.color_data, sizeof(VGint)*1024);
pipe->transfer_unmap(pipe, transfer);
diff --git a/src/gallium/state_trackers/vega/renderer.c b/src/gallium/state_trackers/vega/renderer.c
index 169526bf7bb..080bcf6fb3f 100644
--- a/src/gallium/state_trackers/vega/renderer.c
+++ b/src/gallium/state_trackers/vega/renderer.c
@@ -40,6 +40,7 @@
#include "util/u_simple_shaders.h"
#include "util/u_memory.h"
#include "util/u_sampler.h"
+#include "util/u_surface.h"
#include "util/u_math.h"
#include "cso_cache/cso_context.h"
@@ -815,7 +816,7 @@ VGboolean renderer_filter_begin(struct renderer *renderer,
const void *const_buffer,
VGint const_buffer_len)
{
- struct pipe_surface *surf;
+ struct pipe_surface *surf, surf_tmpl;
assert(renderer->state == RENDERER_STATE_INIT);
@@ -824,8 +825,9 @@ VGboolean renderer_filter_begin(struct renderer *renderer,
if (!renderer_can_support(renderer, dst, PIPE_BIND_RENDER_TARGET))
return VG_FALSE;
- surf = renderer->pipe->screen->get_tex_surface(renderer->pipe->screen,
- dst, 0, 0, 0, PIPE_BIND_RENDER_TARGET);
+ u_surface_default_template(&surf_tmpl, dst,
+ PIPE_BIND_RENDER_TARGET);
+ surf = renderer->pipe->create_surface(renderer->pipe, dst, &surf_tmpl);
if (!surf)
return VG_FALSE;
@@ -1380,8 +1382,8 @@ void renderer_copy_surface(struct renderer *ctx,
struct pipe_screen *screen = pipe->screen;
struct pipe_sampler_view view_templ;
struct pipe_sampler_view *view;
+ struct pipe_box src_box;
struct pipe_resource texTemp, *tex;
- struct pipe_subresource subsrc, subdst;
const struct pipe_framebuffer_state *fb = &ctx->g3d.fb;
const int srcW = abs(srcX1 - srcX0);
const int srcH = abs(srcY1 - srcY0);
@@ -1425,6 +1427,7 @@ void renderer_copy_surface(struct renderer *ctx,
texTemp.width0 = srcW;
texTemp.height0 = srcH;
texTemp.depth0 = 1;
+ texTemp.array_size = 1;
texTemp.bind = PIPE_BIND_SAMPLER_VIEW;
tex = screen->resource_create(screen, &texTemp);
@@ -1437,15 +1440,11 @@ void renderer_copy_surface(struct renderer *ctx,
if (!view)
return;
- subdst.face = 0;
- subdst.level = 0;
- subsrc.face = src->face;
- subsrc.level = src->level;
+ u_box_2d_zslice(srcLeft, srcTop, src->u.tex.first_layer, srcW, srcH, &src_box);
pipe->resource_copy_region(pipe,
- tex, subdst, 0, 0, 0, /* dest */
- src->texture, subsrc, srcLeft, srcTop, src->zslice, /* src */
- srcW, srcH); /* size */
+ tex, 0, 0, 0, 0, /* dest */
+ src->texture, 0, &src_box);
assert(floatsEqual(z, 0.0f));
diff --git a/src/gallium/state_trackers/vega/vg_context.c b/src/gallium/state_trackers/vega/vg_context.c
index 5b072655c74..5479edc8613 100644
--- a/src/gallium/state_trackers/vega/vg_context.c
+++ b/src/gallium/state_trackers/vega/vg_context.c
@@ -44,6 +44,7 @@
#include "util/u_memory.h"
#include "util/u_blit.h"
#include "util/u_sampler.h"
+#include "util/u_surface.h"
#include "util/u_format.h"
struct vg_context *_vg_context = 0;
@@ -241,6 +242,7 @@ create_texture(struct pipe_context *pipe, enum pipe_format format,
templ.width0 = width;
templ.height0 = height;
templ.depth0 = 1;
+ templ.array_size = 1;
templ.last_level = 0;
if (util_format_get_component_bits(format, UTIL_FORMAT_COLORSPACE_ZS, 1)) {
@@ -310,22 +312,18 @@ vg_context_update_surface_mask_view(struct vg_context *ctx,
/* if we had an old surface copy it over */
if (old_sampler_view) {
- struct pipe_subresource subsurf, subold_surf;
- subsurf.face = 0;
- subsurf.level = 0;
- subold_surf.face = 0;
- subold_surf.level = 0;
+ struct pipe_box src_box;
+ u_box_origin_2d(MIN2(old_sampler_view->texture->width0,
+ stfb->surface_mask_view->texture->width0),
+ MIN2(old_sampler_view->texture->height0,
+ stfb->surface_mask_view->texture->height0),
+ &src_box);
+
pipe->resource_copy_region(pipe,
stfb->surface_mask_view->texture,
- subsurf,
- 0, 0, 0,
+ 0, 0, 0, 0,
old_sampler_view->texture,
- subold_surf,
- 0, 0, 0,
- MIN2(old_sampler_view->texture->width0,
- stfb->surface_mask_view->texture->width0),
- MIN2(old_sampler_view->texture->height0,
- stfb->surface_mask_view->texture->height0));
+ 0, &src_box);
}
/* Free the old texture
@@ -359,7 +357,7 @@ vg_context_update_depth_stencil_rb(struct vg_context * ctx,
{
struct st_renderbuffer *dsrb = ctx->draw_buffer->dsrb;
struct pipe_context *pipe = ctx->pipe;
- unsigned surface_usage;
+ struct pipe_surface surf_tmpl;
if ((dsrb->width == width && dsrb->height == height) && dsrb->texture)
return FALSE;
@@ -369,18 +367,16 @@ vg_context_update_depth_stencil_rb(struct vg_context * ctx,
pipe_resource_reference(&dsrb->texture, NULL);
dsrb->width = dsrb->height = 0;
- /* Probably need dedicated flags for surface usage too:
- */
- surface_usage = PIPE_BIND_DEPTH_STENCIL; /* XXX: was: RENDER_TARGET */
-
dsrb->texture = create_texture(pipe, dsrb->format, width, height);
if (!dsrb->texture)
return TRUE;
- dsrb->surface = pipe->screen->get_tex_surface(pipe->screen,
- dsrb->texture,
- 0, 0, 0,
- surface_usage);
+ memset(&surf_tmpl, 0, sizeof(surf_tmpl));
+ u_surface_default_template(&surf_tmpl, dsrb->texture,
+ PIPE_BIND_DEPTH_STENCIL);
+ dsrb->surface = pipe->create_surface(pipe,
+ dsrb->texture,
+ &surf_tmpl);
if (!dsrb->surface) {
pipe_resource_reference(&dsrb->texture, NULL);
return TRUE;
@@ -439,11 +435,16 @@ static void vg_prepare_blend_texture(struct vg_context *ctx,
{
struct st_framebuffer *stfb = ctx->draw_buffer;
struct pipe_surface *surf;
+ struct pipe_surface surf_tmpl;
vg_context_update_blend_texture_view(ctx, stfb->width, stfb->height);
- surf = ctx->pipe->screen->get_tex_surface(ctx->pipe->screen,
- stfb->blend_texture_view->texture, 0, 0, 0, PIPE_BIND_RENDER_TARGET);
+ memset(&surf_tmpl, 0, sizeof(surf_tmpl));
+ u_surface_default_template(&surf_tmpl, stfb->blend_texture_view->texture,
+ PIPE_BIND_RENDER_TARGET);
+ surf = ctx->pipe->create_surface(ctx->pipe,
+ stfb->blend_texture_view->texture,
+ &surf_tmpl);
if (surf) {
util_blit_pixels_tex(ctx->blit,
src, 0, 0, stfb->width, stfb->height,
diff --git a/src/gallium/state_trackers/vega/vg_manager.c b/src/gallium/state_trackers/vega/vg_manager.c
index 03c8d22ba81..d538e665dae 100644
--- a/src/gallium/state_trackers/vega/vg_manager.c
+++ b/src/gallium/state_trackers/vega/vg_manager.c
@@ -34,6 +34,8 @@
#include "util/u_memory.h"
#include "util/u_inlines.h"
#include "util/u_sampler.h"
+#include "util/u_box.h"
+#include "util/u_surface.h"
#include "vg_api.h"
#include "vg_manager.h"
@@ -45,7 +47,8 @@ static boolean
vg_context_update_color_rb(struct vg_context *ctx, struct pipe_resource *pt)
{
struct st_renderbuffer *strb = ctx->draw_buffer->strb;
- struct pipe_screen *screen = ctx->pipe->screen;
+ struct pipe_context *pipe = ctx->pipe;
+ struct pipe_surface surf_tmpl;
if (strb->texture == pt) {
pipe_resource_reference(&pt, NULL);
@@ -58,8 +61,12 @@ vg_context_update_color_rb(struct vg_context *ctx, struct pipe_resource *pt)
strb->width = strb->height = 0;
strb->texture = pt;
- strb->surface = screen->get_tex_surface(screen, strb->texture, 0, 0, 0,
- PIPE_BIND_RENDER_TARGET);
+
+ memset(&surf_tmpl, 0, sizeof(surf_tmpl));
+ u_surface_default_template(&surf_tmpl, strb->texture,
+ PIPE_BIND_RENDER_TARGET);
+ strb->surface = pipe->create_surface(pipe, strb->texture, &surf_tmpl);
+
if (!strb->surface) {
pipe_resource_reference(&strb->texture, NULL);
return TRUE;
diff --git a/src/gallium/state_trackers/wgl/stw_framebuffer.c b/src/gallium/state_trackers/wgl/stw_framebuffer.c
index 259b22f22c7..733222aa21c 100644
--- a/src/gallium/state_trackers/wgl/stw_framebuffer.c
+++ b/src/gallium/state_trackers/wgl/stw_framebuffer.c
@@ -469,7 +469,7 @@ DrvPresentBuffers(HDC hdc, PGLPRESENTBUFFERSDATA data)
{
struct stw_framebuffer *fb;
struct pipe_screen *screen;
- struct pipe_surface *surface;
+ struct pipe_resource *res;
if (!stw_dev)
return FALSE;
@@ -480,7 +480,7 @@ DrvPresentBuffers(HDC hdc, PGLPRESENTBUFFERSDATA data)
screen = stw_dev->screen;
- surface = (struct pipe_surface *)data->pPrivateData;
+ res = (struct pipe_resource *)data->pPrivateData;
if(data->hSharedSurface != fb->hSharedSurface) {
if(fb->shared_surface) {
@@ -498,13 +498,13 @@ DrvPresentBuffers(HDC hdc, PGLPRESENTBUFFERSDATA data)
if(fb->shared_surface) {
stw_dev->stw_winsys->compose(screen,
- surface,
+ res,
fb->shared_surface,
&fb->client_rect,
data->PresentHistoryToken);
}
else {
- stw_dev->stw_winsys->present( screen, surface, hdc );
+ stw_dev->stw_winsys->present( screen, res, hdc );
}
stw_framebuffer_update(fb);
@@ -524,7 +524,7 @@ DrvPresentBuffers(HDC hdc, PGLPRESENTBUFFERSDATA data)
BOOL
stw_framebuffer_present_locked(HDC hdc,
struct stw_framebuffer *fb,
- struct pipe_surface *surface)
+ struct pipe_resource *res)
{
if(stw_dev->callbacks.wglCbPresentBuffers &&
stw_dev->stw_winsys->compose) {
@@ -535,7 +535,7 @@ stw_framebuffer_present_locked(HDC hdc,
data.magic2 = 0;
data.AdapterLuid = stw_dev->AdapterLuid;
data.rect = fb->client_rect;
- data.pPrivateData = (void *)surface;
+ data.pPrivateData = (void *)res;
stw_notify_current_locked(fb);
stw_framebuffer_release(fb);
@@ -545,7 +545,7 @@ stw_framebuffer_present_locked(HDC hdc,
else {
struct pipe_screen *screen = stw_dev->screen;
- stw_dev->stw_winsys->present( screen, surface, hdc );
+ stw_dev->stw_winsys->present( screen, res, hdc );
stw_framebuffer_update(fb);
stw_notify_current_locked(fb);
diff --git a/src/gallium/state_trackers/wgl/stw_framebuffer.h b/src/gallium/state_trackers/wgl/stw_framebuffer.h
index 89d12300e67..6604e545cbc 100644
--- a/src/gallium/state_trackers/wgl/stw_framebuffer.h
+++ b/src/gallium/state_trackers/wgl/stw_framebuffer.h
@@ -32,7 +32,7 @@
#include "os/os_thread.h"
-struct pipe_surface;
+struct pipe_resource;
struct st_framebuffer_iface;
struct stw_pixelformat_info;
@@ -143,7 +143,7 @@ stw_framebuffer_from_hdc(
BOOL
stw_framebuffer_present_locked(HDC hdc,
struct stw_framebuffer *fb,
- struct pipe_surface *surface);
+ struct pipe_resource *res);
void
stw_framebuffer_update(
diff --git a/src/gallium/state_trackers/wgl/stw_st.c b/src/gallium/state_trackers/wgl/stw_st.c
index bcdd82e4f66..40ea2f499ad 100644
--- a/src/gallium/state_trackers/wgl/stw_st.c
+++ b/src/gallium/state_trackers/wgl/stw_st.c
@@ -44,7 +44,7 @@ struct stw_st_framebuffer {
unsigned texture_width, texture_height;
unsigned texture_mask;
- struct pipe_surface *front_surface, *back_surface;
+ struct pipe_resource *front_res, *back_res;
};
static INLINE struct stw_st_framebuffer *
@@ -66,8 +66,8 @@ stw_st_framebuffer_validate_locked(struct st_framebuffer_iface *stfb,
unsigned i;
/* remove outdated surface */
- pipe_surface_reference(&stwfb->front_surface, NULL);
- pipe_surface_reference(&stwfb->back_surface, NULL);
+ pipe_resource_reference(&stwfb->front_res, NULL);
+ pipe_resource_reference(&stwfb->back_res, NULL);
/* remove outdated textures */
if (stwfb->texture_width != width || stwfb->texture_height != height) {
@@ -80,6 +80,7 @@ stw_st_framebuffer_validate_locked(struct st_framebuffer_iface *stfb,
templ.width0 = width;
templ.height0 = height;
templ.depth0 = 1;
+ templ.array_size = 1;
templ.last_level = 0;
for (i = 0; i < ST_ATTACHMENT_COUNT; i++) {
@@ -155,19 +156,22 @@ stw_st_framebuffer_validate(struct st_framebuffer_iface *stfb,
return TRUE;
}
-static struct pipe_surface *
+static struct pipe_resource *
get_present_surface_locked(struct st_framebuffer_iface *stfb,
enum st_attachment_type statt)
{
struct stw_st_framebuffer *stwfb = stw_st_framebuffer(stfb);
+#if 0
+ /* since we don't really have to get a surface for this we
+ no longer need a cache? */
struct pipe_resource *ptex;
- struct pipe_surface *psurf, **cache;
-
+ struct pipe_resource *pres, **cache;
+
ptex = stwfb->textures[statt];
if (!ptex)
return NULL;
- psurf = NULL;
+ pres = NULL;
switch (statt) {
case ST_ATTACHMENT_FRONT_LEFT:
@@ -177,21 +181,21 @@ get_present_surface_locked(struct st_framebuffer_iface *stfb,
cache = &stwfb->back_surface;
break;
default:
- cache = &psurf;
+ cache = &pres;
break;
}
if (!*cache) {
- *cache = stw_dev->screen->get_tex_surface(stw_dev->screen,
- ptex, 0, 0, 0,
- PIPE_BIND_DISPLAY_TARGET |
- PIPE_BIND_RENDER_TARGET);
+ *cache = ptex;
}
- if (psurf != *cache)
- pipe_surface_reference(&psurf, *cache);
+ if (pres != *cache)
+ pipe_resource_reference(&pres, *cache);
- return psurf;
+ return pres;
+#else
+ return stwfb->textures[statt];
+#endif
}
/**
@@ -202,12 +206,12 @@ stw_st_framebuffer_present_locked(struct st_framebuffer_iface *stfb,
enum st_attachment_type statt)
{
struct stw_st_framebuffer *stwfb = stw_st_framebuffer(stfb);
- struct pipe_surface *psurf;
-
- psurf = get_present_surface_locked(&stwfb->base, statt);
- if (psurf) {
- stw_framebuffer_present_locked(stwfb->fb->hDC, stwfb->fb, psurf);
- pipe_surface_reference(&psurf, NULL);
+ struct pipe_resource *pres;
+
+ pres = get_present_surface_locked(&stwfb->base, statt);
+ if (pres) {
+ stw_framebuffer_present_locked(stwfb->fb->hDC, stwfb->fb, pres);
+ pipe_resource_reference(&pres, NULL);
}
return TRUE;
@@ -255,8 +259,8 @@ stw_st_destroy_framebuffer_locked(struct st_framebuffer_iface *stfb)
struct stw_st_framebuffer *stwfb = stw_st_framebuffer(stfb);
int i;
- pipe_surface_reference(&stwfb->front_surface, NULL);
- pipe_surface_reference(&stwfb->back_surface, NULL);
+ pipe_resource_reference(&stwfb->front_res, NULL);
+ pipe_resource_reference(&stwfb->back_res, NULL);
for (i = 0; i < ST_ATTACHMENT_COUNT; i++)
pipe_resource_reference(&stwfb->textures[i], NULL);
@@ -273,7 +277,7 @@ stw_st_swap_framebuffer_locked(struct st_framebuffer_iface *stfb)
struct stw_st_framebuffer *stwfb = stw_st_framebuffer(stfb);
unsigned front = ST_ATTACHMENT_FRONT_LEFT, back = ST_ATTACHMENT_BACK_LEFT;
struct pipe_resource *ptex;
- struct pipe_surface *psurf;
+ struct pipe_resource *pres;
unsigned mask;
/* swap the textures */
@@ -282,9 +286,9 @@ stw_st_swap_framebuffer_locked(struct st_framebuffer_iface *stfb)
stwfb->textures[back] = ptex;
/* swap the surfaces */
- psurf = stwfb->front_surface;
- stwfb->front_surface = stwfb->back_surface;
- stwfb->back_surface = psurf;
+ pres = stwfb->front_res;
+ stwfb->front_res = stwfb->back_res;
+ stwfb->back_res = pres;
/* convert to mask */
front = 1 << front;
diff --git a/src/gallium/state_trackers/wgl/stw_winsys.h b/src/gallium/state_trackers/wgl/stw_winsys.h
index 270fad56a19..397065fc159 100644
--- a/src/gallium/state_trackers/wgl/stw_winsys.h
+++ b/src/gallium/state_trackers/wgl/stw_winsys.h
@@ -34,7 +34,7 @@
struct pipe_screen;
struct pipe_context;
-struct pipe_surface;
+struct pipe_resource;
struct stw_shared_surface;
@@ -43,12 +43,13 @@ struct stw_winsys
struct pipe_screen *
(*create_screen)( void );
+ /* XXX is it actually possible to have non-zero level/layer ??? */
/**
* Present the color buffer to the window associated with the device context.
*/
void
(*present)( struct pipe_screen *screen,
- struct pipe_surface *surf,
+ struct pipe_resource *res,
HDC hDC );
/**
@@ -85,7 +86,7 @@ struct stw_winsys
*/
void
(*compose)( struct pipe_screen *screen,
- struct pipe_surface *src,
+ struct pipe_resource *res,
struct stw_shared_surface *dest,
LPCRECT pRect,
ULONGLONG PresentHistoryToken );
diff --git a/src/gallium/state_trackers/xorg/xorg_composite.c b/src/gallium/state_trackers/xorg/xorg_composite.c
index 4ff48026e50..d4dc84a122b 100644
--- a/src/gallium/state_trackers/xorg/xorg_composite.c
+++ b/src/gallium/state_trackers/xorg/xorg_composite.c
@@ -473,7 +473,7 @@ boolean xorg_composite_bind_state(struct exa_context *exa,
struct exa_pixmap_priv *pMask,
struct exa_pixmap_priv *pDst)
{
- struct pipe_surface *dst_surf = xorg_gpu_surface(exa->scrn, pDst);
+ struct pipe_surface *dst_surf = xorg_gpu_surface(exa->pipe, pDst);
renderer_bind_destination(exa->renderer, dst_surf,
pDst->width,
@@ -529,7 +529,7 @@ boolean xorg_solid_bind_state(struct exa_context *exa,
struct exa_pixmap_priv *pixmap,
Pixel fg)
{
- struct pipe_surface *dst_surf = xorg_gpu_surface(exa->scrn, pixmap);
+ struct pipe_surface *dst_surf = xorg_gpu_surface(exa->pipe, pixmap);
unsigned vs_traits, fs_traits;
struct xorg_shader shader;
diff --git a/src/gallium/state_trackers/xorg/xorg_crtc.c b/src/gallium/state_trackers/xorg/xorg_crtc.c
index 80af82d97b2..28e30e09ff3 100644
--- a/src/gallium/state_trackers/xorg/xorg_crtc.c
+++ b/src/gallium/state_trackers/xorg/xorg_crtc.c
@@ -210,6 +210,7 @@ crtc_load_cursor_argb_ga3d(xf86CrtcPtr crtc, CARD32 * image)
templat.target = PIPE_TEXTURE_2D;
templat.last_level = 0;
templat.depth0 = 1;
+ templat.array_size = 1;
templat.format = PIPE_FORMAT_B8G8R8A8_UNORM;
templat.width0 = 64;
templat.height0 = 64;
@@ -225,9 +226,9 @@ crtc_load_cursor_argb_ga3d(xf86CrtcPtr crtc, CARD32 * image)
}
transfer = pipe_get_transfer(ms->ctx, crtcp->cursor_tex,
- 0, 0, 0,
- PIPE_TRANSFER_WRITE,
- 0, 0, 64, 64);
+ 0, 0,
+ PIPE_TRANSFER_WRITE,
+ 0, 0, 64, 64);
ptr = ms->ctx->transfer_map(ms->ctx, transfer);
util_copy_rect(ptr, crtcp->cursor_tex->format,
transfer->stride, 0, 0,
diff --git a/src/gallium/state_trackers/xorg/xorg_dri2.c b/src/gallium/state_trackers/xorg/xorg_dri2.c
index b723a8e9cb0..17c34b7eac8 100644
--- a/src/gallium/state_trackers/xorg/xorg_dri2.c
+++ b/src/gallium/state_trackers/xorg/xorg_dri2.c
@@ -129,6 +129,7 @@ dri2_do_create_buffer(DrawablePtr pDraw, DRI2BufferPtr buffer, unsigned int form
template.width0 = pDraw->width;
template.height0 = pDraw->height;
template.depth0 = 1;
+ template.array_size = 1;
template.last_level = 0;
template.bind = PIPE_BIND_DEPTH_STENCIL |
PIPE_BIND_SHARED;
diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c
index 4b1c02bad42..718a3453939 100644
--- a/src/gallium/state_trackers/xorg/xorg_exa.c
+++ b/src/gallium/state_trackers/xorg/xorg_exa.c
@@ -46,6 +46,8 @@
#include "util/u_math.h"
#include "util/u_debug.h"
#include "util/u_format.h"
+#include "util/u_box.h"
+#include "util/u_surface.h"
#define DEBUG_PRINT 0
#define ROUND_UP_TEXTURES 1
@@ -188,8 +190,8 @@ ExaDownloadFromScreen(PixmapPtr pPix, int x, int y, int w, int h, char *dst,
if (!priv || !priv->tex)
return FALSE;
- transfer = pipe_get_transfer(exa->pipe, priv->tex, 0, 0, 0,
- PIPE_TRANSFER_READ, x, y, w, h);
+ transfer = pipe_get_transfer(exa->pipe, priv->tex, 0, 0,
+ PIPE_TRANSFER_READ, x, y, w, h);
if (!transfer)
return FALSE;
@@ -222,8 +224,8 @@ ExaUploadToScreen(PixmapPtr pPix, int x, int y, int w, int h, char *src,
if (!priv || !priv->tex)
return FALSE;
- transfer = pipe_get_transfer(exa->pipe, priv->tex, 0, 0, 0,
- PIPE_TRANSFER_WRITE, x, y, w, h);
+ transfer = pipe_get_transfer(exa->pipe, priv->tex, 0, 0,
+ PIPE_TRANSFER_WRITE, x, y, w, h);
if (!transfer)
return FALSE;
@@ -265,7 +267,7 @@ ExaPrepareAccess(PixmapPtr pPix, int index)
assert(pPix->drawable.height <= priv->tex->height0);
priv->map_transfer =
- pipe_get_transfer(exa->pipe, priv->tex, 0, 0, 0,
+ pipe_get_transfer(exa->pipe, priv->tex, 0, 0,
#ifdef EXA_MIXED_PIXMAPS
PIPE_TRANSFER_MAP_DIRECTLY |
#endif
@@ -449,6 +451,7 @@ ExaPrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int xdir,
exa->copy.use_surface_copy = TRUE;
}
else {
+ struct pipe_surface surf_tmpl;
exa->copy.use_surface_copy = FALSE;
if (exa->copy.dst == exa->copy.src)
@@ -458,11 +461,13 @@ ExaPrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int xdir,
pipe_resource_reference(&exa->copy.src_texture,
exa->copy.src->tex);
+ memset(&surf_tmpl, 0, sizeof(surf_tmpl));
+ u_surface_default_template(&surf_tmpl, exa->copy.dst->tex,
+ PIPE_BIND_RENDER_TARGET);
exa->copy.dst_surface =
- exa->scrn->get_tex_surface(exa->scrn,
- exa->copy.dst->tex,
- 0, 0, 0,
- PIPE_BIND_RENDER_TARGET);
+ exa->pipe->create_surface(exa->pipe,
+ exa->copy.dst->tex,
+ &surf_tmpl);
renderer_copy_prepare(exa->renderer,
@@ -492,19 +497,14 @@ ExaCopy(PixmapPtr pDstPixmap, int srcX, int srcY, int dstX, int dstY,
(void) priv;
if (exa->copy.use_surface_copy) {
- struct pipe_subresource subdst, subsrc;
- subdst.face = 0;
- subdst.level = 0;
- subsrc.face = 0;
- subsrc.level = 0;
+ struct pipe_box src_box;
+ u_box_2d(srcX, srcY, width, height, &src_box);
exa->pipe->resource_copy_region( exa->pipe,
exa->copy.dst->tex,
- subdst,
+ 0,
dstX, dstY, 0,
exa->copy.src->tex,
- subsrc,
- srcX, srcY, 0,
- width, height );
+ 0, &src_box);
}
else {
renderer_copy_pixmap(exa->renderer,
@@ -874,24 +874,21 @@ ExaModifyPixmapHeader(PixmapPtr pPixmap, int width, int height,
}
template.depth0 = 1;
+ template.array_size = 1;
template.last_level = 0;
template.bind = PIPE_BIND_RENDER_TARGET | priv->flags;
priv->tex_flags = priv->flags;
texture = exa->scrn->resource_create(exa->scrn, &template);
if (priv->tex) {
- struct pipe_subresource subdst, subsrc;
-
- subdst.face = 0;
- subdst.level = 0;
- subsrc.face = 0;
- subsrc.level = 0;
+ struct pipe_box src_box;
+ u_box_origin_2d(min(width, texture->width0),
+ min(height, texture->height0),
+ &src_box);
exa->pipe->resource_copy_region(exa->pipe, texture,
- subdst, 0, 0, 0,
+ 0, 0, 0, 0,
priv->tex,
- subsrc, 0, 0, 0,
- min(width, texture->width0),
- min(height, texture->height0));
+ 0, &src_box);
}
pipe_resource_reference(&priv->tex, texture);
@@ -947,6 +944,7 @@ xorg_exa_create_root_texture(ScrnInfoPtr pScrn,
template.width0 = width;
template.height0 = height;
template.depth0 = 1;
+ template.array_size = 1;
template.last_level = 0;
template.bind |= PIPE_BIND_RENDER_TARGET;
template.bind |= PIPE_BIND_SCANOUT;
@@ -1063,10 +1061,14 @@ out_err:
}
struct pipe_surface *
-xorg_gpu_surface(struct pipe_screen *scrn, struct exa_pixmap_priv *priv)
+xorg_gpu_surface(struct pipe_context *pipe, struct exa_pixmap_priv *priv)
{
- return scrn->get_tex_surface(scrn, priv->tex, 0, 0, 0,
- PIPE_BIND_RENDER_TARGET);
+ struct pipe_surface surf_tmpl;
+ memset(&surf_tmpl, 0, sizeof(surf_tmpl));
+ u_surface_default_template(&surf_tmpl, priv->tex,
+ PIPE_BIND_RENDER_TARGET);
+
+ return pipe->create_surface(pipe, priv->tex, &surf_tmpl);
}
diff --git a/src/gallium/state_trackers/xorg/xorg_exa.h b/src/gallium/state_trackers/xorg/xorg_exa.h
index 86a1afc06e6..1f78f60be74 100644
--- a/src/gallium/state_trackers/xorg/xorg_exa.h
+++ b/src/gallium/state_trackers/xorg/xorg_exa.h
@@ -72,7 +72,7 @@ do { \
} while(0)
struct pipe_surface *
-xorg_gpu_surface(struct pipe_screen *scrn, struct exa_pixmap_priv *priv);
+xorg_gpu_surface(struct pipe_context *pipe, struct exa_pixmap_priv *priv);
void xorg_exa_flush(struct exa_context *exa, uint pipeFlushFlags,
struct pipe_fence_handle **fence);
diff --git a/src/gallium/state_trackers/xorg/xorg_renderer.c b/src/gallium/state_trackers/xorg/xorg_renderer.c
index 92f1cc50653..a3d7c5a70e2 100644
--- a/src/gallium/state_trackers/xorg/xorg_renderer.c
+++ b/src/gallium/state_trackers/xorg/xorg_renderer.c
@@ -10,6 +10,7 @@
#include "util/u_sampler.h"
#include "util/u_inlines.h"
+#include "util/u_box.h"
#include <math.h>
@@ -535,6 +536,7 @@ renderer_clone_texture(struct xorg_renderer *r,
templ.width0 = src->width0;
templ.height0 = src->height0;
templ.depth0 = 1;
+ templ.array_size = 1;
templ.bind = PIPE_BIND_SAMPLER_VIEW;
pt = screen->resource_create(screen, &templ);
@@ -546,19 +548,15 @@ renderer_clone_texture(struct xorg_renderer *r,
{
/* copy source framebuffer surface into texture */
- struct pipe_subresource subsrc, subdst;
- subsrc.face = 0;
- subsrc.level = 0;
- subdst.face = 0;
- subdst.level = 0;
+ struct pipe_box src_box;
+ u_box_origin_2d(src->width0, src->height0, &src_box);
+
pipe->resource_copy_region(pipe,
pt, /* dest */
- subdst,
+ 0, /* dest_level */
0, 0, 0, /* destx/y/z */
src,
- subsrc,
- 0, 0, 0,
- src->width0, src->height0);
+ 0, &src_box);
}
return pt;
diff --git a/src/gallium/state_trackers/xorg/xorg_xv.c b/src/gallium/state_trackers/xorg/xorg_xv.c
index f64959f00e9..c72ba9ef8db 100644
--- a/src/gallium/state_trackers/xorg/xorg_xv.c
+++ b/src/gallium/state_trackers/xorg/xorg_xv.c
@@ -171,6 +171,7 @@ create_component_texture(struct pipe_context *pipe,
templ.width0 = width;
templ.height0 = height;
templ.depth0 = 1;
+ templ.array_size = 1;
templ.bind = PIPE_BIND_SAMPLER_VIEW;
tex = screen->resource_create(screen, &templ);
@@ -312,17 +313,17 @@ copy_packed_data(ScrnInfoPtr pScrn,
int y_array_size = w * h;
ytrans = pipe_get_transfer(pipe, dst[0],
- 0, 0, 0,
- PIPE_TRANSFER_WRITE,
- left, top, w, h);
+ 0, 0,
+ PIPE_TRANSFER_WRITE,
+ left, top, w, h);
utrans = pipe_get_transfer(pipe, dst[1],
- 0, 0, 0,
- PIPE_TRANSFER_WRITE,
- left, top, w, h);
+ 0, 0,
+ PIPE_TRANSFER_WRITE,
+ left, top, w, h);
vtrans = pipe_get_transfer(pipe, dst[2],
- 0, 0, 0,
- PIPE_TRANSFER_WRITE,
- left, top, w, h);
+ 0, 0,
+ PIPE_TRANSFER_WRITE,
+ left, top, w, h);
ymap = (char*)pipe->transfer_map(pipe, ytrans);
umap = (char*)pipe->transfer_map(pipe, utrans);
@@ -533,7 +534,7 @@ display_video(ScrnInfoPtr pScrn, struct xorg_xv_port_priv *pPriv, int id,
if (!dst || !dst->tex)
XORG_FALLBACK("Xv destination %s", !dst ? "!dst" : "!dst->tex");
- dst_surf = xorg_gpu_surface(pPriv->r->pipe->screen, dst);
+ dst_surf = xorg_gpu_surface(pPriv->r->pipe, dst);
hdtv = ((src_w >= RES_720P_X) && (src_h >= RES_720P_Y));
#ifdef COMPOSITE