kernel/drm: Use #ifdef __DragonFly__ to mark DragonFly specific stuff.
authorSascha Wildner <saw@online.de>
Mon, 28 Sep 2015 16:09:22 +0000 (18:09 +0200)
committerSascha Wildner <saw@online.de>
Mon, 28 Sep 2015 16:14:49 +0000 (18:14 +0200)
This is better findable across the tree than some home-rolled
"XXX begin/end" markers. Also prettier.

sys/dev/drm/drm_crtc.c
sys/dev/drm/drm_dragonfly.c
sys/dev/drm/drm_fb_helper.c
sys/dev/drm/drm_irq.c
sys/dev/drm/i915/i915_gem_gtt.c
sys/dev/drm/i915/intel_panel.c
sys/dev/drm/include/drm/drm_fb_helper.h

index 983b620..fe4ccf4 100644 (file)
@@ -4566,9 +4566,13 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
                e->event.user_data = page_flip->user_data;
                e->base.event = &e->event.base;
                e->base.file_priv = file_priv;
-               /* XXX: DragonFly-specific */
+#ifdef __DragonFly__
                e->base.destroy =
                        (void (*) (struct drm_pending_event *)) drm_kms_free;
+#else
+               e->base.destroy =
+                       (void (*) (struct drm_pending_event *)) kfree;
+#endif
        }
 
        old_fb = crtc->primary->fb;
index 1735747..1e5fe6c 100644 (file)
 #include <sys/ctype.h>
 #include <drm/drmP.h>
 
-#if 0
-commit 26a028bf8c7694e64d44f9e2bb8bd0fba47d7519
-Author: Imre Vadász <imre@vdsz.com>
-Date:   Tue Jun 2 23:14:52 2015 +0200
-
-    drm: hack together an implementation of fb_get_options
-    
-    This can be used to set the video mode used for the syscons fb console,
-    a la "video=..." in linux.
-#endif
-
 /*
  * An implementation of fb_get_options()
  * This can be used to set the video mode used for the syscons fb console,
index 39ff2e8..899c8b8 100644 (file)
@@ -991,7 +991,7 @@ int drm_fb_helper_pan_display(struct fb_var_screeninfo *var,
 EXPORT_SYMBOL(drm_fb_helper_pan_display);
 #endif
 
-/* XXX: DragonFly-specific */
+#ifdef __DragonFly__
 static void
 do_restore_fbdev_mode(void *context, int pending)
 {
@@ -1006,7 +1006,6 @@ do_restore_fbdev_mode(void *context, int pending)
        drm_modeset_unlock_all(dev);
 }
 
-/* XXX: DragonFly-specific */
 static void
 sc_restore_fbdev_mode(void *cookie)
 {
@@ -1017,6 +1016,7 @@ sc_restore_fbdev_mode(void *cookie)
 
        taskqueue_enqueue(taskqueue_thread[0], &fb_helper->fb_mode_task);
 }
+#endif
 
 /*
  * Allocates the backing storage and sets up the fbdev info structure through
@@ -1032,7 +1032,9 @@ static int drm_fb_helper_single_fb_probe(struct drm_fb_helper *fb_helper,
        struct fb_info *info;
        struct drm_fb_helper_surface_size sizes;
        int gamma_size = 0;
-       int kms_console = 1;    /* XXX: DragonFly-specific */
+#ifdef __DragonFly__
+       int kms_console = 1;
+#endif
 
        memset(&sizes, 0, sizeof(struct drm_fb_helper_surface_size));
        sizes.surface_depth = 24;
