gallium/radeon: fold radeon_winsys::surface_best into radeon/winsys
authorMarek Olšák <marek.olsak@amd.com>
Thu, 20 Oct 2016 20:57:03 +0000 (22:57 +0200)
committerMarek Olšák <marek.olsak@amd.com>
Wed, 26 Oct 2016 11:02:58 +0000 (13:02 +0200)
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
src/gallium/drivers/radeon/r600_texture.c
src/gallium/drivers/radeon/radeon_winsys.h
src/gallium/winsys/amdgpu/drm/amdgpu_surface.c
src/gallium/winsys/radeon/drm/radeon_drm_surface.c

index 27035c0faab63cc00bff3d92a9625afb0a8706a8..c38654989b3cde666596f507fe05ff36c4ba52ce 100644 (file)
@@ -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;
 
index 8946209d33791e828749b678f69ff8d6caa4b32a..75badd0246f7294f94ad1726847db38db21c72da 100644 (file)
@@ -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);
 
index c5462bc0e04c412491dd17e75037ff21877f2372..95da4acc7166c1befd11f3d72abb620aabd7c1a1 100644 (file)
@@ -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;
 }
index 0399e5a3680a0fdc3030bc4a733a61b967190b95..8a88ee55490d501ab567dcaf0e42ae333e5216fc 100644 (file)
@@ -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;
 }