[Bug 102655] [CI][HSW] igt@gem_flink_race@flink_close - Failed assertion: obj_count == 0

2017-10-12 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=102655

--- Comment #4 from Marta Löfstedt  ---
Also, CI_DRM_3223 HSW-shards 

(prime_self_import:1525) CRITICAL: Test assertion failure function
test_export_close_race, file prime_self_import.c:363:
(prime_self_import:1525) CRITICAL: Failed assertion: obj_count == 0
(prime_self_import:1525) CRITICAL: Last errno: 9, Bad file descriptor
(prime_self_import:1525) CRITICAL: error: -32 != 0
Subtest export-vs-gem_close-race failed.

https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_3223/shard-hsw4/igt@prime_self_import@export-vs-gem_close-race.html

and: 
https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_339/shard-hsw3/igt@prime_self_import@export-vs-gem_close-race.html

-- 
You are receiving this mail because:
You are the assignee for the bug.___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [Outreachy kernel] [PATCH] drm: Replace kzalloc with kcalloc

2017-10-12 Thread Julia Lawall


On Fri, 13 Oct 2017, Harsha Sharma wrote:

> Prefer kcalloc over kzalloc to allocate an array.
> This patch fixes checkcpatch issue.
>
> Signed-off-by: Harsha Sharma 
> ---
>  drivers/gpu/drm/drm_crtc_helper.c  | 4 ++--
>  drivers/gpu/drm/drm_fb_helper.c| 2 +-
>  drivers/gpu/drm/drm_plane_helper.c | 2 +-
>  3 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_crtc_helper.c 
> b/drivers/gpu/drm/drm_crtc_helper.c
> index eab36a460638..ceb131637e2f 100644
> --- a/drivers/gpu/drm/drm_crtc_helper.c
> +++ b/drivers/gpu/drm/drm_crtc_helper.c
> @@ -562,12 +562,12 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set,
>* Allocate space for the backup of all (non-pointer) encoder and
>* connector data.
>*/
> - save_encoder_crtcs = kzalloc(dev->mode_config.num_encoder *
> + save_encoder_crtcs = kcalloc(dev->mode_config.num_encoder *
>   sizeof(struct drm_crtc *), GFP_KERNEL);

Doesn't kcalloc take 3 arguments?  You need to compile the code and check
that you have obtained a .o file for the file you modified.

julia

>   if (!save_encoder_crtcs)
>   return -ENOMEM;
>
> - save_connector_encoders = kzalloc(dev->mode_config.num_connector *
> + save_connector_encoders = kcalloc(dev->mode_config.num_connector *
>   sizeof(struct drm_encoder *), GFP_KERNEL);
>   if (!save_connector_encoders) {
>   kfree(save_encoder_crtcs);
> diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
> index 1b8f013ffa65..68d197df89fd 100644
> --- a/drivers/gpu/drm/drm_fb_helper.c
> +++ b/drivers/gpu/drm/drm_fb_helper.c
> @@ -2266,7 +2266,7 @@ static int drm_pick_crtcs(struct drm_fb_helper 
> *fb_helper,
>   if (modes[n] == NULL)
>   return best_score;
>
> - crtcs = kzalloc(fb_helper->connector_count *
> + crtcs = kcalloc(fb_helper->connector_count *
>   sizeof(struct drm_fb_helper_crtc *), GFP_KERNEL);
>   if (!crtcs)
>   return best_score;
> diff --git a/drivers/gpu/drm/drm_plane_helper.c 
> b/drivers/gpu/drm/drm_plane_helper.c
> index 06aee1741e96..74054653530e 100644
> --- a/drivers/gpu/drm/drm_plane_helper.c
> +++ b/drivers/gpu/drm/drm_plane_helper.c
> @@ -354,7 +354,7 @@ int drm_primary_helper_update(struct drm_plane *plane, 
> struct drm_crtc *crtc,
>   /* Find current connectors for CRTC */
>   num_connectors = get_connectors_for_crtc(crtc, NULL, 0);
>   BUG_ON(num_connectors == 0);
> - connector_list = kzalloc(num_connectors * sizeof(*connector_list),
> + connector_list = kcalloc(num_connectors * sizeof(*connector_list),
>GFP_KERNEL);
>   if (!connector_list)
>   return -ENOMEM;
> --
> 2.11.0
>
> --
> You received this message because you are subscribed to the Google Groups 
> "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to outreachy-kernel+unsubscr...@googlegroups.com.
> To post to this group, send email to outreachy-ker...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/outreachy-kernel/20171012221758.512-1-harshasharmaiitr%40gmail.com.
> For more options, visit https://groups.google.com/d/optout.
>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v2 2/2] vgaarb: Factor out EFI and fallback default device selection

2017-10-12 Thread Bjorn Helgaas
The default VGA device is normally set in vga_arbiter_add_pci_device() when
we call it for the first enabled device that can be accessed with the
legacy VGA resources ([mem 0xa-0xb], etc.)

That default device can be overridden by an EFI device that owns the boot
framebuffer.  As a fallback, we can also select a VGA device that can't be
accessed via legacy VGA resources, or a VGA device that isn't even enabled.

Factor out this EFI and fallback selection from vga_arb_device_init() into
a separate vga_arb_select_default_device() function.  This doesn't change
any behavior, but it untangles the "bridge control possible" checking and
messages from the default device selection.

Tested-by: Zhou Wang   # D05 Hisi Hip07, Hip08
Signed-off-by: Bjorn Helgaas 
---
 drivers/gpu/vga/vgaarb.c |   57 --
 1 file changed, 35 insertions(+), 22 deletions(-)

diff --git a/drivers/gpu/vga/vgaarb.c b/drivers/gpu/vga/vgaarb.c
index 8035e38d5110..d35d6d271f3f 100644
--- a/drivers/gpu/vga/vgaarb.c
+++ b/drivers/gpu/vga/vgaarb.c
@@ -1402,29 +1402,14 @@ static struct miscdevice vga_arb_device = {
MISC_DYNAMIC_MINOR, "vga_arbiter", _arb_device_fops
 };
 
-static int __init vga_arb_device_init(void)
+static void __init vga_arb_select_default_device(void)
 {
-   int rc;
struct pci_dev *pdev;
struct vga_device *vgadev;
 
-   rc = misc_register(_arb_device);
-   if (rc < 0)
-   pr_err("error %d registering device\n", rc);
-
-   bus_register_notifier(_bus_type, _notifier);
-
-   /* We add all pci devices satisfying vga class in the arbiter by
-* default */
-   pdev = NULL;
-   while ((pdev =
-   pci_get_subsys(PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
-  PCI_ANY_ID, pdev)) != NULL)
-   vga_arbiter_add_pci_device(pdev);
-
+#if defined(CONFIG_X86) || defined(CONFIG_IA64)
list_for_each_entry(vgadev, _list, list) {
struct device *dev = >pdev->dev;
-#if defined(CONFIG_X86) || defined(CONFIG_IA64)
/*
 * Override vga_arbiter_add_pci_device()'s I/O based detection
 * as it may take the wrong device (e.g. on Apple system under
@@ -1461,12 +1446,8 @@ static int __init vga_arb_device_init(void)
vgaarb_info(dev, "overriding boot device\n");
vga_set_default_device(vgadev->pdev);
}
-#endif
-   if (vgadev->bridge_has_one_vga)
-   vgaarb_info(dev, "bridge control possible\n");
-   else
-   vgaarb_info(dev, "no bridge control possible\n");
}
+#endif
 
if (!vga_default_device()) {
list_for_each_entry(vgadev, _list, list) {
@@ -1492,6 +1473,38 @@ static int __init vga_arb_device_init(void)
vga_set_default_device(vgadev->pdev);
}
}
+}
+
+static int __init vga_arb_device_init(void)
+{
+   int rc;
+   struct pci_dev *pdev;
+   struct vga_device *vgadev;
+
+   rc = misc_register(_arb_device);
+   if (rc < 0)
+   pr_err("error %d registering device\n", rc);
+
+   bus_register_notifier(_bus_type, _notifier);
+
+   /* We add all PCI devices satisfying VGA class in the arbiter by
+* default */
+   pdev = NULL;
+   while ((pdev =
+   pci_get_subsys(PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
+  PCI_ANY_ID, pdev)) != NULL)
+   vga_arbiter_add_pci_device(pdev);
+
+   list_for_each_entry(vgadev, _list, list) {
+   struct device *dev = >pdev->dev;
+
+   if (vgadev->bridge_has_one_vga)
+   vgaarb_info(dev, "bridge control possible\n");
+   else
+   vgaarb_info(dev, "no bridge control possible\n");
+   }
+
+   vga_arb_select_default_device();
 
pr_info("loaded\n");
return rc;

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v2 1/2] vgaarb: Select a default VGA device even if there's no legacy VGA

2017-10-12 Thread Bjorn Helgaas
Daniel Axtens reported that on the HiSilicon D05 board, the VGA device is
behind a bridge that doesn't support PCI_BRIDGE_CTL_VGA, so the VGA arbiter
never selects it as the default, which means Xorg auto-detection doesn't
work.

VGA is a legacy PCI feature: a VGA device can respond to addresses, e.g.,
[mem 0xa-0xb], [io 0x3b0-0x3bb], [io 0x3c0-0x3df], etc., that are
not configurable by BARs.  Consequently, multiple VGA devices can conflict
with each other.  The VGA arbiter avoids conflicts by ensuring that those
legacy resources are only routed to one VGA device at a time.

The arbiter identifies the "default VGA" device, i.e., a legacy VGA device
that was used by boot firmware.  It selects the first device that:

  - is of PCI_CLASS_DISPLAY_VGA,
  - has both PCI_COMMAND_IO and PCI_COMMAND_MEMORY enabled, and
  - has PCI_BRIDGE_CTL_VGA set in all upstream bridges.

Some systems don't have such a device.  For example, if a host bridge
doesn't support I/O space, PCI_COMMAND_IO probably won't be enabled for any
devices below it.  Or, as on the HiSilicon D05, the VGA device may be
behind a bridge that doesn't support PCI_BRIDGE_CTL_VGA, so accesses to the
legacy VGA resources will never reach the device.

This patch extends the arbiter so that if it doesn't find a device that
meets all the above criteria, it selects the first device that:

  - is of PCI_CLASS_DISPLAY_VGA and
  - has PCI_COMMAND_IO or PCI_COMMAND_MEMORY enabled

If it doesn't find even that, it selects the first device that:

  - is of class PCI_CLASS_DISPLAY_VGA.

Such a device may not be able to use the legacy VGA resources, but most
drivers can operate the device without those.  Setting it as the default
device means its "boot_vga" sysfs file will contain "1", which Xorg (via
libpciaccess) uses to help select its default output device.

This fixes Xorg auto-detection on some arm64 systems (HiSilicon D05 in
particular; see the link below).

It also replaces the powerpc fixup_vga() quirk, albeit with slightly
different semantics: the quirk selected the first VGA device we found, and
overrode that selection with any enabled VGA device we found.  If there
were several enabled VGA devices, the *last* one we found would become the
default.

The code here instead selects the *first* enabled VGA device we find, and
if none are enabled, the first VGA device we find.

Link: http://lkml.kernel.org/r/20170901072744.2409-1-...@axtens.net
Tested-by: Daniel Axtens    # arm64, ppc64-qemu-tcg
Tested-by: Zhou Wang   # D05 Hisi Hip07, Hip08
Signed-off-by: Bjorn Helgaas 
---
 arch/powerpc/kernel/pci-common.c |   12 
 drivers/gpu/vga/vgaarb.c |   25 +
 2 files changed, 25 insertions(+), 12 deletions(-)

diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index 02831a396419..0ac7aa346c69 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -1740,15 +1740,3 @@ static void fixup_hide_host_resource_fsl(struct pci_dev 
*dev)
 }
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MOTOROLA, PCI_ANY_ID, 
fixup_hide_host_resource_fsl);
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_FREESCALE, PCI_ANY_ID, 
fixup_hide_host_resource_fsl);
-
-static void fixup_vga(struct pci_dev *pdev)
-{
-   u16 cmd;
-
-   pci_read_config_word(pdev, PCI_COMMAND, );
-   if ((cmd & (PCI_COMMAND_IO | PCI_COMMAND_MEMORY)) || 
!vga_default_device())
-   vga_set_default_device(pdev);
-
-}
-DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_ANY_ID, PCI_ANY_ID,
- PCI_CLASS_DISPLAY_VGA, 8, fixup_vga);
diff --git a/drivers/gpu/vga/vgaarb.c b/drivers/gpu/vga/vgaarb.c
index 76875f6299b8..8035e38d5110 100644
--- a/drivers/gpu/vga/vgaarb.c
+++ b/drivers/gpu/vga/vgaarb.c
@@ -1468,6 +1468,31 @@ static int __init vga_arb_device_init(void)
vgaarb_info(dev, "no bridge control possible\n");
}
 
+   if (!vga_default_device()) {
+   list_for_each_entry(vgadev, _list, list) {
+   struct device *dev = >pdev->dev;
+   u16 cmd;
+
+   pdev = vgadev->pdev;
+   pci_read_config_word(pdev, PCI_COMMAND, );
+   if (cmd & (PCI_COMMAND_IO | PCI_COMMAND_MEMORY)) {
+   vgaarb_info(dev, "setting as boot device (VGA 
legacy resources not available)\n");
+   vga_set_default_device(pdev);
+   break;
+   }
+   }
+   }
+
+   if (!vga_default_device()) {
+   vgadev = list_first_entry_or_null(_list,
+ struct vga_device, list);
+   if (vgadev) {
+   struct device *dev = >pdev->dev;
+   vgaarb_info(dev, "setting as boot device (VGA legacy 
resources not 

[PATCH v2 0/2] vgaarb: Select fallback default VGA device

2017-10-12 Thread Bjorn Helgaas
These patches are supposed to fix a problem Daniel Axtens found on the
HiSilicon D05 board.  The VGA device there is behind a bridge that doesn't
support PCI_BRIDGE_CTL_VGA, so the arbiter never selects the device as the
default.

The first patch extends the arbiter so that if it can't find an enabled VGA
device with legacy resources, it selects the first enabled device *without*
legacy resources (this is what fixes the D05).  If that fails, it selects
the first device that isn't enabled.  The combination of both changes
should make the current powerpc fixup_vga() quirk unnecessary.

N.B. It changes the powerpc behavior: if there are several enabled VGA
devices, the current quirk selects the last one, while this patch selects
the first one.  If this is a problem, I can drop that part of the patch and
keep the quirk.

The second patch pulls out this fallback device detection (and the EFI
override) from vga_arb_device_init() to make it easier to read.

Changes in v2:
  - set default device to vgadev->pdev instead of the pdev left over from a
previous iteration through the list (thanks to Julien Thierry)

  - added "Tested-by: Zhou Wang" (I'm pretty sure the change above doesn't
invalidate this testing)

---

Bjorn Helgaas (2):
  vgaarb: Select a default VGA device even if there's no legacy VGA
  vgaarb: Factor out EFI and fallback default device selection


 arch/powerpc/kernel/pci-common.c |   12 --
 drivers/gpu/vga/vgaarb.c |   72 +-
 2 files changed, 55 insertions(+), 29 deletions(-)
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v3] drm: drm_vblank_cleanup: WARN when refcount > 0

2017-10-12 Thread PrasannaKumar Muralidharan
Hi,

On 13 October 2017 at 08:58, PrasannaKumar Muralidharan
 wrote:
> Warn when refcount > 0 in drm_vblank_cleanup.
>
> Signed-off-by: PrasannaKumar Muralidharan 
> ---
>  drivers/gpu/drm/drm_vblank.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
> index 70f2b95..3e61aeb 100644
> --- a/drivers/gpu/drm/drm_vblank.c
> +++ b/drivers/gpu/drm/drm_vblank.c
> @@ -405,6 +405,8 @@ void drm_vblank_cleanup(struct drm_device *dev)
> for (pipe = 0; pipe < dev->num_crtcs; pipe++) {
> struct drm_vblank_crtc *vblank = >vblank[pipe];
>
> +   WARN_ON(atomic_read(>refcount) > 0);
> +
> WARN_ON(READ_ONCE(vblank->enabled) &&
> drm_core_check_feature(dev, DRIVER_MODESET));
>
> --
> 2.10.0
>

Looking at the CI logs, realised that the patch I used for testing had
a problem. I used drm_crtc_vblank_put instead of drm_crtc_vblank_get.
I do see that the warning is generated but I am wondering whether it
is correct.

If it is not correct I will resend corrected test patch. Please let me know.

Thanks,
PrasannaKumar
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v3] drm: drm_vblank_cleanup: WARN when refcount > 0

2017-10-12 Thread PrasannaKumar Muralidharan
Warn when refcount > 0 in drm_vblank_cleanup.

Signed-off-by: PrasannaKumar Muralidharan 
---
 drivers/gpu/drm/drm_vblank.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
index 70f2b95..3e61aeb 100644
--- a/drivers/gpu/drm/drm_vblank.c
+++ b/drivers/gpu/drm/drm_vblank.c
@@ -405,6 +405,8 @@ void drm_vblank_cleanup(struct drm_device *dev)
for (pipe = 0; pipe < dev->num_crtcs; pipe++) {
struct drm_vblank_crtc *vblank = >vblank[pipe];
 
+   WARN_ON(atomic_read(>refcount) > 0);
+
WARN_ON(READ_ONCE(vblank->enabled) &&
drm_core_check_feature(dev, DRIVER_MODESET));
 
-- 
2.10.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/rockchip: add PINCTRL dependency for LVDS

2017-10-12 Thread Mark yao

On 2017年10月05日 20:09, Arnd Bergmann wrote:

The new driver fails to build when CONFIG_PINCTRL is disabled:

drivers/gpu/drm/rockchip/rockchip_lvds.c: In function 
'rockchip_lvds_grf_config':
drivers/gpu/drm/rockchip/rockchip_lvds.c:229:39: error: dereferencing pointer 
to incomplete type 'struct dev_pin_info'
if (lvds->pins && !IS_ERR(lvds->pins->default_state))

This adds the respective Kconfig dependency.

Fixes: 34cc0aa25456 ("drm/rockchip: Add support for Rockchip Soc LVDS")
Signed-off-by: Arnd Bergmann 


Pushed to drm-misc-next

Thanks
Mark

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[radeon-alex:drm-next-4.15-wip 32/47] drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c:335:20: error: dereferencing pointer to incomplete type

2017-10-12 Thread kbuild test robot
tree:   git://people.freedesktop.org/~agd5f/linux.git drm-next-4.15-wip
head:   1dffdb582aecb97a50f6a7feeb58f23488cd7ed6
commit: 6b3dbb0ca422ae70e4c6d8fd273d5007026b [32/47] drm/amdgpu: SR-IOV 
data exchange between PF
config: i386-randconfig-i0-201741 (attached as .config)
compiler: gcc-4.8 (Debian 4.8.4-1) 4.8.4
reproduce:
git checkout 6b3dbb0ca422ae70e4c6d8fd273d5007026b
# save the attached .config to linux build tree
make ARCH=i386 

All errors (new ones prefixed by >>):

   drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c: In function 
'amdgpu_virt_init_data_exchange':
>> drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c:335:20: error: dereferencing 
>> pointer to incomplete type
if (THIS_MODULE->version != NULL)
   ^
   drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c:336:29: error: dereferencing 
pointer to incomplete type
 strcpy(str, THIS_MODULE->version);
^

vim +335 drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c

   298  
   299  void amdgpu_virt_init_data_exchange(struct amdgpu_device *adev)
   300  {
   301  uint32_t pf2vf_ver = 0;
   302  uint32_t pf2vf_size = 0;
   303  uint32_t checksum = 0;
   304  uint32_t checkval;
   305  char *str;
   306  
   307  adev->virt.fw_reserve.p_pf2vf = NULL;
   308  adev->virt.fw_reserve.p_vf2pf = NULL;
   309  
   310  if (adev->fw_vram_usage.va != NULL) {
   311  adev->virt.fw_reserve.p_pf2vf =
   312  (struct amdgim_pf2vf_info_header *)(
   313  adev->fw_vram_usage.va + 
AMDGIM_DATAEXCHANGE_OFFSET);
   314  pf2vf_ver = adev->virt.fw_reserve.p_pf2vf->version;
   315  AMDGPU_FW_VRAM_PF2VF_READ(adev, header.size, 
_size);
   316  AMDGPU_FW_VRAM_PF2VF_READ(adev, checksum, );
   317  
   318  /* pf2vf message must be in 4K */
   319  if (pf2vf_size > 0 && pf2vf_size < 4096) {
   320  checkval = amdgpu_virt_fw_reserve_get_checksum(
   321  adev->virt.fw_reserve.p_pf2vf, 
pf2vf_size,
   322  adev->virt.fw_reserve.checksum_key, 
checksum);
   323  if (checkval == checksum) {
   324  adev->virt.fw_reserve.p_vf2pf =
   325  ((void 
*)adev->virt.fw_reserve.p_pf2vf +
   326  pf2vf_size);
   327  memset((void 
*)adev->virt.fw_reserve.p_vf2pf, 0,
   328  sizeof(amdgim_vf2pf_info));
   329  AMDGPU_FW_VRAM_VF2PF_WRITE(adev, 
header.version,
   330  AMDGPU_FW_VRAM_VF2PF_VER);
   331  AMDGPU_FW_VRAM_VF2PF_WRITE(adev, 
header.size,
   332  sizeof(amdgim_vf2pf_info));
   333  AMDGPU_FW_VRAM_VF2PF_READ(adev, 
driver_version,
   334  );
 > 335  if (THIS_MODULE->version != NULL)
   336  strcpy(str, 
THIS_MODULE->version);
   337  else
   338  strcpy(str, "N/A");
   339  AMDGPU_FW_VRAM_VF2PF_WRITE(adev, 
driver_cert,
   340  0);
   341  AMDGPU_FW_VRAM_VF2PF_WRITE(adev, 
checksum,
   342  
amdgpu_virt_fw_reserve_get_checksum(
   343  adev->virt.fw_reserve.p_vf2pf,
   344  pf2vf_size,
   345  
adev->virt.fw_reserve.checksum_key, 0));
   346  }
   347  }
   348  }
   349  }
   350  

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v2 1/3] drm: Extract drm_debug.[hc]

2017-10-12 Thread kbuild test robot
Hi Haneen,

[auto build test WARNING on drm/drm-next]
[also build test WARNING on v4.14-rc4 next-20171009]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Haneen-Mohammed/drm-Move-debug-macros-out-of-drmP-h/20171013-055510
base:   git://people.freedesktop.org/~airlied/linux.git drm-next
config: i386-randconfig-c0-10130904 (attached as .config)
compiler: gcc-4.9 (Debian 4.9.4-2) 4.9.4
reproduce:
# save the attached .config to linux build tree
make ARCH=i386 

All warnings (new ones prefixed by >>):

   In file included from drivers/gpu/drm/drm_debug.c:27:0:
>> include/drm/drm_debug.h:40:7: warning: 'struct device' declared inside 
>> parameter list
  const char *prefix, const char *format, ...);
  ^
>> include/drm/drm_debug.h:40:7: warning: its scope is only this definition or 
>> declaration, which is probably not what you want
   drivers/gpu/drm/drm_debug.c:32:6: error: conflicting types for 
'drm_dev_printk'
void drm_dev_printk(const struct device *dev, const char *level,
 ^
   In file included from drivers/gpu/drm/drm_debug.c:27:0:
   include/drm/drm_debug.h:38:6: note: previous declaration of 'drm_dev_printk' 
was here
void drm_dev_printk(const struct device *dev, const char *level,
 ^
--
   In file included from drivers/gpu//drm/drm_debug.c:27:0:
>> include/drm/drm_debug.h:40:7: warning: 'struct device' declared inside 
>> parameter list
  const char *prefix, const char *format, ...);
  ^
>> include/drm/drm_debug.h:40:7: warning: its scope is only this definition or 
>> declaration, which is probably not what you want
   drivers/gpu//drm/drm_debug.c:32:6: error: conflicting types for 
'drm_dev_printk'
void drm_dev_printk(const struct device *dev, const char *level,
 ^
   In file included from drivers/gpu//drm/drm_debug.c:27:0:
   include/drm/drm_debug.h:38:6: note: previous declaration of 'drm_dev_printk' 
was here
void drm_dev_printk(const struct device *dev, const char *level,
 ^

vim +40 include/drm/drm_debug.h

36  
37  __printf(6, 7)
38  void drm_dev_printk(const struct device *dev, const char *level,
39  unsigned int category, const char *function_name,
  > 40  const char *prefix, const char *format, ...);
41  __printf(3, 4)
42  void drm_printk(const char *level, unsigned int category,
43  const char *format, ...);
44  

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 0/5]: drm: Add drm mode object leases

2017-10-12 Thread Keith Packard
New since last time:

 * Don't lease encoders
 * Do lease planes
 * Automatically lease primary and cursor planes for
   apps which don't set universal_planes
 * Restrict leases to only contain objects which
   are actually leasable (connectors, crtcs and planes)
 * Drop the patch which changes permissions on get resources
   ioctls

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 2/5] drm: Add new LEASE debug level

2017-10-12 Thread Keith Packard
Separate out lease debugging from the core.

Signed-off-by: Keith Packard 
---
 drivers/gpu/drm/drm_drv.c | 3 ++-
 include/drm/drmP.h| 4 
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index c0292e5d7281..a934fd5e7e55 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -57,7 +57,8 @@ MODULE_PARM_DESC(debug, "Enable debug output, where each bit 
enables a debug cat
 "\t\tBit 2 (0x04) will enable KMS messages (modesetting code)\n"
 "\t\tBit 3 (0x08) will enable PRIME messages (prime code)\n"
 "\t\tBit 4 (0x10) will enable ATOMIC messages (atomic code)\n"
-"\t\tBit 5 (0x20) will enable VBL messages (vblank code)");
+"\t\tBit 5 (0x20) will enable VBL messages (vblank code)\n"
+"\t\tBit 7 (0x80) will enable LEASE messages (leasing code)");
 module_param_named(debug, drm_debug, int, 0600);
 
 static DEFINE_SPINLOCK(drm_minor_lock);
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 7277783a4ff0..59be1232d005 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -136,6 +136,7 @@ struct pci_controller;
 #define DRM_UT_ATOMIC  0x10
 #define DRM_UT_VBL 0x20
 #define DRM_UT_STATE   0x40
+#define DRM_UT_LEASE   0x80
 
 /***/
 /** \name DRM template customization defaults */
@@ -250,6 +251,9 @@ struct pci_controller;
 #define DRM_DEBUG_VBL(fmt, ...)\
drm_printk(KERN_DEBUG, DRM_UT_VBL, fmt, ##__VA_ARGS__)
 
+#define DRM_DEBUG_LEASE(fmt, ...)  \
+   drm_printk(KERN_DEBUG, DRM_UT_LEASE, fmt, ##__VA_ARGS__)
+
 #define _DRM_DEV_DEFINE_DEBUG_RATELIMITED(dev, level, fmt, args...)\
 ({ \
static DEFINE_RATELIMIT_STATE(_rs,  \
-- 
2.15.0.rc0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 3/5] drm: Add drm_object lease infrastructure [v4]

2017-10-12 Thread Keith Packard
This provides new data structures to hold "lease" information about
drm mode setting objects, and provides for creating new drm_masters
which have access to a subset of the available drm resources.

An 'owner' is a drm_master which is not leasing the objects from
another drm_master, and hence 'owns' them.

A 'lessee' is a drm_master which is leasing objects from some other
drm_master. Each lessee holds the set of objects which it is leasing
from the lessor.

A 'lessor' is a drm_master which is leasing objects to another
drm_master. This is the same as the owner in the current code.

The set of objects any drm_master 'controls' is limited to the set of
objects it leases (for lessees) or all objects (for owners).

Objects not controlled by a drm_master cannot be modified through the
various state manipulating ioctls, and any state reported back to user
space will be edited to make them appear idle and/or unusable. For
instance, connectors always report 'disconnected', while encoders
report no possible crtcs or clones.

The full list of lessees leasing objects from an owner (either
directly, or indirectly through another lessee), can be searched from
an idr in the drm_master of the owner.

Changes for v2 as suggested by Daniel Vetter :

* Sub-leasing has been disabled.

* BUG_ON for lock checking replaced with lockdep_assert_held

* 'change' ioctl has been removed.

* Leased objects can always be controlled by the lessor; the
  'mask_lease' flag has been removed

* Checking for leased status has been simplified, replacing
  the drm_lease_check function with drm_lease_held.

Changes in v3, some suggested by Dave Airlie 

* Add revocation. This allows leases to be effectively revoked by
  removing all of the objects they have access to. The lease itself
  hangs around as it's hanging off a file.

* Free the leases IDR when the master is destroyed

* _drm_lease_held should look at lessees, not lessor

* Allow non-master files to check for lease status

Changes in v4, suggested by Dave Airlie 

* Formatting and whitespace changes

Signed-off-by: Keith Packard 
---
 drivers/gpu/drm/Makefile  |   2 +-
 drivers/gpu/drm/drm_auth.c|  29 +++-
 drivers/gpu/drm/drm_lease.c   | 339 ++
 include/drm/drm_auth.h|  20 +++
 include/drm/drm_lease.h   |  36 +
 include/drm/drm_mode_object.h |   1 +
 6 files changed, 425 insertions(+), 2 deletions(-)
 create mode 100644 drivers/gpu/drm/drm_lease.c
 create mode 100644 include/drm/drm_lease.h

diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
index a3fdc5a68dff..81ff79336623 100644
--- a/drivers/gpu/drm/Makefile
+++ b/drivers/gpu/drm/Makefile
@@ -17,7 +17,7 @@ drm-y   :=drm_auth.o drm_bufs.o drm_cache.o \
drm_encoder.o drm_mode_object.o drm_property.o \
drm_plane.o drm_color_mgmt.o drm_print.o \
drm_dumb_buffers.o drm_mode_config.o drm_vblank.o \
-   drm_syncobj.o
+   drm_syncobj.o drm_lease.o
 
 drm-$(CONFIG_DRM_LIB_RANDOM) += lib/drm_random.o
 drm-$(CONFIG_DRM_VM) += drm_vm.o
diff --git a/drivers/gpu/drm/drm_auth.c b/drivers/gpu/drm/drm_auth.c
index 7ff697389d74..541177c71d51 100644
--- a/drivers/gpu/drm/drm_auth.c
+++ b/drivers/gpu/drm/drm_auth.c
@@ -31,6 +31,7 @@
 #include 
 #include "drm_internal.h"
 #include "drm_legacy.h"
+#include 
 
 /**
  * DOC: master and authentication
@@ -93,7 +94,7 @@ int drm_authmagic(struct drm_device *dev, void *data,
return file ? 0 : -EINVAL;
 }
 
-static struct drm_master *drm_master_create(struct drm_device *dev)
+struct drm_master *drm_master_create(struct drm_device *dev)
 {
struct drm_master *master;
 
@@ -107,6 +108,14 @@ static struct drm_master *drm_master_create(struct 
drm_device *dev)
idr_init(>magic_map);
master->dev = dev;
 
+   /* initialize the tree of output resource lessees */
+   master->lessor = NULL;
+   master->lessee_id = 0;
+   INIT_LIST_HEAD(>lessees);
+   INIT_LIST_HEAD(>lessee_list);
+   idr_init(>leases);
+   idr_init(>lessee_idr);
+
return master;
 }
 
@@ -189,6 +198,12 @@ int drm_setmaster_ioctl(struct drm_device *dev, void *data,
goto out_unlock;
}
 
+   if (file_priv->master->lessor != NULL) {
+   DRM_DEBUG_LEASE("Attempt to set lessee %d as master\n", 
file_priv->master->lessee_id);
+   ret = -EINVAL;
+   goto out_unlock;
+   }
+
ret = drm_set_master(dev, file_priv, false);
 out_unlock:
mutex_unlock(>master_mutex);
@@ -270,6 +285,13 @@ void drm_master_release(struct drm_file *file_priv)
if (dev->master == file_priv->master)
drm_drop_master(dev, file_priv);
 out:
+   if (file_priv->is_master) {
+   /* Revoke any leases held by this or lessees, but only if
+* this is the 

[PATCH 4/5] drm: Check mode object lease status in all master ioctl paths [v3]

2017-10-12 Thread Keith Packard
Attempts to modify un-leased objects are rejected with an error.
Information returned about unleased objects is modified to make them
appear unusable and/or disconnected.

Changes for v2 as suggested by Daniel Vetter :

 * With the change in the __drm_mode_object_find API to pass the
   file_priv along, we can now centralize most of the lease-based
   access checks in that function.

 * A few places skip that API and require in-line checks.

Changes for v3 provided by Dave Airlie 

 * remove support for leasing encoders.
 * add support for leasing planes.

Signed-off-by: Keith Packard 
Signed-off-by: Dave Airlie 
---
 drivers/gpu/drm/drm_auth.c|  2 +-
 drivers/gpu/drm/drm_encoder.c |  5 +++--
 drivers/gpu/drm/drm_mode_config.c | 22 +-
 drivers/gpu/drm/drm_mode_object.c | 22 ++
 drivers/gpu/drm/drm_plane.c   | 18 +++---
 drivers/gpu/drm/drm_vblank.c  | 18 --
 include/drm/drm_lease.h   |  2 --
 7 files changed, 66 insertions(+), 23 deletions(-)

diff --git a/drivers/gpu/drm/drm_auth.c b/drivers/gpu/drm/drm_auth.c
index 541177c71d51..bab26b477738 100644
--- a/drivers/gpu/drm/drm_auth.c
+++ b/drivers/gpu/drm/drm_auth.c
@@ -310,7 +310,7 @@ void drm_master_release(struct drm_file *file_priv)
  */
 bool drm_is_current_master(struct drm_file *fpriv)
 {
-   return fpriv->is_master && fpriv->master == fpriv->minor->dev->master;
+   return fpriv->is_master && drm_lease_owner(fpriv->master) == 
fpriv->minor->dev->master;
 }
 EXPORT_SYMBOL(drm_is_current_master);
 
diff --git a/drivers/gpu/drm/drm_encoder.c b/drivers/gpu/drm/drm_encoder.c
index 43f644844b83..59e0ebe733f8 100644
--- a/drivers/gpu/drm/drm_encoder.c
+++ b/drivers/gpu/drm/drm_encoder.c
@@ -226,7 +226,7 @@ int drm_mode_getencoder(struct drm_device *dev, void *data,
 
drm_modeset_lock(>mode_config.connection_mutex, NULL);
crtc = drm_encoder_get_crtc(encoder);
-   if (crtc)
+   if (crtc && drm_lease_held(file_priv, crtc->base.id))
enc_resp->crtc_id = crtc->base.id;
else
enc_resp->crtc_id = 0;
@@ -234,7 +234,8 @@ int drm_mode_getencoder(struct drm_device *dev, void *data,
 
enc_resp->encoder_type = encoder->encoder_type;
enc_resp->encoder_id = encoder->base.id;
-   enc_resp->possible_crtcs = encoder->possible_crtcs;
+   enc_resp->possible_crtcs = drm_lease_filter_crtcs(file_priv,
+ 
encoder->possible_crtcs);
enc_resp->possible_clones = encoder->possible_clones;
 
return 0;
diff --git a/drivers/gpu/drm/drm_mode_config.c 
b/drivers/gpu/drm/drm_mode_config.c
index 919e78d45ab0..cda8bfab6d3b 100644
--- a/drivers/gpu/drm/drm_mode_config.c
+++ b/drivers/gpu/drm/drm_mode_config.c
@@ -122,10 +122,12 @@ int drm_mode_getresources(struct drm_device *dev, void 
*data,
count = 0;
crtc_id = u64_to_user_ptr(card_res->crtc_id_ptr);
drm_for_each_crtc(crtc, dev) {
-   if (count < card_res->count_crtcs &&
-   put_user(crtc->base.id, crtc_id + count))
-   return -EFAULT;
-   count++;
+   if (drm_lease_held(file_priv, crtc->base.id)) {
+   if (count < card_res->count_crtcs &&
+   put_user(crtc->base.id, crtc_id + count))
+   return -EFAULT;
+   count++;
+   }
}
card_res->count_crtcs = count;
 
@@ -143,12 +145,14 @@ int drm_mode_getresources(struct drm_device *dev, void 
*data,
count = 0;
connector_id = u64_to_user_ptr(card_res->connector_id_ptr);
drm_for_each_connector_iter(connector, _iter) {
-   if (count < card_res->count_connectors &&
-   put_user(connector->base.id, connector_id + count)) {
-   drm_connector_list_iter_end(_iter);
-   return -EFAULT;
+   if (drm_lease_held(file_priv, connector->base.id)) {
+   if (count < card_res->count_connectors &&
+   put_user(connector->base.id, connector_id + count)) 
{
+   drm_connector_list_iter_end(_iter);
+   return -EFAULT;
+   }
+   count++;
}
-   count++;
}
card_res->count_connectors = count;
drm_connector_list_iter_end(_iter);
diff --git a/drivers/gpu/drm/drm_mode_object.c 
b/drivers/gpu/drm/drm_mode_object.c
index 240a05d91a53..d1599f36b605 100644
--- a/drivers/gpu/drm/drm_mode_object.c
+++ b/drivers/gpu/drm/drm_mode_object.c
@@ -104,6 +104,25 @@ void drm_mode_object_unregister(struct drm_device *dev,
mutex_unlock(>mode_config.idr_mutex);
 }
 
+/**
+ * drm_lease_required - 

[PATCH 5/5] drm: Add four ioctls for managing drm mode object leases [v6]

2017-10-12 Thread Keith Packard
drm_mode_create_lease

Creates a lease for a list of drm mode objects, returning an
fd for the new drm_master and a 64-bit identifier for the lessee

drm_mode_list_lesees

List the identifiers of the lessees for a master file

drm_mode_get_lease

List the leased objects for a master file

drm_mode_revoke_lease

Erase the set of objects managed by a lease.

This should suffice to at least create and query leases.

Changes for v2 as suggested by Daniel Vetter :

 * query ioctls only query the master associated with
   the provided file.

 * 'mask_lease' value has been removed

 * change ioctl has been removed.

Changes for v3 suggested in part by Dave Airlie 

 * Add revoke ioctl.

Changes for v4 suggested by Dave Airlie 

 * Expand on the comment about the magic use of _lease_idr_object
 * Pad lease ioctl structures to align on 64-bit boundaries

Changes for v5 suggested by Dave Airlie 

 * Check for non-negative object_id in create_lease to avoid debug
   output from the kernel.

Changes for v5 provided by Dave Airlie 

 * For non-universal planes add primary/cursor planes to lease

   If we aren't exposing universal planes to this userspace client,
   and it requests a lease on a crtc, we should implicitly export the
   primary and cursor planes for the crtc.

   If the lessee doesn't request universal planes, it will just see
   the crtc, but if it does request them it will then see the plane
   objects as well.

   This also moves the object look ups earlier as a side effect, so
   we'd exit the ioctl quicker for non-existant objects.

 * Restrict leases to crtc/connector/planes.

   This only allows leasing for objects we wish to allow.

Signed-off-by: Keith Packard 
Signed-off-by: Dave Airlie 
---
 drivers/gpu/drm/drm_ioctl.c   |   4 +
 drivers/gpu/drm/drm_lease.c   | 318 ++
 drivers/gpu/drm/drm_mode_object.c |   5 +-
 include/drm/drm_lease.h   |  12 ++
 include/drm/drm_mode_object.h |   2 +
 include/uapi/drm/drm.h|   5 +
 include/uapi/drm/drm_mode.h   |  66 
 7 files changed, 410 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c
index 9c435a4c0c82..4aafe4802099 100644
--- a/drivers/gpu/drm/drm_ioctl.c
+++ b/drivers/gpu/drm/drm_ioctl.c
@@ -665,6 +665,10 @@ static const struct drm_ioctl_desc drm_ioctls[] = {
  DRM_UNLOCKED|DRM_RENDER_ALLOW),
DRM_IOCTL_DEF(DRM_IOCTL_CRTC_GET_SEQUENCE, drm_crtc_get_sequence_ioctl, 
DRM_UNLOCKED),
DRM_IOCTL_DEF(DRM_IOCTL_CRTC_QUEUE_SEQUENCE, 
drm_crtc_queue_sequence_ioctl, DRM_UNLOCKED),
+   DRM_IOCTL_DEF(DRM_IOCTL_MODE_CREATE_LEASE, drm_mode_create_lease_ioctl, 
DRM_MASTER|DRM_CONTROL_ALLOW|DRM_UNLOCKED),
+   DRM_IOCTL_DEF(DRM_IOCTL_MODE_LIST_LESSEES, drm_mode_list_lessees_ioctl, 
DRM_MASTER|DRM_CONTROL_ALLOW|DRM_UNLOCKED),
+   DRM_IOCTL_DEF(DRM_IOCTL_MODE_GET_LEASE, drm_mode_get_lease_ioctl, 
DRM_MASTER|DRM_CONTROL_ALLOW|DRM_UNLOCKED),
+   DRM_IOCTL_DEF(DRM_IOCTL_MODE_REVOKE_LEASE, drm_mode_revoke_lease_ioctl, 
DRM_MASTER|DRM_CONTROL_ALLOW|DRM_UNLOCKED),
 };
 
 #define DRM_CORE_IOCTL_COUNT   ARRAY_SIZE( drm_ioctls )
diff --git a/drivers/gpu/drm/drm_lease.c b/drivers/gpu/drm/drm_lease.c
index 6c3f2445254c..88c213f9c4ab 100644
--- a/drivers/gpu/drm/drm_lease.c
+++ b/drivers/gpu/drm/drm_lease.c
@@ -23,6 +23,8 @@
 #define drm_for_each_lessee(lessee, lessor) \
list_for_each_entry((lessee), &(lessor)->lessees, lessee_list)
 
+static uint64_t drm_lease_idr_object;
+
 /**
  * drm_lease_owner - return ancestor owner drm_master
  * @master: drm_master somewhere within tree of lessees and lessors
@@ -337,3 +339,319 @@ void _drm_lease_revoke(struct drm_master *top)
}
}
 }
+
+/**
+ * drm_mode_create_lease_ioctl - create a new lease
+ * @dev: the drm device
+ * @data: pointer to struct drm_mode_create_lease
+ * @file_priv: the file being manipulated
+ *
+ * The master associated with the specified file will have a lease
+ * created containing the objects specified in the ioctl structure.
+ * A file descriptor will be allocated for that and returned to the
+ * application.
+ */
+int drm_mode_create_lease_ioctl(struct drm_device *dev,
+   void *data, struct drm_file *lessor_priv)
+{
+   struct drm_mode_create_lease *cl = data;
+   size_t object_count;
+   size_t o;
+   int ret = 0;
+   struct idr leases;
+   struct drm_master *lessor = lessor_priv->master;
+   struct drm_master *lessee = NULL;
+   struct file *lessee_file = NULL;
+   struct file *lessor_file = lessor_priv->filp;
+   struct drm_file *lessee_priv;
+   int fd = -1;
+
+   /* Do not allow sub-leases */
+   if (lessor->lessor)
+   return -EINVAL;

[PATCH 1/5] drm/plane: drop num_overlay_planes (v2)

2017-10-12 Thread Keith Packard
From: Dave Airlie 

In order to implement plane leasing we need to count things,
just make the code consistent with the counting code currently
used for counting crtcs/encoders/connectors and drop the need
for num_overlay_planes.

v2: don't forget to assign plane_ptr. (keithp)

Signed-off-by: Dave Airlie 
---
 drivers/gpu/drm/drm_mode_config.c |  1 -
 drivers/gpu/drm/drm_plane.c   | 46 ++-
 include/drm/drm_mode_config.h | 13 ---
 3 files changed, 16 insertions(+), 44 deletions(-)

diff --git a/drivers/gpu/drm/drm_mode_config.c 
b/drivers/gpu/drm/drm_mode_config.c
index 74f6ff5df656..919e78d45ab0 100644
--- a/drivers/gpu/drm/drm_mode_config.c
+++ b/drivers/gpu/drm/drm_mode_config.c
@@ -385,7 +385,6 @@ void drm_mode_config_init(struct drm_device *dev)
dev->mode_config.num_connector = 0;
dev->mode_config.num_crtc = 0;
dev->mode_config.num_encoder = 0;
-   dev->mode_config.num_overlay_plane = 0;
dev->mode_config.num_total_plane = 0;
 }
 EXPORT_SYMBOL(drm_mode_config_init);
diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
index 574fd1475214..c10869bad729 100644
--- a/drivers/gpu/drm/drm_plane.c
+++ b/drivers/gpu/drm/drm_plane.c
@@ -241,8 +241,6 @@ int drm_universal_plane_init(struct drm_device *dev, struct 
drm_plane *plane,
 
list_add_tail(>head, >plane_list);
plane->index = config->num_total_plane++;
-   if (plane->type == DRM_PLANE_TYPE_OVERLAY)
-   config->num_overlay_plane++;
 
drm_object_attach_property(>base,
   config->plane_type_property,
@@ -353,8 +351,6 @@ void drm_plane_cleanup(struct drm_plane *plane)
 
list_del(>head);
dev->mode_config.num_total_plane--;
-   if (plane->type == DRM_PLANE_TYPE_OVERLAY)
-   dev->mode_config.num_overlay_plane--;
 
WARN_ON(plane->state && !plane->funcs->atomic_destroy_state);
if (plane->state && plane->funcs->atomic_destroy_state)
@@ -462,43 +458,33 @@ int drm_mode_getplane_res(struct drm_device *dev, void 
*data,
struct drm_mode_config *config;
struct drm_plane *plane;
uint32_t __user *plane_ptr;
-   int copied = 0;
-   unsigned num_planes;
+   int count = 0;
 
if (!drm_core_check_feature(dev, DRIVER_MODESET))
return -EINVAL;
 
config = >mode_config;
-
-   if (file_priv->universal_planes)
-   num_planes = config->num_total_plane;
-   else
-   num_planes = config->num_overlay_plane;
+   plane_ptr = u64_to_user_ptr(plane_resp->plane_id_ptr);
 
/*
 * This ioctl is called twice, once to determine how much space is
 * needed, and the 2nd time to fill it.
 */
-   if (num_planes &&
-   (plane_resp->count_planes >= num_planes)) {
-   plane_ptr = (uint32_t __user *)(unsigned 
long)plane_resp->plane_id_ptr;
-
-   /* Plane lists are invariant, no locking needed. */
-   drm_for_each_plane(plane, dev) {
-   /*
-* Unless userspace set the 'universal planes'
-* capability bit, only advertise overlays.
-*/
-   if (plane->type != DRM_PLANE_TYPE_OVERLAY &&
-   !file_priv->universal_planes)
-   continue;
-
-   if (put_user(plane->base.id, plane_ptr + copied))
-   return -EFAULT;
-   copied++;
-   }
+   drm_for_each_plane(plane, dev) {
+   /*
+* Unless userspace set the 'universal planes'
+* capability bit, only advertise overlays.
+*/
+   if (plane->type != DRM_PLANE_TYPE_OVERLAY &&
+   !file_priv->universal_planes)
+   continue;
+
+   if (count < config->num_total_plane &&
+   put_user(plane->base.id, plane_ptr + count))
+   return -EFAULT;
+   count++;
}
-   plane_resp->count_planes = num_planes;
+   plane_resp->count_planes = count;
 
return 0;
 }
diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h
index 1b37368416c8..0b4ac2ebc610 100644
--- a/include/drm/drm_mode_config.h
+++ b/include/drm/drm_mode_config.h
@@ -429,19 +429,6 @@ struct drm_mode_config {
 */
struct list_head encoder_list;
 
-   /**
-* @num_overlay_plane:
-*
-* Number of overlay planes on this device, excluding primary and cursor
-* planes.
-*
-* Track number of overlay planes separately from number of total
-* planes.  By default we only advertise overlay planes to userspace; if
-* userspace sets the "universal plane" capability bit, 

[PATCH] drm/plane: drop num_overlay_planes (v2)

2017-10-12 Thread Dave Airlie
From: Dave Airlie 

In order to implement plane leasing we need to count things,
just make the code consistent with the counting code currently
used for counting crtcs/encoders/connectors and drop the need
for num_overlay_planes.

v2: don't forget to assign plane_ptr. (keithp)

Signed-off-by: Dave Airlie 
---
 drivers/gpu/drm/drm_mode_config.c |  1 -
 drivers/gpu/drm/drm_plane.c   | 46 ++-
 include/drm/drm_mode_config.h | 13 ---
 3 files changed, 16 insertions(+), 44 deletions(-)

diff --git a/drivers/gpu/drm/drm_mode_config.c 
b/drivers/gpu/drm/drm_mode_config.c
index fad6646b38d3..0e6c8ae309b0 100644
--- a/drivers/gpu/drm/drm_mode_config.c
+++ b/drivers/gpu/drm/drm_mode_config.c
@@ -391,7 +391,6 @@ void drm_mode_config_init(struct drm_device *dev)
dev->mode_config.num_connector = 0;
dev->mode_config.num_crtc = 0;
dev->mode_config.num_encoder = 0;
-   dev->mode_config.num_overlay_plane = 0;
dev->mode_config.num_total_plane = 0;
 }
 EXPORT_SYMBOL(drm_mode_config_init);
diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
index e0bb14ad0312..665e4f87aa0c 100644
--- a/drivers/gpu/drm/drm_plane.c
+++ b/drivers/gpu/drm/drm_plane.c
@@ -241,8 +241,6 @@ int drm_universal_plane_init(struct drm_device *dev, struct 
drm_plane *plane,
 
list_add_tail(>head, >plane_list);
plane->index = config->num_total_plane++;
-   if (plane->type == DRM_PLANE_TYPE_OVERLAY)
-   config->num_overlay_plane++;
 
drm_object_attach_property(>base,
   config->plane_type_property,
@@ -353,8 +351,6 @@ void drm_plane_cleanup(struct drm_plane *plane)
 
list_del(>head);
dev->mode_config.num_total_plane--;
-   if (plane->type == DRM_PLANE_TYPE_OVERLAY)
-   dev->mode_config.num_overlay_plane--;
 
WARN_ON(plane->state && !plane->funcs->atomic_destroy_state);
if (plane->state && plane->funcs->atomic_destroy_state)
@@ -462,43 +458,33 @@ int drm_mode_getplane_res(struct drm_device *dev, void 
*data,
struct drm_mode_config *config;
struct drm_plane *plane;
uint32_t __user *plane_ptr;
-   int copied = 0;
-   unsigned num_planes;
+   int count = 0;
 
if (!drm_core_check_feature(dev, DRIVER_MODESET))
return -EINVAL;
 
config = >mode_config;
-
-   if (file_priv->universal_planes)
-   num_planes = config->num_total_plane;
-   else
-   num_planes = config->num_overlay_plane;
+   plane_ptr = u64_to_user_ptr(plane_resp->plane_id_ptr);
 
/*
 * This ioctl is called twice, once to determine how much space is
 * needed, and the 2nd time to fill it.
 */
-   if (num_planes &&
-   (plane_resp->count_planes >= num_planes)) {
-   plane_ptr = (uint32_t __user *)(unsigned 
long)plane_resp->plane_id_ptr;
-
-   /* Plane lists are invariant, no locking needed. */
-   drm_for_each_plane(plane, dev) {
-   /*
-* Unless userspace set the 'universal planes'
-* capability bit, only advertise overlays.
-*/
-   if (plane->type != DRM_PLANE_TYPE_OVERLAY &&
-   !file_priv->universal_planes)
-   continue;
-
-   if (put_user(plane->base.id, plane_ptr + copied))
-   return -EFAULT;
-   copied++;
-   }
+   drm_for_each_plane(plane, dev) {
+   /*
+* Unless userspace set the 'universal planes'
+* capability bit, only advertise overlays.
+*/
+   if (plane->type != DRM_PLANE_TYPE_OVERLAY &&
+   !file_priv->universal_planes)
+   continue;
+
+   if (count < config->num_total_plane &&
+   put_user(plane->base.id, plane_ptr + count))
+   return -EFAULT;
+   count++;
}
-   plane_resp->count_planes = num_planes;
+   plane_resp->count_planes = count;
 
return 0;
 }
diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h
index 1b37368416c8..0b4ac2ebc610 100644
--- a/include/drm/drm_mode_config.h
+++ b/include/drm/drm_mode_config.h
@@ -429,19 +429,6 @@ struct drm_mode_config {
 */
struct list_head encoder_list;
 
-   /**
-* @num_overlay_plane:
-*
-* Number of overlay planes on this device, excluding primary and cursor
-* planes.
-*
-* Track number of overlay planes separately from number of total
-* planes.  By default we only advertise overlay planes to userspace; if
-* userspace sets the "universal plane" capability bit, 

[PATCH 2/3] drm: Reorganize drm_pending_event to support future event types [v2]

2017-10-12 Thread Keith Packard
Place drm_event_vblank in a new union that includes that and a bare
drm_event structure. This will allow new members of that union to be
added in the future without changing code related to the existing vbl
event type.

Assignments to the crtc_id field are now done when the event is
allocated, rather than when delievered. This way, delivery doesn't
need to have the crtc ID available.

v2:
 * Remove 'dev' argument from create_vblank_event

It wasn't being used anyways, and if we need it in the future,
we can always get it from crtc->dev.

 * Check for MODESETTING before looking for crtc in queue_vblank_event

UMS drivers will oops if we try to get a crtc, so make sure
we're modesetting before we try to find a crtc_id to fill into
the event.

Signed-off-by: Keith Packard 
---
 drivers/gpu/drm/drm_atomic.c |  7 +++---
 drivers/gpu/drm/drm_plane.c  |  2 +-
 drivers/gpu/drm/drm_vblank.c | 41 +---
 drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c |  4 ++--
 drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c |  4 ++--
 include/drm/drm_vblank.h |  8 ++-
 6 files changed, 40 insertions(+), 26 deletions(-)

diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index 268969fecee7..1e2021bed265 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -1815,7 +1815,7 @@ int drm_atomic_debugfs_init(struct drm_minor *minor)
  */
 
 static struct drm_pending_vblank_event *create_vblank_event(
-   struct drm_device *dev, uint64_t user_data)
+   struct drm_crtc *crtc, uint64_t user_data)
 {
struct drm_pending_vblank_event *e = NULL;
 
@@ -1825,7 +1825,8 @@ static struct drm_pending_vblank_event 
*create_vblank_event(
 
e->event.base.type = DRM_EVENT_FLIP_COMPLETE;
e->event.base.length = sizeof(e->event);
-   e->event.user_data = user_data;
+   e->event.vbl.crtc_id = crtc->base.id;
+   e->event.vbl.user_data = user_data;
 
return e;
 }
@@ -2079,7 +2080,7 @@ static int prepare_crtc_signaling(struct drm_device *dev,
if (arg->flags & DRM_MODE_PAGE_FLIP_EVENT || fence_ptr) {
struct drm_pending_vblank_event *e;
 
-   e = create_vblank_event(dev, arg->user_data);
+   e = create_vblank_event(crtc, arg->user_data);
if (!e)
return -ENOMEM;
 
diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
index 6af02c7b5da3..574fd1475214 100644
--- a/drivers/gpu/drm/drm_plane.c
+++ b/drivers/gpu/drm/drm_plane.c
@@ -1039,7 +1039,7 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
}
e->event.base.type = DRM_EVENT_FLIP_COMPLETE;
e->event.base.length = sizeof(e->event);
-   e->event.user_data = page_flip->user_data;
+   e->event.vbl.user_data = page_flip->user_data;
ret = drm_event_reserve_init(dev, file_priv, >base, 
>event.base);
if (ret) {
kfree(e);
diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
index 47460589d4cd..d250606cc771 100644
--- a/drivers/gpu/drm/drm_vblank.c
+++ b/drivers/gpu/drm/drm_vblank.c
@@ -804,20 +804,23 @@ static void send_vblank_event(struct drm_device *dev,
struct drm_pending_vblank_event *e,
u64 seq, ktime_t now)
 {
-   struct timespec64 tv = ktime_to_timespec64(now);
-
-   e->event.sequence = seq;
-   /*
-* e->event is a user space structure, with hardcoded unsigned
-* 32-bit seconds/microseconds. This is safe as we always use
-* monotonic timestamps since linux-4.15
-*/
-   e->event.tv_sec = tv.tv_sec;
-   e->event.tv_usec = tv.tv_nsec / 1000;
-
-   trace_drm_vblank_event_delivered(e->base.file_priv, e->pipe,
-e->event.sequence);
+   struct timespec64 tv;
 
+   switch (e->event.base.type) {
+   case DRM_EVENT_VBLANK:
+   case DRM_EVENT_FLIP_COMPLETE:
+   tv = ktime_to_timespec64(now);
+   e->event.vbl.sequence = seq;
+   /*
+* e->event is a user space structure, with hardcoded unsigned
+* 32-bit seconds/microseconds. This is safe as we always use
+* monotonic timestamps since linux-4.15
+*/
+   e->event.vbl.tv_sec = tv.tv_sec;
+   e->event.vbl.tv_usec = tv.tv_nsec / 1000;
+   break;
+   }
+   trace_drm_vblank_event_delivered(e->base.file_priv, e->pipe, seq);
drm_send_event_locked(dev, >base);
 }
 
@@ -869,7 +872,6 @@ void drm_crtc_arm_vblank_event(struct drm_crtc *crtc,
 
e->pipe = pipe;
e->sequence = drm_vblank_count(dev, pipe);
-   e->event.crtc_id = crtc->base.id;

[PATCH 1/3] drm: Widen vblank count to 64-bits [v3]

2017-10-12 Thread Keith Packard
This modifies the datatypes used by the vblank code to provide 64 bits
of vblank count.

The driver interfaces have been left using 32 bits of vblank count;
all of the code necessary to widen that value for the user API was
already included to handle devices returning fewer than 32-bits.

This will provide the necessary datatypes for the Vulkan API.

v2:

 * Re-write wait_vblank ioctl to ABSOLUTE sequence

When an application uses the WAIT_VBLANK ioctl with RELATIVE
or NEXTONMISS bits set, the target vblank interval is updated
within the kernel. We need to write that target back to the
ioctl buffer and update the flags bits so that if the wait is
interrupted by a signal, when it is re-started, it will target
precisely the same vblank count as before.

 * Leave driver API with 32-bit vblank count

v3:

 * Rebase on top of Arnd Bergmann's patch which had
   the switch to ktime_t parts.

Suggested-by:  Michel Dänzer 
Suggested-by: Daniel Vetter 
Signed-off-by: Keith Packard 
---
 drivers/gpu/drm/drm_vblank.c | 104 +--
 include/drm/drm_vblank.h |  10 +++--
 2 files changed, 78 insertions(+), 36 deletions(-)

diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
index 810a93fc558b..47460589d4cd 100644
--- a/drivers/gpu/drm/drm_vblank.c
+++ b/drivers/gpu/drm/drm_vblank.c
@@ -251,7 +251,7 @@ static void drm_update_vblank_count(struct drm_device *dev, 
unsigned int pipe,
}
 
DRM_DEBUG_VBL("updating vblank count on crtc %u:"
- " current=%u, diff=%u, hw=%u hw_last=%u\n",
+ " current=%llu, diff=%u, hw=%u hw_last=%u\n",
  pipe, vblank->count, diff, cur_vblank, vblank->last);
 
if (diff == 0) {
@@ -740,17 +740,31 @@ drm_get_last_vbltimestamp(struct drm_device *dev, 
unsigned int pipe,
  * Returns:
  * The software vblank counter.
  */
-u32 drm_crtc_vblank_count(struct drm_crtc *crtc)
+u64 drm_crtc_vblank_count(struct drm_crtc *crtc)
 {
return drm_vblank_count(crtc->dev, drm_crtc_index(crtc));
 }
 EXPORT_SYMBOL(drm_crtc_vblank_count);
 
-static u32 drm_vblank_count_and_time(struct drm_device *dev, unsigned int pipe,
+/**
+ * drm_vblank_count_and_time - retrieve "cooked" vblank counter value and the
+ * system timestamp corresponding to that vblank counter value.
+ * @dev: DRM device
+ * @pipe: index of CRTC whose counter to retrieve
+ * @vblanktime: Pointer to ktime_t to receive the vblank timestamp.
+ *
+ * Fetches the "cooked" vblank count value that represents the number of
+ * vblank events since the system was booted, including lost events due to
+ * modesetting activity. Returns corresponding system timestamp of the time
+ * of the vblank interval that corresponds to the current vblank counter value.
+ *
+ * This is the legacy version of drm_crtc_vblank_count_and_time().
+ */
+static u64 drm_vblank_count_and_time(struct drm_device *dev, unsigned int pipe,
 ktime_t *vblanktime)
 {
struct drm_vblank_crtc *vblank = >vblank[pipe];
-   u32 vblank_count;
+   u64 vblank_count;
unsigned int seq;
 
if (WARN_ON(pipe >= dev->num_crtcs)) {
@@ -778,7 +792,7 @@ static u32 drm_vblank_count_and_time(struct drm_device 
*dev, unsigned int pipe,
  * modesetting activity. Returns corresponding system timestamp of the time
  * of the vblank interval that corresponds to the current vblank counter value.
  */
-u32 drm_crtc_vblank_count_and_time(struct drm_crtc *crtc,
+u64 drm_crtc_vblank_count_and_time(struct drm_crtc *crtc,
   ktime_t *vblanktime)
 {
return drm_vblank_count_and_time(crtc->dev, drm_crtc_index(crtc),
@@ -788,7 +802,7 @@ EXPORT_SYMBOL(drm_crtc_vblank_count_and_time);
 
 static void send_vblank_event(struct drm_device *dev,
struct drm_pending_vblank_event *e,
-   unsigned long seq, ktime_t now)
+   u64 seq, ktime_t now)
 {
struct timespec64 tv = ktime_to_timespec64(now);
 
@@ -854,7 +868,7 @@ void drm_crtc_arm_vblank_event(struct drm_crtc *crtc,
assert_spin_locked(>event_lock);
 
e->pipe = pipe;
-   e->event.sequence = drm_vblank_count(dev, pipe);
+   e->sequence = drm_vblank_count(dev, pipe);
e->event.crtc_id = crtc->base.id;
list_add_tail(>base.link, >vblank_event_list);
 }
@@ -875,7 +889,8 @@ void drm_crtc_send_vblank_event(struct drm_crtc *crtc,
struct drm_pending_vblank_event *e)
 {
struct drm_device *dev = crtc->dev;
-   unsigned int seq, pipe = drm_crtc_index(crtc);
+   u64 seq;
+   unsigned int pipe = drm_crtc_index(crtc);
ktime_t now;
 
if (dev->num_crtcs > 0) {
@@ -1088,7 +1103,7 @@ void drm_crtc_vblank_off(struct drm_crtc *crtc)
 
ktime_t now;
unsigned long irqflags;
-   unsigned int seq;
+   

[PATCH 0/3] drm: Add new vblank ioctls [v4]

2017-10-12 Thread Keith Packard
This series removes portions of the first patch which switched to
ktime_t as Arnd Bergmann posted a cleaner patch which did only
that. Otherwise, it's the same.

-keith

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 3/3] drm: Add CRTC_GET_SEQUENCE and CRTC_QUEUE_SEQUENCE ioctls [v3]

2017-10-12 Thread Keith Packard
These provide crtc-id based functions instead of pipe-number, while
also offering higher resolution time (ns) and wider frame count (64)
as required by the Vulkan API.

v2:

 * Check for DRIVER_MODESET in new crtc-based vblank ioctls

Failing to check this will oops the driver.

 * Ensure vblank interupt is running in crtc_get_sequence ioctl

The sequence and timing values are not correct while the
interrupt is off, so make sure it's running before asking for
them.

 * Short-circuit get_sequence if the counter is enabled and accurate

Steal the idea from the code in wait_vblank to avoid the
expense of drm_vblank_get/put

 * Return active state of crtc in crtc_get_sequence ioctl

Might be useful for applications that aren't in charge of
modesetting?

 * Use drm_crtc_vblank_get/put in new crtc-based vblank sequence ioctls

Daniel Vetter prefers these over the old drm_vblank_put/get
APIs.

 * Return s64 ns instead of u64 in new sequence event

Suggested-by: Daniel Vetter 
Suggested-by: Ville Syrjälä 

v3:

 * Removed FIRST_PIXEL_OUT_FLAG
 * Document that the timestamp in the query and event are
   that of the first pixel leaving the display engine for
   the display (using the same wording as the Vulkan spec).

Suggested-by: Michel Dänzer 
Acked-by: Dave Airlie 

Signed-off-by: Keith Packard 
---
 drivers/gpu/drm/drm_internal.h |   6 ++
 drivers/gpu/drm/drm_ioctl.c|   2 +
 drivers/gpu/drm/drm_vblank.c   | 168 +
 include/drm/drm_vblank.h   |   1 +
 include/uapi/drm/drm.h |  36 +
 5 files changed, 213 insertions(+)

diff --git a/drivers/gpu/drm/drm_internal.h b/drivers/gpu/drm/drm_internal.h
index edd921adcf33..c9d5a6cd4d41 100644
--- a/drivers/gpu/drm/drm_internal.h
+++ b/drivers/gpu/drm/drm_internal.h
@@ -70,6 +70,12 @@ int drm_legacy_modeset_ctl_ioctl(struct drm_device *dev, 
void *data,
 int drm_legacy_irq_control(struct drm_device *dev, void *data,
   struct drm_file *file_priv);
 
+int drm_crtc_get_sequence_ioctl(struct drm_device *dev, void *data,
+   struct drm_file *filp);
+
+int drm_crtc_queue_sequence_ioctl(struct drm_device *dev, void *data,
+ struct drm_file *filp);
+
 /* drm_auth.c */
 int drm_getmagic(struct drm_device *dev, void *data,
 struct drm_file *file_priv);
diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c
index a78f03155466..9c435a4c0c82 100644
--- a/drivers/gpu/drm/drm_ioctl.c
+++ b/drivers/gpu/drm/drm_ioctl.c
@@ -663,6 +663,8 @@ static const struct drm_ioctl_desc drm_ioctls[] = {
  DRM_UNLOCKED|DRM_RENDER_ALLOW),
DRM_IOCTL_DEF(DRM_IOCTL_SYNCOBJ_SIGNAL, drm_syncobj_signal_ioctl,
  DRM_UNLOCKED|DRM_RENDER_ALLOW),
+   DRM_IOCTL_DEF(DRM_IOCTL_CRTC_GET_SEQUENCE, drm_crtc_get_sequence_ioctl, 
DRM_UNLOCKED),
+   DRM_IOCTL_DEF(DRM_IOCTL_CRTC_QUEUE_SEQUENCE, 
drm_crtc_queue_sequence_ioctl, DRM_UNLOCKED),
 };
 
 #define DRM_CORE_IOCTL_COUNT   ARRAY_SIZE( drm_ioctls )
diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
index d250606cc771..deb080f62a29 100644
--- a/drivers/gpu/drm/drm_vblank.c
+++ b/drivers/gpu/drm/drm_vblank.c
@@ -819,6 +819,11 @@ static void send_vblank_event(struct drm_device *dev,
e->event.vbl.tv_sec = tv.tv_sec;
e->event.vbl.tv_usec = tv.tv_nsec / 1000;
break;
+   case DRM_EVENT_CRTC_SEQUENCE:
+   if (seq)
+   e->event.seq.sequence = seq;
+   e->event.seq.time_ns = ktime_to_ns(now);
+   break;
}
trace_drm_vblank_event_delivered(e->base.file_priv, e->pipe, seq);
drm_send_event_locked(dev, >base);
@@ -1650,3 +1655,166 @@ bool drm_crtc_handle_vblank(struct drm_crtc *crtc)
return drm_handle_vblank(crtc->dev, drm_crtc_index(crtc));
 }
 EXPORT_SYMBOL(drm_crtc_handle_vblank);
+
+/*
+ * Get crtc VBLANK count.
+ *
+ * \param dev DRM device
+ * \param data user arguement, pointing to a drm_crtc_get_sequence structure.
+ * \param file_priv drm file private for the user's open file descriptor
+ */
+
+int drm_crtc_get_sequence_ioctl(struct drm_device *dev, void *data,
+   struct drm_file *file_priv)
+{
+   struct drm_crtc *crtc;
+   struct drm_vblank_crtc *vblank;
+   int pipe;
+   struct drm_crtc_get_sequence *get_seq = data;
+   ktime_t now;
+   bool vblank_enabled;
+   int ret;
+
+   if (!drm_core_check_feature(dev, DRIVER_MODESET))
+   return -EINVAL;
+
+   if (!dev->irq_enabled)
+   return -EINVAL;
+
+   crtc = drm_crtc_find(dev, file_priv, get_seq->crtc_id);
+   if (!crtc)
+   return -ENOENT;
+
+  

Re: [PATCH 2/2] drm: Update old comment style

2017-10-12 Thread kbuild test robot
Hi Haneen,

[auto build test WARNING on drm/drm-next]
[also build test WARNING on v4.14-rc4 next-20171009]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Haneen-Mohammed/drm-Extract-drm_debug-hc/20171013-052937
base:   git://people.freedesktop.org/~airlied/linux.git drm-next
reproduce: make htmldocs

All warnings (new ones prefixed by >>):

   WARNING: convert(1) not found, for SVG to PDF conversion install ImageMagick 
(https://www.imagemagick.org)
   kernel/trace/blktrace.c:824: warning: No description found for parameter 
'cgid'
   drivers/gpio/gpiolib.c:593: warning: No description found for parameter '16'
   drivers/gpio/gpiolib.c:593: warning: Excess struct/union/enum/typedef member 
'events' description in 'lineevent_state'
   include/linux/usb/gadget.h:232: warning: No description found for parameter 
'claimed'
   include/linux/usb/gadget.h:232: warning: No description found for parameter 
'enabled'
   include/linux/usb/gadget.h:414: warning: No description found for parameter 
'quirk_altset_not_supp'
   include/linux/usb/gadget.h:414: warning: No description found for parameter 
'quirk_stall_not_supp'
   include/linux/usb/gadget.h:414: warning: No description found for parameter 
'quirk_zlp_not_supp'
   fs/inode.c:1680: warning: No description found for parameter 'rcu'
   include/linux/jbd2.h:443: warning: No description found for parameter 
'i_transaction'
   include/linux/jbd2.h:443: warning: No description found for parameter 
'i_next_transaction'
   include/linux/jbd2.h:443: warning: No description found for parameter 
'i_list'
   include/linux/jbd2.h:443: warning: No description found for parameter 
'i_vfs_inode'
   include/linux/jbd2.h:443: warning: No description found for parameter 
'i_flags'
   include/linux/jbd2.h:497: warning: No description found for parameter 
'h_rsv_handle'
   include/linux/jbd2.h:497: warning: No description found for parameter 
'h_reserved'
   include/linux/jbd2.h:497: warning: No description found for parameter 
'h_type'
   include/linux/jbd2.h:497: warning: No description found for parameter 
'h_line_no'
   include/linux/jbd2.h:497: warning: No description found for parameter 
'h_start_jiffies'
   include/linux/jbd2.h:497: warning: No description found for parameter 
'h_requested_credits'
   include/linux/jbd2.h:497: warning: No description found for parameter 
'saved_alloc_context'
   include/linux/jbd2.h:1050: warning: No description found for parameter 
'j_chkpt_bhs'
   include/linux/jbd2.h:1050: warning: No description found for parameter 
'j_devname'
   include/linux/jbd2.h:1050: warning: No description found for parameter 
'j_average_commit_time'
   include/linux/jbd2.h:1050: warning: No description found for parameter 
'j_min_batch_time'
   include/linux/jbd2.h:1050: warning: No description found for parameter 
'j_max_batch_time'
   include/linux/jbd2.h:1050: warning: No description found for parameter 
'j_commit_callback'
   include/linux/jbd2.h:1050: warning: No description found for parameter 
'j_failed_commit'
   include/linux/jbd2.h:1050: warning: No description found for parameter 
'j_chksum_driver'
   include/linux/jbd2.h:1050: warning: No description found for parameter 
'j_csum_seed'
   fs/jbd2/transaction.c:511: warning: No description found for parameter 'type'
   fs/jbd2/transaction.c:511: warning: No description found for parameter 
'line_no'
   fs/jbd2/transaction.c:641: warning: No description found for parameter 
'gfp_mask'
   include/drm/drm_drv.h:594: warning: No description found for parameter 
'gem_prime_pin'
   include/drm/drm_drv.h:594: warning: No description found for parameter 
'gem_prime_unpin'
   include/drm/drm_drv.h:594: warning: No description found for parameter 
'gem_prime_res_obj'
   include/drm/drm_drv.h:594: warning: No description found for parameter 
'gem_prime_get_sg_table'
   include/drm/drm_drv.h:594: warning: No description found for parameter 
'gem_prime_import_sg_table'
   include/drm/drm_drv.h:594: warning: No description found for parameter 
'gem_prime_vmap'
   include/drm/drm_drv.h:594: warning: No description found for parameter 
'gem_prime_vunmap'
   include/drm/drm_drv.h:594: warning: No description found for parameter 
'gem_prime_mmap'
   include/drm/drm_mode_config.h:771: warning: No description found for 
parameter 'modifiers_property'
   include/drm/drm_mode_config.h:771: warning: Excess struct/union/enum/typedef 
member 'modifiers' description in 'drm_mode_config'
   include/drm/drm_plane.h:552: warning: No description found for parameter 
'modifiers'
   include/drm/drm_plane.h:552: warning: No description found for parameter 
'modifier_count'
   include/drm/drm_debug.h:76: warning: No description found for parameter 'dev'
>> include/drm/drm_debug.h:76: warning: Excess function parameter 'arg' 
>> description in 'DRM_DEV_ERROR'
   include/drm/drm_debug.h:94: warning: No description found for 

[radeon-alex:amd-staging-drm-next 138/173] drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_resource.c:1644:14: error: implicit declaration of function 'acquire_first_split_pipe'

2017-10-12 Thread kbuild test robot
tree:   git://people.freedesktop.org/~agd5f/linux.git amd-staging-drm-next
head:   1b006d838f78d7822f606087fa12ea7ad2c5753b
commit: 5b5d50de60e4b3b9ffa578f044f2a69d4285 [138/173] drm/amd/display: 
Fixed extend to second screen mode hang
config: ia64-allmodconfig (attached as .config)
compiler: ia64-linux-gcc (GCC) 6.2.0
reproduce:
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout 5b5d50de60e4b3b9ffa578f044f2a69d4285
# save the attached .config to linux build tree
make.cross ARCH=ia64 

All errors (new ones prefixed by >>):

   drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_resource.c: In function 
'resource_map_pool_resources':
>> drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_resource.c:1644:14: error: 
>> implicit declaration of function 'acquire_first_split_pipe' 
>> [-Werror=implicit-function-declaration]
  pipe_idx = acquire_first_split_pipe(>res_ctx, pool, stream);
 ^~~~
   cc1: some warnings being treated as errors

vim +/acquire_first_split_pipe +1644 
drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_resource.c

  1617  
  1618  enum dc_status resource_map_pool_resources(
  1619  const struct dc  *dc,
  1620  struct dc_state *context,
  1621  struct dc_stream_state *stream)
  1622  {
  1623  const struct resource_pool *pool = dc->res_pool;
  1624  int i;
  1625  struct dc_context *dc_ctx = dc->ctx;
  1626  struct pipe_ctx *pipe_ctx = NULL;
  1627  int pipe_idx = -1;
  1628  
  1629  /* TODO Check if this is needed */
  1630  /*if (!resource_is_stream_unchanged(old_context, stream)) {
  1631  if (stream != NULL && old_context->streams[i] 
!= NULL) {
  1632  stream->bit_depth_params =
  1633  
old_context->streams[i]->bit_depth_params;
  1634  stream->clamping = 
old_context->streams[i]->clamping;
  1635  continue;
  1636  }
  1637  }
  1638  */
  1639  
  1640  /* acquire new resources */
  1641  pipe_idx = acquire_first_free_pipe(>res_ctx, pool, 
stream);
  1642  
  1643  if (pipe_idx < 0)
> 1644  pipe_idx = acquire_first_split_pipe(>res_ctx, 
> pool, stream);
  1645  
  1646  if (pipe_idx < 0)
  1647  return DC_NO_CONTROLLER_RESOURCE;
  1648  
  1649  pipe_ctx = >res_ctx.pipe_ctx[pipe_idx];
  1650  
  1651  pipe_ctx->stream_res.stream_enc =
  1652  find_first_free_match_stream_enc_for_link(
  1653  >res_ctx, pool, stream);
  1654  
  1655  if (!pipe_ctx->stream_res.stream_enc)
  1656  return DC_NO_STREAM_ENG_RESOURCE;
  1657  
  1658  update_stream_engine_usage(
  1659  >res_ctx, pool,
  1660  pipe_ctx->stream_res.stream_enc,
  1661  true);
  1662  
  1663  /* TODO: Add check if ASIC support and EDID audio */
  1664  if (!stream->sink->converter_disable_audio &&
  1665  dc_is_audio_capable_signal(pipe_ctx->stream->signal) &&
  1666  stream->audio_info.mode_count) {
  1667  pipe_ctx->stream_res.audio = find_first_free_audio(
  1668  >res_ctx, pool);
  1669  
  1670  /*
  1671   * Audio assigned in order first come first get.
  1672   * There are asics which has number of audio
  1673   * resources less then number of pipes
  1674   */
  1675  if (pipe_ctx->stream_res.audio)
  1676  update_audio_usage(>res_ctx, pool,
  1677 pipe_ctx->stream_res.audio, 
true);
  1678  }
  1679  
  1680  for (i = 0; i < context->stream_count; i++)
  1681  if (context->streams[i] == stream) {
  1682  context->stream_status[i].primary_otg_inst = 
pipe_ctx->stream_res.tg->inst;
  1683  context->stream_status[i].stream_enc_inst = 
pipe_ctx->stream_res.stream_enc->id;
  1684  return DC_OK;
  1685  }
  1686  
  1687  DC_ERROR("Stream %p not found in new ctx!\n", stream);
  1688  return DC_ERROR_UNEXPECTED;
  1689  }
  1690  

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip
___
dri-devel mailing list
dri-devel@lists.freedesktop.org

[PATCH] drm/plane: drop num_overlay_planes

2017-10-12 Thread Dave Airlie
From: Dave Airlie 

In order to implement plane leasing we need to count things,
just make the code consistent with the counting code currently
used for counting crtcs/encoders/connectors and drop the need
for num_overlay_planes.

Signed-off-by: Dave Airlie 
---
 drivers/gpu/drm/drm_mode_config.c |  1 -
 drivers/gpu/drm/drm_plane.c   | 45 +--
 include/drm/drm_mode_config.h | 13 ---
 3 files changed, 15 insertions(+), 44 deletions(-)

diff --git a/drivers/gpu/drm/drm_mode_config.c 
b/drivers/gpu/drm/drm_mode_config.c
index 74f6ff5df656..919e78d45ab0 100644
--- a/drivers/gpu/drm/drm_mode_config.c
+++ b/drivers/gpu/drm/drm_mode_config.c
@@ -385,7 +385,6 @@ void drm_mode_config_init(struct drm_device *dev)
dev->mode_config.num_connector = 0;
dev->mode_config.num_crtc = 0;
dev->mode_config.num_encoder = 0;
-   dev->mode_config.num_overlay_plane = 0;
dev->mode_config.num_total_plane = 0;
 }
 EXPORT_SYMBOL(drm_mode_config_init);
diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
index 6af02c7b5da3..faa34afa708a 100644
--- a/drivers/gpu/drm/drm_plane.c
+++ b/drivers/gpu/drm/drm_plane.c
@@ -241,8 +241,6 @@ int drm_universal_plane_init(struct drm_device *dev, struct 
drm_plane *plane,
 
list_add_tail(>head, >plane_list);
plane->index = config->num_total_plane++;
-   if (plane->type == DRM_PLANE_TYPE_OVERLAY)
-   config->num_overlay_plane++;
 
drm_object_attach_property(>base,
   config->plane_type_property,
@@ -353,8 +351,6 @@ void drm_plane_cleanup(struct drm_plane *plane)
 
list_del(>head);
dev->mode_config.num_total_plane--;
-   if (plane->type == DRM_PLANE_TYPE_OVERLAY)
-   dev->mode_config.num_overlay_plane--;
 
WARN_ON(plane->state && !plane->funcs->atomic_destroy_state);
if (plane->state && plane->funcs->atomic_destroy_state)
@@ -462,43 +458,32 @@ int drm_mode_getplane_res(struct drm_device *dev, void 
*data,
struct drm_mode_config *config;
struct drm_plane *plane;
uint32_t __user *plane_ptr;
-   int copied = 0;
-   unsigned num_planes;
+   int count = 0;
 
if (!drm_core_check_feature(dev, DRIVER_MODESET))
return -EINVAL;
 
config = >mode_config;
 
-   if (file_priv->universal_planes)
-   num_planes = config->num_total_plane;
-   else
-   num_planes = config->num_overlay_plane;
-
/*
 * This ioctl is called twice, once to determine how much space is
 * needed, and the 2nd time to fill it.
 */
-   if (num_planes &&
-   (plane_resp->count_planes >= num_planes)) {
-   plane_ptr = (uint32_t __user *)(unsigned 
long)plane_resp->plane_id_ptr;
-
-   /* Plane lists are invariant, no locking needed. */
-   drm_for_each_plane(plane, dev) {
-   /*
-* Unless userspace set the 'universal planes'
-* capability bit, only advertise overlays.
-*/
-   if (plane->type != DRM_PLANE_TYPE_OVERLAY &&
-   !file_priv->universal_planes)
-   continue;
-
-   if (put_user(plane->base.id, plane_ptr + copied))
-   return -EFAULT;
-   copied++;
-   }
+   drm_for_each_plane(plane, dev) {
+   /*
+* Unless userspace set the 'universal planes'
+* capability bit, only advertise overlays.
+*/
+   if (plane->type != DRM_PLANE_TYPE_OVERLAY &&
+   !file_priv->universal_planes)
+   continue;
+
+   if (count < config->num_total_plane &&
+   put_user(plane->base.id, plane_ptr + count))
+   return -EFAULT;
+   count++;
}
-   plane_resp->count_planes = num_planes;
+   plane_resp->count_planes = count;
 
return 0;
 }
diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h
index 1b37368416c8..0b4ac2ebc610 100644
--- a/include/drm/drm_mode_config.h
+++ b/include/drm/drm_mode_config.h
@@ -429,19 +429,6 @@ struct drm_mode_config {
 */
struct list_head encoder_list;
 
-   /**
-* @num_overlay_plane:
-*
-* Number of overlay planes on this device, excluding primary and cursor
-* planes.
-*
-* Track number of overlay planes separately from number of total
-* planes.  By default we only advertise overlay planes to userspace; if
-* userspace sets the "universal plane" capability bit, we'll go ahead
-* and expose all planes. This is invariant over the lifetime of a
-* device and 

[radeon-alex:amd-staging-drm-next 164/1021] drivers/gpu/drm/amd/amdgpu/../display/dc/gpio/gpio_service.c:134:2-3: Unneeded semicolon

2017-10-12 Thread kbuild test robot
tree:   git://people.freedesktop.org/~agd5f/linux.git amd-staging-drm-next
head:   43dd6fde5df450938568885249b836eb376e2ad6
commit: 80be23c578680168a0c710be9c0bddcf65268fcb [164/1021] drm/amd/dc: Add dc 
display driver (v2)


coccinelle warnings: (new ones prefixed by >>)

>> drivers/gpu/drm/amd/amdgpu/../display/dc/gpio/gpio_service.c:134:2-3: 
>> Unneeded semicolon

Please review and possibly fold the followup patch.

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH] drm/amd/dc: fix semicolon.cocci warnings

2017-10-12 Thread kbuild test robot
drivers/gpu/drm/amd/amdgpu/../display/dc/gpio/gpio_service.c:134:2-3: Unneeded 
semicolon


 Remove unneeded semicolon.

Generated by: scripts/coccinelle/misc/semicolon.cocci

Fixes: 80be23c57868 ("drm/amd/dc: Add dc display driver (v2)")
CC: Harry Wentland 
Signed-off-by: Fengguang Wu 
---

 gpio_service.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/gpu/drm/amd/amdgpu/../display/dc/gpio/gpio_service.c
+++ b/drivers/gpu/drm/amd/amdgpu/../display/dc/gpio/gpio_service.c
@@ -131,7 +131,7 @@ failure_2:
 
if (slot)
dm_free(slot);
-   };
+   }
 
 failure_1:
dm_free(service);
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 1/2] drm: Extract drm_debug.[hc]

2017-10-12 Thread kbuild test robot
Hi Haneen,

[auto build test WARNING on drm/drm-next]
[also build test WARNING on v4.14-rc4 next-20171009]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Haneen-Mohammed/drm-Extract-drm_debug-hc/20171013-052937
base:   git://people.freedesktop.org/~airlied/linux.git drm-next
reproduce: make htmldocs

All warnings (new ones prefixed by >>):

   WARNING: convert(1) not found, for SVG to PDF conversion install ImageMagick 
(https://www.imagemagick.org)
   kernel/trace/blktrace.c:824: warning: No description found for parameter 
'cgid'
   drivers/gpio/gpiolib.c:593: warning: No description found for parameter '16'
   drivers/gpio/gpiolib.c:593: warning: Excess struct/union/enum/typedef member 
'events' description in 'lineevent_state'
   include/linux/usb/gadget.h:232: warning: No description found for parameter 
'claimed'
   include/linux/usb/gadget.h:232: warning: No description found for parameter 
'enabled'
   include/linux/usb/gadget.h:414: warning: No description found for parameter 
'quirk_altset_not_supp'
   include/linux/usb/gadget.h:414: warning: No description found for parameter 
'quirk_stall_not_supp'
   include/linux/usb/gadget.h:414: warning: No description found for parameter 
'quirk_zlp_not_supp'
   fs/inode.c:1680: warning: No description found for parameter 'rcu'
   include/linux/jbd2.h:443: warning: No description found for parameter 
'i_transaction'
   include/linux/jbd2.h:443: warning: No description found for parameter 
'i_next_transaction'
   include/linux/jbd2.h:443: warning: No description found for parameter 
'i_list'
   include/linux/jbd2.h:443: warning: No description found for parameter 
'i_vfs_inode'
   include/linux/jbd2.h:443: warning: No description found for parameter 
'i_flags'
   include/linux/jbd2.h:497: warning: No description found for parameter 
'h_rsv_handle'
   include/linux/jbd2.h:497: warning: No description found for parameter 
'h_reserved'
   include/linux/jbd2.h:497: warning: No description found for parameter 
'h_type'
   include/linux/jbd2.h:497: warning: No description found for parameter 
'h_line_no'
   include/linux/jbd2.h:497: warning: No description found for parameter 
'h_start_jiffies'
   include/linux/jbd2.h:497: warning: No description found for parameter 
'h_requested_credits'
   include/linux/jbd2.h:497: warning: No description found for parameter 
'saved_alloc_context'
   include/linux/jbd2.h:1050: warning: No description found for parameter 
'j_chkpt_bhs'
   include/linux/jbd2.h:1050: warning: No description found for parameter 
'j_devname'
   include/linux/jbd2.h:1050: warning: No description found for parameter 
'j_average_commit_time'
   include/linux/jbd2.h:1050: warning: No description found for parameter 
'j_min_batch_time'
   include/linux/jbd2.h:1050: warning: No description found for parameter 
'j_max_batch_time'
   include/linux/jbd2.h:1050: warning: No description found for parameter 
'j_commit_callback'
   include/linux/jbd2.h:1050: warning: No description found for parameter 
'j_failed_commit'
   include/linux/jbd2.h:1050: warning: No description found for parameter 
'j_chksum_driver'
   include/linux/jbd2.h:1050: warning: No description found for parameter 
'j_csum_seed'
   fs/jbd2/transaction.c:511: warning: No description found for parameter 'type'
   fs/jbd2/transaction.c:511: warning: No description found for parameter 
'line_no'
   fs/jbd2/transaction.c:641: warning: No description found for parameter 
'gfp_mask'
   include/drm/drm_drv.h:594: warning: No description found for parameter 
'gem_prime_pin'
   include/drm/drm_drv.h:594: warning: No description found for parameter 
'gem_prime_unpin'
   include/drm/drm_drv.h:594: warning: No description found for parameter 
'gem_prime_res_obj'
   include/drm/drm_drv.h:594: warning: No description found for parameter 
'gem_prime_get_sg_table'
   include/drm/drm_drv.h:594: warning: No description found for parameter 
'gem_prime_import_sg_table'
   include/drm/drm_drv.h:594: warning: No description found for parameter 
'gem_prime_vmap'
   include/drm/drm_drv.h:594: warning: No description found for parameter 
'gem_prime_vunmap'
   include/drm/drm_drv.h:594: warning: No description found for parameter 
'gem_prime_mmap'
   include/drm/drm_mode_config.h:771: warning: No description found for 
parameter 'modifiers_property'
   include/drm/drm_mode_config.h:771: warning: Excess struct/union/enum/typedef 
member 'modifiers' description in 'drm_mode_config'
   include/drm/drm_plane.h:552: warning: No description found for parameter 
'modifiers'
   include/drm/drm_plane.h:552: warning: No description found for parameter 
'modifier_count'
>> include/drm/drm_debug.h:78: warning: No description found for parameter 'dev'
   include/drm/drm_debug.h:78: warning: No description found for parameter 'fmt'
   include/drm/drm_debug.h:96: warning: No description found for parameter 'dev'
   

[radeon-alex:amd-staging-drm-next 12/173] drivers/gpu/drm/amd/amdgpu/../display/dc/gpio/gpio_service.c:134:3-8: WARNING: NULL check before freeing functions like kfree, debugfs_remove, debugfs_remove_

2017-10-12 Thread kbuild test robot
tree:   git://people.freedesktop.org/~agd5f/linux.git amd-staging-drm-next
head:   1b006d838f78d7822f606087fa12ea7ad2c5753b
commit: f09cd1f46388080272561fa2c61d1b51598ef0e6 [12/173] drm/amd/display: Use 
kernel alloc/free


coccinelle warnings: (new ones prefixed by >>)

>> drivers/gpu/drm/amd/amdgpu/../display/dc/gpio/gpio_service.c:134:3-8: 
>> WARNING: NULL check before freeing functions like kfree, debugfs_remove, 
>> debugfs_remove_recursive or usb_free_urb is not needed. Maybe consider 
>> reorganizing relevant code to avoid passing NULL values.
   drivers/gpu/drm/amd/amdgpu/../display/dc/gpio/gpio_service.c:175:4-9: 
WARNING: NULL check before freeing functions like kfree, debugfs_remove, 
debugfs_remove_recursive or usb_free_urb is not needed. Maybe consider 
reorganizing relevant code to avoid passing NULL values.

Please review and possibly fold the followup patch.

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH] drm/amd/display: fix ifnullfree.cocci warnings

2017-10-12 Thread kbuild test robot
drivers/gpu/drm/amd/amdgpu/../display/dc/gpio/gpio_service.c:134:3-8: WARNING: 
NULL check before freeing functions like kfree, debugfs_remove, 
debugfs_remove_recursive or usb_free_urb is not needed. Maybe consider 
reorganizing relevant code to avoid passing NULL values.
drivers/gpu/drm/amd/amdgpu/../display/dc/gpio/gpio_service.c:175:4-9: WARNING: 
NULL check before freeing functions like kfree, debugfs_remove, 
debugfs_remove_recursive or usb_free_urb is not needed. Maybe consider 
reorganizing relevant code to avoid passing NULL values.

 NULL check before some freeing functions is not needed.

 Based on checkpatch warning
 "kfree(NULL) is safe this check is probably not required"
 and kfreeaddr.cocci by Julia Lawall.

Generated by: scripts/coccinelle/free/ifnullfree.cocci

Fixes: f09cd1f46388 ("drm/amd/display: Use kernel alloc/free")
Signed-off-by: Fengguang Wu 
---

 gpio_service.c |6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

--- a/drivers/gpu/drm/amd/amdgpu/../display/dc/gpio/gpio_service.c
+++ b/drivers/gpu/drm/amd/amdgpu/../display/dc/gpio/gpio_service.c
@@ -130,8 +130,7 @@ failure_2:
 
slot = service->busyness[index_of_id];
 
-   if (slot)
-   kfree(slot);
+   kfree(slot);
};
 
 failure_1:
@@ -171,8 +170,7 @@ void dal_gpio_service_destroy(
do {
uint32_t *slot = (*ptr)->busyness[index_of_id];
 
-   if (slot)
-   kfree(slot);
+   kfree(slot);
 
++index_of_id;
} while (index_of_id < GPIO_ID_COUNT);
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH] tracing, drm/i915: Remove unused trace events

2017-10-12 Thread Steven Rostedt
From: Steven Rostedt (VMware) 

Commit ce8daef3580 ("drm/i915: Remove dead
i915_gem_evict_everything()") removed the only instances of
trace_i915_gem_evict_everything.

Commit a7b9761d0a ("drm/i915: Split i915_gem_flush_ring() into seperate
invalidate/flush funcs") removed the only instances of
trace_i915_gem_ring_flush.

Commit 8b5d27b911 ("drm/i915: Remove intel_flip_work infrastructure")
removed the only instances of trace_i915_flip_request and
trace_i915_flip_complete.

But none of these commits removed the corresponding trace events that
created those tracepoints. As trace events take up memory to define
data structures and functions, even when not in use, remove these
obsolete trace events.

Signed-off-by: Steven Rostedt (VMware) 
---
Index: linux-trace.git/drivers/gpu/drm/i915/i915_trace.h
===
--- linux-trace.git.orig/drivers/gpu/drm/i915/i915_trace.h
+++ linux-trace.git/drivers/gpu/drm/i915/i915_trace.h
@@ -539,21 +539,6 @@ TRACE_EVENT(i915_gem_evict,
  __entry->flags & PIN_MAPPABLE ? ", mappable" : "")
 );
 
-TRACE_EVENT(i915_gem_evict_everything,
-   TP_PROTO(struct drm_device *dev),
-   TP_ARGS(dev),
-
-   TP_STRUCT__entry(
-__field(u32, dev)
-   ),
-
-   TP_fast_assign(
-  __entry->dev = dev->primary->index;
- ),
-
-   TP_printk("dev=%d", __entry->dev)
-);
-
 TRACE_EVENT(i915_gem_evict_vm,
TP_PROTO(struct i915_address_space *vm),
TP_ARGS(vm),
@@ -649,29 +634,6 @@ TRACE_EVENT(i915_gem_request_queue,
  __entry->flags)
 );
 
-TRACE_EVENT(i915_gem_ring_flush,
-   TP_PROTO(struct drm_i915_gem_request *req, u32 invalidate, u32 
flush),
-   TP_ARGS(req, invalidate, flush),
-
-   TP_STRUCT__entry(
-__field(u32, dev)
-__field(u32, ring)
-__field(u32, invalidate)
-__field(u32, flush)
-),
-
-   TP_fast_assign(
-  __entry->dev = req->i915->drm.primary->index;
-  __entry->ring = req->engine->id;
-  __entry->invalidate = invalidate;
-  __entry->flush = flush;
-  ),
-
-   TP_printk("dev=%u, ring=%x, invalidate=%04x, flush=%04x",
- __entry->dev, __entry->ring,
- __entry->invalidate, __entry->flush)
-);
-
 DECLARE_EVENT_CLASS(i915_gem_request,
TP_PROTO(struct drm_i915_gem_request *req),
TP_ARGS(req),
@@ -842,42 +804,6 @@ DEFINE_EVENT(i915_gem_request, i915_gem_
TP_ARGS(req)
 );
 
-TRACE_EVENT(i915_flip_request,
-   TP_PROTO(int plane, struct drm_i915_gem_object *obj),
-
-   TP_ARGS(plane, obj),
-
-   TP_STRUCT__entry(
-   __field(int, plane)
-   __field(struct drm_i915_gem_object *, obj)
-   ),
-
-   TP_fast_assign(
-   __entry->plane = plane;
-   __entry->obj = obj;
-   ),
-
-   TP_printk("plane=%d, obj=%p", __entry->plane, __entry->obj)
-);
-
-TRACE_EVENT(i915_flip_complete,
-   TP_PROTO(int plane, struct drm_i915_gem_object *obj),
-
-   TP_ARGS(plane, obj),
-
-   TP_STRUCT__entry(
-   __field(int, plane)
-   __field(struct drm_i915_gem_object *, obj)
-   ),
-
-   TP_fast_assign(
-   __entry->plane = plane;
-   __entry->obj = obj;
-   ),
-
-   TP_printk("plane=%d, obj=%p", __entry->plane, __entry->obj)
-);
-
 TRACE_EVENT_CONDITION(i915_reg_rw,
TP_PROTO(bool write, i915_reg_t reg, u64 val, int len, bool trace),
 
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v11 2/3] drm/tinydrm: Move tinydrm_of_find_backlight to backlight.c

2017-10-12 Thread kbuild test robot
Hi Meghana,

[auto build test WARNING on v4.14-rc3]
[also build test WARNING on next-20171009]
[cannot apply to drm/drm-next backlight/for-backlight-next 
drm-exynos/exynos-drm/for-next]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Meghana-Madhyastha/Move-backlight-helper-functions-from-tinydrm-helpers-to-linux-backlight/20171013-062032
config: i386-randconfig-x001-201741 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
# save the attached .config to linux build tree
make ARCH=i386 

All warnings (new ones prefixed by >>):

   drivers/video/backlight/backlight.c: In function 'backlight_get':
>> drivers/video/backlight/backlight.c:609:39: warning: character constant too 
>> long for its type
  np = of_parse_phandle(dev->of_node, 'backlight', 0);
  ^~~
>> drivers/video/backlight/backlight.c:609:39: warning: passing argument 2 of 
>> 'of_parse_phandle' makes pointer from integer without a cast 
>> [-Wint-conversion]
   In file included from include/linux/irqdomain.h:34:0,
from include/linux/i2c.h:34,
from include/uapi/linux/fb.h:5,
from include/linux/fb.h:5,
from include/linux/backlight.h:12,
from drivers/video/backlight/backlight.c:13:
   include/linux/of.h:358:28: note: expected 'const char *' but argument is of 
type 'int'
extern struct device_node *of_parse_phandle(const struct device_node *np,
   ^~~~

vim +609 drivers/video/backlight/backlight.c

   582  
   583  /**
   584   * backlight_get - Get backlight device
   585   * @dev: Device
   586   *
   587   * This function looks for a property named 'backlight' on the DT node
   588   * connected to @dev and looks up the backlight device.
   589   *
   590   * Call backlight_put() to drop the reference on the backlight device.
   591   *
   592   * Returns:
   593   * A pointer to the backlight device if found.
   594   * Error pointer -EPROBE_DEFER if the DT property is set, but no 
backlight
   595   * device is found.
   596   * NULL if there's no backlight property.
   597   */
   598  
   599  #if IS_ENABLED(CONFIG_BACKLIGHT_CLASS_DEVICE)
   600  struct backlight_device *backlight_get(struct device *dev)
   601  {
   602  struct backlight_device *bd = NULL;
   603  struct device_node *np;
   604  
   605  if (!dev)
   606  return NULL;
   607  
   608  if (IS_ENABLED(CONFIG_OF) && dev->of_node) {
 > 609  np = of_parse_phandle(dev->of_node, 'backlight', 0);
   610  if (np) {
   611  bd = of_find_backlight_by_node(np);
   612  of_node_put(np);
   613  if (!bd)
   614  return ERR_PTR(-EPROBE_DEFER);
   615  }
   616  }
   617  
   618  return bd;
   619  }
   620  EXPORT_SYMBOL(backlight_get);
   621  #endif
   622  

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 101900] No HDMI HBR audio on Polaris (no TrueHD, no Atmos, no Neo:X, no HD Master audio)

2017-10-12 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=101900

--- Comment #10 from Timofonic  ---
Any news? This would make AMD hardware more interesting to be used on my future
workstation + HTPC setup.

-- 
You are receiving this mail because:
You are the assignee for the bug.___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 3/6] drm/amd/display: Unify DRM state variable namings.

2017-10-12 Thread sunpeng.li
From: "Leo (Sunpeng) Li" 

Use new_*_state and old_*_state for their respective new/old DRM object
states.

Signed-off-by: Leo (Sunpeng) Li 
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 80 +++
 1 file changed, 40 insertions(+), 40 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c 
b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index d4426b3..fe0b658 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -573,12 +573,12 @@ struct amdgpu_dm_connector 
*amdgpu_dm_find_first_crct_matching_connector(
struct drm_crtc *crtc)
 {
uint32_t i;
-   struct drm_connector_state *conn_state;
+   struct drm_connector_state *new_con_state;
struct drm_connector *connector;
struct drm_crtc *crtc_from_state;
 
-   for_each_new_connector_in_state(state, connector, conn_state, i) {
-   crtc_from_state = conn_state->crtc;
+   for_each_new_connector_in_state(state, connector, new_con_state, i) {
+   crtc_from_state = new_con_state->crtc;
 
if (crtc_from_state == crtc)
return to_amdgpu_dm_connector(connector);
@@ -608,7 +608,7 @@ int amdgpu_dm_display_resume(struct amdgpu_device *adev)
struct amdgpu_dm_connector *aconnector;
struct drm_connector *connector;
struct drm_crtc *crtc;
-   struct drm_crtc_state *crtc_state;
+   struct drm_crtc_state *new_crtc_state;
int ret = 0;
int i;
 
@@ -644,8 +644,8 @@ int amdgpu_dm_display_resume(struct amdgpu_device *adev)
}
 
/* Force mode set in atomic comit */
-   for_each_new_crtc_in_state(adev->dm.cached_state, crtc, crtc_state, i)
-   crtc_state->active_changed = true;
+   for_each_new_crtc_in_state(adev->dm.cached_state, crtc, new_crtc_state, 
i)
+   new_crtc_state->active_changed = true;
 
ret = drm_atomic_helper_resume(ddev, adev->dm.cached_state);
 
@@ -3971,7 +3971,7 @@ int amdgpu_dm_atomic_commit(
bool nonblock)
 {
struct drm_crtc *crtc;
-   struct drm_crtc_state *old_crtc_state, *new_state;
+   struct drm_crtc_state *old_crtc_state, *new_crtc_state;
struct amdgpu_device *adev = dev->dev_private;
int i;
 
@@ -3982,11 +3982,11 @@ int amdgpu_dm_atomic_commit(
 * it will update crtc->dm_crtc_state->stream pointer which is used in
 * the ISRs.
 */
-   for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_state, 
i) {
+   for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, 
new_crtc_state, i) {
struct dm_crtc_state *old_acrtc_state = 
to_dm_crtc_state(old_crtc_state);
struct amdgpu_crtc *acrtc = to_amdgpu_crtc(crtc);
 
-   if (drm_atomic_crtc_needs_modeset(new_state) && 
old_acrtc_state->stream)
+   if (drm_atomic_crtc_needs_modeset(new_crtc_state) && 
old_acrtc_state->stream)
manage_dm_interrupts(adev, acrtc, false);
}
 
@@ -4011,7 +4011,7 @@ void amdgpu_dm_atomic_commit_tail(
unsigned long flags;
bool wait_for_vblank = true;
struct drm_connector *connector;
-   struct drm_connector_state *old_conn_state, *new_con_state;
+   struct drm_connector_state *old_con_state, *new_con_state;
struct dm_crtc_state *old_acrtc_state, *new_acrtc_state;
 
drm_atomic_helper_update_legacy_modeset_state(dev, state);
@@ -4145,9 +4145,9 @@ void amdgpu_dm_atomic_commit_tail(
}
 
/* Handle scaling and undersacn changes*/
-   for_each_oldnew_connector_in_state(state, connector, old_conn_state, 
new_con_state, i) {
+   for_each_oldnew_connector_in_state(state, connector, old_con_state, 
new_con_state, i) {
struct dm_connector_state *con_new_state = 
to_dm_connector_state(new_con_state);
-   struct dm_connector_state *con_old_state = 
to_dm_connector_state(old_conn_state);
+   struct dm_connector_state *con_old_state = 
to_dm_connector_state(old_con_state);
struct amdgpu_crtc *acrtc = 
to_amdgpu_crtc(con_new_state->base.crtc);
struct dc_stream_status *status = NULL;
 
@@ -4375,7 +4375,7 @@ static int dm_update_crtcs_state(
bool *lock_and_validation_needed)
 {
struct drm_crtc *crtc;
-   struct drm_crtc_state *old_crtc_state, *crtc_state;
+   struct drm_crtc_state *old_crtc_state, *new_crtc_state;
int i;
struct dm_crtc_state *old_acrtc_state, *new_acrtc_state;
struct dm_atomic_state *dm_state = to_dm_atomic_state(state);
@@ -4384,34 +4384,34 @@ static int dm_update_crtcs_state(
 
/*TODO Move this code into dm_crtc_atomic_check once we get rid of 
dc_validation_set */
/* update changed items */
-   

[PATCH 6/6] drm/amd/display: Remove useless pcrtc pointer

2017-10-12 Thread sunpeng.li
From: "Leo (Sunpeng) Li" 

in amdgpu_dm_atomic_commit_tail. Just use crtc instead.

Signed-off-by: Leo (Sunpeng) Li 
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c 
b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index 67222ff..f9b5769 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -4004,7 +4004,7 @@ void amdgpu_dm_atomic_commit_tail(
struct dm_atomic_state *dm_state;
uint32_t i, j;
uint32_t new_crtcs_count = 0;
-   struct drm_crtc *crtc, *pcrtc;
+   struct drm_crtc *crtc;
struct drm_crtc_state *old_crtc_state, *new_crtc_state;
struct amdgpu_crtc *new_crtcs[MAX_STREAMS];
struct dc_stream_state *new_stream = NULL;
@@ -4200,11 +4200,11 @@ void amdgpu_dm_atomic_commit_tail(
}
 
/* update planes when needed per crtc*/
-   for_each_new_crtc_in_state(state, pcrtc, new_crtc_state, j) {
+   for_each_new_crtc_in_state(state, crtc, new_crtc_state, j) {
dm_new_crtc_state = to_dm_crtc_state(new_crtc_state);
 
if (dm_new_crtc_state->stream)
-   amdgpu_dm_commit_planes(state, dev, dm, pcrtc, 
_for_vblank);
+   amdgpu_dm_commit_planes(state, dev, dm, crtc, 
_for_vblank);
}
 
 
-- 
2.7.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 0/6] Use new DRM API where possible, and cleanups.

2017-10-12 Thread sunpeng.li
From: "Leo (Sunpeng) Li" 

Hi Dave,

This series reworks the previous patch. Patch 1 is a v2 of the previous,
and additional patches are from the feedback received. They apply on top
of your drm-next-amd-dc-staging branch.

Thanks,
Leo

Leo (Sunpeng) Li (6):
  drm/amd/display: Use DRM new-style object iterators.
  drm/amd/display: Use new DRM API where possible
  drm/amd/display: Unify DRM state variable namings.
  drm/amd/display: Unify amdgpu_dm state variable namings.
  drm/amd/display: Fix typo
  drm/amd/display: Remove useless pcrtc pointer

 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 320 +++---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h |   3 +-
 2 files changed, 156 insertions(+), 167 deletions(-)

-- 
2.7.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 4/6] drm/amd/display: Unify amdgpu_dm state variable namings.

2017-10-12 Thread sunpeng.li
From: "Leo (Sunpeng) Li" 

Use dm_new_*_state and dm_old_*_state for their respective amdgpu_dm new
and old object states. Helps with readability, and enforces use of new
DRM api (choose either new, or old).

Signed-off-by: Leo (Sunpeng) Li 
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 137 +++---
 1 file changed, 68 insertions(+), 69 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c 
b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index fe0b658..de88ee1 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -3890,7 +3890,7 @@ static void amdgpu_dm_commit_planes(struct 
drm_atomic_state *state,
drm_atomic_get_new_crtc_state(state, crtc);
struct drm_framebuffer *fb = new_plane_state->fb;
bool pflip_needed;
-   struct dm_plane_state *dm_plane_state = 
to_dm_plane_state(new_plane_state);
+   struct dm_plane_state *dm_new_plane_state = 
to_dm_plane_state(new_plane_state);
 
if (plane->type == DRM_PLANE_TYPE_CURSOR) {
handle_cursor_update(plane, old_plane_state);
@@ -3914,9 +3914,9 @@ static void amdgpu_dm_commit_planes(struct 
drm_atomic_state *state,
spin_unlock_irqrestore(>dev->event_lock, flags);
 
if (!pflip_needed) {
-   WARN_ON(!dm_plane_state->dc_state);
+   WARN_ON(!dm_new_plane_state->dc_state);
 
-   plane_states_constructed[planes_count] = 
dm_plane_state->dc_state;
+   plane_states_constructed[planes_count] = 
dm_new_plane_state->dc_state;
 
dc_stream_attach = acrtc_state->stream;
planes_count++;
@@ -3983,10 +3983,10 @@ int amdgpu_dm_atomic_commit(
 * the ISRs.
 */
for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, 
new_crtc_state, i) {
-   struct dm_crtc_state *old_acrtc_state = 
to_dm_crtc_state(old_crtc_state);
+   struct dm_crtc_state *dm_old_crtc_state = 
to_dm_crtc_state(old_crtc_state);
struct amdgpu_crtc *acrtc = to_amdgpu_crtc(crtc);
 
-   if (drm_atomic_crtc_needs_modeset(new_crtc_state) && 
old_acrtc_state->stream)
+   if (drm_atomic_crtc_needs_modeset(new_crtc_state) && 
dm_old_crtc_state->stream)
manage_dm_interrupts(adev, acrtc, false);
}
 
@@ -4012,7 +4012,7 @@ void amdgpu_dm_atomic_commit_tail(
bool wait_for_vblank = true;
struct drm_connector *connector;
struct drm_connector_state *old_con_state, *new_con_state;
-   struct dm_crtc_state *old_acrtc_state, *new_acrtc_state;
+   struct dm_crtc_state *dm_old_crtc_state, *dm_new_crtc_state;
 
drm_atomic_helper_update_legacy_modeset_state(dev, state);
 
@@ -4022,8 +4022,8 @@ void amdgpu_dm_atomic_commit_tail(
for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, 
new_crtc_state, i) {
struct amdgpu_crtc *acrtc = to_amdgpu_crtc(crtc);
 
-   new_acrtc_state = to_dm_crtc_state(new_crtc_state);
-   old_acrtc_state = to_dm_crtc_state(old_crtc_state);
+   dm_new_crtc_state = to_dm_crtc_state(new_crtc_state);
+   dm_old_crtc_state = to_dm_crtc_state(old_crtc_state);
 
DRM_DEBUG_DRIVER(
"amdgpu_crtc id:%d crtc_state_flags: enable:%d, 
active:%d, "
@@ -4041,11 +4041,11 @@ void amdgpu_dm_atomic_commit_tail(
 * aconnector as needed
 */
 
-   if (modeset_required(new_crtc_state, new_acrtc_state->stream, 
old_acrtc_state->stream)) {
+   if (modeset_required(new_crtc_state, dm_new_crtc_state->stream, 
dm_old_crtc_state->stream)) {
 
DRM_DEBUG_DRIVER("Atomic commit: SET crtc id %d: 
[%p]\n", acrtc->crtc_id, acrtc);
 
-   if (!new_acrtc_state->stream) {
+   if (!dm_new_crtc_state->stream) {
/*
 * this could happen because of issues with
 * userspace notifications delivery.
@@ -4067,8 +4067,8 @@ void amdgpu_dm_atomic_commit_tail(
}
 
 
-   if (old_acrtc_state->stream)
-   remove_stream(adev, acrtc, 
old_acrtc_state->stream);
+   if (dm_old_crtc_state->stream)
+   remove_stream(adev, acrtc, 
dm_old_crtc_state->stream);
 
 
/*
@@ -4092,8 +4092,8 @@ void amdgpu_dm_atomic_commit_tail(
DRM_DEBUG_DRIVER("Atomic commit: RESET. crtc id 
%d:[%p]\n", acrtc->crtc_id, acrtc);
 
/* i.e. reset mode */
-   if 

[PATCH 5/6] drm/amd/display: Fix typo

2017-10-12 Thread sunpeng.li
From: "Leo (Sunpeng) Li" 

undersacn -> underscan

Signed-off-by: Leo (Sunpeng) Li 
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c 
b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index de88ee1..67222ff 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -4144,7 +4144,7 @@ void amdgpu_dm_atomic_commit_tail(
}
}
 
-   /* Handle scaling and undersacn changes*/
+   /* Handle scaling and underscan changes*/
for_each_oldnew_connector_in_state(state, connector, old_con_state, 
new_con_state, i) {
struct dm_connector_state *dm_new_con_state = 
to_dm_connector_state(new_con_state);
struct dm_connector_state *dm_old_con_state = 
to_dm_connector_state(old_con_state);
@@ -4707,7 +4707,7 @@ int amdgpu_dm_atomic_check(struct drm_device *dev,
 if (ret)
 goto fail;
 
-   /* Check scaling and undersacn changes*/
+   /* Check scaling and underscan changes*/
/*TODO Removed scaling changes validation due to inability to commit
 * new stream into context w\o causing full reset. Need to
 * decide how to handle.
-- 
2.7.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 2/6] drm/amd/display: Use new DRM API where possible

2017-10-12 Thread sunpeng.li
From: "Leo (Sunpeng) Li" 

To conform to DRM's new API, we should not be accessing a DRM object's
internal state directly. Rather, the DRM for_each_old/new_* iterators,
and drm_atomic_get_old/new_* interface should be used.

This is an ongoing process. For now, update the DRM-facing atomic
functions, where the atomic state object is given.

Signed-off-by: Leo (Sunpeng) Li 
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 131 +++---
 1 file changed, 66 insertions(+), 65 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c 
b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index cc024ab..d4426b3 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -3873,28 +3873,31 @@ static void amdgpu_dm_commit_planes(struct 
drm_atomic_state *state,
 {
uint32_t i;
struct drm_plane *plane;
-   struct drm_plane_state *old_plane_state;
+   struct drm_plane_state *old_plane_state, *new_plane_state;
struct dc_stream_state *dc_stream_attach;
struct dc_plane_state *plane_states_constructed[MAX_SURFACES];
struct amdgpu_crtc *acrtc_attach = to_amdgpu_crtc(pcrtc);
-   struct dm_crtc_state *acrtc_state = to_dm_crtc_state(pcrtc->state);
+   struct drm_crtc_state *new_pcrtc_state =
+   drm_atomic_get_new_crtc_state(state, pcrtc);
+   struct dm_crtc_state *acrtc_state = to_dm_crtc_state(new_pcrtc_state);
int planes_count = 0;
unsigned long flags;
 
/* update planes when needed */
-   for_each_old_plane_in_state(state, plane, old_plane_state, i) {
-   struct drm_plane_state *plane_state = plane->state;
-   struct drm_crtc *crtc = plane_state->crtc;
-   struct drm_framebuffer *fb = plane_state->fb;
+   for_each_oldnew_plane_in_state(state, plane, old_plane_state, 
new_plane_state, i) {
+   struct drm_crtc *crtc = new_plane_state->crtc;
+   struct drm_crtc_state *new_crtc_state =
+   drm_atomic_get_new_crtc_state(state, crtc);
+   struct drm_framebuffer *fb = new_plane_state->fb;
bool pflip_needed;
-   struct dm_plane_state *dm_plane_state = 
to_dm_plane_state(plane_state);
+   struct dm_plane_state *dm_plane_state = 
to_dm_plane_state(new_plane_state);
 
if (plane->type == DRM_PLANE_TYPE_CURSOR) {
handle_cursor_update(plane, old_plane_state);
continue;
}
 
-   if (!fb || !crtc || pcrtc != crtc || !crtc->state->active)
+   if (!fb || !crtc || pcrtc != crtc || !new_crtc_state->active)
continue;
 
pflip_needed = !state->allow_modeset;
@@ -3918,13 +3921,13 @@ static void amdgpu_dm_commit_planes(struct 
drm_atomic_state *state,
dc_stream_attach = acrtc_state->stream;
planes_count++;
 
-   } else if (crtc->state->planes_changed) {
+   } else if (new_crtc_state->planes_changed) {
/* Assume even ONE crtc with immediate flip means
 * entire can't wait for VBLANK
 * TODO Check if it's correct
 */
*wait_for_vblank =
-   pcrtc->state->pageflip_flags & 
DRM_MODE_PAGE_FLIP_ASYNC ?
+   new_pcrtc_state->pageflip_flags & 
DRM_MODE_PAGE_FLIP_ASYNC ?
false : true;
 
/* TODO: Needs rework for multiplane flip */
@@ -3942,7 +3945,7 @@ static void amdgpu_dm_commit_planes(struct 
drm_atomic_state *state,
if (planes_count) {
unsigned long flags;
 
-   if (pcrtc->state->event) {
+   if (new_pcrtc_state->event) {
 
drm_crtc_vblank_get(pcrtc);
 
@@ -3968,7 +3971,7 @@ int amdgpu_dm_atomic_commit(
bool nonblock)
 {
struct drm_crtc *crtc;
-   struct drm_crtc_state *new_state;
+   struct drm_crtc_state *old_crtc_state, *new_state;
struct amdgpu_device *adev = dev->dev_private;
int i;
 
@@ -3979,8 +3982,8 @@ int amdgpu_dm_atomic_commit(
 * it will update crtc->dm_crtc_state->stream pointer which is used in
 * the ISRs.
 */
-   for_each_new_crtc_in_state(state, crtc, new_state, i) {
-   struct dm_crtc_state *old_acrtc_state = 
to_dm_crtc_state(crtc->state);
+   for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_state, 
i) {
+   struct dm_crtc_state *old_acrtc_state = 
to_dm_crtc_state(old_crtc_state);
struct amdgpu_crtc *acrtc = to_amdgpu_crtc(crtc);
 
if (drm_atomic_crtc_needs_modeset(new_state) 

[PATCH v2 1/6] drm/amd/display: Use DRM new-style object iterators.

2017-10-12 Thread sunpeng.li
From: "Leo (Sunpeng) Li" 

Use the correct for_each_new/old_* iterators instead of for_each_*

List of affected functions:

amdgpu_dm_find_first_crtc_matching_connector: use for_each_new
- Old from_state_var flag was always choosing the new state

amdgpu_dm_display_resume: use for_each_new
- drm_atomic_helper_duplicate_state is called during suspend to
  cache the state
- It sets 'state' within the state triplet to 'new_state'

amdgpu_dm_commit_planes: use for_each_old
- Called after the state was swapped (via atomic commit tail)

amdgpu_dm_atomic_commit: use for_each_new
- Called before the state is swapped

amdgpu_dm_atomic_commit_tail: use for_each_old
- Called after the state was swapped

dm_update_crtcs_state: use for_each_new
- Called before the state is swapped (via atomic check)

amdgpu_dm_atomic_check: use for_each_new
- Called before the state is swapped

v2: Split out typo fixes to a new patch.

Signed-off-by: Leo (Sunpeng) Li 
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 32 ---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h |  3 +--
 2 files changed, 12 insertions(+), 23 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c 
b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index 9bfe1f9..cc024ab 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -570,23 +570,15 @@ static int dm_suspend(void *handle)
 
 struct amdgpu_dm_connector *amdgpu_dm_find_first_crct_matching_connector(
struct drm_atomic_state *state,
-   struct drm_crtc *crtc,
-   bool from_state_var)
+   struct drm_crtc *crtc)
 {
uint32_t i;
struct drm_connector_state *conn_state;
struct drm_connector *connector;
struct drm_crtc *crtc_from_state;
 
-   for_each_new_connector_in_state(
-   state,
-   connector,
-   conn_state,
-   i) {
-   crtc_from_state =
-   from_state_var ?
-   conn_state->crtc :
-   connector->state->crtc;
+   for_each_new_connector_in_state(state, connector, conn_state, i) {
+   crtc_from_state = conn_state->crtc;
 
if (crtc_from_state == crtc)
return to_amdgpu_dm_connector(connector);
@@ -3890,7 +3882,7 @@ static void amdgpu_dm_commit_planes(struct 
drm_atomic_state *state,
unsigned long flags;
 
/* update planes when needed */
-   for_each_new_plane_in_state(state, plane, old_plane_state, i) {
+   for_each_old_plane_in_state(state, plane, old_plane_state, i) {
struct drm_plane_state *plane_state = plane->state;
struct drm_crtc *crtc = plane_state->crtc;
struct drm_framebuffer *fb = plane_state->fb;
@@ -4024,7 +4016,7 @@ void amdgpu_dm_atomic_commit_tail(
dm_state = to_dm_atomic_state(state);
 
/* update changed items */
-   for_each_new_crtc_in_state(state, crtc, old_crtc_state, i) {
+   for_each_old_crtc_in_state(state, crtc, old_crtc_state, i) {
struct amdgpu_crtc *acrtc = to_amdgpu_crtc(crtc);
struct drm_crtc_state *new_state = crtc->state;
 
@@ -4113,11 +4105,9 @@ void amdgpu_dm_atomic_commit_tail(
new_acrtc_state = 
to_dm_crtc_state(new_crtcs[i]->base.state);
 
new_stream = new_acrtc_state->stream;
-   aconnector =
-   amdgpu_dm_find_first_crct_matching_connector(
+   aconnector = 
amdgpu_dm_find_first_crct_matching_connector(
state,
-   _crtcs[i]->base,
-   false);
+   _crtcs[i]->base);
if (!aconnector) {
DRM_DEBUG_DRIVER("Atomic commit: Failed to find 
connector for acrtc id:%d "
 "skipping freesync init\n",
@@ -4151,7 +4141,7 @@ void amdgpu_dm_atomic_commit_tail(
}
 
/* Handle scaling and undersacn changes*/
-   for_each_new_connector_in_state(state, connector, old_conn_state, i) {
+   for_each_old_connector_in_state(state, connector, old_conn_state, i) {
struct amdgpu_dm_connector *aconnector = 
to_amdgpu_dm_connector(connector);
struct dm_connector_state *con_new_state =
to_dm_connector_state(aconnector->base.state);
@@ -4205,7 +4195,7 @@ void amdgpu_dm_atomic_commit_tail(
}
 
/* update planes when needed per crtc*/
-   for_each_new_crtc_in_state(state, pcrtc, old_crtc_state, j) {
+   for_each_old_crtc_in_state(state, pcrtc, old_crtc_state, j) {

Re: [PATCH 2/6] drm: Allow render nodes to query display objects

2017-10-12 Thread Keith Packard
Daniel Vetter  writes:

> One more that came up on irc after discussion why this is needed: The
> userspace side using this won't work on split gpus where the render node
> has 0 displays, and hence where you really need to query the compositor
> anyway.

Agreed -- using the X connection to get the information should let this
work on split systems. Within the Vulkan code, I already have to move
objects from the render node to the display node. Hrm. That exposes a
weakness in the kms_display extension I've proposed; that only allows
you to pass a single fd. Passing separate display and render fds through
that interface seems like a pretty useful change.

-- 
-keith


signature.asc
Description: PGP signature
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 2/6] drm: Allow render nodes to query display objects

2017-10-12 Thread Keith Packard
Daniel Vetter  writes:

> So given the huge possibilities of abuse, do we really, really need all
> this, and is there not any way to create a bit of protocol to pass the
> relevant data from X to clients? From your presentation is sounded like
> current xrandr is (almost) there ...

Yeah, it's the Vulkan EXT_acquire_xlib_display API which is using this
access to discover the set of resources available via the render fd in
preparation for accessing them over the lease fd once the lease has been
created.

I *think* I can get enough information to make a good guess as to what
kernel resources there are from the RandR info. I'll go give that a try
and see if I get stuck.

Thanks for the feedback; the fewer kernel API changes the better.

-- 
-keith


signature.asc
Description: PGP signature
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 1/3] drm/syncobj: extract two helpers from drm_syncobj_create

2017-10-12 Thread Marek Olšák
Sorry, this codepath is not tested by radeonsi.

Marek

On Sun, Oct 1, 2017 at 1:20 AM, Zhou, David(ChunMing)
 wrote:
> Could you test and review it? On hand, I have no env.
>
> Regards,
> David Zhou
>
> 发自坚果 Pro
>
> Marek Ol?醟  于 2017年9月30日 下午11:56写道:
>
> The idea sounds good.
>
> Marek
>
> On Sat, Sep 30, 2017 at 3:55 AM, Chunming Zhou  wrote:
>> My mean is like the attached, I revert part of yours.
>>
>> Regards,
>>
>> David zhou
>>
>>
>>
>> On 2017年09月29日 22:15, Marek Olšák wrote:
>>>
>>> On Fri, Sep 29, 2017 at 4:13 PM, Marek Olšák  wrote:

 On Fri, Sep 29, 2017 at 4:44 AM, Chunming Zhou  wrote:
>
>
> On 2017年09月13日 04:42, Marek Olšák wrote:
>>
>> From: Marek Olšák 
>>
>> For amdgpu.
>>
>> drm_syncobj_create is renamed to drm_syncobj_create_as_handle, and new
>> helpers drm_syncobj_create and drm_syncobj_get_handle are added.
>>
>> Signed-off-by: Marek Olšák 
>> ---
>>drivers/gpu/drm/drm_syncobj.c | 49
>> +++
>>include/drm/drm_syncobj.h |  4 
>>2 files changed, 49 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/drm_syncobj.c
>> b/drivers/gpu/drm/drm_syncobj.c
>> index 0422b8c..0bb1741 100644
>> --- a/drivers/gpu/drm/drm_syncobj.c
>> +++ b/drivers/gpu/drm/drm_syncobj.c
>> @@ -262,8 +262,14 @@ void drm_syncobj_free(struct kref *kref)
>>}
>>EXPORT_SYMBOL(drm_syncobj_free);
>>-static int drm_syncobj_create(struct drm_file *file_private,
>> - u32 *handle, uint32_t flags)
>
> You can add a new parameter for passing dma fence, then in patch3, you
> can
> directly use it for AMDGPU_FENCE_TO HANDLE_GET_SYNCOBJ.
>
> otherwise the set looks good to me.

 Sorry I just pushed this.
>>>
>>> Actually, you commented on a deleted line. The function already has
>>> dma_fence among the parameters.
>>>
>>> Marek
>>
>>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 196615] amdgpu - resume from suspend is no longer working on rx480

2017-10-12 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=196615

--- Comment #23 from klavkala...@gmail.com ---
Oh. I didn't realize it worked like that. The same problem happens with all
versions of 4.13 and 4.14 I tried so far.

-- 
You are receiving this mail because:
You are watching the assignee of the bug.
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [Nouveau] [PATCH v2] drm/nouveau: Document nouveau support for Tegra in DRIVER_DESC

2017-10-12 Thread Ben Skeggs
On 10/12/2017 09:41 PM, Thierry Reding wrote:
> On Sun, Oct 01, 2017 at 10:13:53AM -0400, Rhys Kidd wrote:
>> nouveau supports the Tegra K1 and higher after the SoC-based GPUs converged
>> with the main GeForce GPU families.
>>
>> v2:
>> - Qualify that support is Tegra K1+ (Martin Peres)
>>
>> Signed-off-by: Rhys Kidd 
>> Reviewed-by: Martin Peres 
>> Acked-by: Pierre Moreau 
>> ---
>>  drivers/gpu/drm/nouveau/nouveau_drv.h | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> Ben's probably picked this up already, but FWIW:
It's queued in my tree, but, I've added your ack.  Thanks!

> 
> Acked-by: Thierry Reding 
> 



signature.asc
Description: OpenPGP digital signature
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


RE: page-flip with damage?

2017-10-12 Thread Deepak Singh Rawat
Hi Michal,

Are you currently working on this feature. I started to look into page flip 
with damage for VMware drivers. 

Thanks,
Deepak

> -Original Message-
> From: dri-devel [mailto:dri-devel-boun...@lists.freedesktop.org] On Behalf
> Of Michal Lukaszek
> Sent: Tuesday, September 26, 2017 12:02 AM
> To: dri-devel@lists.freedesktop.org
> Subject: RE: page-flip with damage?
> 
> Thomas Hellstrom wrote:
> 
> 
> 
> > Page flips, while efficient on real hardware, aren't that efficient in
> 
> > other situations, like for virtual devices with local, or even worse,
> 
> > So I'd like to start looking at page-flips with damage
> 
> 
> 
> This is funny, it's exactly what we pointed out during the lighting talk at
> XDC2017
> 
> https://urldefense.proofpoint.com/v2/url?u=https-
> 3A__youtu.be_R2XHZd4uXRI-3Ft-
> 3D6h2m50s=DwIGaQ=uilaK90D4TOVoH58JNXRgQ=zOOG28inJK0762S
> xAf-cyZdStnd2NQpRu98lJP2iYGw=MeqFMzaER-
> gbFwJbxAovSVKR5y4mpUOeQkVPBC4Ixrs=kq0q9TAXS1cc-
> 8aAgqYcfeYyh6oLZOLs4NL9-ixdPzI=
> 
> 
> 
> And VMware gets a mention, too.
> 
> 
> 
> :)
> 
> 
> 
> Join forces?
> 
> 
> 
> Thanks,
> 
> Michal
> 
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://urldefense.proofpoint.com/v2/url?u=https-
> 3A__lists.freedesktop.org_mailman_listinfo_dri-
> 2Ddevel=DwIGaQ=uilaK90D4TOVoH58JNXRgQ=zOOG28inJK0762SxAf
> -cyZdStnd2NQpRu98lJP2iYGw=MeqFMzaER-
> gbFwJbxAovSVKR5y4mpUOeQkVPBC4Ixrs=ppNKRV_ldifYVpCbA-r-
> 6e1vc7_6Wu_KboAacOSdM30=
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/udl: Fixed problem with UDL adpater reconnection

2017-10-12 Thread Alex Deucher
On Wed, Oct 11, 2017 at 4:41 PM, Robert Tarasov
 wrote:
> Fixed problem with DisplayLink and DisplayLink certified adapters when they
> didn't want to work if they were initialized with disconnected DVI cable. Now
> udl driver checks and updates adapter's connection state every 10 seconds, as
> well as retreives all the edid data blocks instead of only base one. Previous
> approch could lead to improper initialization of video mode with certain
> monitors.
>

Seems like this should be split into two patches:

1. rework the EDID handling in the driver
2. enable drm connector polling.

Alex

> Signed-off-by: Robert Tarasov 
> ---
>  drivers/gpu/drm/udl/udl_connector.c | 153 
> 
>  drivers/gpu/drm/udl/udl_connector.h |  13 +++
>  drivers/gpu/drm/udl/udl_drv.c   |   4 +
>  drivers/gpu/drm/udl/udl_main.c  |   5 ++
>  4 files changed, 125 insertions(+), 50 deletions(-)
>  create mode 100644 drivers/gpu/drm/udl/udl_connector.h
>
> diff --git a/drivers/gpu/drm/udl/udl_connector.c 
> b/drivers/gpu/drm/udl/udl_connector.c
> index 9f9a49748d17..b2d9ffcc29aa 100644
> --- a/drivers/gpu/drm/udl/udl_connector.c
> +++ b/drivers/gpu/drm/udl/udl_connector.c
> @@ -14,70 +14,95 @@
>  #include 
>  #include 
>  #include 
> +#include "udl_connector.h"
>  #include "udl_drv.h"
>
> -/* dummy connector to just get EDID,
> -   all UDL appear to have a DVI-D */
> -
> -static u8 *udl_get_edid(struct udl_device *udl)
> +static bool udl_get_edid_block(struct udl_device *udl, int block_idx,
> +  u8 *buff)
>  {
> -   u8 *block;
> -   char *rbuf;
> int ret, i;
> +   u8 *read_buff;
>
> -   block = kmalloc(EDID_LENGTH, GFP_KERNEL);
> -   if (block == NULL)
> -   return NULL;
> -
> -   rbuf = kmalloc(2, GFP_KERNEL);
> -   if (rbuf == NULL)
> -   goto error;
> +   read_buff = kmalloc(2, GFP_KERNEL);
> +   if (!read_buff)
> +   return false;
>
> for (i = 0; i < EDID_LENGTH; i++) {
> +   int bval = (i + block_idx * EDID_LENGTH) << 8;
> ret = usb_control_msg(udl->udev,
> - usb_rcvctrlpipe(udl->udev, 0), (0x02),
> - (0x80 | (0x02 << 5)), i << 8, 0xA1, 
> rbuf, 2,
> - HZ);
> + usb_rcvctrlpipe(udl->udev, 0),
> + (0x02), (0x80 | (0x02 << 5)), bval,
> + 0xA1, read_buff, 2, HZ);
> if (ret < 1) {
> DRM_ERROR("Read EDID byte %d failed err %x\n", i, 
> ret);
> -   goto error;
> +   kfree(read_buff);
> +   return false;
> }
> -   block[i] = rbuf[1];
> +   buff[i] = read_buff[1];
> }
>
> -   kfree(rbuf);
> -   return block;
> -
> -error:
> -   kfree(block);
> -   kfree(rbuf);
> -   return NULL;
> +   kfree(read_buff);
> +   return true;
>  }
>
> -static int udl_get_modes(struct drm_connector *connector)
> +static bool udl_get_edid(struct udl_device *udl, u8 **result_buff,
> +int *result_buff_size)
>  {
> -   struct udl_device *udl = connector->dev->dev_private;
> -   struct edid *edid;
> -   int ret;
> -
> -   edid = (struct edid *)udl_get_edid(udl);
> -   if (!edid) {
> -   drm_mode_connector_update_edid_property(connector, NULL);
> -   return 0;
> +   int i, extensions;
> +   u8 *block_buff = NULL, *buff_ptr;
> +
> +   block_buff = kmalloc(EDID_LENGTH, GFP_KERNEL);
> +   if (block_buff == NULL)
> +   return false;
> +
> +   if (udl_get_edid_block(udl, 0, block_buff) &&
> +   memchr_inv(block_buff, 0, EDID_LENGTH)) {
> +   extensions = ((struct edid *)block_buff)->extensions;
> +   if (extensions > 0) {
> +   /* we have to read all extensions one by one */
> +   *result_buff_size = EDID_LENGTH * (extensions + 1);
> +   *result_buff = kmalloc(*result_buff_size, GFP_KERNEL);
> +   buff_ptr = *result_buff;
> +   if (buff_ptr == NULL) {
> +   kfree(block_buff);
> +   return false;
> +   }
> +   memcpy(buff_ptr, block_buff, EDID_LENGTH);
> +   kfree(block_buff);
> +   buff_ptr += EDID_LENGTH;
> +   for (i = 1; i < extensions; ++i) {
> +   if (udl_get_edid_block(udl, i, buff_ptr)) {
> +   buff_ptr += EDID_LENGTH;
> +   } else {
> +  

Re: [PATCH 2/6] drm: Allow render nodes to query display objects

2017-10-12 Thread Daniel Vetter
On Thu, Oct 12, 2017 at 08:41:17PM +0200, Daniel Vetter wrote:
> Hi Keith,
> 
> On Tue, Oct 10, 2017 at 05:48:27PM -0700, Keith Packard wrote:
> > This allows an application to discover what display resources are
> > available before requesting a lease from the X server.
> > 
> > Signed-off-by: Keith Packard 
> 
> For reasons I've kidna stopped reviewing these patches. I don't really
> agree with the details of the lease uapi as implemented. But that's
> nothing that can't be fixed with a few flags, and leases always need an
> explicit opt-in from the compositor now, so still possible to do
> reasonable architecture on top in the future. Worst case we fake just the
> parts that X needs from this version of leases, we've done that kind of
> stuff in the past.
> 
> This here otoh is an uapi change that we can't ever undo or contain,
> because as soon as we allow anyone to read kms state they will do so. And
> do so in lots of very interesting and abusive ways. E.g. there's already
> apps who try to second-guess the vblank timings with the vblank ioctl
> (which accidentally works everywhere, not just on the master), and ofc get
> it wrong, except for the case the developer tested on. Or without
> uevent/udev events you can't do efficient output probing, which means
> we'll see endless amounts of polling (we had to stop giving accurate data
> in the sysfs interface already, for exactly this reasons, because someone
> thought polling outputs once per second was a smart idea).
> 
> So given the huge possibilities of abuse, do we really, really need all
> this, and is there not any way to create a bit of protocol to pass the
> relevant data from X to clients? From your presentation is sounded like
> current xrandr is (almost) there ...

One more that came up on irc after discussion why this is needed: The
userspace side using this won't work on split gpus where the render node
has 0 displays, and hence where you really need to query the compositor
anyway.

Like I predicted, we expose this, everyone will abuse it in slightly
broken ways :-)
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[ANNOUNCE] libdrm 2.4.84

2017-10-12 Thread Marek Olšák

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1


libdrm 2.4.84 has been released.


Alex Deucher (1):
  tests/amdgpu: add missing header to SOURCES

Andrey Grodzovsky (1):
  amdgpu: Add deadlock detection test suit.

Anuj Phogat (1):
  intel: Change a KBL pci id to GT2 from GT1.5

Christian König (1):
  amdgpu: make userptr unit test more interesting

Dave Airlie (1):
  headers: sync syncobj ioctl defines.

Eric Engestrom (1):
  freedreno/kgsl: fix pointer-to-int cast

James Zhu (2):
  tests/amdgpu: add new uvd enc support check
  tests/amdgpu: fix uvd enc data corruption issue

Jan Vesely (1):
  amdgpu: Do not write beyond allocated memory when parsing ids

Marek Olšák (7):
  amdgpu: print error messages when amdgpu_device_initialize is failing
  include: sync drm.h and amdgpu_drm.h with airlied/drm-next
  amdgpu: add sync_file import and export functions
  drm: add drmSyncobjWait wrapper
  amdgpu: add amdgpu_cs_syncobj_wait
  amdgpu: add amdgpu_cs_fence_to_handle
  configure.ac: bump version to 2.4.84

Philipp Zabel (1):
  etnaviv: prevent deadlock in error path

Rob Herring (2):
  Android: move libraries to /vendor
  headers: sync DRM_MODE_ROTATE/REFLECT defines from kernel v4.14-rc1

git tag: libdrm-2.4.84

https://dri.freedesktop.org/libdrm/libdrm-2.4.84.tar.bz2
MD5:  35b9544bc2ad864acd1abaa1a2b99092  libdrm-2.4.84.tar.bz2
SHA1: 3a8835aaef89648757593f8de9eff95990dd  libdrm-2.4.84.tar.bz2
SHA256: 7ae9c24d91139ac9a2cdee06fe46dbe1c401a1eda1c0bd2a6d1ecf72f479e0aa  
libdrm-2.4.84.tar.bz2
SHA512: 
860ebc5fa934edee97e9e7e13aaa2f2e70a68b946f4f3893cd7f93b8296c10b3cd4ce4c23b1676eefe375286e6e2292b96e917d7976f65c61da3fa661e5e641a
  libdrm-2.4.84.tar.bz2
PGP:  https://dri.freedesktop.org/libdrm/libdrm-2.4.84.tar.bz2.sig

https://dri.freedesktop.org/libdrm/libdrm-2.4.84.tar.gz
MD5:  5e676f903bdb245878383334dca4cc33  libdrm-2.4.84.tar.gz
SHA1: e406522d41c2dc5f3ac9643f885a349e039ffeb6  libdrm-2.4.84.tar.gz
SHA256: ca4d3a4705be2ec289f9df7cfa871f5e02fa43d0f653622c9d9d428959143e78  
libdrm-2.4.84.tar.gz
SHA512: 
efbe352e1bbf3bb1962ad8e1c0a2774e5683db9cd0d91e42b844ddc74089d131f305bc6977c0734690c88af11f5d6777dbfd4bbaab9778fa550dc1b6f52e5cb6
  libdrm-2.4.84.tar.gz
PGP:  https://dri.freedesktop.org/libdrm/libdrm-2.4.84.tar.gz.sig

-BEGIN PGP SIGNATURE-
Version: GnuPG v1

iQEcBAEBAgAGBQJZ37tJAAoJEP3RXVrO8PKxmNoH/jdcdZzvpXtWB6eWC2SEXGbl
WvhoIrNf94cAz/1JvN6nzXjo5oewTTrHsHTd7XYxHcFt13jHTB5uCX8gnCotvY+d
yJesW8liHg4wx1FyL8syAufFlWtzyxK74lQj6R4DHvVeHMnUpc9+goDVZDPkHj2R
/S4u5qbLC4AJeATyDsQG07kPwhblrQpm7QLns4caQsJssrmhboM5w4IkjViHUR1j
7ju5MW1eyAAdWHdhXRgFk7lIO+nuyZXoxS6TjMlQmYichBM261PJldUjo5Zi4Aal
oH/QuDYvoFq0F5E4f/JIliUciU/w4FFSOtheWW2AztzrAeUGyTl1D413WPI4ZUQ=
=o07z
-END PGP SIGNATURE-
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v2] drm/vc4: Add the DRM_IOCTL_VC4_GEM_MADVISE ioctl

2017-10-12 Thread Eric Anholt
Boris Brezillon  writes:

> This ioctl will allow us to purge inactive userspace buffers when the
> system is running out of contiguous memory.
>
> For now, the purge logic is rather dumb in that it does not try to
> release only the amount of BO needed to meet the last CMA alloc request
> but instead purges all objects placed in the purgeable pool as soon as
> we experience a CMA allocation failure.
>
> Note that the in-kernel BO cache is always purged before the purgeable
> cache because those objects are known to be unused while objects marked
> as purgeable by a userspace application/library might have to be
> restored when they are marked back as unpurgeable, which can be
> expensive.
>
> Signed-off-by: Boris Brezillon 
> ---
> Hello,
>
> Updates to libdrm, mesa and igt making use of this kernel feature can
> be found on my github repos [1][2][3].
>
> There's currently no debugfs hook to manually force a purge, but this
> is being discussed and might be added later on.
>
> Regards,
>
> Boris
>
> [1]https://github.com/bbrezillon/drm/tree/vc4/purgeable
> [2]https://github.com/bbrezillon/mesa/tree/vc4/purgeable
> [3]https://github.com/bbrezillon/igt/tree/vc4/purgeable
>
> Changes in v2:
> - Do not re-allocate BO's memory after when WILLNEED is asked after a purge
> - Add purgeable/purged stats to debugfs and dumpstats
> - Pad the drm_vc4_gem_madvise to make it 64-bit aligned
> - Forbid madvise calls on internal BO objects (everything that is not
>   meant to be exposed to userspace)
> - Do not increment/decrement usecnt on internal BOs (they cannot be marked
>   purgeable, so doing that is useless and error prone)
> - Fix a few bugs related to usecnt refcounting
> ---
>  drivers/gpu/drm/vc4/vc4_bo.c| 284 
> ++--
>  drivers/gpu/drm/vc4/vc4_drv.c   |  10 +-
>  drivers/gpu/drm/vc4/vc4_drv.h   |  44 +++
>  drivers/gpu/drm/vc4/vc4_gem.c   | 153 +-
>  drivers/gpu/drm/vc4/vc4_plane.c |  20 +++
>  include/uapi/drm/vc4_drm.h  |  18 +++
>  6 files changed, 512 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/gpu/drm/vc4/vc4_bo.c b/drivers/gpu/drm/vc4/vc4_bo.c
> index 3afdbf4bc10b..edb0062a58c7 100644
> --- a/drivers/gpu/drm/vc4/vc4_bo.c
> +++ b/drivers/gpu/drm/vc4/vc4_bo.c
> @@ -42,7 +42,8 @@ static bool is_user_label(int label)
>  
>  static void vc4_bo_stats_dump(struct vc4_dev *vc4)
>  {
> - int i;
> + size_t purgeable_size, purged_size;
> + int i, npurgeable, npurged;
>  
>   for (i = 0; i < vc4->num_labels; i++) {
>   if (!vc4->bo_labels[i].num_allocated)
> @@ -53,6 +54,21 @@ static void vc4_bo_stats_dump(struct vc4_dev *vc4)
>vc4->bo_labels[i].size_allocated / 1024,
>vc4->bo_labels[i].num_allocated);
>   }
> +
> + mutex_lock(>purgeable.lock);
> + npurgeable = vc4->purgeable.num;
> + purgeable_size = vc4->purgeable.size;
> + purged_size = vc4->purgeable.purged_size;
> + npurged = vc4->purgeable.purged_num;
> + mutex_unlock(>purgeable.lock);
> +
> + if (npurgeable)
> + DRM_INFO("%30s: %6dkb BOs (%d)\n", "userspace BO cache",
> +  purgeable_size / 1024, npurgeable);
> +
> + if (npurged)
> + DRM_INFO("%30s: %6dkb BOs (%d)\n", "total purged BO",
> +  purged_size / 1024, npurged);
>  }

We had a discussion about this on IRC -- I was trying to go for using
the debug labeling stuff instead of maintaining separate stats.
Apparently the "total purged ever" stats have been really useful, though
(since a BO is probably removed soon after being purged), so we're
sticking with it.  Also, losing existing debug labels on
GL_APPLE_object_purgeable objects wouldn't be great.

> +static inline bool vc4_bo_supports_madv(const struct vc4_bo *bo)
> +{
> + switch (bo->label) {
> + case VC4_BO_TYPE_V3D:
> + case VC4_BO_TYPE_V3D_SHADER:
> + case VC4_BO_TYPE_DUMB:
> + return true;
> + default:
> + break;
> + }
> +
> + return false;
> +}

This function is a problem -- we're basing usecnt management elsewhere
on its return value, but these labels are supposed to only be debug
information.  Notably, userspace could call the label ioctl with the
same string as one of the kernel names and get the BO to have one of the
kernel's permanent label numbers, mixing up the usecnts.

>  struct vc4_fence {
>   struct dma_fence base;
>   struct drm_device *dev;
> @@ -503,6 +540,7 @@ int vc4_get_hang_state_ioctl(struct drm_device *dev, void 
> *data,
>struct drm_file *file_priv);
>  int vc4_label_bo_ioctl(struct drm_device *dev, void *data,
>  struct drm_file *file_priv);
> +int vc4_fault(struct vm_fault *vmf);
>  int vc4_mmap(struct file *filp, struct vm_area_struct *vma);
>  struct reservation_object 

linux-next: manual merge of the drm-intel tree with the drm-intel-fixes tree

2017-10-12 Thread Mark Brown
Hi all,

Today's linux-next merge of the drm-intel tree got a conflict in:

  drivers/gpu/drm/i915/i915_gem.c

between commit:

  b85577b72837ee ("drm/i915: Order two completing nop_submit_request")

from the drm-intel-fixes tree and commit:

  af7a8ffad9c58d ("drm/i915: Use rcu instead of stop_machine in set_wedged")

from the drm-intel tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

diff --cc drivers/gpu/drm/i915/i915_gem.c
index d5e58d4a5950,20fcac37c85a..
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@@ -3019,36 -3090,24 +3092,27 @@@ static void nop_submit_request(struct d
GEM_BUG_ON(!i915_terminally_wedged(>i915->gpu_error));
dma_fence_set_error(>fence, -EIO);
  
 -  i915_gem_request_submit(request);
 +  spin_lock_irqsave(>engine->timeline->lock, flags);
 +  __i915_gem_request_submit(request);
 +  intel_engine_init_global_seqno(request->engine, request->global_seqno);
 +  spin_unlock_irqrestore(>engine->timeline->lock, flags);
  }
  
- static void engine_set_wedged(struct intel_engine_cs *engine)
+ static void nop_complete_submit_request(struct drm_i915_gem_request *request)
  {
-   /* We need to be sure that no thread is running the old callback as
-* we install the nop handler (otherwise we would submit a request
-* to hardware that will never complete). In order to prevent this
-* race, we wait until the machine is idle before making the swap
-* (using stop_machine()).
-*/
-   engine->submit_request = nop_submit_request;
+   unsigned long flags;
  
-   /* Mark all executing requests as skipped */
-   engine->cancel_requests(engine);
+   GEM_BUG_ON(!i915_terminally_wedged(>i915->gpu_error));
+   dma_fence_set_error(>fence, -EIO);
  
-   /* Mark all pending requests as complete so that any concurrent
-* (lockless) lookup doesn't try and wait upon the request as we
-* reset it.
-*/
-   intel_engine_init_global_seqno(engine,
-  intel_engine_last_submit(engine));
+   spin_lock_irqsave(>engine->timeline->lock, flags);
+   __i915_gem_request_submit(request);
+   intel_engine_init_global_seqno(request->engine, request->global_seqno);
+   spin_unlock_irqrestore(>engine->timeline->lock, flags);
  }
  
- static int __i915_gem_set_wedged_BKL(void *data)
+ void i915_gem_set_wedged(struct drm_i915_private *i915)
  {
-   struct drm_i915_private *i915 = data;
struct intel_engine_cs *engine;
enum intel_engine_id id;
  


signature.asc
Description: PGP signature
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 103066] Empire boundaries do not show up in Stellaris.

2017-10-12 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=103066

--- Comment #1 from Dylan Stephano-Shachter  ---
Another piece of helpful info might be that when I reduce the graphics to low,
the empire borders appear. However, the sector borders still do not show up.

-- 
You are receiving this mail because:
You are the assignee for the bug.___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 2/6] drm: Allow render nodes to query display objects

2017-10-12 Thread Daniel Vetter
Hi Keith,

On Tue, Oct 10, 2017 at 05:48:27PM -0700, Keith Packard wrote:
> This allows an application to discover what display resources are
> available before requesting a lease from the X server.
> 
> Signed-off-by: Keith Packard 

For reasons I've kidna stopped reviewing these patches. I don't really
agree with the details of the lease uapi as implemented. But that's
nothing that can't be fixed with a few flags, and leases always need an
explicit opt-in from the compositor now, so still possible to do
reasonable architecture on top in the future. Worst case we fake just the
parts that X needs from this version of leases, we've done that kind of
stuff in the past.

This here otoh is an uapi change that we can't ever undo or contain,
because as soon as we allow anyone to read kms state they will do so. And
do so in lots of very interesting and abusive ways. E.g. there's already
apps who try to second-guess the vblank timings with the vblank ioctl
(which accidentally works everywhere, not just on the master), and ofc get
it wrong, except for the case the developer tested on. Or without
uevent/udev events you can't do efficient output probing, which means
we'll see endless amounts of polling (we had to stop giving accurate data
in the sysfs interface already, for exactly this reasons, because someone
thought polling outputs once per second was a smart idea).

So given the huge possibilities of abuse, do we really, really need all
this, and is there not any way to create a bit of protocol to pass the
relevant data from X to clients? From your presentation is sounded like
current xrandr is (almost) there ...

Thanks, Daniel

> ---
>  drivers/gpu/drm/drm_ioctl.c | 20 ++--
>  1 file changed, 10 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c
> index 25559aa4c65b..78a0d6996e12 100644
> --- a/drivers/gpu/drm/drm_ioctl.c
> +++ b/drivers/gpu/drm/drm_ioctl.c
> @@ -613,27 +613,27 @@ static const struct drm_ioctl_desc drm_ioctls[] = {
>   DRM_IOCTL_DEF(DRM_IOCTL_GEM_FLINK, drm_gem_flink_ioctl, 
> DRM_AUTH|DRM_UNLOCKED),
>   DRM_IOCTL_DEF(DRM_IOCTL_GEM_OPEN, drm_gem_open_ioctl, 
> DRM_AUTH|DRM_UNLOCKED),
>  
> - DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETRESOURCES, drm_mode_getresources, 
> DRM_CONTROL_ALLOW|DRM_UNLOCKED),
> + DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETRESOURCES, drm_mode_getresources, 
> DRM_RENDER_ALLOW|DRM_CONTROL_ALLOW|DRM_UNLOCKED),
>  
>   DRM_IOCTL_DEF(DRM_IOCTL_PRIME_HANDLE_TO_FD, 
> drm_prime_handle_to_fd_ioctl, DRM_AUTH|DRM_UNLOCKED|DRM_RENDER_ALLOW),
>   DRM_IOCTL_DEF(DRM_IOCTL_PRIME_FD_TO_HANDLE, 
> drm_prime_fd_to_handle_ioctl, DRM_AUTH|DRM_UNLOCKED|DRM_RENDER_ALLOW),
>  
> - DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETPLANERESOURCES, drm_mode_getplane_res, 
> DRM_CONTROL_ALLOW|DRM_UNLOCKED),
> - DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETCRTC, drm_mode_getcrtc, 
> DRM_CONTROL_ALLOW|DRM_UNLOCKED),
> + DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETPLANERESOURCES, drm_mode_getplane_res, 
> DRM_RENDER_ALLOW|DRM_CONTROL_ALLOW|DRM_UNLOCKED),
> + DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETCRTC, drm_mode_getcrtc, 
> DRM_RENDER_ALLOW|DRM_CONTROL_ALLOW|DRM_UNLOCKED),
>   DRM_IOCTL_DEF(DRM_IOCTL_MODE_SETCRTC, drm_mode_setcrtc, 
> DRM_MASTER|DRM_CONTROL_ALLOW|DRM_UNLOCKED),
> - DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETPLANE, drm_mode_getplane, 
> DRM_CONTROL_ALLOW|DRM_UNLOCKED),
> + DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETPLANE, drm_mode_getplane, 
> DRM_RENDER_ALLOW|DRM_CONTROL_ALLOW|DRM_UNLOCKED),
>   DRM_IOCTL_DEF(DRM_IOCTL_MODE_SETPLANE, drm_mode_setplane, 
> DRM_MASTER|DRM_CONTROL_ALLOW|DRM_UNLOCKED),
>   DRM_IOCTL_DEF(DRM_IOCTL_MODE_CURSOR, drm_mode_cursor_ioctl, 
> DRM_MASTER|DRM_CONTROL_ALLOW|DRM_UNLOCKED),
>   DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETGAMMA, drm_mode_gamma_get_ioctl, 
> DRM_UNLOCKED),
>   DRM_IOCTL_DEF(DRM_IOCTL_MODE_SETGAMMA, drm_mode_gamma_set_ioctl, 
> DRM_MASTER|DRM_UNLOCKED),
> - DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETENCODER, drm_mode_getencoder, 
> DRM_CONTROL_ALLOW|DRM_UNLOCKED),
> - DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETCONNECTOR, drm_mode_getconnector, 
> DRM_CONTROL_ALLOW|DRM_UNLOCKED),
> + DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETENCODER, drm_mode_getencoder, 
> DRM_RENDER_ALLOW|DRM_CONTROL_ALLOW|DRM_UNLOCKED),
> + DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETCONNECTOR, drm_mode_getconnector, 
> DRM_RENDER_ALLOW|DRM_CONTROL_ALLOW|DRM_UNLOCKED),
>   DRM_IOCTL_DEF(DRM_IOCTL_MODE_ATTACHMODE, drm_noop, 
> DRM_MASTER|DRM_CONTROL_ALLOW|DRM_UNLOCKED),
>   DRM_IOCTL_DEF(DRM_IOCTL_MODE_DETACHMODE, drm_noop, 
> DRM_MASTER|DRM_CONTROL_ALLOW|DRM_UNLOCKED),
> - DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETPROPERTY, drm_mode_getproperty_ioctl, 
> DRM_CONTROL_ALLOW|DRM_UNLOCKED),
> + DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETPROPERTY, drm_mode_getproperty_ioctl, 
> DRM_RENDER_ALLOW|DRM_CONTROL_ALLOW|DRM_UNLOCKED),
>   DRM_IOCTL_DEF(DRM_IOCTL_MODE_SETPROPERTY, 
> drm_mode_connector_property_set_ioctl, 
> 

linux-next: manual merge of the drm-intel tree with the drm-intel-fixes tree

2017-10-12 Thread Mark Brown
Hi all,

Today's linux-next merge of the drm-intel tree got a conflict in:

  drivers/gpu/drm/i915/intel_display.c

between commit:

   7b50f7b24cd6c ("rm/i915: Read timings from the correct transcoder in 
intel_crtc_mode_get()")

from the drm-intel-fixes tree and commit:

   de330815677d8 ("drm/i915: Reuse normal state readout for LVDS/DVO fixed 
mode")

from the drm-intel tree.

I fixed it up by taking the version from the drm-intel tree and can
carry the fix as necessary. This is now fixed as far as linux-next is
concerned, but any non trivial conflicts should be mentioned to your
upstream maintainer when your tree is submitted for merging.  You may
also want to consider cooperating with the maintainer of the conflicting
tree to minimise any particularly complex conflicts.


signature.asc
Description: PGP signature
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v2 01/10] drm/panel: Keep track of enabled/prepared

2017-10-12 Thread Daniel Vetter
On Thu, Oct 12, 2017 at 01:55:28PM -0400, Sean Paul wrote:
> This patch adds state tracking to the drm_panel functions which keep
> track of enabled and prepared. If the calls are unbalanced, a WARNING is
> issued.
> 
> The motivation for this change is that a number of panel drivers
> (including panel-simple) all do this to protect their regulator
> refcounts. The atomic framework ensures the calls are balanced, and
> there  aren't any panel drivers being used by legacy drivers. As such,
> these checks are useless, but let's add a WARNING just in case something
> crazy happens (like a legacy driver using a panel).
> 
> Less code == better.
> 
> Changes in v2:
>  - Reduced enabled/prepared bools to one enum (Andrzej)
>  - Don't update state if the operation fails (Andrzej)
>  - Issue warning even if operation is not implemented
> 
> Cc: Andrzej Hajda 
> Signed-off-by: Sean Paul 

I really like this. Bunch of (hopefully) non-jetlagged comments below.

With those address (obviously for all the functions, I only commented on
drm_panel_unprepare):

Reviewed-by: Daniel Vetter 
> ---
>  drivers/gpu/drm/drm_panel.c |  1 +
>  include/drm/drm_panel.h | 60 
> +++--
>  2 files changed, 53 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_panel.c b/drivers/gpu/drm/drm_panel.c
> index 308d442a531b..e5957e7da768 100644
> --- a/drivers/gpu/drm/drm_panel.c
> +++ b/drivers/gpu/drm/drm_panel.c
> @@ -48,6 +48,7 @@ static LIST_HEAD(panel_list);
>  void drm_panel_init(struct drm_panel *panel)
>  {
>   INIT_LIST_HEAD(>list);
> + panel->state = DRM_PANEL_POWER_OFF;
>  }
>  EXPORT_SYMBOL(drm_panel_init);
>  
> diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h
> index 14ac240a1f64..425461c4c574 100644
> --- a/include/drm/drm_panel.h
> +++ b/include/drm/drm_panel.h
> @@ -24,6 +24,7 @@
>  #ifndef __DRM_PANEL_H__
>  #define __DRM_PANEL_H__
>  
> +#include 
>  #include 
>  #include 
>  
> @@ -84,6 +85,7 @@ struct drm_panel_funcs {
>   * @dev: parent device of the panel
>   * @funcs: operations that can be performed on the panel
>   * @list: panel entry in registry
> + * @power_state: keeps track of the panel power status
>   */
>  struct drm_panel {
>   struct drm_device *drm;
> @@ -93,6 +95,12 @@ struct drm_panel {
>   const struct drm_panel_funcs *funcs;
>  
>   struct list_head list;
> +
> + enum {
> + DRM_PANEL_POWER_OFF,
> + DRM_PANEL_POWER_PREPARED,
> + DRM_PANEL_POWER_ENABLED
> + } state;
>  };
>  
>  /**
> @@ -104,12 +112,21 @@ struct drm_panel {
>   * is usually no longer possible to communicate with the panel until another
>   * call to drm_panel_prepare().
>   *
> + * Atomic framework should ensure that prepare/unprepare are properly 
> balanced.
> + * If this is not the case, a WARNING will be issued.

s/should/will/ to make it slightly more authoritative sounding?

> + *
>   * Return: 0 on success or a negative error code on failure.
>   */
>  static inline int drm_panel_unprepare(struct drm_panel *panel)

Given that the functions have grown quite a bit I'm not sure it's
reasonable to have them as static inlines anymore ...

>  {
> - if (panel && panel->funcs && panel->funcs->unprepare)
> - return panel->funcs->unprepare(panel);
> + WARN_ON(panel->state != DRM_PANEL_POWER_PREPARED);
> +
> + if (panel && panel->funcs && panel->funcs->unprepare) {
> + int ret = panel->funcs->unprepare(panel);
> + if (!ret)
> + panel->state = DRM_PANEL_POWER_OFF;

Do you really want to only update the status if the driver provides a
callback? I think this should be moved out of the if
(panel->funcs->disable), but not ouf of the if (panel).

Could probably make the if (panel) an early return, for clean code.
-Daniel

> + return ret;
> + }
>  
>   return panel ? -ENOSYS : -EINVAL;
>  }
> @@ -122,12 +139,21 @@ static inline int drm_panel_unprepare(struct drm_panel 
> *panel)
>   * drivers. For smart panels it should still be possible to communicate with
>   * the integrated circuitry via any command bus after this call.
>   *
> + * Atomic framework should ensure that enable/disable are properly balanced.
> + * If this is not the case, a WARNING will be issued.
> + *
>   * Return: 0 on success or a negative error code on failure.
>   */
>  static inline int drm_panel_disable(struct drm_panel *panel)
>  {
> - if (panel && panel->funcs && panel->funcs->disable)
> - return panel->funcs->disable(panel);
> + WARN_ON(panel->state != DRM_PANEL_POWER_ENABLED);
> +
> + if (panel && panel->funcs && panel->funcs->disable) {
> + int ret = panel->funcs->disable(panel);
> + if (!ret)
> + panel->state = DRM_PANEL_POWER_PREPARED;
> + return ret;
> + }
>  
>   return panel ? -ENOSYS : 

[Bug 103246] PoE: GPU hang with mesa >= 17.2.0 + gallium-nine

2017-10-12 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=103246

Bug ID: 103246
   Summary: PoE: GPU hang with mesa >= 17.2.0 + gallium-nine
   Product: Mesa
   Version: 17.2
  Hardware: x86-64 (AMD64)
OS: Linux (All)
Status: NEW
  Severity: major
  Priority: medium
 Component: Drivers/Gallium/radeonsi
  Assignee: dri-devel@lists.freedesktop.org
  Reporter: kmk3.b...@gmail.com
QA Contact: dri-devel@lists.freedesktop.org

Created attachment 134818
  --> https://bugs.freedesktop.org/attachment.cgi?id=134818=edit
Related packages info

General system info:
System information:
Wine build: wine-2.18 (Staging)
Platform: i386
Version: Windows 7
Host system: Linux
Host version: 4.13.5-1-MANJARO

GPU: R9 280X (GCN 1.0)
GPU driver: xf86-video-ati 1:7.10.0-1 (radeonsi)
DE: plasma-desktop 5.10.5-1
Game info: https://appdb.winehq.org/objectManager.php?sClass=version=30942
Game version: 3.0.1e (Steam)

# Overview
So, when using mesa 17.2+ with wine-staging-nine, the whole system crashes
when entering certain areas on PoE.

After trying to enter my Hideout in the game, the loading screen appears for a
few seconds (as usual), then a sound loop occurs for about 3 seconds, then
silence and the whole system is completely unresponsive.
The keyboard does not work and the monitor has no video output (blue screen).
Then, I just hard-reset the system.

Also, a few days ago, the game somehow crashed without bringing the whole
system down, it just showed a "game crashed" dialog box.

# Game-specific info
I tried to enter the affected areas from Highgate (Act 9), which seems to have
no major issues after wandering around a bit.
So far, it seems to crash on Sarn and the personal Hideout.
The only similarity that I can think of is the presence of Vagan and Vorici in
both areas.
But, AFAIK, it seems unlikely that characters textures would cause a GPU hang.

# Rambling
It is the exact same symptom (including the sound loop) that occured on my
6770m with Linux 3.13+, when I tried to run "startx" without setting
"radeon.dpm=0".

# Debug
The whole screen, including the terminal wine is launched from freezes, so I'm
unable to see if wine printed anything during/after the crash.
I tried setting MESA_DEBUG=1 and MESA_LOG_FILE, but nothing is ever written to
the log file (it is not even created).
I'm not sure if it is because everything really hangs, no mesa errors actually
occur or if I need to compile it with debug flags.
In the case of the latter, should I just follow this guide?
https://wiki.ixit.cz/d3d9_debugging

Also, I'm not really sure whether the problem is on mesa or gallium-nine.
If you know how to debug this, please leave a comment.

# Packages
After testing with different packages, the problem occurs only with
wine-staging-nine.
Tested on wine-staging-nine 2.16+ (2.16-2.18) and mesa 17.2.0+ (17.2.0-17.2.2).

Mesa < 17.2.0 has no problems with wine, wine-staging nor wine-staging-nine.
Wine + gallium-nine works well enough with mesa < 17.2.0.

Misc: At least on manjaro, mesa 17.1.8 depends on llvm 4.0 and mesa 17.2+
depends on llvm 5.0.
Not sure if the version could be related to the issue.

-- 
You are receiving this mail because:
You are the assignee for the bug.___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 1/2] drm: vblank: use ktime_t instead of timeval

2017-10-12 Thread Keith Packard
Arnd Bergmann  writes:

> Overall, this seems good enough, so my patch removes the use of
> 'timeval' from the vblank handling altogether and uses ktime_t
> consistently, except for the part where we copy the data to user
> space structures in the existing format.

This patch is better than the portion of my patch which does the same
thing as it uses the ktime APIs consistently and doesn't assume that
ktime_t is in ns. Thanks much!

Reviewed-by: Keith Packard 

-- 
-keith


signature.asc
Description: PGP signature
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH] staging: vboxvideo: Fix reporting invalid suggested-offset-properties

2017-10-12 Thread Hans de Goede
The x and y hints receives from the host are unsigned 32 bit integers and
they get set to -1 (0x) when invalid. Before this commit the
vboxvideo driver was storing them in an u16 causing the -1 to be truncated
to 65535 which, once reported to userspace, was breaking gnome 3.26+
in Wayland mode.

This commit stores the host values in 32 bit variables, removing the
truncation and checks for -1, replacing it with 0 as -1 is not a valid
suggested-offset-property value. Likewise the properties are now
initialized to 0 instead of -1, since -1 is not a valid value.
This fixes gnome 3.26+ in Wayland mode not working with the vboxvideo
driver.

Reported-by: Gianfranco Costamagna 
Cc: sta...@vger.kernel.org
Cc: Michael Thayer 
Signed-off-by: Hans de Goede 
---
 drivers/staging/vboxvideo/vbox_drv.h  |  8 
 drivers/staging/vboxvideo/vbox_irq.c  |  4 ++--
 drivers/staging/vboxvideo/vbox_mode.c | 26 ++
 3 files changed, 24 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/vboxvideo/vbox_drv.h 
b/drivers/staging/vboxvideo/vbox_drv.h
index 4b9302703b36..eeac4f0cb2c6 100644
--- a/drivers/staging/vboxvideo/vbox_drv.h
+++ b/drivers/staging/vboxvideo/vbox_drv.h
@@ -137,8 +137,8 @@ struct vbox_connector {
char name[32];
struct vbox_crtc *vbox_crtc;
struct {
-   u16 width;
-   u16 height;
+   u32 width;
+   u32 height;
bool disconnected;
} mode_hint;
 };
@@ -150,8 +150,8 @@ struct vbox_crtc {
unsigned int crtc_id;
u32 fb_offset;
bool cursor_enabled;
-   u16 x_hint;
-   u16 y_hint;
+   u32 x_hint;
+   u32 y_hint;
 };
 
 struct vbox_encoder {
diff --git a/drivers/staging/vboxvideo/vbox_irq.c 
b/drivers/staging/vboxvideo/vbox_irq.c
index 3ca8bec62ac4..74abdf02d9fd 100644
--- a/drivers/staging/vboxvideo/vbox_irq.c
+++ b/drivers/staging/vboxvideo/vbox_irq.c
@@ -150,8 +150,8 @@ static void vbox_update_mode_hints(struct vbox_private 
*vbox)
 
disconnected = !(hints->enabled);
crtc_id = vbox_conn->vbox_crtc->crtc_id;
-   vbox_conn->mode_hint.width = hints->cx & 0x8fff;
-   vbox_conn->mode_hint.height = hints->cy & 0x8fff;
+   vbox_conn->mode_hint.width = hints->cx;
+   vbox_conn->mode_hint.height = hints->cy;
vbox_conn->vbox_crtc->x_hint = hints->dx;
vbox_conn->vbox_crtc->y_hint = hints->dy;
vbox_conn->mode_hint.disconnected = disconnected;
diff --git a/drivers/staging/vboxvideo/vbox_mode.c 
b/drivers/staging/vboxvideo/vbox_mode.c
index 257a77830410..6f08dc966719 100644
--- a/drivers/staging/vboxvideo/vbox_mode.c
+++ b/drivers/staging/vboxvideo/vbox_mode.c
@@ -553,12 +553,22 @@ static int vbox_get_modes(struct drm_connector *connector)
++num_modes;
}
vbox_set_edid(connector, preferred_width, preferred_height);
-   drm_object_property_set_value(
-   >base, vbox->dev->mode_config.suggested_x_property,
-   vbox_connector->vbox_crtc->x_hint);
-   drm_object_property_set_value(
-   >base, vbox->dev->mode_config.suggested_y_property,
-   vbox_connector->vbox_crtc->y_hint);
+
+   if (vbox_connector->vbox_crtc->x_hint != -1)
+   drm_object_property_set_value(>base,
+   vbox->dev->mode_config.suggested_x_property,
+   vbox_connector->vbox_crtc->x_hint);
+   else
+   drm_object_property_set_value(>base,
+   vbox->dev->mode_config.suggested_x_property, 0);
+
+   if (vbox_connector->vbox_crtc->y_hint != -1)
+   drm_object_property_set_value(>base,
+   vbox->dev->mode_config.suggested_y_property,
+   vbox_connector->vbox_crtc->y_hint);
+   else
+   drm_object_property_set_value(>base,
+   vbox->dev->mode_config.suggested_y_property, 0);
 
return num_modes;
 }
@@ -640,9 +650,9 @@ static int vbox_connector_init(struct drm_device *dev,
 
drm_mode_create_suggested_offset_properties(dev);
drm_object_attach_property(>base,
-  dev->mode_config.suggested_x_property, -1);
+  dev->mode_config.suggested_x_property, 0);
drm_object_attach_property(>base,
-  dev->mode_config.suggested_y_property, -1);
+  dev->mode_config.suggested_y_property, 0);
drm_connector_register(connector);
 
drm_mode_connector_attach_encoder(connector, encoder);
-- 
2.14.2

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v2 10/10] drm/panel: ls043t1le01: Remove enabled/prepared state

2017-10-12 Thread Sean Paul
They're not necessary for atomic drivers, and drm_panel will
WARN if the calls are unbalanced

Signed-off-by: Sean Paul 
---
 drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c | 23 ---
 1 file changed, 23 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c 
b/drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c
index 3aeb0bda4947..8d7843248556 100644
--- a/drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c
+++ b/drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c
@@ -39,9 +39,6 @@ struct sharp_nt_panel {
struct regulator *supply;
struct gpio_desc *reset_gpio;
 
-   bool prepared;
-   bool enabled;
-
const struct drm_display_mode *mode;
 };
 
@@ -114,16 +111,11 @@ static int sharp_nt_panel_disable(struct drm_panel *panel)
 {
struct sharp_nt_panel *sharp_nt = to_sharp_nt_panel(panel);
 
-   if (!sharp_nt->enabled)
-   return 0;
-
if (sharp_nt->backlight) {
sharp_nt->backlight->props.power = FB_BLANK_POWERDOWN;
backlight_update_status(sharp_nt->backlight);
}
 
-   sharp_nt->enabled = false;
-
return 0;
 }
 
@@ -132,9 +124,6 @@ static int sharp_nt_panel_unprepare(struct drm_panel *panel)
struct sharp_nt_panel *sharp_nt = to_sharp_nt_panel(panel);
int ret;
 
-   if (!sharp_nt->prepared)
-   return 0;
-
ret = sharp_nt_panel_off(sharp_nt);
if (ret < 0) {
dev_err(panel->dev, "failed to set panel off: %d\n", ret);
@@ -145,8 +134,6 @@ static int sharp_nt_panel_unprepare(struct drm_panel *panel)
if (sharp_nt->reset_gpio)
gpiod_set_value(sharp_nt->reset_gpio, 0);
 
-   sharp_nt->prepared = false;
-
return 0;
 }
 
@@ -155,9 +142,6 @@ static int sharp_nt_panel_prepare(struct drm_panel *panel)
struct sharp_nt_panel *sharp_nt = to_sharp_nt_panel(panel);
int ret;
 
-   if (sharp_nt->prepared)
-   return 0;
-
ret = regulator_enable(sharp_nt->supply);
if (ret < 0)
return ret;
@@ -185,8 +169,6 @@ static int sharp_nt_panel_prepare(struct drm_panel *panel)
goto poweroff;
}
 
-   sharp_nt->prepared = true;
-
return 0;
 
 poweroff:
@@ -200,16 +182,11 @@ static int sharp_nt_panel_enable(struct drm_panel *panel)
 {
struct sharp_nt_panel *sharp_nt = to_sharp_nt_panel(panel);
 
-   if (sharp_nt->enabled)
-   return 0;
-
if (sharp_nt->backlight) {
sharp_nt->backlight->props.power = FB_BLANK_UNBLANK;
backlight_update_status(sharp_nt->backlight);
}
 
-   sharp_nt->enabled = true;
-
return 0;
 }
 
-- 
2.15.0.rc0.271.g36b669edcc-goog

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v2 09/10] drm/panel: p079zca: Remove enabled/prepared state

2017-10-12 Thread Sean Paul
They're not necessary for atomic drivers, and drm_panel will
WARN if the calls are unbalanced

Signed-off-by: Sean Paul 
---
 drivers/gpu/drm/panel/panel-innolux-p079zca.c | 23 ---
 1 file changed, 23 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-innolux-p079zca.c 
b/drivers/gpu/drm/panel/panel-innolux-p079zca.c
index 6ba93449fcfb..38b19c8de9e1 100644
--- a/drivers/gpu/drm/panel/panel-innolux-p079zca.c
+++ b/drivers/gpu/drm/panel/panel-innolux-p079zca.c
@@ -27,9 +27,6 @@ struct innolux_panel {
struct backlight_device *backlight;
struct regulator *supply;
struct gpio_desc *enable_gpio;
-
-   bool prepared;
-   bool enabled;
 };
 
 static inline struct innolux_panel *to_innolux_panel(struct drm_panel *panel)
@@ -42,9 +39,6 @@ static int innolux_panel_disable(struct drm_panel *panel)
struct innolux_panel *innolux = to_innolux_panel(panel);
int err;
 
-   if (!innolux->enabled)
-   return 0;
-
innolux->backlight->props.power = FB_BLANK_POWERDOWN;
backlight_update_status(innolux->backlight);
 
@@ -53,8 +47,6 @@ static int innolux_panel_disable(struct drm_panel *panel)
DRM_DEV_ERROR(panel->dev, "failed to set display off: %d\n",
  err);
 
-   innolux->enabled = false;
-
return 0;
 }
 
@@ -63,9 +55,6 @@ static int innolux_panel_unprepare(struct drm_panel *panel)
struct innolux_panel *innolux = to_innolux_panel(panel);
int err;
 
-   if (!innolux->prepared)
-   return 0;
-
err = mipi_dsi_dcs_enter_sleep_mode(innolux->link);
if (err < 0) {
DRM_DEV_ERROR(panel->dev, "failed to enter sleep mode: %d\n",
@@ -82,8 +71,6 @@ static int innolux_panel_unprepare(struct drm_panel *panel)
if (err < 0)
return err;
 
-   innolux->prepared = false;
-
return 0;
 }
 
@@ -92,9 +79,6 @@ static int innolux_panel_prepare(struct drm_panel *panel)
struct innolux_panel *innolux = to_innolux_panel(panel);
int err, regulator_err;
 
-   if (innolux->prepared)
-   return 0;
-
gpiod_set_value_cansleep(innolux->enable_gpio, 0);
 
err = regulator_enable(innolux->supply);
@@ -129,8 +113,6 @@ static int innolux_panel_prepare(struct drm_panel *panel)
/* T7: 5ms */
usleep_range(5000, 6000);
 
-   innolux->prepared = true;
-
return 0;
 
 poweroff:
@@ -148,9 +130,6 @@ static int innolux_panel_enable(struct drm_panel *panel)
struct innolux_panel *innolux = to_innolux_panel(panel);
int ret;
 
-   if (innolux->enabled)
-   return 0;
-
innolux->backlight->props.power = FB_BLANK_UNBLANK;
ret = backlight_update_status(innolux->backlight);
if (ret) {
@@ -159,8 +138,6 @@ static int innolux_panel_enable(struct drm_panel *panel)
return ret;
}
 
-   innolux->enabled = true;
-
return 0;
 }
 
-- 
2.15.0.rc0.271.g36b669edcc-goog

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v2 08/10] drm/panel: simple: Remove enabled/prepared state

2017-10-12 Thread Sean Paul
They're not necessary for atomic drivers, and drm_panel will
WARN if the calls are unbalanced

Signed-off-by: Sean Paul 
---
 drivers/gpu/drm/panel/panel-simple.c | 24 
 1 file changed, 24 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-simple.c 
b/drivers/gpu/drm/panel/panel-simple.c
index a3c96d2ea41c..0e1fbca811a0 100644
--- a/drivers/gpu/drm/panel/panel-simple.c
+++ b/drivers/gpu/drm/panel/panel-simple.c
@@ -77,8 +77,6 @@ struct panel_desc {
 
 struct panel_simple {
struct drm_panel base;
-   bool prepared;
-   bool enabled;
 
const struct panel_desc *desc;
 
@@ -163,9 +161,6 @@ static int panel_simple_disable(struct drm_panel *panel)
 {
struct panel_simple *p = to_panel_simple(panel);
 
-   if (!p->enabled)
-   return 0;
-
if (p->backlight) {
p->backlight->props.power = FB_BLANK_POWERDOWN;
p->backlight->props.state |= BL_CORE_FBBLANK;
@@ -175,8 +170,6 @@ static int panel_simple_disable(struct drm_panel *panel)
if (p->desc->delay.disable)
msleep(p->desc->delay.disable);
 
-   p->enabled = false;
-
return 0;
 }
 
@@ -184,9 +177,6 @@ static int panel_simple_unprepare(struct drm_panel *panel)
 {
struct panel_simple *p = to_panel_simple(panel);
 
-   if (!p->prepared)
-   return 0;
-
gpiod_set_value_cansleep(p->enable_gpio, 0);
 
regulator_disable(p->supply);
@@ -194,8 +184,6 @@ static int panel_simple_unprepare(struct drm_panel *panel)
if (p->desc->delay.unprepare)
msleep(p->desc->delay.unprepare);
 
-   p->prepared = false;
-
return 0;
 }
 
@@ -204,9 +192,6 @@ static int panel_simple_prepare(struct drm_panel *panel)
struct panel_simple *p = to_panel_simple(panel);
int err;
 
-   if (p->prepared)
-   return 0;
-
err = regulator_enable(p->supply);
if (err < 0) {
dev_err(panel->dev, "failed to enable supply: %d\n", err);
@@ -218,8 +203,6 @@ static int panel_simple_prepare(struct drm_panel *panel)
if (p->desc->delay.prepare)
msleep(p->desc->delay.prepare);
 
-   p->prepared = true;
-
return 0;
 }
 
@@ -227,9 +210,6 @@ static int panel_simple_enable(struct drm_panel *panel)
 {
struct panel_simple *p = to_panel_simple(panel);
 
-   if (p->enabled)
-   return 0;
-
if (p->desc->delay.enable)
msleep(p->desc->delay.enable);
 
@@ -239,8 +219,6 @@ static int panel_simple_enable(struct drm_panel *panel)
backlight_update_status(p->backlight);
}
 
-   p->enabled = true;
-
return 0;
 }
 
@@ -301,8 +279,6 @@ static int panel_simple_probe(struct device *dev, const 
struct panel_desc *desc)
if (!panel)
return -ENOMEM;
 
-   panel->enabled = false;
-   panel->prepared = false;
panel->desc = desc;
 
panel->supply = devm_regulator_get(dev, "power");
-- 
2.15.0.rc0.271.g36b669edcc-goog

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v2 07/10] drm/panel: 43wvf1g: Remove enabled/prepared state

2017-10-12 Thread Sean Paul
They're not necessary for atomic drivers, and drm_panel will
WARN if the calls are unbalanced

Signed-off-by: Sean Paul 
---
 drivers/gpu/drm/panel/panel-seiko-43wvf1g.c | 24 
 1 file changed, 24 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-seiko-43wvf1g.c 
b/drivers/gpu/drm/panel/panel-seiko-43wvf1g.c
index 71c09ed436ae..51785774efd1 100644
--- a/drivers/gpu/drm/panel/panel-seiko-43wvf1g.c
+++ b/drivers/gpu/drm/panel/panel-seiko-43wvf1g.c
@@ -44,8 +44,6 @@ struct seiko_panel_desc {
 
 struct seiko_panel {
struct drm_panel base;
-   bool prepared;
-   bool enabled;
const struct seiko_panel_desc *desc;
struct backlight_device *backlight;
struct regulator *dvdd;
@@ -126,17 +124,12 @@ static int seiko_panel_disable(struct drm_panel *panel)
 {
struct seiko_panel *p = to_seiko_panel(panel);
 
-   if (!p->enabled)
-   return 0;
-
if (p->backlight) {
p->backlight->props.power = FB_BLANK_POWERDOWN;
p->backlight->props.state |= BL_CORE_FBBLANK;
backlight_update_status(p->backlight);
}
 
-   p->enabled = false;
-
return 0;
 }
 
@@ -144,9 +137,6 @@ static int seiko_panel_unprepare(struct drm_panel *panel)
 {
struct seiko_panel *p = to_seiko_panel(panel);
 
-   if (!p->prepared)
-   return 0;
-
regulator_disable(p->avdd);
 
/* Add a 100ms delay as per the panel datasheet */
@@ -154,8 +144,6 @@ static int seiko_panel_unprepare(struct drm_panel *panel)
 
regulator_disable(p->dvdd);
 
-   p->prepared = false;
-
return 0;
 }
 
@@ -164,9 +152,6 @@ static int seiko_panel_prepare(struct drm_panel *panel)
struct seiko_panel *p = to_seiko_panel(panel);
int err;
 
-   if (p->prepared)
-   return 0;
-
err = regulator_enable(p->dvdd);
if (err < 0) {
dev_err(panel->dev, "failed to enable dvdd: %d\n", err);
@@ -182,8 +167,6 @@ static int seiko_panel_prepare(struct drm_panel *panel)
goto disable_dvdd;
}
 
-   p->prepared = true;
-
return 0;
 
 disable_dvdd:
@@ -195,17 +178,12 @@ static int seiko_panel_enable(struct drm_panel *panel)
 {
struct seiko_panel *p = to_seiko_panel(panel);
 
-   if (p->enabled)
-   return 0;
-
if (p->backlight) {
p->backlight->props.state &= ~BL_CORE_FBBLANK;
p->backlight->props.power = FB_BLANK_UNBLANK;
backlight_update_status(p->backlight);
}
 
-   p->enabled = true;
-
return 0;
 }
 
@@ -254,8 +232,6 @@ static int seiko_panel_probe(struct device *dev,
if (!panel)
return -ENOMEM;
 
-   panel->enabled = false;
-   panel->prepared = false;
panel->desc = desc;
 
panel->dvdd = devm_regulator_get(dev, "dvdd");
-- 
2.15.0.rc0.271.g36b669edcc-goog

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v2 06/10] drm/panel: otm8009a: Properly sequence [un]prepare with backlight

2017-10-12 Thread Sean Paul
I noticed while removing the enabled flag that backlight update checks
prepared in such a way that could race with hardware turning on/off.
This patch adds a mutex to ensure these races don't happen.

In addition to the lock, this patch also renames prepared to initialized
to better reflect what it means when used in the backlight hook.

Signed-off-by: Sean Paul 
---
 drivers/gpu/drm/panel/panel-orisetech-otm8009a.c | 43 
 1 file changed, 29 insertions(+), 14 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c 
b/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c
index 0a5898fd4502..d099af3c91df 100644
--- a/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c
+++ b/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c
@@ -11,6 +11,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #define DRV_NAME "orisetech_otm8009a"
@@ -62,7 +63,9 @@ struct otm8009a {
struct drm_panel panel;
struct backlight_device *bl_dev;
struct gpio_desc *reset_gpio;
-   bool prepared;
+
+   struct mutex lock;
+   bool initialized;
 };
 
 static const struct drm_display_mode default_mode = {
@@ -265,26 +268,30 @@ static int otm8009a_unprepare(struct drm_panel *panel)
 {
struct otm8009a *ctx = panel_to_otm8009a(panel);
 
-   if (!ctx->prepared)
-   return 0;
+   mutex_lock(>lock);
+   if (!ctx->initialized)
+   goto out;
 
if (ctx->reset_gpio) {
gpiod_set_value_cansleep(ctx->reset_gpio, 1);
msleep(20);
}
 
-   ctx->prepared = false;
+   ctx->initialized = false;
 
+out:
+   mutex_unlock(>lock);
return 0;
 }
 
 static int otm8009a_prepare(struct drm_panel *panel)
 {
struct otm8009a *ctx = panel_to_otm8009a(panel);
-   int ret;
+   int ret = 0;
 
-   if (ctx->prepared)
-   return 0;
+   mutex_lock(>lock);
+   if (ctx->initialized)
+   goto out;
 
if (ctx->reset_gpio) {
gpiod_set_value_cansleep(ctx->reset_gpio, 0);
@@ -296,18 +303,20 @@ static int otm8009a_prepare(struct drm_panel *panel)
 
ret = otm8009a_init_sequence(ctx);
if (ret)
-   return ret;
+   goto out;
 
-   ctx->prepared = true;
+   ctx->initialized = true;
 
/*
 * Power on the backlight. Note: end-user still controls brightness
-* Note: ctx->prepared must be true before updating the backlight.
+* Note: ctx->initialized must be true before updating the backlight.
 */
ctx->bl_dev->props.power = FB_BLANK_UNBLANK;
backlight_update_status(ctx->bl_dev);
 
-   return 0;
+out:
+   mutex_unlock(>lock);
+   return ret;
 }
 
 static int otm8009a_get_modes(struct drm_panel *panel)
@@ -348,10 +357,13 @@ static int otm8009a_backlight_update_status(struct 
backlight_device *bd)
 {
struct otm8009a *ctx = bl_get_data(bd);
u8 data[2];
+   int ret = 0;
 
-   if (!ctx->prepared) {
+   mutex_lock(>lock);
+   if (!ctx->initialized) {
DRM_DEBUG("lcd not ready yet for setting its backlight!\n");
-   return -ENXIO;
+   ret = -ENXIO;
+   goto out;
}
 
if (bd->props.power <= FB_BLANK_NORMAL) {
@@ -375,7 +387,9 @@ static int otm8009a_backlight_update_status(struct 
backlight_device *bd)
data[0] = MIPI_DCS_WRITE_CONTROL_DISPLAY;
otm8009a_dcs_write_buf(ctx, data, ARRAY_SIZE(data));
 
-   return 0;
+out:
+   mutex_unlock(>lock);
+   return ret;
 }
 
 static const struct backlight_ops otm8009a_backlight_ops = {
@@ -401,6 +415,7 @@ static int otm8009a_probe(struct mipi_dsi_device *dsi)
mipi_dsi_set_drvdata(dsi, ctx);
 
ctx->dev = dev;
+   mutex_init(>lock);
 
dsi->lanes = 2;
dsi->format = MIPI_DSI_FMT_RGB888;
-- 
2.15.0.rc0.271.g36b669edcc-goog

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v2 04/10] drm/panel: lq101r1sx01: Remove enabled/prepared state

2017-10-12 Thread Sean Paul
They're not necessary for atomic drivers, and drm_panel will
WARN if the calls are unbalanced.

Signed-off-by: Sean Paul 
---
 drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c | 23 ---
 1 file changed, 23 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c 
b/drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c
index 3cce3ca19601..9b447b0bfcd0 100644
--- a/drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c
+++ b/drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c
@@ -28,9 +28,6 @@ struct sharp_panel {
struct backlight_device *backlight;
struct regulator *supply;
 
-   bool prepared;
-   bool enabled;
-
const struct drm_display_mode *mode;
 };
 
@@ -93,16 +90,11 @@ static int sharp_panel_disable(struct drm_panel *panel)
 {
struct sharp_panel *sharp = to_sharp_panel(panel);
 
-   if (!sharp->enabled)
-   return 0;
-
if (sharp->backlight) {
sharp->backlight->props.power = FB_BLANK_POWERDOWN;
backlight_update_status(sharp->backlight);
}
 
-   sharp->enabled = false;
-
return 0;
 }
 
@@ -111,9 +103,6 @@ static int sharp_panel_unprepare(struct drm_panel *panel)
struct sharp_panel *sharp = to_sharp_panel(panel);
int err;
 
-   if (!sharp->prepared)
-   return 0;
-
sharp_wait_frames(sharp, 4);
 
err = mipi_dsi_dcs_set_display_off(sharp->link1);
@@ -128,8 +117,6 @@ static int sharp_panel_unprepare(struct drm_panel *panel)
 
regulator_disable(sharp->supply);
 
-   sharp->prepared = false;
-
return 0;
 }
 
@@ -173,9 +160,6 @@ static int sharp_panel_prepare(struct drm_panel *panel)
u8 format = MIPI_DCS_PIXEL_FMT_24BIT;
int err;
 
-   if (sharp->prepared)
-   return 0;
-
err = regulator_enable(sharp->supply);
if (err < 0)
return err;
@@ -244,8 +228,6 @@ static int sharp_panel_prepare(struct drm_panel *panel)
goto poweroff;
}
 
-   sharp->prepared = true;
-
/* wait for 6 frames before continuing */
sharp_wait_frames(sharp, 6);
 
@@ -260,16 +242,11 @@ static int sharp_panel_enable(struct drm_panel *panel)
 {
struct sharp_panel *sharp = to_sharp_panel(panel);
 
-   if (sharp->enabled)
-   return 0;
-
if (sharp->backlight) {
sharp->backlight->props.power = FB_BLANK_UNBLANK;
backlight_update_status(sharp->backlight);
}
 
-   sharp->enabled = true;
-
return 0;
 }
 
-- 
2.15.0.rc0.271.g36b669edcc-goog

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v2 05/10] drm/panel: otm8009a: Remove enabled state

2017-10-12 Thread Sean Paul
It's not necessary for atomic drivers, and drm_panel will
WARN if the calls are unbalanced.

Signed-off-by: Sean Paul 
---
 drivers/gpu/drm/panel/panel-orisetech-otm8009a.c | 16 
 1 file changed, 16 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c 
b/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c
index c189cd6329c8..0a5898fd4502 100644
--- a/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c
+++ b/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c
@@ -63,7 +63,6 @@ struct otm8009a {
struct backlight_device *bl_dev;
struct gpio_desc *reset_gpio;
bool prepared;
-   bool enabled;
 };
 
 static const struct drm_display_mode default_mode = {
@@ -243,9 +242,6 @@ static int otm8009a_disable(struct drm_panel *panel)
struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev);
int ret;
 
-   if (!ctx->enabled)
-   return 0; /* This is not an issue so we return 0 here */
-
/* Power off the backlight. Note: end-user still controls brightness */
ctx->bl_dev->props.power = FB_BLANK_POWERDOWN;
ret = backlight_update_status(ctx->bl_dev);
@@ -262,8 +258,6 @@ static int otm8009a_disable(struct drm_panel *panel)
 
msleep(120);
 
-   ctx->enabled = false;
-
return 0;
 }
 
@@ -316,15 +310,6 @@ static int otm8009a_prepare(struct drm_panel *panel)
return 0;
 }
 
-static int otm8009a_enable(struct drm_panel *panel)
-{
-   struct otm8009a *ctx = panel_to_otm8009a(panel);
-
-   ctx->enabled = true;
-
-   return 0;
-}
-
 static int otm8009a_get_modes(struct drm_panel *panel)
 {
struct drm_display_mode *mode;
@@ -352,7 +337,6 @@ static const struct drm_panel_funcs otm8009a_drm_funcs = {
.disable   = otm8009a_disable,
.unprepare = otm8009a_unprepare,
.prepare   = otm8009a_prepare,
-   .enable= otm8009a_enable,
.get_modes = otm8009a_get_modes,
 };
 
-- 
2.15.0.rc0.271.g36b669edcc-goog

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v2 03/10] drm/panel: lt070me05000: Remove enabled/prepared state

2017-10-12 Thread Sean Paul
They're not necessary for atomic drivers, and drm_panel will
WARN if the calls are unbalanced.

Signed-off-by: Sean Paul 
---
 drivers/gpu/drm/panel/panel-jdi-lt070me05000.c | 23 ---
 1 file changed, 23 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c 
b/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c
index 5b2340ef74ed..2f2455650258 100644
--- a/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c
+++ b/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c
@@ -50,9 +50,6 @@ struct jdi_panel {
struct gpio_desc *dcdc_en_gpio;
struct backlight_device *backlight;
 
-   bool prepared;
-   bool enabled;
-
const struct drm_display_mode *mode;
 };
 
@@ -189,14 +186,9 @@ static int jdi_panel_disable(struct drm_panel *panel)
 {
struct jdi_panel *jdi = to_jdi_panel(panel);
 
-   if (!jdi->enabled)
-   return 0;
-
jdi->backlight->props.power = FB_BLANK_POWERDOWN;
backlight_update_status(jdi->backlight);
 
-   jdi->enabled = false;
-
return 0;
 }
 
@@ -206,9 +198,6 @@ static int jdi_panel_unprepare(struct drm_panel *panel)
struct device *dev = >dsi->dev;
int ret;
 
-   if (!jdi->prepared)
-   return 0;
-
jdi_panel_off(jdi);
 
ret = regulator_bulk_disable(ARRAY_SIZE(jdi->supplies), jdi->supplies);
@@ -221,8 +210,6 @@ static int jdi_panel_unprepare(struct drm_panel *panel)
 
gpiod_set_value(jdi->dcdc_en_gpio, 0);
 
-   jdi->prepared = false;
-
return 0;
 }
 
@@ -232,9 +219,6 @@ static int jdi_panel_prepare(struct drm_panel *panel)
struct device *dev = >dsi->dev;
int ret;
 
-   if (jdi->prepared)
-   return 0;
-
ret = regulator_bulk_enable(ARRAY_SIZE(jdi->supplies), jdi->supplies);
if (ret < 0) {
dev_err(dev, "regulator enable failed, %d\n", ret);
@@ -264,8 +248,6 @@ static int jdi_panel_prepare(struct drm_panel *panel)
goto poweroff;
}
 
-   jdi->prepared = true;
-
return 0;
 
 poweroff:
@@ -286,14 +268,9 @@ static int jdi_panel_enable(struct drm_panel *panel)
 {
struct jdi_panel *jdi = to_jdi_panel(panel);
 
-   if (jdi->enabled)
-   return 0;
-
jdi->backlight->props.power = FB_BLANK_UNBLANK;
backlight_update_status(jdi->backlight);
 
-   jdi->enabled = true;
-
return 0;
 }
 
-- 
2.15.0.rc0.271.g36b669edcc-goog

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v2 02/10] drm/panel: vvx10f034n00: Remove enabled/prepared state

2017-10-12 Thread Sean Paul
They're not necessary for atomic drivers, and drm_panel will WARN if
the calls are unbalanced.

Signed-off-by: Sean Paul 
---
 .../gpu/drm/panel/panel-panasonic-vvx10f034n00.c   | 22 --
 1 file changed, 22 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-panasonic-vvx10f034n00.c 
b/drivers/gpu/drm/panel/panel-panasonic-vvx10f034n00.c
index 7f915f706fa6..e7efa097151c 100644
--- a/drivers/gpu/drm/panel/panel-panasonic-vvx10f034n00.c
+++ b/drivers/gpu/drm/panel/panel-panasonic-vvx10f034n00.c
@@ -44,9 +44,6 @@ struct wuxga_nt_panel {
struct backlight_device *backlight;
struct regulator *supply;
 
-   bool prepared;
-   bool enabled;
-
ktime_t earliest_wake;
 
const struct drm_display_mode *mode;
@@ -73,9 +70,6 @@ static int wuxga_nt_panel_disable(struct drm_panel *panel)
 {
struct wuxga_nt_panel *wuxga_nt = to_wuxga_nt_panel(panel);
 
-   if (!wuxga_nt->enabled)
-   return 0;
-
mipi_dsi_shutdown_peripheral(wuxga_nt->dsi);
 
if (wuxga_nt->backlight) {
@@ -84,8 +78,6 @@ static int wuxga_nt_panel_disable(struct drm_panel *panel)
backlight_update_status(wuxga_nt->backlight);
}
 
-   wuxga_nt->enabled = false;
-
return 0;
 }
 
@@ -93,12 +85,8 @@ static int wuxga_nt_panel_unprepare(struct drm_panel *panel)
 {
struct wuxga_nt_panel *wuxga_nt = to_wuxga_nt_panel(panel);
 
-   if (!wuxga_nt->prepared)
-   return 0;
-
regulator_disable(wuxga_nt->supply);
wuxga_nt->earliest_wake = ktime_add_ms(ktime_get_real(), MIN_POFF_MS);
-   wuxga_nt->prepared = false;
 
return 0;
 }
@@ -109,9 +97,6 @@ static int wuxga_nt_panel_prepare(struct drm_panel *panel)
int ret;
s64 enablewait;
 
-   if (wuxga_nt->prepared)
-   return 0;
-
/*
 * If the user re-enabled the panel before the required off-time then
 * we need to wait the remaining period before re-enabling regulator
@@ -141,8 +126,6 @@ static int wuxga_nt_panel_prepare(struct drm_panel *panel)
goto poweroff;
}
 
-   wuxga_nt->prepared = true;
-
return 0;
 
 poweroff:
@@ -155,17 +138,12 @@ static int wuxga_nt_panel_enable(struct drm_panel *panel)
 {
struct wuxga_nt_panel *wuxga_nt = to_wuxga_nt_panel(panel);
 
-   if (wuxga_nt->enabled)
-   return 0;
-
if (wuxga_nt->backlight) {
wuxga_nt->backlight->props.power = FB_BLANK_UNBLANK;
wuxga_nt->backlight->props.state &= ~BL_CORE_FBBLANK;
backlight_update_status(wuxga_nt->backlight);
}
 
-   wuxga_nt->enabled = true;
-
return 0;
 }
 
-- 
2.15.0.rc0.271.g36b669edcc-goog

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v2 01/10] drm/panel: Keep track of enabled/prepared

2017-10-12 Thread Sean Paul
This patch adds state tracking to the drm_panel functions which keep
track of enabled and prepared. If the calls are unbalanced, a WARNING is
issued.

The motivation for this change is that a number of panel drivers
(including panel-simple) all do this to protect their regulator
refcounts. The atomic framework ensures the calls are balanced, and
there  aren't any panel drivers being used by legacy drivers. As such,
these checks are useless, but let's add a WARNING just in case something
crazy happens (like a legacy driver using a panel).

Less code == better.

Changes in v2:
 - Reduced enabled/prepared bools to one enum (Andrzej)
 - Don't update state if the operation fails (Andrzej)
 - Issue warning even if operation is not implemented

Cc: Andrzej Hajda 
Signed-off-by: Sean Paul 
---
 drivers/gpu/drm/drm_panel.c |  1 +
 include/drm/drm_panel.h | 60 +++--
 2 files changed, 53 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/drm_panel.c b/drivers/gpu/drm/drm_panel.c
index 308d442a531b..e5957e7da768 100644
--- a/drivers/gpu/drm/drm_panel.c
+++ b/drivers/gpu/drm/drm_panel.c
@@ -48,6 +48,7 @@ static LIST_HEAD(panel_list);
 void drm_panel_init(struct drm_panel *panel)
 {
INIT_LIST_HEAD(>list);
+   panel->state = DRM_PANEL_POWER_OFF;
 }
 EXPORT_SYMBOL(drm_panel_init);
 
diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h
index 14ac240a1f64..425461c4c574 100644
--- a/include/drm/drm_panel.h
+++ b/include/drm/drm_panel.h
@@ -24,6 +24,7 @@
 #ifndef __DRM_PANEL_H__
 #define __DRM_PANEL_H__
 
+#include 
 #include 
 #include 
 
@@ -84,6 +85,7 @@ struct drm_panel_funcs {
  * @dev: parent device of the panel
  * @funcs: operations that can be performed on the panel
  * @list: panel entry in registry
+ * @power_state: keeps track of the panel power status
  */
 struct drm_panel {
struct drm_device *drm;
@@ -93,6 +95,12 @@ struct drm_panel {
const struct drm_panel_funcs *funcs;
 
struct list_head list;
+
+   enum {
+   DRM_PANEL_POWER_OFF,
+   DRM_PANEL_POWER_PREPARED,
+   DRM_PANEL_POWER_ENABLED
+   } state;
 };
 
 /**
@@ -104,12 +112,21 @@ struct drm_panel {
  * is usually no longer possible to communicate with the panel until another
  * call to drm_panel_prepare().
  *
+ * Atomic framework should ensure that prepare/unprepare are properly balanced.
+ * If this is not the case, a WARNING will be issued.
+ *
  * Return: 0 on success or a negative error code on failure.
  */
 static inline int drm_panel_unprepare(struct drm_panel *panel)
 {
-   if (panel && panel->funcs && panel->funcs->unprepare)
-   return panel->funcs->unprepare(panel);
+   WARN_ON(panel->state != DRM_PANEL_POWER_PREPARED);
+
+   if (panel && panel->funcs && panel->funcs->unprepare) {
+   int ret = panel->funcs->unprepare(panel);
+   if (!ret)
+   panel->state = DRM_PANEL_POWER_OFF;
+   return ret;
+   }
 
return panel ? -ENOSYS : -EINVAL;
 }
@@ -122,12 +139,21 @@ static inline int drm_panel_unprepare(struct drm_panel 
*panel)
  * drivers. For smart panels it should still be possible to communicate with
  * the integrated circuitry via any command bus after this call.
  *
+ * Atomic framework should ensure that enable/disable are properly balanced.
+ * If this is not the case, a WARNING will be issued.
+ *
  * Return: 0 on success or a negative error code on failure.
  */
 static inline int drm_panel_disable(struct drm_panel *panel)
 {
-   if (panel && panel->funcs && panel->funcs->disable)
-   return panel->funcs->disable(panel);
+   WARN_ON(panel->state != DRM_PANEL_POWER_ENABLED);
+
+   if (panel && panel->funcs && panel->funcs->disable) {
+   int ret = panel->funcs->disable(panel);
+   if (!ret)
+   panel->state = DRM_PANEL_POWER_PREPARED;
+   return ret;
+   }
 
return panel ? -ENOSYS : -EINVAL;
 }
@@ -140,12 +166,21 @@ static inline int drm_panel_disable(struct drm_panel 
*panel)
  * the panel. After this has completed it is possible to communicate with any
  * integrated circuitry via a command bus.
  *
+ * Atomic framework should ensure that prepare/unprepare are properly balanced.
+ * If this is not the case, a WARNING will be issued.
+ *
  * Return: 0 on success or a negative error code on failure.
  */
 static inline int drm_panel_prepare(struct drm_panel *panel)
 {
-   if (panel && panel->funcs && panel->funcs->prepare)
-   return panel->funcs->prepare(panel);
+   WARN_ON(panel->state != DRM_PANEL_POWER_OFF);
+
+   if (panel && panel->funcs && panel->funcs->prepare) {
+   int ret = panel->funcs->prepare(panel);
+   if (!ret)
+   panel->state = DRM_PANEL_POWER_PREPARED;
+   return ret;
+   

[PATCH v2 00/10] drm/panel: Remove unnecessary enabled/prepared state

2017-10-12 Thread Sean Paul
A number of panel drivers track enabled/prepared state (I suspect to protect
regulator refcounts). However, the atomic framework already ensures that
prepare/unprepare and enable/disable calls are balanced. This series removes all
independent tracking from the drivers and adds a WARNING to the core in case
someone uses a panel with a legacy driver.

Changes in v2:
- Addressed review comments in first patch
- Since the initial set didn't get much action, this is a partial RESEND


Sean Paul (10):
  drm/panel: Keep track of enabled/prepared
  drm/panel: vvx10f034n00: Remove enabled/prepared state
  drm/panel: lt070me05000: Remove enabled/prepared state
  drm/panel: lq101r1sx01: Remove enabled/prepared state
  drm/panel: otm8009a: Remove enabled state
  drm/panel: otm8009a: Properly sequence [un]prepare with backlight
  drm/panel: 43wvf1g: Remove enabled/prepared state
  drm/panel: simple: Remove enabled/prepared state
  drm/panel: p079zca: Remove enabled/prepared state
  drm/panel: ls043t1le01: Remove enabled/prepared state

 drivers/gpu/drm/drm_panel.c|  1 +
 drivers/gpu/drm/panel/panel-innolux-p079zca.c  | 23 -
 drivers/gpu/drm/panel/panel-jdi-lt070me05000.c | 23 -
 drivers/gpu/drm/panel/panel-orisetech-otm8009a.c   | 59 +++--
 .../gpu/drm/panel/panel-panasonic-vvx10f034n00.c   | 22 
 drivers/gpu/drm/panel/panel-seiko-43wvf1g.c| 24 -
 drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c| 23 -
 drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c| 23 -
 drivers/gpu/drm/panel/panel-simple.c   | 24 -
 include/drm/drm_panel.h| 60 +++---
 10 files changed, 82 insertions(+), 200 deletions(-)

-- 
2.15.0.rc0.271.g36b669edcc-goog

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [Nouveau] [PATCH 03/10] driver:gpu: return -ENOMEM on allocation failure.

2017-10-12 Thread Daniel Vetter
On Wed, Sep 13, 2017 at 01:02:12PM +0530, Allen Pais wrote:
> Signed-off-by: Allen Pais 

Applied to drm-misc-next, thanks.
-Daniel

> ---
>  drivers/gpu/drm/gma500/mid_bios.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/gma500/mid_bios.c 
> b/drivers/gpu/drm/gma500/mid_bios.c
> index d75ecb3..1fa1633 100644
> --- a/drivers/gpu/drm/gma500/mid_bios.c
> +++ b/drivers/gpu/drm/gma500/mid_bios.c
> @@ -237,7 +237,7 @@ static int mid_get_vbt_data_r10(struct drm_psb_private 
> *dev_priv, u32 addr)
>  
>   gct = kmalloc(sizeof(*gct) * vbt.panel_count, GFP_KERNEL);
>   if (!gct)
> - return -1;
> + return -ENOMEM;
>  
>   gct_virtual = ioremap(addr + sizeof(vbt),
>   sizeof(*gct) * vbt.panel_count);
> -- 
> 2.7.4
> 
> ___
> Nouveau mailing list
> nouv...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/nouveau

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


Re: [pull] amdgpu drm-fixes-4.14

2017-10-12 Thread Alex Deucher
On Thu, Oct 12, 2017 at 1:02 PM, Christian König
 wrote:
> Am 12.10.2017 um 18:20 schrieb Michel Dänzer:
>>
>> On 12/10/17 05:58 PM, Alex Deucher wrote:
>>>
>>> Hi Dave,
>>>
>>> One memory management regression fix.
>>>
>>> The following changes since commit
>>> 545036a9944e9d6e50fed4ca03117147c880ff71:
>>>
>>>Merge tag 'drm-misc-fixes-2017-10-11' of
>>> git://anongit.freedesktop.org/drm/drm-misc into drm-fixes (2017-10-12
>>> 10:38:09 +1000)
>>>
>>> are available in the git repository at:
>>>
>>>git://people.freedesktop.org/~agd5f/linux drm-fixes-4.14
>>>
>>> for you to fetch changes up to 27b94b4f1386c3a8181f5a0277434a32e24e7dd7:
>>>
>>>drm/amdgpu: fix placement flags in amdgpu_ttm_bind (2017-10-12
>>> 10:34:42 -0400)
>>>
>>> 
>>> Christian König (1):
>>>drm/amdgpu: fix placement flags in amdgpu_ttm_bind
>>
>> Thanks Alex, but there's another piglit hang regression in 4.14, caused
>> by commit 6af0883ed977 "drm/amdgpu: discard commands of killed
>> processes", fixed by five commits 6b37d03280a4..318d85de9c20 in
>> amd-staging-drm-next. Either the latter need to be backported to 4.14,
>> or the former needs to be reverted from it.
>
>
> The revert is probably easier to handle at this point.
>
> So to answer your question from the other thread I vote for that.

Nicolai's patches apply cleanly and I think they change about the same
amount of code and we don't have to worry about any problems down the
road when the revert gets merged into drm-next.

Alex
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH] drm/ttm: fix the fix for huge compound pages

2017-10-12 Thread Christian König
From: Christian König 

We don't use compound pages at the moment. Take this into account when
freeing them.

Signed-off-by: Christian König 
---
 drivers/gpu/drm/ttm/ttm_page_alloc.c | 21 -
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc.c 
b/drivers/gpu/drm/ttm/ttm_page_alloc.c
index b6f16e73..c3be50f41461 100644
--- a/drivers/gpu/drm/ttm/ttm_page_alloc.c
+++ b/drivers/gpu/drm/ttm/ttm_page_alloc.c
@@ -731,22 +731,33 @@ static void ttm_put_pages(struct page **pages, unsigned 
npages, int flags,
/* No pool for this memory type so free the pages */
i = 0;
while (i < npages) {
-   unsigned order;
+#ifdef CONFIG_TRANSPARENT_HUGEPAGE
+   struct page *p = pages[i];
+#endif
+   unsigned order = 0, j;
 
if (!pages[i]) {
++i;
continue;
}
 
+#ifdef CONFIG_TRANSPARENT_HUGEPAGE
+   for (j = 0; j < HPAGE_PMD_NR; ++j)
+   if (p++ != pages[i + j])
+   break;
+
+   if (j == HPAGE_PMD_NR)
+   order = HPAGE_PMD_ORDER;
+#endif
+
if (page_count(pages[i]) != 1)
pr_err("Erroneous page count. Leaking 
pages.\n");
-   order = compound_order(pages[i]);
__free_pages(pages[i], order);
 
-   order = 1 << order;
-   while (order) {
+   j = 1 << order;
+   while (j) {
pages[i++] = NULL;
-   --order;
+   --j;
}
}
return;
-- 
2.11.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [pull] amdgpu drm-fixes-4.14

2017-10-12 Thread Christian König

Am 12.10.2017 um 18:20 schrieb Michel Dänzer:

On 12/10/17 05:58 PM, Alex Deucher wrote:

Hi Dave,

One memory management regression fix.

The following changes since commit 545036a9944e9d6e50fed4ca03117147c880ff71:

   Merge tag 'drm-misc-fixes-2017-10-11' of 
git://anongit.freedesktop.org/drm/drm-misc into drm-fixes (2017-10-12 10:38:09 
+1000)

are available in the git repository at:

   git://people.freedesktop.org/~agd5f/linux drm-fixes-4.14

for you to fetch changes up to 27b94b4f1386c3a8181f5a0277434a32e24e7dd7:

   drm/amdgpu: fix placement flags in amdgpu_ttm_bind (2017-10-12 10:34:42 
-0400)


Christian König (1):
   drm/amdgpu: fix placement flags in amdgpu_ttm_bind

Thanks Alex, but there's another piglit hang regression in 4.14, caused
by commit 6af0883ed977 "drm/amdgpu: discard commands of killed
processes", fixed by five commits 6b37d03280a4..318d85de9c20 in
amd-staging-drm-next. Either the latter need to be backported to 4.14,
or the former needs to be reverted from it.


The revert is probably easier to handle at this point.

So to answer your question from the other thread I vote for that.

Christian.

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


RE: [pull] amdgpu drm-fixes-4.14

2017-10-12 Thread Deucher, Alexander
> -Original Message-
> From: Michel Dänzer [mailto:mic...@daenzer.net]
> Sent: Thursday, October 12, 2017 12:21 PM
> To: Alex Deucher
> Cc: amd-...@lists.freedesktop.org; dri-devel@lists.freedesktop.org;
> airl...@gmail.com; Deucher, Alexander
> Subject: Re: [pull] amdgpu drm-fixes-4.14
> 
> On 12/10/17 05:58 PM, Alex Deucher wrote:
> > Hi Dave,
> >
> > One memory management regression fix.
> >
> > The following changes since commit
> 545036a9944e9d6e50fed4ca03117147c880ff71:
> >
> >   Merge tag 'drm-misc-fixes-2017-10-11' of
> git://anongit.freedesktop.org/drm/drm-misc into drm-fixes (2017-10-12
> 10:38:09 +1000)
> >
> > are available in the git repository at:
> >
> >   git://people.freedesktop.org/~agd5f/linux drm-fixes-4.14
> >
> > for you to fetch changes up to
> 27b94b4f1386c3a8181f5a0277434a32e24e7dd7:
> >
> >   drm/amdgpu: fix placement flags in amdgpu_ttm_bind (2017-10-12
> 10:34:42 -0400)
> >
> > 
> > Christian König (1):
> >   drm/amdgpu: fix placement flags in amdgpu_ttm_bind
> 
> Thanks Alex, but there's another piglit hang regression in 4.14, caused
> by commit 6af0883ed977 "drm/amdgpu: discard commands of killed
> processes", fixed by five commits 6b37d03280a4..318d85de9c20 in
> amd-staging-drm-next. Either the latter need to be backported to 4.14,
> or the former needs to be reverted from it.

Sorting that out seemed like more effort, so I opted to just send this out.  
Once we get that fixed up, I can send another fixes pull.

Alex

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v12 3/3] drm/tinydrm: Add devres versions of backlight_get

2017-10-12 Thread Noralf Trønnes


Den 12.10.2017 17.57, skrev Meghana Madhyastha:

Add devm_backlight_get and the corresponding release
function because some drivers use devres versions of functions
for requiring device resources.

Signed-off-by: Meghana Madhyastha 
---
Changes in v12:
  -Move backlight_put() to the patch 2/3 from patch 3/3.

  drivers/gpu/drm/tinydrm/mi0283qt.c  |  2 +-
  drivers/video/backlight/backlight.c | 25 +
  include/linux/backlight.h   | 16 
  3 files changed, 42 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/tinydrm/mi0283qt.c 
b/drivers/gpu/drm/tinydrm/mi0283qt.c
index edf9502..03fec36 100644
--- a/drivers/gpu/drm/tinydrm/mi0283qt.c
+++ b/drivers/gpu/drm/tinydrm/mi0283qt.c
@@ -190,7 +190,7 @@ static int mi0283qt_probe(struct spi_device *spi)
if (IS_ERR(mipi->regulator))
return PTR_ERR(mipi->regulator);
  
-	mipi->backlight = backlight_get(dev);

+   mipi->backlight = devm_backlight_get(dev);
if (IS_ERR(mipi->backlight))
return PTR_ERR(mipi->backlight);
  
diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c

index f3e95b3..3663f26 100644
--- a/drivers/video/backlight/backlight.c
+++ b/drivers/video/backlight/backlight.c
@@ -623,6 +623,31 @@ static inline void backlight_put(struct backlight_device 
*bd)
put_device(>dev);
  }
  
+/**

+ ** devm_backlight_get - Resource-managed backlight_get()
+ ** @dev: Device
+ **
+ ** Device managed version of backlight_get(). The reference on the backlight
+ ** device is automatically dropped on driver detach.
+ **/
+struct backlight_device *devm_backlight_get(struct device *dev)
+{
+   struct backlight_device *bd;
+   int ret;
+
+   bd = backlight_get(dev);
+   if (!bd)
+   return NULL;
+   ret = devm_add_action(dev, devm_backlight_get_release, bd);


How can this even compile? Where is devm_backlight_get_release?
Or didn't it change name to devm_backlight_put or something?


+   if (ret) {
+   backlight_put(bd);
+   return ERR_PTR(ret);
+   }
+
+   return bd;
+}
+EXPORT_SYMBOL(devm_backlight_get);
+
  static void __exit backlight_class_exit(void)
  {
class_destroy(backlight_class);
diff --git a/include/linux/backlight.h b/include/linux/backlight.h
index 1d713b3..0bfadb6 100644
--- a/include/linux/backlight.h
+++ b/include/linux/backlight.h
@@ -183,6 +183,16 @@ static inline int backlight_disable(struct 
backlight_device *bd)
return backlight_update_status(bd);
  }
  
+/**

+ ** backlight_put - Drop backlight reference
+ ** @bd: the backlight device to put
+ **/
+static inline void backlight_put(struct backlight_device *bd)
+{
+   if (bd)
+   put_device(>dev);
+}
+


This is the one that should be moved to to previous patch.


  struct generic_bl_info {
const char *name;
int max_intensity;
@@ -204,11 +214,17 @@ of_find_backlight_by_node(struct device_node *node)
  
  #if IS_ENABLED(CONFIG_BACKLIGHT_CLASS_DEVICE)

  struct backlight_device *backlight_get(struct device *dev);
+struct backlight_device *devm_backlight_get(struct device *dev);
  #else
  static inline struct backlight_device *backlight_get(struct device *dev)
  {
return NULL;
  }
+
+static inline struct backlight_device *devm_backlight_get(struct device *dev)
+{
+   return NULL;
+}
  #endif
  
  #endif


___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v12 2/3] drm/tinydrm: Move tinydrm_of_find_backlight to backlight.c

2017-10-12 Thread Noralf Trønnes


Den 12.10.2017 17.50, skrev Meghana Madhyastha:

Rename tinydrm_of_find_backlight to backlight_get and move it
to linux/backlight.c so that it can be used by other drivers.

Signed-off-by: Meghana Madhyastha 
---
Changes in v12:
  -Move backlight_put() to the patch 2/3 from patch 3/3.
  -Remove #if IS_ENABLED(CONFIG_BACKLIGHT_CLASS_DEVICE)..#endif
   because the file is not built if it isn't enabled

  drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c | 40 
  drivers/gpu/drm/tinydrm/mi0283qt.c |  3 +-
  drivers/video/backlight/backlight.c| 43 ++
  include/drm/tinydrm/tinydrm-helpers.h  |  3 --
  include/linux/backlight.h  |  9 ++
  5 files changed, 54 insertions(+), 44 deletions(-)

diff --git a/drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c 
b/drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c
index a42dee6..cb1a01a 100644
--- a/drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c
+++ b/drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c
@@ -236,46 +236,6 @@ void tinydrm_xrgb_to_gray8(u8 *dst, void *vaddr, 
struct drm_framebuffer *fb,
  }
  EXPORT_SYMBOL(tinydrm_xrgb_to_gray8);
  
-/**

- * tinydrm_of_find_backlight - Find backlight device in device-tree
- * @dev: Device
- *
- * This function looks for a DT node pointed to by a property named 'backlight'
- * and uses of_find_backlight_by_node() to get the backlight device.
- * Additionally if the brightness property is zero, it is set to
- * max_brightness.
- *
- * Returns:
- * NULL if there's no backlight property.
- * Error pointer -EPROBE_DEFER if the DT node is found, but no backlight device
- * is found.
- * If the backlight device is found, a pointer to the structure is returned.
- */
-struct backlight_device *tinydrm_of_find_backlight(struct device *dev)
-{
-   struct backlight_device *backlight;
-   struct device_node *np;
-
-   np = of_parse_phandle(dev->of_node, "backlight", 0);
-   if (!np)
-   return NULL;
-
-   backlight = of_find_backlight_by_node(np);
-   of_node_put(np);
-
-   if (!backlight)
-   return ERR_PTR(-EPROBE_DEFER);
-
-   if (!backlight->props.brightness) {
-   backlight->props.brightness = backlight->props.max_brightness;
-   DRM_DEBUG_KMS("Backlight brightness set to %d\n",
- backlight->props.brightness);
-   }
-
-   return backlight;
-}
-EXPORT_SYMBOL(tinydrm_of_find_backlight);
-
  #if IS_ENABLED(CONFIG_SPI)
  
  /**

diff --git a/drivers/gpu/drm/tinydrm/mi0283qt.c 
b/drivers/gpu/drm/tinydrm/mi0283qt.c
index 7e5bb7d..edf9502 100644
--- a/drivers/gpu/drm/tinydrm/mi0283qt.c
+++ b/drivers/gpu/drm/tinydrm/mi0283qt.c
@@ -12,6 +12,7 @@
  #include 
  #include 
  #include 
+#include 
  #include 
  #include 
  #include 
@@ -189,7 +190,7 @@ static int mi0283qt_probe(struct spi_device *spi)
if (IS_ERR(mipi->regulator))
return PTR_ERR(mipi->regulator);
  
-	mipi->backlight = tinydrm_of_find_backlight(dev);

+   mipi->backlight = backlight_get(dev);
if (IS_ERR(mipi->backlight))
return PTR_ERR(mipi->backlight);
  
diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c

index 8049e76..f3e95b3 100644
--- a/drivers/video/backlight/backlight.c
+++ b/drivers/video/backlight/backlight.c
@@ -580,6 +580,49 @@ struct backlight_device *of_find_backlight_by_node(struct 
device_node *node)
  EXPORT_SYMBOL(of_find_backlight_by_node);
  #endif
  
+/**

+ * backlight_get - Get backlight device
+ * @dev: Device
+ *
+ * This function looks for a property named 'backlight' on the DT node
+ * connected to @dev and looks up the backlight device.
+ *
+ * Call backlight_put() to drop the reference on the backlight device.
+ *
+ * Returns:
+ * A pointer to the backlight device if found.
+ * Error pointer -EPROBE_DEFER if the DT property is set, but no backlight
+ * device is found.
+ * NULL if there's no backlight property.
+ */
+struct backlight_device *backlight_get(struct device *dev)
+{
+   struct backlight_device *bd = NULL;
+   struct device_node *np;
+
+   if (!dev)
+   return NULL;
+
+   if (IS_ENABLED(CONFIG_OF) && dev->of_node) {
+   np = of_parse_phandle(dev->of_node, 'backlight', 0);
+   if (np) {
+   bd = of_find_backlight_by_node(np);
+   of_node_put(np);
+   if (!bd)
+   return ERR_PTR(-EPROBE_DEFER);
+   }
+   }
+
+   return bd;
+}
+EXPORT_SYMBOL(backlight_get);
+
+static inline void backlight_put(struct backlight_device *bd)


Inlines like this should go in the header file backlight.h.


+{
+   if (bd)
+   put_device(>dev);
+}
+
  static void __exit backlight_class_exit(void)
  {
class_destroy(backlight_class);
diff --git 

Re: [PATCH v12 1/3] drm/tinydrm: Move helper functions from tinydrm-helpers to backlight.h

2017-10-12 Thread Noralf Trønnes


Den 12.10.2017 17.28, skrev Meghana Madhyastha:

Move the helper functions enable_backlight and disable_backlight
from tinydrm-helpers.c to backlight.h as static inline functions so
that they can be used by other drivers.

Signed-off-by: Meghana Madhyastha 
---


Please rebase on latest drm-misc, the patch doesn't apply.


Changes in v12:
-None

  drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c | 55 --
  drivers/gpu/drm/tinydrm/mipi-dbi.c |  5 ++-
  include/drm/tinydrm/tinydrm-helpers.h  |  2 -
  include/linux/backlight.h  | 30 ++
  4 files changed, 33 insertions(+), 59 deletions(-)

diff --git a/drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c 
b/drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c
index bd6cce0..a42dee6 100644
--- a/drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c
+++ b/drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c
@@ -276,61 +276,6 @@ struct backlight_device *tinydrm_of_find_backlight(struct 
device *dev)
  }
  EXPORT_SYMBOL(tinydrm_of_find_backlight);
  
-/**

- * tinydrm_enable_backlight - Enable backlight helper
- * @backlight: Backlight device
- *
- * Returns:
- * Zero on success, negative error code on failure.
- */
-int tinydrm_enable_backlight(struct backlight_device *backlight)
-{
-   unsigned int old_state;
-   int ret;
-
-   if (!backlight)
-   return 0;
-
-   old_state = backlight->props.state;
-   backlight->props.state &= ~BL_CORE_FBBLANK;
-   DRM_DEBUG_KMS("Backlight state: 0x%x -> 0x%x\n", old_state,
- backlight->props.state);
-
-   ret = backlight_update_status(backlight);
-   if (ret)
-   DRM_ERROR("Failed to enable backlight %d\n", ret);
-
-   return ret;
-}
-EXPORT_SYMBOL(tinydrm_enable_backlight);
-
-/**
- * tinydrm_disable_backlight - Disable backlight helper
- * @backlight: Backlight device
- *
- * Returns:
- * Zero on success, negative error code on failure.
- */
-int tinydrm_disable_backlight(struct backlight_device *backlight)
-{
-   unsigned int old_state;
-   int ret;
-
-   if (!backlight)
-   return 0;
-
-   old_state = backlight->props.state;
-   backlight->props.state |= BL_CORE_FBBLANK;
-   DRM_DEBUG_KMS("Backlight state: 0x%x -> 0x%x\n", old_state,
- backlight->props.state);
-   ret = backlight_update_status(backlight);
-   if (ret)
-   DRM_ERROR("Failed to disable backlight %d\n", ret);
-
-   return ret;
-}
-EXPORT_SYMBOL(tinydrm_disable_backlight);
-
  #if IS_ENABLED(CONFIG_SPI)
  
  /**

diff --git a/drivers/gpu/drm/tinydrm/mipi-dbi.c 
b/drivers/gpu/drm/tinydrm/mipi-dbi.c
index 2caeabc..71b416b 100644
--- a/drivers/gpu/drm/tinydrm/mipi-dbi.c
+++ b/drivers/gpu/drm/tinydrm/mipi-dbi.c
@@ -11,6 +11,7 @@
  
  #include 

  #include 
+#include 
  #include 
  #include 
  #include 
@@ -279,7 +280,7 @@ void mipi_dbi_pipe_enable(struct drm_simple_display_pipe 
*pipe,
if (fb)
fb->funcs->dirty(fb, NULL, 0, 0, NULL, 0);
  
-	tinydrm_enable_backlight(mipi->backlight);

+   backlight_enable(mipi->backlight);
  }
  EXPORT_SYMBOL(mipi_dbi_pipe_enable);
  
@@ -318,7 +319,7 @@ void mipi_dbi_pipe_disable(struct drm_simple_display_pipe *pipe)

mipi->enabled = false;
  
  	if (mipi->backlight)

-   tinydrm_disable_backlight(mipi->backlight);
+   backlight_disable(mipi->backlight);
else
mipi_dbi_blank(mipi);
  }
diff --git a/include/drm/tinydrm/tinydrm-helpers.h 
b/include/drm/tinydrm/tinydrm-helpers.h
index d554ded..f54fae0 100644
--- a/include/drm/tinydrm/tinydrm-helpers.h
+++ b/include/drm/tinydrm/tinydrm-helpers.h
@@ -47,8 +47,6 @@ void tinydrm_xrgb_to_gray8(u8 *dst, void *vaddr, struct 
drm_framebuffer *fb,
   struct drm_clip_rect *clip);
  
  struct backlight_device *tinydrm_of_find_backlight(struct device *dev);

-int tinydrm_enable_backlight(struct backlight_device *backlight);
-int tinydrm_disable_backlight(struct backlight_device *backlight);
  
  size_t tinydrm_spi_max_transfer_size(struct spi_device *spi, size_t max_len);

  bool tinydrm_spi_bpw_supported(struct spi_device *spi, u8 bpw);
diff --git a/include/linux/backlight.h b/include/linux/backlight.h
index 5f2fd61..355e9f5 100644
--- a/include/linux/backlight.h
+++ b/include/linux/backlight.h
@@ -153,6 +153,36 @@ static inline void * bl_get_data(struct backlight_device 
*bl_dev)
return dev_get_drvdata(_dev->dev);
  }
  
+/**

+ * backlight_enable - Enable backlight
+ * @bd: the backlight device to enable
+ */
+static inline int backlight_enable(struct backlight_device *bd)
+{
+   if (!bd)
+   return 0;
+
+   bd->props.power = FB_BLANK_UNBLANK;
+   bd->props.state &= ~BL_CORE_FBBLANK;
+
+   return backlight_update_status(bd);
+}
+
+/**
+ * backlight_disable - Disable backlight
+ * @bd: the backlight device to 

[PATCH v4 1/3] drm: Add retries for lspcon mode detection

2017-10-12 Thread Shashank Sharma
From the CI builds, its been observed that during a driver
reload/insert, dp dual mode read function sometimes fails to
read from LSPCON device over i2c-over-aux channel.

This patch:
- adds some delay and few retries, allowing a scope for these
  devices to settle down and respond.
- changes one error log's level from ERROR->DEBUG as we want
  to call it an error only after all the retries are exhausted.

V2: Addressed review comments from Jani (for loop for retry)
V3: Addressed review comments from Imre (break on partial read too)
V3: Addressed review comments from Ville/Imre (Add the retries
exclusively for LSPCON, not for all dp_dual_mode devices)
V4: Added r-b from Imre, sending it to dri-devel (Jani)

Cc: Ville Syrjala 
Cc: Imre Deak 
Cc: Jani Nikula 

Reviewed-by: Imre Deak 
Signed-off-by: Shashank Sharma 
---
 drivers/gpu/drm/drm_dp_dual_mode_helper.c | 16 +---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/drm_dp_dual_mode_helper.c 
b/drivers/gpu/drm/drm_dp_dual_mode_helper.c
index 0ef9011..02a5092 100644
--- a/drivers/gpu/drm/drm_dp_dual_mode_helper.c
+++ b/drivers/gpu/drm/drm_dp_dual_mode_helper.c
@@ -410,6 +410,7 @@ int drm_lspcon_get_mode(struct i2c_adapter *adapter,
 {
u8 data;
int ret = 0;
+   int retry;
 
if (!mode) {
DRM_ERROR("NULL input\n");
@@ -417,10 +418,19 @@ int drm_lspcon_get_mode(struct i2c_adapter *adapter,
}
 
/* Read Status: i2c over aux */
-   ret = drm_dp_dual_mode_read(adapter, DP_DUAL_MODE_LSPCON_CURRENT_MODE,
-   , sizeof(data));
+   for (retry = 0; retry < 6; retry++) {
+   if (retry)
+   usleep_range(500, 1000);
+
+   ret = drm_dp_dual_mode_read(adapter,
+   DP_DUAL_MODE_LSPCON_CURRENT_MODE,
+   , sizeof(data));
+   if (!ret)
+   break;
+   }
+
if (ret < 0) {
-   DRM_ERROR("LSPCON read(0x80, 0x41) failed\n");
+   DRM_DEBUG_KMS("LSPCON read(0x80, 0x41) failed\n");
return -EFAULT;
}
 
-- 
2.7.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] video: fbdev: radeon: make const array post_divs static, reduces object code size

2017-10-12 Thread Bartlomiej Zolnierkiewicz
On Thursday, October 12, 2017 05:17:49 PM Colin Ian King wrote:
> On 12/10/17 17:17, Bartlomiej Zolnierkiewicz wrote:
> > 
> > [ added dri-devel ML to cc: ]
> > 
> > On Tuesday, September 19, 2017 10:32:01 PM Colin King wrote:
> >> From: Colin Ian King 
> >>
> >> Don't populate the read-only const array post_divs on the stack,
> >> nstead make it static. Makes the object code smaller by 90 bytes:
> >>
> >> Before:
> >>text   data bss dec hex filename
> >>   40231   8584 896   49711c22f radeon_base.o
> >>
> >> After:
> >>text   data bss dec hex filename
> >>   39914   8744 960   49618c1d2 radeon_base.o
> >>
> >> Signed-off-by: Colin Ian King 
> > 
> > Are these results obtained using the same compiler as the other patches
> > (gcc version 7.2.0, x86_64)?
> 
> Yes, I forgot to annotate it.

Patch queued for 4.15 (with updated patch description), thanks.

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R Institute Poland
Samsung Electronics

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] video: fbdev: Fix an errro handling path in 'au1200fb_drv_probe()'

2017-10-12 Thread Bartlomiej Zolnierkiewicz

[ added dri-devel ML to cc: ]

On Tuesday, September 12, 2017 07:39:30 AM Christophe JAILLET wrote:
> If 'dmam_alloc_attrs()' fails, we must go through the error handling code,
> as done elsewhere in this function. Otherwise, there is a resource leak.
> 
> Signed-off-by: Christophe JAILLET 
> ---
> I'm also puzzled by the 'framebuffer_alloc()' call a few lines above.
> 'ret' is known to be 0 at this point. I guess that -ENOMEM should also be
> returned.

Yes, moreover the "failed:" error path is incomplete (please take
a look at au1200fb_drv_remove() for comparison) and needs to be fixed.

Could you please take care of it?

> ---
>  drivers/video/fbdev/au1200fb.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/video/fbdev/au1200fb.c b/drivers/video/fbdev/au1200fb.c
> index 5f04b4096c42..99d6cfb168b5 100644
> --- a/drivers/video/fbdev/au1200fb.c
> +++ b/drivers/video/fbdev/au1200fb.c
> @@ -1701,7 +1701,8 @@ static int au1200fb_drv_probe(struct platform_device 
> *dev)
>   if (!fbdev->fb_mem) {
>   print_err("fail to allocate frambuffer (size: %dK))",
> fbdev->fb_len / 1024);
> - return -ENOMEM;
> + ret = -ENOMEM;
> + goto failed;
>   }
>  
>   /*

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R Institute Poland
Samsung Electronics

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [pull] amdgpu drm-fixes-4.14

2017-10-12 Thread Michel Dänzer
On 12/10/17 05:58 PM, Alex Deucher wrote:
> Hi Dave,
> 
> One memory management regression fix.
> 
> The following changes since commit 545036a9944e9d6e50fed4ca03117147c880ff71:
> 
>   Merge tag 'drm-misc-fixes-2017-10-11' of 
> git://anongit.freedesktop.org/drm/drm-misc into drm-fixes (2017-10-12 
> 10:38:09 +1000)
> 
> are available in the git repository at:
> 
>   git://people.freedesktop.org/~agd5f/linux drm-fixes-4.14
> 
> for you to fetch changes up to 27b94b4f1386c3a8181f5a0277434a32e24e7dd7:
> 
>   drm/amdgpu: fix placement flags in amdgpu_ttm_bind (2017-10-12 10:34:42 
> -0400)
> 
> 
> Christian König (1):
>   drm/amdgpu: fix placement flags in amdgpu_ttm_bind

Thanks Alex, but there's another piglit hang regression in 4.14, caused
by commit 6af0883ed977 "drm/amdgpu: discard commands of killed
processes", fixed by five commits 6b37d03280a4..318d85de9c20 in
amd-staging-drm-next. Either the latter need to be backported to 4.14,
or the former needs to be reverted from it.


-- 
Earthling Michel Dänzer   |   http://www.amd.com
Libre software enthusiast | Mesa and X developer
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] video: fbdev: radeon: make const array post_divs static, reduces object code size

2017-10-12 Thread Colin Ian King
On 12/10/17 17:17, Bartlomiej Zolnierkiewicz wrote:
> 
> [ added dri-devel ML to cc: ]
> 
> On Tuesday, September 19, 2017 10:32:01 PM Colin King wrote:
>> From: Colin Ian King 
>>
>> Don't populate the read-only const array post_divs on the stack,
>> nstead make it static. Makes the object code smaller by 90 bytes:
>>
>> Before:
>>text data bss dec hex filename
>>   40231 8584 896   49711c22f radeon_base.o
>>
>> After:
>>text data bss dec hex filename
>>   39914 8744 960   49618c1d2 radeon_base.o
>>
>> Signed-off-by: Colin Ian King 
> 
> Are these results obtained using the same compiler as the other patches
> (gcc version 7.2.0, x86_64)?

Yes, I forgot to annotate it.

Colin
> 
> Best regards,
> --
> Bartlomiej Zolnierkiewicz
> Samsung R Institute Poland
> Samsung Electronics
> 
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] video: fbdev: radeon: make const array post_divs static, reduces object code size

2017-10-12 Thread Bartlomiej Zolnierkiewicz

[ added dri-devel ML to cc: ]

On Tuesday, September 19, 2017 10:32:01 PM Colin King wrote:
> From: Colin Ian King 
> 
> Don't populate the read-only const array post_divs on the stack,
> nstead make it static. Makes the object code smaller by 90 bytes:
> 
> Before:
>text  data bss dec hex filename
>   40231  8584 896   49711c22f radeon_base.o
> 
> After:
>text  data bss dec hex filename
>   39914  8744 960   49618c1d2 radeon_base.o
> 
> Signed-off-by: Colin Ian King 

Are these results obtained using the same compiler as the other patches
(gcc version 7.2.0, x86_64)?

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R Institute Poland
Samsung Electronics

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] video: fbdev: make fb_var_screeninfo static, const and __initconst

2017-10-12 Thread Bartlomiej Zolnierkiewicz

[ added dri-devel & sparclinux MLs to cc: ]

On Thursday, September 14, 2017 06:02:14 PM Bhumika Goyal wrote:
> Make these structures static as they are not referenced in any other
> file. Make them const as they are used only during a copy operation.
> Replace __initdata with __initconst in file igafb.c to avoid section
> conflict error.
> 
> Signed-off-by: Bhumika Goyal 
> ---
> The changes are not compile tested as I could not find the right 
> architecture to cross compile the files.
> 
>  drivers/video/fbdev/dnfb.c  | 2 +-
>  drivers/video/fbdev/igafb.c | 6 +++---
>  2 files changed, 4 insertions(+), 4 deletions(-)

You can deduce such things by looking into Makefile-s and KConfig-s:
- dnfb is used by apollo platform of m68k arch
- igafb can be used on sparc32 arch

I took care of compile testing these changes and discovered that
in the current vanilla kernel (v4.14-rc4) igafb fails to build.

Thus I've only queued dnfb changes for v4.15 kernel for now.

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R Institute Poland
Samsung Electronics

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[pull] amdgpu drm-fixes-4.14

2017-10-12 Thread Alex Deucher
Hi Dave,

One memory management regression fix.

The following changes since commit 545036a9944e9d6e50fed4ca03117147c880ff71:

  Merge tag 'drm-misc-fixes-2017-10-11' of 
git://anongit.freedesktop.org/drm/drm-misc into drm-fixes (2017-10-12 10:38:09 
+1000)

are available in the git repository at:

  git://people.freedesktop.org/~agd5f/linux drm-fixes-4.14

for you to fetch changes up to 27b94b4f1386c3a8181f5a0277434a32e24e7dd7:

  drm/amdgpu: fix placement flags in amdgpu_ttm_bind (2017-10-12 10:34:42 -0400)


Christian König (1):
  drm/amdgpu: fix placement flags in amdgpu_ttm_bind

 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v12 3/3] drm/tinydrm: Add devres versions of backlight_get

2017-10-12 Thread Meghana Madhyastha
Add devm_backlight_get and the corresponding release
function because some drivers use devres versions of functions
for requiring device resources.

Signed-off-by: Meghana Madhyastha 
---
Changes in v12:
 -Move backlight_put() to the patch 2/3 from patch 3/3.

 drivers/gpu/drm/tinydrm/mi0283qt.c  |  2 +-
 drivers/video/backlight/backlight.c | 25 +
 include/linux/backlight.h   | 16 
 3 files changed, 42 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/tinydrm/mi0283qt.c 
b/drivers/gpu/drm/tinydrm/mi0283qt.c
index edf9502..03fec36 100644
--- a/drivers/gpu/drm/tinydrm/mi0283qt.c
+++ b/drivers/gpu/drm/tinydrm/mi0283qt.c
@@ -190,7 +190,7 @@ static int mi0283qt_probe(struct spi_device *spi)
if (IS_ERR(mipi->regulator))
return PTR_ERR(mipi->regulator);
 
-   mipi->backlight = backlight_get(dev);
+   mipi->backlight = devm_backlight_get(dev);
if (IS_ERR(mipi->backlight))
return PTR_ERR(mipi->backlight);
 
diff --git a/drivers/video/backlight/backlight.c 
b/drivers/video/backlight/backlight.c
index f3e95b3..3663f26 100644
--- a/drivers/video/backlight/backlight.c
+++ b/drivers/video/backlight/backlight.c
@@ -623,6 +623,31 @@ static inline void backlight_put(struct backlight_device 
*bd)
put_device(>dev);
 }
 
+/**
+ ** devm_backlight_get - Resource-managed backlight_get()
+ ** @dev: Device
+ **
+ ** Device managed version of backlight_get(). The reference on the backlight
+ ** device is automatically dropped on driver detach.
+ **/
+struct backlight_device *devm_backlight_get(struct device *dev)
+{
+   struct backlight_device *bd;
+   int ret;
+
+   bd = backlight_get(dev);
+   if (!bd)
+   return NULL;
+   ret = devm_add_action(dev, devm_backlight_get_release, bd);
+   if (ret) {
+   backlight_put(bd);
+   return ERR_PTR(ret);
+   }
+
+   return bd;
+}
+EXPORT_SYMBOL(devm_backlight_get);
+
 static void __exit backlight_class_exit(void)
 {
class_destroy(backlight_class);
diff --git a/include/linux/backlight.h b/include/linux/backlight.h
index 1d713b3..0bfadb6 100644
--- a/include/linux/backlight.h
+++ b/include/linux/backlight.h
@@ -183,6 +183,16 @@ static inline int backlight_disable(struct 
backlight_device *bd)
return backlight_update_status(bd);
 }
 
+/**
+ ** backlight_put - Drop backlight reference
+ ** @bd: the backlight device to put
+ **/
+static inline void backlight_put(struct backlight_device *bd)
+{
+   if (bd)
+   put_device(>dev);
+}
+
 struct generic_bl_info {
const char *name;
int max_intensity;
@@ -204,11 +214,17 @@ of_find_backlight_by_node(struct device_node *node)
 
 #if IS_ENABLED(CONFIG_BACKLIGHT_CLASS_DEVICE)
 struct backlight_device *backlight_get(struct device *dev);
+struct backlight_device *devm_backlight_get(struct device *dev);
 #else
 static inline struct backlight_device *backlight_get(struct device *dev)
 {
return NULL;
 }
+
+static inline struct backlight_device *devm_backlight_get(struct device *dev)
+{
+   return NULL;
+}
 #endif
 
 #endif
-- 
2.7.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v12 2/3] drm/tinydrm: Move tinydrm_of_find_backlight to backlight.c

2017-10-12 Thread Meghana Madhyastha
Rename tinydrm_of_find_backlight to backlight_get and move it
to linux/backlight.c so that it can be used by other drivers.

Signed-off-by: Meghana Madhyastha 
---
Changes in v12:
 -Move backlight_put() to the patch 2/3 from patch 3/3.
 -Remove #if IS_ENABLED(CONFIG_BACKLIGHT_CLASS_DEVICE)..#endif
  because the file is not built if it isn't enabled

 drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c | 40 
 drivers/gpu/drm/tinydrm/mi0283qt.c |  3 +-
 drivers/video/backlight/backlight.c| 43 ++
 include/drm/tinydrm/tinydrm-helpers.h  |  3 --
 include/linux/backlight.h  |  9 ++
 5 files changed, 54 insertions(+), 44 deletions(-)

diff --git a/drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c 
b/drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c
index a42dee6..cb1a01a 100644
--- a/drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c
+++ b/drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c
@@ -236,46 +236,6 @@ void tinydrm_xrgb_to_gray8(u8 *dst, void *vaddr, 
struct drm_framebuffer *fb,
 }
 EXPORT_SYMBOL(tinydrm_xrgb_to_gray8);
 
-/**
- * tinydrm_of_find_backlight - Find backlight device in device-tree
- * @dev: Device
- *
- * This function looks for a DT node pointed to by a property named 'backlight'
- * and uses of_find_backlight_by_node() to get the backlight device.
- * Additionally if the brightness property is zero, it is set to
- * max_brightness.
- *
- * Returns:
- * NULL if there's no backlight property.
- * Error pointer -EPROBE_DEFER if the DT node is found, but no backlight device
- * is found.
- * If the backlight device is found, a pointer to the structure is returned.
- */
-struct backlight_device *tinydrm_of_find_backlight(struct device *dev)
-{
-   struct backlight_device *backlight;
-   struct device_node *np;
-
-   np = of_parse_phandle(dev->of_node, "backlight", 0);
-   if (!np)
-   return NULL;
-
-   backlight = of_find_backlight_by_node(np);
-   of_node_put(np);
-
-   if (!backlight)
-   return ERR_PTR(-EPROBE_DEFER);
-
-   if (!backlight->props.brightness) {
-   backlight->props.brightness = backlight->props.max_brightness;
-   DRM_DEBUG_KMS("Backlight brightness set to %d\n",
- backlight->props.brightness);
-   }
-
-   return backlight;
-}
-EXPORT_SYMBOL(tinydrm_of_find_backlight);
-
 #if IS_ENABLED(CONFIG_SPI)
 
 /**
diff --git a/drivers/gpu/drm/tinydrm/mi0283qt.c 
b/drivers/gpu/drm/tinydrm/mi0283qt.c
index 7e5bb7d..edf9502 100644
--- a/drivers/gpu/drm/tinydrm/mi0283qt.c
+++ b/drivers/gpu/drm/tinydrm/mi0283qt.c
@@ -12,6 +12,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -189,7 +190,7 @@ static int mi0283qt_probe(struct spi_device *spi)
if (IS_ERR(mipi->regulator))
return PTR_ERR(mipi->regulator);
 
-   mipi->backlight = tinydrm_of_find_backlight(dev);
+   mipi->backlight = backlight_get(dev);
if (IS_ERR(mipi->backlight))
return PTR_ERR(mipi->backlight);
 
diff --git a/drivers/video/backlight/backlight.c 
b/drivers/video/backlight/backlight.c
index 8049e76..f3e95b3 100644
--- a/drivers/video/backlight/backlight.c
+++ b/drivers/video/backlight/backlight.c
@@ -580,6 +580,49 @@ struct backlight_device *of_find_backlight_by_node(struct 
device_node *node)
 EXPORT_SYMBOL(of_find_backlight_by_node);
 #endif
 
+/**
+ * backlight_get - Get backlight device
+ * @dev: Device
+ *
+ * This function looks for a property named 'backlight' on the DT node
+ * connected to @dev and looks up the backlight device.
+ *
+ * Call backlight_put() to drop the reference on the backlight device.
+ *
+ * Returns:
+ * A pointer to the backlight device if found.
+ * Error pointer -EPROBE_DEFER if the DT property is set, but no backlight
+ * device is found.
+ * NULL if there's no backlight property.
+ */
+struct backlight_device *backlight_get(struct device *dev)
+{
+   struct backlight_device *bd = NULL;
+   struct device_node *np;
+
+   if (!dev)
+   return NULL;
+
+   if (IS_ENABLED(CONFIG_OF) && dev->of_node) {
+   np = of_parse_phandle(dev->of_node, 'backlight', 0);
+   if (np) {
+   bd = of_find_backlight_by_node(np);
+   of_node_put(np);
+   if (!bd)
+   return ERR_PTR(-EPROBE_DEFER);
+   }
+   }
+
+   return bd;
+}
+EXPORT_SYMBOL(backlight_get);
+
+static inline void backlight_put(struct backlight_device *bd)
+{
+   if (bd)
+   put_device(>dev);
+}
+
 static void __exit backlight_class_exit(void)
 {
class_destroy(backlight_class);
diff --git a/include/drm/tinydrm/tinydrm-helpers.h 
b/include/drm/tinydrm/tinydrm-helpers.h
index f54fae0..b89d8e4 100644
--- a/include/drm/tinydrm/tinydrm-helpers.h
+++ 

Re: [PATCH] video: fbdev: sis: make const array specialtv static, reduces object code size

2017-10-12 Thread Bartlomiej Zolnierkiewicz
On Wednesday, September 13, 2017 04:41:37 PM Colin King wrote:
> From: Colin Ian King 
> 
> Don't populate the const array specialtv on the stack, instead make it
> static.  Makes the object code smaller by over 1100 bytes:
> 
> Before:
>text  data bss dec hex filename
>  179899  7504   0  187403   2dc0b 
> drivers/video/fbdev/sis/init301.o
> 
> After:
>text  data bss dec hex filename
>  178720  7568   0  186288   2d7b0 
> drivers/video/fbdev/sis/init301.o
> 
> (gcc version 7.2.0, x86_64)
> 
> Signed-off-by: Colin Ian King 

Patch queued for 4.15, thanks.

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R Institute Poland
Samsung Electronics

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v12 1/3] drm/tinydrm: Move helper functions from tinydrm-helpers to backlight.h

2017-10-12 Thread Meghana Madhyastha
Move the helper functions enable_backlight and disable_backlight
from tinydrm-helpers.c to backlight.h as static inline functions so
that they can be used by other drivers.

Signed-off-by: Meghana Madhyastha 
---
Changes in v12:
-None

 drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c | 55 --
 drivers/gpu/drm/tinydrm/mipi-dbi.c |  5 ++-
 include/drm/tinydrm/tinydrm-helpers.h  |  2 -
 include/linux/backlight.h  | 30 ++
 4 files changed, 33 insertions(+), 59 deletions(-)

diff --git a/drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c 
b/drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c
index bd6cce0..a42dee6 100644
--- a/drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c
+++ b/drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c
@@ -276,61 +276,6 @@ struct backlight_device *tinydrm_of_find_backlight(struct 
device *dev)
 }
 EXPORT_SYMBOL(tinydrm_of_find_backlight);
 
-/**
- * tinydrm_enable_backlight - Enable backlight helper
- * @backlight: Backlight device
- *
- * Returns:
- * Zero on success, negative error code on failure.
- */
-int tinydrm_enable_backlight(struct backlight_device *backlight)
-{
-   unsigned int old_state;
-   int ret;
-
-   if (!backlight)
-   return 0;
-
-   old_state = backlight->props.state;
-   backlight->props.state &= ~BL_CORE_FBBLANK;
-   DRM_DEBUG_KMS("Backlight state: 0x%x -> 0x%x\n", old_state,
- backlight->props.state);
-
-   ret = backlight_update_status(backlight);
-   if (ret)
-   DRM_ERROR("Failed to enable backlight %d\n", ret);
-
-   return ret;
-}
-EXPORT_SYMBOL(tinydrm_enable_backlight);
-
-/**
- * tinydrm_disable_backlight - Disable backlight helper
- * @backlight: Backlight device
- *
- * Returns:
- * Zero on success, negative error code on failure.
- */
-int tinydrm_disable_backlight(struct backlight_device *backlight)
-{
-   unsigned int old_state;
-   int ret;
-
-   if (!backlight)
-   return 0;
-
-   old_state = backlight->props.state;
-   backlight->props.state |= BL_CORE_FBBLANK;
-   DRM_DEBUG_KMS("Backlight state: 0x%x -> 0x%x\n", old_state,
- backlight->props.state);
-   ret = backlight_update_status(backlight);
-   if (ret)
-   DRM_ERROR("Failed to disable backlight %d\n", ret);
-
-   return ret;
-}
-EXPORT_SYMBOL(tinydrm_disable_backlight);
-
 #if IS_ENABLED(CONFIG_SPI)
 
 /**
diff --git a/drivers/gpu/drm/tinydrm/mipi-dbi.c 
b/drivers/gpu/drm/tinydrm/mipi-dbi.c
index 2caeabc..71b416b 100644
--- a/drivers/gpu/drm/tinydrm/mipi-dbi.c
+++ b/drivers/gpu/drm/tinydrm/mipi-dbi.c
@@ -11,6 +11,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -279,7 +280,7 @@ void mipi_dbi_pipe_enable(struct drm_simple_display_pipe 
*pipe,
if (fb)
fb->funcs->dirty(fb, NULL, 0, 0, NULL, 0);
 
-   tinydrm_enable_backlight(mipi->backlight);
+   backlight_enable(mipi->backlight);
 }
 EXPORT_SYMBOL(mipi_dbi_pipe_enable);
 
@@ -318,7 +319,7 @@ void mipi_dbi_pipe_disable(struct drm_simple_display_pipe 
*pipe)
mipi->enabled = false;
 
if (mipi->backlight)
-   tinydrm_disable_backlight(mipi->backlight);
+   backlight_disable(mipi->backlight);
else
mipi_dbi_blank(mipi);
 }
diff --git a/include/drm/tinydrm/tinydrm-helpers.h 
b/include/drm/tinydrm/tinydrm-helpers.h
index d554ded..f54fae0 100644
--- a/include/drm/tinydrm/tinydrm-helpers.h
+++ b/include/drm/tinydrm/tinydrm-helpers.h
@@ -47,8 +47,6 @@ void tinydrm_xrgb_to_gray8(u8 *dst, void *vaddr, struct 
drm_framebuffer *fb,
   struct drm_clip_rect *clip);
 
 struct backlight_device *tinydrm_of_find_backlight(struct device *dev);
-int tinydrm_enable_backlight(struct backlight_device *backlight);
-int tinydrm_disable_backlight(struct backlight_device *backlight);
 
 size_t tinydrm_spi_max_transfer_size(struct spi_device *spi, size_t max_len);
 bool tinydrm_spi_bpw_supported(struct spi_device *spi, u8 bpw);
diff --git a/include/linux/backlight.h b/include/linux/backlight.h
index 5f2fd61..355e9f5 100644
--- a/include/linux/backlight.h
+++ b/include/linux/backlight.h
@@ -153,6 +153,36 @@ static inline void * bl_get_data(struct backlight_device 
*bl_dev)
return dev_get_drvdata(_dev->dev);
 }
 
+/**
+ * backlight_enable - Enable backlight
+ * @bd: the backlight device to enable
+ */
+static inline int backlight_enable(struct backlight_device *bd)
+{
+   if (!bd)
+   return 0;
+
+   bd->props.power = FB_BLANK_UNBLANK;
+   bd->props.state &= ~BL_CORE_FBBLANK;
+
+   return backlight_update_status(bd);
+}
+
+/**
+ * backlight_disable - Disable backlight
+ * @bd: the backlight device to disable
+ */
+static inline int backlight_disable(struct backlight_device *bd)
+{
+   if (!bd)
+   return 0;
+
+   

[PATCH v12 0/3] Move backlight helper functions from tinydrm-helpers to linux/backlight

2017-10-12 Thread Meghana Madhyastha
Move drm helper functions from tinydrm-helpers to linux/backlight for
ease of use by callers in other drivers. 

Changes in v12:
 -Move backlight_put() to the patch 2/3 from patch 3/3.
 -Remove #if IS_ENABLED(CONFIG_BACKLIGHT_CLASS_DEVICE)..#endif
  because the file is not built if it isn't enabled

Meghana Madhyastha (3):
  drm/tinydrm: Move helper functions from tinydrm-helpers to backlight.h
  drm/tinydrm: Move tinydrm_of_find_backlight to backlight.c
  drm/tinydrm: Add devres versions of backlight_get

 drivers/gpu/drm/tinydrm/core/tinydrm-helpers.c | 95 --
 drivers/gpu/drm/tinydrm/mi0283qt.c |  3 +-
 drivers/gpu/drm/tinydrm/mipi-dbi.c |  5 +-
 drivers/video/backlight/backlight.c| 68 ++
 include/drm/tinydrm/tinydrm-helpers.h  |  5 --
 include/linux/backlight.h  | 55 +++
 6 files changed, 128 insertions(+), 103 deletions(-)

-- 
2.7.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drivers/video/fbdev/atyfb: make const arrays static, reduces object code size

2017-10-12 Thread Bartlomiej Zolnierkiewicz
On Wednesday, September 13, 2017 04:03:09 PM Colin King wrote:
> From: Colin Ian King 
> 
> Don't populate the const arrays ragepro_tbl and ragexl_tbl on the stack,
> instead make them static.  Makes the object code smaller by over 380 bytes:
> 
> Before:
>text  data bss dec hex filename
>   41089 10592 768   52449cce1 atyfb_base.o
> 
> After:
>text  data bss dec hex filename
>   40544 10752 768   52064cb60 atyfb_base.o
> 
> (gcc version 7.2.0, x86_64)
> 
> Signed-off-by: Colin Ian King 

Patch queued for 4.15 (with patch description fixed to
"video: fbdev: aty: ..." for consistency with other patches),
thanks.

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R Institute Poland
Samsung Electronics

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PULL] drm-intel-next

2017-10-12 Thread Jani Nikula
On Wed, 11 Oct 2017, Jani Nikula  wrote:
> Hi Dave, more v4.15 features.

Okay, so I suck and there's still one more batch to come after this. I'm
a bit out of rhythm here. When do you want the pull request for that at
the latest?

BR,
Jani.

>
> Our tooling now supports signed tags, this one is probably the
> first. Maybe we can make them mandatory in the long run.
>
> drm-intel-next-2017-09-29:
> 2nd batch of v4.15 features:
>
> - lib/scatterlist updates, use for userptr allocations (Tvrtko)
> - Fixed point wrapper cleanup (Mahesh)
> - Gen9+ transition watermarks, watermark optimization and fixes (Mahesh)
> - Display IPC (Isochronous Priority Control) support (Mahesh)
> - GEM workaround fixes (Oscar)
> - GVT: PCI config sanitize series (Changbin)
> - GVT: Workload submission error handling series (Fred)
> - PSR fixes and refactoring (Rodrigo)
> - HWSP based optimizations (Chris)
> - Private PAT management (Zhi)
> - IRQ handling fixes and refactoring (Ville)
> - Module parameter refactoring and variable name clash fix (Michal)
> - Execlist refactoring, incomplete request unwinding on reset (Chris)
> - GuC scheduling improvements (Michal)
> - OA updates (Lionel)
> - Coffeelake out of alpha support (Rodrigo)
> - seqno fixes (Chris)
> - Execlist refactoring (Mika)
> - DP and DP MST cleanups (Dhinakaran)
> - Cannonlake slice/sublice config (Ben)
> - Numerous fixes all around (Everyone)
>
> BR,
> Jani.
>
> The following changes since commit 754270c7c56292e97d0eff924a5d5d83f92add07:
>
>   Merge branch 'drm-next-4.15' of git://people.freedesktop.org/~agd5f/linux 
> into drm-next (2017-09-28 08:37:02 +1000)
>
> are available in the git repository at:
>
>   git://anongit.freedesktop.org/drm/drm-intel tags/drm-intel-next-2017-09-29
>
> for you to fetch changes up to e18063e88bd579c479a2b45820be6c4625f841c3:
>
>   drm/i915: Update DRIVER_DATE to 20170929 (2017-09-29 13:50:38 +0300)
>
> 
> 2nd batch of v4.15 features:
>
> - lib/scatterlist updates, use for userptr allocations (Tvrtko)
> - Fixed point wrapper cleanup (Mahesh)
> - Gen9+ transition watermarks, watermark optimization and fixes (Mahesh)
> - Display IPC (Isochronous Priority Control) support (Mahesh)
> - GEM workaround fixes (Oscar)
> - GVT: PCI config sanitize series (Changbin)
> - GVT: Workload submission error handling series (Fred)
> - PSR fixes and refactoring (Rodrigo)
> - HWSP based optimizations (Chris)
> - Private PAT management (Zhi)
> - IRQ handling fixes and refactoring (Ville)
> - Module parameter refactoring and variable name clash fix (Michal)
> - Execlist refactoring, incomplete request unwinding on reset (Chris)
> - GuC scheduling improvements (Michal)
> - OA updates (Lionel)
> - Coffeelake out of alpha support (Rodrigo)
> - seqno fixes (Chris)
> - Execlist refactoring (Mika)
> - DP and DP MST cleanups (Dhinakaran)
> - Cannonlake slice/sublice config (Ben)
> - Numerous fixes all around (Everyone)
>
> 
> Anuj Phogat (1):
>   drm/i915/kbl: Change a KBL pci id to GT2 from GT1.5
>
> Ben Widawsky (1):
>   drm/i915/cnl: Add support slice/subslice/eu configs
>
> Changbin Du (4):
>   drm/i915/kvmgt: Sanitize PCI bar emulation
>   drm/i915/gvt: Add emulation for BAR2 (aperture) with normal file RW 
> approach
>   drm/i915/gvt: Fix incorrect PCI BARs reporting
>   drm/i915/gvt: Add support for PCIe extended configuration space
>
> Chris Wilson (33):
>   drm/i915: Disable snooping (userptr, set-cache-level) on gen4
>   drm/i915: Disable mmio debugging during user access
>   drm/i915: Apply the GTT write flush for all !llc machines
>   drm/i915: Only initialize partially filled pagetables
>   drm/i915: Cleanup error paths through eb_lookup_vma()
>   drm/i915: Move the context descriptor to an inline helper
>   drm/i915: Squelch smatch warning for statement with no effect
>   drm/i915: Use mul_u32_u32() for 32b x 32b -> 64b result
>   drm/i915/selftests: Use mul_u32_u32() for 32b x 32b -> 64b result
>   drm/i915: Allow HW status page to be bound high
>   drm/i915/execlists: Read the context-status buffer from the HWSP
>   drm/i915/execlists: Read the context-status HEAD from the HWSP
>   drm/i915: Remove unused 'in_vbl' from i915_get_crtc_scanoutpos()
>   drm/i915: Mark the userptr invalidate workqueue as WQ_MEM_RECLAIM
>   drm/i915: Cancel all ready but queued requests when wedging
>   drm/i915/execlists: Kick start request processing after a reset
>   drm/i915/execlists: Move insert_request()
>   drm/i915/execlists: Split insert_request()
>   drm/i915/execlists: Unwind incomplete requests on resets
>   drm/i915/selftests: Disable iommu for the mock device
>   drm/i915/selftests: Only touch archdata.iommu when it exists
>   drm/i915/fence: Avoid del_timer_sync() from inside a timer
>   

Re: [09/10] driver:video: return -ENOMEM on allocation failure.

2017-10-12 Thread Bartlomiej Zolnierkiewicz

[ cc: list trimmed down do linux-fbdev/dri-devel/linux-kernel ]

On Wednesday, September 13, 2017 01:02:18 PM Allen wrote:
> Signed-off-by: Allen Pais 

Patch queued for 4.15 (with patch description fixed to
"video: fbdev: matrox: return -ENOMEM on allocation failure"),
thanks.

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R Institute Poland
Samsung Electronics

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/vblank: Fix flip event vblank count

2017-10-12 Thread Ville Syrjälä
On Tue, Oct 10, 2017 at 04:33:22PM +0300, Ville Syrjala wrote:
> From: Ville Syrjälä 
> 
> On machines where the vblank interrupt fires some time after the start
> of vblank (or we just manage to race with the vblank interrupt handler)
> we will currently stuff a stale vblank counter value into the flip event,
> and thus we'll prematurely complete the flip.
> 
> Switch over to drm_crtc_accurate_vblank_count() to make sure we have an
> up to date counter value, crucially also remember to add the +1 so that
> the delayed vblank interrupt won't complete the flip prematurely.
> 
> Cc: sta...@vger.kernel.org
> Cc: Daniel Vetter 
> Suggested-by: Daniel Vetter 
> Signed-off-by: Ville Syrjälä 

Pushed to drm-misc-next with Daniel's irc r-b:
16:48 < danvet> vsyrjala, r-b, I think
...
17:31 < vsyrjala> danvet: your irc r-b for vblank_accurate+1 still
holds?
17:32 < danvet> vsyrjala, yeah

> ---
>  drivers/gpu/drm/drm_vblank.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
> index 70f2b9593edc..f14e6c92e332 100644
> --- a/drivers/gpu/drm/drm_vblank.c
> +++ b/drivers/gpu/drm/drm_vblank.c
> @@ -869,7 +869,7 @@ void drm_crtc_arm_vblank_event(struct drm_crtc *crtc,
>   assert_spin_locked(>event_lock);
>  
>   e->pipe = pipe;
> - e->event.sequence = drm_vblank_count(dev, pipe);
> + e->event.sequence = drm_crtc_accurate_vblank_count(crtc) + 1;
>   e->event.crtc_id = crtc->base.id;
>   list_add_tail(>base.link, >vblank_event_list);
>  }
> -- 
> 2.13.6

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


[Bug 196615] amdgpu - resume from suspend is no longer working on rx480

2017-10-12 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=196615

--- Comment #22 from Alex Deucher (alexdeuc...@gmail.com) ---
(In reply to Peter Spiess-Knafl from comment #20)
> Alex can you help out here? Why was the patch fixing the suspend/resume
> issue removed in 4.13?

The fix was only applied to 4.12.  No one reported any problems with 4.13 or
newe until later.

-- 
You are receiving this mail because:
You are watching the assignee of the bug.
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 196615] amdgpu - resume from suspend is no longer working on rx480

2017-10-12 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=196615

--- Comment #21 from Peter Spiess-Knafl (p...@autistici.org) ---
"git log -p drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c" reveals that the original
patch
(https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git/commit/?h=linux-4.12.y=2dc1889ebf8501b0edf125e89a30e1cf3744a2a7)
has been reapplied over the fix for suspend.

-- 
You are receiving this mail because:
You are watching the assignee of the bug.
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: RFC: page-flip with damage?

2017-10-12 Thread Sean Paul
On Thu, Oct 12, 2017 at 01:55:40PM +0300, Pekka Paalanen wrote:
> On Tue, 26 Sep 2017 09:07:45 -0700
> Thomas Hellstrom  wrote:
> 
> > On 09/26/2017 01:18 AM, Daniel Vetter wrote:
> > > On Sun, Sep 24, 2017 at 07:41:45PM +0200, Thomas Hellstrom wrote:  
> > >> Hi, list!
> > >>
> > >> Page flips, while efficient on real hardware, aren't that efficient in 
> > >> other
> > >> situations, like for virtual devices with local, or even worse, remote
> > >> desktops.
> > >> We might ending up forwarding or encoding a couple of full frames worth 
> > >> of
> > >> data instead of a small region at a cursor blink.
> > >>
> > >> Now there is this extension EGL_KHR_swap_buffers_with_damage, and
> > >> gnome-shell/wayland on KMS also has a damage region that it forwards all 
> > >> the
> > >> way down to the function where page-flip is called.
> 
> > > Wrt single dirty rect vs. rectlist: I'd opt for a single rect since that
> > > makes the interface easier. Currently most drivers collapes the list
> > > passed to fb_funcs->dirty to a single rect, so that seems good enough, and
> > > a nice simplification of the interface (both uapi and driver).  
> > 
> > I think multiple cliprects had its benefits for old X type rendering: 
> > Frontbuffer-type diagonal
> > lines benchmarked with x11perf and similar. Now that everybody's 
> > compositing that use-case is mostly gone, and as you say
> > most driver coalesce anyway. Even we to some extent, at least on newer 
> > "hardware" versions.
> 
> Hi,
> 
> it still is awfully easy to create a pathological use case where
> collapsing into a single rect adds a thousand-fold more pixels to the
> damage than having more than one rectangle would allow: two tiny
> animations at the opposite corners of a screen.
> 
> I'm thinking Wayland compositors here.
> 
> Simplifying damage regions while not crashing down to just one
> rectangle is quite possible I believe. Let userspace do simplification
> from hundreds down to a few rectangles, 

Sounds like you're making a case for overlay planes here :-)

Perhaps migrating the damage rect to plane state would make everyone happy. In
the case where the hardware or compositor only supports one plane, there is one
big rect. In the case where multiple planes are used, you rely on the compositor
to make plane assignments and pass down the individual damage regions per plane.

Sean


> and then collapse into one
> rectangle in the driver if absolutely necessary. That's what I'd hope.
> 
> It is totally fine to require non-overlapping rectangles. You could
> even demand a specific layout of rectangles, e.g. the form Pixman
> regions use. You can also put an arbitrary cap on how many rectangles
> are allowed.
> 
> 
> Thanks,
> pq



> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel


-- 
Sean Paul, Software Engineer, Google / Chromium OS
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 196615] amdgpu - resume from suspend is no longer working on rx480

2017-10-12 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=196615

--- Comment #20 from Peter Spiess-Knafl (p...@autistici.org) ---
Alex can you help out here? Why was the patch fixing the suspend/resume issue
removed in 4.13?

-- 
You are receiving this mail because:
You are watching the assignee of the bug.
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/kirin: Checking for IS_ERR() instead of NULL

2017-10-12 Thread Sean Paul
On Thu, Oct 5, 2017 at 8:57 AM, Dan Carpenter  wrote:
> The of_graph_get_remote_node() function doesn't return error pointers,
> it returns NULL on error so I've updated the check.
>
> Fixes: 86418f90a4c1 ("drm: convert drivers to use of_graph_get_remote_node")
> Signed-off-by: Dan Carpenter 
>

Hi Dan,
Apologies for missing this.

Reviewed-by: Sean Paul 

> diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c 
> b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
> index e27352ca26c4..527aa58485fa 100644
> --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
> +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
> @@ -236,8 +236,8 @@ static int kirin_drm_platform_probe(struct 
> platform_device *pdev)
> }
>
> remote = of_graph_get_remote_node(np, 0, 0);
> -   if (IS_ERR(remote))
> -   return PTR_ERR(remote);
> +   if (!remote)
> +   return -ENODEV;
>
> drm_of_component_match_add(dev, , compare_of, remote);
> of_node_put(remote);
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm: Fix return value check in kirin_drm_platform_probe()

2017-10-12 Thread Sean Paul
On Thu, Oct 12, 2017 at 2:39 AM, Gabriel Krisman Bertazi
 wrote:
> Wei Yongjun  writes:
>
>> In case of error, the function of_graph_get_remote_node() returns NULL
>> pointer not ERR_PTR(). The IS_ERR() test in the return value check
>> should be replaced with NULL test..
>
> Looks good.
>
> Reviewed-by: Gabriel Krisman Bertazi 
>

FYI, I just noticed Dan Carpenter sent an identical patch last week
"<20171005125751.jvtjms62vbtxuvak@mwanda> [PATCH] drm/kirin: Checking
for IS_ERR() instead of NULL".

I'll add my R-b there, since it was first.

Sean


> --
> Gabriel Krisman Bertazi
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/atomic-helper: Fix typo

2017-10-12 Thread Noralf Trønnes


Den 12.10.2017 16.06, skrev Thierry Reding:

From: Thierry Reding 

Fix "esay-to-use" to "easy-to-use" typo.

Signed-off-by: Thierry Reding 
---
  drivers/gpu/drm/drm_atomic_helper.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_atomic_helper.c 
b/drivers/gpu/drm/drm_atomic_helper.c
index 01c34bc5b5b0..ce2ed30b6838 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -1704,7 +1704,7 @@ crtc_or_fake_commit(struct drm_atomic_state *state, 
struct drm_crtc *crtc)
   * drm_atomic_helper_commit_cleanup_done().
   *
   * This is all implemented by in drm_atomic_helper_commit(), giving drivers a
- * complete and esay-to-use default implementation of the atomic_commit() hook.
+ * complete and easy-to-use default implementation of the atomic_commit() hook.
   *
   * The tracking of asynchronously executed and still pending commits is done
   * using the core structure _crtc_commit.


Acked-by: Noralf Trønnes 

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


  1   2   >