@@ -1122,8 +1124,7 @@ static int drm_fb_helper_single_fb_probe(struct drm_fb_helper *fb_helper,
                if (fb_helper->crtc_info[i].mode_set.num_connectors)
                        fb_helper->crtc_info[i].mode_set.fb = fb_helper->fb;
 
-
-       /* XXX: DragonFly-specific */
+#ifdef __DragonFly__
        TUNABLE_INT_FETCH("kern.kms_console", &kms_console);
        if (kms_console) {
                TASK_INIT(&fb_helper->fb_mode_task, 0, do_restore_fbdev_mode,
@@ -1133,6 +1134,7 @@ static int drm_fb_helper_single_fb_probe(struct drm_fb_helper *fb_helper,
                if (register_framebuffer(info) < 0)
                        return -EINVAL;
        }
+#endif
 
 #if 0
        info->var.pixclock = 0;
index 0e80e0c..d472912 100644 (file)
@@ -848,8 +848,9 @@ static void send_vblank_event(struct drm_device *dev,
        list_add_tail(&e->base.link,
                      &e->base.file_priv->event_list);
        wake_up_interruptible(&e->base.file_priv->event_wait);
-       /* XXX: DragonFly-specific */
+#ifdef __DragonFly__
        KNOTE(&e->base.file_priv->dkq.ki_note, 0);
+#endif
 #if 0
        trace_drm_vblank_event_delivered(e->base.pid, e->pipe,
                                         e->event.sequence);
@@ -1258,12 +1259,13 @@ int drm_modeset_ctl(struct drm_device *dev, void *data,
        return 0;
 }
 
-/* DragonFly-specific */
+#ifdef __DragonFly__
 static void
 drm_vblank_event_destroy(struct drm_pending_event *e)
 {
        kfree(e);
 }
+#endif
 
 static int drm_queue_vblank_event(struct drm_device *dev, int pipe,
                                  union drm_wait_vblank *vblwait,
index b824fa4..48920e9 100644 (file)
@@ -1754,13 +1754,14 @@ void i915_gem_setup_global_gtt(struct drm_device *dev,
                                     hole_end - hole_start, true);
        }
 
-       /* XXX: DragonFly-specific */
+#ifdef __DragonFly__
        intel_gtt_clear_range(start / PAGE_SIZE, (end-start) / PAGE_SIZE);
        device_printf(dev->dev,
            "taking over the fictitious range 0x%lx-0x%lx\n",
            dev_priv->gtt.mappable_base + start, dev_priv->gtt.mappable_base + start + mappable);
        error = -vm_phys_fictitious_reg_range(dev_priv->gtt.mappable_base + start,
            dev_priv->gtt.mappable_base + start + mappable, VM_MEMATTR_WRITE_COMBINING);
+#endif
 
        /* And finally clear the reserved guard page */
        ggtt_vm->clear_range(ggtt_vm, end - PAGE_SIZE, PAGE_SIZE, true);
index 45f1490..cb281fc 100644 (file)
@@ -1230,7 +1230,7 @@ static int vlv_setup_backlight(struct intel_connector *connector)
        return 0;
 }
 
-/* XXX: DragonFly-specific begin */
+#ifdef __DragonFly__
 /*
  * Read max backlight level
  */
@@ -1284,7 +1284,7 @@ sysctl_backlight_handler(SYSCTL_HANDLER_ARGS)
 
        return(err);
 }
-/* XXX: DragonFly-specific end */
+#endif /* __DragonFly__ */
 
 int intel_panel_setup_backlight(struct drm_connector *connector)
 {
@@ -1318,7 +1318,7 @@ int intel_panel_setup_backlight(struct drm_connector *connector)
 
        panel->backlight.present = true;
 
-       /* XXX: DragonFly-specific begin */
+#ifdef __DragonFly__
        SYSCTL_ADD_PROC(&connector->dev->sysctl->ctx, &sysctl__hw_children,
                        OID_AUTO, "backlight_max",
                        CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_ANYBODY,
@@ -1331,7 +1331,7 @@ int intel_panel_setup_backlight(struct drm_connector *connector)
                        connector, sizeof(int),
                        sysctl_backlight_handler,
                        "I", "Backlight level");
-       /* XXX: DragonFly-specific end */
+#endif
 
        DRM_DEBUG_KMS("backlight initialized, %s, brightness %u/%u, "
                      "sysfs interface %sregistered\n",
index 5062278..c9fa832 100644 (file)
@@ -96,8 +96,9 @@ struct drm_fb_helper {
           delay until next set_par */
        bool delayed_hotplug;
 
-       /* XXX: DragonFly-specific */
+#ifdef __DragonFly__
        struct task fb_mode_task;
+#endif
 };
 
 void drm_fb_helper_prepare(struct drm_device *dev, struct drm_fb_helper *helper,