Re: [Intel-gfx] [PATCH 5/6] drm/i915: give G45 and GM45 their own platform enums

2016-11-30 Thread Joonas Lahtinen
On ke, 2016-11-30 at 17:43 +0200, Jani Nikula wrote:
> Distinguish them better.
> 
> Signed-off-by: Jani Nikula 

Reviewed-by: Joonas Lahtinen 

Regards, Joonas
-- 
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 1/6] drm/i915: replace platform flags with a platform enum

2016-11-30 Thread Joonas Lahtinen
On ke, 2016-11-30 at 17:43 +0200, Jani Nikula wrote:
> The platform flags in device info are (mostly) mutually
> exclusive. Replace the flags with an enum. Add the platform enum also
> for platforms that previously didn't have a flag, and give them codename
> logging in dmesg.
> 
> Pineview remains an exception, the platform being G33 for that.
> 
> v2: Sort enum by gen and date
> 
> Signed-off-by: Jani Nikula 

The enum can be made into BIT() and the table can still be made with
some __builtin_ffs if that was found desireable.

With or without that;

Reviewed-by: Joonas Lahtinen 

Regards, Joonas
-- 
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH] drm: Initialise drm_mm.head_node.allocated

2016-11-30 Thread Daniel Vetter
On Wed, Nov 30, 2016 at 08:51:26PM +, Chris Wilson wrote:
> commit 202b52b7fbf7 ("drm: Track drm_mm nodes with an interval tree")
> introduced a requirement that the special drm_mm.head_node was
> initialised and marked as not being allocated. It is a very special node
> that has no side but has a hole that represents the drm_mm address
> space, and holds the list of nodes. Since it is not a real node, it is
> not part of the node rbtree and we detect this as it being unallocated.
> This presumed that drm_mm_init() was initialising it to zero. It happens
> that i915 kzallocs its objects and so it was accidentally setting it,
> but for generic use we cannot make that assumption.
> 
> [   22.981519] general protection fault:  [#1] SMP
> [   22.981521] Modules linked in: test_drm_mm(+) ctr ccm arc4 rt2800usb 
> rt2x00usb rt2800lib rt2x00lib crc_ccitt mac80211 cmac rfcomm bnep 
> snd_hda_codec_realtek snd_hda_codec_hdmi snd_hda_codec_generic snd_hda_intel 
> dcdbas snd_hda_codec x86_pkg_temp_thermal intel_powerclamp btusb snd_hda_core 
> coretemp crct10dif_pclmul cfg80211 btrtl btbcm btintel bluetooth crc32_pclmul 
> ghash_clmulni_intel aesni_intel snd_pcm i2c_hid aes_x86_64 lrw gf128mul 
> glue_helper ablk_helper cryptd snd_timer hid_multitouch snd joydev serio_raw 
> lpc_ich mfd_core i2c_designware_platform i2c_designware_core 8250_dw 
> binfmt_misc soundcore acpi_pad nls_iso8859_1 usbhid hid psmouse ahci libahci 
> [last unloaded: test_drm_mm]
> [   22.981544] CPU: 1 PID: 2088 Comm: drm_mm Tainted: GW   
> 4.9.0-rc7+ #234
> [   22.981545] Hardware name: Dell Inc. XPS 13 9343/0310JH, BIOS A07 
> 11/11/2015
> [   22.981546] task: 88020c971cc0 task.stack: c90001728000
> [   22.981547] RIP: 0010:[]  [] 
> drm_mm_interval_tree_add_node+0xa0/0xd0
> [   22.981551] RSP: 0018:c9000172ba98  EFLAGS: 00010202
> [   22.981552] RAX: 0fc69cf63d80 RBX: 88020be0 RCX: 
> 88020be0
> [   22.981553] RDX: 0fff RSI: c9000172bc48 RDI: 
> 810ac4df
> [   22.981553] RBP: c9000172bb08 R08: c9000172bc70 R09: 
> 0fff
> [   22.981554] R10: 810ac4d7 R11: 4dc04d8b4ce5 R12: 
> 1000
> [   22.981555] R13: c9000172bbd0 R14: c9000172bbe0 R15: 
> 0200
> [   22.981556] FS:  7f80c9fab740() GS:88021f48() 
> knlGS:
> [   22.981557] CS:  0010 DS:  ES:  CR0: 80050033
> [   22.981558] CR2: 7f80c9fd5000 CR3: 00020c191000 CR4: 
> 003406e0
> [   22.981559] Stack:
> [   22.981560]  81405d09 88020be0 c9000172bbe0 
> 0172bb08
> [   22.981562]     
> 
> [   22.981563]  0200 0200 a02f3000 
> 88020be0
> [   22.981565] Call Trace:
> [   22.981568]  [] ? drm_mm_insert_node_generic+0x229/0x310
> [   22.981570]  [] ? 0xa02f3000
> [   22.981572]  [] 
> __subtest_insert_range.constprop.7+0xd1/0x5b0 [test_drm_mm]
> [   22.981575]  [] ? default_wake_function+0x12/0x20
> [   22.981576]  [] ? __wake_up_common+0x55/0x90
> [   22.981578]  [] ? sched_clock_cpu+0x72/0xa0
> [   22.981581]  [] ? irq_work_queue+0xd/0x80
> [   22.981582]  [] ? wake_up_klogd+0x34/0x40
> [   22.981584]  [] ? console_unlock+0x4cd/0x530
> [   22.981585]  [] ? vprintk_emit+0x2d7/0x490
> [   22.981587]  [] ? vprintk_default+0x1f/0x30
> [   22.981589]  [] ? printk+0x4d/0x4f
> [   22.981590]  [] ? 0xa02f3000
> [   22.981592]  [] subtest_insert_range+0x15/0x80 
> [test_drm_mm]
> [   22.981594]  [] test_drm_mm_init+0x88/0x1000 
> [test_drm_mm]
> [   22.981597]  [] do_one_initcall+0x3d/0x150
> [   22.981600]  [] ? kfree+0x13f/0x180
> [   22.981602]  [] do_init_module+0x60/0x1f1
> [   22.981606]  [] load_module+0x2228/0x2790
> [   22.981608]  [] ? __symbol_put+0x40/0x40
> [   22.981612]  [] ? kernel_read+0x41/0x60
> [   22.981614]  [] SYSC_finit_module+0x96/0xd0
> [   22.981617]  [] SyS_finit_module+0xe/0x10
> [   22.981620]  [] entry_SYSCALL_64_fastpath+0x17/0x98
> [   22.981622] Code: c7 41 30 00 00 00 00 48 89 e5 48 89 3a 48 c7 c2 20 4e 40 
> 81 e8 b2 a1 f0 ff 5d c3 48 8d 56 78 45 31 d2 48 89 d6 eb 25 48 8b 51 58 <48> 
> 39 50 38 73 04 48 89 50 38 4c 8b 58 28 4c 39 59 48 48 8d 50
> [   22.981651] RIP  [] 
> drm_mm_interval_tree_add_node+0xa0/0xd0
> [   22.981655]  RSP 
> 
> Testcase: igt/drm_mm
> Fixes: 202b52b7fbf7 ("drm: Track drm_mm nodes with an interval tree")
> Signed-off-by: Chris Wilson 
> Cc: David Herrmann 
> Cc: dri-de...@lists.freedesktop.org
> Cc: Daniel Vetter 
> Cc:  # v4.9-rc1+

Applied to drm-misc, thx.
-Daniel

> ---
>  drivers/gpu/drm/drm_mm.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/gpu/drm/drm_mm.c b/drivers/gpu/drm/drm_mm.c
> index b5b0b667677d..952e4594f181 100644
> --- a/drivers/gpu/drm/drm_mm.c

[Intel-gfx] ✗ Fi.CI.BAT: failure for Introduce drmfs pseudo filesystem for drm subsystem

2016-11-30 Thread Patchwork
== Series Details ==

Series: Introduce drmfs pseudo filesystem for drm subsystem
URL   : https://patchwork.freedesktop.org/series/16203/
State : failure

== Summary ==

  CC [M]  drivers/gpu/drm/i915/gvt/opregion.o
  CC [M]  drivers/gpu/drm/i915/gvt/mmio.o
  LD  drivers/video/fbdev/core/built-in.o
  CC [M]  drivers/gpu/drm/i915/gvt/edid.o
  CC [M]  drivers/gpu/drm/i915/gvt/display.o
  CC [M]  drivers/gpu/drm/i915/gvt/execlist.o
  CC [M]  drivers/gpu/drm/i915/gvt/scheduler.o
  CC [M]  drivers/gpu/drm/i915/gvt/sched_policy.o
  CC [M]  drivers/gpu/drm/i915/gvt/render.o
  CC [M]  drivers/gpu/drm/i915/gvt/cmd_parser.o
  LD  drivers/tty/serial/8250/8250.o
  LD  drivers/scsi/scsi_mod.o
  LD  drivers/acpi/acpica/acpi.o
  LD  drivers/gpu/drm/drm.o
  LD [M]  drivers/misc/mei/mei-me.o
  LD  drivers/misc/built-in.o
  LD  drivers/video/fbdev/built-in.o
  LD  drivers/pci/pcie/aer/aerdriver.o
  LD  drivers/pci/pcie/aer/built-in.o
  LD [M]  drivers/net/ethernet/broadcom/genet/genet.o
  LD  drivers/pci/pcie/built-in.o
  LD  drivers/usb/storage/usb-storage.o
  LD  drivers/pci/built-in.o
  LD  drivers/usb/storage/built-in.o
  LD  drivers/acpi/acpica/built-in.o
  LD [M]  sound/pci/hda/snd-hda-codec-generic.o
  LD  sound/pci/built-in.o
  LD  drivers/thermal/thermal_sys.o
  LD  drivers/acpi/built-in.o
  LD  drivers/thermal/built-in.o
  LD  drivers/spi/built-in.o
  LD [M]  drivers/usb/serial/usbserial.o
  LD  sound/built-in.o
drivers/gpu/drm/i915/i915_guc_submission.c: In function 
‘create_buf_file_callback’:
drivers/gpu/drm/i915/i915_guc_submission.c:841:13: error: implicit declaration 
of function ‘drmfs_create_file’ [-Werror=implicit-function-declaration]
  buf_file = drmfs_create_file("guc_log", mode,
 ^
drivers/gpu/drm/i915/i915_guc_submission.c:841:11: error: assignment makes 
pointer from integer without a cast [-Werror=int-conversion]
  buf_file = drmfs_create_file("guc_log", mode,
   ^
drivers/gpu/drm/i915/i915_guc_submission.c: In function 
‘remove_buf_file_callback’:
drivers/gpu/drm/i915/i915_guc_submission.c:851:2: error: implicit declaration 
of function ‘drmfs_remove’ [-Werror=implicit-function-declaration]
  drmfs_remove(dentry);
  ^
  LD  drivers/usb/gadget/udc/udc-core.o
  LD  net/ipv6/ipv6.o
  LD  drivers/usb/gadget/udc/built-in.o
  AR  lib/lib.a
  LD  drivers/usb/gadget/libcomposite.o
  EXPORTS lib/lib-ksyms.o
  LD  net/ipv6/built-in.o
  LD  drivers/tty/serial/8250/8250_base.o
  LD  drivers/scsi/sd_mod.o
  LD  drivers/usb/gadget/built-in.o
  LD  drivers/video/console/built-in.o
  LD  drivers/scsi/built-in.o
  LD  drivers/tty/serial/8250/built-in.o
  LD  lib/built-in.o
  LD  drivers/tty/serial/built-in.o
  LD  drivers/video/built-in.o
  LD  drivers/iommu/built-in.o
  LD  fs/btrfs/btrfs.o
  LD  fs/btrfs/built-in.o
  LD  drivers/usb/core/usbcore.o
  LD  drivers/usb/core/built-in.o
  LD [M]  drivers/net/ethernet/intel/igbvf/igbvf.o
  LD  net/ipv4/built-in.o
  LD [M]  drivers/net/ethernet/intel/e1000/e1000.o
cc1: all warnings being treated as errors
scripts/Makefile.build:293: recipe for target 
'drivers/gpu/drm/i915/i915_guc_submission.o' failed
make[4]: *** [drivers/gpu/drm/i915/i915_guc_submission.o] Error 1
make[4]: *** Waiting for unfinished jobs
  LD  drivers/tty/vt/built-in.o
  LD  drivers/tty/built-in.o
  LD  drivers/md/md-mod.o
  LD  drivers/md/built-in.o
  CC  arch/x86/kernel/cpu/capflags.o
  LD  arch/x86/kernel/cpu/built-in.o
  LD  arch/x86/kernel/built-in.o
  LD  arch/x86/built-in.o
  LD  drivers/usb/host/xhci-hcd.o
  LD  net/core/built-in.o
  LD  fs/ext4/ext4.o
  LD  net/built-in.o
  LD  fs/ext4/built-in.o
  LD  fs/built-in.o
  LD  drivers/usb/host/built-in.o
  LD  drivers/usb/built-in.o
  LD [M]  drivers/net/ethernet/intel/igb/igb.o
  LD [M]  drivers/net/ethernet/intel/e1000e/e1000e.o
  LD  drivers/net/ethernet/built-in.o
  LD  drivers/net/built-in.o
scripts/Makefile.build:544: recipe for target 'drivers/gpu/drm/i915' failed
make[3]: *** [drivers/gpu/drm/i915] Error 2
scripts/Makefile.build:544: recipe for target 'drivers/gpu/drm' failed
make[2]: *** [drivers/gpu/drm] Error 2
scripts/Makefile.build:544: recipe for target 'drivers/gpu' failed
make[1]: *** [drivers/gpu] Error 2
Makefile:986: recipe for target 'drivers' failed
make: *** [drivers] Error 2

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] ✗ Fi.CI.BAT: warning for drm: Initialise drm_mm.head_node.allocated

2016-11-30 Thread Saarinen, Jani
> == Series Details ==
> 
> Series: drm: Initialise drm_mm.head_node.allocated
> URL   : https://patchwork.freedesktop.org/series/16183/
> State : warning
> 
> == Summary ==
> 
> Series 16183v1 drm: Initialise drm_mm.head_node.allocated
> https://patchwork.freedesktop.org/api/1.0/series/16183/revisions/1/mbox/
> 
> Subgroup nonblocking-crc-pipe-a:
> pass   -> DMESG-WARN (fi-ilk-650)

https://bugs.freedesktop.org/show_bug.cgi?id=98251


Jani Saarinen
Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo




___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [RFC 2/3] drm: Register drmfs filesystem from drm init

2016-11-30 Thread swati . dhingra
From: Swati Dhingra 

During drm module initialization, drm_core_init initializes the drmfs
filesystem and register this with kernel. A driver specific directory is created
inside drmfs root, and dentry of this directory is saved for subsequent use
by the driver (e.g. i915). The driver can then create files/directories inside
this root directory directly.
In case of i915 driver, the top directory is created at '/sys/kernel/drm/i915'.

Signed-off-by: Sourab Gupta 
Signed-off-by: Swati Dhingra 
---
 drivers/gpu/drm/drm_drv.c | 22 ++
 include/drm/drm_drv.h |  3 +++
 2 files changed, 25 insertions(+)

diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index 84fcfcb..ead360bd 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -688,6 +688,14 @@ int drm_dev_register(struct drm_device *dev, unsigned long 
flags)
 {
int ret;
 
+#ifdef CONFIG_DRMFS
+   dev->driver->drmfs_root = drmfs_create_dir(dev->driver->name, NULL);
+   if (IS_ERR(dev->driver->drmfs_root)) {
+   DRM_ERROR("Failed to get drmfs root dentry\n");
+   return PTR_ERR(dev->driver->drmfs_root);
+   }
+#endif
+
mutex_lock(_global_mutex);
 
ret = drm_minor_register(dev, DRM_MINOR_CONTROL);
@@ -758,6 +766,9 @@ void drm_dev_unregister(struct drm_device *dev)
drm_minor_unregister(dev, DRM_MINOR_PRIMARY);
drm_minor_unregister(dev, DRM_MINOR_RENDER);
drm_minor_unregister(dev, DRM_MINOR_CONTROL);
+#ifdef CONFIG_DRMFS
+   drmfs_remove(dev->driver->drmfs_root);
+#endif
 }
 EXPORT_SYMBOL(drm_dev_unregister);
 
@@ -825,6 +836,9 @@ static void drm_core_exit(void)
 {
unregister_chrdev(DRM_MAJOR, "drm");
debugfs_remove(drm_debugfs_root);
+#ifdef CONFIG_DRMFS
+   drmfs_fini();
+#endif
drm_sysfs_destroy();
idr_destroy(_minors_idr);
drm_connector_ida_destroy();
@@ -845,6 +859,14 @@ static int __init drm_core_init(void)
goto error;
}
 
+#ifdef CONFIG_DRMFS
+   ret = drmfs_init();
+   if (ret < 0) {
+   DRM_ERROR("Cannot create DRM FS: %d\n", ret);
+   goto error;
+   }
+#endif
+
drm_debugfs_root = debugfs_create_dir("dri", NULL);
if (!drm_debugfs_root) {
ret = -ENOMEM;
diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
index aad8bba..34804de 100644
--- a/include/drm/drm_drv.h
+++ b/include/drm/drm_drv.h
@@ -403,6 +403,9 @@ struct drm_driver {
 
/* List of devices hanging off this driver with stealth attach. */
struct list_head legacy_dev_list;
+
+   /* drmfs parent directory dentry for this driver */
+   struct dentry *drmfs_root;
 };
 
 extern __printf(6, 7)
-- 
2.7.4

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] ✗ Fi.CI.BAT: warning for drm/i915/perf: Treat u64 in uabi as a normal integer

2016-11-30 Thread Saarinen, Jani
> == Series Details ==
> 
> Series: drm/i915/perf: Treat u64 in uabi as a normal integer
> URL   : https://patchwork.freedesktop.org/series/16171/
> State : warning
> 
> == Summary ==
> 
> Series 16171v1 drm/i915/perf: Treat u64 in uabi as a normal integer
> https://patchwork.freedesktop.org/api/1.0/series/16171/revisions/1/mbox/
> 
> Subgroup nonblocking-crc-pipe-a:
> pass   -> DMESG-WARN (fi-ilk-650)
https://bugs.freedesktop.org/show_bug.cgi?id=98251

> fi-bdw-5557u total:245  pass:230  dwarn:0   dfail:0   fail:0   skip:15
> fi-bsw-n3050 total:245  pass:205  dwarn:0   dfail:0   fail:0   skip:40
> fi-bxt-t5700 total:245  pass:217  dwarn:0   dfail:0   fail:0   skip:28
> fi-byt-j1900 total:245  pass:217  dwarn:0   dfail:0   fail:0   skip:28
> fi-byt-n2820 total:245  pass:213  dwarn:0   dfail:0   fail:0   skip:32
> fi-hsw-4770  total:245  pass:225  dwarn:0   dfail:0   fail:0   skip:20
> fi-hsw-4770r total:245  pass:225  dwarn:0   dfail:0   fail:0   skip:20
> fi-ilk-650   total:245  pass:191  dwarn:1   dfail:0   fail:0   skip:53
> fi-ivb-3520m total:245  pass:223  dwarn:0   dfail:0   fail:0   skip:22
> fi-ivb-3770  total:245  pass:223  dwarn:0   dfail:0   fail:0   skip:22
> fi-kbl-7500u total:245  pass:223  dwarn:0   dfail:0   fail:0   skip:22
> fi-skl-6260u total:245  pass:231  dwarn:0   dfail:0   fail:0   skip:14
> fi-skl-6700hqtotal:245  pass:224  dwarn:0   dfail:0   fail:0   skip:21
> fi-skl-6700k total:245  pass:223  dwarn:1   dfail:0   fail:0   skip:21
> fi-skl-6770hqtotal:245  pass:231  dwarn:0   dfail:0   fail:0   skip:14
> fi-snb-2520m total:245  pass:213  dwarn:0   dfail:0   fail:0   skip:32
> fi-snb-2600  total:245  pass:212  dwarn:0   dfail:0   fail:0   skip:33
> 
> 51c6c255aa05775bcfb3f5790a3b9249e5990f3e drm-tip: 2016y-11m-30d-
> 16h-12m-19s UTC integration manifest
> 6287239 drm/i915/perf: Treat u64 in uabi as a normal integer
> 
> == Logs ==
> 


Jani Saarinen
Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo


___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [RFC 3/3] drm/i915: Creating guc log file in drmfs instead of debugfs

2016-11-30 Thread swati . dhingra
From: Swati Dhingra 

In the current scenario, the relay API fit well only with debugfs, due to
availability of parent dentry. Any other existing filesystem was not feasible 
for
holding guc logs, due to incompatibility with relay. But this makes the  guc_log
file unavailable on the production kernels.

GuC log file can therefore be one of candidates for movement to the drmfs
filesystem, which can satisfy all the requirements needed by relay API, and can
house any relayfs based output file.

The patch moves the parent directory of guc 'log_dir' from debugfs_root to
drmfs_root, while using the drmfs api's to create the requisite files.

Signed-off-by: Sourab Gupta 
Signed-off-by: Swati Dhingra 
---
 drivers/gpu/drm/i915/i915_guc_submission.c | 31 ++
 1 file changed, 10 insertions(+), 21 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_guc_submission.c 
b/drivers/gpu/drm/i915/i915_guc_submission.c
index 4462112..dacae71 100644
--- a/drivers/gpu/drm/i915/i915_guc_submission.c
+++ b/drivers/gpu/drm/i915/i915_guc_submission.c
@@ -23,7 +23,7 @@
  */
 #include 
 #include 
-#include 
+#include 
 #include 
 #include "i915_drv.h"
 #include "intel_guc.h"
@@ -923,7 +923,7 @@ static int subbuf_start_callback(struct rchan_buf *buf,
 }
 
 /*
- * file_create() callback. Creates relay file in debugfs.
+ * file_create() callback. Creates relay file in drmfs.
  */
 static struct dentry *create_buf_file_callback(const char *filename,
   struct dentry *parent,
@@ -949,17 +949,17 @@ static struct dentry *create_buf_file_callback(const char 
*filename,
 * dentry of the file associated with the channel buffer and that file's
 * name need not be same as the filename passed as an argument.
 */
-   buf_file = debugfs_create_file("guc_log", mode,
+   buf_file = drmfs_create_file("guc_log", mode,
   parent, buf, _file_operations);
return buf_file;
 }
 
 /*
- * file_remove() default callback. Removes relay file in debugfs.
+ * file_remove() default callback. Removes relay file in drmfs.
  */
 static int remove_buf_file_callback(struct dentry *dentry)
 {
-   debugfs_remove(dentry);
+   drmfs_remove(dentry);
return 0;
 }
 
@@ -1009,22 +1009,11 @@ static int guc_log_create_relay_file(struct intel_guc 
*guc)
struct dentry *log_dir;
int ret;
 
-   /* For now create the log file in /sys/kernel/debug/dri/0 dir */
-   log_dir = dev_priv->drm.primary->debugfs_root;
-
-   /* If /sys/kernel/debug/dri/0 location do not exist, then debugfs is
-* not mounted and so can't create the relay file.
-* The relay API seems to fit well with debugfs only, for availing relay
-* there are 3 requirements which can be met for debugfs file only in a
-* straightforward/clean manner :-
-* i)   Need the associated dentry pointer of the file, while opening 
the
-*  relay channel.
-* ii)  Should be able to use 'relay_file_operations' fops for the file.
-* iii) Set the 'i_private' field of file's inode to the pointer of
-*  relay channel buffer.
-*/
+   /* Create the log file in drmfs dir: /sys/kernel/drm/i915/ */
+   log_dir = dev_priv->drm.driver->drmfs_root;
+
if (!log_dir) {
-   DRM_ERROR("Debugfs dir not available yet for GuC log file\n");
+   DRM_ERROR("Drmfs dir not available yet for GuC log file\n");
return -ENODEV;
}
 
@@ -1265,7 +1254,7 @@ static int guc_log_create_extras(struct intel_guc *guc)
if (!guc->log.relay_chan) {
/* Create a relay channel, so that we have buffers for storing
 * the GuC firmware logs, the channel will be linked with a file
-* later on when debugfs is registered.
+* later on when drmfs is registered.
 */
ret = guc_log_create_relay_channel(guc);
if (ret)
-- 
2.7.4

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [RFC 1/3] fs: Introduce drmfs pseudo filesystem interfaces

2016-11-30 Thread swati . dhingra
From: Swati Dhingra 

The patch introduces a new pseudo filesystem type, named 'drmfs' which is
intended to house the files for the data generated by drm subsystem that
cannot be accommodated by any of the existing filesystems.
The filesystem is modelled on the lines of existing pseudo-filesystems such
as debugfs/tracefs, and borrows ideas from their implementation.
This filesystem will be appearing at sys/kernel/drm.

A new config 'CONFIG_DRMFS' is introduced to enable/disable the filesystem,
which is dependent on CONFIG_DRM.
The filesystem will not be registered standalone during kernel init time,
instead it is intended to be initialized/registered during drm initialization.

The intent for introduction of the filesystem is to act as a location to hold
various kinds of data output from Linux DRM subsystems, which can't really fit
anywhere else into the existing filesystems such as debugfs/sysfs etc. All these
filesystems have their own constraints and are intended to output a particular
type of data such as attributes and small debug parameter data. Due to these
constraints, there is a need for a new pseudo filesytem, customizable to DRM
specific requirements and catering to the needs to DRM subsystem components

Signed-off-by: Sourab Gupta 
Signed-off-by: Swati Dhingra 
---
 drivers/gpu/drm/drm_drv.c  |   1 +
 fs/Kconfig |   9 +
 fs/Makefile|   1 +
 fs/drmfs/Makefile  |   4 +
 fs/drmfs/inode.c   | 561 +
 include/linux/drmfs.h  |  56 +
 include/uapi/linux/magic.h |   3 +
 7 files changed, 635 insertions(+)
 create mode 100644 fs/drmfs/Makefile
 create mode 100644 fs/drmfs/inode.c
 create mode 100644 include/linux/drmfs.h

diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index 6dbb986..84fcfcb 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -27,6 +27,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/fs/Kconfig b/fs/Kconfig
index 4bd03a2..7d0ac20 100644
--- a/fs/Kconfig
+++ b/fs/Kconfig
@@ -200,6 +200,15 @@ config HUGETLBFS
 config HUGETLB_PAGE
def_bool HUGETLBFS
 
+config DRMFS
+   bool "Drmfs file system support"
+   depends on DRM
+   help
+ Drmfs is a pseudo file system for drm subsystem output data.
+
+ drmfs is a filesystem to hold miscellaneous output data from drm
+ subsystems.
+
 config ARCH_HAS_GIGANTIC_PAGE
bool
 
diff --git a/fs/Makefile b/fs/Makefile
index ed2b632..b34a96e 100644
--- a/fs/Makefile
+++ b/fs/Makefile
@@ -120,6 +120,7 @@ obj-$(CONFIG_BEFS_FS)   += befs/
 obj-$(CONFIG_HOSTFS)   += hostfs/
 obj-$(CONFIG_CACHEFILES)   += cachefiles/
 obj-$(CONFIG_DEBUG_FS) += debugfs/
+obj-$(CONFIG_DRMFS)+= drmfs/
 obj-$(CONFIG_TRACING)  += tracefs/
 obj-$(CONFIG_OCFS2_FS) += ocfs2/
 obj-$(CONFIG_BTRFS_FS) += btrfs/
diff --git a/fs/drmfs/Makefile b/fs/drmfs/Makefile
new file mode 100644
index 000..708be0d
--- /dev/null
+++ b/fs/drmfs/Makefile
@@ -0,0 +1,3 @@
+drmfs-objs := inode.o
+
+obj-$(CONFIG_DRMFS)+= drmfs.o
diff --git a/fs/drmfs/inode.c b/fs/drmfs/inode.c
new file mode 100644
index 000..ada3e18
--- /dev/null
+++ b/fs/drmfs/inode.c
@@ -0,0 +1,561 @@
+/*
+ * Copyright © 2014 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Authors:
+ * Swati Dhingra 
+ * Sourab Gupta 
+ * Akash Goel 
+ */
+
+/*
+ * drmfs is the filesystem used for output of drm subsystem data
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define DRMFS_DEFAULT_MODE 0700
+
+static struct vfsmount 

[Intel-gfx] [RFC 0/3] Introduce drmfs pseudo filesystem for drm subsystem

2016-11-30 Thread swati . dhingra
From: Swati Dhingra 

Currently, for the purpose of providing output debug/loggging/crc and various
other kinds of data from DRM layer to userspace, we don't have a standard
filesystem, which would suffice for all the usecases. The filesystems used
currently such as debugfs/sysfs have their own constraints and are intended
to output a particular type of data. For instance, sysfs is suitable for
exporting only small data in form of attributes, thus not suitable to export
large data such as error states/logs/crc etc. Likewise for debugfs, which is
not available in production kernels, and may not be best place to hold certain
kinds of data. As a result, we currently are creating certain files in these
filesystems, which are not particularly suited there (For, i915, guc_log is a
case in point, which is currently created in debugfs, but not particularly
suited there).

Due to these constraints, there is a need for a new pseudo filesytem,
customizable to DRM specific requirements and catering to the needs to DRM
subsystem components. This will provide a unified location to hold various
kinds of data from Linux DRM subsystems, for the files which can't really fit
anywhere else into the existing filesystems.

In this patch series, we have introduced a pseudo filesystem named as 'drmfs'
for now. The filesystem is introduced in the first patch, and the subsequent
patches make use of the filesystem interfaces, in drm driver, and making them
available for use by the drm subsystem components, one of which is i915.
We've moved the location of i915 GuC logs from debugfs to drmfs in the third
patch. Subsequently, more such files such as pipe_crc, error states, memory
stats, etc. can be move to this filesystem, if the idea introduced here is
acceptable per se. The filesystem introduced is being used to house the data
generated by i915 driver in this patch series, but will hopefully be generic
enough to provide scope for usage by any other drm subsystem component.

The patch series is being floated as RFC to gather feedback on the idea and
infrastructure proposed here and it's suitability to address the specific
problem statement/use case.

Swati Dhingra (3):
  fs: Introduce drmfs pseudo filesystem interfaces
  drm: Register drmfs filesystem from drm init
  drm/i915: Creating guc log file in drmfs instead of debugfs

 drivers/gpu/drm/drm_drv.c  |  23 ++
 drivers/gpu/drm/i915/i915_guc_submission.c |  31 +-
 fs/Kconfig |   9 +
 fs/Makefile|   1 +
 fs/drmfs/Makefile  |   4 +
 fs/drmfs/inode.c   | 561 +
 include/drm/drm_drv.h  |   3 +
 include/linux/drmfs.h  |  56 +++
 include/uapi/linux/magic.h |   3 +
 9 files changed, 670 insertions(+), 21 deletions(-)
 create mode 100644 fs/drmfs/Makefile
 create mode 100644 fs/drmfs/inode.c
 create mode 100644 include/linux/drmfs.h

-- 
2.7.4

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] ✓ Fi.CI.BAT: success for series starting with [1/2] drm/i915/audio: extend get_saved_enc() to support more scenarios

2016-11-30 Thread Patchwork
== Series Details ==

Series: series starting with [1/2] drm/i915/audio: extend get_saved_enc() to 
support more scenarios
URL   : https://patchwork.freedesktop.org/series/16200/
State : success

== Summary ==

Series 16200v1 Series without cover letter
https://patchwork.freedesktop.org/api/1.0/series/16200/revisions/1/mbox/

Test kms_busy:
Subgroup basic-flip-default-a:
skip   -> PASS   (fi-ivb-3770)
Subgroup basic-flip-default-b:
skip   -> PASS   (fi-ivb-3770)
Subgroup basic-flip-default-c:
skip   -> PASS   (fi-ivb-3770)
Test kms_cursor_legacy:
Subgroup basic-busy-flip-before-cursor-legacy:
skip   -> PASS   (fi-ivb-3770)
Subgroup basic-busy-flip-before-cursor-varying-size:
skip   -> PASS   (fi-ivb-3770)
Subgroup basic-flip-after-cursor-legacy:
skip   -> PASS   (fi-ivb-3770)
Subgroup basic-flip-after-cursor-varying-size:
skip   -> PASS   (fi-ivb-3770)
Subgroup basic-flip-before-cursor-legacy:
skip   -> PASS   (fi-ivb-3770)
Subgroup basic-flip-before-cursor-varying-size:
skip   -> PASS   (fi-ivb-3770)
Test kms_force_connector_basic:
Subgroup force-connector-state:
skip   -> PASS   (fi-ivb-3770)
Subgroup force-edid:
skip   -> PASS   (fi-ivb-3770)
Subgroup force-load-detect:
skip   -> PASS   (fi-ivb-3770)
Subgroup prune-stale-modes:
skip   -> PASS   (fi-ivb-3770)
Test kms_pipe_crc_basic:
Subgroup hang-read-crc-pipe-a:
skip   -> PASS   (fi-ivb-3770)
Subgroup suspend-read-crc-pipe-a:
skip   -> PASS   (fi-ivb-3770)
Subgroup suspend-read-crc-pipe-b:
skip   -> PASS   (fi-ivb-3770)
Subgroup suspend-read-crc-pipe-c:
skip   -> PASS   (fi-ivb-3770)
Test prime_vgem:
Subgroup basic-fence-flip:
skip   -> PASS   (fi-ivb-3770)

fi-bdw-5557u total:245  pass:230  dwarn:0   dfail:0   fail:0   skip:15 
fi-bsw-n3050 total:245  pass:205  dwarn:0   dfail:0   fail:0   skip:40 
fi-bxt-t5700 total:245  pass:217  dwarn:0   dfail:0   fail:0   skip:28 
fi-byt-j1900 total:245  pass:217  dwarn:0   dfail:0   fail:0   skip:28 
fi-byt-n2820 total:245  pass:213  dwarn:0   dfail:0   fail:0   skip:32 
fi-hsw-4770  total:245  pass:225  dwarn:0   dfail:0   fail:0   skip:20 
fi-hsw-4770r total:245  pass:225  dwarn:0   dfail:0   fail:0   skip:20 
fi-ilk-650   total:245  pass:192  dwarn:0   dfail:0   fail:0   skip:53 
fi-ivb-3520m total:245  pass:223  dwarn:0   dfail:0   fail:0   skip:22 
fi-ivb-3770  total:245  pass:223  dwarn:0   dfail:0   fail:0   skip:22 
fi-kbl-7500u total:245  pass:223  dwarn:0   dfail:0   fail:0   skip:22 
fi-skl-6260u total:245  pass:231  dwarn:0   dfail:0   fail:0   skip:14 
fi-skl-6700hqtotal:245  pass:224  dwarn:0   dfail:0   fail:0   skip:21 
fi-skl-6700k total:245  pass:223  dwarn:1   dfail:0   fail:0   skip:21 
fi-skl-6770hqtotal:245  pass:231  dwarn:0   dfail:0   fail:0   skip:14 
fi-snb-2520m total:245  pass:213  dwarn:0   dfail:0   fail:0   skip:32 
fi-snb-2600  total:245  pass:212  dwarn:0   dfail:0   fail:0   skip:33 

51c6c255aa05775bcfb3f5790a3b9249e5990f3e drm-tip: 2016y-11m-30d-16h-12m-19s UTC 
integration manifest
a6d27e4 drm/i915/audio: extend audio sync rate support for DP MST
99235be drm/i915/audio: extend get_saved_enc() to support more scenarios

== Logs ==

For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_3156/
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] ✗ Fi.CI.BAT: failure for HuC Loading Patches

2016-11-30 Thread Patchwork
== Series Details ==

Series: HuC Loading Patches
URL   : https://patchwork.freedesktop.org/series/16188/
State : failure

== Summary ==

  CC [M]  drivers/gpu/drm/i915/gvt/opregion.o
  CC [M]  drivers/gpu/drm/i915/gvt/mmio.o
  CC [M]  drivers/gpu/drm/i915/gvt/display.o
  CC [M]  drivers/gpu/drm/i915/gvt/edid.o
  CC [M]  drivers/gpu/drm/i915/gvt/execlist.o
  CC [M]  drivers/gpu/drm/i915/gvt/scheduler.o
  CC [M]  drivers/gpu/drm/i915/gvt/sched_policy.o
  CC [M]  drivers/gpu/drm/i915/gvt/render.o
  CC [M]  drivers/gpu/drm/i915/gvt/cmd_parser.o
  LD [M]  drivers/misc/mei/mei-me.o
  LD  drivers/tty/serial/8250/8250.o
  LD  drivers/usb/storage/usb-storage.o
  LD  drivers/misc/built-in.o
  LD  drivers/usb/storage/built-in.o
  LD  net/ipv6/ipv6.o
  LD [M]  sound/pci/hda/snd-hda-codec-generic.o
  LD  sound/pci/built-in.o
  LD  drivers/pci/pcie/aer/aerdriver.o
  LD  drivers/md/dm-mod.o
  LD  drivers/pci/pcie/aer/built-in.o
  LD  drivers/pci/pcie/built-in.o
  LD  net/ipv6/built-in.o
  LD [M]  drivers/usb/serial/usbserial.o
  LD  sound/built-in.o
  LD [M]  drivers/gpu/drm/vgem/vgem.o
drivers/gpu/drm/i915/intel_guc_loader.c: In function ‘intel_guc_setup’:
drivers/gpu/drm/i915/intel_guc_loader.c:532:2: error: implicit declaration of 
function ‘intel_guc_auth_huc’ [-Werror=implicit-function-declaration]
  intel_guc_auth_huc(dev);
  ^
  LD  drivers/usb/gadget/libcomposite.o
drivers/gpu/drm/i915/i915_guc_submission.c: In function ‘intel_guc_auth_huc’:
drivers/gpu/drm/i915/i915_guc_submission.c:1688:8: error: implicit declaration 
of function ‘host2guc_action’ [-Werror=implicit-function-declaration]
  ret = host2guc_action(guc, data, ARRAY_SIZE(data));
^
  LD  drivers/usb/gadget/udc/udc-core.o
  LD  drivers/usb/gadget/udc/built-in.o
  LD  drivers/usb/gadget/built-in.o
  LD  drivers/scsi/scsi_mod.o
  LD  drivers/thermal/thermal_sys.o
  LD  drivers/video/fbdev/core/fb.o
  LD  drivers/video/fbdev/core/built-in.o
  LD  drivers/thermal/built-in.o
  LD [M]  drivers/net/ethernet/broadcom/genet/genet.o
  LD  drivers/video/fbdev/built-in.o
  LD  drivers/iommu/built-in.o
  LD  drivers/spi/built-in.o
  AR  lib/lib.a
  LD  drivers/tty/serial/8250/8250_base.o
  EXPORTS lib/lib-ksyms.o
  LD  drivers/tty/serial/8250/built-in.o
cc1: all warnings being treated as errors
  LD  lib/built-in.o
scripts/Makefile.build:293: recipe for target 
'drivers/gpu/drm/i915/intel_guc_loader.o' failed
make[4]: *** [drivers/gpu/drm/i915/intel_guc_loader.o] Error 1
make[4]: *** Waiting for unfinished jobs
  LD [M]  drivers/net/ethernet/intel/igbvf/igbvf.o
cc1: all warnings being treated as errors
scripts/Makefile.build:293: recipe for target 
'drivers/gpu/drm/i915/i915_guc_submission.o' failed
make[4]: *** [drivers/gpu/drm/i915/i915_guc_submission.o] Error 1
  LD  drivers/tty/serial/built-in.o
  LD  drivers/pci/built-in.o
  LD  drivers/gpu/drm/drm.o
  LD  drivers/usb/core/usbcore.o
  LD  drivers/scsi/sd_mod.o
  LD  drivers/scsi/built-in.o
  LD  drivers/usb/core/built-in.o
  LD  drivers/video/console/built-in.o
  LD  drivers/video/built-in.o
  LD [M]  drivers/net/ethernet/intel/e1000/e1000.o
  LD  fs/btrfs/btrfs.o
  LD  net/ipv4/built-in.o
  CC  arch/x86/kernel/cpu/capflags.o
  LD  arch/x86/kernel/cpu/built-in.o
  LD  fs/btrfs/built-in.o
  LD  arch/x86/kernel/built-in.o
  LD  drivers/usb/host/xhci-hcd.o
  LD  drivers/md/md-mod.o
  LD  arch/x86/built-in.o
  LD  drivers/md/built-in.o
  LD  drivers/tty/vt/built-in.o
  LD  drivers/tty/built-in.o
  LD  net/core/built-in.o
  LD  net/built-in.o
  LD  drivers/usb/host/built-in.o
  LD  drivers/usb/built-in.o
  LD [M]  drivers/net/ethernet/intel/igb/igb.o
  LD  fs/ext4/ext4.o
  LD  fs/ext4/built-in.o
  LD  fs/built-in.o
  LD [M]  drivers/net/ethernet/intel/e1000e/e1000e.o
  LD  drivers/net/ethernet/built-in.o
  LD  drivers/net/built-in.o
scripts/Makefile.build:544: recipe for target 'drivers/gpu/drm/i915' failed
make[3]: *** [drivers/gpu/drm/i915] Error 2
scripts/Makefile.build:544: recipe for target 'drivers/gpu/drm' failed
make[2]: *** [drivers/gpu/drm] Error 2
scripts/Makefile.build:544: recipe for target 'drivers/gpu' failed
make[1]: *** [drivers/gpu] Error 2
Makefile:986: recipe for target 'drivers' failed
make: *** [drivers] Error 2

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH 2/2] drm/i915/audio: extend audio sync rate support for DP MST

2016-11-30 Thread libin . yang
From: Libin Yang 

Remove the type judgement in i915_audio_component_sync_audio_rate().
Audio rate sync is necessary for all i915 digital audio now.

Signed-off-by: Libin Yang 
---
 drivers/gpu/drm/i915/intel_audio.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_audio.c 
b/drivers/gpu/drm/i915/intel_audio.c
index c8a1345..3bbc96c 100644
--- a/drivers/gpu/drm/i915/intel_audio.c
+++ b/drivers/gpu/drm/i915/intel_audio.c
@@ -805,9 +805,7 @@ static int i915_audio_component_sync_audio_rate(struct 
device *kdev, int port,
 
/* 1. get the pipe */
intel_encoder = get_saved_enc(dev_priv, port, pipe);
-   if (!intel_encoder || !intel_encoder->base.crtc ||
-   (intel_encoder->type != INTEL_OUTPUT_HDMI &&
-intel_encoder->type != INTEL_OUTPUT_DP)) {
+   if (!intel_encoder || !intel_encoder->base.crtc) {
DRM_DEBUG_KMS("Not valid for port %c\n", port_name(port));
err = -ENODEV;
goto unlock;
-- 
2.7.4

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH 1/2] drm/i915/audio: extend get_saved_enc() to support more scenarios

2016-11-30 Thread libin . yang
From: Libin Yang 

In initialization, audio driver will call functions get_eld() and etc.
But at that time, audio driver may not know whether it is DP MST or not.
In the original function get_saved_enc(), if it is DP MST, it requires to
set the pipe to the correct value, otherwise, pipe to be -1.

Although audio driver can get the knowledge whether it is in DP MST mode
or not by reading the codec register. It will drop performance each time
before it calls the get_eld and other similar functions. As gfx driver can
easily know whether it is in DP MST mode or not. Let's extend the
get_saved_enc() function to handle the situation that audio driver
still sends the device id info even it is in DP SST mode and return
the correct intel_encoder instead of panic.

Signed-off-by: Libin Yang 
---
 drivers/gpu/drm/i915/intel_audio.c | 32 
 1 file changed, 28 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_audio.c 
b/drivers/gpu/drm/i915/intel_audio.c
index 49f1053..c8a1345 100644
--- a/drivers/gpu/drm/i915/intel_audio.c
+++ b/drivers/gpu/drm/i915/intel_audio.c
@@ -737,25 +737,49 @@ static int i915_audio_component_get_cdclk_freq(struct 
device *kdev)
return dev_priv->cdclk_freq;
 }
 
+/*
+ * get the intel_encoder according to the parameter port and pipe
+ * intel_encoder is saved by the index of pipe
+ * MST & (pipe >= 0): return the av_enc_map[pipe],
+ *   when port is matched
+ * MST & (pipe < 0): this is invalid
+ * Non-MST & (pipe >= 0): only pipe = 0 (the first device entry)
+ *   will get the right intel_encoder with port matched
+ * Non-MST & (pipe < 0): get the right intel_encoder with port matched
+ */
 static struct intel_encoder *get_saved_enc(struct drm_i915_private *dev_priv,
   int port, int pipe)
 {
+   struct intel_encoder *encoder;
 
if (WARN_ON(pipe >= I915_MAX_PIPES))
return NULL;
 
/* MST */
-   if (pipe >= 0)
-   return dev_priv->av_enc_map[pipe];
+   if (pipe >= 0) {
+   encoder = dev_priv->av_enc_map[pipe];
+   /*
+* when bootup, audio driver may not know it is
+* MST or not. So it will poll all the port & pipe
+* combinations
+*/
+   if (encoder != NULL && encoder->port == port &&
+   encoder->type == INTEL_OUTPUT_DP_MST)
+   return encoder;
+   }
 
/* Non-MST */
-   for_each_pipe(dev_priv, pipe) {
-   struct intel_encoder *encoder;
+   if (pipe > 0)
+   return NULL;
 
+   for_each_pipe(dev_priv, pipe) {
encoder = dev_priv->av_enc_map[pipe];
if (encoder == NULL)
continue;
 
+   if (encoder->type == INTEL_OUTPUT_DP_MST)
+   continue;
+
if (port == encoder->port)
return encoder;
}
-- 
2.7.4

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] ✗ Fi.CI.BAT: warning for drm: Initialise drm_mm.head_node.allocated

2016-11-30 Thread Patchwork
== Series Details ==

Series: drm: Initialise drm_mm.head_node.allocated
URL   : https://patchwork.freedesktop.org/series/16183/
State : warning

== Summary ==

Series 16183v1 drm: Initialise drm_mm.head_node.allocated
https://patchwork.freedesktop.org/api/1.0/series/16183/revisions/1/mbox/

Test kms_busy:
Subgroup basic-flip-default-a:
skip   -> PASS   (fi-ivb-3770)
Subgroup basic-flip-default-b:
skip   -> PASS   (fi-ivb-3770)
Subgroup basic-flip-default-c:
skip   -> PASS   (fi-ivb-3770)
Test kms_cursor_legacy:
Subgroup basic-busy-flip-before-cursor-legacy:
skip   -> PASS   (fi-ivb-3770)
Subgroup basic-busy-flip-before-cursor-varying-size:
skip   -> PASS   (fi-ivb-3770)
Subgroup basic-flip-after-cursor-legacy:
skip   -> PASS   (fi-ivb-3770)
Subgroup basic-flip-after-cursor-varying-size:
skip   -> PASS   (fi-ivb-3770)
Subgroup basic-flip-before-cursor-legacy:
skip   -> PASS   (fi-ivb-3770)
Subgroup basic-flip-before-cursor-varying-size:
skip   -> PASS   (fi-ivb-3770)
Test kms_force_connector_basic:
Subgroup force-connector-state:
skip   -> PASS   (fi-ivb-3770)
Subgroup force-edid:
skip   -> PASS   (fi-ivb-3770)
Subgroup force-load-detect:
skip   -> PASS   (fi-ivb-3770)
Subgroup prune-stale-modes:
skip   -> PASS   (fi-ivb-3770)
Test kms_pipe_crc_basic:
Subgroup hang-read-crc-pipe-a:
skip   -> PASS   (fi-ivb-3770)
Subgroup nonblocking-crc-pipe-a:
pass   -> DMESG-WARN (fi-ilk-650)
Subgroup suspend-read-crc-pipe-a:
skip   -> PASS   (fi-ivb-3770)
Subgroup suspend-read-crc-pipe-b:
skip   -> PASS   (fi-ivb-3770)
Subgroup suspend-read-crc-pipe-c:
skip   -> PASS   (fi-ivb-3770)
Test prime_vgem:
Subgroup basic-fence-flip:
skip   -> PASS   (fi-ivb-3770)

fi-bdw-5557u total:245  pass:230  dwarn:0   dfail:0   fail:0   skip:15 
fi-bsw-n3050 total:245  pass:205  dwarn:0   dfail:0   fail:0   skip:40 
fi-byt-j1900 total:245  pass:217  dwarn:0   dfail:0   fail:0   skip:28 
fi-byt-n2820 total:245  pass:213  dwarn:0   dfail:0   fail:0   skip:32 
fi-hsw-4770  total:245  pass:225  dwarn:0   dfail:0   fail:0   skip:20 
fi-hsw-4770r total:245  pass:225  dwarn:0   dfail:0   fail:0   skip:20 
fi-ilk-650   total:245  pass:191  dwarn:1   dfail:0   fail:0   skip:53 
fi-ivb-3520m total:245  pass:223  dwarn:0   dfail:0   fail:0   skip:22 
fi-ivb-3770  total:245  pass:223  dwarn:0   dfail:0   fail:0   skip:22 
fi-kbl-7500u total:245  pass:223  dwarn:0   dfail:0   fail:0   skip:22 
fi-skl-6260u total:245  pass:231  dwarn:0   dfail:0   fail:0   skip:14 
fi-skl-6700hqtotal:245  pass:224  dwarn:0   dfail:0   fail:0   skip:21 
fi-skl-6700k total:245  pass:223  dwarn:1   dfail:0   fail:0   skip:21 
fi-skl-6770hqtotal:245  pass:231  dwarn:0   dfail:0   fail:0   skip:14 
fi-snb-2520m total:245  pass:213  dwarn:0   dfail:0   fail:0   skip:32 
fi-snb-2600  total:245  pass:212  dwarn:0   dfail:0   fail:0   skip:33 

51c6c255aa05775bcfb3f5790a3b9249e5990f3e drm-tip: 2016y-11m-30d-16h-12m-19s UTC 
integration manifest
95cfb56 drm: Initialise drm_mm.head_node.allocated

== Logs ==

For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_3154/
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] ✗ Fi.CI.BAT: warning for drm/i915/perf: Treat u64 in uabi as a normal integer

2016-11-30 Thread Patchwork
== Series Details ==

Series: drm/i915/perf: Treat u64 in uabi as a normal integer
URL   : https://patchwork.freedesktop.org/series/16171/
State : warning

== Summary ==

Series 16171v1 drm/i915/perf: Treat u64 in uabi as a normal integer
https://patchwork.freedesktop.org/api/1.0/series/16171/revisions/1/mbox/

Test kms_busy:
Subgroup basic-flip-default-a:
skip   -> PASS   (fi-ivb-3770)
Subgroup basic-flip-default-b:
skip   -> PASS   (fi-ivb-3770)
Subgroup basic-flip-default-c:
skip   -> PASS   (fi-ivb-3770)
Test kms_cursor_legacy:
Subgroup basic-busy-flip-before-cursor-legacy:
skip   -> PASS   (fi-ivb-3770)
Subgroup basic-busy-flip-before-cursor-varying-size:
skip   -> PASS   (fi-ivb-3770)
Subgroup basic-flip-after-cursor-legacy:
skip   -> PASS   (fi-ivb-3770)
Subgroup basic-flip-after-cursor-varying-size:
skip   -> PASS   (fi-ivb-3770)
Subgroup basic-flip-before-cursor-legacy:
skip   -> PASS   (fi-ivb-3770)
Subgroup basic-flip-before-cursor-varying-size:
skip   -> PASS   (fi-ivb-3770)
Test kms_force_connector_basic:
Subgroup force-connector-state:
skip   -> PASS   (fi-ivb-3770)
Subgroup force-edid:
skip   -> PASS   (fi-ivb-3770)
Subgroup force-load-detect:
skip   -> PASS   (fi-ivb-3770)
Subgroup prune-stale-modes:
skip   -> PASS   (fi-ivb-3770)
Test kms_pipe_crc_basic:
Subgroup hang-read-crc-pipe-a:
skip   -> PASS   (fi-ivb-3770)
Subgroup nonblocking-crc-pipe-a:
pass   -> DMESG-WARN (fi-ilk-650)
Subgroup suspend-read-crc-pipe-a:
skip   -> PASS   (fi-ivb-3770)
Subgroup suspend-read-crc-pipe-b:
skip   -> PASS   (fi-ivb-3770)
Subgroup suspend-read-crc-pipe-c:
skip   -> PASS   (fi-ivb-3770)
Test prime_vgem:
Subgroup basic-fence-flip:
skip   -> PASS   (fi-ivb-3770)

fi-bdw-5557u total:245  pass:230  dwarn:0   dfail:0   fail:0   skip:15 
fi-bsw-n3050 total:245  pass:205  dwarn:0   dfail:0   fail:0   skip:40 
fi-bxt-t5700 total:245  pass:217  dwarn:0   dfail:0   fail:0   skip:28 
fi-byt-j1900 total:245  pass:217  dwarn:0   dfail:0   fail:0   skip:28 
fi-byt-n2820 total:245  pass:213  dwarn:0   dfail:0   fail:0   skip:32 
fi-hsw-4770  total:245  pass:225  dwarn:0   dfail:0   fail:0   skip:20 
fi-hsw-4770r total:245  pass:225  dwarn:0   dfail:0   fail:0   skip:20 
fi-ilk-650   total:245  pass:191  dwarn:1   dfail:0   fail:0   skip:53 
fi-ivb-3520m total:245  pass:223  dwarn:0   dfail:0   fail:0   skip:22 
fi-ivb-3770  total:245  pass:223  dwarn:0   dfail:0   fail:0   skip:22 
fi-kbl-7500u total:245  pass:223  dwarn:0   dfail:0   fail:0   skip:22 
fi-skl-6260u total:245  pass:231  dwarn:0   dfail:0   fail:0   skip:14 
fi-skl-6700hqtotal:245  pass:224  dwarn:0   dfail:0   fail:0   skip:21 
fi-skl-6700k total:245  pass:223  dwarn:1   dfail:0   fail:0   skip:21 
fi-skl-6770hqtotal:245  pass:231  dwarn:0   dfail:0   fail:0   skip:14 
fi-snb-2520m total:245  pass:213  dwarn:0   dfail:0   fail:0   skip:32 
fi-snb-2600  total:245  pass:212  dwarn:0   dfail:0   fail:0   skip:33 

51c6c255aa05775bcfb3f5790a3b9249e5990f3e drm-tip: 2016y-11m-30d-16h-12m-19s UTC 
integration manifest
6287239 drm/i915/perf: Treat u64 in uabi as a normal integer

== Logs ==

For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_3153/
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] ✓ Fi.CI.BAT: success for drm/i915: introduce platform enum

2016-11-30 Thread Patchwork
== Series Details ==

Series: drm/i915: introduce platform enum
URL   : https://patchwork.freedesktop.org/series/16170/
State : success

== Summary ==

Series 16170v1 drm/i915: introduce platform enum
https://patchwork.freedesktop.org/api/1.0/series/16170/revisions/1/mbox/

Test kms_busy:
Subgroup basic-flip-default-a:
skip   -> PASS   (fi-ivb-3770)
Subgroup basic-flip-default-b:
skip   -> PASS   (fi-ivb-3770)
Subgroup basic-flip-default-c:
skip   -> PASS   (fi-ivb-3770)
Test kms_cursor_legacy:
Subgroup basic-busy-flip-before-cursor-legacy:
skip   -> PASS   (fi-ivb-3770)
Subgroup basic-busy-flip-before-cursor-varying-size:
skip   -> PASS   (fi-ivb-3770)
Subgroup basic-flip-after-cursor-legacy:
skip   -> PASS   (fi-ivb-3770)
Subgroup basic-flip-after-cursor-varying-size:
skip   -> PASS   (fi-ivb-3770)
Subgroup basic-flip-before-cursor-legacy:
skip   -> PASS   (fi-ivb-3770)
Subgroup basic-flip-before-cursor-varying-size:
skip   -> PASS   (fi-ivb-3770)
Test kms_force_connector_basic:
Subgroup force-connector-state:
skip   -> PASS   (fi-ivb-3770)
Subgroup force-edid:
skip   -> PASS   (fi-ivb-3770)
Subgroup force-load-detect:
skip   -> PASS   (fi-ivb-3770)
Subgroup prune-stale-modes:
skip   -> PASS   (fi-ivb-3770)
Test kms_pipe_crc_basic:
Subgroup hang-read-crc-pipe-a:
skip   -> PASS   (fi-ivb-3770)
Subgroup suspend-read-crc-pipe-a:
skip   -> PASS   (fi-ivb-3770)
Subgroup suspend-read-crc-pipe-b:
skip   -> PASS   (fi-ivb-3770)
Subgroup suspend-read-crc-pipe-c:
skip   -> PASS   (fi-ivb-3770)
Test prime_vgem:
Subgroup basic-fence-flip:
skip   -> PASS   (fi-ivb-3770)

fi-bdw-5557u total:245  pass:230  dwarn:0   dfail:0   fail:0   skip:15 
fi-bsw-n3050 total:245  pass:205  dwarn:0   dfail:0   fail:0   skip:40 
fi-bxt-t5700 total:245  pass:217  dwarn:0   dfail:0   fail:0   skip:28 
fi-byt-j1900 total:245  pass:217  dwarn:0   dfail:0   fail:0   skip:28 
fi-byt-n2820 total:245  pass:213  dwarn:0   dfail:0   fail:0   skip:32 
fi-hsw-4770  total:245  pass:225  dwarn:0   dfail:0   fail:0   skip:20 
fi-hsw-4770r total:245  pass:225  dwarn:0   dfail:0   fail:0   skip:20 
fi-ilk-650   total:245  pass:192  dwarn:0   dfail:0   fail:0   skip:53 
fi-ivb-3520m total:245  pass:223  dwarn:0   dfail:0   fail:0   skip:22 
fi-ivb-3770  total:245  pass:223  dwarn:0   dfail:0   fail:0   skip:22 
fi-kbl-7500u total:245  pass:223  dwarn:0   dfail:0   fail:0   skip:22 
fi-skl-6260u total:245  pass:231  dwarn:0   dfail:0   fail:0   skip:14 
fi-skl-6700hqtotal:245  pass:224  dwarn:0   dfail:0   fail:0   skip:21 
fi-skl-6700k total:245  pass:223  dwarn:1   dfail:0   fail:0   skip:21 
fi-skl-6770hqtotal:245  pass:231  dwarn:0   dfail:0   fail:0   skip:14 
fi-snb-2520m total:245  pass:213  dwarn:0   dfail:0   fail:0   skip:32 
fi-snb-2600  total:245  pass:212  dwarn:0   dfail:0   fail:0   skip:33 

51c6c255aa05775bcfb3f5790a3b9249e5990f3e drm-tip: 2016y-11m-30d-16h-12m-19s UTC 
integration manifest
d1c5027 drm/i915: use platform enum instead of duplicating PCI ID if possible
072a029 drm/i915: give G45 and GM45 their own platform enums
574aacf drm/i915: add some more "i" in platform names for consistency
639d7d4 drm/i915: rename BROADWATER and CRESTLINE to I965G and I965GM, 
respectively
c257e06 drm/i915: keep intel device info structs in gen based order
0a5a287 drm/i915: replace platform flags with a platform enum

== Logs ==

For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_3152/
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] ✗ Fi.CI.BAT: failure for GEM object create and driver init dev_priv cleanups

2016-11-30 Thread Patchwork
== Series Details ==

Series: GEM object create and driver init dev_priv cleanups
URL   : https://patchwork.freedesktop.org/series/16162/
State : failure

== Summary ==

  CC [M]  drivers/gpu/drm/i915/gvt/sched_policy.o
  CC [M]  drivers/gpu/drm/i915/gvt/render.o
  CC [M]  drivers/gpu/drm/i915/gvt/cmd_parser.o
  LD  drivers/base/regmap/built-in.o
  LD  drivers/scsi/scsi_mod.o
  LD  drivers/video/fbdev/core/fb.o
  LD [M]  sound/pci/hda/snd-hda-codec-generic.o
  LD  drivers/video/fbdev/core/built-in.o
  LD  sound/pci/built-in.o
  LD  drivers/iommu/built-in.o
  LD [M]  drivers/net/ethernet/broadcom/genet/genet.o
  LD  lib/raid6/raid6_pq.o
  LD  drivers/acpi/acpica/acpi.o
  LD  drivers/base/power/built-in.o
  LD  lib/raid6/built-in.o
  LD  drivers/usb/storage/usb-storage.o
  LD  drivers/usb/gadget/libcomposite.o
  LD  drivers/usb/storage/built-in.o
  LD  drivers/base/built-in.o
  LD  sound/built-in.o
  LD  drivers/video/fbdev/built-in.o
  LD  drivers/pci/built-in.o
  LD [M]  drivers/misc/mei/mei-me.o
  LD  drivers/acpi/acpica/built-in.o
  LD  drivers/misc/built-in.o
  LD  drivers/tty/serial/8250/8250_base.o
  LD  drivers/spi/built-in.o
  LD  drivers/tty/serial/8250/built-in.o
  LD  drivers/tty/serial/built-in.o
  LD  drivers/thermal/thermal_sys.o
  LD [M]  drivers/usb/serial/usbserial.o
  LD  drivers/acpi/built-in.o
  LD  drivers/thermal/built-in.o
  LD  drivers/usb/gadget/udc/udc-core.o
  LD  drivers/usb/gadget/udc/built-in.o
  LD  drivers/usb/gadget/built-in.o
  LD  drivers/video/console/built-in.o
  LD  drivers/video/built-in.o
  LD  net/ipv6/ipv6.o
  LD [M]  drivers/net/ethernet/intel/igbvf/igbvf.o
  LD  net/ipv6/built-in.o
drivers/gpu/drm/i915/gvt/cmd_parser.c: In function ‘perform_bb_shadow’:
drivers/gpu/drm/i915/gvt/cmd_parser.c:1605:26: error: passing argument 1 of 
‘i915_gem_object_create’ from incompatible pointer type 
[-Werror=incompatible-pointer-types]
   i915_gem_object_create(&(s->vgpu->gvt->dev_priv->drm),
  ^
In file included from drivers/gpu/drm/i915/gvt/cmd_parser.c:38:0:
drivers/gpu/drm/i915/i915_drv.h:2990:1: note: expected ‘struct drm_i915_private 
*’ but argument is of type ‘struct drm_device *’
 i915_gem_object_create(struct drm_i915_private *dev_priv, u64 size);
 ^
drivers/gpu/drm/i915/gvt/cmd_parser.c: In function ‘shadow_indirect_ctx’:
drivers/gpu/drm/i915/gvt/cmd_parser.c:2675:31: error: passing argument 1 of 
‘i915_gem_object_create’ from incompatible pointer type 
[-Werror=incompatible-pointer-types]
  obj = i915_gem_object_create(dev,
   ^
In file included from drivers/gpu/drm/i915/gvt/cmd_parser.c:38:0:
drivers/gpu/drm/i915/i915_drv.h:2990:1: note: expected ‘struct drm_i915_private 
*’ but argument is of type ‘struct drm_device *’
 i915_gem_object_create(struct drm_i915_private *dev_priv, u64 size);
 ^
  LD [M]  drivers/net/ethernet/intel/e1000/e1000.o
  LD  drivers/tty/vt/built-in.o
  LD  drivers/tty/built-in.o
  LD  drivers/scsi/sd_mod.o
  LD  drivers/scsi/built-in.o
  LD  fs/btrfs/btrfs.o
  LD  fs/btrfs/built-in.o
  LD  drivers/usb/core/usbcore.o
  LD  drivers/usb/core/built-in.o
  LD  drivers/usb/host/xhci-hcd.o
  AR  lib/lib.a
  EXPORTS lib/lib-ksyms.o
  LD  net/ipv4/built-in.o
  LD  lib/built-in.o
cc1: all warnings being treated as errors
  CC  arch/x86/kernel/cpu/capflags.o
scripts/Makefile.build:293: recipe for target 
'drivers/gpu/drm/i915/gvt/cmd_parser.o' failed
make[4]: *** [drivers/gpu/drm/i915/gvt/cmd_parser.o] Error 1
make[4]: *** Waiting for unfinished jobs
  LD  arch/x86/kernel/cpu/built-in.o
  LD  arch/x86/kernel/built-in.o
  LD [M]  drivers/net/ethernet/intel/igb/igb.o
  LD  arch/x86/built-in.o
  LD  drivers/md/md-mod.o
  LD  drivers/md/built-in.o
  LD  drivers/usb/host/built-in.o
  LD  drivers/usb/built-in.o
  LD  fs/ext4/ext4.o
  LD  fs/ext4/built-in.o
  LD  fs/built-in.o
  LD  net/core/built-in.o
  LD  net/built-in.o
  LD [M]  drivers/net/ethernet/intel/e1000e/e1000e.o
  LD  drivers/net/ethernet/built-in.o
  LD  drivers/net/built-in.o
scripts/Makefile.build:544: recipe for target 'drivers/gpu/drm/i915' failed
make[3]: *** [drivers/gpu/drm/i915] Error 2
scripts/Makefile.build:544: recipe for target 'drivers/gpu/drm' failed
make[2]: *** [drivers/gpu/drm] Error 2
scripts/Makefile.build:544: recipe for target 'drivers/gpu' failed
make[1]: *** [drivers/gpu] Error 2
Makefile:986: recipe for target 'drivers' failed
make: *** [drivers] Error 2

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 2/2] drm/i915/audio: Extend audio sync rate support for DP MST

2016-11-30 Thread Yang, Libin

>-Original Message-
>From: Jani Nikula [mailto:jani.nik...@linux.intel.com]
>Sent: Wednesday, November 30, 2016 11:52 PM
>To: Yang, Libin ; intel-gfx@lists.freedesktop.org;
>ville.syrj...@linux.intel.com; Vetter, Daniel ;
>Pandiyan, Dhinakaran ; Kp, Jeeja
>; ti...@suse.de
>Subject: RE: [PATCH 2/2] drm/i915/audio: Extend audio sync rate support for
>DP MST
>
>On Wed, 30 Nov 2016, "Yang, Libin"  wrote:
>>>-Original Message-
>>>From: Jani Nikula [mailto:jani.nik...@linux.intel.com]
>>>Sent: Wednesday, November 30, 2016 12:34 AM
>>>To: Yang, Libin ;
>>>intel-gfx@lists.freedesktop.org; ville.syrj...@linux.intel.com;
>>>Vetter, Daniel ; Pandiyan, Dhinakaran
>>>; Kp, Jeeja ;
>>>ti...@suse.de
>>>Cc: Yang, Libin 
>>>Subject: Re: [PATCH 2/2] drm/i915/audio: Extend audio sync rate
>>>support for DP MST
>>>
>>>On Tue, 15 Nov 2016, libin.y...@intel.com wrote:
 From: Libin Yang 

 This patch extends the support of audio sample rate sync up to DP MST.

 Signed-off-by: Libin Yang 
 ---
  drivers/gpu/drm/i915/intel_audio.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

 diff --git a/drivers/gpu/drm/i915/intel_audio.c
 b/drivers/gpu/drm/i915/intel_audio.c
 index c8a1345..88ed869 100644
 --- a/drivers/gpu/drm/i915/intel_audio.c
 +++ b/drivers/gpu/drm/i915/intel_audio.c
 @@ -807,7 +807,8 @@ static int
>>>i915_audio_component_sync_audio_rate(struct device *kdev, int port,
intel_encoder = get_saved_enc(dev_priv, port, pipe);
if (!intel_encoder || !intel_encoder->base.crtc ||
(intel_encoder->type != INTEL_OUTPUT_HDMI &&
 -   intel_encoder->type != INTEL_OUTPUT_DP)) {
 +   intel_encoder->type != INTEL_OUTPUT_DP &&
 +   intel_encoder->type != INTEL_OUTPUT_DP_MST)) {
>>>
>>>I think the better option is to make absolutely sure we never store
>>>other kinds of encoders in dev_priv->av_enc_map[pipe] to begin with. I
>>>think that's true already, but please add
>>>
>>> if (WARN_ON(intel_encoder->type != INTEL_OUTPUT_HDMI &&
>>> intel_encoder->type != INTEL_OUTPUT_DP &&
>>> intel_encoder->type != INTEL_OUTPUT_DP_MST))
>>> return;
>>>
>>>near the beginning of intel_audio_codec_enable(), and remove the type
>>>checks here. This reduces the confusion about different kinds of
>>>checks after calling get_saved_enc().
>>
>> We can't put the check at the beginning of the function.
>> We still need the check in the same place as we need get intel_encoder at
>first.
>
>We do not need to duplicate the checks here if we ensure only good stuff is
>ever put into av_enc_map.

Yes, I agree. I will remove the type judgement.

Regards,
Libin

>
>>
>> Regards,
>> Libin
>>
>>>
>>>BR,
>>>Jani.
>>>
>>>
DRM_DEBUG_KMS("Not valid for port %c\n",
>>>port_name(port));
err = -ENODEV;
goto unlock;
>>>
>>>--
>>>Jani Nikula, Intel Open Source Technology Center
>
>--
>Jani Nikula, Intel Open Source Technology Center
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [RFC i-g-t v3 3/5] igt_kms: Add helpers for watching for sysfs hotplug events

2016-11-30 Thread Lyude
This adds some basic helpers for connecting to udev and watching for
sysfs hotplug events.

Signed-off-by: Lyude 

Changes since v1:
- Remove unused arg from documentation
---
 lib/igt_kms.c | 108 ++
 lib/igt_kms.h |   6 
 2 files changed, 114 insertions(+)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 989704e..ca37c47 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -38,6 +38,10 @@
 #elif HAVE_SYS_KD_H
 #include 
 #endif
+#ifdef HAVE_UDEV
+#include 
+#include 
+#endif
 #include 
 #include 
 
@@ -2760,6 +2764,110 @@ void igt_reset_connectors(void)
  "detect");
 }
 
+#ifdef HAVE_UDEV
+static struct udev_monitor *hotplug_mon;
+
+/**
+ * igt_watch_hotplug:
+ *
+ * Begin monitoring udev for hotplug events.
+ */
+void igt_watch_hotplug(void)
+{
+   struct udev *udev;
+   int ret, flags, fd;
+
+   if (hotplug_mon)
+   igt_cleanup_hotplug();
+
+   udev = udev_new();
+   igt_assert(udev != NULL);
+
+   hotplug_mon = udev_monitor_new_from_netlink(udev, "udev");
+   igt_assert(hotplug_mon != NULL);
+
+   ret = udev_monitor_filter_add_match_subsystem_devtype(hotplug_mon,
+ "drm",
+ "drm_minor");
+   igt_assert_eq(ret, 0);
+   ret = udev_monitor_filter_update(hotplug_mon);
+   igt_assert_eq(ret, 0);
+   ret = udev_monitor_enable_receiving(hotplug_mon);
+   igt_assert_eq(ret, 0);
+
+   /* Set the fd for udev as non blocking */
+   fd = udev_monitor_get_fd(hotplug_mon);
+   flags = fcntl(fd, F_GETFL, 0);
+   igt_assert(flags);
+
+   flags |= O_NONBLOCK;
+   igt_assert_neq(fcntl(fd, F_SETFL, flags), -1);
+}
+
+/**
+ * igt_hotplug_detected:
+ * @timeout_secs: How long to wait for a hotplug event to occur.
+ *
+ * Assert that a hotplug event was received since we last checked the monitor.
+ *
+ * Returns: true if a sysfs hotplug event was received, false if we timed out
+ */
+bool igt_hotplug_detected(int timeout_secs)
+{
+   struct udev_device *dev;
+   const char *hotplug_val;
+   struct pollfd fd = {
+   .fd = udev_monitor_get_fd(hotplug_mon),
+   .events = POLLIN
+   };
+   bool hotplug_received = false;
+
+   /* Go through all of the events pending on the udev monitor. Once we
+* receive a hotplug, we continue going through the rest of the events
+* so that redundant hotplug events don't change the results of future
+* checks
+*/
+   while (!hotplug_received && poll(, 1, timeout_secs * 1000)) {
+   dev = udev_monitor_receive_device(hotplug_mon);
+
+   hotplug_val = udev_device_get_property_value(dev, "HOTPLUG");
+   if (hotplug_val && atoi(hotplug_val) == 1)
+   hotplug_received = true;
+
+   udev_device_unref(dev);
+   }
+
+   return hotplug_received;
+}
+
+/**
+ * igt_flush_hotplugs:
+ *
+ * Get rid of any pending hotplug events
+ */
+void igt_flush_hotplugs(void)
+{
+   struct udev_device *dev;
+
+   while ((dev = udev_monitor_receive_device(hotplug_mon)))
+   udev_device_unref(dev);
+}
+
+/**
+ * igt_cleanup_hotplug:
+ *
+ * Cleanup the resources allocated by #igt_watch_hotplug
+ */
+void igt_cleanup_hotplug(void)
+{
+   struct udev *udev = udev_monitor_get_udev(hotplug_mon);
+
+   udev_monitor_unref(hotplug_mon);
+   hotplug_mon = NULL;
+   udev_unref(udev);
+}
+#endif
+
 /**
  * kmstest_get_vbl_flag:
  * @pipe_id: Pipe to convert to flag representation.
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index 6422adc..95395cd 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -479,5 +479,11 @@ uint32_t kmstest_get_vbl_flag(uint32_t pipe_id);
 const unsigned char* igt_kms_get_base_edid(void);
 const unsigned char* igt_kms_get_alt_edid(void);
 
+#ifdef HAVE_UDEV
+void igt_watch_hotplug(void);
+bool igt_hotplug_detected(int timeout_secs);
+void igt_flush_hotplugs(void);
+void igt_cleanup_hotplug(void);
+#endif
 
 #endif /* __IGT_KMS_H__ */
-- 
2.9.3

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [RFC i-g-t v3 2/5] igt_aux: Add igt_set_autoresume_delay()

2016-11-30 Thread Lyude
The default autoresume delay is about 5 seconds. It's possible on a
system that's not very fast this might not be a long enough time, since
an asynchronous hotplug event we scheduled on the chamelium that was
intended to happen during suspend could happen before we actually manage
to suspend. So, add a function that allows us to increase the autoresume
time to ensure this never happens during suspend/resume tests with the
chamelium.

Signed-off-by: Lyude 

Changes since v1:
- Use igt_require, not assert
---
 lib/igt_aux.c | 46 ++
 lib/igt_aux.h |  1 +
 2 files changed, 47 insertions(+)

diff --git a/lib/igt_aux.c b/lib/igt_aux.c
index ce2f245..babec57 100644
--- a/lib/igt_aux.c
+++ b/lib/igt_aux.c
@@ -801,6 +801,52 @@ void igt_system_suspend_autoresume(enum igt_suspend_state 
state,
close(power_dir);
 }
 
+static int original_autoresume_delay;
+
+static void igt_restore_autoresume_delay(int sig)
+{
+   int delay_fd;
+   char delay_str[10];
+
+   igt_require((delay_fd = 
open("/sys/module/suspend/parameters/pm_test_delay",
+   O_WRONLY)) >= 0);
+
+   snprintf(delay_str, sizeof(delay_str), "%d", original_autoresume_delay);
+   igt_require(write(delay_fd, delay_str, strlen(delay_str)));
+
+   close(delay_fd);
+}
+
+/**
+ * igt_set_autoresume_delay:
+ * @delay_secs: The delay in seconds before resuming the system
+ *
+ * Sets how long we wait to resume the system after suspending it, using the
+ * suspend.pm_test_delay variable. On exit, the original delay value is
+ * restored.
+ */
+void igt_set_autoresume_delay(int delay_secs)
+{
+   int delay_fd;
+   char delay_str[10];
+
+   igt_skip_on_simulation();
+
+   igt_require((delay_fd = 
open("/sys/module/suspend/parameters/pm_test_delay",
+   O_RDWR)) >= 0);
+
+   if (!original_autoresume_delay) {
+   igt_require(read(delay_fd, delay_str, sizeof(delay_str)));
+   original_autoresume_delay = atoi(delay_str);
+   igt_install_exit_handler(igt_restore_autoresume_delay);
+   }
+
+   snprintf(delay_str, sizeof(delay_str), "%d", delay_secs);
+   igt_require(write(delay_fd, delay_str, strlen(delay_str)));
+
+   close(delay_fd);
+}
+
 /**
  * igt_drop_root:
  *
diff --git a/lib/igt_aux.h b/lib/igt_aux.h
index 41903c2..2c58abc 100644
--- a/lib/igt_aux.h
+++ b/lib/igt_aux.h
@@ -185,6 +185,7 @@ void igt_skip_without_suspend_support(enum 
igt_suspend_state state,
  enum igt_suspend_test test);
 void igt_system_suspend_autoresume(enum igt_suspend_state state,
   enum igt_suspend_test test);
+void igt_set_autoresume_delay(int delay_secs);
 
 /* dropping priviledges */
 void igt_drop_root(void);
-- 
2.9.3

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [RFC i-g-t v3 0/5] Add support for the Chamelium

2016-11-30 Thread Lyude
Latest version of my series for adding Chamelium

Major changes:
- Since I finally figured out why Video capturing wasn't working on my
  Chamelium, add the rest of the CRC functions and fix some of the existing
  ones
- Doc fixes

Lyude (5):
  igt_aux: Add igt_skip_without_suspend_support()
  igt_aux: Add igt_set_autoresume_delay()
  igt_kms: Add helpers for watching for sysfs hotplug events
  igt_debugfs: Make igt_crc_to_string() work with other CRC types
  Add support for hotplug testing with the Chamelium

 configure.ac   |  13 +
 .../intel-gpu-tools/intel-gpu-tools-docs.xml   |   1 +
 lib/Makefile.am|   4 +-
 lib/Makefile.sources   |  10 +-
 lib/igt.h  |   4 +
 lib/igt_aux.c  |  67 ++
 lib/igt_aux.h  |   3 +
 lib/igt_chamelium.c| 849 +
 lib/igt_chamelium.h|  73 ++
 lib/igt_debugfs.c  |  15 +-
 lib/igt_kms.c  | 108 +++
 lib/igt_kms.h  |   6 +
 scripts/run-tests.sh   |   4 +-
 tests/Makefile.am  |   5 +-
 tests/Makefile.sources |   9 +-
 tests/chamelium.c  | 407 ++
 16 files changed, 1566 insertions(+), 12 deletions(-)
 create mode 100644 lib/igt_chamelium.c
 create mode 100644 lib/igt_chamelium.h
 create mode 100644 tests/chamelium.c

-- 
2.9.3

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [RFC i-g-t v3 1/5] igt_aux: Add igt_skip_without_suspend_support()

2016-11-30 Thread Lyude
Since all of the chamelium calls are blocking, we need to be able to
make suspend/resume tests with it multi-threaded. As such, it's not the
best idea to rely on igt_system_suspend_autoresume() for skipping tests
on systems without suspend/resume support since we could accidentally
leave the thread controlling the chamelium running after the test gets
skipped.

Signed-off-by: Lyude 
---
 lib/igt_aux.c | 21 +
 lib/igt_aux.h |  2 ++
 2 files changed, 23 insertions(+)

diff --git a/lib/igt_aux.c b/lib/igt_aux.c
index b5ae854..ce2f245 100644
--- a/lib/igt_aux.c
+++ b/lib/igt_aux.c
@@ -732,6 +732,27 @@ static uint32_t get_supported_suspend_states(int power_dir)
 }
 
 /**
+ * igt_skip_without_suspend_state:
+ * @state: an #igt_suspend_state to check for
+ *
+ * Check whether or not the system supports the given @state, and skip the
+ * current test if it doesn't. Useful for tests we want to skip before
+ * attempting to call #igt_system_suspend_autoresume.
+ */
+void igt_skip_without_suspend_support(enum igt_suspend_state state,
+ enum igt_suspend_test test)
+{
+   int power_dir;
+
+   igt_require((power_dir = open("/sys/power", O_RDONLY)) >= 0);
+   igt_require(get_supported_suspend_states(power_dir) & (1 << state));
+   igt_require(test == SUSPEND_TEST_NONE ||
+   faccessat(power_dir, "pm_test", R_OK | W_OK, 0) == 0);
+
+   close(power_dir);
+}
+
+/**
  * igt_system_suspend_autoresume:
  * @state: an #igt_suspend_state, the target suspend state
  * @test: an #igt_suspend_test, test point at which to complete the suspend
diff --git a/lib/igt_aux.h b/lib/igt_aux.h
index 177bd1d..41903c2 100644
--- a/lib/igt_aux.h
+++ b/lib/igt_aux.h
@@ -181,6 +181,8 @@ enum igt_suspend_test {
SUSPEND_TEST_NUM,
 };
 
+void igt_skip_without_suspend_support(enum igt_suspend_state state,
+ enum igt_suspend_test test);
 void igt_system_suspend_autoresume(enum igt_suspend_state state,
   enum igt_suspend_test test);
 
-- 
2.9.3

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [RFC i-g-t v3 4/5] igt_debugfs: Make igt_crc_to_string() work with other CRC types

2016-11-30 Thread Lyude
Intel GPUs have CRC values with 5 n_words, but the Chamelium's definitely
doesn't. So make igt_crc_to_string() a little smarter so it can handle this.

Signed-off-by: Lyude 
---
 lib/igt_debugfs.c | 15 +++
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c
index 9142e3f..4809b73 100644
--- a/lib/igt_debugfs.c
+++ b/lib/igt_debugfs.c
@@ -290,11 +290,18 @@ void igt_assert_crc_equal(igt_crc_t *a, igt_crc_t *b)
 char *igt_crc_to_string(igt_crc_t *crc)
 {
char buf[128];
+   char *p;
+   int i, len;
+
+   for (i = 0, p = buf;
+i < crc->n_words;
+i++, p += len) {
+   snprintf(p, sizeof(buf) - (p - buf), "%08x %n",
+crc->crc[i], );
+   }
 
-   igt_assert_eq(crc->n_words, 5);
-
-   sprintf(buf, "%08x %08x %08x %08x %08x", crc->crc[0],
-   crc->crc[1], crc->crc[2], crc->crc[3], crc->crc[4]);
+   /* Strip the trailing space */
+   *strrchr(buf, ' ') = '\0';
 
return strdup(buf);
 }
-- 
2.9.3

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [RFC i-g-t v3 5/5] Add support for hotplug testing with the Chamelium

2016-11-30 Thread Lyude
For the purpose of testing things such as hotplugging and bad monitors,
the ChromeOS team ended up designing a neat little device known as the
Chamelium. More information on this can be found here:

https://www.chromium.org/chromium-os/testing/chamelium

This adds support for a couple of things to intel-gpu-tools:
 - igt library functions for connecting to udev and monitoring it for
   hotplug events, loosely based off of the unfinished hotplugging
   implementation in testdisplay
 - Library functions for controlling the chamelium in tests using
   xmlrpc. A couple of RPC calls were ommitted here, mainly because they
   didn't seem very useful for our needs (yet)
 - A set of basic tests using the chamelium.

Signed-off-by: Lyude 

Changes since v1:
- Don't try to guess connector mappings, have the user specify them
  manually using a configuration file
- Open DRM fd using DRIVER_ANY, not DRIVER_INTEL
- Lower the hotplug timeout a little bit, since 30 seconds was leftover
  from debugging these tests anyway
- Don't try to keep track of the original state of the chamelium ports,
  and just leave them plugged in after each run. This makes more sense
  to me, since I'd imagine in automated testing setups using chameliums
  that all of the extra monitors will probably be provided by the
  Chamelium to begin with, so keeping them plugged in would make sure
  tests running afterwards that require >1 monitor don't get skipped.
- Add wait_for_connector() to the chamelium tests. After some more
  testing, I found that depending on the system some tests would throw
  false negatives due to us not waiting long enough for the system to
  detect that we connected something to it. This mainly happened with
  VGA connectors, since their lack of HPD makes them take significantly
  longer for the hardware to notice. wait_for_connector() fixes this by
  continually reprobing the status of the desired connector (without
  relying on a hpd event happening, since that might never come) until
  we get what we want, or we time out and fail.
- Use kmstest_get_property() for retrieving EDIDs instead of doing it by
  hand
- Don't hardcode PIPE_A for bringing up the display, use kmstest to find
  an appropriate CRTC to use.
Changes since v2:
- Fix incorrect usage of the list helpers when recording new EDIDs
- Add missing documentation
- Make sure documentation actually appears
- Since we finally got video capture working, add CRC functions and fix
  the ones we couldn't actually test before
- In the exit handler, reset the xmlrpc env so we can properly reset the
  Chamelium even after an RPC error
- Make sure compiling without Chamelium support still works
---
 configure.ac   |  13 +
 .../intel-gpu-tools/intel-gpu-tools-docs.xml   |   1 +
 lib/Makefile.am|   4 +-
 lib/Makefile.sources   |  10 +-
 lib/igt.h  |   4 +
 lib/igt_chamelium.c| 849 +
 lib/igt_chamelium.h|  73 ++
 scripts/run-tests.sh   |   4 +-
 tests/Makefile.am  |   5 +-
 tests/Makefile.sources |   9 +-
 tests/chamelium.c  | 407 ++
 11 files changed, 1371 insertions(+), 8 deletions(-)
 create mode 100644 lib/igt_chamelium.c
 create mode 100644 lib/igt_chamelium.h
 create mode 100644 tests/chamelium.c

diff --git a/configure.ac b/configure.ac
index b62b8fc..1920609 100644
--- a/configure.ac
+++ b/configure.ac
@@ -263,6 +263,18 @@ if test "x$with_libunwind" = xyes; then
  AC_MSG_ERROR([libunwind not found. Use 
--without-libunwind to disable libunwind support.]))
 fi
 
