Module Name:    src
Committed By:   riastradh
Date:           Sun Dec 19 01:03:32 UTC 2021

Modified Files:
        src/sys/external/bsd/drm2/dist/drm: drm_fb_helper.c
        src/sys/external/bsd/drm2/dist/include/drm: drm_fb_helper.h

Log Message:
Ifdef out linux framebuffer stuff in drm_fb_helper.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/external/bsd/drm2/dist/drm/drm_fb_helper.c
cvs rdiff -u -r1.11 -r1.12 \
    src/sys/external/bsd/drm2/dist/include/drm/drm_fb_helper.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/external/bsd/drm2/dist/drm/drm_fb_helper.c
diff -u src/sys/external/bsd/drm2/dist/drm/drm_fb_helper.c:1.19 src/sys/external/bsd/drm2/dist/drm/drm_fb_helper.c:1.20
--- src/sys/external/bsd/drm2/dist/drm/drm_fb_helper.c:1.19	Sun Dec 19 01:03:22 2021
+++ src/sys/external/bsd/drm2/dist/drm/drm_fb_helper.c	Sun Dec 19 01:03:32 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: drm_fb_helper.c,v 1.19 2021/12/19 01:03:22 riastradh Exp $	*/
+/*	$NetBSD: drm_fb_helper.c,v 1.20 2021/12/19 01:03:32 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2006-2009 Red Hat Inc.
@@ -30,7 +30,7 @@
  *      Jesse Barnes <jesse.bar...@intel.com>
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: drm_fb_helper.c,v 1.19 2021/12/19 01:03:22 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drm_fb_helper.c,v 1.20 2021/12/19 01:03:32 riastradh Exp $");
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
@@ -396,29 +396,32 @@ EXPORT_SYMBOL(drm_fb_helper_blank);
 
 static void drm_fb_helper_resume_worker(struct work_struct *work)
 {
+#ifndef __NetBSD__		/* XXX fb suspend */
 	struct drm_fb_helper *helper = container_of(work, struct drm_fb_helper,
 						    resume_work);
 
 	console_lock();
 	fb_set_suspend(helper->fbdev, 0);
 	console_unlock();
+#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)
 {
 	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;
-	void *src = fb_helper->fbdev->screen_buffer + offset;
-	void *dst = fb_helper->buffer->vaddr + offset;
+	void *src = (char *)fb_helper->fbdev->screen_buffer + offset;
+	void *dst = (char *)fb_helper->buffer->vaddr + offset;
 	size_t len = (clip->x2 - clip->x1) * cpp;
 	unsigned int y;
 
 	for (y = clip->y1; y < clip->y2; y++) {
 		memcpy(dst, src, len);
-		src += fb->pitches[0];
-		dst += fb->pitches[0];
+		src = (char *)src + fb->pitches[0];
+		dst = (char *)dst + fb->pitches[0];
 	}
 }
 
@@ -455,6 +458,7 @@ static void drm_fb_helper_dirty_work(str
 			drm_client_buffer_vunmap(helper->buffer);
 	}
 }
+#endif	/* __NetBSD__ */
 
 /**
  * drm_fb_helper_prepare - setup a drm_fb_helper structure
@@ -469,11 +473,19 @@ void drm_fb_helper_prepare(struct drm_de
 			   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;
 }
@@ -659,6 +671,8 @@ static void drm_fb_helper_dirty(struct f
 	schedule_work(&helper->dirty_work);
 }
 
+#ifndef __NetBSD__		/* XXX fb deferred */
+
 /**
  * drm_fb_helper_deferred_io() - fbdev deferred_io callback function
  * @info: fb_info struct pointer
@@ -826,6 +840,7 @@ void drm_fb_helper_cfb_imageblit(struct 
 			    image->width, image->height);
 }
 EXPORT_SYMBOL(drm_fb_helper_cfb_imageblit);
+#endif	/* __NetBSD__ */
 
 #ifdef __NetBSD__		/* XXX fb info */
 void drm_fb_helper_set_suspend(struct drm_fb_helper *fb_helper, int state)
@@ -1340,9 +1355,7 @@ int drm_fb_helper_check_var(struct fb_va
 	return 0;
 }
 EXPORT_SYMBOL(drm_fb_helper_check_var);
-#endif
 
-#ifndef __NetBSD__		/* XXX fb info */
 /**
  * drm_fb_helper_set_par - implementation for &fb_ops.fb_set_par
  * @info: fbdev registered by the helper
@@ -1744,6 +1757,7 @@ static void drm_setup_crtcs_fb(struct dr
 	}
 	mutex_unlock(&client->modeset_mutex);
 
+#ifndef __NetBSD__		/* XXX fb info */
 	drm_connector_list_iter_begin(fb_helper->dev, &conn_iter);
 	drm_client_for_each_connector_iter(connector, &conn_iter) {
 
@@ -1777,6 +1791,7 @@ static void drm_setup_crtcs_fb(struct dr
 		 */
 		info->fbcon_rotate_hint = FB_ROTATE_UR;
 	}
+#endif
 }
 
 /* Note: Drops fb_helper->lock before returning. */
