Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/external/bsd/drm2/dist Narrow scope of exclusions in drm...



details:   https://anonhg.NetBSD.org/src/rev/5c49f83d279d
branches:  trunk
changeset: 1028348:5c49f83d279d
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sun Dec 19 10:46:43 2021 +0000

description:
Narrow scope of exclusions in drm_fb_helper.c; reduce diffs.

diffstat:

 sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_fb.c     |  17 +----
 sys/external/bsd/drm2/dist/drm/drm_fb_helper.c            |  55 ++++++++++----
 sys/external/bsd/drm2/dist/drm/i915/display/intel_fbdev.c |  15 +---
 sys/external/bsd/drm2/dist/drm/nouveau/nouveau_fbcon.c    |  16 +---
 sys/external/bsd/drm2/dist/drm/radeon/radeon_fb.c         |  16 +---
 sys/external/bsd/drm2/dist/include/drm/drm_fb_helper.h    |   6 +-
 6 files changed, 50 insertions(+), 75 deletions(-)

diffs (truncated from 415 to 300 lines):

diff -r 899866ead574 -r 5c49f83d279d sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_fb.c
--- a/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_fb.c     Sun Dec 19 10:46:35 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_fb.c     Sun Dec 19 10:46:43 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: amdgpu_fb.c,v 1.8 2021/12/18 23:44:58 riastradh Exp $  */
+/*     $NetBSD: amdgpu_fb.c,v 1.9 2021/12/19 10:46:43 riastradh Exp $  */
 
 /*
  * Copyright © 2007 David Airlie
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: amdgpu_fb.c,v 1.8 2021/12/18 23:44:58 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amdgpu_fb.c,v 1.9 2021/12/19 10:46:43 riastradh Exp $");
 
 #include <linux/module.h>
 #include <linux/pm_runtime.h>
@@ -336,21 +336,8 @@
 static int amdgpu_fbdev_destroy(struct drm_device *dev, struct amdgpu_fbdev *rfbdev)
 {
        struct amdgpu_framebuffer *rfb = &rfbdev->rfb;
-#ifdef __NetBSD__
-       int ret;
-#endif
 
-#ifdef __NetBSD__
-       /* XXX errno NetBSD->Linux */
-       ret = -config_detach(rfbdev->helper.fbdev, DETACH_FORCE);
-       if (ret) {
-               DRM_ERROR("failed to detach amdgpufb: %d\n", ret);
-               return ret;
-       }
-       rfbdev->helper.fbdev = NULL;
-#else
        drm_fb_helper_unregister_fbi(&rfbdev->helper);
-#endif
 
        if (rfb->base.obj[0]) {
                amdgpufb_destroy_pinned_object(rfb->base.obj[0]);
diff -r 899866ead574 -r 5c49f83d279d sys/external/bsd/drm2/dist/drm/drm_fb_helper.c
--- a/sys/external/bsd/drm2/dist/drm/drm_fb_helper.c    Sun Dec 19 10:46:35 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/drm_fb_helper.c    Sun Dec 19 10:46:43 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: drm_fb_helper.c,v 1.23 2021/12/19 09:52:24 riastradh Exp $     */
+/*     $NetBSD: drm_fb_helper.c,v 1.24 2021/12/19 10:46:43 riastradh Exp $     */
 
 /*
  * Copyright (c) 2006-2009 Red Hat Inc.
@@ -30,7 +30,7 @@
  *      Jesse Barnes <jesse.barnes%intel.com@localhost>
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: drm_fb_helper.c,v 1.23 2021/12/19 09:52:24 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drm_fb_helper.c,v 1.24 2021/12/19 10:46:43 riastradh Exp $");
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
@@ -54,6 +54,8 @@
 #include "drm_crtc_helper_internal.h"
 #include "drm_internal.h"
 
+#include <linux/nbsd-namespace.h>
+
 static bool drm_fbdev_emulation = true;
 module_param_named(fbdev_emulation, drm_fbdev_emulation, bool, 0600);
 MODULE_PARM_DESC(fbdev_emulation,
@@ -395,10 +397,10 @@
 #endif
 }
 
-#ifndef __NetBSD__             /* XXX fb dirty */
 static void drm_fb_helper_dirty_blit_real(struct drm_fb_helper *fb_helper,
                                          struct drm_clip_rect *clip)
 {
+#ifndef __NetBSD__             /* XXX fb dirty */
        struct drm_framebuffer *fb = fb_helper->fb;
        unsigned int cpp = fb->format->cpp[0];
        size_t offset = clip->y1 * fb->pitches[0] + clip->x1 * cpp;
@@ -412,6 +414,7 @@
                src = (char *)src + fb->pitches[0];
                dst = (char *)dst + fb->pitches[0];
        }
+#endif
 }
 
 static void drm_fb_helper_dirty_work(struct work_struct *work)
