From: Marek Olšák Date: Thu, 20 Oct 2016 20:57:03 +0000 (+0200) Subject: gallium/radeon: fold radeon_winsys::surface_best into radeon/winsys X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=81a95946dab730c1cfcf04ac1373cea5f7908f65;p=mesa.git gallium/radeon: fold radeon_winsys::surface_best into radeon/winsys Reviewed-by: Nicolai Hähnle --- diff --git a/src/gallium/drivers/radeon/r600_texture.c b/src/gallium/drivers/radeon/r600_texture.c index 27035c0faab..c38654989b3 100644 --- a/src/gallium/drivers/radeon/r600_texture.c +++ b/src/gallium/drivers/radeon/r600_texture.c @@ -1296,10 +1296,7 @@ struct pipe_resource *r600_texture_create(struct pipe_screen *screen, if (r) { return NULL; } - r = rscreen->ws->surface_best(rscreen->ws, &surface); - if (r) { - return NULL; - } + return (struct pipe_resource *)r600_texture_create_object(screen, templ, 0, 0, NULL, &surface); } @@ -1349,6 +1346,7 @@ static struct pipe_resource *r600_texture_from_handle(struct pipe_screen *screen return NULL; } + surface.flags |= RADEON_SURF_IMPORTED; if (metadata.scanout) surface.flags |= RADEON_SURF_SCANOUT; diff --git a/src/gallium/drivers/radeon/radeon_winsys.h b/src/gallium/drivers/radeon/radeon_winsys.h index 8946209d337..75badd0246f 100644 --- a/src/gallium/drivers/radeon/radeon_winsys.h +++ b/src/gallium/drivers/radeon/radeon_winsys.h @@ -279,6 +279,7 @@ enum radeon_feature_id { #define RADEON_SURF_FMASK (1 << 21) #define RADEON_SURF_DISABLE_DCC (1 << 22) #define RADEON_SURF_TC_COMPATIBLE_HTILE (1 << 23) +#define RADEON_SURF_IMPORTED (1 << 24) #define RADEON_SURF_GET(v, field) (((v) >> RADEON_SURF_ ## field ## _SHIFT) & RADEON_SURF_ ## field ## _MASK) #define RADEON_SURF_SET(v, field) (((v) & RADEON_SURF_ ## field ## _MASK) << RADEON_SURF_ ## field ## _SHIFT) @@ -744,15 +745,6 @@ struct radeon_winsys { int (*surface_init)(struct radeon_winsys *ws, struct radeon_surf *surf); - /** - * Find best values for a surface - * - * \param ws The winsys this function is called from. - * \param surf Surface structure ptr - */ - int (*surface_best)(struct radeon_winsys *ws, - struct radeon_surf *surf); - uint64_t (*query_value)(struct radeon_winsys *ws, enum radeon_value_id value); diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_surface.c b/src/gallium/winsys/amdgpu/drm/amdgpu_surface.c index c5462bc0e04..95da4acc716 100644 --- a/src/gallium/winsys/amdgpu/drm/amdgpu_surface.c +++ b/src/gallium/winsys/amdgpu/drm/amdgpu_surface.c @@ -577,14 +577,7 @@ static int amdgpu_surface_init(struct radeon_winsys *rws, return 0; } -static int amdgpu_surface_best(struct radeon_winsys *rws, - struct radeon_surf *surf) -{ - return 0; -} - void amdgpu_surface_init_functions(struct amdgpu_winsys *ws) { ws->base.surface_init = amdgpu_surface_init; - ws->base.surface_best = amdgpu_surface_best; } diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_surface.c b/src/gallium/winsys/radeon/drm/radeon_drm_surface.c index 0399e5a3680..8a88ee55490 100644 --- a/src/gallium/winsys/radeon/drm/radeon_drm_surface.c +++ b/src/gallium/winsys/radeon/drm/radeon_drm_surface.c @@ -186,24 +186,13 @@ static int radeon_winsys_surface_init(struct radeon_winsys *rws, surf_winsys_to_drm(&surf_drm, surf_ws); - r = radeon_surface_init(ws->surf_man, &surf_drm); - if (r) - return r; - - surf_drm_to_winsys(ws, surf_ws, &surf_drm); - return 0; -} - -static int radeon_winsys_surface_best(struct radeon_winsys *rws, - struct radeon_surf *surf_ws) -{ - struct radeon_drm_winsys *ws = (struct radeon_drm_winsys*)rws; - struct radeon_surface surf_drm; - int r; - - surf_winsys_to_drm(&surf_drm, surf_ws); + if (!(surf_ws->flags & RADEON_SURF_IMPORTED)) { + r = radeon_surface_best(ws->surf_man, &surf_drm); + if (r) + return r; + } - r = radeon_surface_best(ws->surf_man, &surf_drm); + r = radeon_surface_init(ws->surf_man, &surf_drm); if (r) return r; @@ -214,5 +203,4 @@ static int radeon_winsys_surface_best(struct radeon_winsys *rws, void radeon_surface_init_functions(struct radeon_drm_winsys *ws) { ws->base.surface_init = radeon_winsys_surface_init; - ws->base.surface_best = radeon_winsys_surface_best; }