+# enable support for using the chamelium
+AC_ARG_ENABLE(chamelium,
+ AS_HELP_STRING([--disable-chamelium],
+[Build tests without chamelium support]),
+ [], [enable_chamelium=yes])
+
+AM_CONDITIONAL(HAVE_CHAMELIUM, [test "x$enable_chamelium" = xyes])
+if test "x$enable_chamelium" = xyes; then
+   AC_DEFINE(HAVE_CHAMELIUM, 1, [chamelium suport])
+   PKG_CHECK_MODULES(XMLRPC, xmlrpc_client)
+fi
+
 # enable debug symbols
 AC_ARG_ENABLE(debug,
  AS_HELP_STRING([--disable-debug],
@@ -360,6 +372,7 @@ echo "   Assembler  : ${enable_assembler}"
 echo "   Debugger   : ${enable_debugger}"
 echo "   Overlay: X: ${enable_overlay_xlib}, Xv: 
${enable_overlay_xvlib}"
 echo "   x86-specific tools : ${build_x86}"
+echo "   Chamelium support  : ${enable_chamelium}"
 echo ""
 echo " • API-Documentation  : ${enable_gtk_doc}"
 echo " • Fail on warnings   : ${enable_werror}"
diff --git a/docs/reference/intel-gpu-tools/intel-gpu-tools-docs.xml 
b/docs/reference/intel-gpu-tools/intel-gpu-tools-docs.xml
index 

[Intel-gfx] [PATCH 2/8] drm/i915/huc: Unified css_header struct for GuC and HuC

2016-11-30 Thread Anusha Srivatsa
From: Peter Antoine 

HuC firmware css header has almost exactly same definition as GuC
firmware except for the sw_version. Also, add a new member fw_type
into intel_uc_fw to indicate what kind of fw it is. So, the loader
will pull right sw_version from header.

v2: rebased on-top of drm-intel-nightly
v3: rebased on-top of drm-intel-nightly (again).
v4: rebased + spaces.
v7: rebased.
v8: rebased.
v9: rebased. Rename device_id to guc_branch_client_version,
make guc_sw_version a union. . Put UC_FW_TYPE_GUC
and UC_FW_TYPE_HUC into an enum.
v10: rebased.
v11: rebased.
v12: rebased on top of drm-tip.

Tested-by: Xiang Haihao 
Signed-off-by: Anusha Srivatsa 
Signed-off-by: Alex Dai 
Signed-off-by: Peter Antoine 
Reviewed-by: Dave Gordon 
Reviewed-by: Jeff McGee 
---
 drivers/gpu/drm/i915/intel_guc_fwif.h   | 21 +
 drivers/gpu/drm/i915/intel_guc_loader.c | 41 ++---
 drivers/gpu/drm/i915/intel_uc.h |  5 
 3 files changed, 50 insertions(+), 17 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_guc_fwif.h 
b/drivers/gpu/drm/i915/intel_guc_fwif.h
index 00ca0df..c07d9da 100644
--- a/drivers/gpu/drm/i915/intel_guc_fwif.h
+++ b/drivers/gpu/drm/i915/intel_guc_fwif.h
@@ -154,7 +154,7 @@
  * The GuC firmware layout looks like this:
  *
  * +---+
- * |guc_css_header |
+ * | uc_css_header |
  * |   |
  * | contains major/minor version  |
  * +---+
@@ -181,9 +181,16 @@
  * 3. Length info of each component can be found in header, in dwords.
  * 4. Modulus and exponent key are not required by driver. They may not appear
  *in fw. So driver will load a truncated firmware in this case.
+ *
+ * HuC firmware layout is same as GuC firmware.
+ *
+ * HuC firmware css header is different. However, the only difference is where
+ * the version information is saved. The uc_css_header is unified to support
+ * both. Driver should get HuC version from uc_css_header.huc_sw_version, while
+ * uc_css_header.guc_sw_version for GuC.
  */
 
-struct guc_css_header {
+struct uc_css_header {
uint32_t module_type;
/* header_size includes all non-uCode bits, including css_header, rsa
 * key, modulus key and exponent data. */
@@ -214,8 +221,14 @@ struct guc_css_header {
 
char username[8];
char buildnumber[12];
-   uint32_t device_id;
-   uint32_t guc_sw_version;
+   union {
+   uint32_t guc_branch_client_version;
+   uint32_t huc_sw_version;
+   };
+   union {
+   uint32_t guc_sw_version;
+   uint32_t huc_reserved;
+   };
uint32_t prod_preprod_fw;
uint32_t reserved[12];
uint32_t header_info;
diff --git a/drivers/gpu/drm/i915/intel_guc_loader.c 
b/drivers/gpu/drm/i915/intel_guc_loader.c
index e55ec2c..557d4b4 100644
--- a/drivers/gpu/drm/i915/intel_guc_loader.c
+++ b/drivers/gpu/drm/i915/intel_guc_loader.c
@@ -593,7 +593,7 @@ void intel_uc_fw_fetch(struct drm_device *dev, struct 
intel_uc_fw *uc_fw)
struct pci_dev *pdev = dev->pdev;
struct drm_i915_gem_object *obj;
const struct firmware *fw = NULL;
-   struct guc_css_header *css;
+   struct uc_css_header *css;
size_t size;
int err;
 
@@ -610,19 +610,19 @@ void intel_uc_fw_fetch(struct drm_device *dev, struct 
intel_uc_fw *uc_fw)
uc_fw->uc_fw_path, fw);
 
/* Check the size of the blob before examining buffer contents */
-   if (fw->size < sizeof(struct guc_css_header)) {
+   if (fw->size < sizeof(struct uc_css_header)) {
DRM_NOTE("Firmware header is missing\n");
goto fail;
}
 
-   css = (struct guc_css_header *)fw->data;
+   css = (struct uc_css_header *)fw->data;
 
/* Firmware bits always start from header */
uc_fw->header_offset = 0;
uc_fw->header_size = (css->header_size_dw - css->modulus_size_dw -
css->key_size_dw - css->exponent_size_dw) * sizeof(u32);
 
-   if (uc_fw->header_size != sizeof(struct guc_css_header)) {
+   if (uc_fw->header_size != sizeof(struct uc_css_header)) {
DRM_NOTE("CSS header definition mismatch\n");
goto fail;
}
@@ -646,21 +646,36 @@ void intel_uc_fw_fetch(struct drm_device *dev, struct 
intel_uc_fw *uc_fw)
goto fail;
}
 
-   /* Header and uCode will be loaded to WOPCM. Size of the two. */
-   size = uc_fw->header_size + uc_fw->ucode_size;
-   if (size > guc_wopcm_size(to_i915(dev))) {
-   DRM_NOTE("Firmware is too large to fit in WOPCM\n");
-   goto fail;
-   }
-
/*
 * The GuC firmware 

[Intel-gfx] [PATCH 6/8] drm/i915/huc: Add debugfs for HuC loading status check

2016-11-30 Thread Anusha Srivatsa
From: Peter Antoine 

Add debugfs entry for HuC loading status check.

v2: rebase on-top of drm-intel-nightly.
v3: rebased again.
v7: rebased.
v8: rebased.
v9: rebased.
v10: rebased.
v11: rebased on top of drm-tip

Tested-by: Xiang Haihao 
Signed-off-by: Anusha Srivatsa 
Signed-off-by: Alex Dai 
Signed-off-by: Peter Antoine 
Reviewed-by: Dave Gordon 
Reviewed-by: Jeff McGee 
---
 drivers/gpu/drm/i915/i915_debugfs.c | 31 +++
 1 file changed, 31 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_debugfs.c 
b/drivers/gpu/drm/i915/i915_debugfs.c
index d6efda9..1cc4682 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -2334,6 +2334,36 @@ static int i915_llc(struct seq_file *m, void *data)
return 0;
 }
 
+static int i915_huc_load_status_info(struct seq_file *m, void *data)
+{
+   struct drm_i915_private *dev_priv = node_to_i915(m->private);
+   struct intel_uc_fw *huc_fw = _priv->huc.huc_fw;
+
+   if (!HAS_HUC_UCODE(dev_priv))
+   return 0;
+
+   seq_puts(m, "HuC firmware status:\n");
+   seq_printf(m, "\tpath: %s\n", huc_fw->uc_fw_path);
+   seq_printf(m, "\tfetch: %s\n",
+   intel_uc_fw_status_repr(huc_fw->fetch_status));
+   seq_printf(m, "\tload: %s\n",
+   intel_uc_fw_status_repr(huc_fw->load_status));
+   seq_printf(m, "\tversion wanted: %d.%d\n",
+   huc_fw->major_ver_wanted, huc_fw->minor_ver_wanted);
+   seq_printf(m, "\tversion found: %d.%d\n",
+   huc_fw->major_ver_found, huc_fw->minor_ver_found);
+   seq_printf(m, "\theader: offset is %d; size = %d\n",
+   huc_fw->header_offset, huc_fw->header_size);
+   seq_printf(m, "\tuCode: offset is %d; size = %d\n",
+   huc_fw->ucode_offset, huc_fw->ucode_size);
+   seq_printf(m, "\tRSA: offset is %d; size = %d\n",
+   huc_fw->rsa_offset, huc_fw->rsa_size);
+
+   seq_printf(m, "\nHuC status 0x%08x:\n", I915_READ(HUC_STATUS2));
+
+   return 0;
+}
+
 static int i915_guc_load_status_info(struct seq_file *m, void *data)
 {
struct drm_i915_private *dev_priv = node_to_i915(m->private);
@@ -5402,6 +5432,7 @@ static const struct drm_info_list i915_debugfs_list[] = {
{"i915_guc_info", i915_guc_info, 0},
{"i915_guc_load_status", i915_guc_load_status_info, 0},
{"i915_guc_log_dump", i915_guc_log_dump, 0},
+   {"i915_huc_load_status", i915_huc_load_status_info, 0},
{"i915_frequency_info", i915_frequency_info, 0},
{"i915_hangcheck_info", i915_hangcheck_info, 0},
{"i915_drpc_info", i915_drpc_info, 0},
-- 
2.7.4

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH 4/8] drm/i915/huc: Add BXT HuC Loading Support

2016-11-30 Thread Anusha Srivatsa
This patch adds the HuC Loading for the BXT by using
the updated file construction.

Version 1.7 of the HuC firmware.

v2: rebased.
v3: rebased on top of drm-tip

Cc: Jeff Mcgee 
Signed-off-by: Anusha Srivatsa 
Reviewed-by: Jeff McGee 
---
 drivers/gpu/drm/i915/intel_huc_loader.c | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_huc_loader.c 
b/drivers/gpu/drm/i915/intel_huc_loader.c
index 663fcc4..6357c19 100644
--- a/drivers/gpu/drm/i915/intel_huc_loader.c
+++ b/drivers/gpu/drm/i915/intel_huc_loader.c
@@ -40,6 +40,10 @@
  * Note that HuC firmware loading must be done before GuC loading.
  */
 
+#define BXT_FW_MAJOR 01
+#define BXT_FW_MINOR 07
+#define BXT_BLD_NUM 1398
+
 #define SKL_FW_MAJOR 01
 #define SKL_FW_MINOR 07
 #define SKL_BLD_NUM 1398
@@ -52,6 +56,9 @@
SKL_FW_MINOR, SKL_BLD_NUM)
 MODULE_FIRMWARE(I915_SKL_HUC_UCODE);
 
+#define I915_BXT_HUC_UCODE HUC_FW_PATH(bxt, BXT_FW_MAJOR, \
+   BXT_FW_MINOR, BXT_BLD_NUM)
+MODULE_FIRMWARE(I915_BXT_HUC_UCODE);
 /**
  * huc_ucode_xfer() - DMA's the firmware
  * @dev_priv: the drm device
@@ -159,6 +166,10 @@ void intel_huc_init(struct drm_device *dev)
fw_path = I915_SKL_HUC_UCODE;
huc_fw->major_ver_wanted = SKL_FW_MAJOR;
huc_fw->minor_ver_wanted = SKL_FW_MINOR;
+   } else if (IS_BROXTON(dev_priv)) {
+   fw_path = I915_BXT_HUC_UCODE;
+   huc_fw->major_ver_wanted = BXT_FW_MAJOR;
+   huc_fw->minor_ver_wanted = BXT_FW_MINOR;
}
 
huc_fw->uc_fw_path = fw_path;
-- 
2.7.4

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH 8/8] drm/i915/get_params: Add HuC status to getparams

2016-11-30 Thread Anusha Srivatsa
From: Peter Antoine 

This patch will allow for getparams to return the status of the HuC.
As the HuC has to be validated by the GuC this patch uses the validated
status to show when the HuC is loaded and ready for use. You cannot use
the loaded status as with the GuC as the HuC is verified after it is
loaded and is not usable until it is verified.

v2: removed the forewakes as the registers are already force-woken.
 (T.Ursulin)
v4: rebased.
v5: rebased on top of drm-tip.

Signed-off-by: Peter Antoine 
---
 drivers/gpu/drm/i915/i915_drv.c |  5 +
 drivers/gpu/drm/i915/intel_huc.h|  1 +
 drivers/gpu/drm/i915/intel_huc_loader.c | 12 
 include/uapi/drm/i915_drm.h |  1 +
 4 files changed, 19 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 075d9ce..75a3e24 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -49,6 +49,8 @@
 #include "i915_trace.h"
 #include "i915_vgpu.h"
 #include "intel_drv.h"
+#include "intel_uc.h"
+#include "intel_huc.h"
 
 static struct drm_driver driver;
 
@@ -350,6 +352,9 @@ static int i915_getparam(struct drm_device *dev, void *data,
 */
value = 1;
break;
+   case I915_PARAM_HAS_HUC:
+   value = intel_is_huc_valid(dev_priv);
+   break;
default:
DRM_DEBUG("Unknown parameter %d\n", param->param);
return -EINVAL;
diff --git a/drivers/gpu/drm/i915/intel_huc.h b/drivers/gpu/drm/i915/intel_huc.h
index 1dd18c5..1b67311 100644
--- a/drivers/gpu/drm/i915/intel_huc.h
+++ b/drivers/gpu/drm/i915/intel_huc.h
@@ -39,4 +39,5 @@ struct intel_huc {
 void intel_huc_init(struct drm_device *dev);
 void intel_huc_fini(struct drm_device *dev);
 int intel_huc_load(struct drm_device *dev);
+int intel_is_huc_valid(struct drm_i915_private *dev_priv);
 #endif
diff --git a/drivers/gpu/drm/i915/intel_huc_loader.c 
b/drivers/gpu/drm/i915/intel_huc_loader.c
index 20526a4..e18de0f6 100644
--- a/drivers/gpu/drm/i915/intel_huc_loader.c
+++ b/drivers/gpu/drm/i915/intel_huc_loader.c
@@ -292,3 +292,15 @@ void intel_huc_fini(struct drm_device *dev)
huc_fw->fetch_status = UC_FIRMWARE_NONE;
 }
 
+/**
+ * intel_is_huc_valid() - Check to see if the HuC is fully loaded.
+ * @dev_priv:  drm device to check.
+ *
+ * This function will return true if the guc has been loaded and
+ * has valid firmware. The simplest way of doing this is to check
+ * if the HuC has been validated, if so it must have been loaded.
+ */
+int intel_is_huc_valid(struct drm_i915_private *dev_priv)
+{
+   return ((I915_READ(HUC_STATUS2) & HUC_FW_VERIFIED) != 0);
+}
diff --git a/include/uapi/drm/i915_drm.h b/include/uapi/drm/i915_drm.h
index bdfc688..397b47d 100644
--- a/include/uapi/drm/i915_drm.h
+++ b/include/uapi/drm/i915_drm.h
@@ -395,6 +395,7 @@ typedef struct drm_i915_irq_wait {
  * priorities and the driver will attempt to execute batches in priority order.
  */
 #define I915_PARAM_HAS_SCHEDULER41
+#define I915_PARAM_HAS_HUC  42
 
 typedef struct drm_i915_getparam {
__s32 param;
-- 
2.7.4

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH 5/8] drm/i915/HuC: Add KBL huC loading Support

2016-11-30 Thread Anusha Srivatsa
This patch adds the support to load HuC on KBL
Version 2.0

v2: rebased.
v3: rebased on top of drm-tip

Cc: Jeff Mcgee 
Signed-off-by: Anusha Srivatsa 
Reviewed-by: Jeff McGee 
---
 drivers/gpu/drm/i915/intel_huc_loader.c | 16 
 1 file changed, 16 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_huc_loader.c 
b/drivers/gpu/drm/i915/intel_huc_loader.c
index 6357c19..20526a4 100644
--- a/drivers/gpu/drm/i915/intel_huc_loader.c
+++ b/drivers/gpu/drm/i915/intel_huc_loader.c
@@ -48,6 +48,10 @@
 #define SKL_FW_MINOR 07
 #define SKL_BLD_NUM 1398
 
+#define KBL_FW_MAJOR 02
+#define KBL_FW_MINOR 00
+#define KBL_BLD_NUM 1810
+
 #define HUC_FW_PATH(platform, major, minor, bld_num) \
"i915/" __stringify(platform) "_huc_ver" __stringify(major) "_" \
__stringify(minor) "_" __stringify(bld_num) ".bin"
@@ -59,6 +63,11 @@ MODULE_FIRMWARE(I915_SKL_HUC_UCODE);
 #define I915_BXT_HUC_UCODE HUC_FW_PATH(bxt, BXT_FW_MAJOR, \
BXT_FW_MINOR, BXT_BLD_NUM)
 MODULE_FIRMWARE(I915_BXT_HUC_UCODE);
+
+#define I915_KBL_HUC_UCODE HUC_FW_PATH(kbl, KBL_FW_MAJOR, \
+   KBL_FW_MINOR, KBL_BLD_NUM)
+MODULE_FIRMWARE(I915_KBL_HUC_UCODE);
+
 /**
  * huc_ucode_xfer() - DMA's the firmware
  * @dev_priv: the drm device
@@ -170,8 +179,15 @@ void intel_huc_init(struct drm_device *dev)
fw_path = I915_BXT_HUC_UCODE;
huc_fw->major_ver_wanted = BXT_FW_MAJOR;
huc_fw->minor_ver_wanted = BXT_FW_MINOR;
+   } else if (IS_KABYLAKE(dev_priv)) {
+   fw_path = I915_KBL_HUC_UCODE;
+   huc_fw->major_ver_wanted = KBL_FW_MAJOR;
+   huc_fw->minor_ver_wanted = KBL_FW_MINOR;
}
 
+   if (fw_path == NULL)
+   return;
+
huc_fw->uc_fw_path = fw_path;
huc_fw->fetch_status = UC_FIRMWARE_PENDING;
 
-- 
2.7.4

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH 7/8] drm/i915/huc: Support HuC authentication

2016-11-30 Thread Anusha Srivatsa
From: Peter Antoine 

The HuC authentication is done by host2guc call. The HuC RSA keys
are sent to GuC for authentication.

v2: rebased on top of drm-intel-nightly.
changed name format and upped version 1.7.
v3: rebased on top of drm-intel-nightly.
v4: changed wait_for_automic to wait_for
v5: rebased.
v7: rebased.
v8: rebased.
v9: rebased. Rename intel_huc_auh() to intel_guc_auth_huc()
and place the prototype in intel_guc.h,correct the comments.
v10: rebased.
v11: rebased.
v12: rebased on top of drm-tip

Tested-by: Xiang Haihao 
Signed-off-by: Anusha Srivatsa 
Signed-off-by: Alex Dai 
Signed-off-by: Peter Antoine 
Reviewed-by: Dave Gordon 
Reviewed-by: Jeff McGee 
---
 drivers/gpu/drm/i915/i915_guc_submission.c | 63 ++
 drivers/gpu/drm/i915/intel_guc_fwif.h  |  1 +
 drivers/gpu/drm/i915/intel_guc_loader.c|  2 +
 3 files changed, 66 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_guc_submission.c 
b/drivers/gpu/drm/i915/i915_guc_submission.c
index 4bae8e4..d5c205d 100644
--- a/drivers/gpu/drm/i915/i915_guc_submission.c
+++ b/drivers/gpu/drm/i915/i915_guc_submission.c
@@ -26,6 +26,7 @@
 #include 
 #include "i915_drv.h"
 #include "intel_uc.h"
+#include "intel_huc.h"
 
 /**
  * DOC: GuC-based command submission
@@ -1638,3 +1639,65 @@ int i915_guc_log_control(struct drm_i915_private 
*dev_priv, u64 control_val)
 
return ret;
 }
+
+/**
+ * intel_guc_auth_huc() - authenticate ucode
+ * @dev: the drm device
+ *
+ * Triggers a HuC fw authentication request to the GuC via host-2-guc
+ * interface.
+ */
+void intel_guc_auth_huc(struct drm_device *dev)
+{
+   struct drm_i915_private *dev_priv = dev->dev_private;
+   struct intel_guc *guc = _priv->guc;
+   struct intel_huc *huc = _priv->huc;
+   struct i915_vma *vma;
+   int ret;
+   u32 data[2];
+
+   /* Bypass the case where there is no HuC firmware */
+   if (huc->huc_fw.fetch_status == UC_FIRMWARE_NONE ||
+   huc->huc_fw.load_status == UC_FIRMWARE_NONE)
+   return;
+
+   if (guc->guc_fw.load_status != UC_FIRMWARE_SUCCESS) {
+   DRM_ERROR("HuC: GuC fw wasn't loaded. Can't authenticate");
+   return;
+   }
+
+   if (huc->huc_fw.load_status != UC_FIRMWARE_SUCCESS) {
+   DRM_ERROR("HuC: fw wasn't loaded. Nothing to authenticate");
+   return;
+   }
+
+   vma = i915_gem_object_ggtt_pin(huc->huc_fw.uc_fw_obj, NULL, 0, 0, 0);
+   if (IS_ERR(vma)) {
+   DRM_DEBUG_DRIVER("pin failed %d\n", (int)PTR_ERR(vma));
+   return;
+   }
+
+
+   /* Invalidate GuC TLB to let GuC take the latest updates to GTT. */
+   I915_WRITE(GEN8_GTCR, GEN8_GTCR_INVALIDATE);
+
+   /* Specify auth action and where public signature is. */
+   data[0] = HOST2GUC_ACTION_AUTHENTICATE_HUC;
+   data[1] = i915_ggtt_offset(vma) + huc->huc_fw.rsa_offset;
+
+   ret = host2guc_action(guc, data, ARRAY_SIZE(data));
+   if (ret) {
+   DRM_ERROR("HuC: GuC did not ack Auth request\n");
+   goto out;
+   }
+
+   /* Check authentication status, it should be done by now */
+   ret = wait_for((I915_READ(HUC_STATUS2) & HUC_FW_VERIFIED) > 0, 50);
+   if (ret) {
+   DRM_ERROR("HuC: Authentication failed\n");
+   goto out;
+   }
+
+out:
+   i915_vma_unpin(vma);
+}
diff --git a/drivers/gpu/drm/i915/intel_guc_fwif.h 
b/drivers/gpu/drm/i915/intel_guc_fwif.h
index c07d9da..e51e063 100644
--- a/drivers/gpu/drm/i915/intel_guc_fwif.h
+++ b/drivers/gpu/drm/i915/intel_guc_fwif.h
@@ -513,6 +513,7 @@ enum intel_guc_action {
INTEL_GUC_ACTION_EXIT_S_STATE = 0x502,
INTEL_GUC_ACTION_SLPC_REQUEST = 0x3003,
INTEL_GUC_ACTION_UK_LOG_ENABLE_LOGGING = 0x0E000,
+   HOST2GUC_ACTION_AUTHENTICATE_HUC = 0x4000,
INTEL_GUC_ACTION_LIMIT
 };
 
diff --git a/drivers/gpu/drm/i915/intel_guc_loader.c 
b/drivers/gpu/drm/i915/intel_guc_loader.c
index 7ca5556..31d09f8 100644
--- a/drivers/gpu/drm/i915/intel_guc_loader.c
+++ b/drivers/gpu/drm/i915/intel_guc_loader.c
@@ -529,6 +529,8 @@ int intel_guc_setup(struct drm_device *dev)
intel_uc_fw_status_repr(guc_fw->fetch_status),
intel_uc_fw_status_repr(guc_fw->load_status));
 
+   intel_guc_auth_huc(dev);
+
if (i915.enable_guc_submission) {
if (i915.guc_log_level >= 0)
gen9_enable_guc_interrupts(dev_priv);
-- 
2.7.4

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH 1/8] drm/i915/guc: Make the GuC fw loading helper functions general

2016-11-30 Thread Anusha Srivatsa
From: Peter Antoine 

Rename some of the GuC fw loading code to make them more general. We
will utilise them for HuC loading as well.
 s/intel_guc_fw/intel_uc_fw/g
 s/GUC_FIRMWARE/UC_FIRMWARE/g

Struct intel_guc_fw is renamed to intel_uc_fw. Prefix of tts members,
such as 'guc' or 'guc_fw' either is renamed to 'uc' or removed for
same purpose.

v2: rebased on top of nightly.
reapplied the search/replace as upstream code as changed.
v3: rebased again on drm-nightly.
v4: removed G from messages in shared fw fetch function.
v5: rebased.
v7: rebased.
v8: rebased.
v9: rebased.
v10: rebased.
v11: rebased.
v12: rebased on top of drm-tip

Signed-off-by: Anusha Srivatsa 
Signed-off-by: Alex Dai 
Signed-off-by: Peter Antoine 
Reviewed-by: Dave Gordon 
Reviewed-by: Jeff McGee 
Reviewed-by: Carlos Santa 
Tested-by: Carlos Santa 
---
 drivers/gpu/drm/i915/i915_debugfs.c|  12 +--
 drivers/gpu/drm/i915/i915_guc_submission.c |   4 +-
 drivers/gpu/drm/i915/intel_guc_loader.c| 155 +++--
 drivers/gpu/drm/i915/intel_uc.h|  40 
 4 files changed, 107 insertions(+), 104 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_debugfs.c 
b/drivers/gpu/drm/i915/i915_debugfs.c
index 2434130..d6efda9 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -2337,7 +2337,7 @@ static int i915_llc(struct seq_file *m, void *data)
 static int i915_guc_load_status_info(struct seq_file *m, void *data)
 {
struct drm_i915_private *dev_priv = node_to_i915(m->private);
-   struct intel_guc_fw *guc_fw = _priv->guc.guc_fw;
+   struct intel_uc_fw *guc_fw = _priv->guc.guc_fw;
u32 tmp, i;
 
if (!HAS_GUC_UCODE(dev_priv))
@@ -2345,15 +2345,15 @@ static int i915_guc_load_status_info(struct seq_file 
*m, void *data)
 
seq_printf(m, "GuC firmware status:\n");
seq_printf(m, "\tpath: %s\n",
-   guc_fw->guc_fw_path);
+   guc_fw->uc_fw_path);
seq_printf(m, "\tfetch: %s\n",
-   intel_guc_fw_status_repr(guc_fw->guc_fw_fetch_status));
+   intel_uc_fw_status_repr(guc_fw->fetch_status));
seq_printf(m, "\tload: %s\n",
-   intel_guc_fw_status_repr(guc_fw->guc_fw_load_status));
+   intel_uc_fw_status_repr(guc_fw->load_status));
seq_printf(m, "\tversion wanted: %d.%d\n",
-   guc_fw->guc_fw_major_wanted, guc_fw->guc_fw_minor_wanted);
+   guc_fw->major_ver_wanted, guc_fw->minor_ver_wanted);
seq_printf(m, "\tversion found: %d.%d\n",
-   guc_fw->guc_fw_major_found, guc_fw->guc_fw_minor_found);
+   guc_fw->major_ver_found, guc_fw->minor_ver_found);
seq_printf(m, "\theader: offset is %d; size = %d\n",
guc_fw->header_offset, guc_fw->header_size);
seq_printf(m, "\tuCode: offset is %d; size = %d\n",
diff --git a/drivers/gpu/drm/i915/i915_guc_submission.c 
b/drivers/gpu/drm/i915/i915_guc_submission.c
index 5841380..4bae8e4 100644
--- a/drivers/gpu/drm/i915/i915_guc_submission.c
+++ b/drivers/gpu/drm/i915/i915_guc_submission.c
@@ -1494,7 +1494,7 @@ int intel_guc_suspend(struct drm_device *dev)
struct i915_gem_context *ctx;
u32 data[3];
 
-   if (guc->guc_fw.guc_fw_load_status != GUC_FIRMWARE_SUCCESS)
+   if (guc->guc_fw.load_status != UC_FIRMWARE_SUCCESS)
return 0;
 
gen9_disable_guc_interrupts(dev_priv);
@@ -1522,7 +1522,7 @@ int intel_guc_resume(struct drm_device *dev)
struct i915_gem_context *ctx;
u32 data[3];
 
-   if (guc->guc_fw.guc_fw_load_status != GUC_FIRMWARE_SUCCESS)
+   if (guc->guc_fw.load_status != UC_FIRMWARE_SUCCESS)
return 0;
 
if (i915.guc_log_level >= 0)
diff --git a/drivers/gpu/drm/i915/intel_guc_loader.c 
b/drivers/gpu/drm/i915/intel_guc_loader.c
index a330fa4..e55ec2c 100644
--- a/drivers/gpu/drm/i915/intel_guc_loader.c
+++ b/drivers/gpu/drm/i915/intel_guc_loader.c
@@ -81,16 +81,16 @@ MODULE_FIRMWARE(I915_BXT_GUC_UCODE);
 MODULE_FIRMWARE(I915_KBL_GUC_UCODE);
 
 /* User-friendly representation of an enum */
-const char *intel_guc_fw_status_repr(enum intel_guc_fw_status status)
+const char *intel_uc_fw_status_repr(enum intel_uc_fw_status status)
 {
switch (status) {
-   case GUC_FIRMWARE_FAIL:
+   case UC_FIRMWARE_FAIL:
return "FAIL";
-   case GUC_FIRMWARE_NONE:
+   case UC_FIRMWARE_NONE:
return "NONE";
-   case GUC_FIRMWARE_PENDING:
+   case UC_FIRMWARE_PENDING:
return "PENDING";
-   case GUC_FIRMWARE_SUCCESS:
+   case UC_FIRMWARE_SUCCESS:
return "SUCCESS";
default:
return "UNKNOWN!";
@@ -278,7 +278,7 @@ static inline 

[Intel-gfx] [PATCH 3/8] drm/i915/huc: Add HuC fw loading support

2016-11-30 Thread Anusha Srivatsa
The HuC loading process is similar to GuC. The intel_uc_fw_fetch()
is used for both cases.

HuC loading needs to be before GuC loading. The WOPCM setting must
be done early before loading any of them.

v2: rebased on-top of drm-intel-nightly.
removed if(HAS_GUC()) before the guc call. (D.Gordon)
update huc_version number of format.
v3: rebased to drm-intel-nightly, changed the file name format to
match the one in the huc package.
Changed dev->dev_private to to_i915()
v4: moved function back to where it was.
change wait_for_atomic to wait_for.
v5: rebased + comment changes.
v7: rebased.
v8: rebased.
v9: rebased. Changed the year in the copyright message to reflect
the right year.Correct the comments,remove the unwanted WARN message,
replace drm_gem_object_unreference() with i915_gem_object_put().Make the
prototypes in intel_huc.h non-extern.
v10: rebased. Update the file construction done by HuC. It is similar to
GuC.Adopted the approach used in-
https://patchwork.freedesktop.org/patch/104355/ 
v11: Fix warnings remove old declaration
v12: Change dev to dev_priv in macro definition.
Corrected comments.
v13: rebased.
v14: rebased on top of drm-tip

Cc: Tvrtko Ursulin 
Tested-by: Xiang Haihao 
Signed-off-by: Anusha Srivatsa 
Signed-off-by: Alex Dai 
Signed-off-by: Peter Antoine 
Reviewed-by: Dave Gordon 
---
 drivers/gpu/drm/i915/Makefile   |   1 +
 drivers/gpu/drm/i915/i915_drv.c |   4 +-
 drivers/gpu/drm/i915/i915_drv.h |   4 +-
 drivers/gpu/drm/i915/i915_guc_reg.h |   3 +
 drivers/gpu/drm/i915/intel_guc_loader.c |   6 +-
 drivers/gpu/drm/i915/intel_huc.h|  42 +
 drivers/gpu/drm/i915/intel_huc_loader.c | 267 
 drivers/gpu/drm/i915/intel_uc.h |   2 +
 8 files changed, 324 insertions(+), 5 deletions(-)
 create mode 100644 drivers/gpu/drm/i915/intel_huc.h
 create mode 100644 drivers/gpu/drm/i915/intel_huc_loader.c

diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile
index 3c30916..01d4f4b 100644
--- a/drivers/gpu/drm/i915/Makefile
+++ b/drivers/gpu/drm/i915/Makefile
@@ -57,6 +57,7 @@ i915-y += i915_cmd_parser.o \
 # general-purpose microcontroller (GuC) support
 i915-y += intel_uc.o \
  intel_guc_loader.o \
+ intel_huc_loader.o \
  i915_guc_submission.o
 
 # autogenerated null render state
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 8dac298..075d9ce 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -603,6 +603,7 @@ static int i915_load_modeset_init(struct drm_device *dev)
if (ret)
goto cleanup_irq;
 
+   intel_huc_init(dev);
intel_guc_init(dev);
 
ret = i915_gem_init(dev);
@@ -630,6 +631,7 @@ static int i915_load_modeset_init(struct drm_device *dev)
DRM_ERROR("failed to idle hardware; continuing to unload!\n");
i915_gem_fini(dev_priv);
 cleanup_irq:
+   intel_huc_fini(dev);
intel_guc_fini(dev);
drm_irq_uninstall(dev);
intel_teardown_gmbus(dev);
@@ -1326,7 +1328,7 @@ void i915_driver_unload(struct drm_device *dev)
 
/* Flush any outstanding unpin_work. */
drain_workqueue(dev_priv->wq);
-
+   intel_huc_fini(dev);
intel_guc_fini(dev);
i915_gem_fini(dev_priv);
intel_fbc_cleanup_cfb(dev_priv);
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 297ad03..8edfae6 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -56,6 +56,7 @@
 #include "intel_bios.h"
 #include "intel_dpll_mgr.h"
 #include "intel_uc.h"
+#include "intel_huc.h"
 #include "intel_lrc.h"
 #include "intel_ringbuffer.h"
 
@@ -1933,6 +1934,7 @@ struct drm_i915_private {
 
struct intel_gvt *gvt;
 
+   struct intel_huc huc;
struct intel_guc guc;
 
struct intel_csr csr;
@@ -2698,7 +2700,7 @@ intel_info(const struct drm_i915_private *dev_priv)
 #define HAS_GUC(dev_priv)  ((dev_priv)->info.has_guc)
 #define HAS_GUC_UCODE(dev_priv)(HAS_GUC(dev_priv))
 #define HAS_GUC_SCHED(dev_priv)(HAS_GUC(dev_priv))
-
+#define HAS_HUC_UCODE(dev_priv)(HAS_GUC(dev_priv))
 #define HAS_RESOURCE_STREAMER(dev_priv) 
((dev_priv)->info.has_resource_streamer)
 
 #define HAS_POOLED_EU(dev_priv)((dev_priv)->info.has_pooled_eu)
diff --git a/drivers/gpu/drm/i915/i915_guc_reg.h 
b/drivers/gpu/drm/i915/i915_guc_reg.h
index 5e638fc..f9829f6 100644
--- a/drivers/gpu/drm/i915/i915_guc_reg.h
+++ b/drivers/gpu/drm/i915/i915_guc_reg.h
@@ -61,9 +61,12 @@
 #define   DMA_ADDRESS_SPACE_GTT  (8 << 16)
 #define DMA_COPY_SIZE  _MMIO(0xc310)
 #define DMA_CTRL   _MMIO(0xc314)
+#define   HUC_UKERNEL(1<<9)
 

[Intel-gfx] [PATCH 0/8] HuC Loading Patches

2016-11-30 Thread Anusha Srivatsa
These patches add HuC loading support. The GuC is required to 
authenticate the HuC. The userspace patches that check for a 
fully loaded HuC firmware and use it can be found at:
https://lists.freedesktop.org/archives/libva/2016-September/004554.html
https://lists.freedesktop.org/archives/libva/2016-September/004555.html
 
More information regarding the HuC, batch commands that configure the 
HuC etc can be found at-
https://01.org/sites/default/files/documentation/intel-gfx-prm-osrc-skl-vol02a-commandreference-instructions-huc.pdf
https://www.x.org/docs/intel/CHV/intel-gfx-prm-osrc-chv-bsw-vol10-hevc.pdf

v2: rebased.
v3: rebased. Changed the code following the review comments.
v4: Added action_lock initialization fix provided by Arek
(Hiler Arkadiusz) to the first patch in the series- Make the
GuC fw loading helper functions general. 
v5: rebased on top of drm-tip. The patch series is now in sync with GuC 
code reorganization efforts by Arek-
https://patchwork.freedesktop.org/series/15896/

Signed-off-by: Anusha Srivatsa 
Cc: Arek 
Cc: Jeff Mcgee 

Anusha Srivatsa (2):
  drm/i915/huc: Add BXT HuC Loading Support
  drm/i915/HuC: Add KBL huC loading Support

Peter Antoine (6):
  drm/i915/guc: Make the GuC fw loading helper functions general
  drm/i915/huc: Unified css_header struct for GuC and HuC
  drm/i914/huc: Add HuC fw loading support
  drm/i915/huc: Add debugfs for HuC loading status check
  drm/i915/huc: Support HuC authentication
  drm/i915/get_params: Add HuC status to getparams

 drivers/gpu/drm/i915/Makefile  |   1 +
 drivers/gpu/drm/i915/i915_debugfs.c|  43 +++-
 drivers/gpu/drm/i915/i915_drv.c|   9 +-
 drivers/gpu/drm/i915/i915_drv.h|   4 +-
 drivers/gpu/drm/i915/i915_guc_reg.h|   3 +
 drivers/gpu/drm/i915/i915_guc_submission.c |  67 ++-
 drivers/gpu/drm/i915/intel_guc_fwif.h  |  22 ++-
 drivers/gpu/drm/i915/intel_guc_loader.c| 196 +-
 drivers/gpu/drm/i915/intel_huc.h   |  43 
 drivers/gpu/drm/i915/intel_huc_loader.c| 306 +
 drivers/gpu/drm/i915/intel_uc.h|  47 +++--
 include/uapi/drm/i915_drm.h|   1 +
 12 files changed, 620 insertions(+), 122 deletions(-)
 create mode 100644 drivers/gpu/drm/i915/intel_huc.h
 create mode 100644 drivers/gpu/drm/i915/intel_huc_loader.c

-- 
2.7.4

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] linux-next: problems fetching the drm-intel, etc trees

2016-11-30 Thread Stephen Rothwell
Hi Rob,

On Wed, 30 Nov 2016 17:49:24 -0500 Rob Clark  wrote:
>
> yeah, {cgit,anongit}.fd.o have been having problems all day.. (the ssh
> git urls for folks who have push access work fine).. although it has
> worked for me a couple times today, given enough time.
> 
> (not sure if we have github/etc mirrors somewhere?  I do have a github
> clone of mesa which is up to date as of ~10min ago.. I could do the
> same for other git trees if someone somewhere is stuck)

I have managed (with a lot of persistence) to fetch all the trees I
need from there today.

-- 
Cheers,
Stephen Rothwell
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] linux-next: problems fetching the drm-intel, etc trees

2016-11-30 Thread Rob Clark
yeah, {cgit,anongit}.fd.o have been having problems all day.. (the ssh
git urls for folks who have push access work fine).. although it has
worked for me a couple times today, given enough time.

(not sure if we have github/etc mirrors somewhere?  I do have a github
clone of mesa which is up to date as of ~10min ago.. I could do the
same for other git trees if someone somewhere is stuck)

BR,
-R


On Wed, Nov 30, 2016 at 5:39 PM, Stephen Rothwell  wrote:
> Hi all,
>
> There is something seriaously wrong with anongit.freedesktop.org this
> morning.  Fething trees from there takes an enormous amount of time -
> so long that I had to abort the fetches ...
>
> --
> Cheers,
> Stephen Rothwell
> ___
> dri-devel mailing list
> dri-de...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] linux-next: problems fetching the drm-intel, etc trees

2016-11-30 Thread Stephen Rothwell
Hi all,

There is something seriaously wrong with anongit.freedesktop.org this
morning.  Fething trees from there takes an enormous amount of time -
so long that I had to abort the fetches ...

-- 
Cheers,
Stephen Rothwell
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH] drm: Initialise drm_mm.head_node.allocated