@@ -447,7 +450,6 @@
                        drm_client_buffer_vunmap(helper->buffer);
        }
 }
-#endif /* __NetBSD__ */
 
 /**
  * drm_fb_helper_prepare - setup a drm_fb_helper structure
@@ -462,19 +464,11 @@
                           const struct drm_fb_helper_funcs *funcs)
 {
        INIT_LIST_HEAD(&helper->kernel_fb_list);
-#ifndef __NetBSD__             /* XXX fb dirty */
        spin_lock_init(&helper->dirty_lock);
-#endif
        INIT_WORK(&helper->resume_work, drm_fb_helper_resume_worker);
-#ifndef __NetBSD__             /* XXX fb dirty */
        INIT_WORK(&helper->dirty_work, drm_fb_helper_dirty_work);
        helper->dirty_clip.x1 = helper->dirty_clip.y1 = ~0;
-#endif
-#ifdef __NetBSD__
-       linux_mutex_init(&helper->lock);
-#else
        mutex_init(&helper->lock);
-#endif
        helper->funcs = funcs;
        helper->dev = dev;
 }
@@ -513,8 +507,16 @@
         */
        if (!fb_helper->client.funcs) {
                ret = drm_client_init(dev, &fb_helper->client, "drm_fb_helper", NULL);
-               if (ret)
+               if (ret) {
+                       /*
+                        * XXX Undo what drm_fb_helper_prepare did
+                        * since the caller will not be going through
+                        * drm_fb_helper_fini.
+                        */
+                       mutex_destroy(&fb_helper->lock);
+                       spin_lock_destroy(&fb_helper->dirty_lock);
                        return ret;
+               }
        }
 
        dev->fb_helper = fb_helper;
@@ -523,8 +525,6 @@
 }
 EXPORT_SYMBOL(drm_fb_helper_init);
 
-#ifndef __NetBSD__             /* XXX fb info */
-
 /**
  * drm_fb_helper_alloc_fbi - allocate fb_info and some of its members
  * @fb_helper: driver-allocated fbdev helper
@@ -538,6 +538,7 @@
  * fb_info pointer if things went okay, pointer containing error code
  * otherwise
  */
+#ifndef __NetBSD__             /* XXX fb info */
 struct fb_info *drm_fb_helper_alloc_fbi(struct drm_fb_helper *fb_helper)
 {
        struct device *dev = fb_helper->dev->dev;
@@ -570,6 +571,7 @@
        return ERR_PTR(ret);
 }
 EXPORT_SYMBOL(drm_fb_helper_alloc_fbi);
+#endif
 
 /**
  * drm_fb_helper_unregister_fbi - unregister fb_info framebuffer device
@@ -581,8 +583,15 @@
  */
 void drm_fb_helper_unregister_fbi(struct drm_fb_helper *fb_helper)
 {
+#ifdef __NetBSD__
+       /* XXX errno NetBSD->Linux */
+       int ret = -config_detach(fb_helper->fbdev, DETACH_FORCE);
+       if (ret)
+               DRM_ERROR("failed to detach drm framebuffer: %d\n", ret);
+#else
        if (fb_helper && fb_helper->fbdev)
                unregister_framebuffer(fb_helper->fbdev);
+#endif
 }
 EXPORT_SYMBOL(drm_fb_helper_unregister_fbi);
 