@@ -1785,7 +1800,9 @@ __drm_fb_helper_initial_config_and_unloc
 					  int bpp_sel)
 {
 	struct drm_device *dev = fb_helper->dev;
+#ifndef __NetBSD__		/* XXX fb info */
 	struct fb_info *info;
+#endif
 	unsigned int width, height;
 	int ret;
 
@@ -1830,6 +1847,7 @@ __drm_fb_helper_initial_config_and_unloc
 
 	dev_info(dev->dev, "fb%d: %s frame buffer device\n",
 		 info->node, info->fix.id);
+#endif
 
 	mutex_lock(&kernel_fb_helper_lock);
 	if (list_empty(&kernel_fb_helper_list))
@@ -1983,6 +2001,8 @@ void drm_fb_helper_output_poll_changed(s
 }
 EXPORT_SYMBOL(drm_fb_helper_output_poll_changed);
 
+#ifndef __NetBSD__		/* XXX fb info */
+
 /* @user: 1=userspace, 0=fbcon */
 static int drm_fbdev_fb_open(struct fb_info *info, int user)
 {
@@ -2070,6 +2090,7 @@ static struct fb_deferred_io drm_fbdev_d
 	.deferred_io	= drm_fb_helper_deferred_io,
 };
 
+#endif	/* __NetBSD__ */
 /*
  * This function uses the client API to create a framebuffer backed by a dumb buffer.
  *
@@ -2083,7 +2104,9 @@ static int drm_fb_helper_generic_probe(s
 	struct drm_device *dev = fb_helper->dev;
 	struct drm_client_buffer *buffer;
 	struct drm_framebuffer *fb;
+#ifndef __NetBSD__		/* XXX fb info */
 	struct fb_info *fbi;
+#endif
 	u32 format;
 	void *vaddr;
 
@@ -2101,6 +2124,9 @@ static int drm_fb_helper_generic_probe(s
 	fb_helper->fb = buffer->fb;
 	fb = buffer->fb;
 
+#ifdef __NetBSD__		/* XXX fb info */
+	__USE(fb);
+#else
 	fbi = drm_fb_helper_alloc_fbi(fb_helper);
 	if (IS_ERR(fbi))
 		return PTR_ERR(fbi);
@@ -2133,6 +2159,7 @@ static int drm_fb_helper_generic_probe(s
 				page_to_phys(virt_to_page(fbi->screen_buffer));
 #endif
 	}
+#endif	/* __NetBSD__ */
 
 	return 0;
 }
@@ -2146,8 +2173,12 @@ static void drm_fbdev_client_unregister(
 	struct drm_fb_helper *fb_helper = drm_fb_helper_from_client(client);
 
 	if (fb_helper->fbdev)
+#ifndef __NetBSD__		/* XXX fb info */
+	{
 		/* drm_fbdev_fb_destroy() takes care of cleanup */
 		drm_fb_helper_unregister_fbi(fb_helper);
+	}
+#endif
 	else
 		drm_fbdev_release(fb_helper);
 }

Index: src/sys/external/bsd/drm2/dist/include/drm/drm_fb_helper.h
diff -u src/sys/external/bsd/drm2/dist/include/drm/drm_fb_helper.h:1.11 src/sys/external/bsd/drm2/dist/include/drm/drm_fb_helper.h:1.12
--- src/sys/external/bsd/drm2/dist/include/drm/drm_fb_helper.h:1.11	Sun Dec 19 01:02:34 2021
+++ src/sys/external/bsd/drm2/dist/include/drm/drm_fb_helper.h	Sun Dec 19 01:03:32 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: drm_fb_helper.h,v 1.11 2021/12/19 01:02:34 riastradh Exp $	*/
+/*	$NetBSD: drm_fb_helper.h,v 1.12 2021/12/19 01:03:32 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2006-2009 Red Hat Inc.
@@ -142,9 +142,11 @@ struct drm_fb_helper {
 	struct fb_info *fbdev;
 #endif
 	u32 pseudo_palette[17];
+#ifndef __NetBSD__		/* XXX fb dirty */
 	struct drm_clip_rect dirty_clip;
 	spinlock_t dirty_lock;
 	struct work_struct dirty_work;
+#endif
 	struct work_struct resume_work;
 
 	/**

Reply via email to