2016-11-30 Thread Chris Wilson
commit 202b52b7fbf7 ("drm: Track drm_mm nodes with an interval tree")
introduced a requirement that the special drm_mm.head_node was
initialised and marked as not being allocated. It is a very special node
that has no side but has a hole that represents the drm_mm address
space, and holds the list of nodes. Since it is not a real node, it is
not part of the node rbtree and we detect this as it being unallocated.
This presumed that drm_mm_init() was initialising it to zero. It happens
that i915 kzallocs its objects and so it was accidentally setting it,
but for generic use we cannot make that assumption.

[   22.981519] general protection fault:  [#1] SMP
[   22.981521] Modules linked in: test_drm_mm(+) ctr ccm arc4 rt2800usb 
rt2x00usb rt2800lib rt2x00lib crc_ccitt mac80211 cmac rfcomm bnep 
snd_hda_codec_realtek snd_hda_codec_hdmi snd_hda_codec_generic snd_hda_intel 
dcdbas snd_hda_codec x86_pkg_temp_thermal intel_powerclamp btusb snd_hda_core 
coretemp crct10dif_pclmul cfg80211 btrtl btbcm btintel bluetooth crc32_pclmul 
ghash_clmulni_intel aesni_intel snd_pcm i2c_hid aes_x86_64 lrw gf128mul 
glue_helper ablk_helper cryptd snd_timer hid_multitouch snd joydev serio_raw 
lpc_ich mfd_core i2c_designware_platform i2c_designware_core 8250_dw 
binfmt_misc soundcore acpi_pad nls_iso8859_1 usbhid hid psmouse ahci libahci 
[last unloaded: test_drm_mm]
[   22.981544] CPU: 1 PID: 2088 Comm: drm_mm Tainted: GW   
4.9.0-rc7+ #234
[   22.981545] Hardware name: Dell Inc. XPS 13 9343/0310JH, BIOS A07 11/11/2015
[   22.981546] task: 88020c971cc0 task.stack: c90001728000
[   22.981547] RIP: 0010:[]  [] 
drm_mm_interval_tree_add_node+0xa0/0xd0
[   22.981551] RSP: 0018:c9000172ba98  EFLAGS: 00010202
[   22.981552] RAX: 0fc69cf63d80 RBX: 88020be0 RCX: 88020be0
[   22.981553] RDX: 0fff RSI: c9000172bc48 RDI: 810ac4df
[   22.981553] RBP: c9000172bb08 R08: c9000172bc70 R09: 0fff
[   22.981554] R10: 810ac4d7 R11: 4dc04d8b4ce5 R12: 1000
[   22.981555] R13: c9000172bbd0 R14: c9000172bbe0 R15: 0200
[   22.981556] FS:  7f80c9fab740() GS:88021f48() 
knlGS:
[   22.981557] CS:  0010 DS:  ES:  CR0: 80050033
[   22.981558] CR2: 7f80c9fd5000 CR3: 00020c191000 CR4: 003406e0
[   22.981559] Stack:
[   22.981560]  81405d09 88020be0 c9000172bbe0 
0172bb08
[   22.981562]     

[   22.981563]  0200 0200 a02f3000 
88020be0
[   22.981565] Call Trace:
[   22.981568]  [] ? drm_mm_insert_node_generic+0x229/0x310
[   22.981570]  [] ? 0xa02f3000
[   22.981572]  [] 
__subtest_insert_range.constprop.7+0xd1/0x5b0 [test_drm_mm]
[   22.981575]  [] ? default_wake_function+0x12/0x20
[   22.981576]  [] ? __wake_up_common+0x55/0x90
[   22.981578]  [] ? sched_clock_cpu+0x72/0xa0
[   22.981581]  [] ? irq_work_queue+0xd/0x80
[   22.981582]  [] ? wake_up_klogd+0x34/0x40
[   22.981584]  [] ? console_unlock+0x4cd/0x530
[   22.981585]  [] ? vprintk_emit+0x2d7/0x490
[   22.981587]  [] ? vprintk_default+0x1f/0x30
[   22.981589]  [] ? printk+0x4d/0x4f
[   22.981590]  [] ? 0xa02f3000
[   22.981592]  [] subtest_insert_range+0x15/0x80 
[test_drm_mm]
[   22.981594]  [] test_drm_mm_init+0x88/0x1000 [test_drm_mm]
[   22.981597]  [] do_one_initcall+0x3d/0x150
[   22.981600]  [] ? kfree+0x13f/0x180
[   22.981602]  [] do_init_module+0x60/0x1f1
[   22.981606]  [] load_module+0x2228/0x2790
[   22.981608]  [] ? __symbol_put+0x40/0x40
[   22.981612]  [] ? kernel_read+0x41/0x60
[   22.981614]  [] SYSC_finit_module+0x96/0xd0
[   22.981617]  [] SyS_finit_module+0xe/0x10
[   22.981620]  [] entry_SYSCALL_64_fastpath+0x17/0x98
[   22.981622] Code: c7 41 30 00 00 00 00 48 89 e5 48 89 3a 48 c7 c2 20 4e 40 
81 e8 b2 a1 f0 ff 5d c3 48 8d 56 78 45 31 d2 48 89 d6 eb 25 48 8b 51 58 <48> 39 
50 38 73 04 48 89 50 38 4c 8b 58 28 4c 39 59 48 48 8d 50
[   22.981651] RIP  [] drm_mm_interval_tree_add_node+0xa0/0xd0
[   22.981655]  RSP 

Testcase: igt/drm_mm
Fixes: 202b52b7fbf7 ("drm: Track drm_mm nodes with an interval tree")
Signed-off-by: Chris Wilson 
Cc: David Herrmann 
Cc: dri-de...@lists.freedesktop.org
Cc: Daniel Vetter 
Cc:  # v4.9-rc1+
---
 drivers/gpu/drm/drm_mm.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/drm_mm.c b/drivers/gpu/drm/drm_mm.c
index b5b0b667677d..952e4594f181 100644
--- a/drivers/gpu/drm/drm_mm.c
+++ b/drivers/gpu/drm/drm_mm.c
@@ -902,6 +902,7 @@ void drm_mm_init(struct drm_mm * mm, u64 start, u64 size)
 
/* Clever trick to avoid a special case in the free hole tracking. */
INIT_LIST_HEAD(>head_node.node_list);
+   mm->head_node.allocated = 0;
mm->head_node.hole_follows 

Re: [Intel-gfx] [PATCH] drm/i915/perf: More documentation hooked to i915.rst

2016-11-30 Thread Daniel Vetter
On Tue, Nov 29, 2016 at 05:00:55PM +, Robert Bragg wrote:
> This adds a 'Perf' section to i915.rst with the following sub sections:
> - Overview
> - Comparison with Core Perf
> - i915 Driver Entry Points
> - i915 Perf Stream
> - i915 Perf Observation Architecture Stream
> - All i915 Perf Internals
> 
> Signed-off-by: Robert Bragg 
> Cc: Daniel Vetter 

Two style bikesheds below, feel free to ignore.

> ---
>  Documentation/gpu/i915.rst   |  92 +
>  drivers/gpu/drm/i915/i915_drv.h  | 151 
>  drivers/gpu/drm/i915/i915_perf.c | 289 
> +++
>  3 files changed, 478 insertions(+), 54 deletions(-)
> 
> diff --git a/Documentation/gpu/i915.rst b/Documentation/gpu/i915.rst
> index 117d2ab..714bd4b 100644
> --- a/Documentation/gpu/i915.rst
> +++ b/Documentation/gpu/i915.rst
> @@ -356,4 +356,96 @@ switch_mm
>  .. kernel-doc:: drivers/gpu/drm/i915/i915_trace.h
> :doc: switch_mm tracepoint
>  
> +Perf
> +
> +
> +.. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
> +   :doc: i915 Perf Overview
> +
> +.. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
> +   :doc: i915 Perf History and Comparison with Core Perf
> +
> +.. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
> +   :doc: i915 Perf File Operations

You have the headings in the DOC comments itself, which works until
someone reorganizes stuff. Then it tends to fall apart badly.

> +
> +i915 Driver Entry Points
> +
> +
> +This section covers the entrypoints exported outside of i915_perf.c to
> +integrate with drm/i915 and to handle the `DRM_I915_PERF_OPEN` ioctl.
> +
> +.. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
> +   :functions: i915_perf_init
> +.. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
> +   :functions: i915_perf_fini
> +.. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
> +   :functions: i915_perf_register
> +.. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
> +   :functions: i915_perf_unregister
> +.. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
> +   :functions: i915_perf_open_ioctl
> +.. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
> +   :functions: i915_perf_release

One potential issue with listing everything explicitly is that if someone
ever (and this is bound to happen) adds a new function, they'll forget to
add it. Hence we just pull them all in, and if you want to refernce some
specifically, do that in the overview sections. And also sprinkle lots of
cross-references all over to make groups of functions easier to discover.

But in the end your docs, your turf ;-)
-Daniel

