drm/i915: Use intel_fb_obj() everywhere
authorDaniel Stone <daniels@collabora.com>
Fri, 18 May 2018 14:30:07 +0000 (15:30 +0100)
committerDaniel Stone <daniels@collabora.com>
Tue, 22 May 2018 08:44:02 +0000 (09:44 +0100)
We already have a macro to pull the GEM object from a FB, so use it
everywhere. We'll make use of this later to move the object storage.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@intel.com>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: intel-gfx@lists.freedesktop.org
Link: https://patchwork.freedesktop.org/patch/msgid/20180518143008.4120-1-daniels@collabora.com
drivers/gpu/drm/i915/i915_debugfs.c
drivers/gpu/drm/i915/intel_display.c
drivers/gpu/drm/i915/intel_fbdev.c

index 52515445ac406d278134614bff0dee9e4714e296..e9b1b8df6ef5d787f1ac55a53f96017d73f0c039 100644 (file)
@@ -1908,7 +1908,7 @@ static int i915_gem_framebuffer_info(struct seq_file *m, void *data)
                           fbdev_fb->base.format->cpp[0] * 8,
                           fbdev_fb->base.modifier,
                           drm_framebuffer_read_refcount(&fbdev_fb->base));
-               describe_obj(m, fbdev_fb->obj);
+               describe_obj(m, intel_fb_obj(&fbdev_fb->base));
                seq_putc(m, '\n');
        }
 #endif
@@ -1926,7 +1926,7 @@ static int i915_gem_framebuffer_info(struct seq_file *m, void *data)
                           fb->base.format->cpp[0] * 8,
                           fb->base.modifier,
                           drm_framebuffer_read_refcount(&fb->base));
-               describe_obj(m, fb->obj);
+               describe_obj(m, intel_fb_obj(&fb->base));
                seq_putc(m, '\n');
        }
        mutex_unlock(&dev->mode_config.fb_lock);
index c9ec88acad9c16ed0fb823511ad195b934d03a2c..1b2cf631305e38b41175083ebc7d5b920aa5da2a 100644 (file)
@@ -2474,6 +2474,7 @@ intel_fill_fb_info(struct drm_i915_private *dev_priv,
 {
        struct intel_framebuffer *intel_fb = to_intel_framebuffer(fb);
        struct intel_rotation_info *rot_info = &intel_fb->rot_info;
+       struct drm_i915_gem_object *obj = intel_fb_obj(fb);
        u32 gtt_offset_rotated = 0;
        unsigned int max_size = 0;
        int i, num_planes = fb->format->num_planes;
@@ -2538,7 +2539,7 @@ intel_fill_fb_info(struct drm_i915_private *dev_priv,
                 * fb layout agrees with the fence layout. We already check that the
                 * fb stride matches the fence stride elsewhere.
                 */
-               if (i == 0 && i915_gem_object_is_tiled(intel_fb->obj) &&
+               if (i == 0 && i915_gem_object_is_tiled(obj) &&
                    (x + width) * cpp > fb->pitches[i]) {
                        DRM_DEBUG_KMS("bad fb plane %d offset: 0x%x\n",
                                      i, fb->offsets[i]);
@@ -2623,9 +2624,9 @@ intel_fill_fb_info(struct drm_i915_private *dev_priv,
                max_size = max(max_size, offset + size);
        }
 
-       if (max_size * tile_size > intel_fb->obj->base.size) {
+       if (max_size * tile_size > obj->base.size) {
                DRM_DEBUG_KMS("fb too big for bo (need %u bytes, have %zu bytes)\n",
-                             max_size * tile_size, intel_fb->obj->base.size);
+                             max_size * tile_size, obj->base.size);
                return -EINVAL;
        }
 
@@ -14082,14 +14083,15 @@ static void intel_setup_outputs(struct drm_i915_private *dev_priv)
 static void intel_user_framebuffer_destroy(struct drm_framebuffer *fb)
 {
        struct intel_framebuffer *intel_fb = to_intel_framebuffer(fb);
+       struct drm_i915_gem_object *obj = intel_fb_obj(fb);
 
        drm_framebuffer_cleanup(fb);
 
-       i915_gem_object_lock(intel_fb->obj);
-       WARN_ON(!intel_fb->obj->framebuffer_references--);
-       i915_gem_object_unlock(intel_fb->obj);
+       i915_gem_object_lock(obj);
+       WARN_ON(!obj->framebuffer_references--);
+       i915_gem_object_unlock(obj);
 
-       i915_gem_object_put(intel_fb->obj);
+       i915_gem_object_put(obj);
 
        kfree(intel_fb);
 }
@@ -14098,8 +14100,7 @@ static int intel_user_framebuffer_create_handle(struct drm_framebuffer *fb,
                                                struct drm_file *file,
                                                unsigned int *handle)
 {
-       struct intel_framebuffer *intel_fb = to_intel_framebuffer(fb);
-       struct drm_i915_gem_object *obj = intel_fb->obj;
+       struct drm_i915_gem_object *obj = intel_fb_obj(fb);
 
        if (obj->userptr.mm) {
                DRM_DEBUG("attempting to use a userptr for a framebuffer, denied\n");
index e9e02b58b7be6e2f4fb8b8d1302b552fa7849323..fb2f9fce34cd2a3e627d183d2bca1028d7f48282 100644 (file)
@@ -47,7 +47,7 @@
 
 static void intel_fbdev_invalidate(struct intel_fbdev *ifbdev)
 {
-       struct drm_i915_gem_object *obj = ifbdev->fb->obj;
+       struct drm_i915_gem_object *obj = intel_fb_obj(&ifbdev->fb->base);
        unsigned int origin =
                ifbdev->vma_flags & PLANE_HAS_FENCE ? ORIGIN_GTT : ORIGIN_CPU;
 
@@ -193,7 +193,7 @@ static int intelfb_create(struct drm_fb_helper *helper,
                drm_framebuffer_put(&intel_fb->base);
                intel_fb = ifbdev->fb = NULL;
        }
-       if (!intel_fb || WARN_ON(!intel_fb->obj)) {
+       if (!intel_fb || WARN_ON(!intel_fb_obj(&intel_fb->base))) {
                DRM_DEBUG_KMS("no BIOS fb, allocating a new one\n");
                ret = intelfb_alloc(helper, sizes);
                if (ret)
@@ -265,7 +265,7 @@ static int intelfb_create(struct drm_fb_helper *helper,
         * If the object is stolen however, it will be full of whatever
         * garbage was left in there.
         */
-       if (intel_fb->obj->stolen && !prealloc)
+       if (intel_fb_obj(fb)->stolen && !prealloc)
                memset_io(info->screen_base, 0, info->screen_size);
 
        /* Use default scratch pixmap (info->pixmap.flags = FB_PIXMAP_SYSTEM) */
@@ -792,7 +792,8 @@ void intel_fbdev_set_suspend(struct drm_device *dev, int state, bool synchronous
         * been restored from swap. If the object is stolen however, it will be
         * full of whatever garbage was left in there.
         */
-       if (state == FBINFO_STATE_RUNNING && ifbdev->fb->obj->stolen)
+       if (state == FBINFO_STATE_RUNNING &&
+           intel_fb_obj(&ifbdev->fb->base)->stolen)
                memset_io(info->screen_base, 0, info->screen_size);
 
        drm_fb_helper_set_suspend(&ifbdev->helper, state);