Mon Aug 27 06:16:50 2018 UTC ()
merge in old drm

better match linux del_timer_sync by returning something
(XXX return value?)

Author: coypu <coypu@sdf.org>
Committer: Taylor R Campbell <riastradh@NetBSD.org>


(riastradh)
diff -r1.9 -r1.10 src/sys/external/bsd/drm2/dist/drm/i915/intel_opregion.c
diff -r1.9 -r1.10 src/sys/external/bsd/drm2/dist/drm/i915/intel_sdvo.c
diff -r1.7 -r1.8 src/sys/external/bsd/drm2/dist/drm/i915/intel_panel.c
diff -r1.3 -r1.4 src/sys/external/bsd/drm2/dist/drm/i915/intel_sprite.c
diff -r1.3 -r1.4 src/sys/external/bsd/drm2/include/linux/time.h
diff -r1.5 -r1.6 src/sys/external/bsd/drm2/include/linux/timer.h

cvs diff -r1.9 -r1.10 src/sys/external/bsd/drm2/dist/drm/i915/Attic/intel_opregion.c (expand / switch to unified diff)

--- src/sys/external/bsd/drm2/dist/drm/i915/Attic/intel_opregion.c 2018/08/27 04:58:24 1.9
+++ src/sys/external/bsd/drm2/dist/drm/i915/Attic/intel_opregion.c 2018/08/27 06:16:50 1.10
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: intel_opregion.c,v 1.9 2018/08/27 04:58:24 riastradh Exp $ */ 1/* $NetBSD: intel_opregion.c,v 1.10 2018/08/27 06:16:50 riastradh Exp $ */
2 2
3/* 3/*
4 * Copyright 2008 Intel Corporation <hong.liu@intel.com> 4 * Copyright 2008 Intel Corporation <hong.liu@intel.com>
5 * Copyright 2008 Red Hat <mjg@redhat.com> 5 * Copyright 2008 Red Hat <mjg@redhat.com>
6 * 6 *
7 * Permission is hereby granted, free of charge, to any person obtaining 7 * Permission is hereby granted, free of charge, to any person obtaining
8 * a copy of this software and associated documentation files (the 8 * a copy of this software and associated documentation files (the
9 * "Software"), to deal in the Software without restriction, including 9 * "Software"), to deal in the Software without restriction, including
10 * without limitation the rights to use, copy, modify, merge, publish, 10 * without limitation the rights to use, copy, modify, merge, publish,
11 * distribute, sub license, and/or sell copies of the Software, and to 11 * distribute, sub license, and/or sell copies of the Software, and to
12 * permit persons to whom the Software is furnished to do so, subject to 12 * permit persons to whom the Software is furnished to do so, subject to
13 * the following conditions: 13 * the following conditions:
14 * 14 *
@@ -18,27 +18,27 @@ @@ -18,27 +18,27 @@
18 * 18 *
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
22 * NON-INFRINGEMENT. IN NO EVENT SHALL INTEL AND/OR ITS SUPPLIERS BE 22 * NON-INFRINGEMENT. IN NO EVENT SHALL INTEL AND/OR ITS SUPPLIERS BE
23 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 23 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
24 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 24 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
25 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26 * SOFTWARE. 26 * SOFTWARE.
27 * 27 *
28 */ 28 */
29 29
30#include <sys/cdefs.h> 30#include <sys/cdefs.h>
31__KERNEL_RCSID(0, "$NetBSD: intel_opregion.c,v 1.9 2018/08/27 04:58:24 riastradh Exp $"); 31__KERNEL_RCSID(0, "$NetBSD: intel_opregion.c,v 1.10 2018/08/27 06:16:50 riastradh Exp $");
32 32
33#include <linux/printk.h> 33#include <linux/printk.h>
34#include <linux/acpi.h> 34#include <linux/acpi.h>
35#include <acpi/video.h> 35#include <acpi/video.h>
36#include <asm/io.h> 36#include <asm/io.h>
37 37
38#include <drm/drmP.h> 38#include <drm/drmP.h>
39#include <drm/i915_drm.h> 39#include <drm/i915_drm.h>
40#include "i915_drv.h" 40#include "i915_drv.h"
41#include "intel_drv.h" 41#include "intel_drv.h"
42 42
43#ifdef CONFIG_ACPI 43#ifdef CONFIG_ACPI
44 44
@@ -436,30 +436,32 @@ int intel_opregion_notify_adapter(struct @@ -436,30 +436,32 @@ int intel_opregion_notify_adapter(struct
436 } 436 }
437 437
438 return -EINVAL; 438 return -EINVAL;
439} 439}
440 440
441static u32 asle_set_backlight(struct drm_device *dev, u32 bclp) 441static u32 asle_set_backlight(struct drm_device *dev, u32 bclp)
442{ 442{
443 struct drm_i915_private *dev_priv = dev->dev_private; 443 struct drm_i915_private *dev_priv = dev->dev_private;
444 struct intel_connector *intel_connector; 444 struct intel_connector *intel_connector;
445 struct opregion_asle *asle = dev_priv->opregion.asle; 445 struct opregion_asle *asle = dev_priv->opregion.asle;
446 446
447 DRM_DEBUG_DRIVER("bclp = 0x%08x\n", bclp); 447 DRM_DEBUG_DRIVER("bclp = 0x%08x\n", bclp);
448 448
 449#ifndef __NetBSD__ /* XXX backlight */
449 if (acpi_video_get_backlight_type() == acpi_backlight_native) { 450 if (acpi_video_get_backlight_type() == acpi_backlight_native) {
450 DRM_DEBUG_KMS("opregion backlight request ignored\n"); 451 DRM_DEBUG_KMS("opregion backlight request ignored\n");
451 return 0; 452 return 0;
452 } 453 }
 454#endif
453 455
454 if (!(bclp & ASLE_BCLP_VALID)) 456 if (!(bclp & ASLE_BCLP_VALID))
455 return ASLC_BACKLIGHT_FAILED; 457 return ASLC_BACKLIGHT_FAILED;
456 458
457 bclp &= ASLE_BCLP_MSK; 459 bclp &= ASLE_BCLP_MSK;
458 if (bclp > 255) 460 if (bclp > 255)
459 return ASLC_BACKLIGHT_FAILED; 461 return ASLC_BACKLIGHT_FAILED;
460 462
461 drm_modeset_lock(&dev->mode_config.connection_mutex, NULL); 463 drm_modeset_lock(&dev->mode_config.connection_mutex, NULL);
462 464
463 /* 465 /*
464 * Update backlight on all connectors that support backlight (usually 466 * Update backlight on all connectors that support backlight (usually
465 * only one). 467 * only one).
@@ -654,26 +656,27 @@ static int intel_opregion_video_event(st @@ -654,26 +656,27 @@ static int intel_opregion_video_event(st
654 656
655 if (!system_opregion) 657 if (!system_opregion)
656 return NOTIFY_DONE; 658 return NOTIFY_DONE;
657 659
658 acpi = system_opregion->acpi; 660 acpi = system_opregion->acpi;
659 661
660 if (event->type == 0x80 && ((acpi->cevt & 1) == 0)) 662 if (event->type == 0x80 && ((acpi->cevt & 1) == 0))
661 ret = NOTIFY_BAD; 663 ret = NOTIFY_BAD;
662 664
663 acpi->csts = 0; 665 acpi->csts = 0;
664 666
665 return ret; 667 return ret;
666} 668}
 669#endif
667 670
668static struct notifier_block intel_opregion_notifier = { 671static struct notifier_block intel_opregion_notifier = {
669 .notifier_call = intel_opregion_video_event, 672 .notifier_call = intel_opregion_video_event,
670}; 673};
671#endif /* __NetBSD__ */ 674#endif /* __NetBSD__ */
672 675
673/* 676/*
674 * Initialise the DIDL field in opregion. This passes a list of devices to 677 * Initialise the DIDL field in opregion. This passes a list of devices to
675 * the firmware. Values are defined by section B.4.2 of the ACPI specification 678 * the firmware. Values are defined by section B.4.2 of the ACPI specification
676 * (version 3) 679 * (version 3)
677 */ 680 */
678 681
679static u32 get_did(struct intel_opregion *opregion, int i) 682static u32 get_did(struct intel_opregion *opregion, int i)
@@ -997,28 +1000,31 @@ int intel_opregion_setup(struct drm_devi @@ -997,28 +1000,31 @@ int intel_opregion_setup(struct drm_devi
997 BUILD_BUG_ON(sizeof(struct opregion_swsci) != 0x100); 1000 BUILD_BUG_ON(sizeof(struct opregion_swsci) != 0x100);
998 BUILD_BUG_ON(sizeof(struct opregion_asle) != 0x100); 1001 BUILD_BUG_ON(sizeof(struct opregion_asle) != 0x100);
999 1002
1000 pci_read_config_dword(dev->pdev, PCI_ASLS, &asls); 1003 pci_read_config_dword(dev->pdev, PCI_ASLS, &asls);
1001 DRM_DEBUG_DRIVER("graphic opregion physical addr: 0x%x\n", asls); 1004 DRM_DEBUG_DRIVER("graphic opregion physical addr: 0x%x\n", asls);
1002 if (asls == 0) { 1005 if (asls == 0) {
1003 DRM_DEBUG_DRIVER("ACPI OpRegion not supported!\n"); 1006 DRM_DEBUG_DRIVER("ACPI OpRegion not supported!\n");
1004 return -ENOTSUPP; 1007 return -ENOTSUPP;
1005 } 1008 }
1006 1009
1007#ifdef CONFIG_ACPI 1010#ifdef CONFIG_ACPI
1008 INIT_WORK(&opregion->asle_work, asle_work); 1011 INIT_WORK(&opregion->asle_work, asle_work);
1009#endif 1012#endif
1010 1013#ifdef __NetBSD__
 1014 base = acpi_os_ioremap(asls, OPREGION_SIZE);
 1015#else
1011 base = memremap(asls, OPREGION_SIZE, MEMREMAP_WB); 1016 base = memremap(asls, OPREGION_SIZE, MEMREMAP_WB);
 1017#endif
1012 if (!base) 1018 if (!base)
1013 return -ENOMEM; 1019 return -ENOMEM;
1014 1020
1015 memcpy(buf, base, sizeof(buf)); 1021 memcpy(buf, base, sizeof(buf));
1016 1022
1017 if (memcmp(buf, OPREGION_SIGNATURE, 16)) { 1023 if (memcmp(buf, OPREGION_SIGNATURE, 16)) {
1018 DRM_DEBUG_DRIVER("opregion signature mismatch\n"); 1024 DRM_DEBUG_DRIVER("opregion signature mismatch\n");
1019 err = -EINVAL; 1025 err = -EINVAL;
1020 goto err_out; 1026 goto err_out;
1021 } 1027 }
1022 opregion->header = base; 1028 opregion->header = base;
1023 opregion->vbt = (char *)base + OPREGION_VBT_OFFSET; 1029 opregion->vbt = (char *)base + OPREGION_VBT_OFFSET;
1024 1030

cvs diff -r1.9 -r1.10 src/sys/external/bsd/drm2/dist/drm/i915/Attic/intel_sdvo.c (expand / switch to unified diff)

--- src/sys/external/bsd/drm2/dist/drm/i915/Attic/intel_sdvo.c 2018/08/27 04:58:24 1.9
+++ src/sys/external/bsd/drm2/dist/drm/i915/Attic/intel_sdvo.c 2018/08/27 06:16:50 1.10
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: intel_sdvo.c,v 1.9 2018/08/27 04:58:24 riastradh Exp $ */ 1/* $NetBSD: intel_sdvo.c,v 1.10 2018/08/27 06:16:50 riastradh Exp $ */
2 2
3/* 3/*
4 * Copyright 2006 Dave Airlie <airlied@linux.ie> 4 * Copyright 2006 Dave Airlie <airlied@linux.ie>
5 * Copyright © 2006-2007 Intel Corporation 5 * Copyright © 2006-2007 Intel Corporation
6 * Jesse Barnes <jesse.barnes@intel.com> 6 * Jesse Barnes <jesse.barnes@intel.com>
7 * 7 *
8 * Permission is hereby granted, free of charge, to any person obtaining a 8 * Permission is hereby granted, free of charge, to any person obtaining a
9 * copy of this software and associated documentation files (the "Software"), 9 * copy of this software and associated documentation files (the "Software"),
10 * to deal in the Software without restriction, including without limitation 10 * to deal in the Software without restriction, including without limitation
11 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 11 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
12 * and/or sell copies of the Software, and to permit persons to whom the 12 * and/or sell copies of the Software, and to permit persons to whom the
13 * Software is furnished to do so, subject to the following conditions: 13 * Software is furnished to do so, subject to the following conditions:
14 * 14 *
@@ -18,31 +18,32 @@ @@ -18,31 +18,32 @@
18 * 18 *
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25 * DEALINGS IN THE SOFTWARE. 25 * DEALINGS IN THE SOFTWARE.
26 * 26 *
27 * Authors: 27 * Authors:
28 * Eric Anholt <eric@anholt.net> 28 * Eric Anholt <eric@anholt.net>
29 */ 29 */
30#include <sys/cdefs.h> 30#include <sys/cdefs.h>
31__KERNEL_RCSID(0, "$NetBSD: intel_sdvo.c,v 1.9 2018/08/27 04:58:24 riastradh Exp $"); 31__KERNEL_RCSID(0, "$NetBSD: intel_sdvo.c,v 1.10 2018/08/27 06:16:50 riastradh Exp $");
32 32
33#include <linux/i2c.h> 33#include <linux/i2c.h>
34#include <linux/slab.h> 34#include <linux/slab.h>
35#include <linux/delay.h> 35#include <linux/delay.h>
 36#include <linux/module.h>
36#include <linux/export.h> 37#include <linux/export.h>
37#include <linux/bitops.h> 38#include <linux/bitops.h>
38#include <linux/module.h> 39#include <linux/module.h>
39#include <drm/drmP.h> 40#include <drm/drmP.h>
40#include <drm/drm_atomic_helper.h> 41#include <drm/drm_atomic_helper.h>
41#include <drm/drm_crtc.h> 42#include <drm/drm_crtc.h>
42#include <drm/drm_edid.h> 43#include <drm/drm_edid.h>
43#include "intel_drv.h" 44#include "intel_drv.h"
44#include <drm/i915_drm.h> 45#include <drm/i915_drm.h>
45#include "i915_drv.h" 46#include "i915_drv.h"
46#include "intel_sdvo_regs.h" 47#include "intel_sdvo_regs.h"
47 48
48#define SDVO_TMDS_MASK (SDVO_OUTPUT_TMDS0 | SDVO_OUTPUT_TMDS1) 49#define SDVO_TMDS_MASK (SDVO_OUTPUT_TMDS0 | SDVO_OUTPUT_TMDS1)

cvs diff -r1.7 -r1.8 src/sys/external/bsd/drm2/dist/drm/i915/Attic/intel_panel.c (expand / switch to unified diff)

--- src/sys/external/bsd/drm2/dist/drm/i915/Attic/intel_panel.c 2018/08/27 04:58:24 1.7
+++ src/sys/external/bsd/drm2/dist/drm/i915/Attic/intel_panel.c 2018/08/27 06:16:50 1.8
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: intel_panel.c,v 1.7 2018/08/27 04:58:24 riastradh Exp $ */ 1/* $NetBSD: intel_panel.c,v 1.8 2018/08/27 06:16:50 riastradh Exp $ */
2 2
3/* 3/*
4 * Copyright © 2006-2010 Intel Corporation 4 * Copyright © 2006-2010 Intel Corporation
5 * Copyright (c) 2006 Dave Airlie <airlied@linux.ie> 5 * Copyright (c) 2006 Dave Airlie <airlied@linux.ie>
6 * 6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a 7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"), 8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation 9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the 11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions: 12 * Software is furnished to do so, subject to the following conditions:
13 * 13 *
14 * The above copyright notice and this permission notice (including the next 14 * The above copyright notice and this permission notice (including the next
@@ -21,27 +21,27 @@ @@ -21,27 +21,27 @@
21 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 23 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
24 * DEALINGS IN THE SOFTWARE. 24 * DEALINGS IN THE SOFTWARE.
25 * 25 *
26 * Authors: 26 * Authors:
27 * Eric Anholt <eric@anholt.net> 27 * Eric Anholt <eric@anholt.net>
28 * Dave Airlie <airlied@linux.ie> 28 * Dave Airlie <airlied@linux.ie>
29 * Jesse Barnes <jesse.barnes@intel.com> 29 * Jesse Barnes <jesse.barnes@intel.com>
30 * Chris Wilson <chris@chris-wilson.co.uk> 30 * Chris Wilson <chris@chris-wilson.co.uk>
31 */ 31 */
32 32
33#include <sys/cdefs.h> 33#include <sys/cdefs.h>
34__KERNEL_RCSID(0, "$NetBSD: intel_panel.c,v 1.7 2018/08/27 04:58:24 riastradh Exp $"); 34__KERNEL_RCSID(0, "$NetBSD: intel_panel.c,v 1.8 2018/08/27 06:16:50 riastradh Exp $");
35 35
36#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 36#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
37 37
38#include <linux/kernel.h> 38#include <linux/kernel.h>
39#include <linux/moduleparam.h> 39#include <linux/moduleparam.h>
40#include <linux/module.h> 40#include <linux/module.h>
41#include <linux/printk.h> 41#include <linux/printk.h>
42#include <asm/div64.h> 42#include <asm/div64.h>
43#include <linux/pwm.h> 43#include <linux/pwm.h>
44#include "intel_drv.h" 44#include "intel_drv.h"
45 45
46#define CRC_PMIC_PWM_PERIOD_NS 21333 46#define CRC_PMIC_PWM_PERIOD_NS 21333
47 47
@@ -852,28 +852,30 @@ void intel_panel_disable_backlight(struc @@ -852,28 +852,30 @@ void intel_panel_disable_backlight(struc
852 /* 852 /*
853 * Do not disable backlight on the vga_switcheroo path. When switching 853 * Do not disable backlight on the vga_switcheroo path. When switching
854 * away from i915, the other client may depend on i915 to handle the 854 * away from i915, the other client may depend on i915 to handle the
855 * backlight. This will leave the backlight on unnecessarily when 855 * backlight. This will leave the backlight on unnecessarily when
856 * another client is not activated. 856 * another client is not activated.
857 */ 857 */
858 if (dev->switch_power_state == DRM_SWITCH_POWER_CHANGING) { 858 if (dev->switch_power_state == DRM_SWITCH_POWER_CHANGING) {
859 DRM_DEBUG_DRIVER("Skipping backlight disable on vga switch\n"); 859 DRM_DEBUG_DRIVER("Skipping backlight disable on vga switch\n");
860 return; 860 return;
861 } 861 }
862 862
863 mutex_lock(&dev_priv->backlight_lock); 863 mutex_lock(&dev_priv->backlight_lock);
864 864
 865#ifndef __NetBSD__ /* XXX backlight */
865 if (panel->backlight.device) 866 if (panel->backlight.device)
866 panel->backlight.device->props.power = FB_BLANK_POWERDOWN; 867 panel->backlight.device->props.power = FB_BLANK_POWERDOWN;
 868#endif
867 panel->backlight.enabled = false; 869 panel->backlight.enabled = false;
868 panel->backlight.disable(connector); 870 panel->backlight.disable(connector);
869 871
870 mutex_unlock(&dev_priv->backlight_lock); 872 mutex_unlock(&dev_priv->backlight_lock);
871} 873}
872 874
873static void lpt_enable_backlight(struct intel_connector *connector) 875static void lpt_enable_backlight(struct intel_connector *connector)
874{ 876{
875 struct drm_device *dev = connector->base.dev; 877 struct drm_device *dev = connector->base.dev;
876 struct drm_i915_private *dev_priv = dev->dev_private; 878 struct drm_i915_private *dev_priv = dev->dev_private;
877 struct intel_panel *panel = &connector->panel; 879 struct intel_panel *panel = &connector->panel;
878 u32 pch_ctl1, pch_ctl2; 880 u32 pch_ctl1, pch_ctl2;
879 881
@@ -1131,28 +1133,30 @@ void intel_panel_enable_backlight(struct @@ -1131,28 +1133,30 @@ void intel_panel_enable_backlight(struct
1131 if (panel->backlight.level <= panel->backlight.min) { 1133 if (panel->backlight.level <= panel->backlight.min) {
1132 panel->backlight.level = panel->backlight.max; 1134 panel->backlight.level = panel->backlight.max;
1133#ifndef __NetBSD__ /* XXX backlight */ 1135#ifndef __NetBSD__ /* XXX backlight */
1134 if (panel->backlight.device) 1136 if (panel->backlight.device)
1135 panel->backlight.device->props.brightness = 1137 panel->backlight.device->props.brightness =
1136 scale_hw_to_user(connector, 1138 scale_hw_to_user(connector,
1137 panel->backlight.level, 1139 panel->backlight.level,
1138 panel->backlight.device->props.max_brightness); 1140 panel->backlight.device->props.max_brightness);
1139#endif 1141#endif
1140 } 1142 }
1141 1143
1142 panel->backlight.enable(connector); 1144 panel->backlight.enable(connector);
1143 panel->backlight.enabled = true; 1145 panel->backlight.enabled = true;
 1146#ifndef __NetBSD__ /* XXX backlight */
1144 if (panel->backlight.device) 1147 if (panel->backlight.device)
1145 panel->backlight.device->props.power = FB_BLANK_UNBLANK; 1148 panel->backlight.device->props.power = FB_BLANK_UNBLANK;
 1149#endif
1146 1150
1147 mutex_unlock(&dev_priv->backlight_lock); 1151 mutex_unlock(&dev_priv->backlight_lock);
1148} 1152}
1149 1153
1150#if IS_ENABLED(CONFIG_BACKLIGHT_CLASS_DEVICE) 1154#if IS_ENABLED(CONFIG_BACKLIGHT_CLASS_DEVICE)
1151static int intel_backlight_device_update_status(struct backlight_device *bd) 1155static int intel_backlight_device_update_status(struct backlight_device *bd)
1152{ 1156{
1153 struct intel_connector *connector = bl_get_data(bd); 1157 struct intel_connector *connector = bl_get_data(bd);
1154 struct intel_panel *panel = &connector->panel; 1158 struct intel_panel *panel = &connector->panel;
1155 struct drm_device *dev = connector->base.dev; 1159 struct drm_device *dev = connector->base.dev;
1156 1160
1157 drm_modeset_lock(&dev->mode_config.connection_mutex, NULL); 1161 drm_modeset_lock(&dev->mode_config.connection_mutex, NULL);
1158 DRM_DEBUG_KMS("updating intel_backlight, brightness=%d/%d\n", 1162 DRM_DEBUG_KMS("updating intel_backlight, brightness=%d/%d\n",

cvs diff -r1.3 -r1.4 src/sys/external/bsd/drm2/dist/drm/i915/Attic/intel_sprite.c (expand / switch to unified diff)

--- src/sys/external/bsd/drm2/dist/drm/i915/Attic/intel_sprite.c 2018/08/27 04:58:24 1.3
+++ src/sys/external/bsd/drm2/dist/drm/i915/Attic/intel_sprite.c 2018/08/27 06:16:50 1.4
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: intel_sprite.c,v 1.3 2018/08/27 04:58:24 riastradh Exp $ */ 1/* $NetBSD: intel_sprite.c,v 1.4 2018/08/27 06:16:50 riastradh Exp $ */
2 2
3/* 3/*
4 * Copyright © 2011 Intel Corporation 4 * Copyright © 2011 Intel Corporation
5 * 5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a 6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"), 7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation 8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the 10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions: 11 * Software is furnished to do so, subject to the following conditions:
12 * 12 *
13 * The above copyright notice and this permission notice (including the next 13 * The above copyright notice and this permission notice (including the next
14 * paragraph) shall be included in all copies or substantial portions of the 14 * paragraph) shall be included in all copies or substantial portions of the
@@ -22,27 +22,27 @@ @@ -22,27 +22,27 @@
22 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 * SOFTWARE. 23 * SOFTWARE.
24 * 24 *
25 * Authors: 25 * Authors:
26 * Jesse Barnes <jbarnes@virtuousgeek.org> 26 * Jesse Barnes <jbarnes@virtuousgeek.org>
27 * 27 *
28 * New plane/sprite handling. 28 * New plane/sprite handling.
29 * 29 *
30 * The older chips had a separate interface for programming plane related 30 * The older chips had a separate interface for programming plane related
31 * registers; newer ones are much simpler and we can use the new DRM plane 31 * registers; newer ones are much simpler and we can use the new DRM plane
32 * support. 32 * support.
33 */ 33 */
34#include <sys/cdefs.h> 34#include <sys/cdefs.h>
35__KERNEL_RCSID(0, "$NetBSD: intel_sprite.c,v 1.3 2018/08/27 04:58:24 riastradh Exp $"); 35__KERNEL_RCSID(0, "$NetBSD: intel_sprite.c,v 1.4 2018/08/27 06:16:50 riastradh Exp $");
36 36
37#include <drm/drmP.h> 37#include <drm/drmP.h>
38#include <drm/drm_crtc.h> 38#include <drm/drm_crtc.h>
39#include <drm/drm_fourcc.h> 39#include <drm/drm_fourcc.h>
40#include <drm/drm_rect.h> 40#include <drm/drm_rect.h>
41#include <drm/drm_atomic.h> 41#include <drm/drm_atomic.h>
42#include <drm/drm_plane_helper.h> 42#include <drm/drm_plane_helper.h>
43#include "intel_drv.h" 43#include "intel_drv.h"
44#include <drm/i915_drm.h> 44#include <drm/i915_drm.h>
45#include "i915_drv.h" 45#include "i915_drv.h"
46 46
47static bool 47static bool
48format_is_yuv(uint32_t format) 48format_is_yuv(uint32_t format)
@@ -80,75 +80,83 @@ static int usecs_to_scanlines(const stru @@ -80,75 +80,83 @@ static int usecs_to_scanlines(const stru
80 * 80 *
81 * After a successful call to this function, interrupts will be disabled 81 * After a successful call to this function, interrupts will be disabled
82 * until a subsequent call to intel_pipe_update_end(). That is done to 82 * until a subsequent call to intel_pipe_update_end(). That is done to
83 * avoid random delays. The value written to @start_vbl_count should be 83 * avoid random delays. The value written to @start_vbl_count should be
84 * supplied to intel_pipe_update_end() for error checking. 84 * supplied to intel_pipe_update_end() for error checking.
85 */ 85 */
86void intel_pipe_update_start(struct intel_crtc *crtc) 86void intel_pipe_update_start(struct intel_crtc *crtc)
87{ 87{
88 struct drm_device *dev = crtc->base.dev; 88 struct drm_device *dev = crtc->base.dev;
89 const struct drm_display_mode *adjusted_mode = &crtc->config->base.adjusted_mode; 89 const struct drm_display_mode *adjusted_mode = &crtc->config->base.adjusted_mode;
90 enum pipe pipe = crtc->pipe; 90 enum pipe pipe = crtc->pipe;
91 long timeout = msecs_to_jiffies_timeout(1); 91 long timeout = msecs_to_jiffies_timeout(1);
92 int scanline, min, max, vblank_start; 92 int scanline, min, max, vblank_start;
 93#ifdef __NetBSD__
 94 drm_waitqueue_t *wq = drm_crtc_vblank_waitqueue(&crtc->base);
 95#else
93 wait_queue_head_t *wq = drm_crtc_vblank_waitqueue(&crtc->base); 96 wait_queue_head_t *wq = drm_crtc_vblank_waitqueue(&crtc->base);
94 DEFINE_WAIT(wait); 97 DEFINE_WAIT(wait);
 98#endif
95 99
96 vblank_start = adjusted_mode->crtc_vblank_start; 100 vblank_start = adjusted_mode->crtc_vblank_start;
97 if (adjusted_mode->flags & DRM_MODE_FLAG_INTERLACE) 101 if (adjusted_mode->flags & DRM_MODE_FLAG_INTERLACE)
98 vblank_start = DIV_ROUND_UP(vblank_start, 2); 102 vblank_start = DIV_ROUND_UP(vblank_start, 2);
99 103
100 /* FIXME needs to be calibrated sensibly */ 104 /* FIXME needs to be calibrated sensibly */
101 min = vblank_start - usecs_to_scanlines(adjusted_mode, 100); 105 min = vblank_start - usecs_to_scanlines(adjusted_mode, 100);
102 max = vblank_start - 1; 106 max = vblank_start - 1;
103 107
104 local_irq_disable(); 108 local_irq_disable();
105 109
106 if (min <= 0 || max <= 0) 110 if (min <= 0 || max <= 0)
107 return; 111 return;
108 112
109 if (WARN_ON(drm_crtc_vblank_get(&crtc->base))) 113 if (WARN_ON(drm_crtc_vblank_get(&crtc->base)))
110 return; 114 return;
111 115
112 crtc->debug.min_vbl = min; 116 crtc->debug.min_vbl = min;
113 crtc->debug.max_vbl = max; 117 crtc->debug.max_vbl = max;
114 trace_i915_pipe_update_start(crtc); 118 trace_i915_pipe_update_start(crtc);
115 119
 120#ifdef __NetBSD__
 121 panic("XXX");
 122#else
116 for (;;) { 123 for (;;) {
117 /* 124 /*
118 * prepare_to_wait() has a memory barrier, which guarantees 125 * prepare_to_wait() has a memory barrier, which guarantees
119 * other CPUs can see the task state update by the time we 126 * other CPUs can see the task state update by the time we
120 * read the scanline. 127 * read the scanline.
121 */ 128 */
122 prepare_to_wait(wq, &wait, TASK_UNINTERRUPTIBLE); 129 prepare_to_wait(wq, &wait, TASK_UNINTERRUPTIBLE);
123 130
124 scanline = intel_get_crtc_scanline(crtc); 131 scanline = intel_get_crtc_scanline(crtc);
125 if (scanline < min || scanline > max) 132 if (scanline < min || scanline > max)
126 break; 133 break;
127 134
128 if (timeout <= 0) { 135 if (timeout <= 0) {
129 DRM_ERROR("Potential atomic update failure on pipe %c\n", 136 DRM_ERROR("Potential atomic update failure on pipe %c\n",
130 pipe_name(crtc->pipe)); 137 pipe_name(crtc->pipe));
131 break; 138 break;
132 } 139 }
133 140
134 local_irq_enable(); 141 local_irq_enable();
135 142
136 timeout = schedule_timeout(timeout); 143 timeout = schedule_timeout(timeout);
137 144
138 local_irq_disable(); 145 local_irq_disable();
139 } 146 }
140 147
141 finish_wait(wq, &wait); 148 finish_wait(wq, &wait);
 149#endif
142 150
143 drm_crtc_vblank_put(&crtc->base); 151 drm_crtc_vblank_put(&crtc->base);
144 152
145 crtc->debug.scanline_start = scanline; 153 crtc->debug.scanline_start = scanline;
146 crtc->debug.start_vbl_time = ktime_get(); 154 crtc->debug.start_vbl_time = ktime_get();
147 crtc->debug.start_vbl_count = 155 crtc->debug.start_vbl_count =
148 dev->driver->get_vblank_counter(dev, pipe); 156 dev->driver->get_vblank_counter(dev, pipe);
149 157
150 trace_i915_pipe_update_vblank_evaded(crtc); 158 trace_i915_pipe_update_vblank_evaded(crtc);
151} 159}
152 160
153/** 161/**
154 * intel_pipe_update_end() - end update of a set of display registers 162 * intel_pipe_update_end() - end update of a set of display registers

cvs diff -r1.3 -r1.4 src/sys/external/bsd/drm2/include/linux/time.h (expand / switch to unified diff)

--- src/sys/external/bsd/drm2/include/linux/time.h 2014/07/16 20:56:25 1.3
+++ src/sys/external/bsd/drm2/include/linux/time.h 2018/08/27 06:16:50 1.4
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: time.h,v 1.3 2014/07/16 20:56:25 riastradh Exp $ */ 1/* $NetBSD: time.h,v 1.4 2018/08/27 06:16:50 riastradh Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2013 The NetBSD Foundation, Inc. 4 * Copyright (c) 2013 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Taylor R. Campbell. 8 * by Taylor R. Campbell.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -24,26 +24,28 @@ @@ -24,26 +24,28 @@
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE. 29 * POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32#ifndef _LINUX_TIME_H_ 32#ifndef _LINUX_TIME_H_
33#define _LINUX_TIME_H_ 33#define _LINUX_TIME_H_
34 34
35#include <sys/time.h> 35#include <sys/time.h>
36 36
 37#define NSEC_PER_MSEC 1000000L
 38
37/* 39/*
38 * XXX get_seconds as implemented by Linux is a Y2038 bug waiting to 40 * XXX get_seconds as implemented by Linux is a Y2038 bug waiting to
39 * happen on 32-bit systems because it returns unsigned long. Some 41 * happen on 32-bit systems because it returns unsigned long. Some
40 * callers in Linux (implicitly) convert the result to time_t, though. 42 * callers in Linux (implicitly) convert the result to time_t, though.
41 * We'll pretend get_seconds returns time_t and make sure all our 43 * We'll pretend get_seconds returns time_t and make sure all our
42 * callers treat it as if it did. 44 * callers treat it as if it did.
43 */ 45 */
44 46
45static inline time_t 47static inline time_t
46get_seconds(void) 48get_seconds(void)
47{ 49{
48 return time_second; 50 return time_second;
49} 51}

cvs diff -r1.5 -r1.6 src/sys/external/bsd/drm2/include/linux/timer.h (expand / switch to unified diff)

--- src/sys/external/bsd/drm2/include/linux/timer.h 2014/08/26 17:26:05 1.5
+++ src/sys/external/bsd/drm2/include/linux/timer.h 2018/08/27 06:16:50 1.6
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: timer.h,v 1.5 2014/08/26 17:26:05 riastradh Exp $ */ 1/* $NetBSD: timer.h,v 1.6 2018/08/27 06:16:50 riastradh Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2013 The NetBSD Foundation, Inc. 4 * Copyright (c) 2013 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Taylor R. Campbell. 8 * by Taylor R. Campbell.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -79,31 +79,32 @@ mod_timer_pinned(struct timer_list *time @@ -79,31 +79,32 @@ mod_timer_pinned(struct timer_list *time
79{ 79{
80 80
81 /* XXX Stay on the same CPU it was originally on... */ 81 /* XXX Stay on the same CPU it was originally on... */
82 mod_timer(timer, then); 82 mod_timer(timer, then);
83} 83}
84 84
85static inline void 85static inline void
86del_timer(struct timer_list *timer) 86del_timer(struct timer_list *timer)
87{ 87{
88 88
89 callout_stop(&timer->tl_callout); 89 callout_stop(&timer->tl_callout);
90} 90}
91 91
92static inline void 92static inline bool
93del_timer_sync(struct timer_list *timer) 93del_timer_sync(struct timer_list *timer)
94{ 94{
95 95
96 callout_halt(&timer->tl_callout, NULL); 96 /* XXX return values? */
 97 return callout_halt(&timer->tl_callout, NULL);
97} 98}
98 99
99static inline bool 100static inline bool
100timer_pending(struct timer_list *timer) 101timer_pending(struct timer_list *timer)
101{ 102{
102 103
103 return callout_pending(&timer->tl_callout); 104 return callout_pending(&timer->tl_callout);
104} 105}
105 106
106/* 107/*
107 * XXX This is bogus -- the Linux version does various machinations to 108 * XXX This is bogus -- the Linux version does various machinations to
108 * give some jitter so that stuff doesn't wake up all at once. 109 * give some jitter so that stuff doesn't wake up all at once.
109 */ 110 */