> +
> +i915 Perf Stream
> +
> +
> +This section covers the stream-semantics-agnostic structures and functions
> +for representing an i915 perf stream FD and associated file operations.
> +
> +.. kernel-doc:: drivers/gpu/drm/i915/i915_drv.h
> +   :functions: i915_perf_stream
> +.. kernel-doc:: drivers/gpu/drm/i915/i915_drv.h
> +   :functions: i915_perf_stream_ops
> +
> +.. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
> +   :functions: read_properties_unlocked
> +.. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
> +   :functions: i915_perf_open_ioctl_unlocked
> +.. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
> +   :functions: i915_perf_destroy_unlocked
> +.. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
> +   :functions: i915_perf_read
> +.. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
> +   :functions: i915_perf_ioctl
> +.. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
> +   :functions: i915_perf_enable_unlocked
> +.. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
> +   :functions: i915_perf_disable_unlocked
> +.. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
> +   :functions: i915_perf_poll
> +.. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
> +   :functions: i915_perf_poll_unlocked
> +
> +i915 Perf Observation Architecture Stream
> +-
> +
> +.. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
> +   :functions: OA_BUFFER_SIZE
> +.. kernel-doc:: drivers/gpu/drm/i915/i915_drv.h
> +   :functions: i915_oa_ops
> +
> +.. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
> +   :functions: i915_oa_stream_init
> +.. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
> +   :functions: i915_oa_read
> +.. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
> +   :functions: i915_oa_stream_enable
> +.. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
> +   :functions: i915_oa_stream_disable
> +.. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
> +   :functions: i915_oa_wait_unlocked
> +.. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
> +   :functions: i915_oa_poll_wait
> +
> +All i915 Perf Internals
> +---
> +
> +This section simply includes all currently documented i915 perf internals, in
> +no particular order, but may include some more minor utilities or platform
> +specific details than found in the more high-level sections.
> +
> +.. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
> +  

Re: [Intel-gfx] [PATCH] drm/i915: Remove dummy i915_kick_out_firmware_fb

2016-11-30 Thread Daniel Vetter
On Wed, Nov 30, 2016 at 11:49:23AM +, Chris Wilson wrote:
> On Wed, Nov 30, 2016 at 12:01:31PM +0100, Daniel Vetter wrote:
> > Since
> > 
> > commit 44adece57e2604cec8527a499b48e4d584ab53b8
> > Author: Daniel Vetter 
> > Date:   Wed Aug 10 18:52:34 2016 +0200
> > 
> > drm/fb-helper: Add a dummy remove_conflicting_framebuffers
> > 
> > the drm helpers take care of this for us.
> > 
> > Cc: Chris Wilson 
> > Signed-off-by: Daniel Vetter 
> 
> Still compiles without CONFIG_FB, so
> Reviewed-by: Chris Wilson 

Thanks for double-checking, applied to dinq.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PULL] GVT-g device model fix

2016-11-30 Thread Daniel Vetter
On Wed, Nov 30, 2016 at 04:23:02PM +0800, Zhenyu Wang wrote:
> 
> Hi,
> 
> Here's current left GVT-g device model bug fixes for pull.

Since 4.10 feature freeze is already done, this needs to go into
drm-intel-next-fixes. Jani, can you pls pull?

Thanks, Daniel

> 
> Thanks.
> 
> ---
> 
> The following changes since commit 53e86ada8e53fcdbe1593f70b7df85549ba70b9a:
> 
>   drm/i915/gvt: remove unresolved vfio pin/unpin pages interface dependency 
> (2016-11-17 15:51:16 +0800)
> 
> are available in the git repository at:
> 
>   https://github.com/01org/gvt-linux tags/gvt-next-2016-11-30
> 
> for you to fetch changes up to 53d6f812c0dbf1c9cad89b1c2118e61c13ca9677:
> 
>   drm/i915/gvt: fix lock not released bug for dispatch_workload() err path 
> (2016-11-25 09:18:11 +0800)
> 
> 
> gvt-next-2016-11-30
> 
> - initialize vgpu as primary for correct cfg space setting
> - fix 64 bit bar emulation
> - fix un-released lock issue on dispatch workload err path
> 
> 
> Du, Changbin (1):
>   drm/i915/gvt: fix missing init param.primary
> 
> Xiaoguang Chen (1):
>   drm/i915/gvt: fix getting 64bit bar size error
> 
> Zhenyu Wang (1):
>   drm/i915/gvt: fix lock not released bug for dispatch_workload() err path
> 
>  drivers/gpu/drm/i915/gvt/gvt.h   |  2 ++
>  drivers/gpu/drm/i915/gvt/scheduler.c | 10 ++
>  drivers/gpu/drm/i915/gvt/vgpu.c  |  1 +
>  3 files changed, 9 insertions(+), 4 deletions(-)
> 
> -- 
> Open Source Technology Center, Intel ltd.
> 
> $gpg --keyserver wwwkeys.pgp.net --recv-keys 4D781827



-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PULL] drm-misc-fixes

2016-11-30 Thread Daniel Vetter
Hi Dave,

Just one patch from Michel I picked up for -fixes.

Cheers, Daniel


The following changes since commit e5517c2a5a49ed5e99047008629f1cd60246ea0e:

  Linux 4.9-rc7 (2016-11-27 13:08:04 -0800)

are available in the git repository at:

  git://anongit.freedesktop.org/git/drm-misc tags/drm-misc-fixes-2016-11-30

for you to fetch changes up to e94bd1736f1f60e916a85a80c0b0ebeaae36cce5:

  drm: Don't call drm_for_each_crtc with a non-KMS driver (2016-11-30 10:13:00 
+0100)


Michel Dänzer (1):
  drm: Don't call drm_for_each_crtc with a non-KMS driver

 drivers/gpu/drm/drm_ioctl.c | 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] ✗ Fi.CI.BAT: warning for drm/i915: Remove dummy i915_kick_out_firmware_fb

2016-11-30 Thread Patchwork
== Series Details ==

Series: drm/i915: Remove dummy i915_kick_out_firmware_fb
URL   : https://patchwork.freedesktop.org/series/16158/
State : warning

== Summary ==

Series 16158v1 drm/i915: Remove dummy i915_kick_out_firmware_fb
https://patchwork.freedesktop.org/api/1.0/series/16158/revisions/1/mbox/

Test kms_busy:
Subgroup basic-flip-default-a:
skip   -> PASS   (fi-ivb-3770)
Subgroup basic-flip-default-b:
skip   -> PASS   (fi-ivb-3770)
Subgroup basic-flip-default-c:
skip   -> PASS   (fi-ivb-3770)
Test kms_cursor_legacy:
Subgroup basic-busy-flip-before-cursor-legacy:
skip   -> PASS   (fi-ivb-3770)
Subgroup basic-busy-flip-before-cursor-varying-size:
skip   -> PASS   (fi-ivb-3770)
Subgroup basic-flip-after-cursor-legacy:
skip   -> PASS   (fi-ivb-3770)
Subgroup basic-flip-after-cursor-varying-size:
skip   -> PASS   (fi-ivb-3770)
Subgroup basic-flip-before-cursor-legacy:
skip   -> PASS   (fi-ivb-3770)
Subgroup basic-flip-before-cursor-varying-size:
skip   -> PASS   (fi-ivb-3770)
Test kms_force_connector_basic:
Subgroup force-connector-state:
skip   -> PASS   (fi-ivb-3770)
Subgroup force-edid:
skip   -> PASS   (fi-ivb-3770)
Subgroup force-load-detect:
skip   -> PASS   (fi-ivb-3770)
Subgroup prune-stale-modes:
skip   -> PASS   (fi-ivb-3770)
Test kms_pipe_crc_basic:
Subgroup hang-read-crc-pipe-a:
skip   -> PASS   (fi-ivb-3770)
Subgroup nonblocking-crc-pipe-a:
pass   -> DMESG-WARN (fi-ilk-650)
Subgroup suspend-read-crc-pipe-a:
skip   -> PASS   (fi-ivb-3770)
Subgroup suspend-read-crc-pipe-b:
skip   -> PASS   (fi-ivb-3770)
Subgroup suspend-read-crc-pipe-c:
skip   -> PASS   (fi-ivb-3770)
Test prime_vgem:
Subgroup basic-fence-flip:
skip   -> PASS   (fi-ivb-3770)

fi-bdw-5557u total:245  pass:230  dwarn:0   dfail:0   fail:0   skip:15 
fi-bsw-n3050 total:245  pass:205  dwarn:0   dfail:0   fail:0   skip:40 
fi-byt-j1900 total:245  pass:217  dwarn:0   dfail:0   fail:0   skip:28 
fi-byt-n2820 total:245  pass:213  dwarn:0   dfail:0   fail:0   skip:32 
fi-hsw-4770  total:245  pass:225  dwarn:0   dfail:0   fail:0   skip:20 
fi-hsw-4770r total:245  pass:225  dwarn:0   dfail:0   fail:0   skip:20 
fi-ilk-650   total:245  pass:191  dwarn:1   dfail:0   fail:0   skip:53 
fi-ivb-3520m total:245  pass:223  dwarn:0   dfail:0   fail:0   skip:22 
fi-ivb-3770  total:245  pass:223  dwarn:0   dfail:0   fail:0   skip:22 
fi-kbl-7500u total:245  pass:223  dwarn:0   dfail:0   fail:0   skip:22 
fi-skl-6260u total:245  pass:231  dwarn:0   dfail:0   fail:0   skip:14 
fi-skl-6700hqtotal:245  pass:224  dwarn:0   dfail:0   fail:0   skip:21 
fi-skl-6700k total:245  pass:223  dwarn:1   dfail:0   fail:0   skip:21 
fi-skl-6770hqtotal:245  pass:231  dwarn:0   dfail:0   fail:0   skip:14 
fi-snb-2520m total:245  pass:213  dwarn:0   dfail:0   fail:0   skip:32 
fi-snb-2600  total:245  pass:212  dwarn:0   dfail:0   fail:0   skip:33 

51c6c255aa05775bcfb3f5790a3b9249e5990f3e drm-tip: 2016y-11m-30d-16h-12m-19s UTC 
integration manifest
0178177 drm/i915: Remove dummy i915_kick_out_firmware_fb

== Logs ==

For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_3150/
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [Regression report] Weekly regression report WW48

2016-11-30 Thread Miramontes Caton, Jairo Daniel
Here is the link to the FDO Bugzilla to see this bug list, I'll attach it to 
weekly report


https://bugs.freedesktop.org/buglist.cgi?bug_status=NEW_status=ASSIGNED_status=REOPENED_status=NEEDINFO=DRM%2FIntel=OP=OP=short_desc=keywords=CP=CP=OR_name=i915%20regressions_id=600614=anywordssubstr=anywordssubstr_sys=All_sys=Linux%20%28All%29_sys=other=bug_id%20DESC=DRI_based_on=i915%20regressions_format=advanced_platform=All_platform=x86%20%28IA32%29_platform=x86-64%20%28AMD64%29_platform=IA64%20%28Itanium%29_platform=Other=regression%20bisect=regression%20bisected%20pending_bisect


Regards

-Original Message-
From: Jani Nikula [mailto:jani.nik...@linux.intel.com] 
Sent: Monday, November 28, 2016 3:41 AM
To: Jairo Miramontes ; 
intel-gfx@lists.freedesktop.org; otc gfx qa 
Subject: Re: [Intel-gfx] [Regression report] Weekly regression report WW48

On Mon, 28 Nov 2016, Jairo Miramontes 
 wrote:
> Total regressions: 47

Repeating my earlier request, please share a fdo bugzilla query link where 
anyone can get the results in bugzilla.

BR,
Jani.

--
Jani Nikula, Intel Open Source Technology Center
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 1/3] assembler: Fix assert when setting 3src sources

2016-11-30 Thread Lionel Landwerlin

Hi,

This series is

Reviewed-by: Lionel Landwerlin 

Thanks!

On 30/11/16 01:15, Kristian H. Kristensen wrote:

We need to map the type to the 3src encoding before comparing to
insn->bits1.da3src.src_reg_type, which is 3src encoded.

Signed-off-by: Kristian H. Kristensen 
---
  assembler/brw_eu_emit.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/assembler/brw_eu_emit.c b/assembler/brw_eu_emit.c
