summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2016-02-24 17:03:11 +0100
committerMarek Olšák <[email protected]>2016-03-09 15:02:26 +0100
commite3cee38e13dc79c3810560ba936c70f407c69aae (patch)
tree9aa92bc58e4f92cfb05af367734cfba4da565093 /src/gallium
parentf4aa3256ef2965d558b646b32d5e59280db7021d (diff)
gallium/radeon: move code initializing texture metadata to its own function
Reviewed-by: Michel Dänzer <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/radeon/r600_texture.c38
1 files changed, 23 insertions, 15 deletions
diff --git a/src/gallium/drivers/radeon/r600_texture.c b/src/gallium/drivers/radeon/r600_texture.c
index 4f187881334..33f4042bee5 100644
--- a/src/gallium/drivers/radeon/r600_texture.c
+++ b/src/gallium/drivers/radeon/r600_texture.c
@@ -228,6 +228,27 @@ static int r600_setup_surface(struct pipe_screen *screen,
return 0;
}
+static void r600_texture_init_metadata(struct r600_texture *rtex,
+ struct radeon_bo_metadata *metadata)
+{
+ struct radeon_surf *surface = &rtex->surface;
+
+ memset(metadata, 0, sizeof(*metadata));
+ metadata->microtile = surface->level[0].mode >= RADEON_SURF_MODE_1D ?
+ RADEON_LAYOUT_TILED : RADEON_LAYOUT_LINEAR;
+ metadata->macrotile = surface->level[0].mode >= RADEON_SURF_MODE_2D ?
+ RADEON_LAYOUT_TILED : RADEON_LAYOUT_LINEAR;
+ metadata->pipe_config = surface->pipe_config;
+ metadata->bankw = surface->bankw;
+ metadata->bankh = surface->bankh;
+ metadata->tile_split = surface->tile_split;
+ metadata->stencil_tile_split = surface->stencil_tile_split;
+ metadata->mtilea = surface->mtilea;
+ metadata->num_banks = surface->num_banks;
+ metadata->stride = surface->level[0].pitch_bytes;
+ metadata->scanout = (surface->flags & RADEON_SURF_SCANOUT) != 0;
+}
+
static boolean r600_texture_get_handle(struct pipe_screen* screen,
struct pipe_resource *ptex,
struct winsys_handle *whandle,
@@ -237,22 +258,9 @@ static boolean r600_texture_get_handle(struct pipe_screen* screen,
struct r600_resource *resource = &rtex->resource;
struct radeon_surf *surface = &rtex->surface;
struct r600_common_screen *rscreen = (struct r600_common_screen*)screen;
- struct radeon_bo_metadata metadata = {};
-
- metadata.microtile = surface->level[0].mode >= RADEON_SURF_MODE_1D ?
- RADEON_LAYOUT_TILED : RADEON_LAYOUT_LINEAR;
- metadata.macrotile = surface->level[0].mode >= RADEON_SURF_MODE_2D ?
- RADEON_LAYOUT_TILED : RADEON_LAYOUT_LINEAR;
- metadata.pipe_config = surface->pipe_config;
- metadata.bankw = surface->bankw;
- metadata.bankh = surface->bankh;
- metadata.tile_split = surface->tile_split;
- metadata.stencil_tile_split = surface->stencil_tile_split;
- metadata.mtilea = surface->mtilea;
- metadata.num_banks = surface->num_banks;
- metadata.stride = surface->level[0].pitch_bytes;
- metadata.scanout = (surface->flags & RADEON_SURF_SCANOUT) != 0;
+ struct radeon_bo_metadata metadata;
+ r600_texture_init_metadata(rtex, &metadata);
rscreen->ws->buffer_set_metadata(resource->buf, &metadata);
return rscreen->ws->buffer_get_handle(resource->buf,