drm/i915: Make intel_gtt_get() return type the same as on Linux 3.5
authorFrançois Tigeot <ftigeot@wolfpond.org>
Tue, 1 Oct 2013 13:33:18 +0000 (15:33 +0200)
committerFrançois Tigeot <ftigeot@wolfpond.org>
Tue, 1 Oct 2013 14:36:28 +0000 (16:36 +0200)
sys/dev/agp/agp_i810.c
sys/dev/agp/agp_i810.h
sys/dev/drm/i915/i915_dma.c
sys/dev/drm/i915/i915_drv.h
sys/dev/drm/i915/i915_gem_gtt.c

index 7a0a0a1..cbfbf4a 100644 (file)
@@ -244,6 +244,10 @@ struct agp_i810_driver {
        void (*chipset_flush)(device_t);
 };
 
+static struct {
+       struct intel_gtt base;
+} intel_private;
+
 static const struct agp_i810_driver agp_i810_i810_driver = {
        .chiptype = CHIP_I810,
        .gen = 1,
@@ -2558,11 +2562,10 @@ intel_gtt_insert_pages(u_int first_entry, u_int num_entries, vm_page_t *pages,
            pages, flags);
 }
 
-struct intel_gtt
-intel_gtt_get(void)
+const struct intel_gtt *intel_gtt_get(void)
 {
-
-       return (agp_intel_gtt_get(intel_agp));
+       intel_private.base = agp_intel_gtt_get(intel_agp);
+       return &intel_private.base;
 }
 
 int
index e1a6ae9..82ca718 100644 (file)
@@ -83,7 +83,8 @@ void agp_intel_gtt_insert_sg_entries(device_t dev, struct sglist *sg_list,
 void agp_intel_gtt_insert_pages(device_t dev, u_int first_entry,
     u_int num_entries, vm_page_t *pages, u_int flags);
 
-struct intel_gtt intel_gtt_get(void);
+const struct intel_gtt *intel_gtt_get(void);
+
 int intel_gtt_chipset_flush(void);
 void intel_gtt_unmap_memory(struct sglist *sg_list);
 void intel_gtt_clear_range(u_int first_entry, u_int num_entries);
index c593c75..2919e8c 100644 (file)
@@ -926,9 +926,9 @@ i915_load_gem_init(struct drm_device *dev)
        unsigned long prealloc_size, gtt_size, mappable_size;
        int ret;
 
-       prealloc_size = dev_priv->mm.gtt.stolen_size;
-       gtt_size = dev_priv->mm.gtt.gtt_total_entries << PAGE_SHIFT;
-       mappable_size = dev_priv->mm.gtt.gtt_mappable_entries << PAGE_SHIFT;
+       prealloc_size = dev_priv->mm.gtt->stolen_size;
+       gtt_size = dev_priv->mm.gtt->gtt_total_entries << PAGE_SHIFT;
+       mappable_size = dev_priv->mm.gtt->gtt_mappable_entries << PAGE_SHIFT;
 
        /* Basic memrange allocator for stolen space */
        drm_mm_init(&dev_priv->mm.stolen, 0, prealloc_size);
index 0e76cbc..f50277e 100644 (file)
@@ -514,6 +514,8 @@ typedef struct drm_i915_private {
        u32 savePCH_PORT_HOTPLUG;
 
        struct {
+               /** Bridge to intel-gtt-ko */
+               const struct intel_gtt *gtt;
                /** Memory allocator for GTT stolen memory */
                struct drm_mm stolen;
                /** Memory allocator for GTT */
@@ -640,7 +642,6 @@ typedef struct drm_i915_private {
                size_t object_memory;
                u32 object_count;
 
-               struct intel_gtt gtt;
                eventhandler_tag i915_lowmem;
        } mm;
 
index 3a65503..d76c03f 100644 (file)
@@ -98,7 +98,7 @@ i915_gem_init_aliasing_ppgtt(struct drm_device *dev)
                }
        }
 
-       ppgtt->scratch_page_dma_addr = dev_priv->mm.gtt.scratch_page_dma;
+       ppgtt->scratch_page_dma_addr = dev_priv->mm.gtt->scratch_page_dma;
 
        i915_ppgtt_clear_range(ppgtt, 0, ppgtt->num_pd_entries *
            I915_PPGTT_PT_ENTRIES);
@@ -236,7 +236,7 @@ do_idling(struct drm_i915_private *dev_priv)
 {
        bool ret = dev_priv->mm.interruptible;
 
-       if (dev_priv->mm.gtt.do_idle_maps) {
+       if (unlikely(dev_priv->mm.gtt->do_idle_maps)) {
                dev_priv->mm.interruptible = false;
                if (i915_gpu_idle(dev_priv->dev, false)) {
                        DRM_ERROR("Couldn't idle GPU\n");
@@ -252,7 +252,7 @@ static void
 undo_idling(struct drm_i915_private *dev_priv, bool interruptible)
 {
 
-       if (dev_priv->mm.gtt.do_idle_maps)
+       if (unlikely(dev_priv->mm.gtt->do_idle_maps))
                dev_priv->mm.interruptible = interruptible;
 }