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);
}
return NULL;
}
+ surface.flags |= RADEON_SURF_IMPORTED;
if (metadata.scanout)
surface.flags |= RADEON_SURF_SCANOUT;
#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)
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);
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;
}
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;
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;
}