index 23f0da5..d4fadff 100644
--- a/assembler/brw_eu_emit.c
+++ b/assembler/brw_eu_emit.c
@@ -874,7 +874,7 @@ brw_set_3src_src1(struct brw_compile *p,
 assert(src1.file == BRW_GENERAL_REGISTER_FILE);
 assert(src1.address_mode == BRW_ADDRESS_DIRECT);
 assert(src1.nr < 128);
-   assert(src1.type == insn->bits1.da3src.src_reg_type);
+   assert(get_3src_type(src1.type) == insn->bits1.da3src.src_reg_type);
 insn->bits2.da3src.src1_swizzle = src1.dw1.bits.swizzle;
 insn->bits2.da3src.src1_subreg_nr_low = get_3src_subreg_nr(src1) & 0x3;
 insn->bits3.da3src.src1_subreg_nr_high = get_3src_subreg_nr(src1) >> 2;
@@ -892,7 +892,7 @@ brw_set_3src_src2(struct brw_compile *p,
 assert(src2.file == BRW_GENERAL_REGISTER_FILE);
 assert(src2.address_mode == BRW_ADDRESS_DIRECT);
 assert(src2.nr < 128);
-   assert(src2.type == insn->bits1.da3src.src_reg_type);
+   assert(get_3src_type(src2.type) == insn->bits1.da3src.src_reg_type);
 insn->bits3.da3src.src2_swizzle = src2.dw1.bits.swizzle;
 insn->bits3.da3src.src2_subreg_nr = get_3src_subreg_nr(src2);
 insn->bits3.da3src.src2_rep_ctrl = src2.vstride == BRW_VERTICAL_STRIDE_0;



___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 3/3] drm/i915: Implement Link Rate fallback on Link training failure

2016-11-30 Thread Ville Syrjälä
On Wed, Nov 30, 2016 at 09:36:33AM +0100, Daniel Vetter wrote:
> On Tue, Nov 29, 2016 at 11:30:33PM -0800, Manasi Navare wrote:
> > If link training at a link rate optimal for a particular
> > mode fails during modeset's atomic commit phase, then we
> > let the modeset complete and then retry. We save the link rate
> > value at which link training failed, update the link status property
> > to "BAD" and use a lower link rate to prune the modes. It will redo
> > the modeset on the current mode at lower link rate or if the current
> > mode gets pruned due to lower link constraints then, it will send a
> > hotplug uevent for userspace to handle it.
> > 
> > This is also required to pass DP CTS tests 4.3.1.3, 4.3.1.4,
> > 4.3.1.6.
> > 
> > v9:
> > * Use the trimmed max values of link rate/lane count based on
> > link train fallback (Daniel Vetter)
> > v8:
> > * Set link_status to BAD first and then call mode_valid (Jani Nikula)
> > v7:
> > Remove the redundant variable in previous patch itself
> > v6:
> > * Obtain link rate index from fallback_link_rate using
> > the helper intel_dp_link_rate_index (Jani Nikula)
> > * Include fallback within intel_dp_start_link_train (Jani Nikula)
> > v5:
> > * Move set link status to drm core (Daniel Vetter, Jani Nikula)
> > v4:
> > * Add fallback support for non DDI platforms too
> > * Set connector->link status inside set_link_status function
> > (Jani Nikula)
> > v3:
> > * Set link status property to BAd unconditionally (Jani Nikula)
> > * Dont use two separate variables link_train_failed and link_status
> > to indicate same thing (Jani Nikula)
> > v2:
> > * Squashed a few patches (Jani Nikula)
> > 
> > Acked-by: Tony Cheng 
> > Acked-by: Harry Wentland 
> > Cc: Jani Nikula 
> > Cc: Daniel Vetter 
> > Cc: Ville Syrjala 
> > Signed-off-by: Manasi Navare 
> > ---
> >  drivers/gpu/drm/i915/intel_dp.c   | 44 
> > +++
> >  drivers/gpu/drm/i915/intel_dp_link_training.c | 25 +--
> >  drivers/gpu/drm/i915/intel_drv.h  |  3 ++
> >  3 files changed, 70 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/intel_dp.c 
> > b/drivers/gpu/drm/i915/intel_dp.c
> > index bc1268c..a50b6cd 100644
> > --- a/drivers/gpu/drm/i915/intel_dp.c
> > +++ b/drivers/gpu/drm/i915/intel_dp.c
> > @@ -4435,6 +4435,8 @@ static bool intel_digital_port_connected(struct 
> > drm_i915_private *dev_priv,
> > intel_dp->compliance_test_active = 0;
> > intel_dp->compliance_test_type = 0;
> > intel_dp->compliance_test_data = 0;
> > +   intel_dp->fallback_link_rate = 0;
> > +   intel_dp->fallback_lane_count = 0;
> 
> Hm, I thought we agreed on irc to just track the max link rate/lane count
> at all times, instead of fallback values that sometimes are valid and
> sometimes reset to 0.
> 
> Also, resetting to 0 here is wrong, since this is not the long-pulse hpd
> handler. That probably also explains why you need the hack below, but not
> sure.
> 
> >  
> > if (intel_dp->is_mst) {
> > DRM_DEBUG_KMS("MST device may have disappeared %d vs 
> > %d\n",
> > @@ -4526,6 +4528,13 @@ static bool intel_digital_port_connected(struct 
> > drm_i915_private *dev_priv,
> > DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n",
> >   connector->base.id, connector->name);
> >  
> > +   /* If this is a retry due to link training failure
> > +* then do no do a full detect
> > +*/
> > +   if (status == connector_status_connected &&
> > +   intel_dp->fallback_lane_count)
> > +   return status;
> 
> That sounds very wrong. Why do we need it?
> 
> > +
> > /* If full detect is not performed yet, do a full detect */
> > if (!intel_dp->detect_done)
> > status = intel_dp_long_pulse(intel_dp->attached_connector);
> > @@ -5690,6 +5699,37 @@ static bool intel_edp_init_connector(struct intel_dp 
> > *intel_dp,
> > return false;
> >  }
> >  
> > +static void intel_dp_modeset_retry_work_fn(struct work_struct *work)
> > +{
> > +   struct intel_connector *intel_connector;
> > +   struct drm_connector *connector;
> > +   struct drm_display_mode *mode;
> > +   bool verbose_prune = true;
> > +
> > +   intel_connector = container_of(work, typeof(*intel_connector),
> > +  modeset_retry_work);
> > +   connector = _connector->base;
> > +   DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n", connector->base.id,
> > + connector->name);
> > +
> > +   /* Grab the locks before changing connector property*/
> > +   mutex_lock(>dev->mode_config.mutex);
> > +   /* Set connector link status to BAD and send a Uevent to notify
> > +* userspace to do a modeset.
> > +*/
> > +   drm_mode_connector_set_link_status_property(connector,
> > +  

Re: [Intel-gfx] [PATCH] drm/i915/perf: Treat u64 in uabi as a normal integer

2016-11-30 Thread Matthew Auld
On 30 November 2016 at 16:46, Chris Wilson  wrote:
> Forgo marking up the u64 integer representing a user pointer as this
> just annoys sparse. The conversion from u64 to a user pointer is managed
> by u64_to_user_ptr().
>
> Fixes: eec688e1420d ("drm/i915: Add i915 perf infrastructure")
> Signed-off-by: Chris Wilson 
> Cc: Robert Bragg 
> Cc: Matthew Auld 
Reviewed-by: Matthew Auld 
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 3/3] drm/i915: Implement Link Rate fallback on Link training failure

2016-11-30 Thread Chris Wilson
On Wed, Nov 30, 2016 at 09:36:33AM +0100, Daniel Vetter wrote:
> On Tue, Nov 29, 2016 at 11:30:33PM -0800, Manasi Navare wrote:
> > +static void intel_dp_modeset_retry_work_fn(struct work_struct *work)
> > +{
> > +   struct intel_connector *intel_connector;
> > +   struct drm_connector *connector;
> > +   struct drm_display_mode *mode;
> > +   bool verbose_prune = true;
> > +
> > +   intel_connector = container_of(work, typeof(*intel_connector),
> > +  modeset_retry_work);
> > +   connector = _connector->base;
> > +   DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n", connector->base.id,
> > + connector->name);
> > +
> > +   /* Grab the locks before changing connector property*/
> > +   mutex_lock(>dev->mode_config.mutex);
> > +   /* Set connector link status to BAD and send a Uevent to notify
> > +* userspace to do a modeset.
> > +*/
> > +   drm_mode_connector_set_link_status_property(connector,
> > +   DRM_MODE_LINK_STATUS_BAD);
> > +   list_for_each_entry(mode, >modes, head) {
> > +   mode->status = intel_dp_mode_valid(connector,
> > +  mode);
> > +   }
> > +   drm_mode_prune_invalid(connector->dev, >modes,
> > +  verbose_prune);
> 
> This call to drm_mode_prune_invalid is probably just to paper over a bug
> in SNA - SNA violates the hotplug handling uabi by not unconditionally
> reprobing. Inconsistently paper over that bug in the kernel is not good,
> userspace interfaces need to be well defined. Please remove this call and
> test with either UXA or -modesetting until SNA is fixed.

Then you should also categorically state that (once again) misusing the
HOTPLUG uevent for notification of a property update is wrong.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH] drm/i915/perf: Treat u64 in uabi as a normal integer

2016-11-30 Thread Chris Wilson
Forgo marking up the u64 integer representing a user pointer as this
just annoys sparse. The conversion from u64 to a user pointer is managed
by u64_to_user_ptr().

Fixes: eec688e1420d ("drm/i915: Add i915 perf infrastructure")
Signed-off-by: Chris Wilson 
Cc: Robert Bragg 
Cc: Matthew Auld 
---
 include/uapi/drm/i915_drm.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/uapi/drm/i915_drm.h b/include/uapi/drm/i915_drm.h
index 686e02451789..9ba5a239d099 100644
--- a/include/uapi/drm/i915_drm.h
+++ b/include/uapi/drm/i915_drm.h
@@ -1369,7 +1369,7 @@ struct drm_i915_perf_open_param {
 * Pointer to array of u64 (id, value) pairs configuring the stream
 * to open.
 */
-   __u64 __user properties_ptr;
+   __u64 properties_ptr;
 };
 
 /**
-- 
2.10.2

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH] drm/i915/perf: More documentation hooked to i915.rst

2016-11-30 Thread Matthew Auld
On 29 November 2016 at 17:00, Robert Bragg  wrote:
> This adds a 'Perf' section to i915.rst with the following sub sections:
> - Overview
> - Comparison with Core Perf
> - i915 Driver Entry Points
> - i915 Perf Stream
> - i915 Perf Observation Architecture Stream
> - All i915 Perf Internals
>
> Signed-off-by: Robert Bragg 
> Cc: Daniel Vetter 
> ---
>  Documentation/gpu/i915.rst   |  92 +
>  drivers/gpu/drm/i915/i915_drv.h  | 151 
>  drivers/gpu/drm/i915/i915_perf.c | 289 
> +++
>  3 files changed, 478 insertions(+), 54 deletions(-)
>
> diff --git a/Documentation/gpu/i915.rst b/Documentation/gpu/i915.rst
> index 117d2ab..714bd4b 100644
> --- a/Documentation/gpu/i915.rst
> +++ b/Documentation/gpu/i915.rst
> @@ -356,4 +356,96 @@ switch_mm
>  .. kernel-doc:: drivers/gpu/drm/i915/i915_trace.h
> :doc: switch_mm tracepoint
>
> +Perf
> +
> +
> +.. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
> +   :doc: i915 Perf Overview
> +
> +.. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
> +   :doc: i915 Perf History and Comparison with Core Perf
> +
> +.. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
> +   :doc: i915 Perf File Operations
I see no such :DOC entry in i915_perf.c.

> +
> +i915 Driver Entry Points
> +
> +
> +This section covers the entrypoints exported outside of i915_perf.c to
> +integrate with drm/i915 and to handle the `DRM_I915_PERF_OPEN` ioctl.
> +
> +.. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
> +   :functions: i915_perf_init
> +.. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
> +   :functions: i915_perf_fini
> +.. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
> +   :functions: i915_perf_register
> +.. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
> +   :functions: i915_perf_unregister
> +.. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
> +   :functions: i915_perf_open_ioctl
> +.. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
> +   :functions: i915_perf_release
I see no kernel doc for this.

> +
> +i915 Perf Stream
> +
> +
> +This section covers the stream-semantics-agnostic structures and functions
> +for representing an i915 perf stream FD and associated file operations.
> +
> +.. kernel-doc:: drivers/gpu/drm/i915/i915_drv.h
> +   :functions: i915_perf_stream
> +.. kernel-doc:: drivers/gpu/drm/i915/i915_drv.h
> +   :functions: i915_perf_stream_ops
> +
> +.. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
> +   :functions: read_properties_unlocked
> +.. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
> +   :functions: i915_perf_open_ioctl_unlocked
i915_perf_open_ioctl_locked, and there is no kernel doc for it.

> +.. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
> +   :functions: i915_perf_destroy_unlocked
i915_perf_destroy_locked, and there is no kernel doc for it.

> +.. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
> +   :functions: i915_perf_read
> +.. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
> +   :functions: i915_perf_ioctl
I see no kernel doc for this.

> +.. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
> +   :functions: i915_perf_enable_unlocked
i915_perf_enable_locked, and there is no kernel doc for it.

> +.. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
> +   :functions: i915_perf_disable_unlocked
i915_perf_disable_locked, and there is no kernel doc for it.

> +.. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
> +   :functions: i915_perf_poll
> +.. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
> +   :functions: i915_perf_poll_unlocked
i915_perf_poll_locked, and there is no kernel doc for it

> +
> +i915 Perf Observation Architecture Stream
> +-
> +
> +.. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
> +   :functions: OA_BUFFER_SIZE
hmm, but this is not a function, enum, union, struct or typedef, so
can we actually add kernel doc for preprocessor directives ? Also
OA_BUFFER_SIZE lacks the proper formatting to get picked up anyway.

> +.. kernel-doc:: drivers/gpu/drm/i915/i915_drv.h
> +   :functions: i915_oa_ops
> +
> +.. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
> +   :functions: i915_oa_stream_init
> +.. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
> +   :functions: i915_oa_read
> +.. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
> +   :functions: i915_oa_stream_enable
> +.. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
> +   :functions: i915_oa_stream_disable
> +.. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
> +   :functions: i915_oa_wait_unlocked
> +.. kernel-doc:: drivers/gpu/drm/i915/i915_perf.c
> +   :functions: i915_oa_poll_wait
> +
> +All i915 Perf Internals
> +---
> +
> +This section simply includes all currently documented i915 perf internals, in
> +no particular order, but may include some more minor utilities or platform
> +specific details than found in the more high-level sections.
> +
> +.. kernel-doc:: 

Re: [Intel-gfx] [PATCH 3/3] drm/i915: Implement Link Rate fallback on Link training failure

2016-11-30 Thread Chris Wilson
On Wed, Nov 30, 2016 at 09:36:33AM +0100, Daniel Vetter wrote:
> On Tue, Nov 29, 2016 at 11:30:33PM -0800, Manasi Navare wrote:
> > If link training at a link rate optimal for a particular
> > mode fails during modeset's atomic commit phase, then we
> > let the modeset complete and then retry. We save the link rate
> > value at which link training failed, update the link status property
> > to "BAD" and use a lower link rate to prune the modes. It will redo
> > the modeset on the current mode at lower link rate or if the current
> > mode gets pruned due to lower link constraints then, it will send a
> > hotplug uevent for userspace to handle it.
> > 
> > This is also required to pass DP CTS tests 4.3.1.3, 4.3.1.4,
> > 4.3.1.6.
> > 
> > v9:
> > * Use the trimmed max values of link rate/lane count based on
> > link train fallback (Daniel Vetter)
> > v8:
> > * Set link_status to BAD first and then call mode_valid (Jani Nikula)
> > v7:
> > Remove the redundant variable in previous patch itself
> > v6:
> > * Obtain link rate index from fallback_link_rate using
> > the helper intel_dp_link_rate_index (Jani Nikula)
> > * Include fallback within intel_dp_start_link_train (Jani Nikula)
> > v5:
> > * Move set link status to drm core (Daniel Vetter, Jani Nikula)
> > v4:
> > * Add fallback support for non DDI platforms too
> > * Set connector->link status inside set_link_status function
> > (Jani Nikula)
> > v3:
> > * Set link status property to BAd unconditionally (Jani Nikula)
> > * Dont use two separate variables link_train_failed and link_status
> > to indicate same thing (Jani Nikula)
> > v2:
> > * Squashed a few patches (Jani Nikula)
> > 
> > Acked-by: Tony Cheng 
> > Acked-by: Harry Wentland 
> > Cc: Jani Nikula 
> > Cc: Daniel Vetter 
> > Cc: Ville Syrjala 
> > Signed-off-by: Manasi Navare 
> > ---
> >  drivers/gpu/drm/i915/intel_dp.c   | 44 
> > +++
> >  drivers/gpu/drm/i915/intel_dp_link_training.c | 25 +--
> >  drivers/gpu/drm/i915/intel_drv.h  |  3 ++
> >  3 files changed, 70 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/intel_dp.c 
> > b/drivers/gpu/drm/i915/intel_dp.c
> > index bc1268c..a50b6cd 100644
> > --- a/drivers/gpu/drm/i915/intel_dp.c
> > +++ b/drivers/gpu/drm/i915/intel_dp.c
> > @@ -4435,6 +4435,8 @@ static bool intel_digital_port_connected(struct 
> > drm_i915_private *dev_priv,
> > intel_dp->compliance_test_active = 0;
> > intel_dp->compliance_test_type = 0;
> > intel_dp->compliance_test_data = 0;
> > +   intel_dp->fallback_link_rate = 0;
> > +   intel_dp->fallback_lane_count = 0;
> 
> Hm, I thought we agreed on irc to just track the max link rate/lane count
> at all times, instead of fallback values that sometimes are valid and
> sometimes reset to 0.
> 
> Also, resetting to 0 here is wrong, since this is not the long-pulse hpd
> handler. That probably also explains why you need the hack below, but not
> sure.
> 
> >  
> > if (intel_dp->is_mst) {
> > DRM_DEBUG_KMS("MST device may have disappeared %d vs 
> > %d\n",
> > @@ -4526,6 +4528,13 @@ static bool intel_digital_port_connected(struct 
> > drm_i915_private *dev_priv,
> > DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n",
> >   connector->base.id, connector->name);
> >  
> > +   /* If this is a retry due to link training failure
> > +* then do no do a full detect
> > +*/
> > +   if (status == connector_status_connected &&
> > +   intel_dp->fallback_lane_count)
> > +   return status;
> 
> That sounds very wrong. Why do we need it?
> 
> > +
> > /* If full detect is not performed yet, do a full detect */
> > if (!intel_dp->detect_done)
> > status = intel_dp_long_pulse(intel_dp->attached_connector);
> > @@ -5690,6 +5699,37 @@ static bool intel_edp_init_connector(struct intel_dp 
> > *intel_dp,
> > return false;
> >  }
> >  
> > +static void intel_dp_modeset_retry_work_fn(struct work_struct *work)
> > +{
> > +   struct intel_connector *intel_connector;
> > +   struct drm_connector *connector;
> > +   struct drm_display_mode *mode;
> > +   bool verbose_prune = true;
> > +
> > +   intel_connector = container_of(work, typeof(*intel_connector),
> > +  modeset_retry_work);
> > +   connector = _connector->base;
> > +   DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n", connector->base.id,
> > + connector->name);
> > +
> > +   /* Grab the locks before changing connector property*/
> > +   mutex_lock(>dev->mode_config.mutex);
> > +   /* Set connector link status to BAD and send a Uevent to notify
> > +* userspace to do a modeset.
> > +*/
> > +   drm_mode_connector_set_link_status_property(connector,
> > +  

Re: [Intel-gfx] [PATCH 30/37] drm/i915: Use drm_framebuffer_plane_{width, height}() where possible

2016-11-30 Thread Daniel Vetter
On Fri, Nov 18, 2016 at 09:53:06PM +0200, ville.syrj...@linux.intel.com wrote:
> From: Ville Syrjälä 
> 
> Replace drm_format_plane_{width,height}() usage with
> drm_framebuffer_plane_{width,height}() to avoid the lookup of the format
> info.
> 
> Cc: intel-gfx@lists.freedesktop.org
> Signed-off-by: Ville Syrjälä 

Reviewed-by: Daniel Vetter 

> ---
>  drivers/gpu/drm/i915/intel_display.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_display.c 
> b/drivers/gpu/drm/i915/intel_display.c
> index 8f63fd38deee..5d8db436c557 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -2496,7 +2496,6 @@ intel_fill_fb_info(struct drm_i915_private *dev_priv,
>   struct intel_rotation_info *rot_info = _fb->rot_info;
>   u32 gtt_offset_rotated = 0;
>   unsigned int max_size = 0;
> - uint32_t format = fb->pixel_format;
>   int i, num_planes = fb->format->num_planes;
>   unsigned int tile_size = intel_tile_size(dev_priv);
>  
> @@ -2507,8 +2506,8 @@ intel_fill_fb_info(struct drm_i915_private *dev_priv,
>   int x, y;
>  
>   cpp = fb->format->cpp[i];
> - width = drm_format_plane_width(fb->width, format, i);
> - height = drm_format_plane_height(fb->height, format, i);
> + width = drm_framebuffer_plane_width(fb->width, fb, i);
> + height = drm_framebuffer_plane_height(fb->height, fb, i);
>  
>   intel_fb_offset_to_xy(, , fb, i);
>  
> -- 
> 2.7.4
> 
> ___
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 21/37] drm/i915: Populate fb->format early for inherited fbs

2016-11-30 Thread Daniel Vetter
On Wed, Nov 30, 2016 at 04:42:23PM +0100, Daniel Vetter wrote:
> On Fri, Nov 18, 2016 at 09:52:57PM +0200, ville.syrj...@linux.intel.com wrote:
> > From: Ville Syrjälä 
> > 
> > Make sure the framebuffer format info is available as early as possible
> > for fbs we inherit from the BIOS. This will allow us to use the fb as
> > if it was fully formed before we register it.
> > 
> > Cc: intel-gfx@lists.freedesktop.org
> > Signed-off-by: Ville Syrjälä 
> > ---
> >  drivers/gpu/drm/i915/intel_display.c | 3 +++
> >  1 file changed, 3 insertions(+)
> > 
> > diff --git a/drivers/gpu/drm/i915/intel_display.c 
> > b/drivers/gpu/drm/i915/intel_display.c
> > index 74a638c8de61..c45da6766fff 100644
> > --- a/drivers/gpu/drm/i915/intel_display.c
> > +++ b/drivers/gpu/drm/i915/intel_display.c
> > @@ -8717,6 +8717,7 @@ i9xx_get_initial_plane_config(struct intel_crtc *crtc,
> > fourcc = i9xx_format_to_fourcc(pixel_format);
> > fb->pixel_format = fourcc;
> > fb->bits_per_pixel = drm_format_plane_cpp(fourcc, 0) * 8;
> > +   fb->format = drm_format_info(fourcc);
> >  
> > if (INTEL_GEN(dev_priv) >= 4) {
> > if (plane_config->tiling)
> > @@ -9748,6 +9749,7 @@ skylake_get_initial_plane_config(struct intel_crtc 
> > *crtc,
> >   val & PLANE_CTL_ALPHA_MASK);
> > fb->pixel_format = fourcc;
> > fb->bits_per_pixel = drm_format_plane_cpp(fourcc, 0) * 8;
> > +   fb->format = drm_format_info(fourcc);
> >  
> > tiling = val & PLANE_CTL_TILED_MASK;
> > switch (tiling) {
> > @@ -9863,6 +9865,7 @@ ironlake_get_initial_plane_config(struct intel_crtc 
> > *crtc,
> > fourcc = i9xx_format_to_fourcc(pixel_format);
> > fb->pixel_format = fourcc;
> > fb->bits_per_pixel = drm_format_plane_cpp(fourcc, 0) * 8;
> > +   fb->format = drm_format_info(fourcc);
> 
> Do we really want to hand-roll this all, or could we somehow reuse
> fill_fb_struct? Or will this all go away again?

Looking at the end result I think doing the fill_fb_struct a pile earlier
would be nice. Or at least extract an set_fb_format helper or whatever to
set ->format and ->dev.

Needs a better name than set_fb_format though ;-)

Anyway, follow-up work.
-Daniel

> 
> I'll reserve judgement until the end, but this here looks correct ;-)
> 
> Reviewed-by: Daniel Vetter 
> 
> >  
> > base = I915_READ(DSPSURF(pipe)) & 0xf000;
> > if (IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv)) {
> > -- 
> > 2.7.4
> > 
> > ___
> > dri-devel mailing list
> > dri-de...@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/dri-devel
> 
> -- 
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 28/37] drm/i915: Store a pointer to the pixel format info for fbc

2016-11-30 Thread Daniel Vetter
On Fri, Nov 18, 2016 at 09:53:04PM +0200, ville.syrj...@linux.intel.com wrote:
> From: Ville Syrjälä 
> 
> Rather than store the pixel format and look up the format info as
> needed,  let's just store a pointer to the format info directly
> and speed up our lookups.
> 
> Cc: Paulo Zanoni 
> Cc: intel-gfx@lists.freedesktop.org
> Signed-off-by: Ville Syrjälä 

Assuming it all compiles still:

Reviewed-by: Daniel Vetter 

> ---
>  drivers/gpu/drm/i915/i915_drv.h  |  4 ++--
>  drivers/gpu/drm/i915/intel_fbc.c | 14 +++---
>  2 files changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index be67aeece749..692b79e056be 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -1026,7 +1026,7 @@ struct intel_fbc {
>  
>   struct {
>   u64 ilk_ggtt_offset;
> - uint32_t pixel_format;
> + const struct drm_format_info *format;
>   unsigned int stride;
>   int fence_reg;
>   unsigned int tiling_mode;
> @@ -1042,7 +1042,7 @@ struct intel_fbc {
>  
>   struct {
>   u64 ggtt_offset;
> - uint32_t pixel_format;
> + const struct drm_format_info *format;
>   unsigned int stride;
>   int fence_reg;
>   } fb;
> diff --git a/drivers/gpu/drm/i915/intel_fbc.c 
> b/drivers/gpu/drm/i915/intel_fbc.c
> index 62f215b12eb5..659cebc3bfd2 100644
> --- a/drivers/gpu/drm/i915/intel_fbc.c
> +++ b/drivers/gpu/drm/i915/intel_fbc.c
> @@ -188,7 +188,7 @@ static void g4x_fbc_activate(struct drm_i915_private 
> *dev_priv)
>   u32 dpfc_ctl;
>  
>   dpfc_ctl = DPFC_CTL_PLANE(params->crtc.plane) | DPFC_SR_EN;
> - if (drm_format_plane_cpp(params->fb.pixel_format, 0) == 2)
> + if (params->fb.format->cpp[0] == 2)
>   dpfc_ctl |= DPFC_CTL_LIMIT_2X;
>   else
>   dpfc_ctl |= DPFC_CTL_LIMIT_1X;
> @@ -235,7 +235,7 @@ static void ilk_fbc_activate(struct drm_i915_private 
> *dev_priv)
>   int threshold = dev_priv->fbc.threshold;
>  
>   dpfc_ctl = DPFC_CTL_PLANE(params->crtc.plane);
> - if (drm_format_plane_cpp(params->fb.pixel_format, 0) == 2)
> + if (params->fb.format->cpp[0] == 2)
>   threshold++;
>  
>   switch (threshold) {
> @@ -303,7 +303,7 @@ static void gen7_fbc_activate(struct drm_i915_private 
> *dev_priv)
>   if (IS_IVYBRIDGE(dev_priv))
>   dpfc_ctl |= IVB_DPFC_CTL_PLANE(params->crtc.plane);
>  
> - if (drm_format_plane_cpp(params->fb.pixel_format, 0) == 2)
> + if (params->fb.format->cpp[0] == 2)
>   threshold++;
>  
>   switch (threshold) {
> @@ -581,7 +581,7 @@ static int intel_fbc_alloc_cfb(struct intel_crtc *crtc)
>   WARN_ON(drm_mm_node_allocated(>compressed_fb));
>  
>   size = intel_fbc_calculate_cfb_size(dev_priv, >state_cache);
> - fb_cpp = drm_format_plane_cpp(fbc->state_cache.fb.pixel_format, 0);
> + fb_cpp = fbc->state_cache.fb.format->cpp[0];
>  
>   ret = find_compression_threshold(dev_priv, >compressed_fb,
>size, fb_cpp);
> @@ -764,7 +764,7 @@ static void intel_fbc_update_state_cache(struct 
> intel_crtc *crtc,
>* platforms that need. */
>   if (IS_GEN(dev_priv, 5, 6))
>   cache->fb.ilk_ggtt_offset = i915_gem_object_ggtt_offset(obj, 
> NULL);
> - cache->fb.pixel_format = fb->pixel_format;
> + cache->fb.format = fb->format;
>   cache->fb.stride = fb->pitches[0];
>   cache->fb.fence_reg = get_fence_id(fb);
>   cache->fb.tiling_mode = i915_gem_object_get_tiling(obj);
> @@ -823,7 +823,7 @@ static bool intel_fbc_can_activate(struct intel_crtc 
> *crtc)
>   return false;
>   }
>  
> - if (!pixel_format_is_valid(dev_priv, cache->fb.pixel_format)) {
> + if (!pixel_format_is_valid(dev_priv, cache->fb.format->format)) {
>   fbc->no_fbc_reason = "pixel format is invalid";
>   return false;
>   }
> @@ -892,7 +892,7 @@ static void intel_fbc_get_reg_params(struct intel_crtc 
> *crtc,
>   params->crtc.plane = crtc->plane;
>   params->crtc.fence_y_offset = get_crtc_fence_y_offset(crtc);
>  
> - params->fb.pixel_format = cache->fb.pixel_format;
> + params->fb.format = cache->fb.format;
>   params->fb.stride = cache->fb.stride;
>   params->fb.fence_reg = cache->fb.fence_reg;
>  
> -- 
> 2.7.4
> 
> ___
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
___

Re: [Intel-gfx] [PATCH 30/37] drm/i915: Use drm_framebuffer_plane_{width, height}() where possible

2016-11-30 Thread Daniel Vetter
On Fri, Nov 18, 2016 at 09:53:06PM +0200, ville.syrj...@linux.intel.com wrote:
> From: Ville Syrjälä 
> 
> Replace drm_format_plane_{width,height}() usage with
> drm_framebuffer_plane_{width,height}() to avoid the lookup of the format
> info.
> 
> Cc: intel-gfx@lists.freedesktop.org
> Signed-off-by: Ville Syrjälä 
> ---
>  drivers/gpu/drm/i915/intel_display.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_display.c 
> b/drivers/gpu/drm/i915/intel_display.c
> index 8f63fd38deee..5d8db436c557 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -2496,7 +2496,6 @@ intel_fill_fb_info(struct drm_i915_private *dev_priv,
>   struct intel_rotation_info *rot_info = _fb->rot_info;
>   u32 gtt_offset_rotated = 0;
>   unsigned int max_size = 0;
> - uint32_t format = fb->pixel_format;
>   int i, num_planes = fb->format->num_planes;
>   unsigned int tile_size = intel_tile_size(dev_priv);
>  
> @@ -2507,8 +2506,8 @@ intel_fill_fb_info(struct drm_i915_private *dev_priv,
>   int x, y;
>  
>   cpp = fb->format->cpp[i];
> - width = drm_format_plane_width(fb->width, format, i);
> - height = drm_format_plane_height(fb->height, format, i);

Grep seems to say that we can nuke these two after this patch? I didn't
find that patch in your series ...
-Daniel

> + width = drm_framebuffer_plane_width(fb->width, fb, i);
> + height = drm_framebuffer_plane_height(fb->height, fb, i);
>  
>   intel_fb_offset_to_xy(, , fb, i);
>  
> -- 
> 2.7.4
> 
> ___
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 24/37] drm/i915: Eliminate the ugly 'fb?:' constructs from the ilk/skl wm code

2016-11-30 Thread Ville Syrjälä
On Wed, Nov 30, 2016 at 04:51:33PM +0100, Daniel Vetter wrote:
> On Fri, Nov 18, 2016 at 09:53:00PM +0200, ville.syrj...@linux.intel.com wrote:
> > From: Ville Syrjälä 
> > 
> > Don't access plane_state->fb until we know the plane to be visible.
> > It it's visible, it will have an fb, and thus we don't have to
> > consider the NULL fb case. Makes the code look nicer.
> > 
> > Cc: intel-gfx@lists.freedesktop.org
> > Signed-off-by: Ville Syrjälä 
> > ---
> >  drivers/gpu/drm/i915/intel_pm.c | 23 +++
> >  1 file changed, 15 insertions(+), 8 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/intel_pm.c 
> > b/drivers/gpu/drm/i915/intel_pm.c
> > index bbb1eaf1e6db..8ba7413872dd 100644
> > --- a/drivers/gpu/drm/i915/intel_pm.c
> > +++ b/drivers/gpu/drm/i915/intel_pm.c
> > @@ -1781,13 +1781,14 @@ static uint32_t ilk_compute_pri_wm(const struct 
> > intel_crtc_state *cstate,
> >uint32_t mem_value,
> >bool is_lp)
> >  {
> > -   int cpp = pstate->base.fb ?
> > -   drm_format_plane_cpp(pstate->base.fb->pixel_format, 0) : 0;
> > uint32_t method1, method2;
> > +   int cpp;
> >  
> > if (!cstate->base.active || !pstate->base.visible)
> > return 0;
> 
> Why do we still look for crtc_state->active here? Sounds like a bug in
> proper validating our wm needs.

Yeah, unfortunately that thing is still broken all over :( There are
broken assumptions about this higher up as well, so fixing this will
involve actual work I fear.

> Anway, change itself looks good.
> 
> Reviewed-by: Daniel Vetter 
> 
> >  
> > +   cpp = drm_format_plane_cpp(pstate->base.fb->pixel_format, 0);
> > +
> > method1 = ilk_wm_method1(ilk_pipe_pixel_rate(cstate), cpp, mem_value);
> >  
> > if (!is_lp)
> > @@ -1809,13 +1810,14 @@ static uint32_t ilk_compute_spr_wm(const struct 
> > intel_crtc_state *cstate,
> >const struct intel_plane_state *pstate,
> >uint32_t mem_value)
> >  {
> > -   int cpp = pstate->base.fb ?
> > -   drm_format_plane_cpp(pstate->base.fb->pixel_format, 0) : 0;
> > uint32_t method1, method2;
> > +   int cpp;
> >  
> > if (!cstate->base.active || !pstate->base.visible)
> > return 0;
> >  
> > +   cpp = drm_format_plane_cpp(pstate->base.fb->pixel_format, 0);
> > +
> > method1 = ilk_wm_method1(ilk_pipe_pixel_rate(cstate), cpp, mem_value);
> > method2 = ilk_wm_method2(ilk_pipe_pixel_rate(cstate),
> >  cstate->base.adjusted_mode.crtc_htotal,
> > @@ -1853,12 +1855,13 @@ static uint32_t ilk_compute_fbc_wm(const struct 
> > intel_crtc_state *cstate,
> >const struct intel_plane_state *pstate,
> >uint32_t pri_val)
> >  {
> > -   int cpp = pstate->base.fb ?
> > -   drm_format_plane_cpp(pstate->base.fb->pixel_format, 0) : 0;
> > +   int cpp;
> >  
> > if (!cstate->base.active || !pstate->base.visible)
> > return 0;
> >  
> > +   cpp = drm_format_plane_cpp(pstate->base.fb->pixel_format, 0);
> > +
> > return ilk_wm_fbc(pri_val, drm_rect_width(>base.dst), cpp);
> >  }
> >  
> > @@ -3229,13 +3232,17 @@ skl_plane_relative_data_rate(const struct 
> > intel_crtc_state *cstate,
> >  int y)
> >  {
> > struct intel_plane_state *intel_pstate = to_intel_plane_state(pstate);
> > -   struct drm_framebuffer *fb = pstate->fb;
> > uint32_t down_scale_amount, data_rate;
> > uint32_t width = 0, height = 0;
> > -   unsigned format = fb ? fb->pixel_format : DRM_FORMAT_XRGB;
> > +   struct drm_framebuffer *fb;
> > +   u32 format;
> >  
> > if (!intel_pstate->base.visible)
> > return 0;
> > +
> > +   fb = pstate->fb;
> > +   format = fb->pixel_format;
> > +
> > if (pstate->plane->type == DRM_PLANE_TYPE_CURSOR)
> > return 0;
> > if (y && format != DRM_FORMAT_NV12)
> > -- 
> > 2.7.4
> > 
> > ___
> > Intel-gfx mailing list
> > Intel-gfx@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/intel-gfx
> 
> -- 
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch

-- 
Ville Syrjälä
Intel OTC
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 21/37] drm/i915: Populate fb->format early for inherited fbs

2016-11-30 Thread Ville Syrjälä
On Wed, Nov 30, 2016 at 04:42:23PM +0100, Daniel Vetter wrote:
> On Fri, Nov 18, 2016 at 09:52:57PM +0200, ville.syrj...@linux.intel.com wrote:
> > From: Ville Syrjälä 
> > 
> > Make sure the framebuffer format info is available as early as possible
> > for fbs we inherit from the BIOS. This will allow us to use the fb as
> > if it was fully formed before we register it.
> > 
> > Cc: intel-gfx@lists.freedesktop.org
> > Signed-off-by: Ville Syrjälä 
> > ---
> >  drivers/gpu/drm/i915/intel_display.c | 3 +++
> >  1 file changed, 3 insertions(+)
> > 
> > diff --git a/drivers/gpu/drm/i915/intel_display.c 
> > b/drivers/gpu/drm/i915/intel_display.c
> > index 74a638c8de61..c45da6766fff 100644
> > --- a/drivers/gpu/drm/i915/intel_display.c
> > +++ b/drivers/gpu/drm/i915/intel_display.c
> > @@ -8717,6 +8717,7 @@ i9xx_get_initial_plane_config(struct intel_crtc *crtc,
> > fourcc = i9xx_format_to_fourcc(pixel_format);
> > fb->pixel_format = fourcc;
> > fb->bits_per_pixel = drm_format_plane_cpp(fourcc, 0) * 8;
> > +   fb->format = drm_format_info(fourcc);
> >  
> > if (INTEL_GEN(dev_priv) >= 4) {
> > if (plane_config->tiling)
> > @@ -9748,6 +9749,7 @@ skylake_get_initial_plane_config(struct intel_crtc 
> > *crtc,
> >   val & PLANE_CTL_ALPHA_MASK);
> > fb->pixel_format = fourcc;
> > fb->bits_per_pixel = drm_format_plane_cpp(fourcc, 0) * 8;
> > +   fb->format = drm_format_info(fourcc);
> >  
> > tiling = val & PLANE_CTL_TILED_MASK;
> > switch (tiling) {
> > @@ -9863,6 +9865,7 @@ ironlake_get_initial_plane_config(struct intel_crtc 
> > *crtc,
> > fourcc = i9xx_format_to_fourcc(pixel_format);
> > fb->pixel_format = fourcc;
> > fb->bits_per_pixel = drm_format_plane_cpp(fourcc, 0) * 8;
> > +   fb->format = drm_format_info(fourcc);
> 
> Do we really want to hand-roll this all, or could we somehow reuse
> fill_fb_struct? Or will this all go away again?

Yeah, I think we'll want to flip all of this over to using
fill_fb_struct(). Just didn't have the energy to look into that yet,
and the series was already getting too long anyway. So figured I'd save
that for the next round.

> 
> I'll reserve judgement until the end, but this here looks correct ;-)
> 
> Reviewed-by: Daniel Vetter 
> 
> >  
> > base = I915_READ(DSPSURF(pipe)) & 0xf000;
> > if (IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv)) {
> > -- 
> > 2.7.4
> > 
> > ___
> > dri-devel mailing list
> > dri-de...@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/dri-devel
> 
> -- 
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch

-- 
Ville Syrjälä
Intel OTC
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 2/2] drm/i915/audio: Extend audio sync rate support for DP MST

2016-11-30 Thread Jani Nikula
On Wed, 30 Nov 2016, "Yang, Libin"  wrote:
>>-Original Message-
>>From: Jani Nikula [mailto:jani.nik...@linux.intel.com]
>>Sent: Wednesday, November 30, 2016 12:34 AM
>>To: Yang, Libin ; intel-gfx@lists.freedesktop.org;
>>ville.syrj...@linux.intel.com; Vetter, Daniel ;
>>Pandiyan, Dhinakaran ; Kp, Jeeja
>>; ti...@suse.de
>>Cc: Yang, Libin 
>>Subject: Re: [PATCH 2/2] drm/i915/audio: Extend audio sync rate support for
>>DP MST
>>
>>On Tue, 15 Nov 2016, libin.y...@intel.com wrote:
>>> From: Libin Yang 
>>>
>>> This patch extends the support of audio sample rate sync up to DP MST.
>>>
>>> Signed-off-by: Libin Yang 
>>> ---
>>>  drivers/gpu/drm/i915/intel_audio.c | 3 ++-
>>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/gpu/drm/i915/intel_audio.c
>>> b/drivers/gpu/drm/i915/intel_audio.c
>>> index c8a1345..88ed869 100644
>>> --- a/drivers/gpu/drm/i915/intel_audio.c
>>> +++ b/drivers/gpu/drm/i915/intel_audio.c
>>> @@ -807,7 +807,8 @@ static int
>>i915_audio_component_sync_audio_rate(struct device *kdev, int port,
>>> intel_encoder = get_saved_enc(dev_priv, port, pipe);
>>> if (!intel_encoder || !intel_encoder->base.crtc ||
>>> (intel_encoder->type != INTEL_OUTPUT_HDMI &&
>>> -intel_encoder->type != INTEL_OUTPUT_DP)) {
>>> +intel_encoder->type != INTEL_OUTPUT_DP &&
>>> +intel_encoder->type != INTEL_OUTPUT_DP_MST)) {
>>
>>I think the better option is to make absolutely sure we never store other 
>>kinds
>>of encoders in dev_priv->av_enc_map[pipe] to begin with. I think that's true
>>already, but please add
>>
>>  if (WARN_ON(intel_encoder->type != INTEL_OUTPUT_HDMI &&
>>  intel_encoder->type != INTEL_OUTPUT_DP &&
>>  intel_encoder->type != INTEL_OUTPUT_DP_MST))
>>  return;
>>
>>near the beginning of intel_audio_codec_enable(), and remove the type
>>checks here. This reduces the confusion about different kinds of checks after
>>calling get_saved_enc().
>
> We can't put the check at the beginning of the function.
> We still need the check in the same place as we need get intel_encoder at 
> first.

We do not need to duplicate the checks here if we ensure only good stuff
is ever put into av_enc_map.

>
> Regards,
> Libin
>
>>
>>BR,
>>Jani.
>>
>>
>>> DRM_DEBUG_KMS("Not valid for port %c\n",
>>port_name(port));
>>> err = -ENODEV;
>>> goto unlock;
>>
>>--
>>Jani Nikula, Intel Open Source Technology Center

-- 
Jani Nikula, Intel Open Source Technology Center
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 24/37] drm/i915: Eliminate the ugly 'fb?:' constructs from the ilk/skl wm code

2016-11-30 Thread Daniel Vetter
On Fri, Nov 18, 2016 at 09:53:00PM +0200, ville.syrj...@linux.intel.com wrote:
> From: Ville Syrjälä 
> 
> Don't access plane_state->fb until we know the plane to be visible.
> It it's visible, it will have an fb, and thus we don't have to
> consider the NULL fb case. Makes the code look nicer.
> 
> Cc: intel-gfx@lists.freedesktop.org
> Signed-off-by: Ville Syrjälä 
> ---
>  drivers/gpu/drm/i915/intel_pm.c | 23 +++
>  1 file changed, 15 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
> index bbb1eaf1e6db..8ba7413872dd 100644
> --- a/drivers/gpu/drm/i915/intel_pm.c
> +++ b/drivers/gpu/drm/i915/intel_pm.c
> @@ -1781,13 +1781,14 @@ static uint32_t ilk_compute_pri_wm(const struct 
> intel_crtc_state *cstate,
>  uint32_t mem_value,
>  bool is_lp)
>  {
> - int cpp = pstate->base.fb ?
> - drm_format_plane_cpp(pstate->base.fb->pixel_format, 0) : 0;
>   uint32_t method1, method2;
> + int cpp;
>  
>   if (!cstate->base.active || !pstate->base.visible)
>   return 0;

Why do we still look for crtc_state->active here? Sounds like a bug in
proper validating our wm needs. Anway, change itself looks good.

Reviewed-by: Daniel Vetter 

>  
> + cpp = drm_format_plane_cpp(pstate->base.fb->pixel_format, 0);
> +
>   method1 = ilk_wm_method1(ilk_pipe_pixel_rate(cstate), cpp, mem_value);
>  
>   if (!is_lp)
> @@ -1809,13 +1810,14 @@ static uint32_t ilk_compute_spr_wm(const struct 
> intel_crtc_state *cstate,
>  const struct intel_plane_state *pstate,
>  uint32_t mem_value)
>  {
> - int cpp = pstate->base.fb ?
> - drm_format_plane_cpp(pstate->base.fb->pixel_format, 0) : 0;
>   uint32_t method1, method2;
> + int cpp;
>  
>   if (!cstate->base.active || !pstate->base.visible)
>   return 0;
>  
> + cpp = drm_format_plane_cpp(pstate->base.fb->pixel_format, 0);
> +
>   method1 = ilk_wm_method1(ilk_pipe_pixel_rate(cstate), cpp, mem_value);
>   method2 = ilk_wm_method2(ilk_pipe_pixel_rate(cstate),
>cstate->base.adjusted_mode.crtc_htotal,
> @@ -1853,12 +1855,13 @@ static uint32_t ilk_compute_fbc_wm(const struct 
> intel_crtc_state *cstate,
>  const struct intel_plane_state *pstate,
>  uint32_t pri_val)
>  {
> - int cpp = pstate->base.fb ?
> - drm_format_plane_cpp(pstate->base.fb->pixel_format, 0) : 0;
> + int cpp;
>  
>   if (!cstate->base.active || !pstate->base.visible)
>   return 0;
>  
> + cpp = drm_format_plane_cpp(pstate->base.fb->pixel_format, 0);
> +
>   return ilk_wm_fbc(pri_val, drm_rect_width(>base.dst), cpp);
>  }
>  
> @@ -3229,13 +3232,17 @@ skl_plane_relative_data_rate(const struct 
> intel_crtc_state *cstate,
>int y)
>  {
>   struct intel_plane_state *intel_pstate = to_intel_plane_state(pstate);
> - struct drm_framebuffer *fb = pstate->fb;
>   uint32_t down_scale_amount, data_rate;
>   uint32_t width = 0, height = 0;
> - unsigned format = fb ? fb->pixel_format : DRM_FORMAT_XRGB;
> + struct drm_framebuffer *fb;
> + u32 format;
>  
>   if (!intel_pstate->base.visible)
>   return 0;
> +
> + fb = pstate->fb;
> + format = fb->pixel_format;
> +
>   if (pstate->plane->type == DRM_PLANE_TYPE_CURSOR)
>   return 0;
>   if (y && format != DRM_FORMAT_NV12)
> -- 
> 2.7.4
> 
> ___
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 21/37] drm/i915: Populate fb->format early for inherited fbs

2016-11-30 Thread Daniel Vetter
On Fri, Nov 18, 2016 at 09:52:57PM +0200, ville.syrj...@linux.intel.com wrote:
> From: Ville Syrjälä 
> 
> Make sure the framebuffer format info is available as early as possible
> for fbs we inherit from the BIOS. This will allow us to use the fb as
> if it was fully formed before we register it.
> 
> Cc: intel-gfx@lists.freedesktop.org
> Signed-off-by: Ville Syrjälä 
> ---
>  drivers/gpu/drm/i915/intel_display.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/intel_display.c 
> b/drivers/gpu/drm/i915/intel_display.c
> index 74a638c8de61..c45da6766fff 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -8717,6 +8717,7 @@ i9xx_get_initial_plane_config(struct intel_crtc *crtc,
>   fourcc = i9xx_format_to_fourcc(pixel_format);
>   fb->pixel_format = fourcc;
>   fb->bits_per_pixel = drm_format_plane_cpp(fourcc, 0) * 8;
> + fb->format = drm_format_info(fourcc);
>  
>   if (INTEL_GEN(dev_priv) >= 4) {
>   if (plane_config->tiling)
> @@ -9748,6 +9749,7 @@ skylake_get_initial_plane_config(struct intel_crtc 
> *crtc,
> val & PLANE_CTL_ALPHA_MASK);
>   fb->pixel_format = fourcc;
>   fb->bits_per_pixel = drm_format_plane_cpp(fourcc, 0) * 8;
> + fb->format = drm_format_info(fourcc);
>  
>   tiling = val & PLANE_CTL_TILED_MASK;
>   switch (tiling) {
> @@ -9863,6 +9865,7 @@ ironlake_get_initial_plane_config(struct intel_crtc 
> *crtc,
>   fourcc = i9xx_format_to_fourcc(pixel_format);
>   fb->pixel_format = fourcc;
>   fb->bits_per_pixel = drm_format_plane_cpp(fourcc, 0) * 8;
> + fb->format = drm_format_info(fourcc);

Do we really want to hand-roll this all, or could we somehow reuse
fill_fb_struct? Or will this all go away again?

I'll reserve judgement until the end, but this here looks correct ;-)

Reviewed-by: Daniel Vetter 

>  
>   base = I915_READ(DSPSURF(pipe)) & 0xf000;
>   if (IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv)) {
> -- 
> 2.7.4
> 
> ___
> dri-devel mailing list
> dri-de...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH 5/6] drm/i915: give G45 and GM45 their own platform enums

2016-11-30 Thread Jani Nikula
Distinguish them better.

Signed-off-by: Jani Nikula 
---
 drivers/gpu/drm/i915/i915_drv.h  | 8 +---
 drivers/gpu/drm/i915/i915_pci.c  | 4 ++--
 drivers/gpu/drm/i915/intel_device_info.c | 3 ++-
 3 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index ee5af9140e7c..373eeef4f67c 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -752,7 +752,8 @@ enum intel_platform {
INTEL_PINEVIEW,
INTEL_I965G,
INTEL_I965GM,
-   INTEL_G4X,
+   INTEL_G45,
+   INTEL_GM45,
INTEL_IRONLAKE,
INTEL_SANDYBRIDGE,
INTEL_IVYBRIDGE,
@@ -2518,8 +2519,9 @@ intel_info(const struct drm_i915_private *dev_priv)
 #define IS_I945GM(dev_priv)((dev_priv)->info.platform == INTEL_I945GM)
 #define IS_I965G(dev_priv) ((dev_priv)->info.platform == INTEL_I965G)
 #define IS_I965GM(dev_priv)((dev_priv)->info.platform == INTEL_I965GM)
-#define IS_GM45(dev_priv)  (INTEL_DEVID(dev_priv) == 0x2A42)
-#define IS_G4X(dev_priv)   ((dev_priv)->info.platform == INTEL_G4X)
+#define IS_G45(dev_priv)   ((dev_priv)->info.platform == INTEL_G45)
+#define IS_GM45(dev_priv)  ((dev_priv)->info.platform == INTEL_GM45)
+#define IS_G4X(dev_priv)   (IS_G45(dev_priv) || IS_GM45(dev_priv))
 #define IS_PINEVIEW_G(dev_priv)(INTEL_DEVID(dev_priv) == 0xa001)
 #define IS_PINEVIEW_M(dev_priv)(INTEL_DEVID(dev_priv) == 0xa011)
 #define IS_PINEVIEW(dev_priv)  ((dev_priv)->info.is_pineview)
diff --git a/drivers/gpu/drm/i915/i915_pci.c b/drivers/gpu/drm/i915/i915_pci.c
index 44f772b00c4d..3ffdc9119fd4 100644
--- a/drivers/gpu/drm/i915/i915_pci.c
+++ b/drivers/gpu/drm/i915/i915_pci.c
@@ -172,14 +172,14 @@ static const struct intel_device_info intel_i965gm_info = 
{
 
 static const struct intel_device_info intel_g45_info = {
GEN4_FEATURES,
-   .platform = INTEL_G4X,
+   .platform = INTEL_G45,
.has_pipe_cxsr = 1,
.ring_mask = RENDER_RING | BSD_RING,
 };
 
 static const struct intel_device_info intel_gm45_info = {
GEN4_FEATURES,
-   .platform = INTEL_G4X,
+   .platform = INTEL_GM45,
.is_mobile = 1, .has_fbc = 1,
.has_pipe_cxsr = 1,
.supports_tv = 1,
diff --git a/drivers/gpu/drm/i915/intel_device_info.c 
b/drivers/gpu/drm/i915/intel_device_info.c
index d6ec15a27e17..bdae2e48bbc6 100644
--- a/drivers/gpu/drm/i915/intel_device_info.c
+++ b/drivers/gpu/drm/i915/intel_device_info.c
@@ -38,7 +38,8 @@ static const char * const platform_names[] = {
PLATFORM_NAME(PINEVIEW),
PLATFORM_NAME(I965G),
PLATFORM_NAME(I965GM),
-   PLATFORM_NAME(G4X),
+   PLATFORM_NAME(G45),
+   PLATFORM_NAME(GM45),
PLATFORM_NAME(IRONLAKE),
PLATFORM_NAME(SANDYBRIDGE),
PLATFORM_NAME(IVYBRIDGE),
-- 
2.1.4

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH 2/6] drm/i915: keep intel device info structs in gen based order

2016-11-30 Thread Jani Nikula
Move G33 and Pineview higher up in the list. Add a couple of blank lines
for OCD while at it.

Signed-off-by: Jani Nikula 
---
 drivers/gpu/drm/i915/i915_pci.c | 32 ++--
 1 file changed, 18 insertions(+), 14 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_pci.c b/drivers/gpu/drm/i915/i915_pci.c
index 804038f4f162..81eb530c2c3d 100644
--- a/drivers/gpu/drm/i915/i915_pci.c
+++ b/drivers/gpu/drm/i915/i915_pci.c
@@ -54,6 +54,7 @@
 #define CHV_COLORS \
.color = { .degamma_lut_size = 65, .gamma_lut_size = 257 }
 
+/* Keep in gen based order, and chronological order within a gen */
 #define GEN2_FEATURES \
.gen = 2, .num_pipes = 1, \
.has_overlay = 1, .overlay_needs_physical = 1, \
@@ -101,6 +102,7 @@ static const struct intel_device_info intel_i915g_info = {
.has_overlay = 1, .overlay_needs_physical = 1,
.hws_needs_physical = 1,
 };
+
 static const struct intel_device_info intel_i915gm_info = {
GEN3_FEATURES,
.platform = INTEL_I915GM,
@@ -111,6 +113,7 @@ static const struct intel_device_info intel_i915gm_info = {
.has_fbc = 1,
.hws_needs_physical = 1,
 };
+
 static const struct intel_device_info intel_i945g_info = {
GEN3_FEATURES,
.platform = INTEL_I945G,
@@ -118,6 +121,7 @@ static const struct intel_device_info intel_i945g_info = {
.has_overlay = 1, .overlay_needs_physical = 1,
.hws_needs_physical = 1,
 };
+
 static const struct intel_device_info intel_i945gm_info = {
GEN3_FEATURES,
.platform = INTEL_I945GM, .is_mobile = 1,
@@ -128,6 +132,20 @@ static const struct intel_device_info intel_i945gm_info = {
.hws_needs_physical = 1,
 };
 
+static const struct intel_device_info intel_g33_info = {
+   GEN3_FEATURES,
+   .platform = INTEL_G33,
+   .has_hotplug = 1,
+   .has_overlay = 1,
+};
+
+static const struct intel_device_info intel_pineview_info = {
+   GEN3_FEATURES,
+   .platform = INTEL_G33, .is_pineview = 1, .is_mobile = 1,
+   .has_hotplug = 1,
+   .has_overlay = 1,
+};
+
 #define GEN4_FEATURES \
.gen = 4, .num_pipes = 2, \
.has_hotplug = 1, \
@@ -152,13 +170,6 @@ static const struct intel_device_info intel_i965gm_info = {
.hws_needs_physical = 1,
 };
 
-static const struct intel_device_info intel_g33_info = {
-   GEN3_FEATURES,
-   .platform = INTEL_G33,
-   .has_hotplug = 1,
-   .has_overlay = 1,
-};
-
 static const struct intel_device_info intel_g45_info = {
GEN4_FEATURES,
.platform = INTEL_G4X,
@@ -175,13 +186,6 @@ static const struct intel_device_info intel_gm45_info = {
.ring_mask = RENDER_RING | BSD_RING,
 };
 
-static const struct intel_device_info intel_pineview_info = {
-   GEN3_FEATURES,
-   .platform = INTEL_G33, .is_pineview = 1, .is_mobile = 1,
-   .has_hotplug = 1,
-   .has_overlay = 1,
-};
-
 #define GEN5_FEATURES \
.gen = 5, .num_pipes = 2, \
.has_hotplug = 1, \
-- 
2.1.4

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH 6/6] drm/i915: use platform enum instead of duplicating PCI ID if possible

2016-11-30 Thread Jani Nikula
Duplicating the PCI ID for IS_FOO checks is redundant for a bunch of
platforms. Simplify.

Signed-off-by: Jani Nikula 
---
 drivers/gpu/drm/i915/i915_drv.h | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 373eeef4f67c..4d573705a836 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -2509,13 +2509,13 @@ intel_info(const struct drm_i915_private *dev_priv)
 #define IS_REVID(p, since, until) \
(INTEL_REVID(p) >= (since) && INTEL_REVID(p) <= (until))
 
-#define IS_I830(dev_priv)  (INTEL_DEVID(dev_priv) == 0x3577)
-#define IS_I845G(dev_priv) (INTEL_DEVID(dev_priv) == 0x2562)
+#define IS_I830(dev_priv)  ((dev_priv)->info.platform == INTEL_I830)
+#define IS_I845G(dev_priv) ((dev_priv)->info.platform == INTEL_I845G)
 #define IS_I85X(dev_priv)  ((dev_priv)->info.platform == INTEL_I85X)
-#define IS_I865G(dev_priv) (INTEL_DEVID(dev_priv) == 0x2572)
+#define IS_I865G(dev_priv) ((dev_priv)->info.platform == INTEL_I865G)
 #define IS_I915G(dev_priv) ((dev_priv)->info.platform == INTEL_I915G)
-#define IS_I915GM(dev_priv)(INTEL_DEVID(dev_priv) == 0x2592)
-#define IS_I945G(dev_priv) (INTEL_DEVID(dev_priv) == 0x2772)
+#define IS_I915GM(dev_priv)((dev_priv)->info.platform == INTEL_I915GM)
+#define IS_I945G(dev_priv) ((dev_priv)->info.platform == INTEL_I945G)
 #define IS_I945GM(dev_priv)((dev_priv)->info.platform == INTEL_I945GM)
 #define IS_I965G(dev_priv) ((dev_priv)->info.platform == INTEL_I965G)
 #define IS_I965GM(dev_priv)((dev_priv)->info.platform == INTEL_I965GM)
-- 
2.1.4

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH 3/6] drm/i915: rename BROADWATER and CRESTLINE to I965G and I965GM, respectively

2016-11-30 Thread Jani Nikula
Add more consistency to our naming. Pineview remains the outlier. Keep
using code names for gen5+.

Signed-off-by: Jani Nikula 
---
 drivers/gpu/drm/i915/i915_debugfs.c  | 2 +-
 drivers/gpu/drm/i915/i915_drv.c  | 2 +-
 drivers/gpu/drm/i915/i915_drv.h  | 8 
 drivers/gpu/drm/i915/i915_gem.c  | 2 +-
 drivers/gpu/drm/i915/i915_gem_internal.c | 2 +-
 drivers/gpu/drm/i915/i915_pci.c  | 4 ++--
 drivers/gpu/drm/i915/intel_device_info.c | 4 ++--
 drivers/gpu/drm/i915/intel_display.c | 8 
 drivers/gpu/drm/i915/intel_pm.c  | 6 +++---
 9 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_debugfs.c 
b/drivers/gpu/drm/i915/i915_debugfs.c
index 15fb97dd9ed3..91abacbe3570 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -1734,7 +1734,7 @@ static int i915_sr_status(struct seq_file *m, void 
*unused)
 
if (HAS_PCH_SPLIT(dev_priv))
sr_enabled = I915_READ(WM1_LP_ILK) & WM1_LP_SR_EN;
-   else if (IS_CRESTLINE(dev_priv) || IS_G4X(dev_priv) ||
+   else if (IS_I965GM(dev_priv) || IS_G4X(dev_priv) ||
 IS_I945G(dev_priv) || IS_I945GM(dev_priv))
sr_enabled = I915_READ(FW_BLC_SELF) & FW_BLC_SELF_EN;
else if (IS_I915GM(dev_priv))
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 8dac298461c0..616d424177d3 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -1048,7 +1048,7 @@ static int i915_driver_init_hw(struct drm_i915_private 
*dev_priv)
 * behaviour if any general state is accessed within a page above 4GB,
 * which also needs to be handled carefully.
 */
-   if (IS_BROADWATER(dev_priv) || IS_CRESTLINE(dev_priv)) {
+   if (IS_I965G(dev_priv) || IS_I965GM(dev_priv)) {
ret = dma_set_coherent_mask(>dev, DMA_BIT_MASK(32));
 
if (ret) {
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 494237ed084d..66384c407dbd 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -750,8 +750,8 @@ enum intel_platform {
INTEL_I945GM,
INTEL_G33,
INTEL_PINEVIEW,
-   INTEL_BROADWATER,
-   INTEL_CRESTLINE,
+   INTEL_I965G,
+   INTEL_I965GM,
INTEL_G4X,
INTEL_IRONLAKE,
INTEL_SANDYBRIDGE,
@@ -2516,8 +2516,8 @@ intel_info(const struct drm_i915_private *dev_priv)
 #define IS_I915GM(dev_priv)(INTEL_DEVID(dev_priv) == 0x2592)
 #define IS_I945G(dev_priv) (INTEL_DEVID(dev_priv) == 0x2772)
 #define IS_I945GM(dev_priv)((dev_priv)->info.platform == INTEL_I945GM)
-#define IS_BROADWATER(dev_priv)((dev_priv)->info.platform == 
INTEL_BROADWATER)
-#define IS_CRESTLINE(dev_priv) ((dev_priv)->info.platform == INTEL_CRESTLINE)
+#define IS_I965G(dev_priv) ((dev_priv)->info.platform == INTEL_I965G)
+#define IS_I965GM(dev_priv)((dev_priv)->info.platform == INTEL_I965GM)
 #define IS_GM45(dev_priv)  (INTEL_DEVID(dev_priv) == 0x2A42)
 #define IS_G4X(dev_priv)   ((dev_priv)->info.platform == INTEL_G4X)
 #define IS_PINEVIEW_G(dev_priv)(INTEL_DEVID(dev_priv) == 0xa001)
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 8ebefb6f6cf2..41ab5d93e419 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -3999,7 +3999,7 @@ i915_gem_object_create(struct drm_device *dev, u64 size)
goto fail;
 
mask = GFP_HIGHUSER | __GFP_RECLAIMABLE;
-   if (IS_CRESTLINE(dev_priv) || IS_BROADWATER(dev_priv)) {
+   if (IS_I965GM(dev_priv) || IS_I965G(dev_priv)) {
/* 965gm cannot relocate objects above 4GiB. */
mask &= ~__GFP_HIGHMEM;
mask |= __GFP_DMA32;
diff --git a/drivers/gpu/drm/i915/i915_gem_internal.c 
b/drivers/gpu/drm/i915/i915_gem_internal.c
index 4b3ff3e5b911..7e7afb5ba3a2 100644
--- a/drivers/gpu/drm/i915/i915_gem_internal.c
+++ b/drivers/gpu/drm/i915/i915_gem_internal.c
@@ -71,7 +71,7 @@ i915_gem_object_get_pages_internal(struct drm_i915_gem_object 
*obj)
 #endif
 
gfp = GFP_KERNEL | __GFP_HIGHMEM | __GFP_RECLAIMABLE;
-   if (IS_CRESTLINE(i915) || IS_BROADWATER(i915)) {
+   if (IS_I965GM(i915) || IS_I965G(i915)) {
/* 965gm cannot relocate objects above 4GiB. */
gfp &= ~__GFP_HIGHMEM;
gfp |= __GFP_DMA32;
diff --git a/drivers/gpu/drm/i915/i915_pci.c b/drivers/gpu/drm/i915/i915_pci.c
index 81eb530c2c3d..5ce4c64cbd49 100644
--- a/drivers/gpu/drm/i915/i915_pci.c
+++ b/drivers/gpu/drm/i915/i915_pci.c
@@ -156,14 +156,14 @@ static const struct intel_device_info intel_pineview_info 
= {
 
 static const struct intel_device_info intel_i965g_info = {
GEN4_FEATURES,
-   .platform = INTEL_BROADWATER,
+   .platform = INTEL_I965G,
.has_overlay = 

[Intel-gfx] [PATCH 1/6] drm/i915: replace platform flags with a platform enum

2016-11-30 Thread Jani Nikula
The platform flags in device info are (mostly) mutually
exclusive. Replace the flags with an enum. Add the platform enum also
for platforms that previously didn't have a flag, and give them codename
logging in dmesg.

Pineview remains an exception, the platform being G33 for that.

v2: Sort enum by gen and date

Signed-off-by: Jani Nikula 
---
 drivers/gpu/drm/i915/i915_debugfs.c  |  1 +
 drivers/gpu/drm/i915/i915_drv.h  | 76 +++-
 drivers/gpu/drm/i915/i915_gpu_error.c|  1 +
 drivers/gpu/drm/i915/i915_pci.c  | 53 +-
 drivers/gpu/drm/i915/intel_device_info.c | 40 -
 5 files changed, 117 insertions(+), 54 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_debugfs.c 
b/drivers/gpu/drm/i915/i915_debugfs.c
index 2434130087be..15fb97dd9ed3 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -77,6 +77,7 @@ static int i915_capabilities(struct seq_file *m, void *data)
const struct intel_device_info *info = INTEL_INFO(dev_priv);
 
seq_printf(m, "gen: %d\n", INTEL_GEN(dev_priv));
+   seq_printf(m, "platform: %s\n", intel_platform_name(info->platform));
seq_printf(m, "pch: %d\n", INTEL_PCH_TYPE(dev_priv));
 #define PRINT_FLAG(x)  seq_printf(m, #x ": %s\n", yesno(info->x))
DEV_INFO_FOR_EACH_FLAG(PRINT_FLAG);
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 297ad03ab0c2..494237ed084d 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -686,24 +686,8 @@ struct intel_csr {
 };
 
 #define DEV_INFO_FOR_EACH_FLAG(func) \
-   /* Keep is_* in chronological order */ \
func(is_mobile); \
-   func(is_i85x); \
-   func(is_i915g); \
-   func(is_i945gm); \
-   func(is_g33); \
-   func(is_g4x); \
func(is_pineview); \
-   func(is_broadwater); \
-   func(is_crestline); \
-   func(is_ivybridge); \
-   func(is_valleyview); \
-   func(is_cherryview); \
-   func(is_haswell); \
-   func(is_broadwell); \
-   func(is_skylake); \
-   func(is_broxton); \
-   func(is_kabylake); \
func(is_alpha_support); \
/* Keep has_* in alphabetical order */ \
func(has_64bit_reloc); \
@@ -753,6 +737,34 @@ static inline unsigned int sseu_subslice_total(const 
struct sseu_dev_info *sseu)
return hweight8(sseu->slice_mask) * hweight8(sseu->subslice_mask);
 }
 
+/* Keep in gen based order, and chronological order within a gen */
+enum intel_platform {
+   INTEL_PLATFORM_UNINITIALIZED = 0,
+   INTEL_I830,
+   INTEL_I845G,
+   INTEL_I85X,
+   INTEL_I865G,
+   INTEL_I915G,
+   INTEL_I915GM,
+   INTEL_I945G,
+   INTEL_I945GM,
+   INTEL_G33,
+   INTEL_PINEVIEW,
+   INTEL_BROADWATER,
+   INTEL_CRESTLINE,
+   INTEL_G4X,
+   INTEL_IRONLAKE,
+   INTEL_SANDYBRIDGE,
+   INTEL_IVYBRIDGE,
+   INTEL_VALLEYVIEW,
+   INTEL_HASWELL,
+   INTEL_BROADWELL,
+   INTEL_CHERRYVIEW,
+   INTEL_SKYLAKE,
+   INTEL_BROXTON,
+   INTEL_KABYLAKE,
+};
+
 struct intel_device_info {
u32 display_mmio_offset;
u16 device_id;
@@ -760,6 +772,7 @@ struct intel_device_info {
u8 num_sprites[I915_MAX_PIPES];
u8 gen;
u16 gen_mask;
+   enum intel_platform platform;
u8 ring_mask; /* Rings supported by the HW */
u8 num_rings;
 #define DEFINE_FLAG(name) u8 name:1
@@ -2497,32 +2510,32 @@ intel_info(const struct drm_i915_private *dev_priv)
 
 #define IS_I830(dev_priv)  (INTEL_DEVID(dev_priv) == 0x3577)
 #define IS_845G(dev_priv)  (INTEL_DEVID(dev_priv) == 0x2562)
-#define IS_I85X(dev_priv)  ((dev_priv)->info.is_i85x)
+#define IS_I85X(dev_priv)  ((dev_priv)->info.platform == INTEL_I85X)
 #define IS_I865G(dev_priv) (INTEL_DEVID(dev_priv) == 0x2572)
-#define IS_I915G(dev_priv) ((dev_priv)->info.is_i915g)
+#define IS_I915G(dev_priv) ((dev_priv)->info.platform == INTEL_I915G)
 #define IS_I915GM(dev_priv)(INTEL_DEVID(dev_priv) == 0x2592)
 #define IS_I945G(dev_priv) (INTEL_DEVID(dev_priv) == 0x2772)
-#define IS_I945GM(dev_priv)((dev_priv)->info.is_i945gm)
-#define IS_BROADWATER(dev_priv)((dev_priv)->info.is_broadwater)
-#define IS_CRESTLINE(dev_priv) ((dev_priv)->info.is_crestline)
+#define IS_I945GM(dev_priv)((dev_priv)->info.platform == INTEL_I945GM)
+#define IS_BROADWATER(dev_priv)((dev_priv)->info.platform == 
INTEL_BROADWATER)
+#define IS_CRESTLINE(dev_priv) ((dev_priv)->info.platform == INTEL_CRESTLINE)
 #define IS_GM45(dev_priv)  (INTEL_DEVID(dev_priv) == 0x2A42)
-#define IS_G4X(dev_priv)   ((dev_priv)->info.is_g4x)
+#define IS_G4X(dev_priv)   ((dev_priv)->info.platform == INTEL_G4X)
 #define IS_PINEVIEW_G(dev_priv)(INTEL_DEVID(dev_priv) == 0xa001)
 #define IS_PINEVIEW_M(dev_priv)(INTEL_DEVID(dev_priv) == 

[Intel-gfx] [PATCH 0/6] drm/i915: introduce platform enum

2016-11-30 Thread Jani Nikula
The platform enum patch + some sugar coating on top.

BR,
Jani.

Jani Nikula (6):
  drm/i915: replace platform flags with a platform enum
  drm/i915: keep intel device info structs in gen based order
  drm/i915: rename BROADWATER and CRESTLINE to I965G and I965GM,
respectively
  drm/i915: add some more "i" in platform names for consistency
  drm/i915: give G45 and GM45 their own platform enums
  drm/i915: use platform enum instead of duplicating PCI ID if possible

 drivers/gpu/drm/i915/i915_debugfs.c  |  5 +-
 drivers/gpu/drm/i915/i915_drv.c  |  2 +-
 drivers/gpu/drm/i915/i915_drv.h  | 92 +++-
 drivers/gpu/drm/i915/i915_gem.c  |  2 +-
 drivers/gpu/drm/i915/i915_gem_internal.c |  2 +-
 drivers/gpu/drm/i915/i915_gem_stolen.c   |  2 +-
 drivers/gpu/drm/i915/i915_gpu_error.c|  1 +
 drivers/gpu/drm/i915/i915_pci.c  | 85 -
 drivers/gpu/drm/i915/intel_device_info.c | 41 +-
 drivers/gpu/drm/i915/intel_display.c | 22 
 drivers/gpu/drm/i915/intel_i2c.c |  2 +-
 drivers/gpu/drm/i915/intel_overlay.c |  4 +-
 drivers/gpu/drm/i915/intel_pm.c  |  6 +--
 drivers/gpu/drm/i915/intel_ringbuffer.c  |  4 +-
 14 files changed, 170 insertions(+), 100 deletions(-)

-- 
2.1.4

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH 4/6] drm/i915: add some more "i" in platform names for consistency

2016-11-30 Thread Jani Nikula
Consistency FTW.

Signed-off-by: Jani Nikula 
---
 drivers/gpu/drm/i915/i915_debugfs.c |  2 +-
 drivers/gpu/drm/i915/i915_drv.h |  4 ++--
 drivers/gpu/drm/i915/i915_gem_stolen.c  |  2 +-
 drivers/gpu/drm/i915/i915_pci.c |  4 ++--
 drivers/gpu/drm/i915/intel_display.c| 14 +++---
 drivers/gpu/drm/i915/intel_i2c.c|  2 +-
 drivers/gpu/drm/i915/intel_overlay.c|  4 ++--
 drivers/gpu/drm/i915/intel_ringbuffer.c |  4 ++--
 8 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_debugfs.c 
b/drivers/gpu/drm/i915/i915_debugfs.c
index 91abacbe3570..6fe38f5bc6e0 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -2955,7 +2955,7 @@ static bool cursor_active(struct drm_i915_private 
*dev_priv, int pipe)
 {
u32 state;
 
-   if (IS_845G(dev_priv) || IS_I865G(dev_priv))
+   if (IS_I845G(dev_priv) || IS_I865G(dev_priv))
state = I915_READ(CURCNTR(PIPE_A)) & CURSOR_ENABLE;
else
state = I915_READ(CURCNTR(pipe)) & CURSOR_MODE;
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 66384c407dbd..ee5af9140e7c 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -2509,7 +2509,7 @@ intel_info(const struct drm_i915_private *dev_priv)
(INTEL_REVID(p) >= (since) && INTEL_REVID(p) <= (until))
 
 #define IS_I830(dev_priv)  (INTEL_DEVID(dev_priv) == 0x3577)
-#define IS_845G(dev_priv)  (INTEL_DEVID(dev_priv) == 0x2562)
+#define IS_I845G(dev_priv) (INTEL_DEVID(dev_priv) == 0x2562)
 #define IS_I85X(dev_priv)  ((dev_priv)->info.platform == INTEL_I85X)
 #define IS_I865G(dev_priv) (INTEL_DEVID(dev_priv) == 0x2572)
 #define IS_I915G(dev_priv) ((dev_priv)->info.platform == INTEL_I915G)
@@ -2658,7 +2658,7 @@ intel_info(const struct drm_i915_private *dev_priv)
((dev_priv)->info.overlay_needs_physical)
 
 /* Early gen2 have a totally busted CS tlb and require pinned batches. */
-#define HAS_BROKEN_CS_TLB(dev_priv)(IS_I830(dev_priv) || IS_845G(dev_priv))
+#define HAS_BROKEN_CS_TLB(dev_priv)(IS_I830(dev_priv) || 
IS_I845G(dev_priv))
 
 /* WaRsDisableCoarsePowerGating:skl,bxt */
 #define NEEDS_WaRsDisableCoarsePowerGating(dev_priv) \
diff --git a/drivers/gpu/drm/i915/i915_gem_stolen.c 
b/drivers/gpu/drm/i915/i915_gem_stolen.c
index ebaa941c83af..9e113228309b 100644
--- a/drivers/gpu/drm/i915/i915_gem_stolen.c
+++ b/drivers/gpu/drm/i915/i915_gem_stolen.c
@@ -153,7 +153,7 @@ static unsigned long i915_stolen_to_physical(struct 
drm_i915_private *dev_priv)
tom = tmp * MB(32);
 
base = tom - tseg_size - ggtt->stolen_size;
-   } else if (IS_845G(dev_priv)) {
+   } else if (IS_I845G(dev_priv)) {
u32 tseg_size = 0;
u32 tom;
u8 tmp;
diff --git a/drivers/gpu/drm/i915/i915_pci.c b/drivers/gpu/drm/i915/i915_pci.c
index 5ce4c64cbd49..44f772b00c4d 100644
--- a/drivers/gpu/drm/i915/i915_pci.c
+++ b/drivers/gpu/drm/i915/i915_pci.c
@@ -71,7 +71,7 @@ static const struct intel_device_info intel_i830_info = {
.num_pipes = 2, /* legal, last one wins */
 };
 
-static const struct intel_device_info intel_845g_info = {
+static const struct intel_device_info intel_i845g_info = {
GEN2_FEATURES,
.platform = INTEL_I845G,
 };
@@ -410,7 +410,7 @@ static const struct intel_device_info 
intel_kabylake_gt3_info = {
  */
 static const struct pci_device_id pciidlist[] = {
INTEL_I830_IDS(_i830_info),
-   INTEL_I845G_IDS(_845g_info),
+   INTEL_I845G_IDS(_i845g_info),
INTEL_I85X_IDS(_i85x_info),
INTEL_I865G_IDS(_i865g_info),
INTEL_I915G_IDS(_i915g_info),
diff --git a/drivers/gpu/drm/i915/intel_display.c 
b/drivers/gpu/drm/i915/intel_display.c
index fe843ecf3296..b3f76d403560 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -1232,7 +1232,7 @@ static void assert_cursor(struct drm_i915_private 
*dev_priv,
 {
bool cur_state;
 
-   if (IS_845G(dev_priv) || IS_I865G(dev_priv))
+   if (IS_I845G(dev_priv) || IS_I865G(dev_priv))
cur_state = I915_READ(CURCNTR(PIPE_A)) & CURSOR_ENABLE;
else
cur_state = I915_READ(CURCNTR(pipe)) & CURSOR_MODE;
@@ -10886,7 +10886,7 @@ static void intel_crtc_update_cursor(struct drm_crtc 
*crtc,
 
I915_WRITE(CURPOS(pipe), pos);
 
-   if (IS_845G(dev_priv) || IS_I865G(dev_priv))
+   if (IS_I845G(dev_priv) || IS_I865G(dev_priv))
i845_update_cursor(crtc, base, plane_state);
else
i9xx_update_cursor(crtc, base, plane_state);
@@ -10904,11 +10904,11 @@ static bool cursor_size_ok(struct drm_i915_private 
*dev_priv,
 * the precision of the register. Everything else requires
 * square cursors, limited to a few power-of-two sizes.
 */
-  

Re: [Intel-gfx] [PATCH 17/37] drm/i915: Set fb->dev early on for inherited fbs

2016-11-30 Thread Daniel Vetter
On Fri, Nov 18, 2016 at 09:52:53PM +0200, ville.syrj...@linux.intel.com wrote:
> From: Ville Syrjälä 
> 
> We want the fbs inherited from the BIOS to be more or less fully working
> prior to actually registering them. This will allow us to just pass the
> fb to various helper function instead of having to pass all the
> different parameters separately.
> 
> Cc: intel-gfx@lists.freedesktop.org
> Signed-off-by: Ville Syrjälä 

I guess eventually we'll grow a WARN_ON(!fb->dev) in
drm_framebuffer_init() to make sure these don't escape? Anyway:

Reviewed-by: Daniel Vetter 
> ---
>  drivers/gpu/drm/i915/intel_display.c | 6 ++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/intel_display.c 
> b/drivers/gpu/drm/i915/intel_display.c
> index 12af936a402d..74a638c8de61 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -8704,6 +8704,8 @@ i9xx_get_initial_plane_config(struct intel_crtc *crtc,
>  
>   fb = _fb->base;
>  
> + fb->dev = dev;
> +
>   if (INTEL_GEN(dev_priv) >= 4) {
>   if (val & DISPPLANE_TILED) {
>   plane_config->tiling = I915_TILING_X;
> @@ -9734,6 +9736,8 @@ skylake_get_initial_plane_config(struct intel_crtc 
> *crtc,
>  
>   fb = _fb->base;
>  
> + fb->dev = dev;
> +
>   val = I915_READ(PLANE_CTL(pipe, 0));
>   if (!(val & PLANE_CTL_ENABLE))
>   goto error;
> @@ -9846,6 +9850,8 @@ ironlake_get_initial_plane_config(struct intel_crtc 
> *crtc,
>  
>   fb = _fb->base;
>  
> + fb->dev = dev;
> +
>   if (INTEL_GEN(dev_priv) >= 4) {
>   if (val & DISPPLANE_TILED) {
>   plane_config->tiling = I915_TILING_X;
> -- 
> 2.7.4
> 
> ___
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 01/37] drm/i915: Add local 'fb' variables

2016-11-30 Thread Daniel Vetter
On Fri, Nov 18, 2016 at 09:52:37PM +0200, ville.syrj...@linux.intel.com wrote:
> From: Ville Syrjälä 
> 
> Add a local 'fb' variable to a few places to get rid of the
> 'crtc->primary->fb' stuff. Looks neater and helps me with my poor
> coccinelle skills later.
> 
> While at it switch over to using the pixel format rather than
> depth+bpp.
> 
> Cc: intel-gfx@lists.freedesktop.org
> Signed-off-by: Ville Syrjälä 

Reviewed-by: Daniel Vetter 

> ---
>  drivers/gpu/drm/i915/intel_overlay.c | 26 --
>  1 file changed, 12 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_overlay.c 
> b/drivers/gpu/drm/i915/intel_overlay.c
> index fd0e4dac7cc1..ce3667c18e18 100644
> --- a/drivers/gpu/drm/i915/intel_overlay.c
> +++ b/drivers/gpu/drm/i915/intel_overlay.c
> @@ -658,6 +658,8 @@ static bool update_scaling_factors(struct intel_overlay 
> *overlay,
>  static void update_colorkey(struct intel_overlay *overlay,
>   struct overlay_registers __iomem *regs)
>  {
> + const struct drm_framebuffer *fb =
> + overlay->crtc->base.primary->fb;
>   u32 key = overlay->color_key;
>   u32 flags;
>  
> @@ -665,24 +667,20 @@ static void update_colorkey(struct intel_overlay 
> *overlay,
>   if (overlay->color_key_enabled)
>   flags |= DST_KEY_ENABLE;
>  
> - switch (overlay->crtc->base.primary->fb->bits_per_pixel) {
> - case 8:
> + switch (fb->pixel_format) {
> + case DRM_FORMAT_C8:
>   key = 0;
>   flags |= CLK_RGB8I_MASK;
>   break;
> -
> - case 16:
> - if (overlay->crtc->base.primary->fb->depth == 15) {
> - key = RGB15_TO_COLORKEY(key);
> - flags |= CLK_RGB15_MASK;
> - } else {
> - key = RGB16_TO_COLORKEY(key);
> - flags |= CLK_RGB16_MASK;
> - }
> + case DRM_FORMAT_XRGB1555:
> + key = RGB15_TO_COLORKEY(key);
> + flags |= CLK_RGB15_MASK;
>   break;
> -
> - case 24:
> - case 32:
> + case DRM_FORMAT_RGB565:
> + key = RGB16_TO_COLORKEY(key);
> + flags |= CLK_RGB16_MASK;
> + break;
> + default:
>   flags |= CLK_RGB24_MASK;
>   break;
>   }
> -- 
> 2.7.4
> 
> ___
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH i-g-t] tests/kms_plane_multiple: Fix CRC based atomic correctness test

2016-11-30 Thread Maarten Lankhorst
Op 29-11-16 om 14:57 schreef Mika Kahola:
> Fixes issues on kms_plane_multiple i-g-t test found when running CI tests
>
> v1:
>  - don't use tiling for cursor plane (Ville)
>  - for y/yf tiling check that the platform is at least GEN9 (Ville)
>
> Cc: Ville Syrjala 
> Cc: Maarten Lankhorst 
> Signed-off-by: Mika Kahola 
> ---
>  tests/kms_plane_multiple.c | 7 ++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/tests/kms_plane_multiple.c b/tests/kms_plane_multiple.c
> index bedee16..5e12be4 100644
> --- a/tests/kms_plane_multiple.c
> +++ b/tests/kms_plane_multiple.c
> @@ -210,7 +210,7 @@ prepare_planes(data_t *data, enum pipe pipe, color_t 
> *color,
>   igt_create_color_fb(data->drm_fd,
>   size[i], size[i],
>   data->plane[i]->is_cursor ? 
> DRM_FORMAT_ARGB : DRM_FORMAT_XRGB,
> - tiling,
> + data->plane[i]->is_cursor ? 
> LOCAL_DRM_FORMAT_MOD_NONE : tiling,
>   color->red, color->green, color->blue,
>   >fb[i]);
In the future we could be more smart here and do some TEST_ONLY to see if 
tiling is allowed, but this is fine for now.
> @@ -349,6 +349,7 @@ test_plane_position(data_t *data, enum pipe pipe, bool 
> atomic, int max_planes,
>  {
>   igt_output_t *output;
>   int connected_outs;
> + int devid = intel_get_drm_devid(data->drm_fd);
>  
>   if (atomic)
>   igt_require(data->display.is_atomic);
> @@ -356,6 +357,10 @@ test_plane_position(data_t *data, enum pipe pipe, bool 
> atomic, int max_planes,
>   igt_skip_on(pipe >= data->display.n_pipes);
>   igt_skip_on(max_planes >= data->display.pipes[pipe].n_planes);
>  
> + if ((tiling == LOCAL_I915_FORMAT_MOD_Y_TILED ||
> +  tiling == LOCAL_I915_FORMAT_MOD_Yf_TILED))
> + igt_require(AT_LEAST_GEN(devid, 9));
Reviewed-by: Maarten Lankhorst 
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH v2] drm/i915: Create a common GEN9_LP_FEATURE.

2016-11-30 Thread Imre Deak
On ma, 2016-11-14 at 16:19 +0200, Ander Conselvan de Oliveira wrote:
> From: Rodrigo Vivi 
> 
> The following LP platform inherits a lot of this platform
> So let's simplify here to re-use this later.
> 
> v2: Keep ddb_size out of the new macro.
> 
> Signed-off-by: Rodrigo Vivi 
> Signed-off-by: Ander Conselvan de Oliveira
> 

Needs a rebase due to new .has_decoupled_mmio, with that in
GEN9_LP_FEATURES:
Reviewed-by: Imre Deak 

> ---
>  drivers/gpu/drm/i915/i915_pci.c | 45 ++-
> --
>  1 file changed, 24 insertions(+), 21 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_pci.c
> b/drivers/gpu/drm/i915/i915_pci.c
> index 70a99ce..f8b93c1 100644
> --- a/drivers/gpu/drm/i915/i915_pci.c
> +++ b/drivers/gpu/drm/i915/i915_pci.c
> @@ -343,30 +343,33 @@ static const struct intel_device_info
> intel_skylake_gt3_info = {
>   .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING
> | BSD2_RING,
>  };
>  
> +#define GEN9_LP_FEATURES \
> + .gen = 9, \
> + .has_hotplug = 1, \
> + .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING,
> \
> + .num_pipes = 3, \
> + .has_64bit_reloc = 1, \
> + .has_ddi = 1, \
> + .has_fpga_dbg = 1, \
> + .has_fbc = 1, \
> + .has_runtime_pm = 1, \
> + .has_pooled_eu = 0, \
> + .has_csr = 1, \
> + .has_resource_streamer = 1, \
> + .has_rc6 = 1, \
> + .has_dp_mst = 1, \
> + .has_gmbus_irq = 1, \
> + .has_hw_contexts = 1, \
> + .has_logical_ring_contexts = 1, \
> + .has_guc = 1, \
> + GEN_DEFAULT_PIPEOFFSETS, \
> + IVB_CURSOR_OFFSETS, \
> + BDW_COLORS
> +
>  static const struct intel_device_info intel_broxton_info = {
>   .is_broxton = 1,
> - .gen = 9,
> - .has_hotplug = 1,
> - .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING,
> - .num_pipes = 3,
> - .has_64bit_reloc = 1,
> - .has_ddi = 1,
> - .has_fpga_dbg = 1,
> - .has_fbc = 1,
> - .has_runtime_pm = 1,
> - .has_pooled_eu = 0,
> - .has_csr = 1,
> - .has_resource_streamer = 1,
> - .has_rc6 = 1,
> - .has_dp_mst = 1,
> - .has_gmbus_irq = 1,
> - .has_hw_contexts = 1,
> - .has_logical_ring_contexts = 1,
> - .has_guc = 1,
> + GEN9_LP_FEATURES,
>   .ddb_size = 512,
> - GEN_DEFAULT_PIPEOFFSETS,
> - IVB_CURSOR_OFFSETS,
> - BDW_COLORS,
>  };
>  
>  static const struct intel_device_info intel_kabylake_info = {
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH]i915: use WARN_ON_ONCE in intel_dp_aux_transfer

2016-11-30 Thread Ville Syrjälä
On Thu, Nov 24, 2016 at 05:03:20PM +0800, Dave Young wrote:
> On 11/24/16 at 10:53am, Jani Nikula wrote:
> > On Thu, 24 Nov 2016, Dave Young  wrote:
> > > I see a lot of below warning:
> > 
> > No, we must not hide this under the carpet. There's a bug at fdo about
> > this, and we need to fix it.
> 
> It is not hiding it, just not repeating the warnings. But anyway I do
> not have strong opinion. I'm building my kernel with this patch until
> there is a real fix in upstream.

We already have a patch to reduce it a single WARN:
d4cb3fd9b548 ("drm/i915/dp: add lane_count check in intel_dp_check_link_status")

Do we need to get that backported to stable?

> 
> > 
> > BR,
> > Jani.
> > 
> > 
> > > [   17.128256] WARNING: CPU: 1 PID: 95 at 
> > > drivers/gpu/drm/i915/intel_dp.c:1062 intel_dp_aux_transfer+0x201/0x240 
> > > [i915]
> > > [   17.128264] WARN_ON_ONCE(!msg->buffer != !msg->size)
> > > [   17.128267] Modules linked in:
> > > [   17.128273]  kvm_intel kvm irqbypass i915 intel_gtt drm_kms_helper 
> > > snd_hda_codec_realtek syscopyarea snd_hda_codec_generic sysfillrect 
> > > sysimgblt fb_sys_fops drm arc4 rtsx_pci_sdmmc iwlmvm mac80211 
> > > snd_hda_intel btusb snd_hda_codec btrtl iwlwifi btbcm btintel snd_hwdep 
> > > snd_hda_core snd_seq bluetooth e1000e i2c_i801 cfg80211 input_leds 
> > > snd_seq_device i2c_smbus serio_raw pcspkr snd_pcm ptp rtsx_pci pps_core 
> > > mfd_core snd_timer thinkpad_acpi snd soundcore rfkill video nfsd 
> > > auth_rpcgss nfs_acl lockd grace sunrpc
> > > [   17.128338] CPU: 1 PID: 95 Comm: kworker/u16:2 Not tainted 4.9.0-rc6+ 
> > > #200
> > > [   17.128344] Hardware name: LENOVO 20ARS1BJ02/20ARS1BJ02, BIOS GJET91WW 
> > > (2.41 ) 09/21/2016
> > > [   17.128355] Workqueue: events_unbound async_run_entry_fn
> > > [   17.128361]  9db20105fa98 a9eeb8ed 9db20105fae8 
> > > 
> > > [   17.128370]  9db20105fad8 a9c5339b 0426907d27c8 
> > > 9db20105fbc0
> > > [   17.128379]  9474910510e0 0003 fffb 
> > > 
> > > [   17.128388] Call Trace:
> > > [   17.128396]  [] dump_stack+0x63/0x86
> > > [   17.128404]  [] __warn+0xcb/0xf0
> > > [   17.128410]  [] warn_slowpath_fmt+0x5f/0x80
> > > [   17.128454]  [] ? intel_dp_aux_transfer+0xde/0x240 
> > > [i915]
> > > [   17.128492]  [] intel_dp_aux_transfer+0x201/0x240 
> > > [i915]
> > > [   17.128507]  [] drm_dp_dpcd_access+0x72/0x110 
> > > [drm_kms_helper]
> > > [   17.128519]  [] drm_dp_dpcd_write+0x1b/0x20 
> > > [drm_kms_helper]
> > > [   17.128557]  [] 
> > > intel_dp_start_link_train+0x2cb/0x4c0 [i915]
> > > [   17.128594]  [] 
> > > intel_dp_check_link_status+0xd9/0x110 [i915]
> > > [   17.128630]  [] intel_dp_detect+0x79f/0xb90 [i915]
> > > [   17.128641]  [] 
> > > drm_helper_probe_single_connector_modes+0x3ff/0x4f0 [drm_kms_helper]
> > > [   17.128654]  [] 
> > > drm_fb_helper_initial_config+0xae/0x430 [drm_kms_helper]
> > > [   17.128697]  [] intel_fbdev_initial_config+0x18/0x30 
> > > [i915]
> > > [   17.128705]  [] async_run_entry_fn+0x37/0xe0
> > > [   17.128713]  [] process_one_work+0x1e9/0x440
> > > [   17.128721]  [] worker_thread+0x4b/0x4f0
> > > [   17.128728]  [] ? process_one_work+0x440/0x440
> > > [   17.128721]  [] worker_thread+0x4b/0x4f0
> > > [   17.128728]  [] ? process_one_work+0x440/0x440
> > > [   17.128735]  [] kthread+0xd9/0xf0
> > > [   17.128741]  [] ? __switch_to+0x2ce/0x580
> > > [   17.128748]  [] ? kthread_park+0x60/0x60
> > > [   17.128754]  [] ? kthread_park+0x60/0x60
> > > [   17.128762]  [] ret_from_fork+0x25/0x30
> > > [   17.128768] ---[ end trace 1c8614b2fcd03dac ]---
> > > [   17.151929] [drm:intel_dp_start_link_train [i915]] *ERROR* failed to 
> > > update link training
> > >
> > > It seems a known issue below:
> > > https://bugs.freedesktop.org/show_bug.cgi?id=97344
> > >
> > > This is not to fix the real problem just use WARN_ON_ONCE is better for
> > > this kind of warnings instead of warn again and again.
> > >
> > > Signed-off-by: Dave Young 
> > > ---
> > >  drivers/gpu/drm/i915/intel_dp.c |2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > --- linux-x86.orig/drivers/gpu/drm/i915/intel_dp.c
> > > +++ linux-x86/drivers/gpu/drm/i915/intel_dp.c
> > > @@ -1059,7 +1059,7 @@ intel_dp_aux_transfer(struct drm_dp_aux
> > >   if (WARN_ON(txsize > 20))
> > >   return -E2BIG;
> > >  
> > > - WARN_ON(!msg->buffer != !msg->size);
> > > + WARN_ON_ONCE(!msg->buffer != !msg->size);
> > >  
> > >   if (msg->buffer)
> > >   memcpy(txbuf + HEADER_SIZE, msg->buffer, msg->size);
> > 
> > -- 
> > Jani Nikula, Intel Open Source Technology Center
> ___
> dri-devel mailing list
> dri-de...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Ville Syrjälä
Intel OTC
___

Re: [Intel-gfx] [PATCH 07/10] drm/i915: Make gmbus setup take dev_priv

2016-11-30 Thread Joonas Lahtinen
On ke, 2016-11-30 at 11:35 +, Tvrtko Ursulin wrote:
> From: Tvrtko Ursulin 
> 

Commit message.

> Signed-off-by: Tvrtko Ursulin 

With that,

Reviewed-by: Joonas Lahtinen 

Regards, Joonas
-- 
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH v2] drm/i915/lspcon: Enable AUX interrupts for resume time initialization

2016-11-30 Thread Imre Deak
On ti, 2016-11-29 at 23:00 +0200, Ville Syrjälä wrote:
> [...]
> > > > > There is a slight concern on g4x/vlv/chv that an AUX interrupts
> > > > > would
> > > > > trigger the hpd irq handler, which doesn't realize it's supposed
> > > > > to
> > > > > ignore the actual hpd bits in PORT_HOTPLUG_STAT. So any aux
> > > > > before we
> > > > > enable hpd processing for real could do something bad. So I guess
> > > > > we
> > > > > should add some kind of software tracking for that stuff like we
> > > > > have
> > > > > for PIPESTAT.
> > > > 
> > > > Didn't think about that, but BSpec tells me those are masked by the
> > > > HPD
> > > > IRQ enable bits in PORT_HOTPLUG_EN and those we enable only later.
> > > > Otherwise this would be also a problem during output setup time.
> > > 
> > > Hmm. Are they really masked? I though it's just an IER effectively.
> > 
> > I only tried for real on BXT/SKL where I had to enable the interrupts
> > (in PCH_PORT_HOTPLUG) for HPD sensing. The CHV BSpec suggests the same
> > for the live state bits, but yes it's not clear if the long/short
> > detect bits are completely masked by the enable flags or they are just
> > not propagated if not enabled. Will give it a try tomorrow.
> 
> Hmm. Yeah, we did in fact chat about this. Already forgot. Spec seems to
> suggest you are correct. But checking on actual hw is always a good
> idea.

Checked now both on BXT and VLV both the live state and short/long
detect bits in the hotplug_stat reg are masked by the hotplug_en bits.
(And we clear any stale short/long bits during IRQ reset.)

--Imre
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 03/10] drm/i915: Make various init functions take dev_priv

2016-11-30 Thread Joonas Lahtinen
On ke, 2016-11-30 at 11:35 +, Tvrtko Ursulin wrote:
> From: Tvrtko Ursulin 
> 
> Like GEM init, GUC init, MOCS init and context creation.
> 
> Enables them to lose dev_priv locals.
> 
> Signed-off-by: Tvrtko Ursulin 

Keeps pdev \o/

Reviewed-by: Joonas Lahtinen 

Regards, Joonas
-- 
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 02/10] drm/i915: Make GEM object create and create from data take dev_priv

2016-11-30 Thread Joonas Lahtinen
On ke, 2016-11-30 at 11:35 +, Tvrtko Ursulin wrote:
> From: Tvrtko Ursulin 
> 
> Makes all GEM object constructors consistent.
> 
> Signed-off-by: Tvrtko Ursulin 

Reviewed-by: Joonas Lahtinen 

Regards, Joonas
-- 
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 01/10] drm/i915: Make GEM object alloc/free and stolen created take dev_priv

2016-11-30 Thread Joonas Lahtinen
On ke, 2016-11-30 at 11:35 +, Tvrtko Ursulin wrote:
> From: Tvrtko Ursulin 
> 
> Where it is more appropriate and also to be consistent with
> the direction of the driver.
> 
> Also inline object alloc/free since they are just wrappers
> around kmem_cache_alloc/free.
> 
> Signed-off-by: Tvrtko Ursulin 



> @@ -2976,8 +2976,17 @@ void i915_gem_load_init_fences(struct drm_i915_private 
> *dev_priv);
>  int i915_gem_freeze(struct drm_i915_private *dev_priv);
>  int i915_gem_freeze_late(struct drm_i915_private *dev_priv);
>  
> -void *i915_gem_object_alloc(struct drm_device *dev);
> -void i915_gem_object_free(struct drm_i915_gem_object *obj);
> +static inline void *i915_gem_object_alloc(struct drm_i915_private *dev_priv)
> +{
> + return kmem_cache_zalloc(dev_priv->objects, GFP_KERNEL);
> +}
> +
> +static inline void i915_gem_object_free(struct drm_i915_gem_object *obj)
> +{
> + struct drm_i915_private *dev_priv = to_i915(obj->base.dev);
> + kmem_cache_free(dev_priv->objects, obj);
> +}

Split this change into a separate patch, and untangle enough to
relocate to i915_gem_object.h.

Rest of the functions should be moved too.

Just the dev_priv changes are;

Reviewed-by: Joonas Lahtinen 

Regards, Joonas
-- 
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 10/10] drm/i915: Make intel_pm_setup take dev_priv

2016-11-30 Thread Joonas Lahtinen
On ke, 2016-11-30 at 11:35 +, Tvrtko Ursulin wrote:
> From: Tvrtko Ursulin 
> 
> Signed-off-by: Tvrtko Ursulin 

With commit message;

Reviewed-by: Joonas Lahtinen 

Regards, Joonas
-- 
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 09/10] drm/i915: Make i915_save/restore_state and intel_i2c_reset take dev_priv

2016-11-30 Thread Joonas Lahtinen
On ke, 2016-11-30 at 11:35 +, Tvrtko Ursulin wrote:
> From: Tvrtko Ursulin 
> 

Empty commit message is strictly forbidden. At least repeat the title
with a couple more word.

> Signed-off-by: Tvrtko Ursulin 

Again, keep the 'pdev' and this is;

Reviewed-by: Joonas Lahtinen 

Regards, Joonas
-- 
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 08/10] drm/i915: Make i915_destroy_error_state take dev_priv

2016-11-30 Thread Joonas Lahtinen
On ke, 2016-11-30 at 11:35 +, Tvrtko Ursulin wrote:
> From: Tvrtko Ursulin 
> 
> Since it does not need dev at all.
> 
> Also change the stored pointer in struct i915_error_state_file_priv
> to i915.
> 
> Signed-off-by: Tvrtko Ursulin 

Reviewed-by: Joonas Lahtinen 

Regards, Joonas
-- 
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 04/10] drm/i915: More GEM init dev_priv cleanup

2016-11-30 Thread Joonas Lahtinen
On ke, 2016-11-30 at 11:35 +, Tvrtko Ursulin wrote:
> From: Tvrtko Ursulin 
> 
> Signed-off-by: Tvrtko Ursulin 

Reviewed-by: Joonas Lahtinen 

Regards, Joonas
-- 
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 00/10] GEM object create and driver init dev_priv cleanups

2016-11-30 Thread Chris Wilson
On Wed, Nov 30, 2016 at 11:35:30AM +, Tvrtko Ursulin wrote:
> From: Tvrtko Ursulin 
> 
> Autumn of churn continues. :)
> 
> This series tidies GEM object construction to take dev_priv instead of dev
> in all cases and also does a bit of random tidy in the driver load/init code.
> 
> Basically functions which only need dev_priv are changed to take dev_priv
> instead of dev. There is often a cascade effect and the end result is a
> saving in lines of code. And even in binary occasionally but not worth much
> mention.
> 
> Tvrtko Ursulin (10):
>   drm/i915: Make GEM object alloc/free and stolen created take dev_priv
>   drm/i915: Make GEM object create and create from data take dev_priv
>   drm/i915: Make various init functions take dev_priv
>   drm/i915: More GEM init dev_priv cleanup
>   drm/i915: dev_priv cleanup in bridge/bar/mmio init code
>   drm/i915: Unexport VGA switcheroo functions
>   drm/i915: Make gmbus setup take dev_priv
>   drm/i915: Make i915_destroy_error_state take dev_priv
>   drm/i915: Make i915_save/restore_state and intel_i2c_reset take
> dev_priv
>   drm/i915: Make intel_pm_setup take dev_priv

They all look ok and many are a sight for sore eyes.
Reviewed-by: Chris Wilson 

>  28 files changed, 214 insertions(+), 261 deletions(-)

Just from superlus locals and declarations, nice!
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 05/10] drm/i915: dev_priv cleanup in bridge/bar/mmio init code

2016-11-30 Thread Joonas Lahtinen
On ke, 2016-11-30 at 11:35 +, Tvrtko Ursulin wrote:
> From: Tvrtko Ursulin 
> 
> Signed-off-by: Tvrtko Ursulin 



> -static int i915_mmio_setup(struct drm_device *dev)
> +static int i915_mmio_setup(struct drm_i915_private *dev_priv)
>  {
> - struct drm_i915_private *dev_priv = to_i915(dev);
> - struct pci_dev *pdev = dev_priv->drm.pdev;

Keep the pdev.

> -static void i915_mmio_cleanup(struct drm_device *dev)
> +static void i915_mmio_cleanup(struct drm_i915_private *dev_priv)
>  {
> - struct drm_i915_private *dev_priv = to_i915(dev);
> - struct pci_dev *pdev = dev_priv->drm.pdev;

And here.

Then;

Reviewed-by: Joonas Lahtinen 

Regards, Joonas
-- 
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 06/10] drm/i915: Unexport VGA switcheroo functions

2016-11-30 Thread Joonas Lahtinen
On ke, 2016-11-30 at 11:35 +, Tvrtko Ursulin wrote:
> From: Tvrtko Ursulin 
> 
> They are only used in i915_drv.c so a forward declaration is enough.
> 
> Signed-off-by: Tvrtko Ursulin 

Reviewed-by: Joonas Lahtinen 

Regards, Joonas
-- 
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH] drm/i915: Remove dummy i915_kick_out_firmware_fb

2016-11-30 Thread Chris Wilson
On Wed, Nov 30, 2016 at 12:01:31PM +0100, Daniel Vetter wrote:
> Since
> 
> commit 44adece57e2604cec8527a499b48e4d584ab53b8
> Author: Daniel Vetter 
> Date:   Wed Aug 10 18:52:34 2016 +0200
> 
> drm/fb-helper: Add a dummy remove_conflicting_framebuffers
> 
> the drm helpers take care of this for us.
> 
> Cc: Chris Wilson 
> Signed-off-by: Daniel Vetter 

Still compiles without CONFIG_FB, so
Reviewed-by: Chris Wilson 
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH 05/10] drm/i915: dev_priv cleanup in bridge/bar/mmio init code

2016-11-30 Thread Tvrtko Ursulin
From: Tvrtko Ursulin 

Signed-off-by: Tvrtko Ursulin 
---
 drivers/gpu/drm/i915/i915_drv.c | 52 +++--
 1 file changed, 19 insertions(+), 33 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 3c0deb0e008f..23d8001ea0b0 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -142,9 +142,8 @@ static enum intel_pch intel_virt_detect_pch(struct 
drm_i915_private *dev_priv)
return ret;
 }
 
-static void intel_detect_pch(struct drm_device *dev)
+static void intel_detect_pch(struct drm_i915_private *dev_priv)
 {
-   struct drm_i915_private *dev_priv = to_i915(dev);
struct pci_dev *pch = NULL;
 
/* In all current cases, num_pipes is equivalent to the PCH_NOP setting
@@ -361,10 +360,8 @@ static int i915_getparam(struct drm_device *dev, void 
*data,
return 0;
 }
 
-static int i915_get_bridge_dev(struct drm_device *dev)
+static int i915_get_bridge_dev(struct drm_i915_private *dev_priv)
 {
-   struct drm_i915_private *dev_priv = to_i915(dev);
-
dev_priv->bridge_dev = pci_get_bus_and_slot(0, PCI_DEVFN(0, 0));
if (!dev_priv->bridge_dev) {
DRM_ERROR("bridge device not found\n");
@@ -375,9 +372,8 @@ static int i915_get_bridge_dev(struct drm_device *dev)
 
 /* Allocate space for the MCH regs if needed, return nonzero on error */
 static int
-intel_alloc_mchbar_resource(struct drm_device *dev)
+intel_alloc_mchbar_resource(struct drm_i915_private *dev_priv)
 {
-   struct drm_i915_private *dev_priv = to_i915(dev);
int reg = INTEL_GEN(dev_priv) >= 4 ? MCHBAR_I965 : MCHBAR_I915;
u32 temp_lo, temp_hi = 0;
u64 mchbar_addr;
@@ -421,9 +417,8 @@ intel_alloc_mchbar_resource(struct drm_device *dev)
 
 /* Setup MCHBAR if possible, return true if we should disable it again */
 static void
-intel_setup_mchbar(struct drm_device *dev)
+intel_setup_mchbar(struct drm_i915_private *dev_priv)
 {
-   struct drm_i915_private *dev_priv = to_i915(dev);
int mchbar_reg = INTEL_GEN(dev_priv) >= 4 ? MCHBAR_I965 : MCHBAR_I915;
u32 temp;
bool enabled;
@@ -445,7 +440,7 @@ intel_setup_mchbar(struct drm_device *dev)
if (enabled)
return;
 
-   if (intel_alloc_mchbar_resource(dev))
+   if (intel_alloc_mchbar_resource(dev_priv))
return;
 
dev_priv->mchbar_need_disable = true;
@@ -461,9 +456,8 @@ intel_setup_mchbar(struct drm_device *dev)
 }
 
 static void
-intel_teardown_mchbar(struct drm_device *dev)
+intel_teardown_mchbar(struct drm_i915_private *dev_priv)
 {
-   struct drm_i915_private *dev_priv = to_i915(dev);
int mchbar_reg = INTEL_GEN(dev_priv) >= 4 ? MCHBAR_I965 : MCHBAR_I915;
 
if (dev_priv->mchbar_need_disable) {
@@ -493,9 +487,9 @@ intel_teardown_mchbar(struct drm_device *dev)
 /* true = enable decode, false = disable decoder */
 static unsigned int i915_vga_set_decode(void *cookie, bool state)
 {
-   struct drm_device *dev = cookie;
+   struct drm_i915_private *dev_priv = cookie;
 
-   intel_modeset_vga_set_state(to_i915(dev), state);
+   intel_modeset_vga_set_state(dev_priv, state);
if (state)
return VGA_RSRC_LEGACY_IO | VGA_RSRC_LEGACY_MEM |
   VGA_RSRC_NORMAL_IO | VGA_RSRC_NORMAL_MEM;
@@ -574,7 +568,7 @@ static int i915_load_modeset_init(struct drm_device *dev)
 * then we do not take part in VGA arbitration and the
 * vga_client_register() fails with -ENODEV.
 */
-   ret = vga_client_register(pdev, dev, NULL, i915_vga_set_decode);
+   ret = vga_client_register(pdev, dev_priv, NULL, i915_vga_set_decode);
if (ret && ret != -ENODEV)
goto out;
 
@@ -830,7 +824,7 @@ static int i915_driver_init_early(struct drm_i915_private 
*dev_priv,
goto err_workqueues;
 
/* This must be called before any calls to HAS_PCH_* */
-   intel_detect_pch(_priv->drm);
+   intel_detect_pch(dev_priv);
 
intel_pm_setup(_priv->drm);
intel_init_dpio(dev_priv);
@@ -872,10 +866,8 @@ static void i915_driver_cleanup_early(struct 
drm_i915_private *dev_priv)
i915_workqueues_cleanup(dev_priv);
 }
 
-static int i915_mmio_setup(struct drm_device *dev)
+static int i915_mmio_setup(struct drm_i915_private *dev_priv)
 {
-   struct drm_i915_private *dev_priv = to_i915(dev);
-   struct pci_dev *pdev = dev_priv->drm.pdev;
int mmio_bar;
int mmio_size;
 
@@ -892,7 +884,7 @@ static int i915_mmio_setup(struct drm_device *dev)
mmio_size = 512 * 1024;
else
mmio_size = 2 * 1024 * 1024;
-   dev_priv->regs = pci_iomap(pdev, mmio_bar, mmio_size);
+   dev_priv->regs = pci_iomap(dev_priv->drm.pdev, mmio_bar, mmio_size);
if (dev_priv->regs == NULL) {
DRM_ERROR("failed to map 

[Intel-gfx] [PATCH 02/10] drm/i915: Make GEM object create and create from data take dev_priv

2016-11-30 Thread Tvrtko Ursulin
From: Tvrtko Ursulin 

Makes all GEM object constructors consistent.

Signed-off-by: Tvrtko Ursulin 
---
 drivers/gpu/drm/i915/i915_drv.h|  9 +
 drivers/gpu/drm/i915/i915_gem.c| 20 ++--
 drivers/gpu/drm/i915/i915_gem_context.c|  5 +++--
 drivers/gpu/drm/i915/i915_guc_submission.c |  2 +-
 drivers/gpu/drm/i915/i915_perf.c   |  2 +-
 drivers/gpu/drm/i915/intel_display.c   |  2 +-
 drivers/gpu/drm/i915/intel_fbdev.c |  2 +-
 drivers/gpu/drm/i915/intel_guc_loader.c|  5 +++--
 drivers/gpu/drm/i915/intel_lrc.c   |  4 ++--
 drivers/gpu/drm/i915/intel_overlay.c   |  2 +-
 drivers/gpu/drm/i915/intel_ringbuffer.c|  4 ++--
 11 files changed, 30 insertions(+), 27 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 722c68766504..769f64202b4c 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -2989,10 +2989,11 @@ static inline void i915_gem_object_free(struct 
drm_i915_gem_object *obj)
 
 void i915_gem_object_init(struct drm_i915_gem_object *obj,
 const struct drm_i915_gem_object_ops *ops);
-struct drm_i915_gem_object *i915_gem_object_create(struct drm_device *dev,
-  u64 size);
-struct drm_i915_gem_object *i915_gem_object_create_from_data(
-   struct drm_device *dev, const void *data, size_t size);
+struct drm_i915_gem_object *
+i915_gem_object_create(struct drm_i915_private *dev_priv, u64 size);
+struct drm_i915_gem_object *
+i915_gem_object_create_from_data(struct drm_i915_private *dev_priv,
+const void *data, size_t size);
 void i915_gem_close_object(struct drm_gem_object *gem, struct drm_file *file);
 void i915_gem_free_object(struct drm_gem_object *obj);
 
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 04af42ef9b0e..1f8eab3a021f 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -624,7 +624,7 @@ i915_gem_phys_pwrite(struct drm_i915_gem_object *obj,
 
 static int
 i915_gem_create(struct drm_file *file,
-   struct drm_device *dev,
+   struct drm_i915_private *dev_priv,
uint64_t size,
uint32_t *handle_p)
 {
@@ -637,7 +637,7 @@ i915_gem_create(struct drm_file *file,
return -EINVAL;
 
/* Allocate the new object */
-   obj = i915_gem_object_create(dev, size);
+   obj = i915_gem_object_create(dev_priv, size);
if (IS_ERR(obj))
return PTR_ERR(obj);
 
@@ -659,7 +659,7 @@ i915_gem_dumb_create(struct drm_file *file,
/* have to work out size/pitch and return them */
args->pitch = ALIGN(args->width * DIV_ROUND_UP(args->bpp, 8), 64);
args->size = args->pitch * args->height;
-   return i915_gem_create(file, dev,
+   return i915_gem_create(file, to_i915(dev),
   args->size, >handle);
 }
 
@@ -673,11 +673,12 @@ int
 i915_gem_create_ioctl(struct drm_device *dev, void *data,
  struct drm_file *file)
 {
+   struct drm_i915_private *dev_priv = to_i915(dev);
struct drm_i915_gem_create *args = data;
 
-   i915_gem_flush_free_objects(to_i915(dev));
+   i915_gem_flush_free_objects(dev_priv);
 
-   return i915_gem_create(file, dev,
+   return i915_gem_create(file, dev_priv,
   args->size, >handle);
 }
 
@@ -3959,9 +3960,8 @@ static const struct drm_i915_gem_object_ops 
i915_gem_object_ops = {
(sizeof(x) > sizeof(T) && (x) >> (sizeof(T) * BITS_PER_BYTE))
 
 struct drm_i915_gem_object *
-i915_gem_object_create(struct drm_device *dev, u64 size)
+i915_gem_object_create(struct drm_i915_private *dev_priv, u64 size)
 {
-   struct drm_i915_private *dev_priv = to_i915(dev);
struct drm_i915_gem_object *obj;
struct address_space *mapping;
gfp_t mask;
@@ -3982,7 +3982,7 @@ i915_gem_object_create(struct drm_device *dev, u64 size)
if (obj == NULL)
return ERR_PTR(-ENOMEM);
 
-   ret = drm_gem_object_init(dev, >base, size);
+   ret = drm_gem_object_init(_priv->drm, >base, size);
if (ret)
goto fail;
 
@@ -4738,7 +4738,7 @@ void i915_gem_track_fb(struct drm_i915_gem_object *old,
 
 /* Allocate a new GEM object and fill it with the supplied data */
 struct drm_i915_gem_object *
-i915_gem_object_create_from_data(struct drm_device *dev,
+i915_gem_object_create_from_data(struct drm_i915_private *dev_priv,
 const void *data, size_t size)
 {
struct drm_i915_gem_object *obj;
@@ -4746,7 +4746,7 @@ i915_gem_object_create_from_data(struct drm_device *dev,
size_t bytes;
int ret;
 
-   obj = i915_gem_object_create(dev, round_up(size, PAGE_SIZE));
+   obj = 

[Intel-gfx] [PATCH 04/10] drm/i915: More GEM init dev_priv cleanup

2016-11-30 Thread Tvrtko Ursulin
From: Tvrtko Ursulin 

Signed-off-by: Tvrtko Ursulin 
---
 drivers/gpu/drm/i915/i915_drv.c |  8 
 drivers/gpu/drm/i915/i915_drv.h |  8 
 drivers/gpu/drm/i915/i915_gem.c | 10 +++---
 drivers/gpu/drm/i915/i915_gem_context.c |  5 ++---
 4 files changed, 13 insertions(+), 18 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 55efff69fcd0..3c0deb0e008f 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -544,8 +544,8 @@ static const struct vga_switcheroo_client_ops 
i915_switcheroo_ops = {
 static void i915_gem_fini(struct drm_i915_private *dev_priv)
 {
mutex_lock(_priv->drm.struct_mutex);
-   i915_gem_cleanup_engines(_priv->drm);
-   i915_gem_context_fini(_priv->drm);
+   i915_gem_cleanup_engines(dev_priv);
+   i915_gem_context_fini(dev_priv);
mutex_unlock(_priv->drm.struct_mutex);
 
rcu_barrier();
@@ -840,7 +840,7 @@ static int i915_driver_init_early(struct drm_i915_private 
*dev_priv,
intel_init_display_hooks(dev_priv);
intel_init_clock_gating_hooks(dev_priv);
intel_init_audio_hooks(dev_priv);
-   ret = i915_gem_load_init(_priv->drm);
+   ret = i915_gem_load_init(dev_priv);
if (ret < 0)
goto err_gvt;
 
@@ -868,7 +868,7 @@ static int i915_driver_init_early(struct drm_i915_private 
*dev_priv,
 static void i915_driver_cleanup_early(struct drm_i915_private *dev_priv)
 {
i915_perf_fini(dev_priv);
-   i915_gem_load_cleanup(_priv->drm);
+   i915_gem_load_cleanup(dev_priv);
i915_workqueues_cleanup(dev_priv);
 }
 
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index f01c91849928..c6f37b0ba7ab 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -2970,8 +2970,8 @@ int i915_gem_get_aperture_ioctl(struct drm_device *dev, 
void *data,
struct drm_file *file_priv);
 int i915_gem_wait_ioctl(struct drm_device *dev, void *data,
struct drm_file *file_priv);
-int i915_gem_load_init(struct drm_device *dev);
-void i915_gem_load_cleanup(struct drm_device *dev);
+int i915_gem_load_init(struct drm_i915_private *dev_priv);
+void i915_gem_load_cleanup(struct drm_i915_private *dev_priv);
 void i915_gem_load_init_fences(struct drm_i915_private *dev_priv);
 int i915_gem_freeze(struct drm_i915_private *dev_priv);
 int i915_gem_freeze_late(struct drm_i915_private *dev_priv);
@@ -3184,7 +3184,7 @@ void i915_gem_clflush_object(struct drm_i915_gem_object 
*obj, bool force);
 int __must_check i915_gem_init(struct drm_i915_private *dev_priv);
 int __must_check i915_gem_init_hw(struct drm_i915_private *dev_priv);
 void i915_gem_init_swizzling(struct drm_i915_private *dev_priv);
-void i915_gem_cleanup_engines(struct drm_device *dev);
+void i915_gem_cleanup_engines(struct drm_i915_private *dev_priv);
 int __must_check i915_gem_wait_for_idle(struct drm_i915_private *dev_priv,
unsigned int flags);
 int __must_check i915_gem_suspend(struct drm_i915_private *dev_priv);
@@ -3273,7 +3273,7 @@ void i915_gem_object_save_bit_17_swizzle(struct 
drm_i915_gem_object *obj,
 /* i915_gem_context.c */
 int __must_check i915_gem_context_init(struct drm_i915_private *dev_priv);
 void i915_gem_context_lost(struct drm_i915_private *dev_priv);
-void i915_gem_context_fini(struct drm_device *dev);
+void i915_gem_context_fini(struct drm_i915_private *dev_priv);
 int i915_gem_context_open(struct drm_device *dev, struct drm_file *file);
 void i915_gem_context_close(struct drm_device *dev, struct drm_file *file);
 int i915_switch_context(struct drm_i915_gem_request *req);
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index b5888f751e01..1178d00969d6 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -4469,9 +4469,8 @@ int i915_gem_init(struct drm_i915_private *dev_priv)
 }
 
 void
-i915_gem_cleanup_engines(struct drm_device *dev)
+i915_gem_cleanup_engines(struct drm_i915_private *dev_priv)
 {
-   struct drm_i915_private *dev_priv = to_i915(dev);
struct intel_engine_cs *engine;
enum intel_engine_id id;
 
@@ -4511,9 +4510,8 @@ i915_gem_load_init_fences(struct drm_i915_private 
*dev_priv)
 }
 
 int
-i915_gem_load_init(struct drm_device *dev)
+i915_gem_load_init(struct drm_i915_private *dev_priv)
 {
-   struct drm_i915_private *dev_priv = to_i915(dev);
int err = -ENOMEM;
 
dev_priv->objects = KMEM_CACHE(drm_i915_gem_object, SLAB_HWCACHE_ALIGN);
@@ -4582,10 +4580,8 @@ i915_gem_load_init(struct drm_device *dev)
return err;
 }
 
-void i915_gem_load_cleanup(struct drm_device *dev)
+void i915_gem_load_cleanup(struct drm_i915_private *dev_priv)
 {
-   struct drm_i915_private *dev_priv = to_i915(dev);
-

[Intel-gfx] [PATCH 09/10] drm/i915: Make i915_save/restore_state and intel_i2c_reset take dev_priv

2016-11-30 Thread Tvrtko Ursulin
From: Tvrtko Ursulin 

Signed-off-by: Tvrtko Ursulin 
---
 drivers/gpu/drm/i915/i915_drv.c |  4 ++--
 drivers/gpu/drm/i915/i915_drv.h |  6 +++---
 drivers/gpu/drm/i915/i915_suspend.c | 22 +-
 drivers/gpu/drm/i915/intel_i2c.c|  8 +++-
 4 files changed, 17 insertions(+), 23 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 3ca00fafda20..f6331e873735 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -1443,7 +1443,7 @@ static int i915_drm_suspend(struct drm_device *dev)
 
i915_gem_suspend_gtt_mappings(dev_priv);
 
-   i915_save_state(dev);
+   i915_save_state(dev_priv);
 
opregion_target_state = suspend_to_idle(dev_priv) ? PCI_D1 : PCI_D3cold;
intel_opregion_notify_adapter(dev_priv, opregion_target_state);
@@ -1566,7 +1566,7 @@ static int i915_drm_resume(struct drm_device *dev)
 
i915_gem_resume(dev_priv);
 
-   i915_restore_state(dev);
+   i915_restore_state(dev_priv);
intel_pps_unlock_regs_wa(dev_priv);
intel_opregion_setup(dev_priv);
 
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 41ad3183ab8e..aa92040d1841 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -3474,8 +3474,8 @@ extern void i915_perf_register(struct drm_i915_private 
*dev_priv);
 extern void i915_perf_unregister(struct drm_i915_private *dev_priv);
 
 /* i915_suspend.c */
-extern int i915_save_state(struct drm_device *dev);
-extern int i915_restore_state(struct drm_device *dev);
+extern int i915_save_state(struct drm_i915_private *dev_priv);
+extern int i915_restore_state(struct drm_i915_private *dev_priv);
 
 /* i915_sysfs.c */
 void i915_setup_sysfs(struct drm_i915_private *dev_priv);
@@ -3495,7 +3495,7 @@ static inline bool intel_gmbus_is_forced_bit(struct 
i2c_adapter *adapter)
 {
return container_of(adapter, struct intel_gmbus, adapter)->force_bit;
 }
-extern void intel_i2c_reset(struct drm_device *dev);
+extern void intel_i2c_reset(struct drm_i915_private *dev_priv);
 
 /* intel_bios.c */
 int intel_bios_init(struct drm_i915_private *dev_priv);
diff --git a/drivers/gpu/drm/i915/i915_suspend.c 
b/drivers/gpu/drm/i915/i915_suspend.c
index b0e1e7ca75da..c21be0d88f8a 100644
--- a/drivers/gpu/drm/i915/i915_suspend.c
+++ b/drivers/gpu/drm/i915/i915_suspend.c
@@ -56,18 +56,16 @@ static void i915_restore_display(struct drm_i915_private 
*dev_priv)
i915_redisable_vga(dev_priv);
 }
 
-int i915_save_state(struct drm_device *dev)
+int i915_save_state(struct drm_i915_private *dev_priv)
 {
-   struct drm_i915_private *dev_priv = to_i915(dev);
-   struct pci_dev *pdev = dev_priv->drm.pdev;
int i;
 
-   mutex_lock(>struct_mutex);
+   mutex_lock(_priv->drm.struct_mutex);
 
i915_save_display(dev_priv);
 
if (IS_GEN4(dev_priv))
-   pci_read_config_word(pdev, GCDGMBUS,
+   pci_read_config_word(dev_priv->drm.pdev, GCDGMBUS,
 _priv->regfile.saveGCDGMBUS);
 
/* Cache mode state */
@@ -97,23 +95,21 @@ int i915_save_state(struct drm_device *dev)
dev_priv->regfile.saveSWF3[i] = I915_READ(SWF3(i));
}
 
-   mutex_unlock(>struct_mutex);
+   mutex_unlock(_priv->drm.struct_mutex);
 
return 0;
 }
 
-int i915_restore_state(struct drm_device *dev)
+int i915_restore_state(struct drm_i915_private *dev_priv)
 {
-   struct drm_i915_private *dev_priv = to_i915(dev);
-   struct pci_dev *pdev = dev_priv->drm.pdev;
int i;
 
-   mutex_lock(>struct_mutex);
+   mutex_lock(_priv->drm.struct_mutex);
 
i915_gem_restore_fences(dev_priv);
 
if (IS_GEN4(dev_priv))
-   pci_write_config_word(pdev, GCDGMBUS,
+   pci_write_config_word(dev_priv->drm.pdev, GCDGMBUS,
  dev_priv->regfile.saveGCDGMBUS);
i915_restore_display(dev_priv);
 
@@ -145,9 +141,9 @@ int i915_restore_state(struct drm_device *dev)
I915_WRITE(SWF3(i), dev_priv->regfile.saveSWF3[i]);
}
 
-   mutex_unlock(>struct_mutex);
+   mutex_unlock(_priv->drm.struct_mutex);
 
-   intel_i2c_reset(dev);
+   intel_i2c_reset(dev_priv);
 
return 0;
 }
diff --git a/drivers/gpu/drm/i915/intel_i2c.c b/drivers/gpu/drm/i915/intel_i2c.c
index 85faba415633..62fe529516b1 100644
--- a/drivers/gpu/drm/i915/intel_i2c.c
+++ b/drivers/gpu/drm/i915/intel_i2c.c
@@ -111,10 +111,8 @@ to_intel_gmbus(struct i2c_adapter *i2c)
 }
 
 void
-intel_i2c_reset(struct drm_device *dev)
+intel_i2c_reset(struct drm_i915_private *dev_priv)
 {
-   struct drm_i915_private *dev_priv = to_i915(dev);
-
I915_WRITE(GMBUS0, 0);
I915_WRITE(GMBUS4, 0);
 }
@@ -211,7 +209,7 @@ intel_gpio_pre_xfer(struct i2c_adapter *adapter)

[Intel-gfx] [PATCH 07/10] drm/i915: Make gmbus setup take dev_priv

2016-11-30 Thread Tvrtko Ursulin
From: Tvrtko Ursulin 

Signed-off-by: Tvrtko Ursulin 
---
 drivers/gpu/drm/i915/i915_drv.c  | 4 ++--
 drivers/gpu/drm/i915/i915_drv.h  | 4 ++--
 drivers/gpu/drm/i915/intel_display.c | 2 +-
 drivers/gpu/drm/i915/intel_i2c.c | 8 +++-
 4 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 45b65962bd97..2d1f1090a1ff 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -592,7 +592,7 @@ static int i915_load_modeset_init(struct drm_device *dev)
if (ret)
goto cleanup_csr;
 
-   intel_setup_gmbus(dev);
+   intel_setup_gmbus(dev_priv);
 
/* Important: The output setup functions called by modeset_init need
 * working irqs for e.g. gmbus and dp aux transfers. */
@@ -629,7 +629,7 @@ static int i915_load_modeset_init(struct drm_device *dev)
 cleanup_irq:
intel_guc_fini(dev_priv);
drm_irq_uninstall(dev);
-   intel_teardown_gmbus(dev);
+   intel_teardown_gmbus(dev_priv);
 cleanup_csr:
intel_csr_ucode_fini(dev_priv);
intel_power_domains_fini(dev_priv);
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index c6437c1422f3..0522aab3576b 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -3482,8 +3482,8 @@ void i915_setup_sysfs(struct drm_i915_private *dev_priv);
 void i915_teardown_sysfs(struct drm_i915_private *dev_priv);
 
 /* intel_i2c.c */
-extern int intel_setup_gmbus(struct drm_device *dev);
-extern void intel_teardown_gmbus(struct drm_device *dev);
+extern int intel_setup_gmbus(struct drm_i915_private *dev_priv);
+extern void intel_teardown_gmbus(struct drm_i915_private *dev_priv);
 extern bool intel_gmbus_is_valid_pin(struct drm_i915_private *dev_priv,
 unsigned int pin);
 
diff --git a/drivers/gpu/drm/i915/intel_display.c 
b/drivers/gpu/drm/i915/intel_display.c
index 2785c619fa55..16fb90964a64 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -17162,7 +17162,7 @@ void intel_modeset_cleanup(struct drm_device *dev)
 
intel_cleanup_gt_powersave(dev_priv);
 
-   intel_teardown_gmbus(dev);
+   intel_teardown_gmbus(dev_priv);
 }
 
 void intel_connector_attach_encoder(struct intel_connector *connector,
diff --git a/drivers/gpu/drm/i915/intel_i2c.c b/drivers/gpu/drm/i915/intel_i2c.c
index 83f260bb4eef..85faba415633 100644
--- a/drivers/gpu/drm/i915/intel_i2c.c
+++ b/drivers/gpu/drm/i915/intel_i2c.c
@@ -617,11 +617,10 @@ static const struct i2c_algorithm gmbus_algorithm = {
 
 /**
  * intel_gmbus_setup - instantiate all Intel i2c GMBuses
- * @dev: DRM device
+ * @dev_priv: i915 device private
  */
-int intel_setup_gmbus(struct drm_device *dev)
+int intel_setup_gmbus(struct drm_i915_private *dev_priv)
 {
-   struct drm_i915_private *dev_priv = to_i915(dev);
struct pci_dev *pdev = dev_priv->drm.pdev;
struct intel_gmbus *bus;
unsigned int pin;
@@ -724,9 +723,8 @@ void intel_gmbus_force_bit(struct i2c_adapter *adapter, 
bool force_bit)
mutex_unlock(_priv->gmbus_mutex);
 }
 
-void intel_teardown_gmbus(struct drm_device *dev)
+void intel_teardown_gmbus(struct drm_i915_private *dev_priv)
 {
-   struct drm_i915_private *dev_priv = to_i915(dev);
struct intel_gmbus *bus;
unsigned int pin;
 
-- 
2.7.4

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH 01/10] drm/i915: Make GEM object alloc/free and stolen created take dev_priv

2016-11-30 Thread Tvrtko Ursulin
From: Tvrtko Ursulin 

Where it is more appropriate and also to be consistent with
the direction of the driver.

Also inline object alloc/free since they are just wrappers
around kmem_cache_alloc/free.

Signed-off-by: Tvrtko Ursulin 
---
 drivers/gpu/drm/i915/i915_drv.h  | 17 +
 drivers/gpu/drm/i915/i915_gem.c  | 14 +-
 drivers/gpu/drm/i915/i915_gem_dmabuf.c   |  2 +-
 drivers/gpu/drm/i915/i915_gem_internal.c |  2 +-
 drivers/gpu/drm/i915/i915_gem_stolen.c   | 21 +
 drivers/gpu/drm/i915/i915_gem_userptr.c  |  2 +-
 drivers/gpu/drm/i915/intel_display.c |  2 +-
 drivers/gpu/drm/i915/intel_engine_cs.c   |  2 +-
 drivers/gpu/drm/i915/intel_fbdev.c   |  2 +-
 drivers/gpu/drm/i915/intel_overlay.c |  3 +--
 drivers/gpu/drm/i915/intel_pm.c  |  4 ++--
 drivers/gpu/drm/i915/intel_ringbuffer.c  |  2 +-
 12 files changed, 33 insertions(+), 40 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 297ad03ab0c2..722c68766504 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -2976,8 +2976,17 @@ void i915_gem_load_init_fences(struct drm_i915_private 
*dev_priv);
 int i915_gem_freeze(struct drm_i915_private *dev_priv);
 int i915_gem_freeze_late(struct drm_i915_private *dev_priv);
 
-void *i915_gem_object_alloc(struct drm_device *dev);
-void i915_gem_object_free(struct drm_i915_gem_object *obj);
+static inline void *i915_gem_object_alloc(struct drm_i915_private *dev_priv)
+{
+   return kmem_cache_zalloc(dev_priv->objects, GFP_KERNEL);
+}
+
+static inline void i915_gem_object_free(struct drm_i915_gem_object *obj)
+{
+   struct drm_i915_private *dev_priv = to_i915(obj->base.dev);
+   kmem_cache_free(dev_priv->objects, obj);
+}
+
 void i915_gem_object_init(struct drm_i915_gem_object *obj,
 const struct drm_i915_gem_object_ops *ops);
 struct drm_i915_gem_object *i915_gem_object_create(struct drm_device *dev,
@@ -3361,9 +3370,9 @@ void i915_gem_stolen_remove_node(struct drm_i915_private 
*dev_priv,
 int i915_gem_init_stolen(struct drm_i915_private *dev_priv);
 void i915_gem_cleanup_stolen(struct drm_device *dev);
 struct drm_i915_gem_object *
-i915_gem_object_create_stolen(struct drm_device *dev, u32 size);
+i915_gem_object_create_stolen(struct drm_i915_private *dev_priv, u32 size);
 struct drm_i915_gem_object *
-i915_gem_object_create_stolen_for_preallocated(struct drm_device *dev,
+i915_gem_object_create_stolen_for_preallocated(struct drm_i915_private 
*dev_priv,
   u32 stolen_offset,
   u32 gtt_offset,
   u32 size);
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 8ebefb6f6cf2..04af42ef9b0e 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -622,18 +622,6 @@ i915_gem_phys_pwrite(struct drm_i915_gem_object *obj,
return ret;
 }
 
-void *i915_gem_object_alloc(struct drm_device *dev)
-{
-   struct drm_i915_private *dev_priv = to_i915(dev);
-   return kmem_cache_zalloc(dev_priv->objects, GFP_KERNEL);
-}
-
-void i915_gem_object_free(struct drm_i915_gem_object *obj)
-{
-   struct drm_i915_private *dev_priv = to_i915(obj->base.dev);
-   kmem_cache_free(dev_priv->objects, obj);
-}
-
 static int
 i915_gem_create(struct drm_file *file,
struct drm_device *dev,
@@ -3990,7 +3978,7 @@ i915_gem_object_create(struct drm_device *dev, u64 size)
if (overflows_type(size, obj->base.size))
return ERR_PTR(-E2BIG);
 
-   obj = i915_gem_object_alloc(dev);
+   obj = i915_gem_object_alloc(dev_priv);
if (obj == NULL)
return ERR_PTR(-ENOMEM);
 
diff --git a/drivers/gpu/drm/i915/i915_gem_dmabuf.c 
b/drivers/gpu/drm/i915/i915_gem_dmabuf.c
index 5e38299b5df6..d037adcda6f2 100644
--- a/drivers/gpu/drm/i915/i915_gem_dmabuf.c
+++ b/drivers/gpu/drm/i915/i915_gem_dmabuf.c
@@ -278,7 +278,7 @@ struct drm_gem_object *i915_gem_prime_import(struct 
drm_device *dev,
 
get_dma_buf(dma_buf);
 
-   obj = i915_gem_object_alloc(dev);
+   obj = i915_gem_object_alloc(to_i915(dev));
if (obj == NULL) {
ret = -ENOMEM;
goto fail_detach;
diff --git a/drivers/gpu/drm/i915/i915_gem_internal.c 
b/drivers/gpu/drm/i915/i915_gem_internal.c
index 4b3ff3e5b911..08d26306d40e 100644
--- a/drivers/gpu/drm/i915/i915_gem_internal.c
+++ b/drivers/gpu/drm/i915/i915_gem_internal.c
@@ -155,7 +155,7 @@ i915_gem_object_create_internal(struct drm_i915_private 
*i915,
 {
struct drm_i915_gem_object *obj;
 
-   obj = i915_gem_object_alloc(>drm);
+   obj = i915_gem_object_alloc(i915);
if (!obj)
return ERR_PTR(-ENOMEM);
 
diff --git 

[Intel-gfx] [PATCH 03/10] drm/i915: Make various init functions take dev_priv

2016-11-30 Thread Tvrtko Ursulin
From: Tvrtko Ursulin 

Like GEM init, GUC init, MOCS init and context creation.

Enables them to lose dev_priv locals.

Signed-off-by: Tvrtko Ursulin 
---
 drivers/gpu/drm/i915/i915_drv.c| 31 ++--
 drivers/gpu/drm/i915/i915_drv.h| 10 -
 drivers/gpu/drm/i915/i915_gem.c| 28 -
 drivers/gpu/drm/i915/i915_gem_context.c| 31 +---
 drivers/gpu/drm/i915/i915_guc_submission.c | 10 -
 drivers/gpu/drm/i915/intel_engine_cs.c |  5 ++---
 drivers/gpu/drm/i915/intel_guc_loader.c| 33 ++
 drivers/gpu/drm/i915/intel_lrc.h   |  2 +-
 drivers/gpu/drm/i915/intel_mocs.c  |  5 ++---
 drivers/gpu/drm/i915/intel_mocs.h  |  2 +-
 drivers/gpu/drm/i915/intel_uc.h| 10 -
 11 files changed, 77 insertions(+), 90 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 8dac298461c0..55efff69fcd0 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -603,9 +603,9 @@ static int i915_load_modeset_init(struct drm_device *dev)
if (ret)
goto cleanup_irq;
 
-   intel_guc_init(dev);
+   intel_guc_init(dev_priv);
 
-   ret = i915_gem_init(dev);
+   ret = i915_gem_init(dev_priv);
if (ret)
goto cleanup_irq;
 
@@ -626,11 +626,11 @@ static int i915_load_modeset_init(struct drm_device *dev)
return 0;
 
 cleanup_gem:
-   if (i915_gem_suspend(dev))
+   if (i915_gem_suspend(dev_priv))
DRM_ERROR("failed to idle hardware; continuing to unload!\n");
i915_gem_fini(dev_priv);
 cleanup_irq:
-   intel_guc_fini(dev);
+   intel_guc_fini(dev_priv);
drm_irq_uninstall(dev);
intel_teardown_gmbus(dev);
 cleanup_csr:
@@ -1290,7 +1290,7 @@ void i915_driver_unload(struct drm_device *dev)
 
intel_fbdev_fini(dev);
 
-   if (i915_gem_suspend(dev))
+   if (i915_gem_suspend(dev_priv))
DRM_ERROR("failed to idle hardware; continuing to unload!\n");
 
intel_display_power_get(dev_priv, POWER_DOMAIN_INIT);
@@ -1327,7 +1327,7 @@ void i915_driver_unload(struct drm_device *dev)
/* Flush any outstanding unpin_work. */
drain_workqueue(dev_priv->wq);
 
-   intel_guc_fini(dev);
+   intel_guc_fini(dev_priv);
i915_gem_fini(dev_priv);
intel_fbc_cleanup_cfb(dev_priv);
 
@@ -1432,14 +1432,14 @@ static int i915_drm_suspend(struct drm_device *dev)
 
pci_save_state(pdev);
 
-   error = i915_gem_suspend(dev);
+   error = i915_gem_suspend(dev_priv);
if (error) {
dev_err(>dev,
"GEM idle failed, resume might fail\n");
goto out;
}
 
-   intel_guc_suspend(dev);
+   intel_guc_suspend(dev_priv);
 
intel_display_suspend(dev);
 
@@ -1575,7 +1575,7 @@ static int i915_drm_resume(struct drm_device *dev)
 
intel_csr_ucode_resume(dev_priv);
 
-   i915_gem_resume(dev);
+   i915_gem_resume(dev_priv);
 
i915_restore_state(dev);
intel_pps_unlock_regs_wa(dev_priv);
@@ -1595,13 +1595,13 @@ static int i915_drm_resume(struct drm_device *dev)
intel_runtime_pm_enable_interrupts(dev_priv);
 
mutex_lock(>struct_mutex);
-   if (i915_gem_init_hw(dev)) {
+   if (i915_gem_init_hw(dev_priv)) {
DRM_ERROR("failed to re-initialize GPU, declaring wedged!\n");
i915_gem_set_wedged(dev_priv);
}
mutex_unlock(>struct_mutex);
 
-   intel_guc_resume(dev);
+   intel_guc_resume(dev_priv);
 
intel_modeset_init_hw(dev);
 
@@ -1774,11 +1774,10 @@ static void enable_engines_irq(struct drm_i915_private 
*dev_priv)
  */
 void i915_reset(struct drm_i915_private *dev_priv)
 {
-   struct drm_device *dev = _priv->drm;
struct i915_gpu_error *error = _priv->gpu_error;
int ret;
 
-   lockdep_assert_held(>struct_mutex);
+   lockdep_assert_held(_priv->drm.struct_mutex);
 
if (!test_and_clear_bit(I915_RESET_IN_PROGRESS, >flags))
return;
@@ -1818,7 +1817,7 @@ void i915_reset(struct drm_i915_private *dev_priv)
 * was running at the time of the reset (i.e. we weren't VT
 * switched away).
 */
-   ret = i915_gem_init_hw(dev);
+   ret = i915_gem_init_hw(dev_priv);
if (ret) {
DRM_ERROR("Failed hw init on reset %d\n", ret);
goto error;
@@ -2332,7 +2331,7 @@ static int intel_runtime_suspend(struct device *kdev)
 */
i915_gem_runtime_suspend(dev_priv);
 
-   intel_guc_suspend(dev);
+   intel_guc_suspend(dev_priv);
 
intel_runtime_pm_disable_interrupts(dev_priv);
 
@@ -2417,7 +2416,7 @@ static int intel_runtime_resume(struct device *kdev)
if 

[Intel-gfx] [PATCH 06/10] drm/i915: Unexport VGA switcheroo functions

2016-11-30 Thread Tvrtko Ursulin
From: Tvrtko Ursulin 

They are only used in i915_drv.c so a forward declaration is enough.

Signed-off-by: Tvrtko Ursulin 
---
 drivers/gpu/drm/i915/i915_drv.c | 5 -
 drivers/gpu/drm/i915/i915_drv.h | 3 ---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 23d8001ea0b0..45b65962bd97 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -497,6 +497,9 @@ static unsigned int i915_vga_set_decode(void *cookie, bool 
state)
return VGA_RSRC_NORMAL_IO | VGA_RSRC_NORMAL_MEM;
 }
 
+static int i915_resume_switcheroo(struct drm_device *dev);
+static int i915_suspend_switcheroo(struct drm_device *dev, pm_message_t state);
+
 static void i915_switcheroo_set_state(struct pci_dev *pdev, enum 
vga_switcheroo_state state)
 {
struct drm_device *dev = pci_get_drvdata(pdev);
@@ -1711,7 +1714,7 @@ static int i915_drm_resume_early(struct drm_device *dev)
return ret;
 }
 
-int i915_resume_switcheroo(struct drm_device *dev)
+static int i915_resume_switcheroo(struct drm_device *dev)
 {
int ret;
 
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index c6f37b0ba7ab..c6437c1422f3 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -2754,9 +2754,6 @@ static inline bool intel_scanout_needs_vtd_wa(struct 
drm_i915_private *dev_priv)
return false;
 }
 
-extern int i915_suspend_switcheroo(struct drm_device *dev, pm_message_t state);
-extern int i915_resume_switcheroo(struct drm_device *dev);
-
 int intel_sanitize_enable_ppgtt(struct drm_i915_private *dev_priv,
int enable_ppgtt);
 
-- 
2.7.4

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH 10/10] drm/i915: Make intel_pm_setup take dev_priv

2016-11-30 Thread Tvrtko Ursulin
From: Tvrtko Ursulin 

Signed-off-by: Tvrtko Ursulin 
---
 drivers/gpu/drm/i915/i915_drv.c  | 2 +-
 drivers/gpu/drm/i915/intel_drv.h | 2 +-
 drivers/gpu/drm/i915/intel_pm.c  | 4 +---
 3 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index f6331e873735..15a7779ab265 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -829,7 +829,7 @@ static int i915_driver_init_early(struct drm_i915_private 
*dev_priv,
/* This must be called before any calls to HAS_PCH_* */
intel_detect_pch(dev_priv);
 
-   intel_pm_setup(_priv->drm);
+   intel_pm_setup(dev_priv);
intel_init_dpio(dev_priv);
intel_power_domains_init(dev_priv);
intel_irq_init(dev_priv);
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 460f3742ebd7..1d126c29598f 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -1724,7 +1724,7 @@ int ilk_wm_max_level(const struct drm_i915_private 
*dev_priv);
 void intel_update_watermarks(struct intel_crtc *crtc);
 void intel_init_pm(struct drm_i915_private *dev_priv);
 void intel_init_clock_gating_hooks(struct drm_i915_private *dev_priv);
-void intel_pm_setup(struct drm_device *dev);
+void intel_pm_setup(struct drm_i915_private *dev_priv);
 void intel_gpu_ips_init(struct drm_i915_private *dev_priv);
 void intel_gpu_ips_teardown(void);
 void intel_init_gt_powersave(struct drm_i915_private *dev_priv);
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index ca31cdd82ebd..c45ee1732715 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -7955,10 +7955,8 @@ void intel_queue_rps_boost_for_request(struct 
drm_i915_gem_request *req)
queue_work(req->i915->wq, >work);
 }
 
-void intel_pm_setup(struct drm_device *dev)
+void intel_pm_setup(struct drm_i915_private *dev_priv)
 {
-   struct drm_i915_private *dev_priv = to_i915(dev);
-
mutex_init(_priv->rps.hw_lock);
spin_lock_init(_priv->rps.client_lock);
 
-- 
2.7.4

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH 08/10] drm/i915: Make i915_destroy_error_state take dev_priv

2016-11-30 Thread Tvrtko Ursulin
From: Tvrtko Ursulin 

Since it does not need dev at all.

Also change the stored pointer in struct i915_error_state_file_priv
to i915.

Signed-off-by: Tvrtko Ursulin 
---
 drivers/gpu/drm/i915/i915_debugfs.c   | 8 
 drivers/gpu/drm/i915/i915_drv.c   | 2 +-
 drivers/gpu/drm/i915/i915_drv.h   | 6 +++---
 drivers/gpu/drm/i915/i915_gpu_error.c | 5 ++---
 drivers/gpu/drm/i915/i915_sysfs.c | 4 ++--
 5 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_debugfs.c 
b/drivers/gpu/drm/i915/i915_debugfs.c
index 2434130087be..d006ed131a54 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -946,7 +946,7 @@ i915_error_state_write(struct file *filp,
struct i915_error_state_file_priv *error_priv = filp->private_data;
 
DRM_DEBUG_DRIVER("Resetting error state\n");
-   i915_destroy_error_state(error_priv->dev);
+   i915_destroy_error_state(error_priv->i915);
 
return cnt;
 }
@@ -960,7 +960,7 @@ static int i915_error_state_open(struct inode *inode, 
struct file *file)
if (!error_priv)
return -ENOMEM;
 
-   error_priv->dev = _priv->drm;
+   error_priv->i915 = dev_priv;
 
i915_error_state_get(_priv->drm, error_priv);
 
@@ -988,8 +988,8 @@ static ssize_t i915_error_state_read(struct file *file, 
char __user *userbuf,
ssize_t ret_count = 0;
int ret;
 
-   ret = i915_error_state_buf_init(_str,
-   to_i915(error_priv->dev), count, *pos);
+   ret = i915_error_state_buf_init(_str, error_priv->i915,
+   count, *pos);
if (ret)
return ret;
 
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 2d1f1090a1ff..3ca00fafda20 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -1311,7 +1311,7 @@ void i915_driver_unload(struct drm_device *dev)
 
/* Free error state after interrupts are fully disabled. */
cancel_delayed_work_sync(_priv->gpu_error.hangcheck_work);
-   i915_destroy_error_state(dev);
+   i915_destroy_error_state(dev_priv);
 
/* Flush any outstanding unpin_work. */
drain_workqueue(dev_priv->wq);
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 0522aab3576b..41ad3183ab8e 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -1457,7 +1457,7 @@ struct drm_i915_error_state_buf {
 };
 
 struct i915_error_state_file_priv {
-   struct drm_device *dev;
+   struct drm_i915_private *i915;
struct drm_i915_error_state *error;
 };
 
@@ -3438,7 +3438,7 @@ void i915_capture_error_state(struct drm_i915_private 
*dev_priv,
 void i915_error_state_get(struct drm_device *dev,
  struct i915_error_state_file_priv *error_priv);
 void i915_error_state_put(struct i915_error_state_file_priv *error_priv);
-void i915_destroy_error_state(struct drm_device *dev);
+void i915_destroy_error_state(struct drm_i915_private *dev_priv);
 
 #else
 
@@ -3448,7 +3448,7 @@ static inline void i915_capture_error_state(struct 
drm_i915_private *dev_priv,
 {
 }
 
-static inline void i915_destroy_error_state(struct drm_device *dev)
+static inline void i915_destroy_error_state(struct drm_i915_private *dev_priv)
 {
 }
 
diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c 
b/drivers/gpu/drm/i915/i915_gpu_error.c
index 82458ea60150..a14f7badc337 100644
--- a/drivers/gpu/drm/i915/i915_gpu_error.c
+++ b/drivers/gpu/drm/i915/i915_gpu_error.c
@@ -514,7 +514,7 @@ static void err_print_capabilities(struct 
drm_i915_error_state_buf *m,
 int i915_error_state_to_str(struct drm_i915_error_state_buf *m,
const struct i915_error_state_file_priv *error_priv)
 {
-   struct drm_i915_private *dev_priv = to_i915(error_priv->dev);
+   struct drm_i915_private *dev_priv = error_priv->i915;
struct pci_dev *pdev = dev_priv->drm.pdev;
struct drm_i915_error_state *error = error_priv->error;
struct drm_i915_error_object *obj;
@@ -1644,9 +1644,8 @@ void i915_error_state_put(struct 
i915_error_state_file_priv *error_priv)
kref_put(_priv->error->ref, i915_error_state_free);
 }
 
-void i915_destroy_error_state(struct drm_device *dev)
+void i915_destroy_error_state(struct drm_i915_private *dev_priv)
 {
-   struct drm_i915_private *dev_priv = to_i915(dev);
struct drm_i915_error_state *error;
 
spin_lock_irq(_priv->gpu_error.lock);
diff --git a/drivers/gpu/drm/i915/i915_sysfs.c 
b/drivers/gpu/drm/i915/i915_sysfs.c
index 47590ab08d7e..b99fd9668317 100644
--- a/drivers/gpu/drm/i915/i915_sysfs.c
+++ b/drivers/gpu/drm/i915/i915_sysfs.c
@@ -535,7 +535,7 @@ static ssize_t error_state_read(struct file *filp, struct 
kobject *kobj,
if (ret)
return ret;
 

[Intel-gfx] [PATCH 00/10] GEM object create and driver init dev_priv cleanups

2016-11-30 Thread Tvrtko Ursulin
From: Tvrtko Ursulin 

Autumn of churn continues. :)

This series tidies GEM object construction to take dev_priv instead of dev
in all cases and also does a bit of random tidy in the driver load/init code.

Basically functions which only need dev_priv are changed to take dev_priv
instead of dev. There is often a cascade effect and the end result is a
saving in lines of code. And even in binary occasionally but not worth much
mention.

Tvrtko Ursulin (10):
  drm/i915: Make GEM object alloc/free and stolen created take dev_priv
  drm/i915: Make GEM object create and create from data take dev_priv
  drm/i915: Make various init functions take dev_priv
  drm/i915: More GEM init dev_priv cleanup
  drm/i915: dev_priv cleanup in bridge/bar/mmio init code
  drm/i915: Unexport VGA switcheroo functions
  drm/i915: Make gmbus setup take dev_priv
  drm/i915: Make i915_destroy_error_state take dev_priv
  drm/i915: Make i915_save/restore_state and intel_i2c_reset take
dev_priv
  drm/i915: Make intel_pm_setup take dev_priv

 drivers/gpu/drm/i915/i915_debugfs.c|   8 +--
 drivers/gpu/drm/i915/i915_drv.c| 108 +
 drivers/gpu/drm/i915/i915_drv.h|  63 +
 drivers/gpu/drm/i915/i915_gem.c|  72 ---
 drivers/gpu/drm/i915/i915_gem_context.c|  39 +--
 drivers/gpu/drm/i915/i915_gem_dmabuf.c |   2 +-
 drivers/gpu/drm/i915/i915_gem_internal.c   |   2 +-
 drivers/gpu/drm/i915/i915_gem_stolen.c |  21 +++---
 drivers/gpu/drm/i915/i915_gem_userptr.c|   2 +-
 drivers/gpu/drm/i915/i915_gpu_error.c  |   5 +-
 drivers/gpu/drm/i915/i915_guc_submission.c |  12 ++--
 drivers/gpu/drm/i915/i915_perf.c   |   2 +-
 drivers/gpu/drm/i915/i915_suspend.c|  22 +++---
 drivers/gpu/drm/i915/i915_sysfs.c  |   4 +-
 drivers/gpu/drm/i915/intel_display.c   |   6 +-
 drivers/gpu/drm/i915/intel_drv.h   |   2 +-
 drivers/gpu/drm/i915/intel_engine_cs.c |   7 +-
 drivers/gpu/drm/i915/intel_fbdev.c |   4 +-
 drivers/gpu/drm/i915/intel_guc_loader.c|  36 +-
 drivers/gpu/drm/i915/intel_i2c.c   |  16 ++---
 drivers/gpu/drm/i915/intel_lrc.c   |   4 +-
 drivers/gpu/drm/i915/intel_lrc.h   |   2 +-
 drivers/gpu/drm/i915/intel_mocs.c  |   5 +-
 drivers/gpu/drm/i915/intel_mocs.h  |   2 +-
 drivers/gpu/drm/i915/intel_overlay.c   |   5 +-
 drivers/gpu/drm/i915/intel_pm.c|   8 +--
 drivers/gpu/drm/i915/intel_ringbuffer.c|   6 +-
 drivers/gpu/drm/i915/intel_uc.h|  10 +--
 28 files changed, 214 insertions(+), 261 deletions(-)

-- 
2.7.4

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH] drm/i915: Remove dummy i915_kick_out_firmware_fb

2016-11-30 Thread Daniel Vetter
Since

commit 44adece57e2604cec8527a499b48e4d584ab53b8
Author: Daniel Vetter 
Date:   Wed Aug 10 18:52:34 2016 +0200

drm/fb-helper: Add a dummy remove_conflicting_framebuffers

the drm helpers take care of this for us.

Cc: Chris Wilson 
Signed-off-by: Daniel Vetter 
---
 drivers/gpu/drm/i915/i915_drv.c | 7 ---
 1 file changed, 7 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 8dac298461c0..dc80c8ff54e3 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -643,7 +643,6 @@ static int i915_load_modeset_init(struct drm_device *dev)
return ret;
 }
 
-#if IS_ENABLED(CONFIG_FB)
 static int i915_kick_out_firmware_fb(struct drm_i915_private *dev_priv)
 {
struct apertures_struct *ap;
@@ -668,12 +667,6 @@ static int i915_kick_out_firmware_fb(struct 
drm_i915_private *dev_priv)
 
return ret;
 }
-#else
-static int i915_kick_out_firmware_fb(struct drm_i915_private *dev_priv)
-{
-   return 0;
-}
-#endif
 
 #if !defined(CONFIG_VGA_CONSOLE)
 static int i915_kick_out_vgacon(struct drm_i915_private *dev_priv)
-- 
2.10.2

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [dim PATCH 2/2] dim: fetch drm-tip before rebuilding

2016-11-30 Thread Daniel Vetter
On Tue, Nov 29, 2016 at 06:17:16PM +0200, Jani Nikula wrote:
> Without this, my non-git-worktree setup will fail to push (or it takes
> forever) if the local drm-tip is not up to date.
> 
> Signed-off-by: Jani Nikula 

Ack. No idea why git is dense at this ...
-Daniel
> ---
>  dim | 6 ++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/dim b/dim
> index 562cbc64c93e..6371c95885a8 100755
> --- a/dim
> +++ b/dim
> @@ -424,6 +424,12 @@ function dim_rebuild_tip
>   exit 1
>   fi
>  
> + echo -n "Fetching drm-tip (local remote $remote)... "
> + remote=$(url_to_remote $drm_tip_ssh)
> + # git fetch returns 128 if there's nothing to be fetched
> + git fetch -q $remote || true
> + echo "Done."
> +
>   for repo in "${!drm_tip_repos[@]}"; do
>   url=${drm_tip_repos[$repo]}
>   remote=$(url_to_remote $url)
> -- 
> 2.1.4
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [dim PATCH 1/2] dim: fetch Linus' tree again on update-branches

2016-11-30 Thread Daniel Vetter
On Tue, Nov 29, 2016 at 06:17:15PM +0200, Jani Nikula wrote:
> Fixes: 6552af2d32c4 ("dim: fix update-branches to fetch all available nightly 
> repos")
> Cc: Archit Taneja 
> Signed-off-by: Jani Nikula 
> ---
>  dim | 8 
>  1 file changed, 8 insertions(+)
> 
> diff --git a/dim b/dim
> index 3dd2d1dec796..562cbc64c93e 100755
> --- a/dim
> +++ b/dim
> @@ -1255,6 +1255,14 @@ function dim_update_branches
>   local repo remote
>  
>   cd $DIM_PREFIX/$DIM_DRM_INTEL
> +
> + if remote=$(url_to_remote $linux_upstream_git 2>/dev/null); then

We still have a bunch of places where we hardcode origin for Linus' repo.
Might want to sed that at one point for consistency ...

But this here is acked.

> + echo -n "Fetching linux (local remote $remote)... "
> + # git fetch returns 128 if there's nothing to be fetched
> + git fetch -q $remote || true

Another idea: fetch_helper instead of the same 2 lines copypasted everywhere?
-Daniel

> + echo "Done."
> + fi
> +
>   for repo in "${!drm_tip_repos[@]}"; do
>   url=${drm_tip_repos[$repo]}
>   if ! remote=$(url_to_remote $url 2>/dev/null); then
> -- 
> 2.1.4
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH v3] Idleness DRRS test

2016-11-30 Thread Daniel Vetter
On Tue, Nov 29, 2016 at 03:06:17PM +0530, Nautiyal, Ankit K wrote:
> As per discussion with Chris, on IRC following were the suggestions :
> 
> - Chris has suggested an event based approach to avoid using pthreads.
> 
> - Avoid using kernel-specific info like transitional delays and instead use
> either polling or wait-for-event approach. Need to focus on user-observable
> behavior rather than the kernel standpoint.
> 
> - Check for transition latency is unnecessary in this test, as this is more
> of a performance/power benchmark.
> 
> 
> I will try the event based mechanism to do away with pthreads, and
> incorporate these suggestions in the next patch-set.

Again, why is kms_frontbuffer_tracking not considered? Reinventing wheels
is not good, and kms_frontbuffer_tracking implements all of the above
stuff afaik.
-Daniel

> 
> -Ankit
> 
> 
> On 11/15/2016 2:28 PM, Daniel Vetter wrote:
> > On Mon, Nov 14, 2016 at 01:06:09PM +, Chris Wilson wrote:
> > > On Mon, Nov 14, 2016 at 02:44:35PM +0200, Petri Latvala wrote:
> > > > Chris, happy with this revision?
> > > Me? No. It still uses a thread instead of events, so I don't think it
> > > qualifies as a good example for anyone else wanting to do the same thing.
> > > Lots of hardcoded expectations (specific sleep patterns, rather than
> > > waiting for the kernel to change with a timeout for failure). It doesn't
> > > check all the possible ways that the output maybe changed (and if they
> > > are irrelevent, that too also needs to be tested to establish expected
> > > behaviour and catch future regressions). Important question, how is
> > > userspace expected to know that the vrefresh changed? How do get around
> > > that userspace is expecting a fixed vblank frequency?
> > for display power testing we already have the kms_frontbuffer_tracking
> > testcase, adding a DRRS variants to that one should resolve all this.
> > 
> > And then kms_drrs would be empty, except when we (if ever) do explicit
> > drrs through modeset requests. And that would just be checking that the
> > observed timings match the requested timings.
> > -Daniel
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


  1   2   >