@@ -594,7 +603,9 @@
  */
 void drm_fb_helper_fini(struct drm_fb_helper *fb_helper)
 {
+#ifndef __NetBSD__
        struct fb_info *info;
+#endif
 
        if (!fb_helper)
                return;
@@ -607,12 +618,14 @@
        cancel_work_sync(&fb_helper->resume_work);
        cancel_work_sync(&fb_helper->dirty_work);
 
+#ifndef __NetBSD__
        info = fb_helper->fbdev;
        if (info) {
                if (info->cmap.len)
                        fb_dealloc_cmap(&info->cmap);
                framebuffer_release(info);
        }
+#endif
        fb_helper->fbdev = NULL;
 
        mutex_lock(&kernel_fb_helper_lock);
@@ -624,12 +637,15 @@
        mutex_unlock(&kernel_fb_helper_lock);
 
        mutex_destroy(&fb_helper->lock);
+       spin_lock_destroy(&fb_helper->dirty_lock);
 
        if (!fb_helper->client.funcs)
                drm_client_release(&fb_helper->client);
 }
 EXPORT_SYMBOL(drm_fb_helper_fini);
 
+#ifndef __NetBSD__             /* XXX fb dirty */
+
 static bool drm_fbdev_use_shadow_fb(struct drm_fb_helper *fb_helper)
 {
        struct drm_device *dev = fb_helper->dev;
@@ -660,6 +676,8 @@
        schedule_work(&helper->dirty_work);
 }
 
+#endif
+
 #ifndef __NetBSD__             /* XXX fb deferred */
 
 /**
@@ -832,7 +850,7 @@
 #endif /* __NetBSD__ */
 
 #ifdef __NetBSD__              /* XXX fb info */
-void drm_fb_helper_set_suspend(struct drm_fb_helper *fb_helper, int state)
+void drm_fb_helper_set_suspend(struct drm_fb_helper *fb_helper, bool suspend)
 {
 }
 #else
@@ -878,6 +896,7 @@
        /* make sure there's no pending/ongoing resume */
        flush_work(&fb_helper->resume_work);
 
+#ifndef __NetBSD__             /* XXX fb suspend */
        if (suspend) {
                if (fb_helper->fbdev->state != FBINFO_STATE_RUNNING)
                        return;
@@ -896,9 +915,12 @@
 
        fb_set_suspend(fb_helper->fbdev, suspend);
        console_unlock();
+#endif
 }
 EXPORT_SYMBOL(drm_fb_helper_set_suspend_unlocked);
 
+#ifndef __NetBSD__
+
 static int setcmap_pseudo_palette(struct fb_cmap *cmap, struct fb_info *info)
 {
        u32 *palette = (u32 *)info->pseudo_palette;
@@ -1463,6 +1485,7 @@
        return ret;
 }
 EXPORT_SYMBOL(drm_fb_helper_pan_display);
+
 #endif
 
 /*
diff -r 899866ead574 -r 5c49f83d279d sys/external/bsd/drm2/dist/drm/i915/display/intel_fbdev.c
--- a/sys/external/bsd/drm2/dist/drm/i915/display/intel_fbdev.c Sun Dec 19 10:46:35 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/i915/display/intel_fbdev.c Sun Dec 19 10:46:43 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: intel_fbdev.c,v 1.2 2021/12/18 23:45:30 riastradh Exp $        */
+/*     $NetBSD: intel_fbdev.c,v 1.3 2021/12/19 10:46:43 riastradh Exp $        */
 
 /*
  * Copyright © 2007 David Airlie
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: intel_fbdev.c,v 1.2 2021/12/18 23:45:30 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intel_fbdev.c,v 1.3 2021/12/19 10:46:43 riastradh Exp $");
 
 #include <linux/async.h>
 #include <linux/console.h>
@@ -333,18 +333,7 @@
         * trying to rectify all the possible error paths leading here.
         */
 
-#ifdef __NetBSD__
-    {
-       int ret;
-       /* XXX errno NetBSD->Linux */
-       ret = -config_detach(ifbdev->helper.fbdev, DETACH_FORCE);
-       if (ret)
-               DRM_ERROR("failed to detach intelfb: %d\n", ret);
-       ifbdev->helper.fbdev = NULL;
-    }
-#else
        drm_fb_helper_fini(&ifbdev->helper);
-#endif
 
        if (ifbdev->vma)
                intel_unpin_fb_vma(ifbdev->vma, ifbdev->vma_flags);
diff -r 899866ead574 -r 5c49f83d279d sys/external/bsd/drm2/dist/drm/nouveau/nouveau_fbcon.c



Home | Main Index | Thread Index | Old Index