Re: [PATCH] drm/hisilicon: Fix rmmod hibmc_drm failed

2020-12-14 Thread Thomas Zimmermann

Hi Tian

Am 15.12.20 um 04:01 schrieb Tian Tao:

drm_irq_uninstall should be called before pci_disable_msi, if use
devm_drm_irq_install to register the interrupt, the system will
call pci_disable_msi first and then call drm_irq_uninstall, which
  will result in the following callstack.

kernel BUG at drivers/pci/msi.c:376!
Internal error: Oops - BUG: 0 [#1] SMP
CPU: 93 PID: 173814 Comm: rmmod Tainted:
pstate: a049 (NzCv daif +PAN -UAO -TCO BTYPE=--)
pc : free_msi_irqs+0x17c/0x1a0
lr : free_msi_irqs+0x16c/0x1a0
sp : 2028157f7bd0
x29: 2028157f7bd0 x28: 202849edab00
x27:  x26: 
x25:  x24: 
x23: 0020851da000 x22: 0020851da2d8
x21: 0020cc829000 x20: 
x19: 0020d6714800 x18: 0010
x17:  x16: 
x15:  x14: 2028957f77df
x13: 2028157f77ed x12: 
x11: 0040 x10: 800011b2f8e0
x9 : 800011b2f8d8 x8 : 2020203fc458
x7 :  x6 : 
x5 : 2020203fc430 x4 : 2020203fc4a0
x3 :  x2 : 
x1 : 02c9 x0 : 0020d6719500
Call trace:
  free_msi_irqs+0x17c/0x1a0
  pci_disable_msi+0xe4/0x118
  hibmc_unload+0x44/0x80 [hibmc_drm]
  hibmc_pci_remove+0x2c/0x38 [hibmc_drm]
  pci_device_remove+0x48/0x108
  device_release_driver_internal+0x118/0x1f0
  driver_detach+0x6c/0xe0
  bus_remove_driver+0x74/0x100
  driver_unregister+0x34/0x60
  pci_unregister_driver+0x24/0xd8
  hibmc_pci_driver_exit+0x14/0xe768 [hibmc_drm]
  __arm64_sys_delete_module+0x1fc/0x2d0
  el0_svc_common.constprop.3+0xa8/0x188
  do_el0_svc+0x80/0xa0
  el0_sync_handler+0x8c/0xb0
  el0_sync+0x15c/0x180
Code: f940b400 b400 a903e7b8 f90013b5 (d421)
---[ end trace 310d94ee8abef44f ]---
Kernel panic - not syncing: Oops - BUG: Fatal exception

Signed-off-by: Tian Tao 
---
  drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c | 6 +-
  1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c 
b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
index e3ab765b..02f3bd1 100644
--- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
+++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
@@ -251,6 +251,10 @@ static int hibmc_hw_init(struct hibmc_drm_private *priv)
  static int hibmc_unload(struct drm_device *dev)
  {
drm_atomic_helper_shutdown(dev);
+
+   if (dev->irq_enabled)
+   drm_irq_uninstall(dev);
+
pci_disable_msi(dev->pdev);


We're trying to move towards managed driver releases; and this feels 
like a step backwards.


I looked through the PCI-device release code in pcim_release() and it 
already disables MSI automatically. [1] You can enable the PCI device 
with pcim_enable_device() instead of pci_enable_device() to use the 
automatic release. No more need to disable MSI manually.


If this does not work, could you provide a managed version of 
pci_disable_msi() that solves the problem?


Best regards
Thomas

[1] https://elixir.bootlin.com/linux/latest/source/drivers/pci/pci.c#L1976


  
  	return 0;

@@ -286,7 +290,7 @@ static int hibmc_load(struct drm_device *dev)
if (ret) {
drm_warn(dev, "enabling MSI failed: %d\n", ret);
} else {
-   ret = devm_drm_irq_install(dev, dev->pdev->irq);
+   ret = drm_irq_install(dev, dev->pdev->irq);
if (ret)
drm_warn(dev, "install irq failed: %d\n", ret);
}



--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer



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


[radeon-alex:amd-20.45 2392/2427] drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:9376:5: warning: no previous prototype for 'amdgpu_dm_dp_mst_add_affected_dsc_crtcs'

2020-12-14 Thread kernel test robot
tree:   git://people.freedesktop.org/~agd5f/linux.git amd-20.45
head:   a3950d94b046fb206e58fd3ec717f071c0203ba3
commit: 5dcf8eb3991298ab764be6f83eaa48f75d49e77a [2392/2427] drm/amd/display: 
add copy of drm_dp_mst_add_affected_dsc_crtc()
config: i386-randconfig-r022-20201214 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce (this is a W=1 build):
git remote add radeon-alex git://people.freedesktop.org/~agd5f/linux.git
git fetch --no-tags radeon-alex amd-20.45
git checkout 5dcf8eb3991298ab764be6f83eaa48f75d49e77a
# save the attached .config to linux build tree
make W=1 ARCH=i386 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot 

All warnings (new ones prefixed by >>):

from include/kcl/backport/kcl_fence_backport.h:4,
from drivers/gpu/drm/amd/backport/backport.h:13,
from :
   drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c: In function 
'get_fb_info':
   drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:3979:44: 
warning: passing argument 1 of 'drm_gem_fb_get_obj' discards 'const' qualifier 
from pointer target type [-Wdiscarded-qualifiers]
3979 |  rbo = gem_to_amdgpu_bo(drm_gem_fb_get_obj(_fb->base, 0));
 |^~~~
   include/linux/kernel.h:986:26: note: in definition of macro 'container_of'
 986 |  void *__mptr = (void *)(ptr); \
 |  ^~~
   drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:3979:8: note: in 
expansion of macro 'gem_to_amdgpu_bo'
3979 |  rbo = gem_to_amdgpu_bo(drm_gem_fb_get_obj(_fb->base, 0));
 |^~~~
   In file included from 
drivers/gpu/drm/amd/backport/include/kcl/kcl_amdgpu_drm_fb_helper.h:6,
from drivers/gpu/drm/amd/backport/backport.h:62,
from :
   include/drm/drm_gem_framebuffer_helper.h:15:24: note: expected 'struct 
drm_framebuffer *' but argument is of type 'const struct drm_framebuffer *'
  15 | struct drm_gem_object *drm_gem_fb_get_obj(struct drm_framebuffer *fb,
 |^~
   In file included from include/linux/rcupdate.h:24,
from include/kcl/kcl_rcupdate.h:5,
from include/kcl/kcl_fence.h:6,
from include/kcl/backport/kcl_fence_backport.h:4,
from drivers/gpu/drm/amd/backport/backport.h:13,
from :
   drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:3979:44: 
warning: passing argument 1 of 'drm_gem_fb_get_obj' discards 'const' qualifier 
from pointer target type [-Wdiscarded-qualifiers]
3979 |  rbo = gem_to_amdgpu_bo(drm_gem_fb_get_obj(_fb->base, 0));
 |^~~~
   include/linux/compiler.h:330:9: note: in definition of macro 
'__compiletime_assert'
 330 |   if (!(condition)) \
 | ^
   include/linux/compiler.h:350:2: note: in expansion of macro 
'_compiletime_assert'
 350 |  _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
 |  ^~~
   include/linux/build_bug.h:39:37: note: in expansion of macro 
'compiletime_assert'
  39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
 | ^~
   include/linux/kernel.h:987:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
 987 |  BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
 |  ^~~~
   include/linux/kernel.h:987:20: note: in expansion of macro '__same_type'
 987 |  BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
 |^~~
   drivers/gpu/drm/amd/amdgpu/amdgpu_gem.h:34:32: note: in expansion of macro 
'container_of'
  34 | #define gem_to_amdgpu_bo(gobj) container_of((gobj), struct 
amdgpu_bo, tbo.base)
 |^~~~
   drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:3979:8: note: in 
expansion of macro 'gem_to_amdgpu_bo'
3979 |  rbo = gem_to_amdgpu_bo(drm_gem_fb_get_obj(_fb->base, 0));
 |^~~~
   In file included from 
drivers/gpu/drm/amd/backport/include/kcl/kcl_amdgpu_drm_fb_helper.h:6,
from drivers/gpu/drm/amd/backport/backport.h:62,
from :
   include/drm/drm_gem_framebuffer_helper.h:15:24: note: expected 'struct 
drm_framebuffer *' but argument is of type 'const struct drm_framebuffer *'
  15 | struct drm_gem_object *drm_gem_fb_get_obj(struct drm_framebuffer *fb,
 |^~
   In file included from include/linux/rcupdate.h:24,
from include/kcl/kcl_rcupdate.h:5,
  

[radeon-alex:amd-20.45 1379/2427] drivers/gpu/drm/amd/amdgpu/../display/dc/clk_mgr/dcn30/dcn30_clk_mgr.c:103:35: error: no member named 'bw_params' in 'struct clk_mgr'

2020-12-14 Thread kernel test robot
tree:   git://people.freedesktop.org/~agd5f/linux.git amd-20.45
head:   a3950d94b046fb206e58fd3ec717f071c0203ba3
commit: 470f4be73099cc46478d2c708411fecde8197ca3 [1379/2427] drm/amdkcl: update 
DRM_AMD_DC_DCN3_0 to depends on legacy display config
config: x86_64-randconfig-a001-20201214 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 
a29ecca7819a6ed4250d3689b12b1f664bb790d7)
reproduce (this is a W=1 build):
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# install x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
git remote add radeon-alex git://people.freedesktop.org/~agd5f/linux.git
git fetch --no-tags radeon-alex amd-20.45
git checkout 470f4be73099cc46478d2c708411fecde8197ca3
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot 

All errors (new ones prefixed by >>):

>> drivers/gpu/drm/amd/amdgpu/../display/dc/clk_mgr/dcn30/dcn30_clk_mgr.c:103:35:
>>  error: no member named 'bw_params' in 'struct clk_mgr'
   entry_i += 
sizeof(clk_mgr->base.bw_params->clk_table.entries[0]);
 ~ ^
   
drivers/gpu/drm/amd/amdgpu/../display/dc/clk_mgr/dcn30/dcn30_clk_mgr.c:113:40: 
error: no member named 'bw_params' in 'struct clk_mgr'
   uint16_t min_uclk_mhz = 
clk_mgr->base.bw_params->clk_table.entries[0].memclk_mhz;
   ~ ^
   
drivers/gpu/drm/amd/amdgpu/../display/dc/clk_mgr/dcn30/dcn30_clk_mgr.c:116:16: 
error: no member named 'bw_params' in 'struct clk_mgr'
   clk_mgr->base.bw_params->wm_table.nv_entries[WM_A].valid = true;
   ~ ^
>> drivers/gpu/drm/amd/amdgpu/../display/dc/clk_mgr/dcn30/dcn30_clk_mgr.c:116:47:
>>  error: use of undeclared identifier 'WM_A'
   clk_mgr->base.bw_params->wm_table.nv_entries[WM_A].valid = true;
^
   
drivers/gpu/drm/amd/amdgpu/../display/dc/clk_mgr/dcn30/dcn30_clk_mgr.c:117:16: 
error: no member named 'bw_params' in 'struct clk_mgr'
   
clk_mgr->base.bw_params->wm_table.nv_entries[WM_A].dml_input.pstate_latency_us 
= pstate_latency_us;
   ~ ^
   
drivers/gpu/drm/amd/amdgpu/../display/dc/clk_mgr/dcn30/dcn30_clk_mgr.c:117:47: 
error: use of undeclared identifier 'WM_A'
   
clk_mgr->base.bw_params->wm_table.nv_entries[WM_A].dml_input.pstate_latency_us 
= pstate_latency_us;
^
   
drivers/gpu/drm/amd/amdgpu/../display/dc/clk_mgr/dcn30/dcn30_clk_mgr.c:118:16: 
error: no member named 'bw_params' in 'struct clk_mgr'
   
clk_mgr->base.bw_params->wm_table.nv_entries[WM_A].dml_input.sr_exit_time_us = 
sr_exit_time_us;
   ~ ^
   
drivers/gpu/drm/amd/amdgpu/../display/dc/clk_mgr/dcn30/dcn30_clk_mgr.c:118:47: 
error: use of undeclared identifier 'WM_A'
   
clk_mgr->base.bw_params->wm_table.nv_entries[WM_A].dml_input.sr_exit_time_us = 
sr_exit_time_us;
^
   
drivers/gpu/drm/amd/amdgpu/../display/dc/clk_mgr/dcn30/dcn30_clk_mgr.c:119:16: 
error: no member named 'bw_params' in 'struct clk_mgr'
   
clk_mgr->base.bw_params->wm_table.nv_entries[WM_A].dml_input.sr_enter_plus_exit_time_us
 = sr_enter_plus_exit_time_us;
   ~ ^
   
drivers/gpu/drm/amd/amdgpu/../display/dc/clk_mgr/dcn30/dcn30_clk_mgr.c:119:47: 
error: use of undeclared identifier 'WM_A'
   
clk_mgr->base.bw_params->wm_table.nv_entries[WM_A].dml_input.sr_enter_plus_exit_time_us
 = sr_enter_plus_exit_time_us;
^
   
drivers/gpu/drm/amd/amdgpu/../display/dc/clk_mgr/dcn30/dcn30_clk_mgr.c:120:16: 
error: no member named 'bw_params' in 'struct clk_mgr'
   
clk_mgr->base.bw_params->wm_table.nv_entries[WM_A].pmfw_breakdown.wm_type = 
WATERMARKS_CLOCK_RANGE;
   ~ ^
   
drivers/gpu/drm/amd/amdgpu/../display/dc/clk_mgr/dcn30/dcn30_clk_mgr.c:120:47: 
error: use of undeclared identifier 'WM_A'
   
clk_mgr->base.bw_params->wm_table.nv_entries[WM_A].pmfw_breakdown.wm_type = 
WATERMARKS_CLOCK_RANGE;
^
   
drivers/gpu/drm/amd/amdgpu/../display/dc/clk_mgr/dcn30/dcn30_clk_mgr.c:121:16: 
error: no member named 'bw_params' in 'struct clk_mgr'
   
clk_mgr->base.bw_params->wm_table.nv_entries[WM_A].pmfw_breakdown.min_dcfclk = 
0;
   ~ ^
   
drivers/gpu/drm/amd/amdgpu/../disp

[radeon-alex:amd-20.45 2127/2427] drivers/gpu/drm/amd/amdgpu/../display/dc/bios/command_table.c:1880:39: sparse: sparse: incorrect type in argument 1 (different base types)

2020-12-14 Thread kernel test robot
tree:   git://people.freedesktop.org/~agd5f/linux.git amd-20.45
head:   a3950d94b046fb206e58fd3ec717f071c0203ba3
commit: c82b6c9ed412fb7009b02dd82e50ee24f451e9a8 [2127/2427] drm/amd/display: 
convert to use le16_add_cpu()
config: arc-randconfig-s031-20201214 (attached as .config)
compiler: arc-elf-gcc (GCC) 9.3.0
reproduce:
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.3-184-g1b896707-dirty
git remote add radeon-alex git://people.freedesktop.org/~agd5f/linux.git
git fetch --no-tags radeon-alex amd-20.45
git checkout c82b6c9ed412fb7009b02dd82e50ee24f451e9a8
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 
CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=arc 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot 


"sparse warnings: (new ones prefixed by >>)"
   drivers/gpu/drm/amd/amdgpu/../display/dc/bios/command_table.c:879:43: 
sparse: sparse: incorrect type in assignment (different base types) @@ 
expected unsigned int [addressable] [assigned] [usertype] ulSymClock @@ got 
restricted __le16 [usertype] @@
   drivers/gpu/drm/amd/amdgpu/../display/dc/bios/command_table.c:879:43: 
sparse: expected unsigned int [addressable] [assigned] [usertype] ulSymClock
   drivers/gpu/drm/amd/amdgpu/../display/dc/bios/command_table.c:879:43: 
sparse: got restricted __le16 [usertype]
   drivers/gpu/drm/amd/amdgpu/../display/dc/bios/command_table.c:956:40: 
sparse: sparse: incorrect type in assignment (different base types) @@ 
expected unsigned short [addressable] [assigned] [usertype] usRefDiv @@ got 
restricted __le16 [usertype] @@
   drivers/gpu/drm/amd/amdgpu/../display/dc/bios/command_table.c:956:40: 
sparse: expected unsigned short [addressable] [assigned] [usertype] usRefDiv
   drivers/gpu/drm/amd/amdgpu/../display/dc/bios/command_table.c:956:40: 
sparse: got restricted __le16 [usertype]
   drivers/gpu/drm/amd/amdgpu/../display/dc/bios/command_table.c:958:39: 
sparse: sparse: incorrect type in assignment (different base types) @@ 
expected unsigned short [addressable] [assigned] [usertype] usFbDiv @@ got 
restricted __le16 [usertype] @@
   drivers/gpu/drm/amd/amdgpu/../display/dc/bios/command_table.c:958:39: 
sparse: expected unsigned short [addressable] [assigned] [usertype] usFbDiv
   drivers/gpu/drm/amd/amdgpu/../display/dc/bios/command_table.c:958:39: 
sparse: got restricted __le16 [usertype]
   drivers/gpu/drm/amd/amdgpu/../display/dc/bios/command_table.c:966:44: 
sparse: sparse: incorrect type in assignment (different base types) @@ 
expected unsigned short [addressable] [assigned] [usertype] usPixelClock @@ 
got restricted __le16 [usertype] @@
   drivers/gpu/drm/amd/amdgpu/../display/dc/bios/command_table.c:966:44: 
sparse: expected unsigned short [addressable] [assigned] [usertype] 
usPixelClock
   drivers/gpu/drm/amd/amdgpu/../display/dc/bios/command_table.c:966:44: 
sparse: got restricted __le16 [usertype]
   drivers/gpu/drm/amd/amdgpu/../display/dc/bios/command_table.c:1029:40: 
sparse: sparse: incorrect type in assignment (different base types) @@ 
expected unsigned short [addressable] [assigned] [usertype] usFbDiv @@ got 
restricted __le16 [usertype] @@
   drivers/gpu/drm/amd/amdgpu/../display/dc/bios/command_table.c:1029:40: 
sparse: expected unsigned short [addressable] [assigned] [usertype] usFbDiv
   drivers/gpu/drm/amd/amdgpu/../display/dc/bios/command_table.c:1029:40: 
sparse: got restricted __le16 [usertype]
   drivers/gpu/drm/amd/amdgpu/../display/dc/bios/command_table.c:1031:47: 
sparse: sparse: incorrect type in assignment (different base types) @@ 
expected unsigned int [addressable] [assigned] [usertype] ulFbDivDecFrac @@ 
got restricted __le32 [usertype] @@
   drivers/gpu/drm/amd/amdgpu/../display/dc/bios/command_table.c:1031:47: 
sparse: expected unsigned int [addressable] [assigned] [usertype] 
ulFbDivDecFrac
   drivers/gpu/drm/amd/amdgpu/../display/dc/bios/command_table.c:1031:47: 
sparse: got restricted __le32 [usertype]
   drivers/gpu/drm/amd/amdgpu/../display/dc/bios/command_table.c:1044:45: 
sparse: sparse: incorrect type in assignment (different base types) @@ 
expected unsigned short [addressable] [assigned] [usertype] usPixelClock @@ 
got restricted __le16 [usertype] @@
   drivers/gpu/drm/amd/amdgpu/../display/dc/bios/command_table.c:1044:45: 
sparse: expected unsigned short [addressable] [assigned] [usertype] 
usPixelClock
   drivers/gpu/drm/amd/amdgpu/../display/dc/bios/command_table.c:1044:45: 
sparse: got restricted __le16 [usertype]
   drivers/gpu/drm/amd/amdgpu/../display/dc/bios/command_table.c:1105:40: 
sparse: sparse: incorrect type in assig

[radeon-alex:amd-20.45 189/2427] ./usr/include/drm/amdgpu_drm.h:874:4: error: unknown type name 'uint32_t'

2020-12-14 Thread kernel test robot
Hi Flora,

FYI, the error/warning still remains.

tree:   git://people.freedesktop.org/~agd5f/linux.git amd-20.45
head:   a3950d94b046fb206e58fd3ec717f071c0203ba3
commit: b46fcb031f1ca11f48ea670680cb5eed851e9870 [189/2427] drm/amdgpu: 
[hybrid] add query for aperture va range
config: x86_64-randconfig-a004-20201214 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 
a29ecca7819a6ed4250d3689b12b1f664bb790d7)
reproduce (this is a W=1 build):
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# install x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
git remote add radeon-alex git://people.freedesktop.org/~agd5f/linux.git
git fetch --no-tags radeon-alex amd-20.45
git checkout b46fcb031f1ca11f48ea670680cb5eed851e9870
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot 

All errors (new ones prefixed by >>):

   In file included from :1:
>> ./usr/include/drm/amdgpu_drm.h:874:4: error: unknown type name 'uint32_t'
   uint32_t aperture;
   ^
   ./usr/include/drm/amdgpu_drm.h:875:4: error: unknown type name 'uint32_t'
   uint32_t _pad;
   ^
>> ./usr/include/drm/amdgpu_drm.h:1102:2: error: unknown type name 'uint64_t'
   uint64_t start;
   ^
   ./usr/include/drm/amdgpu_drm.h:1103:2: error: unknown type name 'uint64_t'
   uint64_t end;
   ^
   4 errors generated.

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org


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


RE: [radeon-alex:amd-20.45 2387/2427] drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c:1284:2: warning: ignoring return value of function declared with 'warn_unused_result' attribute

2020-12-14 Thread Chen, Guchun
[AMD Public Use]

Hi there,

I will fix this soon. The issue is reported on amd-20.45 branch, which was 
branched out ahead of the fix available on mainline.

Regards,
Guchun

-Original Message-
From: kernel test robot  
Sent: Tuesday, December 15, 2020 1:49 PM
To: Chen, Guchun 
Cc: kbuild-...@lists.01.org; clang-built-li...@googlegroups.com; 
dri-devel@lists.freedesktop.org; Li, Dennis 
Subject: [radeon-alex:amd-20.45 2387/2427] 
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c:1284:2: warning: ignoring return value 
of function declared with 'warn_unused_result' attribute

Hi Guchun,

FYI, the error/warning still remains.

tree:   git://people.freedesktop.org/~agd5f/linux.git amd-20.45
head:   a3950d94b046fb206e58fd3ec717f071c0203ba3
commit: cf13e50dea28cde351fa32767e36135afb30386d [2387/2427] drm/amdgpu: clean 
up ras sysfs creation (v2)
config: x86_64-randconfig-a002-20201214 (attached as .config)
compiler: clang version 12.0.0 
(https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fllvm%2Fllvm-projectdata=04%7C01%7Cguchun.chen%40amd.com%7C708cce12ecaa4d2ee1d108d8a0bd3135%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637436084052882308%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000sdata=I4ohtcRRR8iQs%2FfkMhy%2B7pnsAJ4V%2Br%2F0EpNjcoQp%2B4s%3Dreserved=0
 a29ecca7819a6ed4250d3689b12b1f664bb790d7)
reproduce (this is a W=1 build):
wget 
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fraw.githubusercontent.com%2Fintel%2Flkp-tests%2Fmaster%2Fsbin%2Fmake.crossdata=04%7C01%7Cguchun.chen%40amd.com%7C708cce12ecaa4d2ee1d108d8a0bd3135%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637436084052892302%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000sdata=ijbznpvhsb43YLeQJ6UZb%2BfG4mnCiAA2ZmPQhLgz6Ig%3Dreserved=0
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
git remote add radeon-alex git://people.freedesktop.org/~agd5f/linux.git
git fetch --no-tags radeon-alex amd-20.45
git checkout cf13e50dea28cde351fa32767e36135afb30386d
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot 

All warnings (new ones prefixed by >>):

   drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c:906:5: warning: no previous 
prototype for function 'amdgpu_ras_error_cure' [-Wmissing-prototypes]
   int amdgpu_ras_error_cure(struct amdgpu_device *adev,
   ^
   drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c:906:1: note: declare 'static' if the 
function is not intended to be used outside of this translation unit
   int amdgpu_ras_error_cure(struct amdgpu_device *adev,
   ^
   static 
>> drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c:1284:2: warning: ignoring return 
>> value of function declared with 'warn_unused_result' attribute 
>> [-Wunused-result]
   sysfs_create_group(>dev->kobj, );
   ^~ 
   2 warnings generated.

vim +/warn_unused_result +1284 drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c

  1249  
  1250  /* ras fs */
  1251  static BIN_ATTR(gpu_vram_bad_pages, S_IRUGO,
  1252  amdgpu_ras_sysfs_badpages_read, NULL, 0);
  1253  static DEVICE_ATTR(features, S_IRUGO,
  1254  amdgpu_ras_sysfs_features_read, NULL);
  1255  static int amdgpu_ras_fs_init(struct amdgpu_device *adev)
  1256  {
  1257  struct amdgpu_ras *con = amdgpu_ras_get_context(adev);
  1258  struct attribute_group group = {
  1259  .name = RAS_FS_NAME,
  1260  };
  1261  struct attribute *attrs[] = {
  1262  >features_attr.attr,
  1263  NULL
  1264  };
  1265  struct bin_attribute *bin_attrs[] = {
  1266  NULL,
  1267  NULL,
  1268  };
  1269  
  1270  /* add features entry */
  1271  con->features_attr = dev_attr_features;
  1272  group.attrs = attrs;
  1273  sysfs_attr_init(attrs[0]);
  1274  
  1275  if (amdgpu_bad_page_threshold != 0) {
  1276  /* add bad_page_features entry */
  1277  bin_attr_gpu_vram_bad_pages.private = NULL;
  1278  con->badpages_attr = bin_attr_gpu_vram_bad_pages;
  1279  bin_attrs[0] = >badpages_attr;
  1280  group.bin_attrs = bin_attrs;
  1281  sysfs_bin_attr_init(bin_attrs[0]);
  1282  }
  1283  
> 1284  sysfs_create_group(>dev->kobj, );
  1285  
  1286  return 0;
  1287  }
  1288  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://nam11.safelinks.protection.outlook.com/

[radeon-alex:amd-20.45 2349/2427] drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c:272:15: warning: initialized field overwritten

2020-12-14 Thread kernel test robot
tree:   git://people.freedesktop.org/~agd5f/linux.git amd-20.45
head:   a3950d94b046fb206e58fd3ec717f071c0203ba3
commit: 353801e46ab9f255e45bff91e185580df75787c0 [2349/2427] drm/amdgpu/gmc9: 
print client id string for mmhub
config: i386-randconfig-r022-20201214 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce (this is a W=1 build):
git remote add radeon-alex git://people.freedesktop.org/~agd5f/linux.git
git fetch --no-tags radeon-alex amd-20.45
git checkout 353801e46ab9f255e45bff91e185580df75787c0
# save the attached .config to linux build tree
make W=1 ARCH=i386 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot 

All warnings (new ones prefixed by >>):

>> drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c:272:15: warning: initialized field 
>> overwritten [-Woverride-init]
 272 |  [32+15][1] = "SDMA1",
 |   ^~~
   drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c:272:15: note: (near initialization for 
'mmhub_client_ids_arcturus[47][1]')
   drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c:383:23: warning: 
'ecc_umc_mcumc_status_addrs' defined but not used [-Wunused-const-variable=]
 383 | static const uint32_t ecc_umc_mcumc_status_addrs[] = {
 |   ^~
   In file included from 
drivers/gpu/drm/amd/backport/include/kcl/kcl_amdgpu.h:6,
from drivers/gpu/drm/amd/backport/backport.h:22,
from :
   drivers/gpu/drm/amd/amdgpu/amdgpu.h:198:19: warning: 'no_system_mem_limit' 
defined but not used [-Wunused-const-variable=]
 198 | static const bool no_system_mem_limit;
 |   ^~~
   drivers/gpu/drm/amd/amdgpu/amdgpu.h:197:19: warning: 'debug_evictions' 
defined but not used [-Wunused-const-variable=]
 197 | static const bool debug_evictions; /* = false */
 |   ^~~
   drivers/gpu/drm/amd/amdgpu/amdgpu.h:196:18: warning: 'sched_policy' defined 
but not used [-Wunused-const-variable=]
 196 | static const int sched_policy = KFD_SCHED_POLICY_HWS;
 |  ^~~~
   In file included from drivers/gpu/drm/amd/display/dc/dc_types.h:33,
from drivers/gpu/drm/amd/display/dc/dm_services_types.h:30,
from drivers/gpu/drm/amd/include/dm_pp_interface.h:26,
from drivers/gpu/drm/amd/amdgpu/amdgpu.h:64,
from 
drivers/gpu/drm/amd/backport/include/kcl/kcl_amdgpu.h:6,
from drivers/gpu/drm/amd/backport/backport.h:22,
from :
   drivers/gpu/drm/amd/display/include/fixed31_32.h:76:32: warning: 
'dc_fixpt_ln2_div_2' defined but not used [-Wunused-const-variable=]
  76 | static const struct fixed31_32 dc_fixpt_ln2_div_2 = { 1488522236LL };
 |^~
   drivers/gpu/drm/amd/display/include/fixed31_32.h:75:32: warning: 
'dc_fixpt_ln2' defined but not used [-Wunused-const-variable=]
  75 | static const struct fixed31_32 dc_fixpt_ln2 = { 2977044471LL };
 |^~~~
   drivers/gpu/drm/amd/display/include/fixed31_32.h:74:32: warning: 
'dc_fixpt_e' defined but not used [-Wunused-const-variable=]
  74 | static const struct fixed31_32 dc_fixpt_e = { 11674931555LL };
 |^~
   drivers/gpu/drm/amd/display/include/fixed31_32.h:73:32: warning: 
'dc_fixpt_two_pi' defined but not used [-Wunused-const-variable=]
  73 | static const struct fixed31_32 dc_fixpt_two_pi = { 26986075409LL };
 |^~~
   drivers/gpu/drm/amd/display/include/fixed31_32.h:72:32: warning: 
'dc_fixpt_pi' defined but not used [-Wunused-const-variable=]
  72 | static const struct fixed31_32 dc_fixpt_pi = { 13493037705LL };
 |^~~

vim +272 drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c

   242  
   243  static const char *mmhub_client_ids_arcturus[][2] = {
   244  [2][0] = "MP1",
   245  [3][0] = "MP0",
   246  [10][0] = "UTCL2",
   247  [13][0] = "OSS",
   248  [14][0] = "HDP",
   249  [15][0] = "SDMA0",
   250  [32+15][0] = "SDMA1",
   251  [64+15][0] = "SDMA2",
   252  [96+15][0] = "SDMA3",
   253  [128+15][0] = "SDMA4",
   254  [160+11][0] = "JPEG",
   255  [160+12][0] = "VCN",
   256  [160+13][0] = "VCNU",
   257  [160+15][0] = "SDMA5",
   258  [192+10][0] = "UTCL2",
   259  [192+11][0] = "JPEG1",
   260  [192+12][0] = "VCN1",
   261  [192+13][0] = "VCN1U",
   262  [192+1

[radeon-alex:amd-20.45 1587/2427] drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v10.c:882:6: warning: no previous prototype for 'kgd_gfx_v10_set_address_watch'

2020-12-14 Thread kernel test robot
tree:   git://people.freedesktop.org/~agd5f/linux.git amd-20.45
head:   a3950d94b046fb206e58fd3ec717f071c0203ba3
commit: abdc393ab8265df9db5d9d64eb33ed1c33e9d95c [1587/2427] drm/amdkfd: Add 
gfx10 address watch support
config: powerpc-allyesconfig (attached as .config)
compiler: powerpc64-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
git remote add radeon-alex git://people.freedesktop.org/~agd5f/linux.git
git fetch --no-tags radeon-alex amd-20.45
git checkout abdc393ab8265df9db5d9d64eb33ed1c33e9d95c
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross 
ARCH=powerpc 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot 

All warnings (new ones prefixed by >>):

   drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v10.c:763:6: warning: no 
previous prototype for 'kgd_gfx_v10_enable_debug_trap' [-Wmissing-prototypes]
 763 | void kgd_gfx_v10_enable_debug_trap(struct kgd_dev *kgd,
 |  ^
   drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v10.c:792:6: warning: no 
previous prototype for 'kgd_gfx_v10_disable_debug_trap' [-Wmissing-prototypes]
 792 | void kgd_gfx_v10_disable_debug_trap(struct kgd_dev *kgd)
 |  ^~
   drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v10.c:803:5: warning: no 
previous prototype for 'kgd_gfx_v10_set_wave_launch_trap_override' 
[-Wmissing-prototypes]
 803 | int kgd_gfx_v10_set_wave_launch_trap_override(struct kgd_dev *kgd,
 | ^
   drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v10.c:852:6: warning: no 
previous prototype for 'kgd_gfx_v10_set_wave_launch_mode' [-Wmissing-prototypes]
 852 | void kgd_gfx_v10_set_wave_launch_mode(struct kgd_dev *kgd,
 |  ^~~~
>> drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v10.c:882:6: warning: no 
>> previous prototype for 'kgd_gfx_v10_set_address_watch' [-Wmissing-prototypes]
 882 | void kgd_gfx_v10_set_address_watch(struct kgd_dev *kgd,
 |  ^
>> drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v10.c:942:6: warning: no 
>> previous prototype for 'kgd_gfx_v10_clear_address_watch' 
>> [-Wmissing-prototypes]
 942 | void kgd_gfx_v10_clear_address_watch(struct kgd_dev *kgd,
 |  ^~~
   drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v10.c:967:6: warning: no 
previous prototype for 'kgd_gfx_v10_get_iq_wait_times' [-Wmissing-prototypes]
 967 | void kgd_gfx_v10_get_iq_wait_times(struct kgd_dev *kgd,
 |  ^
   drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v10.c:976:6: warning: no 
previous prototype for 'kgd_gfx_v10_build_grace_period_packet_info' 
[-Wmissing-prototypes]
 976 | void kgd_gfx_v10_build_grace_period_packet_info(struct kgd_dev *kgd,
 |  ^~
   In file included from drivers/gpu/drm/amd/display/dc/dc_types.h:33,
from drivers/gpu/drm/amd/display/dc/dm_services_types.h:30,
from drivers/gpu/drm/amd/include/dm_pp_interface.h:26,
from drivers/gpu/drm/amd/amdgpu/amdgpu.h:64,
from 
drivers/gpu/drm/amd/backport/include/kcl/kcl_amdgpu.h:6,
from drivers/gpu/drm/amd/backport/backport.h:18,
from :
   drivers/gpu/drm/amd/display/include/fixed31_32.h:76:32: warning: 
'dc_fixpt_ln2_div_2' defined but not used [-Wunused-const-variable=]
  76 | static const struct fixed31_32 dc_fixpt_ln2_div_2 = { 1488522236LL };
 |^~
   drivers/gpu/drm/amd/display/include/fixed31_32.h:75:32: warning: 
'dc_fixpt_ln2' defined but not used [-Wunused-const-variable=]
  75 | static const struct fixed31_32 dc_fixpt_ln2 = { 2977044471LL };
 |^~~~
   drivers/gpu/drm/amd/display/include/fixed31_32.h:74:32: warning: 
'dc_fixpt_e' defined but not used [-Wunused-const-variable=]
  74 | static const struct fixed31_32 dc_fixpt_e = { 11674931555LL };
 |^~
   drivers/gpu/drm/amd/display/include/fixed31_32.h:73:32: warning: 
'dc_fixpt_two_pi' defined but not used [-Wunused-const-variable=]
  73 | static const struct fixed31_32 dc_fixpt_two_pi = { 26986075409LL };
 |^~~
   drivers/gpu/drm/amd/display/include/fixed31_32.h:72:32: warning: 
'dc_fixpt_pi' defined but not used [-Wunused-const-variable=]
  72 | static const struct fixed31_32 dc_fixpt_pi = { 13493037705LL };
 |^~~
   

[radeon-alex:amd-20.45 2387/2427] drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c:1284:2: warning: ignoring return value of function declared with 'warn_unused_result' attribute

2020-12-14 Thread kernel test robot
Hi Guchun,

FYI, the error/warning still remains.

tree:   git://people.freedesktop.org/~agd5f/linux.git amd-20.45
head:   a3950d94b046fb206e58fd3ec717f071c0203ba3
commit: cf13e50dea28cde351fa32767e36135afb30386d [2387/2427] drm/amdgpu: clean 
up ras sysfs creation (v2)
config: x86_64-randconfig-a002-20201214 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 
a29ecca7819a6ed4250d3689b12b1f664bb790d7)
reproduce (this is a W=1 build):
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# install x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
git remote add radeon-alex git://people.freedesktop.org/~agd5f/linux.git
git fetch --no-tags radeon-alex amd-20.45
git checkout cf13e50dea28cde351fa32767e36135afb30386d
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot 

All warnings (new ones prefixed by >>):

   drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c:906:5: warning: no previous 
prototype for function 'amdgpu_ras_error_cure' [-Wmissing-prototypes]
   int amdgpu_ras_error_cure(struct amdgpu_device *adev,
   ^
   drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c:906:1: note: declare 'static' if the 
function is not intended to be used outside of this translation unit
   int amdgpu_ras_error_cure(struct amdgpu_device *adev,
   ^
   static 
>> drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c:1284:2: warning: ignoring return 
>> value of function declared with 'warn_unused_result' attribute 
>> [-Wunused-result]
   sysfs_create_group(>dev->kobj, );
   ^~ 
   2 warnings generated.

vim +/warn_unused_result +1284 drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c

  1249  
  1250  /* ras fs */
  1251  static BIN_ATTR(gpu_vram_bad_pages, S_IRUGO,
  1252  amdgpu_ras_sysfs_badpages_read, NULL, 0);
  1253  static DEVICE_ATTR(features, S_IRUGO,
  1254  amdgpu_ras_sysfs_features_read, NULL);
  1255  static int amdgpu_ras_fs_init(struct amdgpu_device *adev)
  1256  {
  1257  struct amdgpu_ras *con = amdgpu_ras_get_context(adev);
  1258  struct attribute_group group = {
  1259  .name = RAS_FS_NAME,
  1260  };
  1261  struct attribute *attrs[] = {
  1262  >features_attr.attr,
  1263  NULL
  1264  };
  1265  struct bin_attribute *bin_attrs[] = {
  1266  NULL,
  1267  NULL,
  1268  };
  1269  
  1270  /* add features entry */
  1271  con->features_attr = dev_attr_features;
  1272  group.attrs = attrs;
  1273  sysfs_attr_init(attrs[0]);
  1274  
  1275  if (amdgpu_bad_page_threshold != 0) {
  1276  /* add bad_page_features entry */
  1277  bin_attr_gpu_vram_bad_pages.private = NULL;
  1278  con->badpages_attr = bin_attr_gpu_vram_bad_pages;
  1279  bin_attrs[0] = >badpages_attr;
  1280  group.bin_attrs = bin_attrs;
  1281  sysfs_bin_attr_init(bin_attrs[0]);
  1282  }
  1283  
> 1284  sysfs_create_group(>dev->kobj, );
  1285  
  1286  return 0;
  1287  }
  1288  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org


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


Re: [PATCH] drm/panel: s6e63m0: Support max-brightness

2020-12-14 Thread Sam Ravnborg
Hi Linus.
On Mon, Dec 14, 2020 at 11:22:10PM +0100, Linus Walleij wrote:
> The "max-brightness" is a standard backlight property that
> we need to support for the Samsung GT-I8190 Golden because
> the display will go black if we crank up the brightness
> too high.
> 
> As the platform needs this ability to give picture this is
> a regression fix along with the addition of the property
> to the GT-I8190 device tree.
> 
> Cc: Stephan Gerhold 
> Fixes: 9c3f0a0dd6a1 ("drm/panel: s6e63m0: Implement 28 backlight levels")
> Signed-off-by: Linus Walleij 

Looks good. backlight_properties.max_brightness is an int, but this
looks like a sub-optimal type so the use of u32 in this patch is fine.

Reviewed-by: Sam Ravnborg 

As we are in the merge window it should be drm-next-fixes material,
but you may have to wait until -rc2 before the drm-next-fixes branched
is ready.

Sam

> ---
>  drivers/gpu/drm/panel/panel-samsung-s6e63m0.c | 17 +
>  1 file changed, 13 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c 
> b/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c
> index bf6d704d4d27..603c5dfe8768 100644
> --- a/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c
> +++ b/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c
> @@ -692,12 +692,12 @@ static const struct backlight_ops s6e63m0_backlight_ops 
> = {
>   .update_status  = s6e63m0_set_brightness,
>  };
>  
> -static int s6e63m0_backlight_register(struct s6e63m0 *ctx)
> +static int s6e63m0_backlight_register(struct s6e63m0 *ctx, u32 
> max_brightness)
>  {
>   struct backlight_properties props = {
>   .type   = BACKLIGHT_RAW,
> - .brightness = MAX_BRIGHTNESS,
> - .max_brightness = MAX_BRIGHTNESS
> + .brightness = max_brightness,
> + .max_brightness = max_brightness,
>   };
>   struct device *dev = ctx->dev;
>   int ret = 0;
> @@ -719,6 +719,7 @@ int s6e63m0_probe(struct device *dev,
> bool dsi_mode)
>  {
>   struct s6e63m0 *ctx;
> + u32 max_brightness;
>   int ret;
>  
>   ctx = devm_kzalloc(dev, sizeof(struct s6e63m0), GFP_KERNEL);
> @@ -734,6 +735,14 @@ int s6e63m0_probe(struct device *dev,
>   ctx->enabled = false;
>   ctx->prepared = false;
>  
> + ret = device_property_read_u32(dev, "max-brightness", _brightness);
> + if (ret)
> + max_brightness = MAX_BRIGHTNESS;
> + if (max_brightness > MAX_BRIGHTNESS) {
> + dev_err(dev, "illegal max brightness specified\n");
> + max_brightness = MAX_BRIGHTNESS;
> + }
> +
>   ctx->supplies[0].supply = "vdd3";
>   ctx->supplies[1].supply = "vci";
>   ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(ctx->supplies),
> @@ -753,7 +762,7 @@ int s6e63m0_probe(struct device *dev,
>  dsi_mode ? DRM_MODE_CONNECTOR_DSI :
>  DRM_MODE_CONNECTOR_DPI);
>  
> - ret = s6e63m0_backlight_register(ctx);
> + ret = s6e63m0_backlight_register(ctx, max_brightness);
>   if (ret < 0)
>   return ret;
>  
> -- 
> 2.29.2
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[radeon-alex:amd-20.45 2016/2427] drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:3987:62: warning: passing argument 1 of 'drm_gem_fb_get_obj' discards 'const' qualifier from pointer targe

2020-12-14 Thread kernel test robot
tree:   git://people.freedesktop.org/~agd5f/linux.git amd-20.45
head:   a3950d94b046fb206e58fd3ec717f071c0203ba3
commit: e1357d7a01b8b3bf23e71415eb7ca101902ee6b4 [2016/2427] drm/amdkcl: fake 
drm_gem_fb_get_obj & kcl_drm_gem_fb_set_obj
config: mips-allyesconfig (attached as .config)
compiler: mips-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
git remote add radeon-alex git://people.freedesktop.org/~agd5f/linux.git
git fetch --no-tags radeon-alex amd-20.45
git checkout e1357d7a01b8b3bf23e71415eb7ca101902ee6b4
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross 
ARCH=mips 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot 

All warnings (new ones prefixed by >>):

   In file included from drivers/gpu/drm/amd/display/dmub/dmub_srv.h:67,
from 
drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:33:
   drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h: In function 
'dmub_rb_flush_pending':
   drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h:785:12: warning: variable 
'temp' set but not used [-Wunused-but-set-variable]
 785 |   uint64_t temp;
 |^~~~
   drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c: In function 
'amdgpu_notify_freesync':
   drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:3659:30: 
warning: variable 'old_con_state' set but not used [-Wunused-but-set-variable]
3659 |  struct drm_connector_state *old_con_state, *new_con_state;
 |  ^
   In file included from include/asm-generic/bug.h:19,
from arch/mips/include/asm/bug.h:42,
from include/linux/bug.h:5,
from arch/mips/include/asm/cmpxchg.h:11,
from arch/mips/include/asm/atomic.h:22,
from include/linux/atomic.h:7,
from include/linux/rcupdate.h:25,
from include/kcl/kcl_rcupdate.h:5,
from include/kcl/kcl_fence.h:6,
from include/kcl/backport/kcl_fence_backport.h:4,
from drivers/gpu/drm/amd/backport/backport.h:11,
from :
   drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c: In function 
'get_fb_info':
>> drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:3987:62: 
>> warning: passing argument 1 of 'drm_gem_fb_get_obj' discards 'const' 
>> qualifier from pointer target type [-Wdiscarded-qualifiers]
3987 |  struct amdgpu_bo *rbo = 
gem_to_amdgpu_bo(drm_gem_fb_get_obj(_fb->base, 0));
 |  
^~~~
   include/linux/kernel.h:986:26: note: in definition of macro 'container_of'
 986 |  void *__mptr = (void *)(ptr); \
 |  ^~~
   drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:3987:26: note: 
in expansion of macro 'gem_to_amdgpu_bo'
3987 |  struct amdgpu_bo *rbo = 
gem_to_amdgpu_bo(drm_gem_fb_get_obj(_fb->base, 0));
 |  ^~~~
   In file included from 
drivers/gpu/drm/amd/backport/include/kcl/kcl_amdgpu_drm_fb_helper.h:6,
from drivers/gpu/drm/amd/backport/backport.h:59,
from :
   include/drm/drm_gem_framebuffer_helper.h:15:24: note: expected 'struct 
drm_framebuffer *' but argument is of type 'const struct drm_framebuffer *'
  15 | struct drm_gem_object *drm_gem_fb_get_obj(struct drm_framebuffer *fb,
 |^~
   In file included from include/linux/rcupdate.h:24,
from include/kcl/kcl_rcupdate.h:5,
from include/kcl/kcl_fence.h:6,
from include/kcl/backport/kcl_fence_backport.h:4,
from drivers/gpu/drm/amd/backport/backport.h:11,
from :
>> drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:3987:62: 
>> warning: passing argument 1 of 'drm_gem_fb_get_obj' discards 'const' 
>> qualifier from pointer target type [-Wdiscarded-qualifiers]
3987 |  struct amdgpu_bo *rbo = 
gem_to_amdgpu_bo(drm_gem_fb_get_obj(_fb->base, 0));
 |  
^~~~
   include/linux/compiler.h:330:9: note: in definition of macro 
'__compiletime_assert'
 330 |   if (!(condition)) \
 | ^
   include/linux/compiler.h:350:2: note: in expansion of macro 
'_compiletime_assert'
 350 |  _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
 |  ^~~
   include/linux/build_bug.h:39:37: note: in expansion of macro 
'compiletime_assert'
  39 | 

[radeon-alex:amd-20.45 2016/2427] drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:3987:62: warning: passing argument 1 of 'drm_gem_fb_get_obj' discards 'const' qualifier from pointer targe

2020-12-14 Thread kernel test robot
tree:   git://people.freedesktop.org/~agd5f/linux.git amd-20.45
head:   a3950d94b046fb206e58fd3ec717f071c0203ba3
commit: e1357d7a01b8b3bf23e71415eb7ca101902ee6b4 [2016/2427] drm/amdkcl: fake 
drm_gem_fb_get_obj & kcl_drm_gem_fb_set_obj
config: i386-randconfig-r022-20201214 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce (this is a W=1 build):
git remote add radeon-alex git://people.freedesktop.org/~agd5f/linux.git
git fetch --no-tags radeon-alex amd-20.45
git checkout e1357d7a01b8b3bf23e71415eb7ca101902ee6b4
# save the attached .config to linux build tree
make W=1 ARCH=i386 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot 

All warnings (new ones prefixed by >>):

   In file included from drivers/gpu/drm/amd/display/dmub/dmub_srv.h:67,
from 
drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:33:
   drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h: In function 
'dmub_rb_flush_pending':
   drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h:785:12: warning: variable 
'temp' set but not used [-Wunused-but-set-variable]
 785 |   uint64_t temp;
 |^~~~
   drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c: In function 
'amdgpu_notify_freesync':
   drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:3659:30: 
warning: variable 'old_con_state' set but not used [-Wunused-but-set-variable]
3659 |  struct drm_connector_state *old_con_state, *new_con_state;
 |  ^
   In file included from include/asm-generic/bug.h:19,
from arch/x86/include/asm/bug.h:83,
from include/linux/bug.h:5,
from include/linux/jump_label.h:250,
from include/linux/static_key.h:1,
from arch/x86/include/asm/nospec-branch.h:6,
from arch/x86/include/asm/irqflags.h:9,
from include/linux/irqflags.h:16,
from include/linux/rcupdate.h:26,
from include/kcl/kcl_rcupdate.h:5,
from include/kcl/kcl_fence.h:6,
from include/kcl/backport/kcl_fence_backport.h:4,
from drivers/gpu/drm/amd/backport/backport.h:11,
from :
   drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c: In function 
'get_fb_info':
>> drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:3987:62: 
>> warning: passing argument 1 of 'drm_gem_fb_get_obj' discards 'const' 
>> qualifier from pointer target type [-Wdiscarded-qualifiers]
3987 |  struct amdgpu_bo *rbo = 
gem_to_amdgpu_bo(drm_gem_fb_get_obj(_fb->base, 0));
 |  
^~~~
   include/linux/kernel.h:986:26: note: in definition of macro 'container_of'
 986 |  void *__mptr = (void *)(ptr); \
 |  ^~~
   drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:3987:26: note: 
in expansion of macro 'gem_to_amdgpu_bo'
3987 |  struct amdgpu_bo *rbo = 
gem_to_amdgpu_bo(drm_gem_fb_get_obj(_fb->base, 0));
 |  ^~~~
   In file included from 
drivers/gpu/drm/amd/backport/include/kcl/kcl_amdgpu_drm_fb_helper.h:6,
from drivers/gpu/drm/amd/backport/backport.h:59,
from :
   include/drm/drm_gem_framebuffer_helper.h:15:24: note: expected 'struct 
drm_framebuffer *' but argument is of type 'const struct drm_framebuffer *'
  15 | struct drm_gem_object *drm_gem_fb_get_obj(struct drm_framebuffer *fb,
 |^~
   In file included from include/linux/rcupdate.h:24,
from include/kcl/kcl_rcupdate.h:5,
from include/kcl/kcl_fence.h:6,
from include/kcl/backport/kcl_fence_backport.h:4,
from drivers/gpu/drm/amd/backport/backport.h:11,
from :
>> drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:3987:62: 
>> warning: passing argument 1 of 'drm_gem_fb_get_obj' discards 'const' 
>> qualifier from pointer target type [-Wdiscarded-qualifiers]
3987 |  struct amdgpu_bo *rbo = 
gem_to_amdgpu_bo(drm_gem_fb_get_obj(_fb->base, 0));
 |  
^~~~
   include/linux/compiler.h:330:9: note: in definition of macro 
'__compiletime_assert'
 330 |   if (!(condition)) \
 | ^
   include/linux/compiler.h:350:2: note: in expansion of macro 
'_compiletime_assert'
 350 |  _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
 |  ^~~
   include/linux/build_bug.h:39:37: note: in expansion of macro 
'compiletime_assert'
  39 | #define BUIL

[radeon-alex:amd-20.45 1835/2427] drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c:788:5: error: redefinition of 'amdgpu_mn_register'

2020-12-14 Thread kernel test robot
tree:   git://people.freedesktop.org/~agd5f/linux.git amd-20.45
head:   a3950d94b046fb206e58fd3ec717f071c0203ba3
commit: 90e75e02fc4f30c8139b7321f8bbd635ec9d75ce [1835/2427] drm/amdkcl: dkms 
support for hmm
config: x86_64-randconfig-a002-20201214 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 
a29ecca7819a6ed4250d3689b12b1f664bb790d7)
reproduce (this is a W=1 build):
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# install x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
git remote add radeon-alex git://people.freedesktop.org/~agd5f/linux.git
git fetch --no-tags radeon-alex amd-20.45
git checkout 90e75e02fc4f30c8139b7321f8bbd635ec9d75ce
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot 

All errors (new ones prefixed by >>):

>> drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c:788:5: error: redefinition of 
>> 'amdgpu_mn_register'
   int amdgpu_mn_register(struct amdgpu_bo *bo, unsigned long addr)
   ^
   drivers/gpu/drm/amd/amdgpu/amdgpu_mn.h:70:19: note: previous definition is 
here
   static inline int amdgpu_mn_register(struct amdgpu_bo *bo, unsigned long 
addr)
 ^
>> drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c:806:6: error: redefinition of 
>> 'amdgpu_mn_unregister'
   void amdgpu_mn_unregister(struct amdgpu_bo *bo)
^
   drivers/gpu/drm/amd/amdgpu/amdgpu_mn.h:76:20: note: previous definition is 
here
   static inline void amdgpu_mn_unregister(struct amdgpu_bo *bo) {}
  ^
   2 errors generated.

vim +/amdgpu_mn_register +788 drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c

   778  
   779  /**
   780   * amdgpu_mn_register - register a BO for notifier updates
   781   *
   782   * @bo: amdgpu buffer object
   783   * @addr: userptr addr we should monitor
   784   *
   785   * Registers a mmu_notifier for the given BO at the specified address.
   786   * Returns 0 on success, -ERRNO if anything goes wrong.
   787   */
 > 788  int amdgpu_mn_register(struct amdgpu_bo *bo, unsigned long addr)
   789  {
   790  if (bo->kfd_bo)
   791  return mmu_interval_notifier_insert(>notifier, 
current->mm,
   792  addr, 
amdgpu_bo_size(bo),
   793  _mn_hsa_ops);
   794  return mmu_interval_notifier_insert(>notifier, current->mm, 
addr,
   795  amdgpu_bo_size(bo),
   796  _mn_gfx_ops);
   797  }
   798  
   799  /**
   800   * amdgpu_mn_unregister - unregister a BO for notifier updates
   801   *
   802   * @bo: amdgpu buffer object
   803   *
   804   * Remove any registration of mmu notifier updates from the buffer 
object.
   805   */
 > 806  void amdgpu_mn_unregister(struct amdgpu_bo *bo)

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org


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


[radeon-alex:amd-20.45 2016/2427] drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:3987:33: sparse: sparse: incorrect type in argument 1 (different modifiers)

2020-12-14 Thread kernel test robot
tree:   git://people.freedesktop.org/~agd5f/linux.git amd-20.45
head:   a3950d94b046fb206e58fd3ec717f071c0203ba3
commit: e1357d7a01b8b3bf23e71415eb7ca101902ee6b4 [2016/2427] drm/amdkcl: fake 
drm_gem_fb_get_obj & kcl_drm_gem_fb_set_obj
config: arc-randconfig-s031-20201214 (attached as .config)
compiler: arc-elf-gcc (GCC) 9.3.0
reproduce:
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.3-184-g1b896707-dirty
git remote add radeon-alex git://people.freedesktop.org/~agd5f/linux.git
git fetch --no-tags radeon-alex amd-20.45
git checkout e1357d7a01b8b3bf23e71415eb7ca101902ee6b4
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 
CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=arc 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot 


"sparse warnings: (new ones prefixed by >>)"
   drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:797:25: sparse: 
sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:801:23: sparse: 
sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:802:23: sparse: 
sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:805:30: sparse: 
sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:808:28: sparse: 
sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:1192:17: sparse: 
sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:1192:17: sparse: 
sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:1192:17: sparse: 
sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:1192:17: sparse: 
sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:1192:17: sparse: 
sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:1192:17: sparse: 
sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:1197:17: sparse: 
sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:1197:17: sparse: 
sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:1197:17: sparse: 
sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:1199:36: sparse: 
sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:1276:25: sparse: 
sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:1276:25: sparse: 
sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:1276:25: sparse: 
sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:1282:37: sparse: 
sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:1308:41: sparse: 
sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:1310:39: sparse: 
sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:1314:17: sparse: 
sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:1315:17: sparse: 
sparse: cast to restricted __le32
   drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:1318:17: sparse: 
sparse: cast to restricted __le32
>> drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:3987:33: sparse: 
>> sparse: incorrect type in argument 1 (different modifiers) @@ expected 
>> struct drm_framebuffer *fb @@ got struct drm_framebuffer const * @@
   drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:3987:33: sparse: 
expected struct drm_framebuffer *fb
   drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:3987:33: sparse: 
got struct drm_framebuffer const *
>> drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:3987:33: sparse: 
>> sparse: incorrect type in argument 1 (different modifiers) @@ expected 
>> struct drm_framebuffer *fb @@ got struct drm_framebuffer const * @@
   drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:3987:33: sparse: 
expected struct drm_framebuffer *fb
   drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:3987:33: sparse: 
got struct drm_framebuffer const *
>> drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:3987:33: sparse: 
>> sparse: incorrect type in argument 1 (different 

Re: [PATCH v3 3/3] drm/amd/display: Skip modeset for front porch change

2020-12-14 Thread Shashank Sharma

On 15/12/20 3:50 am, Aurabindo Pillai wrote:
> [Why]
> Inorder to enable freesync video mode, driver adds extra
> modes based on preferred modes for common freesync frame rates.
> When commiting these mode changes, a full modeset is not needed.
> If the change in only in the front porch timing value, skip full
> modeset and continue using the same stream.
>
> Signed-off-by: Aurabindo Pillai 
> Acked-by: Christian König 
> ---
>  .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 210 +++---
>  .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h |   1 +
>  2 files changed, 179 insertions(+), 32 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 c1ffd33e9d83..4ba6be59dcd5 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -213,6 +213,9 @@ static bool amdgpu_dm_psr_disable_all(struct 
> amdgpu_display_manager *dm);
>  static const struct drm_format_info *
>  amd_get_format_info(const struct drm_mode_fb_cmd2 *cmd);
>  
> +static bool
> +is_timing_unchanged_for_freesync(struct drm_crtc_state *old_crtc_state,
> +  struct drm_crtc_state *new_crtc_state);
Do we need this forward declaration for a static function ?
>  /*
>   * dm_vblank_get_counter
>   *
> @@ -4940,7 +4943,8 @@ static void 
> fill_stream_properties_from_drm_display_mode(
>   const struct drm_connector *connector,
>   const struct drm_connector_state *connector_state,
>   const struct dc_stream_state *old_stream,
> - int requested_bpc)
> + int requested_bpc,
> + bool is_in_modeset)
>  {
>   struct dc_crtc_timing *timing_out = >timing;
>   const struct drm_display_info *info = >display_info;
> @@ -4995,19 +4999,28 @@ static void 
> fill_stream_properties_from_drm_display_mode(
>   timing_out->hdmi_vic = hv_frame.vic;
>   }
>  
> - timing_out->h_addressable = mode_in->crtc_hdisplay;
> - timing_out->h_total = mode_in->crtc_htotal;
> - timing_out->h_sync_width =
> - mode_in->crtc_hsync_end - mode_in->crtc_hsync_start;
> - timing_out->h_front_porch =
> - mode_in->crtc_hsync_start - mode_in->crtc_hdisplay;
> - timing_out->v_total = mode_in->crtc_vtotal;
> - timing_out->v_addressable = mode_in->crtc_vdisplay;
> - timing_out->v_front_porch =
> - mode_in->crtc_vsync_start - mode_in->crtc_vdisplay;
> - timing_out->v_sync_width =
> - mode_in->crtc_vsync_end - mode_in->crtc_vsync_start;
> - timing_out->pix_clk_100hz = mode_in->crtc_clock * 10;
> + if (is_in_modeset) {
> + timing_out->h_addressable = mode_in->hdisplay;
> + timing_out->h_total = mode_in->htotal;
> + timing_out->h_sync_width = mode_in->hsync_end - 
> mode_in->hsync_start;
> + timing_out->h_front_porch = mode_in->hsync_start - 
> mode_in->hdisplay;
> + timing_out->v_total = mode_in->vtotal;
> + timing_out->v_addressable = mode_in->vdisplay;
> + timing_out->v_front_porch = mode_in->vsync_start - 
> mode_in->vdisplay;
> + timing_out->v_sync_width = mode_in->vsync_end - 
> mode_in->vsync_start;
> + timing_out->pix_clk_100hz = mode_in->clock * 10;
> + } else {
> + timing_out->h_addressable = mode_in->crtc_hdisplay;
> + timing_out->h_total = mode_in->crtc_htotal;
> + timing_out->h_sync_width = mode_in->crtc_hsync_end - 
> mode_in->crtc_hsync_start;
> + timing_out->h_front_porch = mode_in->crtc_hsync_start - 
> mode_in->crtc_hdisplay;
> + timing_out->v_total = mode_in->crtc_vtotal;
> + timing_out->v_addressable = mode_in->crtc_vdisplay;
> + timing_out->v_front_porch = mode_in->crtc_vsync_start - 
> mode_in->crtc_vdisplay;
> + timing_out->v_sync_width = mode_in->crtc_vsync_end - 
> mode_in->crtc_vsync_start;
> + timing_out->pix_clk_100hz = mode_in->crtc_clock * 10;
> + }
> +
>   timing_out->aspect_ratio = get_aspect_ratio(mode_in);
>  
>   stream->output_color_space = get_output_color_space(timing_out);
> @@ -5227,6 +5240,24 @@ get_highest_refresh_rate_mode(struct 
> amdgpu_dm_connector *aconnector,
>   return m_pref;
>  }
>  
> +static bool is_freesync_video_mode(struct drm_display_mode *mode,
> +struct amdgpu_dm_connector *aconnector)
> +{
> + struct drm_display_mode *high_mode;
> +
> + high_mode = get_highest_refresh_rate_mode(aconnector, false);
> + if (!high_mode || !mode)
> + return false;
> +
> + if (high_mode->clock == 0 ||
> + high_mode->hdisplay != mode->hdisplay ||
> + high_mode->vdisplay != mode->vdisplay ||
> + high_mode->clock != mode->clock)
> + return false;
> + else
> + return true;
> +}
> +
>  static struct 

[radeon-alex:amd-20.45 1087/2427] drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h:679:12: warning: variable 'temp' set but not used

2020-12-14 Thread kernel test robot
Hi Anthony,

FYI, the error/warning still remains.

tree:   git://people.freedesktop.org/~agd5f/linux.git amd-20.45
head:   a3950d94b046fb206e58fd3ec717f071c0203ba3
commit: cba14b2c4e6c30f8af8c1fe00893e11e040d1873 [1087/2427] drm/amd/display: 
combine public interfaces into single header
config: i386-randconfig-r022-20201214 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce (this is a W=1 build):
git remote add radeon-alex git://people.freedesktop.org/~agd5f/linux.git
git fetch --no-tags radeon-alex amd-20.45
git checkout cba14b2c4e6c30f8af8c1fe00893e11e040d1873
# save the attached .config to linux build tree
make W=1 ARCH=i386 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot 

All warnings (new ones prefixed by >>):

   In file included from drivers/gpu/drm/amd/display/dmub/dmub_srv.h:67,
from 
drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm_debugfs.c:35:
   drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h: In function 
'dmub_rb_flush_pending':
>> drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h:679:12: warning: variable 
>> 'temp' set but not used [-Wunused-but-set-variable]
 679 |   uint64_t temp;
 |^~~~
   In file included from 
drivers/gpu/drm/amd/backport/include/kcl/kcl_amdgpu.h:5,
from drivers/gpu/drm/amd/backport/backport.h:17,
from :
   At top level:
   drivers/gpu/drm/amd/amdgpu/amdgpu.h:193:18: warning: 'sched_policy' defined 
but not used [-Wunused-const-variable=]
 193 | static const int sched_policy = KFD_SCHED_POLICY_HWS;
 |  ^~~~
   In file included from drivers/gpu/drm/amd/display/dc/dc_types.h:33,
from drivers/gpu/drm/amd/display/dc/dm_services_types.h:30,
from drivers/gpu/drm/amd/include/dm_pp_interface.h:26,
from drivers/gpu/drm/amd/amdgpu/amdgpu.h:64,
from 
drivers/gpu/drm/amd/backport/include/kcl/kcl_amdgpu.h:5,
from drivers/gpu/drm/amd/backport/backport.h:17,
from :
   drivers/gpu/drm/amd/display/include/fixed31_32.h:76:32: warning: 
'dc_fixpt_ln2_div_2' defined but not used [-Wunused-const-variable=]
  76 | static const struct fixed31_32 dc_fixpt_ln2_div_2 = { 1488522236LL };
 |^~
   drivers/gpu/drm/amd/display/include/fixed31_32.h:75:32: warning: 
'dc_fixpt_ln2' defined but not used [-Wunused-const-variable=]
  75 | static const struct fixed31_32 dc_fixpt_ln2 = { 2977044471LL };
 |^~~~
   drivers/gpu/drm/amd/display/include/fixed31_32.h:74:32: warning: 
'dc_fixpt_e' defined but not used [-Wunused-const-variable=]
  74 | static const struct fixed31_32 dc_fixpt_e = { 11674931555LL };
 |^~
   drivers/gpu/drm/amd/display/include/fixed31_32.h:73:32: warning: 
'dc_fixpt_two_pi' defined but not used [-Wunused-const-variable=]
  73 | static const struct fixed31_32 dc_fixpt_two_pi = { 26986075409LL };
 |^~~
   drivers/gpu/drm/amd/display/include/fixed31_32.h:72:32: warning: 
'dc_fixpt_pi' defined but not used [-Wunused-const-variable=]
  72 | static const struct fixed31_32 dc_fixpt_pi = { 13493037705LL };
 |^~~
   drivers/gpu/drm/amd/display/include/fixed31_32.h:67:32: warning: 
'dc_fixpt_zero' defined but not used [-Wunused-const-variable=]
  67 | static const struct fixed31_32 dc_fixpt_zero = { 0 };
 |^
--
   In file included from drivers/gpu/drm/amd/display/dmub/dmub_srv.h:67,
from drivers/gpu/drm/amd/display/dc/dc_dmub_srv.h:30,
from 
drivers/gpu/drm/amd/amdgpu/../display/dc/dce/dmub_psr.c:28:
   drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h: In function 
'dmub_rb_flush_pending':
>> drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h:679:12: warning: variable 
>> 'temp' set but not used [-Wunused-but-set-variable]
 679 |   uint64_t temp;
 |^~~~
   In file included from drivers/gpu/drm/amd/display/dc/inc/core_types.h:88,
from 
drivers/gpu/drm/amd/amdgpu/../display/dc/dce/dmub_psr.c:30:
   At top level:
   drivers/gpu/drm/amd/display/dc/inc/hw/dpp.h:54:42: warning: 
'dpp_input_csc_matrix' defined but not used [-Wunused-const-variable=]
  54 | static const struct dpp_input_csc_matrix dpp_input_csc_matrix[] = {
 |  ^~~~
   In file included from drivers/gpu/drm/amd/display/dc/inc/core_types.h:32,
from 
drivers/gpu/drm/amd/amdgpu/../display/dc/dce/dmub_psr.c:30:
   drivers/gpu/drm/amd/display/include/ddc_s

[radeon-alex:amd-20.45 1016/2427] drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c:854:6: warning: no previous prototype for 'kgd_gfx_v9_set_address_watch'

2020-12-14 Thread kernel test robot
tree:   git://people.freedesktop.org/~agd5f/linux.git amd-20.45
head:   a3950d94b046fb206e58fd3ec717f071c0203ba3
commit: 0c6b8c594dad29321b0a233ac5b81a6eb1fbf4cf [1016/2427] drm/amdkfd: 
Initial gfx9 debug address watch
config: powerpc-allyesconfig (attached as .config)
compiler: powerpc64-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
git remote add radeon-alex git://people.freedesktop.org/~agd5f/linux.git
git fetch --no-tags radeon-alex amd-20.45
git checkout 0c6b8c594dad29321b0a233ac5b81a6eb1fbf4cf
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross 
ARCH=powerpc 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot 

All warnings (new ones prefixed by >>):

   drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c:108:6: warning: no 
previous prototype for 'kgd_gfx_v9_program_sh_mem_settings' 
[-Wmissing-prototypes]
 108 | void kgd_gfx_v9_program_sh_mem_settings(struct kgd_dev *kgd, 
uint32_t vmid,
 |  ^~
   drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c:125:5: warning: no 
previous prototype for 'kgd_gfx_v9_set_pasid_vmid_mapping' 
[-Wmissing-prototypes]
 125 | int kgd_gfx_v9_set_pasid_vmid_mapping(struct kgd_dev *kgd, unsigned 
int pasid,
 | ^
   drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c:186:5: warning: no 
previous prototype for 'kgd_gfx_v9_init_interrupts' [-Wmissing-prototypes]
 186 | int kgd_gfx_v9_init_interrupts(struct kgd_dev *kgd, uint32_t pipe_id)
 | ^~
   drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c:245:5: warning: no 
previous prototype for 'kgd_gfx_v9_hqd_load' [-Wmissing-prototypes]
 245 | int kgd_gfx_v9_hqd_load(struct kgd_dev *kgd, void *mqd, uint32_t 
pipe_id,
 | ^~~
   drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c:325:5: warning: no 
previous prototype for 'kgd_gfx_v9_hiq_mqd_load' [-Wmissing-prototypes]
 325 | int kgd_gfx_v9_hiq_mqd_load(struct kgd_dev *kgd, void *mqd,
 | ^~~
   drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c:378:5: warning: no 
previous prototype for 'kgd_gfx_v9_hqd_dump' [-Wmissing-prototypes]
 378 | int kgd_gfx_v9_hqd_dump(struct kgd_dev *kgd,
 | ^~~
   drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c:512:6: warning: no 
previous prototype for 'kgd_gfx_v9_hqd_is_occupied' [-Wmissing-prototypes]
 512 | bool kgd_gfx_v9_hqd_is_occupied(struct kgd_dev *kgd, uint64_t 
queue_address,
 |  ^~
   drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c:553:5: warning: no 
previous prototype for 'kgd_gfx_v9_hqd_destroy' [-Wmissing-prototypes]
 553 | int kgd_gfx_v9_hqd_destroy(struct kgd_dev *kgd, void *mqd,
 | ^~
   drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c:643:6: warning: no 
previous prototype for 'kgd_gfx_v9_get_atc_vmid_pasid_mapping_info' 
[-Wmissing-prototypes]
 643 | bool kgd_gfx_v9_get_atc_vmid_pasid_mapping_info(struct kgd_dev *kgd,
 |  ^~
   drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c:656:5: warning: no 
previous prototype for 'kgd_gfx_v9_address_watch_disable' [-Wmissing-prototypes]
 656 | int kgd_gfx_v9_address_watch_disable(struct kgd_dev *kgd)
 | ^~~~
   drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c:680:5: warning: no 
previous prototype for 'kgd_gfx_v9_address_watch_execute' [-Wmissing-prototypes]
 680 | int kgd_gfx_v9_address_watch_execute(struct kgd_dev *kgd,
 | ^~~~
   drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c:715:5: warning: no 
previous prototype for 'kgd_gfx_v9_wave_control_execute' [-Wmissing-prototypes]
 715 | int kgd_gfx_v9_wave_control_execute(struct kgd_dev *kgd,
 | ^~~
   drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c:740:10: warning: no 
previous prototype for 'kgd_gfx_v9_address_watch_get_offset' 
[-Wmissing-prototypes]
 740 | uint32_t kgd_gfx_v9_address_watch_get_offset(struct kgd_dev *kgd,
 |  ^~~
   drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c:748:10: warning: no 
previous prototype for 'kgd_gfx_v9_enable_debug_trap' [-Wmissing-prototypes]
 748 | uint32_t kgd_gfx_v9_enable_debug_trap(struct kgd_dev *kgd,
 |  ^~~~
   drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c:779:10: warning: no 
previous prototype for 'kgd_gfx_v9_disable_debug_trap' [-Wmissing-prototypes]
 779 | uint32_t kgd_gfx_v9_disable_debug_trap(struct kgd_dev 

Re: [PATCH v3 2/3] drm/amd/display: Add freesync video modes based on preferred modes

2020-12-14 Thread Shashank Sharma

On 15/12/20 3:50 am, Aurabindo Pillai wrote:
> [Why]
> If experimental freesync video mode module parameter is enabled, add
> few extra display modes into the driver's mode list corresponding to common
> video frame rates. When userspace sets these modes, no modeset will be
> performed (if current mode was one of freesync modes or the base freesync mode
> based off which timings have been generated for the rest of the freesync 
> modes)
> since these modes only differ from the base mode with front porch timing.
>
> Signed-off-by: Aurabindo Pillai 
> Acked-by: Christian König 
> ---
>  .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 167 ++
>  .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h |   2 +
>  2 files changed, 169 insertions(+)
>
> 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 e7ee2467eadb..c1ffd33e9d83 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -5174,6 +5174,59 @@ static void 
> dm_enable_per_frame_crtc_master_sync(struct dc_state *context)
>   set_master_stream(context->streams, context->stream_count);
>  }
>  
> +static struct drm_display_mode *
> +get_highest_refresh_rate_mode(struct amdgpu_dm_connector *aconnector,
> +   bool use_probed_modes)
> +{
> + struct drm_display_mode *m, *m_pref = NULL;
> + u16 current_refresh, highest_refresh;
> + struct list_head *list_head = use_probed_modes ?
> + 
> >base.probed_modes :
> + >base.modes;
> +
> + if (aconnector->freesync_vid_base.clock != 0)
> + return >freesync_vid_base;
> +
> + /* Find the preferred mode */
> + list_for_each_entry (m, list_head, head) {
> + if (m->type & DRM_MODE_TYPE_PREFERRED) {
> + m_pref = m;
> + break;
> + }
> + }
> +
> + if (!m_pref) {
> + /* Probably an EDID with no preferred mode. Fallback to first 
> entry */
> + m_pref = list_first_entry_or_null(
> + >base.modes, struct drm_display_mode, head);
> + if (!m_pref) {
> + DRM_DEBUG_DRIVER("No preferred mode found in EDID\n");
> + return NULL;
> + }
> + }
> +
> + highest_refresh = drm_mode_vrefresh(m_pref);
> +
> + /*
> +  * Find the mode with highest refresh rate with same resolution.
> +  * For some monitors, preferred mode is not the mode with highest
> +  * supported refresh rate.
> +  */
> + list_for_each_entry (m, list_head, head) {
> + current_refresh  = drm_mode_vrefresh(m);
> +
> + if (m->hdisplay == m_pref->hdisplay &&
> + m->vdisplay == m_pref->vdisplay &&
> + highest_refresh < current_refresh) {
> + highest_refresh = current_refresh;
> + m_pref = m;
> + }
> + }
> +
> + aconnector->freesync_vid_base = *m_pref;
> + return m_pref;
> +}
> +
>  static struct dc_stream_state *
>  create_stream_for_sink(struct amdgpu_dm_connector *aconnector,
>  const struct drm_display_mode *drm_mode,
> @@ -6999,6 +7052,119 @@ static void amdgpu_dm_connector_ddc_get_modes(struct 
> drm_connector *connector,
>   }
>  }
>  
> +static bool is_duplicate_mode(struct amdgpu_dm_connector *aconnector,
> +   struct drm_display_mode *mode)
> +{
> + struct drm_display_mode *m;
> +
> + list_for_each_entry (m, >base.probed_modes, head) {
> + if (drm_mode_equal(m, mode))
> + return true;
> + }
> +
> + return false;
> +}
> +
> +static uint add_fs_modes(struct amdgpu_dm_connector *aconnector,
> +  struct detailed_data_monitor_range *range)
> +{
> + const struct drm_display_mode *m;
> + struct drm_display_mode *new_mode;
> + uint i;
> + uint64_t target_vtotal, target_vtotal_diff;
> + uint32_t new_modes_count = 0;
> + uint64_t num, den;
My previous review comment about num,den, target_vtotal and target_vtotal_diff 
here was neither addressed nor explained.
> +
> + /* Standard FPS values
> +  *
> +  * 23.976 - TV/NTSC
> +  * 24 - Cinema
> +  * 25 - TV/PAL
> +  * 29.97  - TV/NTSC
> +  * 30 - TV/NTSC
> +  * 48 - Cinema HFR
> +  * 50 - TV/PAL
> +  */
My previous review comment about 60 fps here was neither addressed nor 
explained.
> + const uint32_t common_rates[] = { 23976, 24000, 25000, 29970, 3,
> +  48000, 5, 6, 72000, 96000 };
> +
> + /*
> +  * Find mode with highest refresh rate with the same resolution
> +  * as the preferred mode. Some monitors report a preferred mode
> +  * with 

Re: linux-next: build warning after merge of the amdgpu tree

2020-12-14 Thread Stephen Rothwell
Hi all,

On Tue, 15 Dec 2020 06:56:08 +1100 Stephen Rothwell  
wrote:
>
> On Tue, 17 Nov 2020 15:45:14 +1100 Stephen Rothwell  
> wrote:
> >
> > After merging the amdgpu tree, today's linux-next build (htmldocs)
> > produced this warning:
> > 
> > drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h:353: warning: Function 
> > parameter or member 'crc_win_x_start_property' not described in 
> > 'amdgpu_display_manager'
> > drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h:353: warning: Function 
> > parameter or member 'crc_win_y_start_property' not described in 
> > 'amdgpu_display_manager'
> > drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h:353: warning: Function 
> > parameter or member 'crc_win_x_end_property' not described in 
> > 'amdgpu_display_manager'
> > drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h:353: warning: Function 
> > parameter or member 'crc_win_y_end_property' not described in 
> > 'amdgpu_display_manager'
> > 
> > Introduced by commit
> > 
> >   c920888c604d ("drm/amd/display: Expose new CRC window property")  
> 
> I am still getting those warnings.  That commit is now in the drm tree.

These warnings are now from Linus' tree.

-- 
Cheers,
Stephen Rothwell


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


Re: linux-next: build warnings after merge of the drm tree

2020-12-14 Thread Stephen Rothwell
Hi all,

On Tue, 15 Dec 2020 06:50:45 +1100 Stephen Rothwell  
wrote:
>
> On Mon, 16 Nov 2020 10:44:44 +1100 Stephen Rothwell  
> wrote:
> >
> > On Thu, 5 Nov 2020 17:50:31 +1100 Stephen Rothwell  
> > wrote:  
> > >
> > > After merging the drm tree, today's linux-next build (htmldocs) produced
> > > these warnings:
> > > 
> > > include/linux/dma-buf-map.h:106: warning: Excess function parameter 
> > > 'vaddr' description in 'DMA_BUF_MAP_INIT_VADDR'
> > > include/linux/dma-buf-map.h:106: warning: Function parameter or member 
> > > 'vaddr_' not described in 'DMA_BUF_MAP_INIT_VADDR'
> > > include/linux/dma-buf-map.h:106: warning: Excess function parameter 
> > > 'vaddr' description in 'DMA_BUF_MAP_INIT_VADDR'
> > > 
> > > Introduced by commit
> > > 
> > >   20e76f1a7059 ("dma-buf: Use struct dma_buf_map in dma_buf_vunmap() 
> > > interfaces")
> > 
> > I am still getting these warnings.  
> 
> I am still getting these warnings.

These warnings are now from Linus' tree.

-- 
Cheers,
Stephen Rothwell


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


[Bug 205147] Unable to shut down - radeon_drv.c - radeon_suspend_kms()

2020-12-14 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=205147

Richard Herbert (rherb...@sympatico.ca) changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |CODE_FIX

--- Comment #5 from Richard Herbert (rherb...@sympatico.ca) ---
Sorry for not closing a LONG time ago.

-- 
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


[radeon-alex:amd-20.45 630/2427] drivers/gpu/drm/amd/amdgpu/amdgpu_sem.c:103:17: sparse: sparse: incorrect type in initializer (different base types)

2020-12-14 Thread kernel test robot
tree:   git://people.freedesktop.org/~agd5f/linux.git amd-20.45
head:   a3950d94b046fb206e58fd3ec717f071c0203ba3
commit: 4978452e875a60112754d1247480cd76321e3ff9 [630/2427] drm/amdkcl: 
generate config.h
config: arc-randconfig-s031-20201214 (attached as .config)
compiler: arc-elf-gcc (GCC) 9.3.0
reproduce:
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.3-184-g1b896707-dirty
git remote add radeon-alex git://people.freedesktop.org/~agd5f/linux.git
git fetch --no-tags radeon-alex amd-20.45
git checkout 4978452e875a60112754d1247480cd76321e3ff9
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 
CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=arc 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot 


"sparse warnings: (new ones prefixed by >>)"
>> drivers/gpu/drm/amd/amdgpu/amdgpu_sem.c:103:17: sparse: sparse: incorrect 
>> type in initializer (different base types) @@ expected restricted 
>> __poll_t ( *poll )( ... ) @@ got unsigned int ( * )( ... ) @@
   drivers/gpu/drm/amd/amdgpu/amdgpu_sem.c:103:17: sparse: expected 
restricted __poll_t ( *poll )( ... )
   drivers/gpu/drm/amd/amdgpu/amdgpu_sem.c:103:17: sparse: got unsigned int 
( * )( ... )
--
   drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c:158:9: sparse: sparse: incompatible 
types in conditional expression (different base types):
   drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c:158:9: sparse:void
   drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c:158:9: sparse:int
   drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c:529:5: sparse: sparse: symbol 
'psp_ta_invoke' was not declared. Should it be static?
>> drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c:1899:21: sparse: sparse: incorrect 
>> type in argument 1 (different address spaces) @@ expected void volatile 
>> [noderef]  *addr @@ got void *[assigned] cpu_addr @@
   drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c:1899:21: sparse: expected void 
volatile [noderef]  *addr
   drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c:1899:21: sparse: got void 
*[assigned] cpu_addr
   drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c:305:15: sparse: sparse: memset with 
byte count of 1048576
   drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c:407:15: sparse: sparse: memset with 
byte count of 1048576
   drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c:563:15: sparse: sparse: memset with 
byte count of 1048576
   drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c:703:15: sparse: sparse: memset with 
byte count of 1048576
   drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c:877:15: sparse: sparse: memset with 
byte count of 1048576
   drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c:1024:15: sparse: sparse: memset with 
byte count of 1048576
--
   drivers/gpu/drm/amd/amdgpu/../display/dmub/src/dmub_reg.c: note: in included 
file:
   drivers/gpu/drm/amd/amdgpu/../display/dmub/src/dmub_reg.h:61:9: sparse: 
sparse: preprocessor token REG_SET redefined
   drivers/gpu/drm/amd/amdgpu/../display/dmub/src/dmub_reg.c: note: in included 
file (through drivers/gpu/drm/amd/backport/include/kcl/kcl_amdgpu.h, 
drivers/gpu/drm/amd/backport/backport.h, builtin):
>> drivers/gpu/drm/amd/amdgpu/amdgpu.h:1082:9: sparse: this was the original 
>> definition
   drivers/gpu/drm/amd/amdgpu/../display/dmub/src/dmub_reg.c: note: in included 
file:
   drivers/gpu/drm/amd/amdgpu/../display/dmub/src/dmub_reg.h:112:9: sparse: 
sparse: preprocessor token REG_GET redefined
   drivers/gpu/drm/amd/amdgpu/../display/dmub/src/dmub_reg.c: note: in included 
file (through drivers/gpu/drm/amd/backport/include/kcl/kcl_amdgpu.h, 
drivers/gpu/drm/amd/backport/backport.h, builtin):
   drivers/gpu/drm/amd/amdgpu/amdgpu.h:1083:9: sparse: this was the original 
definition
--
   drivers/gpu/drm/amd/amdgpu/../display/dmub/src/dmub_dcn20.c: note: in 
included file:
   drivers/gpu/drm/amd/amdgpu/../display/dmub/src/dmub_reg.h:61:9: sparse: 
sparse: preprocessor token REG_SET redefined
   drivers/gpu/drm/amd/amdgpu/../display/dmub/src/dmub_dcn20.c: note: in 
included file (through drivers/gpu/drm/amd/backport/include/kcl/kcl_amdgpu.h, 
drivers/gpu/drm/amd/backport/backport.h, builtin):
>> drivers/gpu/drm/amd/amdgpu/amdgpu.h:1082:9: sparse: this was the original 
>> definition
   drivers/gpu/drm/amd/amdgpu/../display/dmub/src/dmub_dcn20.c: note: in 
included file:
   drivers/gpu/drm/amd/amdgpu/../display/dmub/src/dmub_reg.h:112:9: sparse: 
sparse: preprocessor token REG_GET redefined
   drivers/gpu/drm/amd/amdgpu/../display/dmub/src/dmub_dcn20.c: note: in 
included file (through drivers/gpu/drm/amd/backport/include/kcl/kcl_amdgpu.h, 
drivers/gpu/drm/amd/backport/backport.h, builtin):
   drivers/gpu/drm/amd/amdgpu/amdgpu.h:1083:9: sparse: this was the original 

[radeon-alex:amd-20.45 1087/2427] drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h:679:12: warning: variable 'temp' set but not used

2020-12-14 Thread kernel test robot
tree:   git://people.freedesktop.org/~agd5f/linux.git amd-20.45
head:   a3950d94b046fb206e58fd3ec717f071c0203ba3
commit: cba14b2c4e6c30f8af8c1fe00893e11e040d1873 [1087/2427] drm/amd/display: 
combine public interfaces into single header
config: mips-allyesconfig (attached as .config)
compiler: mips-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
git remote add radeon-alex git://people.freedesktop.org/~agd5f/linux.git
git fetch --no-tags radeon-alex amd-20.45
git checkout cba14b2c4e6c30f8af8c1fe00893e11e040d1873
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross 
ARCH=mips 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot 

All warnings (new ones prefixed by >>):

   In file included from drivers/gpu/drm/amd/display/dmub/dmub_srv.h:67,
from 
drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:33:
   drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h: In function 
'dmub_rb_flush_pending':
>> drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h:679:12: warning: variable 
>> 'temp' set but not used [-Wunused-but-set-variable]
 679 |   uint64_t temp;
 |^~~~
   drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c: At top level:
   drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:735:6: warning: 
no previous prototype for 'amdgpu_dm_audio_eld_notify' [-Wmissing-prototypes]
 735 | void amdgpu_dm_audio_eld_notify(struct amdgpu_device *adev, int pin)
 |  ^~
   drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:1641:16: 
warning: no previous prototype for 'amdgpu_dm_commit_zero_streams' 
[-Wmissing-prototypes]
1641 | enum dc_status amdgpu_dm_commit_zero_streams(struct dc *dc)
 |^
   drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:2866:1: warning: 
no previous prototype for 'dm_atomic_get_new_state' [-Wmissing-prototypes]
2866 | dm_atomic_get_new_state(struct drm_atomic_state *state)
 | ^~~
   drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:2884:1: warning: 
no previous prototype for 'dm_atomic_get_old_state' [-Wmissing-prototypes]
2884 | dm_atomic_get_old_state(struct drm_atomic_state *state)
 | ^~~
   drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c: In function 
'amdgpu_notify_freesync':
   drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:3544:30: 
warning: variable 'old_con_state' set but not used [-Wunused-but-set-variable]
3544 |  struct drm_connector_state *old_con_state, *new_con_state;
 |  ^
   drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c: At top level:
   drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:6312:6: warning: 
no previous prototype for 'dm_drm_plane_destroy_state' [-Wmissing-prototypes]
6312 | void dm_drm_plane_destroy_state(struct drm_plane *plane,
 |  ^~
   drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c: In function 
'amdgpu_dm_commit_cursors':
   drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:7621:44: 
warning: variable 'new_plane_state' set but not used [-Wunused-but-set-variable]
7621 |  struct drm_plane_state *old_plane_state, *new_plane_state;
 |^~~
   drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c: In function 
'amdgpu_dm_atomic_check':
   drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:9600:25: 
warning: unused variable 'dm_old_crtc_state' [-Wunused-variable]
9600 |   struct dm_crtc_state *dm_old_crtc_state  = 
to_dm_crtc_state(old_crtc_state);
 | ^
   drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:9599:25: 
warning: unused variable 'dm_new_crtc_state' [-Wunused-variable]
9599 |   struct dm_crtc_state *dm_new_crtc_state = 
to_dm_crtc_state(new_crtc_state);
 | ^
   At top level:
   drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:3483:11: 
warning: 'dm_get_backlight_level' defined but not used [-Wunused-function]
3483 | static u8 dm_get_backlight_level(struct amdgpu_encoder 
*amdgpu_encoder)
 |   ^~
   drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:3477:13: 
warning: 'dm_set_backlight_level' defined but not used [-Wunused-function]
3477 | static void dm_set_backlight_level(struct amdgpu_encoder 
*amdgpu_encoder,
 | ^~
   In file included from 

Re: [PATCH] drm/amd/display: Revert "add DCN support for aarch64"

2020-12-14 Thread Will Deacon
On Mon, Dec 14, 2020 at 06:52:25PM +0100, Ard Biesheuvel wrote:
> This reverts commit c38d444e44badc557cf29fdfdfb823604890ccfa.
> 
> Simply disabling -mgeneral-regs-only left and right is risky, given that
> the standard AArch64 ABI permits the use of FP/SIMD registers anywhere,
> and GCC is known to use SIMD registers for spilling, and may invent
> other uses of the FP/SIMD register file that have nothing to do with the
> floating point code in question. Note that putting kernel_neon_begin()
> and kernel_neon_end() around the code that does use FP is not sufficient
> here, the problem is in all the other code that may be emitted with
> references to SIMD registers in it.
> 
> So the only way to do this properly is to put all floating point code in
> a separate compilation unit, and only compile that unit with
> -mgeneral-regs-only. But perhaps the use of floating point here is
> something that should be reconsidered entirely.
> 
> Cc: Catalin Marinas 
> Cc: Will Deacon 
> Cc: Dave Martin 
> Cc: Rob Herring 
> Cc: Leo Li 
> Cc: Alex Deucher 
> Cc: "Christian König" 
> Cc: David Airlie 
> Cc: Daniel Vetter 
> Cc: Daniel Kolesa 
> Cc: amd-...@lists.freedesktop.org
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Ard Biesheuvel 
> ---
>  drivers/gpu/drm/amd/display/Kconfig   |  2 +-
>  drivers/gpu/drm/amd/display/dc/calcs/Makefile |  7 --
>  drivers/gpu/drm/amd/display/dc/clk_mgr/Makefile   |  7 --
>  drivers/gpu/drm/amd/display/dc/dcn10/Makefile |  7 --
>  drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c | 81 
> 
>  drivers/gpu/drm/amd/display/dc/dcn20/Makefile |  4 -
>  drivers/gpu/drm/amd/display/dc/dcn21/Makefile |  4 -
>  drivers/gpu/drm/amd/display/dc/dml/Makefile   | 13 
>  drivers/gpu/drm/amd/display/dc/dsc/Makefile   |  5 --
>  drivers/gpu/drm/amd/display/dc/os_types.h |  4 -
>  10 files changed, 32 insertions(+), 102 deletions(-)

I didn't notice we'd enabled this for arm64, but I agree with the reasoning
in the commit message, so:

Acked-by: Will Deacon 

The long and short of it is that it is not safe to compile kernel C code
without -mgeneral-regs-only on arm64.

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


[Bug 201539] AMDGPU R9 390 automatic fan speed control in Linux 4.19/4.20/5.0

2020-12-14 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=201539

--- Comment #74 from MasterCATZ (masterc...@hotmail.com) ---
GRUB_CMDLINE_LINUX_DEFAULT="usbcore.autosuspend=-1 amdgpu.dcfeaturemask=2
apparmor=0 amdgpu.ppfeaturemask=0xfffd7fff amdgpu.ppfeaturemask=0x
amdgpu.dc=1 amdgpu.cik_support=1 radeon.cik_support=0 radeon.si_support=0
amdgpu.si_support=1"


I am running amdgpu.dcfeaturemask=2 ?
or are the other attempted featuremask's causing issues now ?


Kernel 5.10 is working perfectly 


I turned off fancontrol service and using "marazmista/radeon-profile"

it is following my fan curve perfectly with out being locked out 

it has been years since my R9 was not cooking from 20% fanspeed issue even with
the core set @ 300mhz / 100 mhz memory

-- 
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 v2, 12/17] drm/mediatek: fix gamma size config

2020-12-14 Thread Chun-Kuang Hu
Hi, Yongqiang:

Yongqiang Niu  於 2020年12月12日 週六 下午12:13寫道:
>
> fix gamma size config

I would like you to provide more information. The original code works
in mt8173, why do you modify this? The description may be something
like this:

According to data sheet, the width is in bits [31, 16] and height is
in bits [15, 0]. Even though wrong setting may works in some SoC such
as mt8173, but it does not work in mt8192.

Regards,
Chun-Kuang.

>
> Fixes: e0a5d3370245 (drm/mediatek: Add GAMMA engine basic function)
> Signed-off-by: Yongqiang Niu 
> ---
>  drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c 
> b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
> index 00d5687..52b6fc7 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
> @@ -297,7 +297,7 @@ static void mtk_gamma_config(struct mtk_ddp_comp *comp, 
> unsigned int w,
>  unsigned int h, unsigned int vrefresh,
>  unsigned int bpc, struct cmdq_pkt *cmdq_pkt)
>  {
> -   mtk_ddp_write(cmdq_pkt, h << 16 | w, comp, DISP_GAMMA_SIZE);
> +   mtk_ddp_write(cmdq_pkt, w << 16 | h, comp, DISP_GAMMA_SIZE);
> mtk_dither_set(comp, bpc, DISP_GAMMA_CFG, cmdq_pkt);
>  }
>
> --
> 1.8.1.1.dirty
> ___
> Linux-mediatek mailing list
> linux-media...@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-mediatek
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 201539] AMDGPU R9 390 automatic fan speed control in Linux 4.19/4.20/5.0

2020-12-14 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=201539

--- Comment #73 from Alex Deucher (alexdeuc...@gmail.com) ---
(In reply to MasterCATZ from comment #72)
> 
> now if someone could solve the issue when it uses more power when running
> multiple displays ( exactly the same monitors res / hz  )
>  I can run the card single display under 10 watts plug in another display
> and its over 50 watts idle

You can enable mclk switching with identical monitors by setting
amdgpu.dcfeaturemask=2
It's enabled by default in 5.11.

-- 
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 201539] AMDGPU R9 390 automatic fan speed control in Linux 4.19/4.20/5.0

2020-12-14 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=201539

--- Comment #72 from MasterCATZ (masterc...@hotmail.com) ---
finally this summer the R9 290 GPU's will be manageable 

seems to be working , now I just have to find the old settings I changed when
trying to run it at higher rpm , @ 60deg and its doing 80%+ RPM
possibly it is now following my BIOS settings from when I was trying to force
higher RPM  when it kept trying to run under 20% 

my manual settings seem to get overwritten a second after setting them 
but at least I am not being locked out like before 


now if someone could solve the issue when it uses more power when running
multiple displays ( exactly the same monitors res / hz  )
 I can run the card single display under 10 watts plug in another display and
its over 50 watts idle

-- 
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 v5 27/29] drm/omap: dsi: remove ulps support

2020-12-14 Thread Tomi Valkeinen
On 14/12/2020 19:39, Sebastian Reichel wrote:
> Hi,
> 
> On Tue, Dec 08, 2020 at 02:28:53PM +0200, Tomi Valkeinen wrote:
>> ULPS doesn't work, and I have been unable to get it to work. As ULPS
>> is a minor power-saving feature which requires substantial amount of
>> non-trivial code, and we have trouble just getting and
>> keeping DSI working at all, remove ULPS support.
>>
>> When the DSI driver works reliably for command and video mode displays,
>> someone interested can add it back.
>>
>> Signed-off-by: Tomi Valkeinen 
>> Reviewed-by: Laurent Pinchart 
>> ---
> 
> Is it really 'minor power-saving'? If I search for DSI and ULPS among
> the first results is a TI datasheet for SN65DSI84, which claims device
> active current in the more than 100mA range and ULPS current in the
> less than 10mA range.

I don't have any numbers, just my guesses. For videomode displays or command 
mode displays in active
use, I don't think ULPS matters much. The link is mostly not in ULPS. And if 
the display is blanked,
things are off, so again not in ULPS.

It's only for command mode displays, when updated rarely, where I think ULPS 
matters. Which, of
course, is probably not unusual use case if you have a cmdmode display. But 
whether OMAP DSI power
savings matches SN65DSI84, I have no clue.

> Considering all known omapdrm DSI users are battery powered devices
> caring for saving as much power as possible, it might be good to just
> keep this until it is being fixed considering this is very close to
> the end of the series anyways?

I don't like to leave known to be broken code around, unless someone has plans 
to work on it. I
wouldn't be surprised to see ULPS still broken two years from now =). It should 
be trivial to add
the relevant bits back later.

But I can leave it here if you think it's better, presuming it doesn't have 
bigger conflicts with
the 29/29 or break anything. However, I have only a few days left in TI, which 
is why I'm rushing
here a bit (*). If I hit problems, I either have to drop the whole series, or 
push it in its current
form.

 Tomi

(*) But I will fix possible issues caused by my push, of course.

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [git pull] drm for 5.11-rc1

2020-12-14 Thread Alex Deucher
On Mon, Dec 14, 2020 at 5:45 PM Linus Torvalds
 wrote:
>
> On Mon, Dec 14, 2020 at 2:29 PM Alex Deucher  wrote:
> >
> > The relevant fixes are:
>
> Ok, I can confirm that applying those two patches gets my workstation
> working properly again.
>
> Would it be possible to get those submitted properly (or I can just
> take them as-is, but would like to get a "please just pick them
> directly")?
>
> I don't like to continue to do merges during the merge windows with a
> known broken base - it makes for a nightmare of bisection when you
> have multiple independent problems, and I assume this hits not just me
> but a lot of people with radeon/amdgpu graphics?

Yes, anyone using AMD GPUs will be affected.  The patches are already
in drm-misc, so they should show up in the next drm -fixes PR, but I
think it would be fine to pick them directly to fix support for
everyone using your tree.

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


Re: [git pull] drm for 5.11-rc1

2020-12-14 Thread Linus Torvalds
On Mon, Dec 14, 2020 at 2:29 PM Alex Deucher  wrote:
>
> The relevant fixes are:

Ok, I can confirm that applying those two patches gets my workstation
working properly again.

Would it be possible to get those submitted properly (or I can just
take them as-is, but would like to get a "please just pick them
directly")?

I don't like to continue to do merges during the merge windows with a
known broken base - it makes for a nightmare of bisection when you
have multiple independent problems, and I assume this hits not just me
but a lot of people with radeon/amdgpu graphics?

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


Re: [git pull] drm for 5.11-rc1

2020-12-14 Thread Alex Deucher
On Mon, Dec 14, 2020 at 5:21 PM Linus Torvalds
 wrote:
>
> On Thu, Dec 10, 2020 at 7:52 PM Dave Airlie  wrote:
> >
> > This is an early pull request for drm for 5.11 merge window. I'm going
> > to be out for most of the first week of the merge window so thought
> > I'd just preempt things and send this early.
>
> Ok, I've merged this, and Dave is likely gone already, but it _looks_
> like there's a problem with the drm tree on my Radeon workstation.
>
> It works fine on my i915 laptop.
>
> The symptoms are that the boot just hangs after
>
>fb0: switching to amdgpudrmfb from EFI VGA
>
> when on a working kernel the next lines are
>
>   amdgpu :49:00.0: vgaarb: deactivate vga console
>   [drm] initializing kernel modesetting (POLARIS10 0x1002:0x67DF
> 0x1DA2:0xE353 0xE7).
>   amdgpu :49:00.0: amdgpu: Trusted Memory Zone (TMZ) feature not supported
>   [drm] register mmio base: 0xE1C0
>   [drm] register mmio size: 262144
>
> I'm bisecting for more details, but it might take a while, and I
> thought I'd start the ball rolling with this initial report in case
> somebody goes "Aahh.., we know about that case already, the fix is
> XYZ"...
>

The relevant fixes are:
https://cgit.freedesktop.org/drm/drm-misc/commit/?h=drm-misc-next-fixes=aefec40938e4a0e1214f9121520aba4d51697cd9
https://cgit.freedesktop.org/drm/drm-misc/commit/?h=drm-misc-next-fixes=95e3d610d35c9c5b51e12c5c8ac18061ae08cf97

Alex



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


[PATCH] drm/panel: s6e63m0: Support max-brightness

2020-12-14 Thread Linus Walleij
The "max-brightness" is a standard backlight property that
we need to support for the Samsung GT-I8190 Golden because
the display will go black if we crank up the brightness
too high.

As the platform needs this ability to give picture this is
a regression fix along with the addition of the property
to the GT-I8190 device tree.

Cc: Stephan Gerhold 
Fixes: 9c3f0a0dd6a1 ("drm/panel: s6e63m0: Implement 28 backlight levels")
Signed-off-by: Linus Walleij 
---
 drivers/gpu/drm/panel/panel-samsung-s6e63m0.c | 17 +
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c 
b/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c
index bf6d704d4d27..603c5dfe8768 100644
--- a/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c
+++ b/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c
@@ -692,12 +692,12 @@ static const struct backlight_ops s6e63m0_backlight_ops = 
{
.update_status  = s6e63m0_set_brightness,
 };
 
-static int s6e63m0_backlight_register(struct s6e63m0 *ctx)
+static int s6e63m0_backlight_register(struct s6e63m0 *ctx, u32 max_brightness)
 {
struct backlight_properties props = {
.type   = BACKLIGHT_RAW,
-   .brightness = MAX_BRIGHTNESS,
-   .max_brightness = MAX_BRIGHTNESS
+   .brightness = max_brightness,
+   .max_brightness = max_brightness,
};
struct device *dev = ctx->dev;
int ret = 0;
@@ -719,6 +719,7 @@ int s6e63m0_probe(struct device *dev,
  bool dsi_mode)
 {
struct s6e63m0 *ctx;
+   u32 max_brightness;
int ret;
 
ctx = devm_kzalloc(dev, sizeof(struct s6e63m0), GFP_KERNEL);
@@ -734,6 +735,14 @@ int s6e63m0_probe(struct device *dev,
ctx->enabled = false;
ctx->prepared = false;
 
+   ret = device_property_read_u32(dev, "max-brightness", _brightness);
+   if (ret)
+   max_brightness = MAX_BRIGHTNESS;
+   if (max_brightness > MAX_BRIGHTNESS) {
+   dev_err(dev, "illegal max brightness specified\n");
+   max_brightness = MAX_BRIGHTNESS;
+   }
+
ctx->supplies[0].supply = "vdd3";
ctx->supplies[1].supply = "vci";
ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(ctx->supplies),
@@ -753,7 +762,7 @@ int s6e63m0_probe(struct device *dev,
   dsi_mode ? DRM_MODE_CONNECTOR_DSI :
   DRM_MODE_CONNECTOR_DPI);
 
-   ret = s6e63m0_backlight_register(ctx);
+   ret = s6e63m0_backlight_register(ctx, max_brightness);
if (ret < 0)
return ret;
 
-- 
2.29.2

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


[PATCH v3 3/3] drm/amd/display: Skip modeset for front porch change

2020-12-14 Thread Aurabindo Pillai
[Why]
Inorder to enable freesync video mode, driver adds extra
modes based on preferred modes for common freesync frame rates.
When commiting these mode changes, a full modeset is not needed.
If the change in only in the front porch timing value, skip full
modeset and continue using the same stream.

Signed-off-by: Aurabindo Pillai 
Acked-by: Christian König 
---
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 210 +++---
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h |   1 +
 2 files changed, 179 insertions(+), 32 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 c1ffd33e9d83..4ba6be59dcd5 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -213,6 +213,9 @@ static bool amdgpu_dm_psr_disable_all(struct 
amdgpu_display_manager *dm);
 static const struct drm_format_info *
 amd_get_format_info(const struct drm_mode_fb_cmd2 *cmd);
 
+static bool
+is_timing_unchanged_for_freesync(struct drm_crtc_state *old_crtc_state,
+struct drm_crtc_state *new_crtc_state);
 /*
  * dm_vblank_get_counter
  *
@@ -4940,7 +4943,8 @@ static void fill_stream_properties_from_drm_display_mode(
const struct drm_connector *connector,
const struct drm_connector_state *connector_state,
const struct dc_stream_state *old_stream,
-   int requested_bpc)
+   int requested_bpc,
+   bool is_in_modeset)
 {
struct dc_crtc_timing *timing_out = >timing;
const struct drm_display_info *info = >display_info;
@@ -4995,19 +4999,28 @@ static void 
fill_stream_properties_from_drm_display_mode(
timing_out->hdmi_vic = hv_frame.vic;
}
 
-   timing_out->h_addressable = mode_in->crtc_hdisplay;
-   timing_out->h_total = mode_in->crtc_htotal;
-   timing_out->h_sync_width =
-   mode_in->crtc_hsync_end - mode_in->crtc_hsync_start;
-   timing_out->h_front_porch =
-   mode_in->crtc_hsync_start - mode_in->crtc_hdisplay;
-   timing_out->v_total = mode_in->crtc_vtotal;
-   timing_out->v_addressable = mode_in->crtc_vdisplay;
-   timing_out->v_front_porch =
-   mode_in->crtc_vsync_start - mode_in->crtc_vdisplay;
-   timing_out->v_sync_width =
-   mode_in->crtc_vsync_end - mode_in->crtc_vsync_start;
-   timing_out->pix_clk_100hz = mode_in->crtc_clock * 10;
+   if (is_in_modeset) {
+   timing_out->h_addressable = mode_in->hdisplay;
+   timing_out->h_total = mode_in->htotal;
+   timing_out->h_sync_width = mode_in->hsync_end - 
mode_in->hsync_start;
+   timing_out->h_front_porch = mode_in->hsync_start - 
mode_in->hdisplay;
+   timing_out->v_total = mode_in->vtotal;
+   timing_out->v_addressable = mode_in->vdisplay;
+   timing_out->v_front_porch = mode_in->vsync_start - 
mode_in->vdisplay;
+   timing_out->v_sync_width = mode_in->vsync_end - 
mode_in->vsync_start;
+   timing_out->pix_clk_100hz = mode_in->clock * 10;
+   } else {
+   timing_out->h_addressable = mode_in->crtc_hdisplay;
+   timing_out->h_total = mode_in->crtc_htotal;
+   timing_out->h_sync_width = mode_in->crtc_hsync_end - 
mode_in->crtc_hsync_start;
+   timing_out->h_front_porch = mode_in->crtc_hsync_start - 
mode_in->crtc_hdisplay;
+   timing_out->v_total = mode_in->crtc_vtotal;
+   timing_out->v_addressable = mode_in->crtc_vdisplay;
+   timing_out->v_front_porch = mode_in->crtc_vsync_start - 
mode_in->crtc_vdisplay;
+   timing_out->v_sync_width = mode_in->crtc_vsync_end - 
mode_in->crtc_vsync_start;
+   timing_out->pix_clk_100hz = mode_in->crtc_clock * 10;
+   }
+
timing_out->aspect_ratio = get_aspect_ratio(mode_in);
 
stream->output_color_space = get_output_color_space(timing_out);
@@ -5227,6 +5240,24 @@ get_highest_refresh_rate_mode(struct amdgpu_dm_connector 
*aconnector,
return m_pref;
 }
 
+static bool is_freesync_video_mode(struct drm_display_mode *mode,
+  struct amdgpu_dm_connector *aconnector)
+{
+   struct drm_display_mode *high_mode;
+
+   high_mode = get_highest_refresh_rate_mode(aconnector, false);
+   if (!high_mode || !mode)
+   return false;
+
+   if (high_mode->clock == 0 ||
+   high_mode->hdisplay != mode->hdisplay ||
+   high_mode->vdisplay != mode->vdisplay ||
+   high_mode->clock != mode->clock)
+   return false;
+   else
+   return true;
+}
+
 static struct dc_stream_state *
 create_stream_for_sink(struct amdgpu_dm_connector *aconnector,
   const struct drm_display_mode *drm_mode,
@@ -5240,15 +5271,21 @@ create_stream_for_sink(struct amdgpu_dm_connector 

[PATCH v3 2/3] drm/amd/display: Add freesync video modes based on preferred modes

2020-12-14 Thread Aurabindo Pillai
[Why]
If experimental freesync video mode module parameter is enabled, add
few extra display modes into the driver's mode list corresponding to common
video frame rates. When userspace sets these modes, no modeset will be
performed (if current mode was one of freesync modes or the base freesync mode
based off which timings have been generated for the rest of the freesync modes)
since these modes only differ from the base mode with front porch timing.

Signed-off-by: Aurabindo Pillai 
Acked-by: Christian König 
---
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 167 ++
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h |   2 +
 2 files changed, 169 insertions(+)

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 e7ee2467eadb..c1ffd33e9d83 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -5174,6 +5174,59 @@ static void dm_enable_per_frame_crtc_master_sync(struct 
dc_state *context)
set_master_stream(context->streams, context->stream_count);
 }
 
+static struct drm_display_mode *
+get_highest_refresh_rate_mode(struct amdgpu_dm_connector *aconnector,
+ bool use_probed_modes)
+{
+   struct drm_display_mode *m, *m_pref = NULL;
+   u16 current_refresh, highest_refresh;
+   struct list_head *list_head = use_probed_modes ?
+   
>base.probed_modes :
+   >base.modes;
+
+   if (aconnector->freesync_vid_base.clock != 0)
+   return >freesync_vid_base;
+
+   /* Find the preferred mode */
+   list_for_each_entry (m, list_head, head) {
+   if (m->type & DRM_MODE_TYPE_PREFERRED) {
+   m_pref = m;
+   break;
+   }
+   }
+
+   if (!m_pref) {
+   /* Probably an EDID with no preferred mode. Fallback to first 
entry */
+   m_pref = list_first_entry_or_null(
+   >base.modes, struct drm_display_mode, head);
+   if (!m_pref) {
+   DRM_DEBUG_DRIVER("No preferred mode found in EDID\n");
+   return NULL;
+   }
+   }
+
+   highest_refresh = drm_mode_vrefresh(m_pref);
+
+   /*
+* Find the mode with highest refresh rate with same resolution.
+* For some monitors, preferred mode is not the mode with highest
+* supported refresh rate.
+*/
+   list_for_each_entry (m, list_head, head) {
+   current_refresh  = drm_mode_vrefresh(m);
+
+   if (m->hdisplay == m_pref->hdisplay &&
+   m->vdisplay == m_pref->vdisplay &&
+   highest_refresh < current_refresh) {
+   highest_refresh = current_refresh;
+   m_pref = m;
+   }
+   }
+
+   aconnector->freesync_vid_base = *m_pref;
+   return m_pref;
+}
+
 static struct dc_stream_state *
 create_stream_for_sink(struct amdgpu_dm_connector *aconnector,
   const struct drm_display_mode *drm_mode,
@@ -6999,6 +7052,119 @@ static void amdgpu_dm_connector_ddc_get_modes(struct 
drm_connector *connector,
}
 }
 
+static bool is_duplicate_mode(struct amdgpu_dm_connector *aconnector,
+ struct drm_display_mode *mode)
+{
+   struct drm_display_mode *m;
+
+   list_for_each_entry (m, >base.probed_modes, head) {
+   if (drm_mode_equal(m, mode))
+   return true;
+   }
+
+   return false;
+}
+
+static uint add_fs_modes(struct amdgpu_dm_connector *aconnector,
+struct detailed_data_monitor_range *range)
+{
+   const struct drm_display_mode *m;
+   struct drm_display_mode *new_mode;
+   uint i;
+   uint64_t target_vtotal, target_vtotal_diff;
+   uint32_t new_modes_count = 0;
+   uint64_t num, den;
+
+   /* Standard FPS values
+*
+* 23.976 - TV/NTSC
+* 24 - Cinema
+* 25 - TV/PAL
+* 29.97  - TV/NTSC
+* 30 - TV/NTSC
+* 48 - Cinema HFR
+* 50 - TV/PAL
+*/
+   const uint32_t common_rates[] = { 23976, 24000, 25000, 29970, 3,
+48000, 5, 6, 72000, 96000 };
+
+   /*
+* Find mode with highest refresh rate with the same resolution
+* as the preferred mode. Some monitors report a preferred mode
+* with lower resolution than the highest refresh rate supported.
+*/
+
+   m = get_highest_refresh_rate_mode(aconnector, true);
+   if (!m)
+   return 0;
+
+   for (i = 0; i < ARRAY_SIZE(common_rates); i++) {
+   if (drm_mode_vrefresh(m) * 1000 < common_rates[i])
+   continue;
+
+   if 

[PATCH v3 1/3] drm/amd/display: Add module parameter for freesync video mode

2020-12-14 Thread Aurabindo Pillai
[Why]
Adds a module parameter to enable experimental freesync video mode modeset
optimization. Enabling this mode allows the driver to skip a full modeset when
freesync compatible modes are requested by the userspace. This paramters also
adds some standard modes based on the connected monitor's VRR range.

Signed-off-by: Aurabindo Pillai 
Acked-by: Christian König 
Reviewed-by: Shashank Sharma 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h |  1 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 12 
 2 files changed, 13 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h 
b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
index eed5410947e9..e0942184efdd 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
@@ -177,6 +177,7 @@ extern int amdgpu_gpu_recovery;
 extern int amdgpu_emu_mode;
 extern uint amdgpu_smu_memory_pool_size;
 extern uint amdgpu_dc_feature_mask;
+extern uint amdgpu_exp_freesync_vid_mode;
 extern uint amdgpu_dc_debug_mask;
 extern uint amdgpu_dm_abm_level;
 extern struct amdgpu_mgpu_info mgpu_info;
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index b2a1dd7581bf..ece51ecd53d1 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -158,6 +158,7 @@ int amdgpu_mes;
 int amdgpu_noretry = -1;
 int amdgpu_force_asic_type = -1;
 int amdgpu_tmz;
+uint amdgpu_exp_freesync_vid_mode;
 int amdgpu_reset_method = -1; /* auto */
 int amdgpu_num_kcq = -1;
 
@@ -786,6 +787,17 @@ module_param_named(abmlevel, amdgpu_dm_abm_level, uint, 
0444);
 MODULE_PARM_DESC(tmz, "Enable TMZ feature (-1 = auto, 0 = off (default), 1 = 
on)");
 module_param_named(tmz, amdgpu_tmz, int, 0444);
 
+/**
+ * DOC: experimental_freesync_video (uint)
+ * Enabled the optimization to adjust front porch timing to achieve seamless 
mode change experience
+ * when setting a freesync supported mode for which full modeset is not needed.
+ * The default value: 0 (off).
+ */
+MODULE_PARM_DESC(
+   experimental_freesync_video,
+   "Enable freesync modesetting optimization feature (0 = off (default), 1 
= on)");
+module_param_named(experimental_freesync_video, amdgpu_exp_freesync_vid_mode, 
uint, 0444);
+
 /**
  * DOC: reset_method (int)
  * GPU reset method (-1 = auto (default), 0 = legacy, 1 = mode0, 2 = mode1, 3 
= mode2, 4 = baco)
-- 
2.29.2

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


Re: [git pull] drm for 5.11-rc1

2020-12-14 Thread Linus Torvalds
On Thu, Dec 10, 2020 at 7:52 PM Dave Airlie  wrote:
>
> This is an early pull request for drm for 5.11 merge window. I'm going
> to be out for most of the first week of the merge window so thought
> I'd just preempt things and send this early.

Ok, I've merged this, and Dave is likely gone already, but it _looks_
like there's a problem with the drm tree on my Radeon workstation.

It works fine on my i915 laptop.

The symptoms are that the boot just hangs after

   fb0: switching to amdgpudrmfb from EFI VGA

when on a working kernel the next lines are

  amdgpu :49:00.0: vgaarb: deactivate vga console
  [drm] initializing kernel modesetting (POLARIS10 0x1002:0x67DF
0x1DA2:0xE353 0xE7).
  amdgpu :49:00.0: amdgpu: Trusted Memory Zone (TMZ) feature not supported
  [drm] register mmio base: 0xE1C0
  [drm] register mmio size: 262144

I'm bisecting for more details, but it might take a while, and I
thought I'd start the ball rolling with this initial report in case
somebody goes "Aahh.., we know about that case already, the fix is
XYZ"...

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


[PATCH v3 0/3] Experimental freesync video mode optimization

2020-12-14 Thread Aurabindo Pillai
Changes in V3
=

1) Add freesync video modes based on preferred modes:

* Cache base freesync video mode during the first iteration to avoid
  iterating over modelist again later.
* Add mode for 60 fps videos

2) Skip modeset for front porch change

* Fixes for bug exposed by caching of modes.

Changes in V2
=

1) Add freesync video modes based on preferred modes:

* Remove check for connector type before adding freesync compatible
  modes as VRR support is being checked, and there is no reason to block
  freesync video support on eDP.
* use drm_mode_equal() instead of creating same functionality.
* Additional null pointer deference check
* Removed unnecessary variables.
* Cosmetic fixes.

2) Skip modeset for front porch change

* Remove _FSV string being appended to freesync video modes so as to not
  define new policies or break existing application that might use the
  mode name to figure out mode resolution.
* Remove unnecessary variables
* Cosmetic fixes.

--

This patchset enables freesync video mode usecase where the userspace
can request a freesync compatible video mode such that switching to this
mode does not trigger blanking.

This feature is guarded by a module parameter which is disabled by
default. Enabling this paramters adds additional modes to the driver
modelist, and also enables the optimization to skip modeset when using
one of these modes.

--

Aurabindo Pillai (3):
  drm/amd/display: Add module parameter for freesync video mode
  drm/amd/display: Add freesync video modes based on preferred modes
  drm/amd/display: Skip modeset for front porch change

 drivers/gpu/drm/amd/amdgpu/amdgpu.h   |   1 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c   |  12 +
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 377 --
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h |   3 +
 4 files changed, 361 insertions(+), 32 deletions(-)

-- 
2.29.2

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


Re: [PATCH linux-next] drm/amd/display: Adding prototype for dccg21_update_dpp_dto()

2020-12-14 Thread Alex Deucher
Applied.  Thanks!

Alex

On Mon, Dec 14, 2020 at 3:18 AM Souptick Joarder  wrote:
>
> Kernel test robot throws below warning ->
>
> drivers/gpu/drm/amd/amdgpu/../display/dc/dcn21/dcn21_dccg.c:46:6:
> warning: no previous prototype for 'dccg21_update_dpp_dto'
> [-Wmissing-prototypes]
>
> Adding prototype for dccg21_update_dpp_dto().
>
> Reported-by: kernel test robot 
> Signed-off-by: Souptick Joarder 
> ---
>  drivers/gpu/drm/amd/display/dc/dcn21/dcn21_dccg.h | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/gpu/drm/amd/display/dc/dcn21/dcn21_dccg.h 
> b/drivers/gpu/drm/amd/display/dc/dcn21/dcn21_dccg.h
> index b7efa77..e44a374 100644
> --- a/drivers/gpu/drm/amd/display/dc/dcn21/dcn21_dccg.h
> +++ b/drivers/gpu/drm/amd/display/dc/dcn21/dcn21_dccg.h
> @@ -32,5 +32,6 @@ struct dccg *dccg21_create(
> const struct dccg_shift *dccg_shift,
> const struct dccg_mask *dccg_mask);
>
> +void dccg21_update_dpp_dto(struct dccg *dccg, int dpp_inst, int req_dppclk);
>
>  #endif /* __DCN21_DCCG_H__ */
> --
> 1.9.1
>
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v5 27/29] drm/omap: dsi: remove ulps support

2020-12-14 Thread Sebastian Reichel
Hi,

On Mon, Dec 14, 2020 at 08:55:36PM +0200, Tomi Valkeinen wrote:
> On 14/12/2020 19:39, Sebastian Reichel wrote:
> > Hi,
> > 
> > On Tue, Dec 08, 2020 at 02:28:53PM +0200, Tomi Valkeinen wrote:
> >> ULPS doesn't work, and I have been unable to get it to work. As ULPS
> >> is a minor power-saving feature which requires substantial amount of
> >> non-trivial code, and we have trouble just getting and
> >> keeping DSI working at all, remove ULPS support.
> >>
> >> When the DSI driver works reliably for command and video mode displays,
> >> someone interested can add it back.
> >>
> >> Signed-off-by: Tomi Valkeinen 
> >> Reviewed-by: Laurent Pinchart 
> >> ---
> > 
> > Is it really 'minor power-saving'? If I search for DSI and ULPS among
> > the first results is a TI datasheet for SN65DSI84, which claims device
> > active current in the more than 100mA range and ULPS current in the
> > less than 10mA range.
> 
> I don't have any numbers, just my guesses. For videomode displays
> or command mode displays in active use, I don't think ULPS matters
> much. The link is mostly not in ULPS. And if the display is
> blanked, things are off, so again not in ULPS.
> 
> It's only for command mode displays, when updated rarely, where I
> think ULPS matters. Which, of course, is probably not unusual use
> case if you have a cmdmode display. But whether OMAP DSI power
> savings matches SN65DSI84, I have no clue.

Right. FWIW I don't expect savings to be as big as this. The
comparision is not "active current", but "idle current" since
we do disable the clocks among other things. Considering the
amount of power-saving is pure guess-work I suggest to rephrase
the commit message to something like this:

ULPS is a niche power-saving optimization feature only
affecting enabled command mode panels showing a static
picture. It never worked with the omapdrm driver and I have
been unable to get it working. Keeping DSI command mode panels
working is hard enough without this, so remove ULPS support.

FWIW I'm fine with this being removed:

Reviewed-by: Sebastian Reichel 

> > Considering all known omapdrm DSI users are battery powered devices
> > caring for saving as much power as possible, it might be good to just
> > keep this until it is being fixed considering this is very close to
> > the end of the series anyways?
> 
> I don't like to leave known to be broken code around, unless
> someone has plans to work on it. I wouldn't be surprised to see
> ULPS still broken two years from now =). It should be trivial to
> add the relevant bits back later.

Ack.

> But I can leave it here if you think it's better, presuming it
> doesn't have bigger conflicts with the 29/29 or break anything.
> However, I have only a few days left in TI, which is why I'm
> rushing here a bit (*). If I hit problems, I either have to drop
> the whole series, or push it in its current form.
> 
>  Tomi
> 
> (*) But I will fix possible issues caused by my push, of course.

Best of luck on whatever you do next!

-- Sebastian


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/2] dt-bindings: mali-bifrost: Add dynamic-power-coefficient

2020-12-14 Thread Rob Herring
On Wed, 09 Dec 2020 11:51:43 +, Lukasz Luba wrote:
> Add a property dynamic-power-coefficient which allows to register Energy
> Model for the Mali Bifrost devices.
> 
> Signed-off-by: Lukasz Luba 
> ---
>  .../bindings/gpu/arm,mali-bifrost.yaml  | 17 +
>  1 file changed, 17 insertions(+)
> 

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


Re: [PATCH 1/2] dt-bindings: mali-midgard: Add dynamic-power-coefficient

2020-12-14 Thread Rob Herring
On Wed, 09 Dec 2020 11:51:42 +, Lukasz Luba wrote:
> Add a property dynamic-power-coefficient which allows to register Energy
> Model for the Mali Midgard devices.
> 
> Signed-off-by: Lukasz Luba 
> ---
>  .../bindings/gpu/arm,mali-midgard.yaml  | 17 +
>  1 file changed, 17 insertions(+)
> 

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


Re: [PATCH] drm/amd/display: Fixed kernel test robot warning

2020-12-14 Thread Alex Deucher
On Fri, Dec 11, 2020 at 2:34 PM Souptick Joarder  wrote:
>
> Kernel test robot throws below warning ->
>
> drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:5349:5:
> warning: no previous prototype for 'amdgpu_dm_crtc_atomic_set_property'
> [-Wmissing-prototypes]
> drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:5349:5:
> warning: no previous prototype for function
> 'amdgpu_dm_crtc_atomic_set_property' [-Wmissing-prototypes]
> drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:5373:5:
> warning: no previous prototype for 'amdgpu_dm_crtc_atomic_get_property'
> [-Wmissing-prototypes]
> drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:5373:5:
> warning: no previous prototype for function
> 'amdgpu_dm_crtc_atomic_get_property' [-Wmissing-prototypes]
>
> As these functions are only used inside amdgpu_dm.c, these can be
> made static.
>
> Reported-by: kernel test robot 
> Signed-off-by: Souptick Joarder 

Applied.  Thanks!

Alex

> ---
>  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 313501c..e6d069d 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -5328,7 +5328,7 @@ static void dm_crtc_reset_state(struct drm_crtc *crtc)
>  }
>
>  #ifdef CONFIG_DEBUG_FS
> -int amdgpu_dm_crtc_atomic_set_property(struct drm_crtc *crtc,
> +static int amdgpu_dm_crtc_atomic_set_property(struct drm_crtc *crtc,
> struct drm_crtc_state *crtc_state,
> struct drm_property *property,
> uint64_t val)
> @@ -5352,7 +5352,7 @@ int amdgpu_dm_crtc_atomic_set_property(struct drm_crtc 
> *crtc,
> return 0;
>  }
>
> -int amdgpu_dm_crtc_atomic_get_property(struct drm_crtc *crtc,
> +static int amdgpu_dm_crtc_atomic_get_property(struct drm_crtc *crtc,
> const struct drm_crtc_state 
> *state,
> struct drm_property *property,
> uint64_t *val)
> --
> 1.9.1
>
> ___
> amd-gfx mailing list
> amd-...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [patch 22/30] net/mlx5: Replace irq_to_desc() abuse

2020-12-14 Thread Saeed Mahameed
On Thu, 2020-12-10 at 20:25 +0100, Thomas Gleixner wrote:
> No driver has any business with the internals of an interrupt
> descriptor. Storing a pointer to it just to use yet another helper at
> the
> actual usage site to retrieve the affinity mask is creative at best.
> Just
> because C does not allow encapsulation does not mean that the kernel
> has no
> limits.
> 

you can't blame the developers for using stuff from include/linux/
Not all developers are the same, and sometime we don't read in between
the lines, you can't assume all driver developers to be expert on irq
APIs disciplines.

your rules must be programmatically expressed, for instance,
you can just hide struct irq_desc and irq_to_desc() in kernel/irq/ and
remove them from include/linux/ header files, if you want privacy in
your subsystem, don't put all your header files on display under
include/linux.


> Retrieve a pointer to the affinity mask itself and use that. It's
> still
> using an interface which is usually not for random drivers, but
> definitely
> less hideous than the previous hack.
> 
> Signed-off-by: Thomas Gleixner 
> ---
>  drivers/net/ethernet/mellanox/mlx5/core/en.h  |2 +-
>  drivers/net/ethernet/mellanox/mlx5/core/en_main.c |2 +-
>  drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c |6 +-
>  3 files changed, 3 insertions(+), 7 deletions(-)
> 
> --- a/drivers/net/ethernet/mellanox/mlx5/core/en.h
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h
> @@ -669,7 +669,7 @@ struct mlx5e_channel {
>   spinlock_t async_icosq_lock;
>  
>   /* data path - accessed per napi poll */
> - struct irq_desc *irq_desc;
> + const struct cpumask  *aff_mask;
>   struct mlx5e_ch_stats *stats;
>  
>   /* control */
> --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
> @@ -1998,7 +1998,7 @@ static int mlx5e_open_channel(struct mlx
>   c->num_tc   = params->num_tc;
>   c->xdp  = !!params->xdp_prog;
>   c->stats= >channel_stats[ix].ch;
> - c->irq_desc = irq_to_desc(irq);
> + c->aff_mask = irq_get_affinity_mask(irq);

as long as the affinity mask pointer stays the same for the lifetime of
the irq vector.

Assuming that:
Acked-by: Saeed Mahameed 


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


Re: [patch 23/30] net/mlx5: Use effective interrupt affinity

2020-12-14 Thread Saeed Mahameed
On Thu, 2020-12-10 at 20:25 +0100, Thomas Gleixner wrote:
> Using the interrupt affinity mask for checking locality is not really
> working well on architectures which support effective affinity masks.
> 
> The affinity mask is either the system wide default or set by user
> space,
> but the architecture can or even must reduce the mask to the
> effective set,
> which means that checking the affinity mask itself does not really
> tell
> about the actual target CPUs.
> 
> Signed-off-by: Thomas Gleixner 
> Cc: Saeed Mahameed 
> Cc: Leon Romanovsky 
> Cc: "David S. Miller" 
> Cc: Jakub Kicinski 
> Cc: net...@vger.kernel.org
> Cc: linux-r...@vger.kernel.org
> 

Acked-by: Saeed Mahameed 

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


[PATCH v2 7/9] drm: rcar-du: Replace dev_private with container_of

2020-12-14 Thread Laurent Pinchart
Now that drm_device is embedded in rcar_du_device, we can use
container_of to get the rcar_du_device pointer from the drm_device,
instead of using the drm_device.dev_private field.

Signed-off-by: Laurent Pinchart 
Reviewed-by: Jacopo Mondi 
Reviewed-by: Kieran Bingham 
---
 drivers/gpu/drm/rcar-du/rcar_du_drv.c   | 2 --
 drivers/gpu/drm/rcar-du/rcar_du_drv.h   | 5 +
 drivers/gpu/drm/rcar-du/rcar_du_kms.c   | 8 
 drivers/gpu/drm/rcar-du/rcar_du_plane.c | 2 +-
 4 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.c 
b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
index 4ab99ac49891..d6a8b7899952 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_drv.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
@@ -587,8 +587,6 @@ static int rcar_du_probe(struct platform_device *pdev)
return PTR_ERR(rcdu->mmio);
 
/* DRM/KMS objects */
-   rcdu->ddev.dev_private = rcdu;
-
ret = rcar_du_modeset_init(rcdu);
if (ret < 0) {
if (ret != -EPROBE_DEFER)
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.h 
b/drivers/gpu/drm/rcar-du/rcar_du_drv.h
index 0b1726fd7bdb..02ca2d0e1b55 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_drv.h
+++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.h
@@ -99,6 +99,11 @@ struct rcar_du_device {
unsigned int vspd1_sink;
 };
 
+static inline struct rcar_du_device *to_rcar_du_device(struct drm_device *dev)
+{
+   return container_of(dev, struct rcar_du_device, ddev);
+}
+
 static inline bool rcar_du_has(struct rcar_du_device *rcdu,
   unsigned int feature)
 {
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_kms.c 
b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
index 57bb0dc22807..d6b71a9361ca 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
@@ -327,7 +327,7 @@ const struct rcar_du_format_info *rcar_du_format_info(u32 
fourcc)
 int rcar_du_dumb_create(struct drm_file *file, struct drm_device *dev,
struct drm_mode_create_dumb *args)
 {
-   struct rcar_du_device *rcdu = dev->dev_private;
+   struct rcar_du_device *rcdu = to_rcar_du_device(dev);
unsigned int min_pitch = DIV_ROUND_UP(args->width * args->bpp, 8);
unsigned int align;
 
@@ -349,7 +349,7 @@ static struct drm_framebuffer *
 rcar_du_fb_create(struct drm_device *dev, struct drm_file *file_priv,
  const struct drm_mode_fb_cmd2 *mode_cmd)
 {
-   struct rcar_du_device *rcdu = dev->dev_private;
+   struct rcar_du_device *rcdu = to_rcar_du_device(dev);
const struct rcar_du_format_info *format;
unsigned int chroma_pitch;
unsigned int max_pitch;
@@ -421,7 +421,7 @@ rcar_du_fb_create(struct drm_device *dev, struct drm_file 
*file_priv,
 static int rcar_du_atomic_check(struct drm_device *dev,
struct drm_atomic_state *state)
 {
-   struct rcar_du_device *rcdu = dev->dev_private;
+   struct rcar_du_device *rcdu = to_rcar_du_device(dev);
int ret;
 
ret = drm_atomic_helper_check(dev, state);
@@ -437,7 +437,7 @@ static int rcar_du_atomic_check(struct drm_device *dev,
 static void rcar_du_atomic_commit_tail(struct drm_atomic_state *old_state)
 {
struct drm_device *dev = old_state->dev;
-   struct rcar_du_device *rcdu = dev->dev_private;
+   struct rcar_du_device *rcdu = to_rcar_du_device(dev);
struct drm_crtc_state *crtc_state;
struct drm_crtc *crtc;
unsigned int i;
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_plane.c 
b/drivers/gpu/drm/rcar-du/rcar_du_plane.c
index 5f69ff4502c1..02e5f11f38eb 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_plane.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_plane.c
@@ -128,7 +128,7 @@ static int rcar_du_plane_hwalloc(struct rcar_du_plane 
*plane,
 int rcar_du_atomic_check_planes(struct drm_device *dev,
struct drm_atomic_state *state)
 {
-   struct rcar_du_device *rcdu = dev->dev_private;
+   struct rcar_du_device *rcdu = to_rcar_du_device(dev);
unsigned int group_freed_planes[RCAR_DU_MAX_GROUPS] = { 0, };
unsigned int group_free_planes[RCAR_DU_MAX_GROUPS] = { 0, };
bool needs_realloc = false;
-- 
Regards,

Laurent Pinchart

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


[PATCH v2 4/9] drm: rcar-du: Use DRM-managed allocation for VSP planes

2020-12-14 Thread Laurent Pinchart
devm_kcalloc() is the wrong API to allocate planes, as the lifetime of
the planes is tied to the DRM device, not the device to driver
binding. drmm_kcalloc() isn't a good option either, as it would result
in the planes being freed before being unregistered during the managed
cleanup of the DRM objects. Use a plain kcalloc(), and cleanup the
planes and free the memory in the existing rcar_du_vsp_cleanup()
handler.

Signed-off-by: Laurent Pinchart 
Reviewed-by: Kieran Bingham 
---
 drivers/gpu/drm/rcar-du/rcar_du_vsp.c | 22 +-
 1 file changed, 17 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/rcar-du/rcar_du_vsp.c 
b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c
index 4dcb1bfbe201..78a886651d9f 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_vsp.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c
@@ -21,6 +21,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -344,6 +345,15 @@ static const struct drm_plane_funcs 
rcar_du_vsp_plane_funcs = {
 static void rcar_du_vsp_cleanup(struct drm_device *dev, void *res)
 {
struct rcar_du_vsp *vsp = res;
+   unsigned int i;
+
+   for (i = 0; i < vsp->num_planes; ++i) {
+   struct rcar_du_vsp_plane *plane = >planes[i];
+
+   drm_plane_cleanup(>plane);
+   }
+
+   kfree(vsp->planes);
 
put_device(vsp->vsp);
 }
@@ -354,6 +364,7 @@ int rcar_du_vsp_init(struct rcar_du_vsp *vsp, struct 
device_node *np,
struct rcar_du_device *rcdu = vsp->dev;
struct platform_device *pdev;
unsigned int num_crtcs = hweight32(crtcs);
+   unsigned int num_planes;
unsigned int i;
int ret;
 
@@ -376,14 +387,13 @@ int rcar_du_vsp_init(struct rcar_du_vsp *vsp, struct 
device_node *np,
  * The VSP2D (Gen3) has 5 RPFs, but the VSP1D (Gen2) is limited to
  * 4 RPFs.
  */
-   vsp->num_planes = rcdu->info->gen >= 3 ? 5 : 4;
+   num_planes = rcdu->info->gen >= 3 ? 5 : 4;
 
-   vsp->planes = devm_kcalloc(rcdu->dev, vsp->num_planes,
-  sizeof(*vsp->planes), GFP_KERNEL);
+   vsp->planes = kcalloc(num_planes, sizeof(*vsp->planes), GFP_KERNEL);
if (!vsp->planes)
return -ENOMEM;
 
-   for (i = 0; i < vsp->num_planes; ++i) {
+   for (i = 0; i < num_planes; ++i) {
enum drm_plane_type type = i < num_crtcs
 ? DRM_PLANE_TYPE_PRIMARY
 : DRM_PLANE_TYPE_OVERLAY;
@@ -409,8 +419,10 @@ int rcar_du_vsp_init(struct rcar_du_vsp *vsp, struct 
device_node *np,
} else {
drm_plane_create_alpha_property(>plane);
drm_plane_create_zpos_property(>plane, 1, 1,
-  vsp->num_planes - 1);
+  num_planes - 1);
}
+
+   vsp->num_planes++;
}
 
return 0;
-- 
Regards,

Laurent Pinchart

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


[PATCH v2 6/9] drm: rcar-du: Embed drm_device in rcar_du_device

2020-12-14 Thread Laurent Pinchart
Embedding drm_device in rcar_du_device allows usage of the DRM managed
API to allocate both structures in one go, simplifying error handling.

Signed-off-by: Laurent Pinchart 
Reviewed-by: Jacopo Mondi 
Reviewed-by: Kieran Bingham 
---
 drivers/gpu/drm/rcar-du/rcar_du_crtc.c  |  2 +-
 drivers/gpu/drm/rcar-du/rcar_du_drv.c   | 33 +
 drivers/gpu/drm/rcar-du/rcar_du_drv.h   |  5 ++--
 drivers/gpu/drm/rcar-du/rcar_du_encoder.c   |  4 +--
 drivers/gpu/drm/rcar-du/rcar_du_kms.c   |  4 +--
 drivers/gpu/drm/rcar-du/rcar_du_plane.c |  6 ++--
 drivers/gpu/drm/rcar-du/rcar_du_vsp.c   |  6 ++--
 drivers/gpu/drm/rcar-du/rcar_du_writeback.c |  2 +-
 8 files changed, 29 insertions(+), 33 deletions(-)

diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c 
b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
index e23b9c7b4afe..9a099c0fe1d4 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
@@ -1251,7 +1251,7 @@ int rcar_du_crtc_create(struct rcar_du_group *rgrp, 
unsigned int swindex,
else
primary = >planes[swindex % 2].plane;
 
-   ret = drm_crtc_init_with_planes(rcdu->ddev, crtc, primary, NULL,
+   ret = drm_crtc_init_with_planes(>ddev, crtc, primary, NULL,
rcdu->info->gen <= 2 ?
_funcs_gen2 : _funcs_gen3,
NULL);
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.c 
b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
index 1490ec182646..4ab99ac49891 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_drv.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
@@ -18,10 +18,11 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
-#include 
 #include 
+#include 
 #include 
 
 #include "rcar_du_drv.h"
@@ -529,14 +530,14 @@ static int rcar_du_pm_suspend(struct device *dev)
 {
struct rcar_du_device *rcdu = dev_get_drvdata(dev);
 
-   return drm_mode_config_helper_suspend(rcdu->ddev);
+   return drm_mode_config_helper_suspend(>ddev);
 }
 
 static int rcar_du_pm_resume(struct device *dev)
 {
struct rcar_du_device *rcdu = dev_get_drvdata(dev);
 
-   return drm_mode_config_helper_resume(rcdu->ddev);
+   return drm_mode_config_helper_resume(>ddev);
 }
 #endif
 
@@ -551,7 +552,7 @@ static const struct dev_pm_ops rcar_du_pm_ops = {
 static int rcar_du_remove(struct platform_device *pdev)
 {
struct rcar_du_device *rcdu = platform_get_drvdata(pdev);
-   struct drm_device *ddev = rcdu->ddev;
+   struct drm_device *ddev = >ddev;
 
drm_dev_unregister(ddev);
 
@@ -565,14 +566,14 @@ static int rcar_du_remove(struct platform_device *pdev)
 static int rcar_du_probe(struct platform_device *pdev)
 {
struct rcar_du_device *rcdu;
-   struct drm_device *ddev;
struct resource *mem;
int ret;
 
/* Allocate and initialize the R-Car device structure. */
-   rcdu = devm_kzalloc(>dev, sizeof(*rcdu), GFP_KERNEL);
-   if (rcdu == NULL)
-   return -ENOMEM;
+   rcdu = devm_drm_dev_alloc(>dev, _du_driver,
+ struct rcar_du_device, ddev);
+   if (IS_ERR(rcdu))
+   return PTR_ERR(rcdu);
 
rcdu->dev = >dev;
rcdu->info = of_device_get_match_data(rcdu->dev);
@@ -586,12 +587,7 @@ static int rcar_du_probe(struct platform_device *pdev)
return PTR_ERR(rcdu->mmio);
 
/* DRM/KMS objects */
-   ddev = drm_dev_alloc(_du_driver, >dev);
-   if (IS_ERR(ddev))
-   return PTR_ERR(ddev);
-
-   rcdu->ddev = ddev;
-   ddev->dev_private = rcdu;
+   rcdu->ddev.dev_private = rcdu;
 
ret = rcar_du_modeset_init(rcdu);
if (ret < 0) {
@@ -601,25 +597,24 @@ static int rcar_du_probe(struct platform_device *pdev)
goto error;
}
 
-   ddev->irq_enabled = 1;
+   rcdu->ddev.irq_enabled = 1;
 
/*
 * Register the DRM device with the core and the connectors with
 * sysfs.
 */
-   ret = drm_dev_register(ddev, 0);
+   ret = drm_dev_register(>ddev, 0);
if (ret)
goto error;
 
DRM_INFO("Device %s probed\n", dev_name(>dev));
 
-   drm_fbdev_generic_setup(ddev, 32);
+   drm_fbdev_generic_setup(>ddev, 32);
 
return 0;
 
 error:
-   rcar_du_remove(pdev);
-
+   drm_kms_helper_poll_fini(>ddev);
return ret;
 }
 
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.h 
b/drivers/gpu/drm/rcar-du/rcar_du_drv.h
index 3597a179bfb7..0b1726fd7bdb 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_drv.h
+++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.h
@@ -13,6 +13,8 @@
 #include 
 #include 
 
+#include 
+
 #include "rcar_cmm.h"
 #include "rcar_du_crtc.h"
 #include "rcar_du_group.h"
@@ -21,7 +23,6 @@
 struct clk;
 struct device;
 struct drm_bridge;
-struct drm_device;
 struct drm_property;
 struct rcar_du_device;
 
@@ -79,7 +80,7 @@ struct 

[PATCH v2 9/9] drm: rcar-du: Drop local encoder variable

2020-12-14 Thread Laurent Pinchart
The local encoder variable is an alias for >base, and is only use
twice. It doesn't help much, drop it, along with the
rcar_encoder_to_drm_encoder() macro that is then unused.

Signed-off-by: Laurent Pinchart 
Reviewed-by: Jacopo Mondi 
Reviewed-by: Kieran Bingham 
---
 drivers/gpu/drm/rcar-du/rcar_du_encoder.c | 6 ++
 drivers/gpu/drm/rcar-du/rcar_du_encoder.h | 2 --
 2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/rcar-du/rcar_du_encoder.c 
b/drivers/gpu/drm/rcar-du/rcar_du_encoder.c
index 0d873f4b42dc..ba8c6038cd63 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_encoder.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_encoder.c
@@ -61,7 +61,6 @@ int rcar_du_encoder_init(struct rcar_du_device *rcdu,
 struct device_node *enc_node)
 {
struct rcar_du_encoder *renc;
-   struct drm_encoder *encoder;
struct drm_bridge *bridge;
int ret;
 
@@ -107,12 +106,11 @@ int rcar_du_encoder_init(struct rcar_du_device *rcdu,
return -ENOMEM;
 
renc->output = output;
-   encoder = rcar_encoder_to_drm_encoder(renc);
 
dev_dbg(rcdu->dev, "initializing encoder %pOF for output %u\n",
enc_node, output);
 
-   ret = drm_encoder_init(>ddev, encoder, _du_encoder_funcs,
+   ret = drm_encoder_init(>ddev, >base, _du_encoder_funcs,
   DRM_MODE_ENCODER_NONE, NULL);
if (ret < 0) {
kfree(renc);
@@ -128,5 +126,5 @@ int rcar_du_encoder_init(struct rcar_du_device *rcdu,
 * Attach the bridge to the encoder. The bridge will create the
 * connector.
 */
-   return drm_bridge_attach(encoder, bridge, NULL, 0);
+   return drm_bridge_attach(>base, bridge, NULL, 0);
 }
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_encoder.h 
b/drivers/gpu/drm/rcar-du/rcar_du_encoder.h
index df9be4524301..73560563fb31 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_encoder.h
+++ b/drivers/gpu/drm/rcar-du/rcar_du_encoder.h
@@ -22,8 +22,6 @@ struct rcar_du_encoder {
 #define to_rcar_encoder(e) \
container_of(e, struct rcar_du_encoder, base)
 
-#define rcar_encoder_to_drm_encoder(e) (&(e)->base)
-
 int rcar_du_encoder_init(struct rcar_du_device *rcdu,
 enum rcar_du_output output,
 struct device_node *enc_node);
-- 
Regards,

Laurent Pinchart

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


[PATCH v2 5/9] drm: rcar-du: Use DRM-managed allocation for encoders

2020-12-14 Thread Laurent Pinchart
devm_kzalloc() is the wrong API to allocate encoders, as the lifetime of
the encoders is tied to the DRM device, not the device to driver
binding. drmm_kzalloc() isn't a good option either, as it would result
in the encoder being freed before being unregistered during the managed
cleanup of the DRM objects. Use a plain kzalloc(), and register a drmm
action to cleanup the encoder.

Signed-off-by: Laurent Pinchart 
---
 drivers/gpu/drm/rcar-du/rcar_du_encoder.c | 47 ++-
 1 file changed, 29 insertions(+), 18 deletions(-)

diff --git a/drivers/gpu/drm/rcar-du/rcar_du_encoder.c 
b/drivers/gpu/drm/rcar-du/rcar_du_encoder.c
index e4bac47caf16..55a0ecf45ebb 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_encoder.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_encoder.c
@@ -8,12 +8,13 @@
  */
 
 #include 
+#include 
 
 #include 
 #include 
+#include 
 #include 
 #include 
-#include 
 
 #include "rcar_du_drv.h"
 #include "rcar_du_encoder.h"
@@ -44,6 +45,17 @@ static unsigned int rcar_du_encoder_count_ports(struct 
device_node *node)
return num_ports;
 }
 
+static const struct drm_encoder_funcs rcar_du_encoder_funcs = {
+};
+
+static void rcar_du_encoder_release(struct drm_device *dev, void *res)
+{
+   struct rcar_du_encoder *renc = res;
+
+   drm_encoder_cleanup(>base);
+   kfree(renc);
+}
+
 int rcar_du_encoder_init(struct rcar_du_device *rcdu,
 enum rcar_du_output output,
 struct device_node *enc_node)
@@ -53,7 +65,7 @@ int rcar_du_encoder_init(struct rcar_du_device *rcdu,
struct drm_bridge *bridge;
int ret;
 
-   renc = devm_kzalloc(rcdu->dev, sizeof(*renc), GFP_KERNEL);
+   renc = kzalloc(sizeof(*renc), GFP_KERNEL);
if (renc == NULL)
return -ENOMEM;
 
@@ -75,20 +87,20 @@ int rcar_du_encoder_init(struct rcar_du_device *rcdu,
 
if (IS_ERR(panel)) {
ret = PTR_ERR(panel);
-   goto done;
+   goto error;
}
 
bridge = devm_drm_panel_bridge_add_typed(rcdu->dev, panel,
 
DRM_MODE_CONNECTOR_DPI);
if (IS_ERR(bridge)) {
ret = PTR_ERR(bridge);
-   goto done;
+   goto error;
}
} else {
bridge = of_drm_find_bridge(enc_node);
if (!bridge) {
ret = -EPROBE_DEFER;
-   goto done;
+   goto error;
}
 
if (output == RCAR_DU_OUTPUT_LVDS0 ||
@@ -103,28 +115,27 @@ int rcar_du_encoder_init(struct rcar_du_device *rcdu,
if (rcdu->info->gen >= 3 && output == RCAR_DU_OUTPUT_LVDS1) {
if (rcar_lvds_dual_link(bridge)) {
ret = -ENOLINK;
-   goto done;
+   goto error;
}
}
 
-   ret = drm_simple_encoder_init(rcdu->ddev, encoder,
- DRM_MODE_ENCODER_NONE);
+   ret = drm_encoder_init(rcdu->ddev, encoder, _du_encoder_funcs,
+  DRM_MODE_ENCODER_NONE, NULL);
if (ret < 0)
-   goto done;
+   goto error;
+
+   ret = drmm_add_action_or_reset(rcdu->ddev, rcar_du_encoder_release,
+  renc);
+   if (ret)
+   return ret;
 
/*
 * Attach the bridge to the encoder. The bridge will create the
 * connector.
 */
-   ret = drm_bridge_attach(encoder, bridge, NULL, 0);
-   if (ret) {
-   drm_encoder_cleanup(encoder);
-   return ret;
-   }
-
-done:
-   if (ret < 0)
-   devm_kfree(rcdu->dev, renc);
+   return drm_bridge_attach(encoder, bridge, NULL, 0);
 
+error:
+   kfree(renc);
return ret;
 }
-- 
Regards,

Laurent Pinchart

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


[PATCH v2 8/9] drm: rcar-du: Skip encoder allocation for LVDS1 in dual-link mode

2020-12-14 Thread Laurent Pinchart
The rcar-du driver skips registration of the encoder for the LVDS1
output when LVDS is used in dual-link mode, as the LVDS0 and LVDS1 links
are bundled and handled through the LVDS0 output. It however still
allocates the encoder and immediately destroys it, which is pointless.
Skip allocation of the encoder altogether in that case.

Signed-off-by: Laurent Pinchart 
Reviewed-by: Jacopo Mondi 
Reviewed-by: Kieran Bingham 
---
Changes since v1:

- Drop error label
---
 drivers/gpu/drm/rcar-du/rcar_du_encoder.c | 59 ++-
 1 file changed, 25 insertions(+), 34 deletions(-)

diff --git a/drivers/gpu/drm/rcar-du/rcar_du_encoder.c 
b/drivers/gpu/drm/rcar-du/rcar_du_encoder.c
index 3afaf106d750..0d873f4b42dc 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_encoder.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_encoder.c
@@ -65,16 +65,6 @@ int rcar_du_encoder_init(struct rcar_du_device *rcdu,
struct drm_bridge *bridge;
int ret;
 
-   renc = kzalloc(sizeof(*renc), GFP_KERNEL);
-   if (renc == NULL)
-   return -ENOMEM;
-
-   renc->output = output;
-   encoder = rcar_encoder_to_drm_encoder(renc);
-
-   dev_dbg(rcdu->dev, "initializing encoder %pOF for output %u\n",
-   enc_node, output);
-
/*
 * Locate the DRM bridge from the DT node. For the DPAD outputs, if the
 * DT node has a single port, assume that it describes a panel and
@@ -85,23 +75,17 @@ int rcar_du_encoder_init(struct rcar_du_device *rcdu,
rcar_du_encoder_count_ports(enc_node) == 1) {
struct drm_panel *panel = of_drm_find_panel(enc_node);
 
-   if (IS_ERR(panel)) {
-   ret = PTR_ERR(panel);
-   goto error;
-   }
+   if (IS_ERR(panel))
+   return PTR_ERR(panel);
 
bridge = devm_drm_panel_bridge_add_typed(rcdu->dev, panel,
 
DRM_MODE_CONNECTOR_DPI);
-   if (IS_ERR(bridge)) {
-   ret = PTR_ERR(bridge);
-   goto error;
-   }
+   if (IS_ERR(bridge))
+   return PTR_ERR(bridge);
} else {
bridge = of_drm_find_bridge(enc_node);
-   if (!bridge) {
-   ret = -EPROBE_DEFER;
-   goto error;
-   }
+   if (!bridge)
+   return -EPROBE_DEFER;
 
if (output == RCAR_DU_OUTPUT_LVDS0 ||
output == RCAR_DU_OUTPUT_LVDS1)
@@ -109,20 +93,31 @@ int rcar_du_encoder_init(struct rcar_du_device *rcdu,
}
 
/*
-* On Gen3 skip the LVDS1 output if the LVDS1 encoder is used as a
-* companion for LVDS0 in dual-link mode.
+* Create and initialize the encoder. On Gen3 skip the LVDS1 output if
+* the LVDS1 encoder is used as a companion for LVDS0 in dual-link
+* mode.
 */
if (rcdu->info->gen >= 3 && output == RCAR_DU_OUTPUT_LVDS1) {
-   if (rcar_lvds_dual_link(bridge)) {
-   ret = -ENOLINK;
-   goto error;
-   }
+   if (rcar_lvds_dual_link(bridge))
+   return -ENOLINK;
}
 
+   renc = kzalloc(sizeof(*renc), GFP_KERNEL);
+   if (renc == NULL)
+   return -ENOMEM;
+
+   renc->output = output;
+   encoder = rcar_encoder_to_drm_encoder(renc);
+
+   dev_dbg(rcdu->dev, "initializing encoder %pOF for output %u\n",
+   enc_node, output);
+
ret = drm_encoder_init(>ddev, encoder, _du_encoder_funcs,
   DRM_MODE_ENCODER_NONE, NULL);
-   if (ret < 0)
-   goto error;
+   if (ret < 0) {
+   kfree(renc);
+   return ret;
+   }
 
ret = drmm_add_action_or_reset(>ddev, rcar_du_encoder_release,
   renc);
@@ -134,8 +129,4 @@ int rcar_du_encoder_init(struct rcar_du_device *rcdu,
 * connector.
 */
return drm_bridge_attach(encoder, bridge, NULL, 0);
-
-error:
-   kfree(renc);
-   return ret;
 }
-- 
Regards,

Laurent Pinchart

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


[PATCH v2 3/9] drm: rcar-du: Drop unneeded encoder cleanup in error path

2020-12-14 Thread Laurent Pinchart
The encoder->name field can never be non-null in the error path, as that
can only be possible after a successful call to
drm_simple_encoder_init(). Drop the cleanup.

Signed-off-by: Laurent Pinchart 
Reviewed-by: Jacopo Mondi 
Reviewed-by: Kieran Bingham 
---
 drivers/gpu/drm/rcar-du/rcar_du_encoder.c | 5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/rcar-du/rcar_du_encoder.c 
b/drivers/gpu/drm/rcar-du/rcar_du_encoder.c
index 50fc14534fa4..e4bac47caf16 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_encoder.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_encoder.c
@@ -123,11 +123,8 @@ int rcar_du_encoder_init(struct rcar_du_device *rcdu,
}
 
 done:
-   if (ret < 0) {
-   if (encoder->name)
-   encoder->funcs->destroy(encoder);
+   if (ret < 0)
devm_kfree(rcdu->dev, renc);
-   }
 
return ret;
 }
-- 
Regards,

Laurent Pinchart

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


[PATCH v2 0/9] drm: rcar-du: Fix LVDS-related crash

2020-12-14 Thread Laurent Pinchart
Hello,

This patch series fixes a crash in the LVDS encoder on D3 and E3 SoCs.
See patch 1/9 for details. The next patches are additional cleanups.

Patches 4/9 to 6/9 fix incorrect usage of the devm_* API. They could be
made simpler by using the proposed drmm_* allocators for encoders and
planes ([1]), but those haven't landed yet. Not depending on them also
helps backporting those fixes to stable kernels. I will switch to the
new helpers when they will be available.

[1] 
https://lore.kernel.org/dri-devel/20200911135724.25833-1-p.za...@pengutronix.de/

Laurent Pinchart (9):
  drm: rcar-du: Fix crash when using LVDS1 clock for CRTC
  drm: rcar-du: Release vsp device reference in all error paths
  drm: rcar-du: Drop unneeded encoder cleanup in error path
  drm: rcar-du: Use DRM-managed allocation for VSP planes
  drm: rcar-du: Use DRM-managed allocation for encoders
  drm: rcar-du: Embed drm_device in rcar_du_device
  drm: rcar-du: Replace dev_private with container_of
  drm: rcar-du: Skip encoder allocation for LVDS1 in dual-link mode
  drm: rcar-du: Drop local encoder variable

 drivers/gpu/drm/rcar-du/rcar_du_crtc.c  | 12 +--
 drivers/gpu/drm/rcar-du/rcar_du_drv.c   | 33 +++
 drivers/gpu/drm/rcar-du/rcar_du_drv.h   | 16 ++--
 drivers/gpu/drm/rcar-du/rcar_du_encoder.c   | 98 ++---
 drivers/gpu/drm/rcar-du/rcar_du_encoder.h   |  2 -
 drivers/gpu/drm/rcar-du/rcar_du_kms.c   | 12 +--
 drivers/gpu/drm/rcar-du/rcar_du_plane.c |  8 +-
 drivers/gpu/drm/rcar-du/rcar_du_vsp.c   | 28 --
 drivers/gpu/drm/rcar-du/rcar_du_writeback.c |  2 +-
 9 files changed, 107 insertions(+), 104 deletions(-)

-- 
Regards,

Laurent Pinchart

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


[PATCH v2 2/9] drm: rcar-du: Release vsp device reference in all error paths

2020-12-14 Thread Laurent Pinchart
Use drmm_add_action_or_reset() instead of drmm_add_action() to ensure
the vsp device reference is released in case the function call fails.

Signed-off-by: Laurent Pinchart 
Reviewed-by: Jacopo Mondi 
Reviewed-by: Kieran Bingham 
---
 drivers/gpu/drm/rcar-du/rcar_du_vsp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/rcar-du/rcar_du_vsp.c 
b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c
index f6a69aa116e6..4dcb1bfbe201 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_vsp.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c
@@ -364,7 +364,7 @@ int rcar_du_vsp_init(struct rcar_du_vsp *vsp, struct 
device_node *np,
 
vsp->vsp = >dev;
 
-   ret = drmm_add_action(rcdu->ddev, rcar_du_vsp_cleanup, vsp);
+   ret = drmm_add_action_or_reset(rcdu->ddev, rcar_du_vsp_cleanup, vsp);
if (ret < 0)
return ret;
 
-- 
Regards,

Laurent Pinchart

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


[PATCH v2 1/9] drm: rcar-du: Fix crash when using LVDS1 clock for CRTC

2020-12-14 Thread Laurent Pinchart
On D3 and E3 platforms, the LVDS encoder includes a PLL that can
generate a clock for the corresponding CRTC, used even when the CRTC
output to a non-LVDS port. This mechanism is supported by the driver,
but the implementation is broken in dual-link LVDS mode. In that case,
the LVDS1 drm_encoder is skipped, which causes a crash when trying to
access its bridge later on.

Fix this by storing bridge pointers internally instead of retrieving
them from the encoder. The rcar_du_device encoders field isn't used
anymore and can be dropped.

Fixes: 8e8fddab0d0a ("drm: rcar-du: Skip LVDS1 output on Gen3 when using 
dual-link LVDS mode")
Signed-off-by: Laurent Pinchart 
Reviewed-by: Jacopo Mondi 
Reviewed-by: Kieran Bingham 
---
Changes since v1:

- Drop rcar_du_device.encoders field
- Add Fixes: tag
---
 drivers/gpu/drm/rcar-du/rcar_du_crtc.c| 10 ++
 drivers/gpu/drm/rcar-du/rcar_du_drv.h |  6 +++---
 drivers/gpu/drm/rcar-du/rcar_du_encoder.c |  5 -
 3 files changed, 9 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c 
b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
index b5fb941e0f53..e23b9c7b4afe 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
@@ -730,13 +730,10 @@ static void rcar_du_crtc_atomic_enable(struct drm_crtc 
*crtc,
 */
if (rcdu->info->lvds_clk_mask & BIT(rcrtc->index) &&
rstate->outputs == BIT(RCAR_DU_OUTPUT_DPAD0)) {
-   struct rcar_du_encoder *encoder =
-   rcdu->encoders[RCAR_DU_OUTPUT_LVDS0 + rcrtc->index];
+   struct drm_bridge *bridge = rcdu->lvds[rcrtc->index];
const struct drm_display_mode *mode =
>state->adjusted_mode;
-   struct drm_bridge *bridge;
 
-   bridge = drm_bridge_chain_get_first_bridge(>base);
rcar_lvds_clk_enable(bridge, mode->clock * 1000);
}
 
@@ -764,15 +761,12 @@ static void rcar_du_crtc_atomic_disable(struct drm_crtc 
*crtc,
 
if (rcdu->info->lvds_clk_mask & BIT(rcrtc->index) &&
rstate->outputs == BIT(RCAR_DU_OUTPUT_DPAD0)) {
-   struct rcar_du_encoder *encoder =
-   rcdu->encoders[RCAR_DU_OUTPUT_LVDS0 + rcrtc->index];
-   struct drm_bridge *bridge;
+   struct drm_bridge *bridge = rcdu->lvds[rcrtc->index];
 
/*
 * Disable the LVDS clock output, see
 * rcar_du_crtc_atomic_enable().
 */
-   bridge = drm_bridge_chain_get_first_bridge(>base);
rcar_lvds_clk_disable(bridge);
}
 
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.h 
b/drivers/gpu/drm/rcar-du/rcar_du_drv.h
index 61504c54e2ec..3597a179bfb7 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_drv.h
+++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.h
@@ -20,10 +20,10 @@
 
 struct clk;
 struct device;
+struct drm_bridge;
 struct drm_device;
 struct drm_property;
 struct rcar_du_device;
-struct rcar_du_encoder;
 
 #define RCAR_DU_FEATURE_CRTC_IRQ_CLOCK BIT(0)  /* Per-CRTC IRQ and clock */
 #define RCAR_DU_FEATURE_VSP1_SOURCEBIT(1)  /* Has inputs from VSP1 */
@@ -71,6 +71,7 @@ struct rcar_du_device_info {
 #define RCAR_DU_MAX_CRTCS  4
 #define RCAR_DU_MAX_GROUPS DIV_ROUND_UP(RCAR_DU_MAX_CRTCS, 2)
 #define RCAR_DU_MAX_VSPS   4
+#define RCAR_DU_MAX_LVDS   2
 
 struct rcar_du_device {
struct device *dev;
@@ -83,11 +84,10 @@ struct rcar_du_device {
struct rcar_du_crtc crtcs[RCAR_DU_MAX_CRTCS];
unsigned int num_crtcs;
 
-   struct rcar_du_encoder *encoders[RCAR_DU_OUTPUT_MAX];
-
struct rcar_du_group groups[RCAR_DU_MAX_GROUPS];
struct platform_device *cmms[RCAR_DU_MAX_CRTCS];
struct rcar_du_vsp vsps[RCAR_DU_MAX_VSPS];
+   struct drm_bridge *lvds[RCAR_DU_MAX_LVDS];
 
struct {
struct drm_property *colorkey;
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_encoder.c 
b/drivers/gpu/drm/rcar-du/rcar_du_encoder.c
index b0335da0c161..50fc14534fa4 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_encoder.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_encoder.c
@@ -57,7 +57,6 @@ int rcar_du_encoder_init(struct rcar_du_device *rcdu,
if (renc == NULL)
return -ENOMEM;
 
-   rcdu->encoders[output] = renc;
renc->output = output;
encoder = rcar_encoder_to_drm_encoder(renc);
 
@@ -91,6 +90,10 @@ int rcar_du_encoder_init(struct rcar_du_device *rcdu,
ret = -EPROBE_DEFER;
goto done;
}
+
+   if (output == RCAR_DU_OUTPUT_LVDS0 ||
+   output == RCAR_DU_OUTPUT_LVDS1)
+   rcdu->lvds[output - RCAR_DU_OUTPUT_LVDS0] = bridge;
}
 
/*
-- 
Regards,

Laurent Pinchart

___
dri-devel mailing list
dri-devel@lists.freedesktop.org

Re: [PATCH] drm/amdkfd: fix ttm size refactor fallout

2020-12-14 Thread Felix Kuehling
Am 2020-12-14 um 3:27 p.m. schrieb Christian König:
> Am 14.12.20 um 20:17 schrieb Daniel Vetter:
>> I guess Christian didn't compile test amdkfd.
>
> Scratching my head what has happened here. When I tested everything
> was at least building fine.

Looks like you were missing CONFIG_HSA_AMD in your .config for some reason.

Regards,
  Felix


>
>>
>> Fixes: e11bfb99d6ec ("drm/ttm: cleanup BO size handling v3")
>> Cc: Christian König 
>> Cc: Huang Rui  (v1)
>> Cc: Daniel Vetter 
>> Cc: Felix Kuehling 
>> Cc: amd-...@lists.freedesktop.org
>> Signed-off-by: Daniel Vetter 
>
> Reviewed-by: Christian König 
>
>> ---
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 8 
>>   1 file changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
>> index 7791d074bd32..a9647e7f98a8 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
>> @@ -453,7 +453,7 @@ static int add_bo_to_vm(struct amdgpu_device
>> *adev, struct kgd_mem *mem,
>>   struct amdgpu_bo *bo = mem->bo;
>>   uint64_t va = mem->va;
>>   struct list_head *list_bo_va = >bo_va_list;
>> -    unsigned long bo_size = bo->tbo.mem.size;
>> +    unsigned long bo_size = bo->tbo.base.size;
>>     if (!va) {
>>   pr_err("Invalid VA when adding BO to VM\n");
>> @@ -1281,7 +1281,7 @@ int amdgpu_amdkfd_gpuvm_free_memory_of_gpu(
>>   struct kgd_dev *kgd, struct kgd_mem *mem, uint64_t *size)
>>   {
>>   struct amdkfd_process_info *process_info = mem->process_info;
>> -    unsigned long bo_size = mem->bo->tbo.mem.size;
>> +    unsigned long bo_size = mem->bo->tbo.base.size;
>>   struct kfd_bo_va_list *entry, *tmp;
>>   struct bo_vm_reservation_context ctx;
>>   struct ttm_validate_buffer *bo_list_entry;
>> @@ -1402,7 +1402,7 @@ int amdgpu_amdkfd_gpuvm_map_memory_to_gpu(
>>   mutex_lock(>lock);
>>     domain = mem->domain;
>> -    bo_size = bo->tbo.mem.size;
>> +    bo_size = bo->tbo.base.size;
>>     pr_debug("Map VA 0x%llx - 0x%llx to vm %p domain %s\n",
>>   mem->va,
>> @@ -1506,7 +1506,7 @@ int amdgpu_amdkfd_gpuvm_unmap_memory_from_gpu(
>>   struct amdgpu_device *adev = get_amdgpu_device(kgd);
>>   struct amdkfd_process_info *process_info =
>>   ((struct amdgpu_vm *)vm)->process_info;
>> -    unsigned long bo_size = mem->bo->tbo.mem.size;
>> +    unsigned long bo_size = mem->bo->tbo.base.size;
>>   struct kfd_bo_va_list *entry;
>>   struct bo_vm_reservation_context ctx;
>>   int ret;
>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: linux-next: manual merge of the drm tree with the pci tree

2020-12-14 Thread Stephen Rothwell
Hi all,

On Tue, 8 Dec 2020 13:27:54 +1100 Stephen Rothwell  
wrote:
> 
> Today's linux-next merge of the drm tree got a conflict in:
> 
>   drivers/gpu/vga/vga_switcheroo.c
> 
> between commit:
> 
>   99efde6c9bb7 ("PCI/PM: Rename pci_wakeup_bus() to pci_resume_bus()")
> 
> from the pci tree and commit:
> 
>   9572e6693cd7 ("vga_switcheroo: simplify the return expression of 
> vga_switcheroo_runtime_resume")
> 
> from the drm 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.
> 
> -- 
> Cheers,
> Stephen Rothwell
> 
> diff --cc drivers/gpu/vga/vga_switcheroo.c
> index 8843b078ad4e,1401fd52f37a..
> --- a/drivers/gpu/vga/vga_switcheroo.c
> +++ b/drivers/gpu/vga/vga_switcheroo.c
> @@@ -1039,12 -1038,8 +1038,8 @@@ static int vga_switcheroo_runtime_resum
>   mutex_lock(_mutex);
>   vga_switcheroo_power_switch(pdev, VGA_SWITCHEROO_ON);
>   mutex_unlock(_mutex);
>  -pci_wakeup_bus(pdev->bus);
>  +pci_resume_bus(pdev->bus);
> - ret = dev->bus->pm->runtime_resume(dev);
> - if (ret)
> - return ret;
> - 
> - return 0;
> + return dev->bus->pm->runtime_resume(dev);
>   }
>   
>   /**

This is now a conflict between the pci tree and Linus' tree.

-- 
Cheers,
Stephen Rothwell


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


Re: [PATCH 2/4] drm/amdgpu/ttm: use multihop

2020-12-14 Thread Alex Deucher
On Mon, Dec 14, 2020 at 4:08 AM Daniel Vetter  wrote:
>
> On Sun, Dec 13, 2020 at 2:44 AM Mike Lothian  wrote:
> >
> > Hi
> >
> > This patch is causing issues for me on both a Raven system and a Tonga
> > (PRIME) system
> >
> > https://gitlab.freedesktop.org/drm/amd/-/issues/1405
> >
> > It's only recently been merged into agd5f's tree - which is why I'm
> > only just noticing it
> >
> > I realise this has now been submitted for rc1 - please can someone take a 
> > look
>
> Can you pls cherry-pick this one from drm-misc-next?
>
> commit 9afdda82ee7f69b25cb5e6968e2d3d63e2313d12
> Author: Christian König 
> Date:   Wed Nov 25 15:32:23 2020 +0100
>
>drm/radeon: fix check order in radeon_bo_move
>
> Christian, I think this fix should be cherry-picked to
> drm-misc-next-fixes to make it into the merge window. It should have
> been there from the start, but drm-misc-next-fixes wasn't ready yet I
> think. Also adding Thomas to make sure the pull train goes out.

Looks like it's already in drm-misc-next-fixes:
https://cgit.freedesktop.org/drm/drm-misc/commit/?h=drm-misc-next-fixes=aefec40938e4a0e1214f9121520aba4d51697cd9

commit aefec40938e4a0e1214f9121520aba4d51697cd9
Author: Christian König 
Date:   Mon Nov 16 20:12:03 2020 +0100

drm/amdgpu: fix check order in amdgpu_bo_move

Reorder the code to fix checking if blitting is available.

Signed-off-by: Christian König 
Acked-by: Alex Deucher 
Link: https://patchwork.freedesktop.org/patch/401019/

Alex

> -Daniel
>
> > Thanks
> >
> > Mike
> >
> > On Mon, 9 Nov 2020 at 00:54, Dave Airlie  wrote:
> > >
> > > From: Dave Airlie 
> > >
> > > This removes the code to move resources directly between
> > > SYSTEM and VRAM in favour of using the core ttm mulithop code.
> > >
> > > Signed-off-by: Dave Airlie 
> > > ---
> > >  drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 136 +++-
> > >  1 file changed, 13 insertions(+), 123 deletions(-)
> > >
> > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c 
> > > b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> > > index ce0d82802333..e1458d575aa9 100644
> > > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> > > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> > > @@ -512,119 +512,6 @@ static int amdgpu_move_blit(struct 
> > > ttm_buffer_object *bo,
> > > return r;
> > >  }
> > >
> > > -/**
> > > - * amdgpu_move_vram_ram - Copy VRAM buffer to RAM buffer
> > > - *
> > > - * Called by amdgpu_bo_move().
> > > - */
> > > -static int amdgpu_move_vram_ram(struct ttm_buffer_object *bo, bool evict,
> > > -   struct ttm_operation_ctx *ctx,
> > > -   struct ttm_resource *new_mem)
> > > -{
> > > -   struct ttm_resource *old_mem = >mem;
> > > -   struct ttm_resource tmp_mem;
> > > -   struct ttm_place placements;
> > > -   struct ttm_placement placement;
> > > -   int r;
> > > -
> > > -   /* create space/pages for new_mem in GTT space */
> > > -   tmp_mem = *new_mem;
> > > -   tmp_mem.mm_node = NULL;
> > > -   placement.num_placement = 1;
> > > -   placement.placement = 
> > > -   placement.num_busy_placement = 1;
> > > -   placement.busy_placement = 
> > > -   placements.fpfn = 0;
> > > -   placements.lpfn = 0;
> > > -   placements.mem_type = TTM_PL_TT;
> > > -   placements.flags = 0;
> > > -   r = ttm_bo_mem_space(bo, , _mem, ctx);
> > > -   if (unlikely(r)) {
> > > -   pr_err("Failed to find GTT space for blit from VRAM\n");
> > > -   return r;
> > > -   }
> > > -
> > > -   r = ttm_tt_populate(bo->bdev, bo->ttm, ctx);
> > > -   if (unlikely(r))
> > > -   goto out_cleanup;
> > > -
> > > -   /* Bind the memory to the GTT space */
> > > -   r = amdgpu_ttm_backend_bind(bo->bdev, bo->ttm, _mem);
> > > -   if (unlikely(r)) {
> > > -   goto out_cleanup;
> > > -   }
> > > -
> > > -   /* blit VRAM to GTT */
> > > -   r = amdgpu_move_blit(bo, evict, _mem, old_mem);
> > > -   if (unlikely(r)) {
> > > -   goto out_cleanup;
> > > -   }
> > > -
> > > -   r = ttm_bo_wait_ctx(bo, ctx);
> > > -   if (unlikely(r))
> > > -   goto out_cleanup;
> > > -
> > > -   amdgpu_ttm_backend_unbind(bo->bdev, bo->ttm);
> > > -   ttm_resource_free(bo, >mem);
> > > -   ttm_bo_assign_mem(bo, new_mem);
> > > -out_cleanup:
> > > -   ttm_resource_free(bo, _mem);
> > > -   return r;
> > > -}
> > > -
> > > -/**
> > > - * amdgpu_move_ram_vram - Copy buffer from RAM to VRAM
> > > - *
> > > - * Called by amdgpu_bo_move().
> > > - */
> > > -static int amdgpu_move_ram_vram(struct ttm_buffer_object *bo, bool evict,
> > > -   struct ttm_operation_ctx *ctx,
> > > -   struct ttm_resource *new_mem)
> > > -{
> > > -   struct ttm_resource *old_mem = >mem;
> > > -   struct ttm_resource tmp_mem;
> > > -   struct 

Re: [PATCH] drm/ttm: cleanup BO size handling v3

2020-12-14 Thread Christian König
Turned out I did test it, but then forgot to do git add to the changes 
before pushing


It was a really long day/week/year :)

Christian.

Am 14.12.20 um 17:55 schrieb Daniel Vetter:

I think you forgot to compile test with amdkfd :-)

drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c: In function ‘add_bo_to_vm’:
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c:456:37: error:
‘struct ttm_resource’ has no member named ‘size’
  456 |  unsigned long bo_size = bo->tbo.mem.size;
  | ^
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c: In function
‘amdgpu_amdkfd_gpuvm_free_memory_of_gpu’:
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c:1284:42: error:
‘struct ttm_resource’ has no member named ‘size’
1284 |  unsigned long bo_size = mem->bo->tbo.mem.size;
  |  ^
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c: In function
‘amdgpu_amdkfd_gpuvm_map_memory_to_gpu’:
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c:1405:23: error:
‘struct ttm_resource’ has no member named ‘size’
1405 |  bo_size = bo->tbo.mem.size;
  |   ^
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c: In function
‘amdgpu_amdkfd_gpuvm_unmap_memory_from_gpu’:
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c:1509:42: error:
‘struct ttm_resource’ has no member named ‘size’
1509 |  unsigned long bo_size = mem->bo->tbo.mem.size;
  |  ^
Also we really need gitlab CI to stop this kind of stuff ...
-Daniel

On Thu, Dec 10, 2020 at 3:52 PM Christian König
 wrote:

Based on an idea from Dave, but cleaned up a bit.

We had multiple fields for essentially the same thing.

Now bo->base.size is the original size of the BO in
arbitrary units, usually bytes.

bo->mem.num_pages is the size in number of pages in the
resource domain of bo->mem.mem_type.

v2: use the GEM object size instead of the BO size
v3: fix printks in some places

Signed-off-by: Christian König 
Reviewed-by: Huang Rui  (v1)
Acked-by: Daniel Vetter 
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c   |  2 +-
  drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c   |  2 +-
  drivers/gpu/drm/amd/amdgpu/amdgpu_object.c|  2 +-
  drivers/gpu/drm/amd/amdgpu/amdgpu_object.h|  4 +--
  drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h |  2 +-
  drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c   |  6 ++--
  drivers/gpu/drm/amd/amdgpu/mes_v10_1.c|  2 +-
  drivers/gpu/drm/nouveau/nouveau_bo.c  | 10 +++---
  drivers/gpu/drm/nouveau/nouveau_display.c |  8 ++---
  drivers/gpu/drm/nouveau/nouveau_prime.c   |  4 +--
  drivers/gpu/drm/nouveau/nv17_fence.c  |  2 +-
  drivers/gpu/drm/nouveau/nv50_fence.c  |  2 +-
  drivers/gpu/drm/qxl/qxl_object.h  |  2 +-
  drivers/gpu/drm/radeon/radeon_cs.c|  3 +-
  drivers/gpu/drm/radeon/radeon_object.c| 13 ---
  drivers/gpu/drm/radeon/radeon_object.h|  4 +--
  drivers/gpu/drm/radeon/radeon_prime.c |  4 +--
  drivers/gpu/drm/radeon/radeon_trace.h |  2 +-
  drivers/gpu/drm/radeon/radeon_ttm.c   |  2 +-
  drivers/gpu/drm/ttm/ttm_bo.c  | 35 ++-
  drivers/gpu/drm/ttm/ttm_bo_util.c | 12 +++
  drivers/gpu/drm/ttm/ttm_bo_vm.c   |  6 ++--
  drivers/gpu/drm/ttm/ttm_tt.c  |  2 +-
  drivers/gpu/drm/vmwgfx/vmwgfx_blit.c  |  4 +--
  drivers/gpu/drm/vmwgfx/vmwgfx_bo.c|  6 ++--
  drivers/gpu/drm/vmwgfx/vmwgfx_cotable.c   |  2 +-
  drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c   |  4 +--
  drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c |  5 ++-
  drivers/gpu/drm/vmwgfx/vmwgfx_kms.c   |  2 +-
  drivers/gpu/drm/vmwgfx/vmwgfx_page_dirty.c|  8 ++---
  drivers/gpu/drm/vmwgfx/vmwgfx_resource.c  |  2 +-
  drivers/gpu/drm/vmwgfx/vmwgfx_shader.c|  3 +-
  drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c  |  4 +--
  drivers/gpu/drm/vmwgfx/vmwgfx_surface.c   |  7 ++--
  include/drm/ttm/ttm_bo_api.h  |  9 ++---
  include/drm/ttm/ttm_resource.h|  1 -
  36 files changed, 84 insertions(+), 104 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c
index e5919efca870..c4c93f19d273 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c
@@ -269,7 +269,7 @@ static struct sg_table *amdgpu_dma_buf_map(struct 
dma_buf_attachment *attach,
 case TTM_PL_TT:
 sgt = drm_prime_pages_to_sg(obj->dev,
 bo->tbo.ttm->pages,
-   bo->tbo.num_pages);
+   bo->tbo.ttm->num_pages);
 if (IS_ERR(sgt))
 return sgt;

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
index 

Re: [PATCH] drm/amdkfd: fix ttm size refactor fallout

2020-12-14 Thread Christian König

Am 14.12.20 um 20:17 schrieb Daniel Vetter:

I guess Christian didn't compile test amdkfd.


Scratching my head what has happened here. When I tested everything was 
at least building fine.




Fixes: e11bfb99d6ec ("drm/ttm: cleanup BO size handling v3")
Cc: Christian König 
Cc: Huang Rui  (v1)
Cc: Daniel Vetter 
Cc: Felix Kuehling 
Cc: amd-...@lists.freedesktop.org
Signed-off-by: Daniel Vetter 


Reviewed-by: Christian König 


---
  drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 8 
  1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
index 7791d074bd32..a9647e7f98a8 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
@@ -453,7 +453,7 @@ static int add_bo_to_vm(struct amdgpu_device *adev, struct 
kgd_mem *mem,
struct amdgpu_bo *bo = mem->bo;
uint64_t va = mem->va;
struct list_head *list_bo_va = >bo_va_list;
-   unsigned long bo_size = bo->tbo.mem.size;
+   unsigned long bo_size = bo->tbo.base.size;
  
  	if (!va) {

pr_err("Invalid VA when adding BO to VM\n");
@@ -1281,7 +1281,7 @@ int amdgpu_amdkfd_gpuvm_free_memory_of_gpu(
struct kgd_dev *kgd, struct kgd_mem *mem, uint64_t *size)
  {
struct amdkfd_process_info *process_info = mem->process_info;
-   unsigned long bo_size = mem->bo->tbo.mem.size;
+   unsigned long bo_size = mem->bo->tbo.base.size;
struct kfd_bo_va_list *entry, *tmp;
struct bo_vm_reservation_context ctx;
struct ttm_validate_buffer *bo_list_entry;
@@ -1402,7 +1402,7 @@ int amdgpu_amdkfd_gpuvm_map_memory_to_gpu(
mutex_lock(>lock);
  
  	domain = mem->domain;

-   bo_size = bo->tbo.mem.size;
+   bo_size = bo->tbo.base.size;
  
  	pr_debug("Map VA 0x%llx - 0x%llx to vm %p domain %s\n",

mem->va,
@@ -1506,7 +1506,7 @@ int amdgpu_amdkfd_gpuvm_unmap_memory_from_gpu(
struct amdgpu_device *adev = get_amdgpu_device(kgd);
struct amdkfd_process_info *process_info =
((struct amdgpu_vm *)vm)->process_info;
-   unsigned long bo_size = mem->bo->tbo.mem.size;
+   unsigned long bo_size = mem->bo->tbo.base.size;
struct kfd_bo_va_list *entry;
struct bo_vm_reservation_context ctx;
int ret;


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


Re: linux-next: build warning after merge of the amdgpu tree

2020-12-14 Thread Stephen Rothwell
Hi all,

On Tue, 17 Nov 2020 15:45:14 +1100 Stephen Rothwell  
wrote:
>
> After merging the amdgpu tree, today's linux-next build (htmldocs)
> produced this warning:
> 
> drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h:353: warning: Function 
> parameter or member 'crc_win_x_start_property' not described in 
> 'amdgpu_display_manager'
> drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h:353: warning: Function 
> parameter or member 'crc_win_y_start_property' not described in 
> 'amdgpu_display_manager'
> drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h:353: warning: Function 
> parameter or member 'crc_win_x_end_property' not described in 
> 'amdgpu_display_manager'
> drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h:353: warning: Function 
> parameter or member 'crc_win_y_end_property' not described in 
> 'amdgpu_display_manager'
> 
> Introduced by commit
> 
>   c920888c604d ("drm/amd/display: Expose new CRC window property")

I am still getting those warnings.  That commit is now in the drm tree.
-- 
Cheers,
Stephen Rothwell


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


Re: [PATCH] drm/amdkfd: fix ttm size refactor fallout

2020-12-14 Thread Daniel Vetter
On Mon, Dec 14, 2020 at 02:20:39PM -0500, Alex Deucher wrote:
> On Mon, Dec 14, 2020 at 2:17 PM Daniel Vetter  wrote:
> >
> > I guess Christian didn't compile test amdkfd.
> >
> > Fixes: e11bfb99d6ec ("drm/ttm: cleanup BO size handling v3")
> > Cc: Christian König 
> > Cc: Huang Rui  (v1)
> > Cc: Daniel Vetter 
> > Cc: Felix Kuehling 
> > Cc: amd-...@lists.freedesktop.org
> > Signed-off-by: Daniel Vetter 
> 
> Acked-by: Alex Deucher 

Pushed to drm-misc-next, thanks for review and all.
-Daniel

> 
> > ---
> >  drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 8 
> >  1 file changed, 4 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c 
> > b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
> > index 7791d074bd32..a9647e7f98a8 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
> > @@ -453,7 +453,7 @@ static int add_bo_to_vm(struct amdgpu_device *adev, 
> > struct kgd_mem *mem,
> > struct amdgpu_bo *bo = mem->bo;
> > uint64_t va = mem->va;
> > struct list_head *list_bo_va = >bo_va_list;
> > -   unsigned long bo_size = bo->tbo.mem.size;
> > +   unsigned long bo_size = bo->tbo.base.size;
> >
> > if (!va) {
> > pr_err("Invalid VA when adding BO to VM\n");
> > @@ -1281,7 +1281,7 @@ int amdgpu_amdkfd_gpuvm_free_memory_of_gpu(
> > struct kgd_dev *kgd, struct kgd_mem *mem, uint64_t *size)
> >  {
> > struct amdkfd_process_info *process_info = mem->process_info;
> > -   unsigned long bo_size = mem->bo->tbo.mem.size;
> > +   unsigned long bo_size = mem->bo->tbo.base.size;
> > struct kfd_bo_va_list *entry, *tmp;
> > struct bo_vm_reservation_context ctx;
> > struct ttm_validate_buffer *bo_list_entry;
> > @@ -1402,7 +1402,7 @@ int amdgpu_amdkfd_gpuvm_map_memory_to_gpu(
> > mutex_lock(>lock);
> >
> > domain = mem->domain;
> > -   bo_size = bo->tbo.mem.size;
> > +   bo_size = bo->tbo.base.size;
> >
> > pr_debug("Map VA 0x%llx - 0x%llx to vm %p domain %s\n",
> > mem->va,
> > @@ -1506,7 +1506,7 @@ int amdgpu_amdkfd_gpuvm_unmap_memory_from_gpu(
> > struct amdgpu_device *adev = get_amdgpu_device(kgd);
> > struct amdkfd_process_info *process_info =
> > ((struct amdgpu_vm *)vm)->process_info;
> > -   unsigned long bo_size = mem->bo->tbo.mem.size;
> > +   unsigned long bo_size = mem->bo->tbo.base.size;
> > struct kfd_bo_va_list *entry;
> > struct bo_vm_reservation_context ctx;
> > int ret;
> > --
> > 2.29.2
> >
> > ___
> > amd-gfx mailing list
> > amd-...@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/amd-gfx

-- 
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: [git pull] drm for 5.11-rc1

2020-12-14 Thread pr-tracker-bot
The pull request you sent on Fri, 11 Dec 2020 13:52:21 +1000:

> git://anongit.freedesktop.org/drm/drm tags/drm-next-2020-12-11

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/1d36dffa5d887715dacca0f717f4519b7be5e498

Thank you!

-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/prtracker.html
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: linux-next: build warnings after merge of the drm tree

2020-12-14 Thread Stephen Rothwell
Hi all,

On Mon, 16 Nov 2020 10:44:44 +1100 Stephen Rothwell  
wrote:
>
> On Thu, 5 Nov 2020 17:50:31 +1100 Stephen Rothwell  
> wrote:
> >
> > After merging the drm tree, today's linux-next build (htmldocs) produced
> > these warnings:
> > 
> > include/linux/dma-buf-map.h:106: warning: Excess function parameter 'vaddr' 
> > description in 'DMA_BUF_MAP_INIT_VADDR'
> > include/linux/dma-buf-map.h:106: warning: Function parameter or member 
> > 'vaddr_' not described in 'DMA_BUF_MAP_INIT_VADDR'
> > include/linux/dma-buf-map.h:106: warning: Excess function parameter 'vaddr' 
> > description in 'DMA_BUF_MAP_INIT_VADDR'
> > 
> > Introduced by commit
> > 
> >   20e76f1a7059 ("dma-buf: Use struct dma_buf_map in dma_buf_vunmap() 
> > interfaces")  
> 
> I am still getting these warnings.

I am still getting these warnings.

-- 
Cheers,
Stephen Rothwell


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


Re: [PATCH] drm/amdkfd: fix ttm size refactor fallout

2020-12-14 Thread Felix Kuehling
Am 2020-12-14 um 2:17 p.m. schrieb Daniel Vetter:
> I guess Christian didn't compile test amdkfd.
>
> Fixes: e11bfb99d6ec ("drm/ttm: cleanup BO size handling v3")
> Cc: Christian König 
> Cc: Huang Rui  (v1)
> Cc: Daniel Vetter 
> Cc: Felix Kuehling 
> Cc: amd-...@lists.freedesktop.org
> Signed-off-by: Daniel Vetter 

Thanks.

Reviewed-by: Felix Kuehling 


> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 8 
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
> index 7791d074bd32..a9647e7f98a8 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
> @@ -453,7 +453,7 @@ static int add_bo_to_vm(struct amdgpu_device *adev, 
> struct kgd_mem *mem,
>   struct amdgpu_bo *bo = mem->bo;
>   uint64_t va = mem->va;
>   struct list_head *list_bo_va = >bo_va_list;
> - unsigned long bo_size = bo->tbo.mem.size;
> + unsigned long bo_size = bo->tbo.base.size;
>  
>   if (!va) {
>   pr_err("Invalid VA when adding BO to VM\n");
> @@ -1281,7 +1281,7 @@ int amdgpu_amdkfd_gpuvm_free_memory_of_gpu(
>   struct kgd_dev *kgd, struct kgd_mem *mem, uint64_t *size)
>  {
>   struct amdkfd_process_info *process_info = mem->process_info;
> - unsigned long bo_size = mem->bo->tbo.mem.size;
> + unsigned long bo_size = mem->bo->tbo.base.size;
>   struct kfd_bo_va_list *entry, *tmp;
>   struct bo_vm_reservation_context ctx;
>   struct ttm_validate_buffer *bo_list_entry;
> @@ -1402,7 +1402,7 @@ int amdgpu_amdkfd_gpuvm_map_memory_to_gpu(
>   mutex_lock(>lock);
>  
>   domain = mem->domain;
> - bo_size = bo->tbo.mem.size;
> + bo_size = bo->tbo.base.size;
>  
>   pr_debug("Map VA 0x%llx - 0x%llx to vm %p domain %s\n",
>   mem->va,
> @@ -1506,7 +1506,7 @@ int amdgpu_amdkfd_gpuvm_unmap_memory_from_gpu(
>   struct amdgpu_device *adev = get_amdgpu_device(kgd);
>   struct amdkfd_process_info *process_info =
>   ((struct amdgpu_vm *)vm)->process_info;
> - unsigned long bo_size = mem->bo->tbo.mem.size;
> + unsigned long bo_size = mem->bo->tbo.base.size;
>   struct kfd_bo_va_list *entry;
>   struct bo_vm_reservation_context ctx;
>   int ret;
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 2/2] drm/ttm: cleanup LRU handling further

2020-12-14 Thread Andrey Grodzovsky

Series is Acked-by: Andrey Grodzovsky 

Andrey

On 11/27/20 9:16 AM, Christian König wrote:

We only completely delete the BO from the LRU on destruction.

Signed-off-by: Christian König 
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c |  4 +-
  drivers/gpu/drm/qxl/qxl_release.c  |  2 +-
  drivers/gpu/drm/ttm/ttm_bo.c   | 60 +++---
  drivers/gpu/drm/ttm/ttm_execbuf_util.c |  4 +-
  include/drm/ttm/ttm_bo_api.h   |  2 +
  include/drm/ttm/ttm_bo_driver.h|  5 ++-
  6 files changed, 36 insertions(+), 41 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index 0768c8686983..ad91c0c3c423 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -653,9 +653,11 @@ void amdgpu_vm_move_to_lru_tail(struct amdgpu_device *adev,
if (!bo->parent)
continue;
  
-		ttm_bo_move_to_lru_tail(>tbo, >lru_bulk_move);

+   ttm_bo_move_to_lru_tail(>tbo, >tbo.mem,
+   >lru_bulk_move);
if (bo->shadow)
ttm_bo_move_to_lru_tail(>shadow->tbo,
+   >shadow->tbo.mem,
>lru_bulk_move);
}
spin_unlock(_bo_glob.lru_lock);
diff --git a/drivers/gpu/drm/qxl/qxl_release.c 
b/drivers/gpu/drm/qxl/qxl_release.c
index e75e364655b8..0fcfc952d5e9 100644
--- a/drivers/gpu/drm/qxl/qxl_release.c
+++ b/drivers/gpu/drm/qxl/qxl_release.c
@@ -456,7 +456,7 @@ void qxl_release_fence_buffer_objects(struct qxl_release 
*release)
bo = entry->bo;
  
  		dma_resv_add_shared_fence(bo->base.resv, >base);

-   ttm_bo_move_to_lru_tail(bo, NULL);
+   ttm_bo_move_to_lru_tail(bo, >mem, NULL);
dma_resv_unlock(bo->base.resv);
}
spin_unlock(_bo_glob.lru_lock);
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
index a0bddcc64504..a4435caba94c 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -109,40 +109,14 @@ static struct kobj_type ttm_bo_glob_kobj_type  = {
.default_attrs = ttm_bo_global_attrs
  };
  
-static void ttm_bo_add_mem_to_lru(struct ttm_buffer_object *bo,

- struct ttm_resource *mem)
-{
-   struct ttm_bo_device *bdev = bo->bdev;
-   struct ttm_resource_manager *man;
-
-   if (!list_empty(>lru) || bo->pin_count)
-   return;
-
-   man = ttm_manager_type(bdev, mem->mem_type);
-   list_add_tail(>lru, >lru[bo->priority]);
-
-   if (man->use_tt && bo->ttm &&
-   !(bo->ttm->page_flags & (TTM_PAGE_FLAG_SG |
-TTM_PAGE_FLAG_SWAPPED))) {
-   list_add_tail(>swap, _bo_glob.swap_lru[bo->priority]);
-   }
-}
-
  static void ttm_bo_del_from_lru(struct ttm_buffer_object *bo)
  {
struct ttm_bo_device *bdev = bo->bdev;
-   bool notify = false;
  
-	if (!list_empty(>swap)) {

-   list_del_init(>swap);
-   notify = true;
-   }
-   if (!list_empty(>lru)) {
-   list_del_init(>lru);
-   notify = true;
-   }
+   list_del_init(>swap);
+   list_del_init(>lru);
  
-	if (notify && bdev->driver->del_from_lru_notify)

+   if (bdev->driver->del_from_lru_notify)
bdev->driver->del_from_lru_notify(bo);
  }
  
@@ -155,12 +129,30 @@ static void ttm_bo_bulk_move_set_pos(struct ttm_lru_bulk_move_pos *pos,

  }
  
  void ttm_bo_move_to_lru_tail(struct ttm_buffer_object *bo,

+struct ttm_resource *mem,
 struct ttm_lru_bulk_move *bulk)
  {
+   struct ttm_bo_device *bdev = bo->bdev;
+   struct ttm_resource_manager *man;
+
dma_resv_assert_held(bo->base.resv);
  
-	ttm_bo_del_from_lru(bo);

-   ttm_bo_add_mem_to_lru(bo, >mem);
+   if (bo->pin_count)
+   return;
+
+   man = ttm_manager_type(bdev, mem->mem_type);
+   list_move_tail(>lru, >lru[bo->priority]);
+   if (man->use_tt && bo->ttm &&
+   !(bo->ttm->page_flags & (TTM_PAGE_FLAG_SG |
+TTM_PAGE_FLAG_SWAPPED))) {
+   struct list_head *swap;
+
+   swap = _bo_glob.swap_lru[bo->priority];
+   list_move_tail(>swap, swap);
+   }
+
+   if (bdev->driver->del_from_lru_notify)
+   bdev->driver->del_from_lru_notify(bo);
  
  	if (bulk && !bo->pin_count) {

switch (bo->mem.mem_type) {
@@ -516,8 +508,7 @@ static void ttm_bo_release(struct kref *kref)
 */
if (bo->pin_count) {
bo->pin_count = 0;
-   ttm_bo_del_from_lru(bo);
-   ttm_bo_add_mem_to_lru(bo, >mem);
+   ttm_bo_move_to_lru_tail(bo, >mem, NULL);

Re: [PATCH] drm/amdkfd: fix ttm size refactor fallout

2020-12-14 Thread Alex Deucher
On Mon, Dec 14, 2020 at 2:17 PM Daniel Vetter  wrote:
>
> I guess Christian didn't compile test amdkfd.
>
> Fixes: e11bfb99d6ec ("drm/ttm: cleanup BO size handling v3")
> Cc: Christian König 
> Cc: Huang Rui  (v1)
> Cc: Daniel Vetter 
> Cc: Felix Kuehling 
> Cc: amd-...@lists.freedesktop.org
> Signed-off-by: Daniel Vetter 

Acked-by: Alex Deucher 

> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 8 
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
> index 7791d074bd32..a9647e7f98a8 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
> @@ -453,7 +453,7 @@ static int add_bo_to_vm(struct amdgpu_device *adev, 
> struct kgd_mem *mem,
> struct amdgpu_bo *bo = mem->bo;
> uint64_t va = mem->va;
> struct list_head *list_bo_va = >bo_va_list;
> -   unsigned long bo_size = bo->tbo.mem.size;
> +   unsigned long bo_size = bo->tbo.base.size;
>
> if (!va) {
> pr_err("Invalid VA when adding BO to VM\n");
> @@ -1281,7 +1281,7 @@ int amdgpu_amdkfd_gpuvm_free_memory_of_gpu(
> struct kgd_dev *kgd, struct kgd_mem *mem, uint64_t *size)
>  {
> struct amdkfd_process_info *process_info = mem->process_info;
> -   unsigned long bo_size = mem->bo->tbo.mem.size;
> +   unsigned long bo_size = mem->bo->tbo.base.size;
> struct kfd_bo_va_list *entry, *tmp;
> struct bo_vm_reservation_context ctx;
> struct ttm_validate_buffer *bo_list_entry;
> @@ -1402,7 +1402,7 @@ int amdgpu_amdkfd_gpuvm_map_memory_to_gpu(
> mutex_lock(>lock);
>
> domain = mem->domain;
> -   bo_size = bo->tbo.mem.size;
> +   bo_size = bo->tbo.base.size;
>
> pr_debug("Map VA 0x%llx - 0x%llx to vm %p domain %s\n",
> mem->va,
> @@ -1506,7 +1506,7 @@ int amdgpu_amdkfd_gpuvm_unmap_memory_from_gpu(
> struct amdgpu_device *adev = get_amdgpu_device(kgd);
> struct amdkfd_process_info *process_info =
> ((struct amdgpu_vm *)vm)->process_info;
> -   unsigned long bo_size = mem->bo->tbo.mem.size;
> +   unsigned long bo_size = mem->bo->tbo.base.size;
> struct kfd_bo_va_list *entry;
> struct bo_vm_reservation_context ctx;
> int ret;
> --
> 2.29.2
>
> ___
> amd-gfx mailing list
> amd-...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH] drm/amdkfd: fix ttm size refactor fallout

2020-12-14 Thread Daniel Vetter
I guess Christian didn't compile test amdkfd.

Fixes: e11bfb99d6ec ("drm/ttm: cleanup BO size handling v3")
Cc: Christian König 
Cc: Huang Rui  (v1)
Cc: Daniel Vetter 
Cc: Felix Kuehling 
Cc: amd-...@lists.freedesktop.org
Signed-off-by: Daniel Vetter 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
index 7791d074bd32..a9647e7f98a8 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
@@ -453,7 +453,7 @@ static int add_bo_to_vm(struct amdgpu_device *adev, struct 
kgd_mem *mem,
struct amdgpu_bo *bo = mem->bo;
uint64_t va = mem->va;
struct list_head *list_bo_va = >bo_va_list;
-   unsigned long bo_size = bo->tbo.mem.size;
+   unsigned long bo_size = bo->tbo.base.size;
 
if (!va) {
pr_err("Invalid VA when adding BO to VM\n");
@@ -1281,7 +1281,7 @@ int amdgpu_amdkfd_gpuvm_free_memory_of_gpu(
struct kgd_dev *kgd, struct kgd_mem *mem, uint64_t *size)
 {
struct amdkfd_process_info *process_info = mem->process_info;
-   unsigned long bo_size = mem->bo->tbo.mem.size;
+   unsigned long bo_size = mem->bo->tbo.base.size;
struct kfd_bo_va_list *entry, *tmp;
struct bo_vm_reservation_context ctx;
struct ttm_validate_buffer *bo_list_entry;
@@ -1402,7 +1402,7 @@ int amdgpu_amdkfd_gpuvm_map_memory_to_gpu(
mutex_lock(>lock);
 
domain = mem->domain;
-   bo_size = bo->tbo.mem.size;
+   bo_size = bo->tbo.base.size;
 
pr_debug("Map VA 0x%llx - 0x%llx to vm %p domain %s\n",
mem->va,
@@ -1506,7 +1506,7 @@ int amdgpu_amdkfd_gpuvm_unmap_memory_from_gpu(
struct amdgpu_device *adev = get_amdgpu_device(kgd);
struct amdkfd_process_info *process_info =
((struct amdgpu_vm *)vm)->process_info;
-   unsigned long bo_size = mem->bo->tbo.mem.size;
+   unsigned long bo_size = mem->bo->tbo.base.size;
struct kfd_bo_va_list *entry;
struct bo_vm_reservation_context ctx;
int ret;
-- 
2.29.2

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


Re: [PATCH v4 1/2] drm: automatic legacy gamma support

2020-12-14 Thread Philippe CORNU
Hi Tomi,


On 12/11/20 12:42 PM, Tomi Valkeinen wrote:
> To support legacy gamma ioctls the drivers need to set
> drm_crtc_funcs.gamma_set either to a custom implementation or to
> drm_atomic_helper_legacy_gamma_set. Most of the atomic drivers do the
> latter.
> 
> We can simplify this by making the core handle it automatically.
> 
> Move the drm_atomic_helper_legacy_gamma_set() functionality into
> drm_color_mgmt.c to make drm_mode_gamma_set_ioctl() use
> drm_crtc_funcs.gamma_set if set or GAMMA_LUT property if not.
> 
> Signed-off-by: Tomi Valkeinen 
> ---
>   .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |   1 -
>   .../gpu/drm/arm/display/komeda/komeda_crtc.c  |   1 -
>   drivers/gpu/drm/arm/malidp_crtc.c |   1 -
>   drivers/gpu/drm/armada/armada_crtc.c  |   1 -
>   drivers/gpu/drm/ast/ast_mode.c|   1 -
>   .../gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c|   1 -
>   drivers/gpu/drm/drm_atomic_helper.c   |  70 ---
>   drivers/gpu/drm/drm_color_mgmt.c  | 111 --
>   drivers/gpu/drm/i915/display/intel_display.c  |   1 -
>   drivers/gpu/drm/ingenic/ingenic-drm-drv.c |   2 -
>   drivers/gpu/drm/mediatek/mtk_drm_crtc.c   |   1 -
>   drivers/gpu/drm/nouveau/dispnv50/head.c   |   2 -
>   drivers/gpu/drm/omapdrm/omap_crtc.c   |   1 -
>   drivers/gpu/drm/rcar-du/rcar_du_crtc.c|   1 -
>   drivers/gpu/drm/rockchip/rockchip_drm_vop.c   |   1 -
>   drivers/gpu/drm/stm/ltdc.c|   1 -

For the stm part,
Reviewed-by: Philippe Cornu 

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


Re: [kbuild-all] Re: [PATCH v2 2/2] drm: automatic legacy gamma support

2020-12-14 Thread Dan Carpenter
On Sat, Dec 12, 2020 at 04:54:45PM +0800, Philip Li wrote:
> On Fri, Dec 11, 2020 at 04:42:00PM +0200, Ville Syrjälä wrote:
> > On Fri, Dec 11, 2020 at 01:24:49PM +0200, Tomi Valkeinen wrote:
> > > On 10/12/2020 20:06, kernel test robot wrote:
> > > > Hi Tomi,
> > > > 
> > > > I love your patch! Perhaps something to improve:
> > > > 
> > > > [auto build test WARNING on drm-intel/for-linux-next]
> > > > [also build test WARNING on linus/master v5.10-rc7]
> > > > [cannot apply to drm-tip/drm-tip anholt/for-next next-20201210]
> > > > [If your patch is applied to the wrong git tree, kindly drop us a note.
> > > > And when submitting patch, we suggest to use '--base' as documented in
> > > > https://git-scm.com/docs/git-format-patch ]
> > > > 
> > > > url:
> > > > https://github.com/0day-ci/linux/commits/Tomi-Valkeinen/drm-fix-and-cleanup-legacy-gamma-support/20201208-215917
> > > >  
> > > > base:   git://anongit.freedesktop.org/drm-intel for-linux-next
> > > > config: i386-randconfig-m021-20201209 (attached as .config)
> > > > compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
> > > > 
> > > > If you fix the issue, kindly add following tag as appropriate
> > > > Reported-by: kernel test robot 
> > > > 
> > > > New smatch warnings:
> > > > drivers/gpu/drm/drm_color_mgmt.c:307 drm_crtc_legacy_gamma_set() error: 
> > > > potential null dereference 'blob'.  (drm_property_create_blob returns 
> > > > null)
> > > 
> > > I don't see how this could happen. There's no code path I see where 
> > > drm_property_create_blob could
> > > return null...
> > 
> > IIRC we've received multiple similar nonsense reports from lkp, but
> > no explanation why it thinks it could ever be null. Hmm, maybe there
> > is a codepath somewhere that has a null check on the return value?
> hi Dan, can you help on this to share some idea?
> 
> The original report is at
> https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org/thread/F3MVBRGF2R4URBNLNY3GMTSDZUCBX6RF/
>  

Thanks, Philip.  I've pushed a fix for this.

It didn't show up if you had the cross function DB built, so it's not
something I would see in my testing.

regards,
dan carpenter

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


Re: [v1] drm/msm/disp/dpu1: turn off vblank irqs aggressively in dpu driver

2020-12-14 Thread Rob Clark
On Mon, Dec 14, 2020 at 3:41 AM Kalyan Thota  wrote:
>
> Turn off vblank irqs immediately as soon as drm_vblank_put is
> requested so that there are no irqs triggered during idle state.
>
> This will reduce cpu wakeups and help in power saving. The change
> also enable driver timestamp for vblanks.
>
> Signed-off-by: Kalyan Thota 
> ---
>  drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c| 69 
> +
>  drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 15 +++
>  drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h |  6 +++
>  drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c |  4 ++
>  4 files changed, 94 insertions(+)
>
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c 
> b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
> index d4662e8..a4a5733 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
> @@ -65,6 +65,73 @@ static void dpu_crtc_destroy(struct drm_crtc *crtc)
> kfree(dpu_crtc);
>  }
>
> +static struct drm_encoder *get_encoder_from_crtc(struct drm_crtc *crtc)
> +{
> +   struct drm_device *dev = crtc->dev;
> +   struct drm_encoder *encoder;
> +
> +   drm_for_each_encoder(encoder, dev)
> +   if (encoder->crtc == crtc)
> +   return encoder;
> +
> +   return NULL;
> +}
> +
> +static bool dpu_crtc_get_scanout_position(struct drm_crtc *crtc,
> +  bool in_vblank_irq,
> +  int *vpos, int *hpos,
> +  ktime_t *stime, ktime_t *etime,
> +  const struct drm_display_mode 
> *mode)
> +{
> +   unsigned int pipe = crtc->index;
> +   struct drm_encoder *encoder;
> +   int line, vsw, vbp, vactive_start, vactive_end, vfp_end;
> +
> +
> +   encoder = get_encoder_from_crtc(crtc);
> +   if (!encoder) {
> +   DRM_ERROR("no encoder found for crtc %d\n", pipe);
> +   return false;
> +   }
> +
> +   vsw = mode->crtc_vsync_end - mode->crtc_vsync_start;
> +   vbp = mode->crtc_vtotal - mode->crtc_vsync_end;
> +
> +   /*
> +* the line counter is 1 at the start of the VSYNC pulse and VTOTAL at
> +* the end of VFP. Translate the porch values relative to the line
> +* counter positions.
> +*/
> +
> +   vactive_start = vsw + vbp + 1;
> +
> +   vactive_end = vactive_start + mode->crtc_vdisplay;
> +
> +   /* last scan line before VSYNC */
> +   vfp_end = mode->crtc_vtotal;
> +
> +   if (stime)
> +   *stime = ktime_get();
> +
> +   line = dpu_encoder_get_linecount(encoder);
> +
> +   if (line < vactive_start)
> +   line -= vactive_start;
> +   else if (line > vactive_end)
> +   line = line - vfp_end - vactive_start;
> +   else
> +   line -= vactive_start;
> +
> +   *vpos = line;
> +   *hpos = 0;
> +
> +   if (etime)
> +   *etime = ktime_get();
> +
> +   return true;
> +}
> +
> +
>  static void _dpu_crtc_setup_blend_cfg(struct dpu_crtc_mixer *mixer,
> struct dpu_plane_state *pstate, struct dpu_format *format)
>  {
> @@ -1243,6 +1310,7 @@ static const struct drm_crtc_funcs dpu_crtc_funcs = {
> .early_unregister = dpu_crtc_early_unregister,
> .enable_vblank  = msm_crtc_enable_vblank,
> .disable_vblank = msm_crtc_disable_vblank,
> +   .get_vblank_timestamp = drm_crtc_vblank_helper_get_vblank_timestamp,
>  };
>
>  static const struct drm_crtc_helper_funcs dpu_crtc_helper_funcs = {
> @@ -1251,6 +1319,7 @@ static const struct drm_crtc_helper_funcs 
> dpu_crtc_helper_funcs = {
> .atomic_check = dpu_crtc_atomic_check,
> .atomic_begin = dpu_crtc_atomic_begin,
> .atomic_flush = dpu_crtc_atomic_flush,
> +   .get_scanout_position = dpu_crtc_get_scanout_position,
>  };

I'm happy to see get_vblank_timestamp/get_scanout_position wired up, I
had a WIP patch for this somewhere but never got around to finishing
it.

But you probably should mention in the commit msg why this is part of this patch

>
>  /* initialize crtc */
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c 
> b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
> index f7f5c25..6c7c7fd 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
> @@ -425,6 +425,21 @@ int dpu_encoder_helper_unregister_irq(struct 
> dpu_encoder_phys *phys_enc,
> return 0;
>  }
>
> +int dpu_encoder_get_linecount(struct drm_encoder *drm_enc)
> +{
> +   struct dpu_encoder_virt *dpu_enc = NULL;
> +   struct dpu_encoder_phys *phys = NULL;
> +   int linecount = 0;
> +
> +   dpu_enc = to_dpu_encoder_virt(drm_enc);
> +   phys = dpu_enc ? dpu_enc->cur_master : NULL;
> +
> +   if (phys && phys->ops.get_line_count)
> +   linecount = phys->ops.get_line_count(phys);
> +
> +   

[Bug 210683] Nasty amdgpu powersave regression Navi14

2020-12-14 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=210683

Alex Deucher (alexdeuc...@gmail.com) changed:

   What|Removed |Added

 CC||alexdeuc...@gmail.com

--- Comment #3 from Alex Deucher (alexdeuc...@gmail.com) ---
Please attach your dmesg output.  Can you bisect?

-- 
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


[PATCH] drm/amd/display: Revert "add DCN support for aarch64"

2020-12-14 Thread Ard Biesheuvel
This reverts commit c38d444e44badc557cf29fdfdfb823604890ccfa.

Simply disabling -mgeneral-regs-only left and right is risky, given that
the standard AArch64 ABI permits the use of FP/SIMD registers anywhere,
and GCC is known to use SIMD registers for spilling, and may invent
other uses of the FP/SIMD register file that have nothing to do with the
floating point code in question. Note that putting kernel_neon_begin()
and kernel_neon_end() around the code that does use FP is not sufficient
here, the problem is in all the other code that may be emitted with
references to SIMD registers in it.

So the only way to do this properly is to put all floating point code in
a separate compilation unit, and only compile that unit with
-mgeneral-regs-only. But perhaps the use of floating point here is
something that should be reconsidered entirely.

Cc: Catalin Marinas 
Cc: Will Deacon 
Cc: Dave Martin 
Cc: Rob Herring 
Cc: Leo Li 
Cc: Alex Deucher 
Cc: "Christian König" 
Cc: David Airlie 
Cc: Daniel Vetter 
Cc: Daniel Kolesa 
Cc: amd-...@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Ard Biesheuvel 
---
 drivers/gpu/drm/amd/display/Kconfig   |  2 +-
 drivers/gpu/drm/amd/display/dc/calcs/Makefile |  7 --
 drivers/gpu/drm/amd/display/dc/clk_mgr/Makefile   |  7 --
 drivers/gpu/drm/amd/display/dc/dcn10/Makefile |  7 --
 drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c | 81 
 drivers/gpu/drm/amd/display/dc/dcn20/Makefile |  4 -
 drivers/gpu/drm/amd/display/dc/dcn21/Makefile |  4 -
 drivers/gpu/drm/amd/display/dc/dml/Makefile   | 13 
 drivers/gpu/drm/amd/display/dc/dsc/Makefile   |  5 --
 drivers/gpu/drm/amd/display/dc/os_types.h |  4 -
 10 files changed, 32 insertions(+), 102 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/Kconfig 
b/drivers/gpu/drm/amd/display/Kconfig
index 60dfdd432aba..3c410d236c49 100644
--- a/drivers/gpu/drm/amd/display/Kconfig
+++ b/drivers/gpu/drm/amd/display/Kconfig
@@ -6,7 +6,7 @@ config DRM_AMD_DC
bool "AMD DC - Enable new display engine"
default y
select SND_HDA_COMPONENT if SND_HDA_CORE
-   select DRM_AMD_DC_DCN if (X86 || PPC64 || (ARM64 && KERNEL_MODE_NEON)) 
&& !(KCOV_INSTRUMENT_ALL && KCOV_ENABLE_COMPARISONS)
+   select DRM_AMD_DC_DCN if (X86 || PPC64) && !(KCOV_INSTRUMENT_ALL && 
KCOV_ENABLE_COMPARISONS)
help
  Choose this option if you want to use the new display engine
  support for AMDGPU. This adds required support for Vega and
diff --git a/drivers/gpu/drm/amd/display/dc/calcs/Makefile 
b/drivers/gpu/drm/amd/display/dc/calcs/Makefile
index 64f515d74410..4674aca8f206 100644
--- a/drivers/gpu/drm/amd/display/dc/calcs/Makefile
+++ b/drivers/gpu/drm/amd/display/dc/calcs/Makefile
@@ -33,10 +33,6 @@ ifdef CONFIG_PPC64
 calcs_ccflags := -mhard-float -maltivec
 endif
 
-ifdef CONFIG_ARM64
-calcs_rcflags := -mgeneral-regs-only
-endif
-
 ifdef CONFIG_CC_IS_GCC
 ifeq ($(call cc-ifversion, -lt, 0701, y), y)
 IS_OLD_GCC = 1
@@ -57,9 +53,6 @@ endif
 CFLAGS_$(AMDDALPATH)/dc/calcs/dcn_calcs.o := $(calcs_ccflags)
 CFLAGS_$(AMDDALPATH)/dc/calcs/dcn_calc_auto.o := $(calcs_ccflags)
 CFLAGS_$(AMDDALPATH)/dc/calcs/dcn_calc_math.o := $(calcs_ccflags) 
-Wno-tautological-compare
-CFLAGS_REMOVE_$(AMDDALPATH)/dc/calcs/dcn_calcs.o := $(calcs_rcflags)
-CFLAGS_REMOVE_$(AMDDALPATH)/dc/calcs/dcn_calc_auto.o := $(calcs_rcflags)
-CFLAGS_REMOVE_$(AMDDALPATH)/dc/calcs/dcn_calc_math.o := $(calcs_rcflags)
 
 BW_CALCS = dce_calcs.o bw_fixed.o custom_float.o
 
diff --git a/drivers/gpu/drm/amd/display/dc/clk_mgr/Makefile 
b/drivers/gpu/drm/amd/display/dc/clk_mgr/Makefile
index 1a495759a034..52b1ce775a1e 100644
--- a/drivers/gpu/drm/amd/display/dc/clk_mgr/Makefile
+++ b/drivers/gpu/drm/amd/display/dc/clk_mgr/Makefile
@@ -104,13 +104,6 @@ ifdef CONFIG_PPC64
 CFLAGS_$(AMDDALPATH)/dc/clk_mgr/dcn21/rn_clk_mgr.o := $(call 
cc-option,-mno-gnu-attribute)
 endif
 
-# prevent build errors:
-# ...: '-mgeneral-regs-only' is incompatible with the use of floating-point 
types
-# this file is unused on arm64, just like on ppc64
-ifdef CONFIG_ARM64
-CFLAGS_REMOVE_$(AMDDALPATH)/dc/clk_mgr/dcn21/rn_clk_mgr.o := 
-mgeneral-regs-only
-endif
-
 AMD_DAL_CLK_MGR_DCN21 = $(addprefix 
$(AMDDALPATH)/dc/clk_mgr/dcn21/,$(CLK_MGR_DCN21))
 
 AMD_DISPLAY_FILES += $(AMD_DAL_CLK_MGR_DCN21)
diff --git a/drivers/gpu/drm/amd/display/dc/dcn10/Makefile 
b/drivers/gpu/drm/amd/display/dc/dcn10/Makefile
index 733e6e6e43bd..62ad1a11bff9 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn10/Makefile
+++ b/drivers/gpu/drm/amd/display/dc/dcn10/Makefile
@@ -31,11 +31,4 @@ DCN10 = dcn10_init.o dcn10_resource.o dcn10_ipp.o 
dcn10_hw_sequencer.o \
 
 AMD_DAL_DCN10 = $(addprefix $(AMDDALPATH)/dc/dcn10/,$(DCN10))
 
-# fix:
-# ...: '-mgeneral-regs-only' is incompatible with the use of floating-point 
types
-# aarch64 does not support soft-float, so use hard-float and handle this in 

[PATCH v6 1/5] drm: Add function to convert rect in 16.16 fixed format to regular format

2020-12-14 Thread José Roberto de Souza
Much more clear to read one function call than four lines doing this
conversion.

Cc: dri-devel@lists.freedesktop.org
Cc: Gwan-gyeong Mun 
Signed-off-by: José Roberto de Souza 
---
 drivers/gpu/drm/drm_rect.c | 15 +++
 include/drm/drm_rect.h |  2 ++
 2 files changed, 17 insertions(+)

diff --git a/drivers/gpu/drm/drm_rect.c b/drivers/gpu/drm/drm_rect.c
index 0460e874896e..24345704b353 100644
--- a/drivers/gpu/drm/drm_rect.c
+++ b/drivers/gpu/drm/drm_rect.c
@@ -373,3 +373,18 @@ void drm_rect_rotate_inv(struct drm_rect *r,
}
 }
 EXPORT_SYMBOL(drm_rect_rotate_inv);
+
+/**
+ * drm_rect_convert_16_16_to_regular - Convert a rect in 16.16 fixed point form
+ * to regular form.
+ * @in: rect in 16.16 fixed point form
+ * @out: rect to be stored the converted value
+ */
+void drm_rect_convert_16_16_to_regular(struct drm_rect *in, struct drm_rect 
*out)
+{
+   out->x1 = in->x1 >> 16;
+   out->y1 = in->y1 >> 16;
+   out->x2 = in->x2 >> 16;
+   out->y2 = in->y2 >> 16;
+}
+EXPORT_SYMBOL(drm_rect_convert_16_16_to_regular);
diff --git a/include/drm/drm_rect.h b/include/drm/drm_rect.h
index e7f4d24cdd00..2ef8180416cd 100644
--- a/include/drm/drm_rect.h
+++ b/include/drm/drm_rect.h
@@ -223,5 +223,7 @@ void drm_rect_rotate(struct drm_rect *r,
 void drm_rect_rotate_inv(struct drm_rect *r,
 int width, int height,
 unsigned int rotation);
+void drm_rect_convert_16_16_to_regular(struct drm_rect *in,
+  struct drm_rect *out);
 
 #endif
-- 
2.29.2

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


Re: [PATCH v5 27/29] drm/omap: dsi: remove ulps support

2020-12-14 Thread Sebastian Reichel
Hi,

On Tue, Dec 08, 2020 at 02:28:53PM +0200, Tomi Valkeinen wrote:
> ULPS doesn't work, and I have been unable to get it to work. As ULPS
> is a minor power-saving feature which requires substantial amount of
> non-trivial code, and we have trouble just getting and
> keeping DSI working at all, remove ULPS support.
>
> When the DSI driver works reliably for command and video mode displays,
> someone interested can add it back.
> 
> Signed-off-by: Tomi Valkeinen 
> Reviewed-by: Laurent Pinchart 
> ---

Is it really 'minor power-saving'? If I search for DSI and ULPS among
the first results is a TI datasheet for SN65DSI84, which claims device
active current in the more than 100mA range and ULPS current in the
less than 10mA range.

Considering all known omapdrm DSI users are battery powered devices
caring for saving as much power as possible, it might be good to just
keep this until it is being fixed considering this is very close to
the end of the series anyways?

-- Sebastian

>  drivers/gpu/drm/omapdrm/dss/dsi.c | 297 +-
>  drivers/gpu/drm/omapdrm/dss/dsi.h |   4 -
>  2 files changed, 8 insertions(+), 293 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c 
> b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index cc8b169b2223..b2aa07a09dcd 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -53,8 +53,6 @@
>  #define REG_FLD_MOD(dsi, idx, val, start, end) \
>   dsi_write_reg(dsi, idx, FLD_MOD(dsi_read_reg(dsi, idx), val, start, 
> end))
>  
> -static void dsi_set_ulps_auto(struct dsi_data *dsi, bool enable);
> -
>  static int dsi_init_dispc(struct dsi_data *dsi);
>  static void dsi_uninit_dispc(struct dsi_data *dsi);
>  
> @@ -688,44 +686,6 @@ static int dsi_unregister_isr_vc(struct dsi_data *dsi, 
> int vc,
>   return r;
>  }
>  
> -static int dsi_register_isr_cio(struct dsi_data *dsi, omap_dsi_isr_t isr,
> - void *arg, u32 mask)
> -{
> - unsigned long flags;
> - int r;
> -
> - spin_lock_irqsave(>irq_lock, flags);
> -
> - r = _dsi_register_isr(isr, arg, mask, dsi->isr_tables.isr_table_cio,
> - ARRAY_SIZE(dsi->isr_tables.isr_table_cio));
> -
> - if (r == 0)
> - _omap_dsi_set_irqs_cio(dsi);
> -
> - spin_unlock_irqrestore(>irq_lock, flags);
> -
> - return r;
> -}
> -
> -static int dsi_unregister_isr_cio(struct dsi_data *dsi, omap_dsi_isr_t isr,
> -   void *arg, u32 mask)
> -{
> - unsigned long flags;
> - int r;
> -
> - spin_lock_irqsave(>irq_lock, flags);
> -
> - r = _dsi_unregister_isr(isr, arg, mask, dsi->isr_tables.isr_table_cio,
> - ARRAY_SIZE(dsi->isr_tables.isr_table_cio));
> -
> - if (r == 0)
> - _omap_dsi_set_irqs_cio(dsi);
> -
> - spin_unlock_irqrestore(>irq_lock, flags);
> -
> - return r;
> -}
> -
>  static u32 dsi_get_errors(struct dsi_data *dsi)
>  {
>   unsigned long flags;
> @@ -1450,56 +1410,6 @@ static void dsi_cio_timings(struct dsi_data *dsi)
>   dsi_write_reg(dsi, DSI_DSIPHY_CFG2, r);
>  }
>  
> -/* lane masks have lane 0 at lsb. mask_p for positive lines, n for negative 
> */
> -static void dsi_cio_enable_lane_override(struct dsi_data *dsi,
> -  unsigned int mask_p,
> -  unsigned int mask_n)
> -{
> - int i;
> - u32 l;
> - u8 lptxscp_start = dsi->num_lanes_supported == 3 ? 22 : 26;
> -
> - l = 0;
> -
> - for (i = 0; i < dsi->num_lanes_supported; ++i) {
> - unsigned int p = dsi->lanes[i].polarity;
> -
> - if (mask_p & (1 << i))
> - l |= 1 << (i * 2 + (p ? 0 : 1));
> -
> - if (mask_n & (1 << i))
> - l |= 1 << (i * 2 + (p ? 1 : 0));
> - }
> -
> - /*
> -  * Bits in REGLPTXSCPDAT4TO0DXDY:
> -  * 17: DY0 18: DX0
> -  * 19: DY1 20: DX1
> -  * 21: DY2 22: DX2
> -  * 23: DY3 24: DX3
> -  * 25: DY4 26: DX4
> -  */
> -
> - /* Set the lane override configuration */
> -
> - /* REGLPTXSCPDAT4TO0DXDY */
> - REG_FLD_MOD(dsi, DSI_DSIPHY_CFG10, l, lptxscp_start, 17);
> -
> - /* Enable lane override */
> -
> - /* ENLPTXSCPDAT */
> - REG_FLD_MOD(dsi, DSI_DSIPHY_CFG10, 1, 27, 27);
> -}
> -
> -static void dsi_cio_disable_lane_override(struct dsi_data *dsi)
> -{
> - /* Disable lane override */
> - REG_FLD_MOD(dsi, DSI_DSIPHY_CFG10, 0, 27, 27); /* ENLPTXSCPDAT */
> - /* Reset the lane override configuration */
> - /* REGLPTXSCPDAT4TO0DXDY */
> - REG_FLD_MOD(dsi, DSI_DSIPHY_CFG10, 0, 22, 17);
> -}
> -
>  static int dsi_cio_wait_tx_clk_esc_reset(struct dsi_data *dsi)
>  {
>   int t, i;
> @@ -1674,32 +1584,6 @@ static int dsi_cio_init(struct dsi_data *dsi)
>   l = FLD_MOD(l, 0x1fff, 12, 0);  /* STOP_STATE_COUNTER_IO */
>   dsi_write_reg(dsi, DSI_TIMING1, l);
>  
> - if (dsi->ulps_enabled) {
> - 

Re: [PATCH 8/9] drm: rcar-du: Skip encoder allocation for LVDS1 in dual-link mode

2020-12-14 Thread Kieran Bingham
Hi Laurent,

On 04/12/2020 22:01, Laurent Pinchart wrote:
> The rcar-du driver skips registration of the encoder for the LVDS1
> output when LVDS is used in dual-link mode, as the LVDS0 and LVDS1 links
> are bundled and handled through the LVDS0 output. It however still
> allocates the encoder and immediately destroys it, which is pointless.
> Skip allocation of the encoder altogether in that case.
> 
> Signed-off-by: Laurent Pinchart 

I love it when re-ordering code simplifies all the error conditions.

Reviewed-by: Kieran Bingham 

> ---
>  drivers/gpu/drm/rcar-du/rcar_du_encoder.c | 51 ++-
>  1 file changed, 22 insertions(+), 29 deletions(-)
> 
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_encoder.c 
> b/drivers/gpu/drm/rcar-du/rcar_du_encoder.c
> index e4f35a88d00f..49c0b27e2f5a 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_encoder.c
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_encoder.c
> @@ -65,17 +65,6 @@ int rcar_du_encoder_init(struct rcar_du_device *rcdu,
>   struct drm_bridge *bridge;
>   int ret;
>  
> - renc = kzalloc(sizeof(*renc), GFP_KERNEL);
> - if (renc == NULL)
> - return -ENOMEM;
> -
> - rcdu->encoders[output] = renc;
> - renc->output = output;
> - encoder = rcar_encoder_to_drm_encoder(renc);
> -
> - dev_dbg(rcdu->dev, "initializing encoder %pOF for output %u\n",
> - enc_node, output);
> -
>   /*
>* Locate the DRM bridge from the DT node. For the DPAD outputs, if the
>* DT node has a single port, assume that it describes a panel and
> @@ -86,23 +75,17 @@ int rcar_du_encoder_init(struct rcar_du_device *rcdu,
>   rcar_du_encoder_count_ports(enc_node) == 1) {
>   struct drm_panel *panel = of_drm_find_panel(enc_node);
>  
> - if (IS_ERR(panel)) {
> - ret = PTR_ERR(panel);
> - goto error;
> - }
> + if (IS_ERR(panel))
> + return PTR_ERR(panel);
>  
>   bridge = devm_drm_panel_bridge_add_typed(rcdu->dev, panel,
>
> DRM_MODE_CONNECTOR_DPI);
> - if (IS_ERR(bridge)) {
> - ret = PTR_ERR(bridge);
> - goto error;
> - }
> + if (IS_ERR(bridge))
> + return PTR_ERR(bridge);
>   } else {
>   bridge = of_drm_find_bridge(enc_node);
> - if (!bridge) {
> - ret = -EPROBE_DEFER;
> - goto error;
> - }
> + if (!bridge)
> + return -EPROBE_DEFER;
>  
>   if (output == RCAR_DU_OUTPUT_LVDS0 ||
>   output == RCAR_DU_OUTPUT_LVDS1)
> @@ -110,16 +93,26 @@ int rcar_du_encoder_init(struct rcar_du_device *rcdu,
>   }
>  
>   /*
> -  * On Gen3 skip the LVDS1 output if the LVDS1 encoder is used as a
> -  * companion for LVDS0 in dual-link mode.
> +  * Create and initialize the encoder. On Gen3 skip the LVDS1 output if
> +  * the LVDS1 encoder is used as a companion for LVDS0 in dual-link
> +  * mode.
>*/
>   if (rcdu->info->gen >= 3 && output == RCAR_DU_OUTPUT_LVDS1) {
> - if (rcar_lvds_dual_link(bridge)) {
> - ret = -ENOLINK;
> - goto error;
> - }
> + if (rcar_lvds_dual_link(bridge))
> + return -ENOLINK;
>   }
>  
> + renc = kzalloc(sizeof(*renc), GFP_KERNEL);
> + if (renc == NULL)
> + return -ENOMEM;
> +
> + rcdu->encoders[output] = renc;
> + renc->output = output;
> + encoder = rcar_encoder_to_drm_encoder(renc);
> +
> + dev_dbg(rcdu->dev, "initializing encoder %pOF for output %u\n",
> + enc_node, output);
> +
>   ret = drm_encoder_init(>ddev, encoder, _du_encoder_funcs,
>  DRM_MODE_ENCODER_NONE, NULL);
>   if (ret < 0)
> 

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


Re: [PATCH v5 29/29] drm/omap: dsi: allow DSI commands to be sent early

2020-12-14 Thread Sebastian Reichel
Hi,

On Tue, Dec 08, 2020 at 02:28:55PM +0200, Tomi Valkeinen wrote:
> Panel drivers can send DSI commands in panel's prepare(), which happens
> before the bridge's enable() is called. The OMAP DSI driver currently
> only sets up the DSI interface at bridge's enable(), so prepare() cannot
> be used to send DSI commands.
> 
> This patch fixes the issue by making it possible to enable the DSI
> interface any time a command is about to be sent. Disabling the
> interface is be done via delayed work.
> 
> Signed-off-by: Tomi Valkeinen 
> ---

Reviewed-by: Sebastian Reichel 

Would be nice to include the information why locking is ok from your
reply mails to the patch description. It was helpful for reviewing
the patch :)

-- Sebastian

>  drivers/gpu/drm/omapdrm/dss/dsi.c | 49 +++
>  drivers/gpu/drm/omapdrm/dss/dsi.h |  3 ++
>  2 files changed, 47 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c 
> b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index 53a64bc91867..34f665aa9a59 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -3503,6 +3503,9 @@ static void dsi_enable(struct dsi_data *dsi)
>  
>   WARN_ON(!dsi_bus_is_locked(dsi));
>  
> + if (WARN_ON(dsi->iface_enabled))
> + return;
> +
>   mutex_lock(>lock);
>  
>   r = dsi_runtime_get(dsi);
> @@ -3515,6 +3518,8 @@ static void dsi_enable(struct dsi_data *dsi)
>   if (r)
>   goto err_init_dsi;
>  
> + dsi->iface_enabled = true;
> +
>   mutex_unlock(>lock);
>  
>   return;
> @@ -3530,6 +3535,9 @@ static void dsi_disable(struct dsi_data *dsi)
>  {
>   WARN_ON(!dsi_bus_is_locked(dsi));
>  
> + if (WARN_ON(!dsi->iface_enabled))
> + return;
> +
>   mutex_lock(>lock);
>  
>   dsi_sync_vc(dsi, 0);
> @@ -3541,6 +3549,8 @@ static void dsi_disable(struct dsi_data *dsi)
>  
>   dsi_runtime_put(dsi);
>  
> + dsi->iface_enabled = false;
> +
>   mutex_unlock(>lock);
>  }
>  
> @@ -4229,10 +4239,12 @@ static ssize_t omap_dsi_host_transfer(struct 
> mipi_dsi_host *host,
>  
>   dsi_bus_lock(dsi);
>  
> - if (dsi->video_enabled)
> - r = _omap_dsi_host_transfer(dsi, vc, msg);
> - else
> - r = -EIO;
> + if (!dsi->iface_enabled) {
> + dsi_enable(dsi);
> + schedule_delayed_work(>dsi_disable_work, 
> msecs_to_jiffies(2000));
> + }
> +
> + r = _omap_dsi_host_transfer(dsi, vc, msg);
>  
>   dsi_bus_unlock(dsi);
>  
> @@ -4397,6 +4409,14 @@ static int omap_dsi_host_detach(struct mipi_dsi_host 
> *host,
>   if (WARN_ON(dsi->dsidev != client))
>   return -EINVAL;
>  
> + cancel_delayed_work_sync(>dsi_disable_work);
> +
> + if (dsi->iface_enabled) {
> + dsi_bus_lock(dsi);
> + dsi_disable(dsi);
> + dsi_bus_unlock(dsi);
> + }
> +
>   omap_dsi_unregister_te_irq(dsi);
>   dsi->dsidev = NULL;
>   return 0;
> @@ -4632,9 +4652,12 @@ static void dsi_bridge_enable(struct drm_bridge 
> *bridge)
>   struct dsi_data *dsi = drm_bridge_to_dsi(bridge);
>   struct omap_dss_device *dssdev = >output;
>  
> + cancel_delayed_work_sync(>dsi_disable_work);
> +
>   dsi_bus_lock(dsi);
>  
> - dsi_enable(dsi);
> + if (!dsi->iface_enabled)
> + dsi_enable(dsi);
>  
>   dsi_enable_video_output(dssdev, VC_VIDEO);
>  
> @@ -4648,6 +4671,8 @@ static void dsi_bridge_disable(struct drm_bridge 
> *bridge)
>   struct dsi_data *dsi = drm_bridge_to_dsi(bridge);
>   struct omap_dss_device *dssdev = >output;
>  
> + cancel_delayed_work_sync(>dsi_disable_work);
> +
>   dsi_bus_lock(dsi);
>  
>   dsi->video_enabled = false;
> @@ -4840,6 +4865,18 @@ static const struct soc_device_attribute 
> dsi_soc_devices[] = {
>   { /* sentinel */ }
>  };
>  
> +static void omap_dsi_disable_work_callback(struct work_struct *work)
> +{
> + struct dsi_data *dsi = container_of(work, struct dsi_data, 
> dsi_disable_work.work);
> +
> + dsi_bus_lock(dsi);
> +
> + if (dsi->iface_enabled && !dsi->video_enabled)
> + dsi_disable(dsi);
> +
> + dsi_bus_unlock(dsi);
> +}
> +
>  static int dsi_probe(struct platform_device *pdev)
>  {
>   const struct soc_device_attribute *soc;
> @@ -4873,6 +4910,8 @@ static int dsi_probe(struct platform_device *pdev)
>   INIT_DEFERRABLE_WORK(>framedone_timeout_work,
>dsi_framedone_timeout_work_callback);
>  
> + INIT_DEFERRABLE_WORK(>dsi_disable_work, 
> omap_dsi_disable_work_callback);
> +
>  #ifdef DSI_CATCH_MISSING_TE
>   timer_setup(>te_timer, dsi_te_timeout, 0);
>  #endif
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.h 
> b/drivers/gpu/drm/omapdrm/dss/dsi.h
> index de9411067ba2..601707c0ecc4 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.h
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.h
> @@ -394,6 +394,7 @@ struct dsi_data {
>   atomic_t 

Re: [PATCH 9/9] drm: rcar-du: Drop local encoder variable

2020-12-14 Thread Kieran Bingham
Hi Laurent,

On 04/12/2020 22:01, Laurent Pinchart wrote:
> The local encoder variable is an alias for >base, and is only use
> twice. It doesn't help much, drop it, along with the
> rcar_encoder_to_drm_encoder() macro that is then unused.

It does seem overkill to have a macro for only a single (variable
instantiation) usage, so this makes sense.

And now there's 4 lines less code ... That's always a win :-D

Reviewed-by: Kieran Bingham 


> Signed-off-by: Laurent Pinchart 
> ---
>  drivers/gpu/drm/rcar-du/rcar_du_encoder.c | 6 ++
>  drivers/gpu/drm/rcar-du/rcar_du_encoder.h | 2 --
>  2 files changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_encoder.c 
> b/drivers/gpu/drm/rcar-du/rcar_du_encoder.c
> index 49c0b27e2f5a..9a565bd3380d 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_encoder.c
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_encoder.c
> @@ -61,7 +61,6 @@ int rcar_du_encoder_init(struct rcar_du_device *rcdu,
>struct device_node *enc_node)
>  {
>   struct rcar_du_encoder *renc;
> - struct drm_encoder *encoder;
>   struct drm_bridge *bridge;
>   int ret;
>  
> @@ -108,12 +107,11 @@ int rcar_du_encoder_init(struct rcar_du_device *rcdu,
>  
>   rcdu->encoders[output] = renc;
>   renc->output = output;
> - encoder = rcar_encoder_to_drm_encoder(renc);
>  
>   dev_dbg(rcdu->dev, "initializing encoder %pOF for output %u\n",
>   enc_node, output);
>  
> - ret = drm_encoder_init(>ddev, encoder, _du_encoder_funcs,
> + ret = drm_encoder_init(>ddev, >base, _du_encoder_funcs,
>  DRM_MODE_ENCODER_NONE, NULL);
>   if (ret < 0)
>   goto error;
> @@ -127,7 +125,7 @@ int rcar_du_encoder_init(struct rcar_du_device *rcdu,
>* Attach the bridge to the encoder. The bridge will create the
>* connector.
>*/
> - return drm_bridge_attach(encoder, bridge, NULL, 0);
> + return drm_bridge_attach(>base, bridge, NULL, 0);
>  
>  error:
>   kfree(renc);
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_encoder.h 
> b/drivers/gpu/drm/rcar-du/rcar_du_encoder.h
> index df9be4524301..73560563fb31 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_encoder.h
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_encoder.h
> @@ -22,8 +22,6 @@ struct rcar_du_encoder {
>  #define to_rcar_encoder(e) \
>   container_of(e, struct rcar_du_encoder, base)
>  
> -#define rcar_encoder_to_drm_encoder(e)   (&(e)->base)
> -
>  int rcar_du_encoder_init(struct rcar_du_device *rcdu,
>enum rcar_du_output output,
>struct device_node *enc_node);
> 

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


[PATCH] dma-buf: begin/end_cpu might lock the dma_resv lock

2020-12-14 Thread Daniel Vetter
At least amdgpu and i915 do, so lets just document this as the rule.

v2: Works better with less typos (intel-gfx-ci)

Signed-off-by: Daniel Vetter 
Cc: Thomas Zimmermann 
Cc: Sumit Semwal 
Cc: "Christian König" 
Cc: linux-me...@vger.kernel.org
Cc: linaro-mm-...@lists.linaro.org
---
 drivers/dma-buf/dma-buf.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c
index e1fa6c6f02c4..a0a02ef888da 100644
--- a/drivers/dma-buf/dma-buf.c
+++ b/drivers/dma-buf/dma-buf.c
@@ -1118,6 +1118,8 @@ int dma_buf_begin_cpu_access(struct dma_buf *dmabuf,
if (WARN_ON(!dmabuf))
return -EINVAL;
 
+   might_lock(>resv->lock.base);
+
if (dmabuf->ops->begin_cpu_access)
ret = dmabuf->ops->begin_cpu_access(dmabuf, direction);
 
@@ -1151,6 +1153,8 @@ int dma_buf_end_cpu_access(struct dma_buf *dmabuf,
 
WARN_ON(!dmabuf);
 
+   might_lock(>resv->lock.base);
+
if (dmabuf->ops->end_cpu_access)
ret = dmabuf->ops->end_cpu_access(dmabuf, direction);
 
-- 
2.29.2

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


Re: [PATCH 7/9] drm: rcar-du: Replace dev_private with container_of

2020-12-14 Thread Kieran Bingham
Hi Laurent,

On 14/12/2020 10:58, Jacopo Mondi wrote:
> Hi Laurent,
> 
> On Sat, Dec 05, 2020 at 12:01:37AM +0200, Laurent Pinchart wrote:
>> Now that drm_device is embedded in rcar_du_device, we can use
>> container_of to get the rcar_du_device pointer from the drm_device,
>> instead of using the drm_device.dev_private field.
>>
>> Signed-off-by: Laurent Pinchart 
> 
> De gustibus non est disputandum


Err ... um ... what he said - whatever that is ... maybe ...

/me checks if google is still working to translate ...

Oh ok ;-)

Well - Yes, I like to_*(from) conversion macros ... so

Reviewed-by: Kieran Bingham 

> 
> Reviewed-by: Jacopo Mondi 
> 
> Thanks
>   j
> 
>> ---
>>  drivers/gpu/drm/rcar-du/rcar_du_drv.c   | 2 --
>>  drivers/gpu/drm/rcar-du/rcar_du_drv.h   | 5 +
>>  drivers/gpu/drm/rcar-du/rcar_du_kms.c   | 8 
>>  drivers/gpu/drm/rcar-du/rcar_du_plane.c | 2 +-
>>  4 files changed, 10 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.c 
>> b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
>> index 4ab99ac49891..d6a8b7899952 100644
>> --- a/drivers/gpu/drm/rcar-du/rcar_du_drv.c
>> +++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
>> @@ -587,8 +587,6 @@ static int rcar_du_probe(struct platform_device *pdev)
>>  return PTR_ERR(rcdu->mmio);
>>
>>  /* DRM/KMS objects */
>> -rcdu->ddev.dev_private = rcdu;
>> -
>>  ret = rcar_du_modeset_init(rcdu);
>>  if (ret < 0) {
>>  if (ret != -EPROBE_DEFER)
>> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.h 
>> b/drivers/gpu/drm/rcar-du/rcar_du_drv.h
>> index e5b6f456357e..98d6bac3f2fa 100644
>> --- a/drivers/gpu/drm/rcar-du/rcar_du_drv.h
>> +++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.h
>> @@ -102,6 +102,11 @@ struct rcar_du_device {
>>  unsigned int vspd1_sink;
>>  };
>>
>> +static inline struct rcar_du_device *to_rcar_du_device(struct drm_device 
>> *dev)
>> +{
>> +return container_of(dev, struct rcar_du_device, ddev);
>> +}
>> +
>>  static inline bool rcar_du_has(struct rcar_du_device *rcdu,
>> unsigned int feature)
>>  {
>> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_kms.c 
>> b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
>> index 57bb0dc22807..d6b71a9361ca 100644
>> --- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c
>> +++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
>> @@ -327,7 +327,7 @@ const struct rcar_du_format_info 
>> *rcar_du_format_info(u32 fourcc)
>>  int rcar_du_dumb_create(struct drm_file *file, struct drm_device *dev,
>>  struct drm_mode_create_dumb *args)
>>  {
>> -struct rcar_du_device *rcdu = dev->dev_private;
>> +struct rcar_du_device *rcdu = to_rcar_du_device(dev);
>>  unsigned int min_pitch = DIV_ROUND_UP(args->width * args->bpp, 8);
>>  unsigned int align;
>>
>> @@ -349,7 +349,7 @@ static struct drm_framebuffer *
>>  rcar_du_fb_create(struct drm_device *dev, struct drm_file *file_priv,
>>const struct drm_mode_fb_cmd2 *mode_cmd)
>>  {
>> -struct rcar_du_device *rcdu = dev->dev_private;
>> +struct rcar_du_device *rcdu = to_rcar_du_device(dev);
>>  const struct rcar_du_format_info *format;
>>  unsigned int chroma_pitch;
>>  unsigned int max_pitch;
>> @@ -421,7 +421,7 @@ rcar_du_fb_create(struct drm_device *dev, struct 
>> drm_file *file_priv,
>>  static int rcar_du_atomic_check(struct drm_device *dev,
>>  struct drm_atomic_state *state)
>>  {
>> -struct rcar_du_device *rcdu = dev->dev_private;
>> +struct rcar_du_device *rcdu = to_rcar_du_device(dev);
>>  int ret;
>>
>>  ret = drm_atomic_helper_check(dev, state);
>> @@ -437,7 +437,7 @@ static int rcar_du_atomic_check(struct drm_device *dev,
>>  static void rcar_du_atomic_commit_tail(struct drm_atomic_state *old_state)
>>  {
>>  struct drm_device *dev = old_state->dev;
>> -struct rcar_du_device *rcdu = dev->dev_private;
>> +struct rcar_du_device *rcdu = to_rcar_du_device(dev);
>>  struct drm_crtc_state *crtc_state;
>>  struct drm_crtc *crtc;
>>  unsigned int i;
>> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_plane.c 
>> b/drivers/gpu/drm/rcar-du/rcar_du_plane.c
>> index 5f69ff4502c1..02e5f11f38eb 100644
>> --- a/drivers/gpu/drm/rcar-du/rcar_du_plane.c
>> +++ b/drivers/gpu/drm/rcar-du/rcar_du_plane.c
>> @@ -128,7 +128,7 @@ static int rcar_du_plane_hwalloc(struct rcar_du_plane 
>> *plane,
>>  int rcar_du_atomic_check_planes(struct drm_device *dev,
>>  struct drm_atomic_state *state)
>>  {
>> -struct rcar_du_device *rcdu = dev->dev_private;
>> +struct rcar_du_device *rcdu = to_rcar_du_device(dev);
>>  unsigned int group_freed_planes[RCAR_DU_MAX_GROUPS] = { 0, };
>>  unsigned int group_free_planes[RCAR_DU_MAX_GROUPS] = { 0, };
>>  bool needs_realloc = false;
>> --
>> Regards,
>>
>> Laurent Pinchart
>>

-- 
Regards
--
Kieran
___
dri-devel mailing list

Re: [PATCH v4 1/2] drm: automatic legacy gamma support

2020-12-14 Thread Tomi Valkeinen
On 11/12/2020 13:50, Laurent Pinchart wrote:
> Hi Tomi,
> 
> Thank you for the patch.
> 
> On Fri, Dec 11, 2020 at 01:42:36PM +0200, Tomi Valkeinen wrote:
>> To support legacy gamma ioctls the drivers need to set
>> drm_crtc_funcs.gamma_set either to a custom implementation or to
>> drm_atomic_helper_legacy_gamma_set. Most of the atomic drivers do the
>> latter.
>>
>> We can simplify this by making the core handle it automatically.
>>
>> Move the drm_atomic_helper_legacy_gamma_set() functionality into
>> drm_color_mgmt.c to make drm_mode_gamma_set_ioctl() use
>> drm_crtc_funcs.gamma_set if set or GAMMA_LUT property if not.
>>
>> Signed-off-by: Tomi Valkeinen 
> 
> Reviewed-by: Laurent Pinchart 

Thanks Laurent! If there are no objections, I'd like to push these to 
drm-misc-next tomorrow (along
with the omapdrm gamma + CTM patches).

 Tomi

-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 6/9] drm: rcar-du: Embed drm_device in rcar_du_device

2020-12-14 Thread Kieran Bingham
Hi Laurent,

On 04/12/2020 22:01, Laurent Pinchart wrote:
> Embedding drm_device in rcar_du_device allows usage of the DRM managed
> API to allocate both structures in one go, simplifying error handling.

No point making multiple allocations unnecessarily...

LGTM.

Reviewed-by: Kieran Bingham 


> Signed-off-by: Laurent Pinchart 
> ---
>  drivers/gpu/drm/rcar-du/rcar_du_crtc.c  |  2 +-
>  drivers/gpu/drm/rcar-du/rcar_du_drv.c   | 33 +
>  drivers/gpu/drm/rcar-du/rcar_du_drv.h   |  5 ++--
>  drivers/gpu/drm/rcar-du/rcar_du_encoder.c   |  4 +--
>  drivers/gpu/drm/rcar-du/rcar_du_kms.c   |  4 +--
>  drivers/gpu/drm/rcar-du/rcar_du_plane.c |  6 ++--
>  drivers/gpu/drm/rcar-du/rcar_du_vsp.c   |  6 ++--
>  drivers/gpu/drm/rcar-du/rcar_du_writeback.c |  2 +-
>  8 files changed, 29 insertions(+), 33 deletions(-)
> 
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c 
> b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
> index e23b9c7b4afe..9a099c0fe1d4 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
> @@ -1251,7 +1251,7 @@ int rcar_du_crtc_create(struct rcar_du_group *rgrp, 
> unsigned int swindex,
>   else
>   primary = >planes[swindex % 2].plane;
>  
> - ret = drm_crtc_init_with_planes(rcdu->ddev, crtc, primary, NULL,
> + ret = drm_crtc_init_with_planes(>ddev, crtc, primary, NULL,
>   rcdu->info->gen <= 2 ?
>   _funcs_gen2 : _funcs_gen3,
>   NULL);
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.c 
> b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
> index 1490ec182646..4ab99ac49891 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_drv.c
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
> @@ -18,10 +18,11 @@
>  #include 
>  
>  #include 
> +#include 
>  #include 
>  #include 
> -#include 
>  #include 
> +#include 
>  #include 
>  
>  #include "rcar_du_drv.h"
> @@ -529,14 +530,14 @@ static int rcar_du_pm_suspend(struct device *dev)
>  {
>   struct rcar_du_device *rcdu = dev_get_drvdata(dev);
>  
> - return drm_mode_config_helper_suspend(rcdu->ddev);
> + return drm_mode_config_helper_suspend(>ddev);
>  }
>  
>  static int rcar_du_pm_resume(struct device *dev)
>  {
>   struct rcar_du_device *rcdu = dev_get_drvdata(dev);
>  
> - return drm_mode_config_helper_resume(rcdu->ddev);
> + return drm_mode_config_helper_resume(>ddev);
>  }
>  #endif
>  
> @@ -551,7 +552,7 @@ static const struct dev_pm_ops rcar_du_pm_ops = {
>  static int rcar_du_remove(struct platform_device *pdev)
>  {
>   struct rcar_du_device *rcdu = platform_get_drvdata(pdev);
> - struct drm_device *ddev = rcdu->ddev;
> + struct drm_device *ddev = >ddev;
>  
>   drm_dev_unregister(ddev);
>  
> @@ -565,14 +566,14 @@ static int rcar_du_remove(struct platform_device *pdev)
>  static int rcar_du_probe(struct platform_device *pdev)
>  {
>   struct rcar_du_device *rcdu;
> - struct drm_device *ddev;
>   struct resource *mem;
>   int ret;
>  
>   /* Allocate and initialize the R-Car device structure. */
> - rcdu = devm_kzalloc(>dev, sizeof(*rcdu), GFP_KERNEL);
> - if (rcdu == NULL)
> - return -ENOMEM;
> + rcdu = devm_drm_dev_alloc(>dev, _du_driver,
> +   struct rcar_du_device, ddev);
> + if (IS_ERR(rcdu))
> + return PTR_ERR(rcdu);
>  
>   rcdu->dev = >dev;
>   rcdu->info = of_device_get_match_data(rcdu->dev);
> @@ -586,12 +587,7 @@ static int rcar_du_probe(struct platform_device *pdev)
>   return PTR_ERR(rcdu->mmio);
>  
>   /* DRM/KMS objects */
> - ddev = drm_dev_alloc(_du_driver, >dev);
> - if (IS_ERR(ddev))
> - return PTR_ERR(ddev);
> -
> - rcdu->ddev = ddev;
> - ddev->dev_private = rcdu;
> + rcdu->ddev.dev_private = rcdu;
>  
>   ret = rcar_du_modeset_init(rcdu);
>   if (ret < 0) {
> @@ -601,25 +597,24 @@ static int rcar_du_probe(struct platform_device *pdev)
>   goto error;
>   }
>  
> - ddev->irq_enabled = 1;
> + rcdu->ddev.irq_enabled = 1;
>  
>   /*
>* Register the DRM device with the core and the connectors with
>* sysfs.
>*/
> - ret = drm_dev_register(ddev, 0);
> + ret = drm_dev_register(>ddev, 0);
>   if (ret)
>   goto error;
>  
>   DRM_INFO("Device %s probed\n", dev_name(>dev));
>  
> - drm_fbdev_generic_setup(ddev, 32);
> + drm_fbdev_generic_setup(>ddev, 32);
>  
>   return 0;
>  
>  error:
> - rcar_du_remove(pdev);
> -
> + drm_kms_helper_poll_fini(>ddev);
>   return ret;
>  }
>  
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.h 
> b/drivers/gpu/drm/rcar-du/rcar_du_drv.h
> index 71732fc5df8f..e5b6f456357e 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_drv.h
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.h
> @@ -13,6 +13,8 @@
>  #include 
>  #include 

Re: [PATCH] drm/ttm: cleanup BO size handling v3

2020-12-14 Thread Daniel Vetter
I think you forgot to compile test with amdkfd :-)

drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c: In function ‘add_bo_to_vm’:
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c:456:37: error:
‘struct ttm_resource’ has no member named ‘size’
 456 |  unsigned long bo_size = bo->tbo.mem.size;
 | ^
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c: In function
‘amdgpu_amdkfd_gpuvm_free_memory_of_gpu’:
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c:1284:42: error:
‘struct ttm_resource’ has no member named ‘size’
1284 |  unsigned long bo_size = mem->bo->tbo.mem.size;
 |  ^
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c: In function
‘amdgpu_amdkfd_gpuvm_map_memory_to_gpu’:
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c:1405:23: error:
‘struct ttm_resource’ has no member named ‘size’
1405 |  bo_size = bo->tbo.mem.size;
 |   ^
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c: In function
‘amdgpu_amdkfd_gpuvm_unmap_memory_from_gpu’:
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c:1509:42: error:
‘struct ttm_resource’ has no member named ‘size’
1509 |  unsigned long bo_size = mem->bo->tbo.mem.size;
 |  ^
Also we really need gitlab CI to stop this kind of stuff ...
-Daniel

On Thu, Dec 10, 2020 at 3:52 PM Christian König
 wrote:
>
> Based on an idea from Dave, but cleaned up a bit.
>
> We had multiple fields for essentially the same thing.
>
> Now bo->base.size is the original size of the BO in
> arbitrary units, usually bytes.
>
> bo->mem.num_pages is the size in number of pages in the
> resource domain of bo->mem.mem_type.
>
> v2: use the GEM object size instead of the BO size
> v3: fix printks in some places
>
> Signed-off-by: Christian König 
> Reviewed-by: Huang Rui  (v1)
> Acked-by: Daniel Vetter 
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c   |  2 +-
>  drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c   |  2 +-
>  drivers/gpu/drm/amd/amdgpu/amdgpu_object.c|  2 +-
>  drivers/gpu/drm/amd/amdgpu/amdgpu_object.h|  4 +--
>  drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h |  2 +-
>  drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c   |  6 ++--
>  drivers/gpu/drm/amd/amdgpu/mes_v10_1.c|  2 +-
>  drivers/gpu/drm/nouveau/nouveau_bo.c  | 10 +++---
>  drivers/gpu/drm/nouveau/nouveau_display.c |  8 ++---
>  drivers/gpu/drm/nouveau/nouveau_prime.c   |  4 +--
>  drivers/gpu/drm/nouveau/nv17_fence.c  |  2 +-
>  drivers/gpu/drm/nouveau/nv50_fence.c  |  2 +-
>  drivers/gpu/drm/qxl/qxl_object.h  |  2 +-
>  drivers/gpu/drm/radeon/radeon_cs.c|  3 +-
>  drivers/gpu/drm/radeon/radeon_object.c| 13 ---
>  drivers/gpu/drm/radeon/radeon_object.h|  4 +--
>  drivers/gpu/drm/radeon/radeon_prime.c |  4 +--
>  drivers/gpu/drm/radeon/radeon_trace.h |  2 +-
>  drivers/gpu/drm/radeon/radeon_ttm.c   |  2 +-
>  drivers/gpu/drm/ttm/ttm_bo.c  | 35 ++-
>  drivers/gpu/drm/ttm/ttm_bo_util.c | 12 +++
>  drivers/gpu/drm/ttm/ttm_bo_vm.c   |  6 ++--
>  drivers/gpu/drm/ttm/ttm_tt.c  |  2 +-
>  drivers/gpu/drm/vmwgfx/vmwgfx_blit.c  |  4 +--
>  drivers/gpu/drm/vmwgfx/vmwgfx_bo.c|  6 ++--
>  drivers/gpu/drm/vmwgfx/vmwgfx_cotable.c   |  2 +-
>  drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c   |  4 +--
>  drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c |  5 ++-
>  drivers/gpu/drm/vmwgfx/vmwgfx_kms.c   |  2 +-
>  drivers/gpu/drm/vmwgfx/vmwgfx_page_dirty.c|  8 ++---
>  drivers/gpu/drm/vmwgfx/vmwgfx_resource.c  |  2 +-
>  drivers/gpu/drm/vmwgfx/vmwgfx_shader.c|  3 +-
>  drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c  |  4 +--
>  drivers/gpu/drm/vmwgfx/vmwgfx_surface.c   |  7 ++--
>  include/drm/ttm/ttm_bo_api.h  |  9 ++---
>  include/drm/ttm/ttm_resource.h|  1 -
>  36 files changed, 84 insertions(+), 104 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c
> index e5919efca870..c4c93f19d273 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c
> @@ -269,7 +269,7 @@ static struct sg_table *amdgpu_dma_buf_map(struct 
> dma_buf_attachment *attach,
> case TTM_PL_TT:
> sgt = drm_prime_pages_to_sg(obj->dev,
> bo->tbo.ttm->pages,
> -   bo->tbo.num_pages);
> +   bo->tbo.ttm->num_pages);
> if (IS_ERR(sgt))
> return sgt;
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
> index 056cb87d09ea..52bcd1b5582f 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
> +++ 

Re: [PATCH v5 28/29] drm/omap: dsi: fix DCS_CMD_ENABLE

2020-12-14 Thread Sebastian Reichel
Hi,

On Tue, Dec 08, 2020 at 02:28:54PM +0200, Tomi Valkeinen wrote:
> We only need to set VC_CTRL:DCS_CMD_ENABLE for command mode panels when
> the HW has DSI_QUIRK_DCS_CMD_CONFIG_VC quirk. The old code did this
> right by accident, but now we set DCS_CMD_ENABLE for video mode panels
> too.
> 
> Fix this by skipping the set for video mode.
> 
> Signed-off-by: Tomi Valkeinen 
> Reviewed-by: Laurent Pinchart 
> ---

Reviewed-by: Sebastian Reichel 

-- Sebastian

>  drivers/gpu/drm/omapdrm/dss/dsi.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c 
> b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index b2aa07a09dcd..53a64bc91867 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -3406,7 +3406,8 @@ static void dsi_setup_dsi_vcs(struct dsi_data *dsi)
>   REG_FLD_MOD(dsi, DSI_VC_CTRL(VC_VIDEO), 1, 1, 1); /* SOURCE_VP */
>   dsi->vc[VC_VIDEO].source = DSI_VC_SOURCE_VP;
>  
> - if (dsi->data->quirks & DSI_QUIRK_DCS_CMD_CONFIG_VC)
> + if ((dsi->data->quirks & DSI_QUIRK_DCS_CMD_CONFIG_VC) &&
> + !(dsi->dsidev->mode_flags & MIPI_DSI_MODE_VIDEO))
>   REG_FLD_MOD(dsi, DSI_VC_CTRL(VC_VIDEO), 1, 30, 30); /* 
> DCS_CMD_ENABLE */
>  
>   dsi_vc_enable(dsi, VC_CMD, 1);
> -- 
> Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
> Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
> 


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


Re: [PATCH v5 26/29] drm/omap: dsi: fix and cleanup ddr_clk_always_on

2020-12-14 Thread Sebastian Reichel
Hi,

On Tue, Dec 08, 2020 at 02:28:52PM +0200, Tomi Valkeinen wrote:
> The driver ignores MIPI_DSI_CLOCK_NON_CONTINUOUS, and always uses
> non-continuous clock.
> 
> Fix this by using MIPI_DSI_CLOCK_NON_CONTINUOUS and at the same time,
> drop ddr_clk_always_on field which seems pretty useless.
> 
> Signed-off-by: Tomi Valkeinen 
> Reviewed-by: Laurent Pinchart 
> ---

Reviewed-by: Sebastian Reichel 

-- Sebastian

>  drivers/gpu/drm/omapdrm/dss/dsi.c | 12 +---
>  drivers/gpu/drm/omapdrm/dss/dsi.h |  2 --
>  2 files changed, 5 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c 
> b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index 71de6119d2de..cc8b169b2223 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -1734,11 +1734,10 @@ static int dsi_cio_init(struct dsi_data *dsi)
>  
>   dsi_cio_timings(dsi);
>  
> - if (dsi->mode == OMAP_DSS_DSI_VIDEO_MODE) {
> - /* DDR_CLK_ALWAYS_ON */
> - REG_FLD_MOD(dsi, DSI_CLK_CTRL,
> - dsi->vm_timings.ddr_clk_always_on, 13, 13);
> - }
> + /* DDR_CLK_ALWAYS_ON */
> + REG_FLD_MOD(dsi, DSI_CLK_CTRL,
> + !(dsi->dsidev->mode_flags & MIPI_DSI_CLOCK_NON_CONTINUOUS),
> + 13, 13);
>  
>   dsi->ulps_enabled = false;
>  
> @@ -3646,7 +3645,7 @@ static void dsi_setup_dsi_vcs(struct dsi_data *dsi)
>   dsi_force_tx_stop_mode_io(dsi);
>  
>   /* start the DDR clock by sending a NULL packet */
> - if (dsi->vm_timings.ddr_clk_always_on)
> + if (!(dsi->dsidev->mode_flags & MIPI_DSI_CLOCK_NON_CONTINUOUS))
>   dsi_vc_send_null(dsi, VC_CMD, dsi->dsidev->channel);
>  }
>  
> @@ -4155,7 +4154,6 @@ static bool dsi_vm_calc_blanking(struct 
> dsi_clk_calc_ctx *ctx)
>   dsi_vm->hfp_blanking_mode = 1;
>   dsi_vm->hbp_blanking_mode = 1;
>  
> - dsi_vm->ddr_clk_always_on = cfg->ddr_clk_always_on;
>   dsi_vm->window_sync = 4;
>  
>   /* setup DISPC videomode */
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.h 
> b/drivers/gpu/drm/omapdrm/dss/dsi.h
> index 478fc10bd18d..476069fda082 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.h
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.h
> @@ -212,7 +212,6 @@ struct omap_dss_dsi_videomode_timings {
>  
>   enum omap_dss_dsi_trans_mode trans_mode;
>  
> - bool ddr_clk_always_on;
>   int window_sync;
>  };
>  
> @@ -224,7 +223,6 @@ struct omap_dss_dsi_config {
>   unsigned long hs_clk_min, hs_clk_max;
>   unsigned long lp_clk_min, lp_clk_max;
>  
> - bool ddr_clk_always_on;
>   enum omap_dss_dsi_trans_mode trans_mode;
>  };
>  
> -- 
> Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
> Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
> 


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


Re: [PATCH v5 25/29] drm/omap: dsi: split video mode enable/disable into separate func

2020-12-14 Thread Sebastian Reichel
Hi,

On Tue, Dec 08, 2020 at 02:28:51PM +0200, Tomi Valkeinen wrote:
> Clean up the code by separating video-mode enable/disable code into
> functions of their own.
> 
> Signed-off-by: Tomi Valkeinen 
> Reviewed-by: Laurent Pinchart 
> ---

Reviewed-by: Sebastian Reichel 

-- Sebastian

>  drivers/gpu/drm/omapdrm/dss/dsi.c | 101 +-
>  1 file changed, 57 insertions(+), 44 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c 
> b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index c32884f167b8..71de6119d2de 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -3207,12 +3207,61 @@ static int dsi_configure_pins(struct dsi_data *dsi,
>   return 0;
>  }
>  
> -static void dsi_enable_video_output(struct omap_dss_device *dssdev, int vc)
> +static int dsi_enable_video_mode(struct dsi_data *dsi, int vc)
>  {
> - struct dsi_data *dsi = to_dsi_data(dssdev);
>   int bpp = mipi_dsi_pixel_format_to_bpp(dsi->pix_fmt);
>   u8 data_type;
>   u16 word_count;
> +
> + switch (dsi->pix_fmt) {
> + case MIPI_DSI_FMT_RGB888:
> + data_type = MIPI_DSI_PACKED_PIXEL_STREAM_24;
> + break;
> + case MIPI_DSI_FMT_RGB666:
> + data_type = MIPI_DSI_PIXEL_STREAM_3BYTE_18;
> + break;
> + case MIPI_DSI_FMT_RGB666_PACKED:
> + data_type = MIPI_DSI_PACKED_PIXEL_STREAM_18;
> + break;
> + case MIPI_DSI_FMT_RGB565:
> + data_type = MIPI_DSI_PACKED_PIXEL_STREAM_16;
> + break;
> + default:
> + return -EINVAL;
> + }
> +
> + dsi_if_enable(dsi, false);
> + dsi_vc_enable(dsi, vc, false);
> +
> + /* MODE, 1 = video mode */
> + REG_FLD_MOD(dsi, DSI_VC_CTRL(vc), 1, 4, 4);
> +
> + word_count = DIV_ROUND_UP(dsi->vm.hactive * bpp, 8);
> +
> + dsi_vc_write_long_header(dsi, vc, dsi->dsidev->channel, data_type,
> + word_count, 0);
> +
> + dsi_vc_enable(dsi, vc, true);
> + dsi_if_enable(dsi, true);
> +
> + return 0;
> +}
> +
> +static void dsi_disable_video_mode(struct dsi_data *dsi, int vc)
> +{
> + dsi_if_enable(dsi, false);
> + dsi_vc_enable(dsi, vc, false);
> +
> + /* MODE, 0 = command mode */
> + REG_FLD_MOD(dsi, DSI_VC_CTRL(vc), 0, 4, 4);
> +
> + dsi_vc_enable(dsi, vc, true);
> + dsi_if_enable(dsi, true);
> +}
> +
> +static void dsi_enable_video_output(struct omap_dss_device *dssdev, int vc)
> +{
> + struct dsi_data *dsi = to_dsi_data(dssdev);
>   int r;
>  
>   r = dsi_init_dispc(dsi);
> @@ -3222,37 +3271,9 @@ static void dsi_enable_video_output(struct 
> omap_dss_device *dssdev, int vc)
>   }
>  
>   if (dsi->mode == OMAP_DSS_DSI_VIDEO_MODE) {
> - switch (dsi->pix_fmt) {
> - case MIPI_DSI_FMT_RGB888:
> - data_type = MIPI_DSI_PACKED_PIXEL_STREAM_24;
> - break;
> - case MIPI_DSI_FMT_RGB666:
> - data_type = MIPI_DSI_PIXEL_STREAM_3BYTE_18;
> - break;
> - case MIPI_DSI_FMT_RGB666_PACKED:
> - data_type = MIPI_DSI_PACKED_PIXEL_STREAM_18;
> - break;
> - case MIPI_DSI_FMT_RGB565:
> - data_type = MIPI_DSI_PACKED_PIXEL_STREAM_16;
> - break;
> - default:
> - r = -EINVAL;
> - goto err_pix_fmt;
> - }
> -
> - dsi_if_enable(dsi, false);
> - dsi_vc_enable(dsi, vc, false);
> -
> - /* MODE, 1 = video mode */
> - REG_FLD_MOD(dsi, DSI_VC_CTRL(vc), 1, 4, 4);
> -
> - word_count = DIV_ROUND_UP(dsi->vm.hactive * bpp, 8);
> -
> - dsi_vc_write_long_header(dsi, vc, dsi->dsidev->channel, 
> data_type,
> - word_count, 0);
> -
> - dsi_vc_enable(dsi, vc, true);
> - dsi_if_enable(dsi, true);
> + r = dsi_enable_video_mode(dsi, vc);
> + if (r)
> + goto err_video_mode;
>   }
>  
>   r = dss_mgr_enable(>output);
> @@ -3266,7 +3287,7 @@ static void dsi_enable_video_output(struct 
> omap_dss_device *dssdev, int vc)
>   dsi_if_enable(dsi, false);
>   dsi_vc_enable(dsi, vc, false);
>   }
> -err_pix_fmt:
> +err_video_mode:
>   dsi_uninit_dispc(dsi);
>   dev_err(dsi->dev, "failed to enable DSI encoder!\n");
>   return;
> @@ -3276,16 +3297,8 @@ static void dsi_disable_video_output(struct 
> omap_dss_device *dssdev, int vc)
>  {
>   struct dsi_data *dsi = to_dsi_data(dssdev);
>  
> - if (dsi->mode == OMAP_DSS_DSI_VIDEO_MODE) {
> - dsi_if_enable(dsi, false);
> - dsi_vc_enable(dsi, vc, false);
> -
> - /* MODE, 0 = command mode */
> - REG_FLD_MOD(dsi, DSI_VC_CTRL(vc), 0, 4, 4);
> -
> - dsi_vc_enable(dsi, vc, true);
> -

Re: [PATCH v5 24/29] drm/omap: dsi: cleanup initial vc setup

2020-12-14 Thread Sebastian Reichel
Hi,

On Tue, Dec 08, 2020 at 02:28:50PM +0200, Tomi Valkeinen wrote:
> As we now have a fixed setup for VCs (VC0 for video stream, VC1 for
> commands), we can simplify the VC setup.
> 
> Signed-off-by: Tomi Valkeinen 
> ---

Reviewed-by: Sebastian Reichel 

-- Sebastian

>  drivers/gpu/drm/omapdrm/dss/dsi.c | 85 +++
>  1 file changed, 31 insertions(+), 54 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c 
> b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index d9c2cd849328..c32884f167b8 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -2017,40 +2017,6 @@ static void dsi_vc_initial_config(struct dsi_data 
> *dsi, int vc)
>   dsi->vc[vc].source = DSI_VC_SOURCE_L4;
>  }
>  
> -static int dsi_vc_config_source(struct dsi_data *dsi, int vc,
> - enum dsi_vc_source source)
> -{
> - if (dsi->vc[vc].source == source)
> - return 0;
> -
> - DSSDBG("Source config of VC %d", vc);
> -
> - dsi_sync_vc(dsi, vc);
> -
> - dsi_vc_enable(dsi, vc, 0);
> -
> - /* VC_BUSY */
> - if (!wait_for_bit_change(dsi, DSI_VC_CTRL(vc), 15, 0)) {
> - DSSERR("vc(%d) busy when trying to config for VP\n", vc);
> - return -EIO;
> - }
> -
> - /* SOURCE, 0 = L4, 1 = video port */
> - REG_FLD_MOD(dsi, DSI_VC_CTRL(vc), source, 1, 1);
> -
> - /* DCS_CMD_ENABLE */
> - if (dsi->data->quirks & DSI_QUIRK_DCS_CMD_CONFIG_VC) {
> - bool enable = source == DSI_VC_SOURCE_VP;
> - REG_FLD_MOD(dsi, DSI_VC_CTRL(vc), enable, 30, 30);
> - }
> -
> - dsi_vc_enable(dsi, vc, 1);
> -
> - dsi->vc[vc].source = source;
> -
> - return 0;
> -}
> -
>  static void dsi_vc_enable_hs(struct omap_dss_device *dssdev, int vc,
>   bool enable)
>  {
> @@ -2072,10 +2038,6 @@ static void dsi_vc_enable_hs(struct omap_dss_device 
> *dssdev, int vc,
>   dsi_if_enable(dsi, 1);
>  
>   dsi_force_tx_stop_mode_io(dsi);
> -
> - /* start the DDR clock by sending a NULL packet */
> - if (dsi->vm_timings.ddr_clk_always_on && enable)
> - dsi_vc_send_null(dsi, vc, dsi->dsidev->channel);
>  }
>  
>  static void dsi_vc_flush_long_data(struct dsi_data *dsi, int vc)
> @@ -2270,8 +2232,6 @@ static int dsi_vc_send_long(struct dsi_data *dsi, int 
> vc,
>   return -EINVAL;
>   }
>  
> - dsi_vc_config_source(dsi, vc, DSI_VC_SOURCE_L4);
> -
>   dsi_vc_write_long_header(dsi, vc, msg->channel, msg->type, msg->tx_len, 
> 0);
>  
>   p = msg->tx_buf;
> @@ -2331,8 +2291,6 @@ static int dsi_vc_send_short(struct dsi_data *dsi, int 
> vc,
>   DSSDBG("dsi_vc_send_short(ch%d, dt %#x, b1 %#x, b2 %#x)\n",
>  vc, msg->type, pkt.header[1], pkt.header[2]);
>  
> - dsi_vc_config_source(dsi, vc, DSI_VC_SOURCE_L4);
> -
>   if (FLD_GET(dsi_read_reg(dsi, DSI_VC_CTRL(vc)), 16, 16)) {
>   DSSERR("ERROR FIFO FULL, aborting transfer\n");
>   return -EINVAL;
> @@ -3351,8 +3309,6 @@ static void dsi_update_screen_dispc(struct dsi_data 
> *dsi)
>  
>   DSSDBG("dsi_update_screen_dispc(%dx%d)\n", w, h);
>  
> - dsi_vc_config_source(dsi, vc, DSI_VC_SOURCE_VP);
> -
>   bytespp = mipi_dsi_pixel_format_to_bpp(dsi->pix_fmt) / 8;
>   bytespl = w * bytespp;
>   bytespf = bytespl * h;
> @@ -3522,14 +3478,12 @@ static int dsi_update_channel(struct omap_dss_device 
> *dssdev, int vc)
>  
>   dsi_set_ulps_auto(dsi, false);
>  
> - dsi_vc_enable_hs(dssdev, vc, true);
> -
>   /*
>* Send NOP between the frames. If we don't send something here, the
>* updates stop working. This is probably related to DSI spec stating
>* that the DSI host should transition to LP at least once per frame.
>*/
> - r = _dsi_send_nop(dsi, vc, dsi->dsidev->channel);
> + r = _dsi_send_nop(dsi, VC_CMD, dsi->dsidev->channel);
>   if (r < 0) {
>   DSSWARN("failed to send nop between frames: %d\n", r);
>   goto err;
> @@ -3654,6 +3608,35 @@ static int dsi_configure_dsi_clocks(struct dsi_data 
> *dsi)
>   return 0;
>  }
>  
> +static void dsi_setup_dsi_vcs(struct dsi_data *dsi)
> +{
> + /* Setup VC_CMD for LP and cpu transfers */
> + REG_FLD_MOD(dsi, DSI_VC_CTRL(VC_CMD), 0, 9, 9); /* LP */
> +
> + REG_FLD_MOD(dsi, DSI_VC_CTRL(VC_CMD), 0, 1, 1); /* SOURCE_L4 */
> + dsi->vc[VC_CMD].source = DSI_VC_SOURCE_L4;
> +
> + /* Setup VC_VIDEO for HS and dispc transfers */
> + REG_FLD_MOD(dsi, DSI_VC_CTRL(VC_VIDEO), 1, 9, 9); /* HS */
> +
> + REG_FLD_MOD(dsi, DSI_VC_CTRL(VC_VIDEO), 1, 1, 1); /* SOURCE_VP */
> + dsi->vc[VC_VIDEO].source = DSI_VC_SOURCE_VP;
> +
> + if (dsi->data->quirks & DSI_QUIRK_DCS_CMD_CONFIG_VC)
> + REG_FLD_MOD(dsi, DSI_VC_CTRL(VC_VIDEO), 1, 30, 30); /* 
> DCS_CMD_ENABLE */
> +
> + dsi_vc_enable(dsi, VC_CMD, 1);
> + dsi_vc_enable(dsi, VC_VIDEO, 1);
> +
> + 

Re: [PATCH 4/9] drm: rcar-du: Use DRM-managed allocation for VSP planes

2020-12-14 Thread Laurent Pinchart
Hi Kieran,

On Mon, Dec 14, 2020 at 04:20:17PM +, Kieran Bingham wrote:
> On 04/12/2020 22:01, Laurent Pinchart wrote:
> > devm_kcalloc() is the wrong API to allocate planes, as the lifetime of
> > the planes is tied to the DRM device, not the device to driver
> > binding. drmm_kcalloc() isn't a good option either, as it would result
> > in the planes being freed before being unregistered during the managed
> > cleanup of the DRM objects. Use a plain kcalloc(), and cleanup the
> > planes and free the memory in the existing rcar_du_vsp_cleanup()
> > handler.
> 
> Managed memory always seems to hurt - which is a shame, because it
> should be better throughout.
> 
> It's like we need a way to arbitrarily specify the lifetimes of objects
> correctly against another object... without being tied to a dev ...

I've been saying for years that devm_kzalloc() is a major regression.
We've traded a memory leak for a use-after-free. The function has its
use cases, there are objects that need to match the lifetime of the
binding between a device and its driver, but that's a small minority.

> Reviewed-by: Kieran Bingham 
> 
> > 
> > Signed-off-by: Laurent Pinchart 
> > ---
> >  drivers/gpu/drm/rcar-du/rcar_du_vsp.c | 22 +-
> >  1 file changed, 17 insertions(+), 5 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/rcar-du/rcar_du_vsp.c 
> > b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c
> > index 4dcb1bfbe201..78a886651d9f 100644
> > --- a/drivers/gpu/drm/rcar-du/rcar_du_vsp.c
> > +++ b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c
> > @@ -21,6 +21,7 @@
> >  #include 
> >  #include 
> >  #include 
> > +#include 
> >  #include 
> >  
> >  #include 
> > @@ -344,6 +345,15 @@ static const struct drm_plane_funcs 
> > rcar_du_vsp_plane_funcs = {
> >  static void rcar_du_vsp_cleanup(struct drm_device *dev, void *res)
> >  {
> > struct rcar_du_vsp *vsp = res;
> > +   unsigned int i;
> > +
> > +   for (i = 0; i < vsp->num_planes; ++i) {
> > +   struct rcar_du_vsp_plane *plane = >planes[i];
> > +
> > +   drm_plane_cleanup(>plane);
> > +   }
> > +
> > +   kfree(vsp->planes);
> >  
> > put_device(vsp->vsp);
> >  }
> > @@ -354,6 +364,7 @@ int rcar_du_vsp_init(struct rcar_du_vsp *vsp, struct 
> > device_node *np,
> > struct rcar_du_device *rcdu = vsp->dev;
> > struct platform_device *pdev;
> > unsigned int num_crtcs = hweight32(crtcs);
> > +   unsigned int num_planes;
> > unsigned int i;
> > int ret;
> >  
> > @@ -376,14 +387,13 @@ int rcar_du_vsp_init(struct rcar_du_vsp *vsp, struct 
> > device_node *np,
> >   * The VSP2D (Gen3) has 5 RPFs, but the VSP1D (Gen2) is limited to
> >   * 4 RPFs.
> >   */
> > -   vsp->num_planes = rcdu->info->gen >= 3 ? 5 : 4;
> > +   num_planes = rcdu->info->gen >= 3 ? 5 : 4;
> >  
> > -   vsp->planes = devm_kcalloc(rcdu->dev, vsp->num_planes,
> > -  sizeof(*vsp->planes), GFP_KERNEL);
> > +   vsp->planes = kcalloc(num_planes, sizeof(*vsp->planes), GFP_KERNEL);
> > if (!vsp->planes)
> > return -ENOMEM;
> >  
> > -   for (i = 0; i < vsp->num_planes; ++i) {
> > +   for (i = 0; i < num_planes; ++i) {
> > enum drm_plane_type type = i < num_crtcs
> >  ? DRM_PLANE_TYPE_PRIMARY
> >  : DRM_PLANE_TYPE_OVERLAY;
> > @@ -409,8 +419,10 @@ int rcar_du_vsp_init(struct rcar_du_vsp *vsp, struct 
> > device_node *np,
> > } else {
> > drm_plane_create_alpha_property(>plane);
> > drm_plane_create_zpos_property(>plane, 1, 1,
> > -  vsp->num_planes - 1);
> > +  num_planes - 1);
> > }
> > +
> > +   vsp->num_planes++;> }
> >  
> > return 0;
> > 

-- 
Regards,

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


Re: [Intel-gfx] [PATCH 1/2] drm/framebuffer: Format modifier for Intel Gen 12 render compression with Clear Color

2020-12-14 Thread Imre Deak
On Fri, Dec 11, 2020 at 09:04:02AM +0200, Chery, Nanley G wrote:
> [...]
> > > We probably don't have to update the header, but we noticed in our
> > > testing that the clear color prefers an alignment greater than 64B.
> > > Unfortunately, I can't find any bspec note about this. As long as the
> > > buffer creators are aware though, I think we should be fine. I don't
> > > know if this is the best forum to bring it up, but I thought I'd
> > > share.
> > 
> > Yes, would be good to clarify this and get it also to the spec. Then the
> > driver should also check the alignment of the 3rd FB plane.
> 
> I plan to run some more tests and file a bug in the spec.

Ok, thanks. Note that this patch has a problem with synchornization and
based on Chris' response I'm planning to update it once I figured out
the proper way to map the CC plane. Until that you could still use it on
TGL if you wait for the RT result explicitly after the fast clear and
before flipping to it (that's what the IGT test does atm).

> I see that the IGT test only clears the fb once. Just to confirm, is the 
> clear color offset read from on every frame? Userspace would like to be 
> able to pass different clear colors for an fb.

Yes, every time you do a flip the kernel will re-read the CC value and
program it to the display.

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


Re: [PATCH v5 23/29] drm/omap: dsi: rename dsi_display_* functions

2020-12-14 Thread Sebastian Reichel
Hi,

On Tue, Dec 08, 2020 at 02:28:49PM +0200, Tomi Valkeinen wrote:
> The function names have evolved to be very confusing, and bunch of them
> have "display" in them even if the function doesn't deal with display as
> such (e.g. dsi_display_enable which just enables the DSI interface).
> Rename them by dropping the "display".
> 
> Signed-off-by: Tomi Valkeinen 
> Reviewed-by: Laurent Pinchart 
> ---

Reviewed-by: Sebastian Reichel 

-- Sebastian

>  drivers/gpu/drm/omapdrm/dss/dsi.c | 36 +++
>  1 file changed, 18 insertions(+), 18 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c 
> b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index d83346812810..d9c2cd849328 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -55,8 +55,8 @@
>  
>  static void dsi_set_ulps_auto(struct dsi_data *dsi, bool enable);
>  
> -static int dsi_display_init_dispc(struct dsi_data *dsi);
> -static void dsi_display_uninit_dispc(struct dsi_data *dsi);
> +static int dsi_init_dispc(struct dsi_data *dsi);
> +static void dsi_uninit_dispc(struct dsi_data *dsi);
>  
>  static int dsi_vc_send_null(struct dsi_data *dsi, int vc, int channel);
>  
> @@ -3257,7 +3257,7 @@ static void dsi_enable_video_output(struct 
> omap_dss_device *dssdev, int vc)
>   u16 word_count;
>   int r;
>  
> - r = dsi_display_init_dispc(dsi);
> + r = dsi_init_dispc(dsi);
>   if (r) {
>   dev_err(dsi->dev, "failed to init dispc!\n");
>   return;
> @@ -3309,7 +3309,7 @@ static void dsi_enable_video_output(struct 
> omap_dss_device *dssdev, int vc)
>   dsi_vc_enable(dsi, vc, false);
>   }
>  err_pix_fmt:
> - dsi_display_uninit_dispc(dsi);
> + dsi_uninit_dispc(dsi);
>   dev_err(dsi->dev, "failed to enable DSI encoder!\n");
>   return;
>  }
> @@ -3331,7 +3331,7 @@ static void dsi_disable_video_output(struct 
> omap_dss_device *dssdev, int vc)
>  
>   dss_mgr_disable(>output);
>  
> - dsi_display_uninit_dispc(dsi);
> + dsi_uninit_dispc(dsi);
>  }
>  
>  static void dsi_update_screen_dispc(struct dsi_data *dsi)
> @@ -3582,7 +3582,7 @@ static int dsi_configure_dispc_clocks(struct dsi_data 
> *dsi)
>   return 0;
>  }
>  
> -static int dsi_display_init_dispc(struct dsi_data *dsi)
> +static int dsi_init_dispc(struct dsi_data *dsi)
>  {
>   enum omap_channel dispc_channel = dsi->output.dispc_channel;
>   int r;
> @@ -3627,7 +3627,7 @@ static int dsi_display_init_dispc(struct dsi_data *dsi)
>   return r;
>  }
>  
> -static void dsi_display_uninit_dispc(struct dsi_data *dsi)
> +static void dsi_uninit_dispc(struct dsi_data *dsi)
>  {
>   enum omap_channel dispc_channel = dsi->output.dispc_channel;
>  
> @@ -3654,7 +3654,7 @@ static int dsi_configure_dsi_clocks(struct dsi_data 
> *dsi)
>   return 0;
>  }
>  
> -static int dsi_display_init_dsi(struct dsi_data *dsi)
> +static int dsi_init_dsi(struct dsi_data *dsi)
>  {
>   int r;
>  
> @@ -3718,7 +3718,7 @@ static int dsi_display_init_dsi(struct dsi_data *dsi)
>   return r;
>  }
>  
> -static void dsi_display_uninit_dsi(struct dsi_data *dsi, bool 
> disconnect_lanes,
> +static void dsi_uninit_dsi(struct dsi_data *dsi, bool disconnect_lanes,
>  bool enter_ulps)
>  {
>   if (enter_ulps && !dsi->ulps_enabled)
> @@ -3741,7 +3741,7 @@ static void dsi_display_uninit_dsi(struct dsi_data 
> *dsi, bool disconnect_lanes,
>   }
>  }
>  
> -static void dsi_display_enable(struct dsi_data *dsi)
> +static void dsi_enable(struct dsi_data *dsi)
>  {
>   int r;
>  
> @@ -3755,7 +3755,7 @@ static void dsi_display_enable(struct dsi_data *dsi)
>  
>   _dsi_initialize_irq(dsi);
>  
> - r = dsi_display_init_dsi(dsi);
> + r = dsi_init_dsi(dsi);
>   if (r)
>   goto err_init_dsi;
>  
> @@ -3767,10 +3767,10 @@ static void dsi_display_enable(struct dsi_data *dsi)
>   dsi_runtime_put(dsi);
>  err_get_dsi:
>   mutex_unlock(>lock);
> - DSSDBG("dsi_display_ulps_enable FAILED\n");
> + DSSDBG("dsi_enable FAILED\n");
>  }
>  
> -static void dsi_display_disable(struct dsi_data *dsi,
> +static void dsi_disable(struct dsi_data *dsi,
>   bool disconnect_lanes, bool enter_ulps)
>  {
>   WARN_ON(!dsi_bus_is_locked(dsi));
> @@ -3782,7 +3782,7 @@ static void dsi_display_disable(struct dsi_data *dsi,
>   dsi_sync_vc(dsi, 2);
>   dsi_sync_vc(dsi, 3);
>  
> - dsi_display_uninit_dsi(dsi, disconnect_lanes, enter_ulps);
> + dsi_uninit_dsi(dsi, disconnect_lanes, enter_ulps);
>  
>   dsi_runtime_put(dsi);
>  
> @@ -3812,7 +3812,7 @@ static void omap_dsi_ulps_work_callback(struct 
> work_struct *work)
>  
>   dsi_enable_te(dsi, false);
>  
> - dsi_display_disable(dsi, false, true);
> + dsi_disable(dsi, false, true);
>  
>   dsi_bus_unlock(dsi);
>  }
> @@ -3833,7 +3833,7 @@ static void dsi_set_ulps_auto(struct dsi_data *dsi, 
> bool enable)
>

Re: [PATCH 4/9] drm: rcar-du: Use DRM-managed allocation for VSP planes

2020-12-14 Thread Kieran Bingham
Hi Laurent,

On 04/12/2020 22:01, Laurent Pinchart wrote:
> devm_kcalloc() is the wrong API to allocate planes, as the lifetime of
> the planes is tied to the DRM device, not the device to driver
> binding. drmm_kcalloc() isn't a good option either, as it would result
> in the planes being freed before being unregistered during the managed
> cleanup of the DRM objects. Use a plain kcalloc(), and cleanup the
> planes and free the memory in the existing rcar_du_vsp_cleanup()
> handler.

Managed memory always seems to hurt - which is a shame, because it
should be better throughout.

It's like we need a way to arbitrarily specify the lifetimes of objects
correctly against another object... without being tied to a dev ...

Anyway,

Reviewed-by: Kieran Bingham 

> 
> Signed-off-by: Laurent Pinchart 
> ---
>  drivers/gpu/drm/rcar-du/rcar_du_vsp.c | 22 +-
>  1 file changed, 17 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_vsp.c 
> b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c
> index 4dcb1bfbe201..78a886651d9f 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_vsp.c
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_vsp.c
> @@ -21,6 +21,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  
>  #include 
> @@ -344,6 +345,15 @@ static const struct drm_plane_funcs 
> rcar_du_vsp_plane_funcs = {
>  static void rcar_du_vsp_cleanup(struct drm_device *dev, void *res)
>  {
>   struct rcar_du_vsp *vsp = res;
> + unsigned int i;
> +
> + for (i = 0; i < vsp->num_planes; ++i) {
> + struct rcar_du_vsp_plane *plane = >planes[i];
> +
> + drm_plane_cleanup(>plane);
> + }
> +
> + kfree(vsp->planes);
>  
>   put_device(vsp->vsp);
>  }
> @@ -354,6 +364,7 @@ int rcar_du_vsp_init(struct rcar_du_vsp *vsp, struct 
> device_node *np,
>   struct rcar_du_device *rcdu = vsp->dev;
>   struct platform_device *pdev;
>   unsigned int num_crtcs = hweight32(crtcs);
> + unsigned int num_planes;
>   unsigned int i;
>   int ret;
>  
> @@ -376,14 +387,13 @@ int rcar_du_vsp_init(struct rcar_du_vsp *vsp, struct 
> device_node *np,
> * The VSP2D (Gen3) has 5 RPFs, but the VSP1D (Gen2) is limited to
> * 4 RPFs.
> */
> - vsp->num_planes = rcdu->info->gen >= 3 ? 5 : 4;
> + num_planes = rcdu->info->gen >= 3 ? 5 : 4;
>  
> - vsp->planes = devm_kcalloc(rcdu->dev, vsp->num_planes,
> -sizeof(*vsp->planes), GFP_KERNEL);
> + vsp->planes = kcalloc(num_planes, sizeof(*vsp->planes), GFP_KERNEL);
>   if (!vsp->planes)
>   return -ENOMEM;
>  
> - for (i = 0; i < vsp->num_planes; ++i) {
> + for (i = 0; i < num_planes; ++i) {
>   enum drm_plane_type type = i < num_crtcs
>? DRM_PLANE_TYPE_PRIMARY
>: DRM_PLANE_TYPE_OVERLAY;
> @@ -409,8 +419,10 @@ int rcar_du_vsp_init(struct rcar_du_vsp *vsp, struct 
> device_node *np,
>   } else {
>   drm_plane_create_alpha_property(>plane);
>   drm_plane_create_zpos_property(>plane, 1, 1,
> -vsp->num_planes - 1);
> +num_planes - 1);
>   }
> +
> + vsp->num_planes++;> }
>  
>   return 0;
> 

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


Re: [PATCH 01/15] irqchip: Allow to compile bcmstb on other platforms

2020-12-14 Thread Marc Zyngier

Hi Maxime,

On 2020-12-14 15:27, Maxime Ripard wrote:

Hi Marc,

On Thu, Dec 10, 2020 at 05:59:09PM +, Marc Zyngier wrote:


[...]


I'm always sceptical of making interrupt controllers user-selectable.
Who is going to know that they need to pick that one?

I'd be much more in favour of directly selecting this symbol
from DRM_VC4_HDMI_CEC, since there is an obvious dependency.


It's a bit weird to me that the HDMI CEC support selects it, since that
interrupt controller is external and here no matter what.


From glancing at the series, I was under the impression that these
controllers were there for the sole benefit of the HDMI controllers.
Is there anything else connected to them?


Would selecting it from the ARCH_* Kconfig option work for you?


Sure. My only ask is that the low level plumbing is selected without
requiring any user guesswork.

Thanks,

M.
--
Jazz is not dead. It just smells funny...
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v5 22/29] drm/omap: dsi: display_disable cleanup

2020-12-14 Thread Sebastian Reichel
Hi,

On Tue, Dec 08, 2020 at 02:28:48PM +0200, Tomi Valkeinen wrote:
> We can drop dsi_display_disable() which just calls
> _dsi_display_disable(), and rename _dsi_display_disable() to
> dsi_display_disable().
> 
> The WARN_ON(!dsi_bus_is_locked(dsi)) in dsi_display_disable is extra and
> can be dropped, as _dsi_display_disable() has the same WARN_ON().
> 
> Signed-off-by: Tomi Valkeinen 
> Reviewed-by: Laurent Pinchart 
> ---

Reviewed-by: Sebastian Reichel 

-- Sebastian

>  drivers/gpu/drm/omapdrm/dss/dsi.c | 19 +++
>  1 file changed, 3 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c 
> b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index 961b991f6498..d83346812810 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -63,8 +63,6 @@ static int dsi_vc_send_null(struct dsi_data *dsi, int vc, 
> int channel);
>  static ssize_t _omap_dsi_host_transfer(struct dsi_data *dsi, int vc,
>  const struct mipi_dsi_msg *msg);
>  
> -static void dsi_display_disable(struct omap_dss_device *dssdev);
> -
>  #ifdef DSI_PERF_MEASURE
>  static bool dsi_perf;
>  module_param(dsi_perf, bool, 0644);
> @@ -3772,7 +3770,7 @@ static void dsi_display_enable(struct dsi_data *dsi)
>   DSSDBG("dsi_display_ulps_enable FAILED\n");
>  }
>  
> -static void _dsi_display_disable(struct dsi_data *dsi,
> +static void dsi_display_disable(struct dsi_data *dsi,
>   bool disconnect_lanes, bool enter_ulps)
>  {
>   WARN_ON(!dsi_bus_is_locked(dsi));
> @@ -3791,17 +3789,6 @@ static void _dsi_display_disable(struct dsi_data *dsi,
>   mutex_unlock(>lock);
>  }
>  
> -static void dsi_display_disable(struct omap_dss_device *dssdev)
> -{
> - struct dsi_data *dsi = to_dsi_data(dssdev);
> -
> - WARN_ON(!dsi_bus_is_locked(dsi));
> -
> - DSSDBG("dsi_display_disable\n");
> -
> - _dsi_display_disable(dsi, true, false);
> -}
> -
>  static int dsi_enable_te(struct dsi_data *dsi, bool enable)
>  {
>   dsi->te_enabled = enable;
> @@ -3825,7 +3812,7 @@ static void omap_dsi_ulps_work_callback(struct 
> work_struct *work)
>  
>   dsi_enable_te(dsi, false);
>  
> - _dsi_display_disable(dsi, false, true);
> + dsi_display_disable(dsi, false, true);
>  
>   dsi_bus_unlock(dsi);
>  }
> @@ -4959,7 +4946,7 @@ static void dsi_bridge_disable(struct drm_bridge 
> *bridge)
>  
>   dsi_disable_video_output(dssdev, VC_VIDEO);
>  
> - dsi_display_disable(dssdev);
> + dsi_display_disable(dsi, true, false);
>  
>   dsi_bus_unlock(dsi);
>  }
> -- 
> Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
> Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
> 


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


Re: [PATCH v5 21/29] drm/omap: dsi: display_enable cleanup

2020-12-14 Thread Sebastian Reichel
Hi,

On Tue, Dec 08, 2020 at 02:28:47PM +0200, Tomi Valkeinen wrote:
> We can drop dsi_display_enable(), which just calls
> _dsi_display_enable(), and rename _dsi_display_enable() to
> dsi_display_enable().
> 
> The WARN_ON(!dsi_bus_is_locked(dsi)) in dsi_display_enable is extra and
> can be dropped, as _dsi_display_enable() has the same WARN_ON().
> 
> Signed-off-by: Tomi Valkeinen 
> Reviewed-by: Laurent Pinchart 
> ---

Reviewed-by: Sebastian Reichel 

-- Sebastian

>  drivers/gpu/drm/omapdrm/dss/dsi.c | 16 +++-
>  1 file changed, 3 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c 
> b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index 44b8e42b52ec..961b991f6498 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -3743,7 +3743,7 @@ static void dsi_display_uninit_dsi(struct dsi_data 
> *dsi, bool disconnect_lanes,
>   }
>  }
>  
> -static void _dsi_display_enable(struct dsi_data *dsi)
> +static void dsi_display_enable(struct dsi_data *dsi)
>  {
>   int r;
>  
> @@ -3772,16 +3772,6 @@ static void _dsi_display_enable(struct dsi_data *dsi)
>   DSSDBG("dsi_display_ulps_enable FAILED\n");
>  }
>  
> -static void dsi_display_enable(struct omap_dss_device *dssdev)
> -{
> - struct dsi_data *dsi = to_dsi_data(dssdev);
> - DSSDBG("dsi_display_enable\n");
> -
> - WARN_ON(!dsi_bus_is_locked(dsi));
> -
> - _dsi_display_enable(dsi);
> -}
> -
>  static void _dsi_display_disable(struct dsi_data *dsi,
>   bool disconnect_lanes, bool enter_ulps)
>  {
> @@ -3856,7 +3846,7 @@ static void dsi_set_ulps_auto(struct dsi_data *dsi, 
> bool enable)
>   return;
>  
>   dsi_bus_lock(dsi);
> - _dsi_display_enable(dsi);
> + dsi_display_enable(dsi);
>   dsi_enable_te(dsi, true);
>   dsi_bus_unlock(dsi);
>   }
> @@ -4947,7 +4937,7 @@ static void dsi_bridge_enable(struct drm_bridge *bridge)
>  
>   dsi_bus_lock(dsi);
>  
> - dsi_display_enable(dssdev);
> + dsi_display_enable(dsi);
>  
>   dsi_enable_video_output(dssdev, VC_VIDEO);
>  
> -- 
> Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
> Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
> 


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


Re: [PATCH v5 20/29] drm/omap: dsi: move enable/disable to bridge enable/disable

2020-12-14 Thread Sebastian Reichel
Hi,

On Tue, Dec 08, 2020 at 02:28:46PM +0200, Tomi Valkeinen wrote:
> Clean up the code by inlining dsi_enable_video_outputs and
> dsi_disable_video_outputs functions.
> 
> Signed-off-by: Tomi Valkeinen 
> Reviewed-by: Laurent Pinchart 
> ---

Reviewed-by: Sebastian Reichel 

-- Sebastian

>  drivers/gpu/drm/omapdrm/dss/dsi.c | 55 +--
>  1 file changed, 22 insertions(+), 33 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c 
> b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index da3ff9e236bd..44b8e42b52ec 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -3336,20 +3336,6 @@ static void dsi_disable_video_output(struct 
> omap_dss_device *dssdev, int vc)
>   dsi_display_uninit_dispc(dsi);
>  }
>  
> -static void dsi_disable_video_outputs(struct omap_dss_device *dssdev)
> -{
> - struct dsi_data *dsi = to_dsi_data(dssdev);
> -
> - dsi_bus_lock(dsi);
> - dsi->video_enabled = false;
> -
> - dsi_disable_video_output(dssdev, VC_VIDEO);
> -
> - dsi_display_disable(dssdev);
> -
> - dsi_bus_unlock(dsi);
> -}
> -
>  static void dsi_update_screen_dispc(struct dsi_data *dsi)
>  {
>   unsigned int bytespp;
> @@ -3796,23 +3782,6 @@ static void dsi_display_enable(struct omap_dss_device 
> *dssdev)
>   _dsi_display_enable(dsi);
>  }
>  
> -static void dsi_enable_video_outputs(struct omap_dss_device *dssdev)
> -{
> - struct dsi_data *dsi = to_dsi_data(dssdev);
> -
> - dsi_bus_lock(dsi);
> -
> - dsi_display_enable(dssdev);
> -
> - dsi_enable_video_output(dssdev, VC_VIDEO);
> -
> - dsi->video_enabled = true;
> -
> - dsi_set_ulps_auto(dsi, true);
> -
> - dsi_bus_unlock(dsi);
> -}
> -
>  static void _dsi_display_disable(struct dsi_data *dsi,
>   bool disconnect_lanes, bool enter_ulps)
>  {
> @@ -4974,15 +4943,35 @@ static void dsi_bridge_mode_set(struct drm_bridge 
> *bridge,
>  static void dsi_bridge_enable(struct drm_bridge *bridge)
>  {
>   struct dsi_data *dsi = drm_bridge_to_dsi(bridge);
> + struct omap_dss_device *dssdev = >output;
>  
> - dsi_enable_video_outputs(>output);
> + dsi_bus_lock(dsi);
> +
> + dsi_display_enable(dssdev);
> +
> + dsi_enable_video_output(dssdev, VC_VIDEO);
> +
> + dsi->video_enabled = true;
> +
> + dsi_set_ulps_auto(dsi, true);
> +
> + dsi_bus_unlock(dsi);
>  }
>  
>  static void dsi_bridge_disable(struct drm_bridge *bridge)
>  {
>   struct dsi_data *dsi = drm_bridge_to_dsi(bridge);
> + struct omap_dss_device *dssdev = >output;
> +
> + dsi_bus_lock(dsi);
> +
> + dsi->video_enabled = false;
> +
> + dsi_disable_video_output(dssdev, VC_VIDEO);
>  
> - dsi_disable_video_outputs(>output);
> + dsi_display_disable(dssdev);
> +
> + dsi_bus_unlock(dsi);
>  }
>  
>  static const struct drm_bridge_funcs dsi_bridge_funcs = {
> -- 
> Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
> Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
> 


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


Re: [PATCH v5 19/29] drm/omap: dsi: move structs & defines to dsi.h

2020-12-14 Thread Sebastian Reichel
Hi,

On Tue, Dec 08, 2020 at 02:28:45PM +0200, Tomi Valkeinen wrote:
> Move structs and defines to a private dsi.h header file to make dsi.c a
> bit easier to navigate. Also move the (now) private structs and defines
> from omapdss.h to dsi.h.
> 
> Signed-off-by: Tomi Valkeinen 
> Reviewed-by: Laurent Pinchart 
> ---

Reviewed-by: Sebastian Reichel 

-- Sebastian

>  drivers/gpu/drm/omapdrm/dss/dsi.c | 384 +
>  drivers/gpu/drm/omapdrm/dss/dsi.h | 459 ++
>  drivers/gpu/drm/omapdrm/dss/omapdss.h |  64 
>  3 files changed, 460 insertions(+), 447 deletions(-)
>  create mode 100644 drivers/gpu/drm/omapdrm/dss/dsi.h
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c 
> b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index 0795efdd8902..da3ff9e236bd 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -45,73 +45,7 @@
>  
>  #define DSI_CATCH_MISSING_TE
>  
> -struct dsi_reg { u16 module; u16 idx; };
> -
> -#define DSI_REG(mod, idx)((const struct dsi_reg) { mod, idx })
> -
> -/* DSI Protocol Engine */
> -
> -#define DSI_PROTO0
> -#define DSI_PROTO_SZ 0x200
> -
> -#define DSI_REVISION DSI_REG(DSI_PROTO, 0x)
> -#define DSI_SYSCONFIGDSI_REG(DSI_PROTO, 0x0010)
> -#define DSI_SYSSTATUSDSI_REG(DSI_PROTO, 0x0014)
> -#define DSI_IRQSTATUSDSI_REG(DSI_PROTO, 0x0018)
> -#define DSI_IRQENABLEDSI_REG(DSI_PROTO, 0x001C)
> -#define DSI_CTRL DSI_REG(DSI_PROTO, 0x0040)
> -#define DSI_GNQ  DSI_REG(DSI_PROTO, 0x0044)
> -#define DSI_COMPLEXIO_CFG1   DSI_REG(DSI_PROTO, 0x0048)
> -#define DSI_COMPLEXIO_IRQ_STATUS DSI_REG(DSI_PROTO, 0x004C)
> -#define DSI_COMPLEXIO_IRQ_ENABLE DSI_REG(DSI_PROTO, 0x0050)
> -#define DSI_CLK_CTRL DSI_REG(DSI_PROTO, 0x0054)
> -#define DSI_TIMING1  DSI_REG(DSI_PROTO, 0x0058)
> -#define DSI_TIMING2  DSI_REG(DSI_PROTO, 0x005C)
> -#define DSI_VM_TIMING1   DSI_REG(DSI_PROTO, 0x0060)
> -#define DSI_VM_TIMING2   DSI_REG(DSI_PROTO, 0x0064)
> -#define DSI_VM_TIMING3   DSI_REG(DSI_PROTO, 0x0068)
> -#define DSI_CLK_TIMING   DSI_REG(DSI_PROTO, 0x006C)
> -#define DSI_TX_FIFO_VC_SIZE  DSI_REG(DSI_PROTO, 0x0070)
> -#define DSI_RX_FIFO_VC_SIZE  DSI_REG(DSI_PROTO, 0x0074)
> -#define DSI_COMPLEXIO_CFG2   DSI_REG(DSI_PROTO, 0x0078)
> -#define DSI_RX_FIFO_VC_FULLNESS  DSI_REG(DSI_PROTO, 0x007C)
> -#define DSI_VM_TIMING4   DSI_REG(DSI_PROTO, 0x0080)
> -#define DSI_TX_FIFO_VC_EMPTINESS DSI_REG(DSI_PROTO, 0x0084)
> -#define DSI_VM_TIMING5   DSI_REG(DSI_PROTO, 0x0088)
> -#define DSI_VM_TIMING6   DSI_REG(DSI_PROTO, 0x008C)
> -#define DSI_VM_TIMING7   DSI_REG(DSI_PROTO, 0x0090)
> -#define DSI_STOPCLK_TIMING   DSI_REG(DSI_PROTO, 0x0094)
> -#define DSI_VC_CTRL(n)   DSI_REG(DSI_PROTO, 0x0100 + (n 
> * 0x20))
> -#define DSI_VC_TE(n) DSI_REG(DSI_PROTO, 0x0104 + (n * 0x20))
> -#define DSI_VC_LONG_PACKET_HEADER(n) DSI_REG(DSI_PROTO, 0x0108 + (n * 0x20))
> -#define DSI_VC_LONG_PACKET_PAYLOAD(n)DSI_REG(DSI_PROTO, 0x010C + (n 
> * 0x20))
> -#define DSI_VC_SHORT_PACKET_HEADER(n)DSI_REG(DSI_PROTO, 0x0110 + (n 
> * 0x20))
> -#define DSI_VC_IRQSTATUS(n)  DSI_REG(DSI_PROTO, 0x0118 + (n * 0x20))
> -#define DSI_VC_IRQENABLE(n)  DSI_REG(DSI_PROTO, 0x011C + (n * 0x20))
> -
> -/* DSIPHY_SCP */
> -
> -#define DSI_PHY  1
> -#define DSI_PHY_OFFSET   0x200
> -#define DSI_PHY_SZ   0x40
> -
> -#define DSI_DSIPHY_CFG0  DSI_REG(DSI_PHY, 0x)
> -#define DSI_DSIPHY_CFG1  DSI_REG(DSI_PHY, 0x0004)
> -#define DSI_DSIPHY_CFG2  DSI_REG(DSI_PHY, 0x0008)
> -#define DSI_DSIPHY_CFG5  DSI_REG(DSI_PHY, 0x0014)
> -#define DSI_DSIPHY_CFG10 DSI_REG(DSI_PHY, 0x0028)
> -
> -/* DSI_PLL_CTRL_SCP */
> -
> -#define DSI_PLL  2
> -#define DSI_PLL_OFFSET   0x300
> -#define DSI_PLL_SZ   0x20
> -
> -#define DSI_PLL_CONTROL  DSI_REG(DSI_PLL, 0x)
> -#define DSI_PLL_STATUS   DSI_REG(DSI_PLL, 0x0004)
> -#define DSI_PLL_GO   DSI_REG(DSI_PLL, 0x0008)
> -#define DSI_PLL_CONFIGURATION1   DSI_REG(DSI_PLL, 0x000C)
> -#define DSI_PLL_CONFIGURATION2   DSI_REG(DSI_PLL, 0x0010)
> +#include "dsi.h"
>  
>  #define REG_GET(dsi, idx, start, end) \
>   FLD_GET(dsi_read_reg(dsi, idx), start, end)
> @@ -119,96 +53,6 @@ struct dsi_reg { u16 module; u16 idx; };
>  #define 

Re: [PATCH v5 18/29] drm/panel: panel-dsi-cm: drop unneeded includes

2020-12-14 Thread Sebastian Reichel
Hi,

On Tue, Dec 08, 2020 at 02:28:44PM +0200, Tomi Valkeinen wrote:
> Drop unneeded includes.
> 
> Signed-off-by: Tomi Valkeinen 
> Reviewed-by: Sam Ravnborg 
> Reviewed-by: Laurent Pinchart 
> ---
>  drivers/gpu/drm/panel/panel-dsi-cm.c | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/panel/panel-dsi-cm.c 
> b/drivers/gpu/drm/panel/panel-dsi-cm.c
> index 3fb5b2856283..3fe73c4bef6e 100644
> --- a/drivers/gpu/drm/panel/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/panel/panel-dsi-cm.c
> @@ -11,9 +11,6 @@
>  #include 
>  #include 
>  #include 
> -#include 
> -#include 
> -#include 

Note, that 'of_device_get_match_data', which I suggested in
previous patch is defined in . Otherwise

Reviewed-by: Sebastian Reichel 

-- Sebastian

>  #include 
>  
>  #include 
> -- 
> Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
> Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
> 


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


Re: [PATCH v5 17/29] drm/panel: panel-dsi-cm: add panel database to driver

2020-12-14 Thread Sebastian Reichel
On Tue, Dec 08, 2020 at 02:28:43PM +0200, Tomi Valkeinen wrote:
> Add a panel database to the driver instead of reading propertes from DT
> data. This is similar to panel-simple, and I believe it's more future
> safe way to handle the panels.
> 
> Signed-off-by: Tomi Valkeinen 
> Reviewed-by: Sam Ravnborg 
> ---
>  drivers/gpu/drm/panel/panel-dsi-cm.c | 107 +--
>  1 file changed, 69 insertions(+), 38 deletions(-)
> 
> diff --git a/drivers/gpu/drm/panel/panel-dsi-cm.c 
> b/drivers/gpu/drm/panel/panel-dsi-cm.c
> index fa564aad7f25..3fb5b2856283 100644
> --- a/drivers/gpu/drm/panel/panel-dsi-cm.c
> +++ b/drivers/gpu/drm/panel/panel-dsi-cm.c
> @@ -21,10 +21,7 @@
>  #include 
>  #include 
>  
> -#include 
>  #include 
> -#include 
> -#include 
>  
>  #define DCS_GET_ID1  0xda
>  #define DCS_GET_ID2  0xdb
> @@ -32,6 +29,18 @@
>  
>  #define DCS_REGULATOR_SUPPLY_NUM 2
>  
> +static const struct of_device_id dsicm_of_match[];
> +
> +struct dsic_panel_data {
> + u32 xres;
> + u32 yres;
> + u32 refresh;
> + u32 width_mm;
> + u32 height_mm;
> + u32 max_hs_rate;
> + u32 max_lp_rate;
> +};
> +
>  struct panel_drv_data {
>   struct mipi_dsi_device *dsi;
>   struct drm_panel panel;
> @@ -47,16 +56,14 @@ struct panel_drv_data {
>*/
>   unsigned long   hw_guard_wait;  /* max guard time in jiffies */
>  
> - /* panel HW configuration from DT or platform data */
> + const struct dsic_panel_data *panel_data;
> +
>   struct gpio_desc *reset_gpio;
>  
>   struct regulator_bulk_data supplies[DCS_REGULATOR_SUPPLY_NUM];
>  
>   bool use_dsi_backlight;
>  
> - int width_mm;
> - int height_mm;
> -
>   /* runtime variables */
>   bool enabled;
>  
> @@ -450,11 +457,8 @@ static int dsicm_get_modes(struct drm_panel *panel,
>   return -ENOMEM;
>   }
>  
> - drm_mode_set_name(mode);
> - mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
> -
> - connector->display_info.width_mm = ddata->width_mm;
> - connector->display_info.height_mm = ddata->height_mm;
> + connector->display_info.width_mm = ddata->panel_data->width_mm;
> + connector->display_info.height_mm = ddata->panel_data->height_mm;
>  
>   drm_mode_probed_add(connector, mode);
>  
> @@ -471,15 +475,10 @@ static const struct drm_panel_funcs dsicm_panel_funcs = 
> {
>  
>  static int dsicm_probe_of(struct mipi_dsi_device *dsi)
>  {
> - struct device_node *node = dsi->dev.of_node;
>   struct backlight_device *backlight;
>   struct panel_drv_data *ddata = mipi_dsi_get_drvdata(dsi);
> - struct display_timing timing;
> - struct videomode vm = {
> - .hactive = 864,
> - .vactive = 480,
> - };
>   int err;
> + struct drm_display_mode *mode = >mode;
>  
>   ddata->reset_gpio = devm_gpiod_get(>dev, "reset", GPIOD_OUT_LOW);
>   if (IS_ERR(ddata->reset_gpio)) {
> @@ -488,23 +487,16 @@ static int dsicm_probe_of(struct mipi_dsi_device *dsi)
>   return err;
>   }
>  
> - err = of_get_display_timing(node, "panel-timing", );
> - if (!err) {
> - videomode_from_timing(, );
> - } else {
> - dev_warn(>dev,
> -  "failed to get video timing, using defaults\n");
> - }
> -
> - if (!vm.pixelclock)
> - vm.pixelclock = vm.hactive * vm.vactive * 60;
> - drm_display_mode_from_videomode(, >mode);
> -
> - ddata->width_mm = 0;
> - of_property_read_u32(node, "width-mm", >width_mm);
> -
> - ddata->height_mm = 0;
> - of_property_read_u32(node, "height-mm", >height_mm);
> + mode->hdisplay = mode->hsync_start = mode->hsync_end = mode->htotal =
> + ddata->panel_data->xres;
> + mode->vdisplay = mode->vsync_start = mode->vsync_end = mode->vtotal =
> + ddata->panel_data->yres;
> + mode->clock = ddata->panel_data->xres * ddata->panel_data->yres *
> + ddata->panel_data->refresh / 1000;
> + mode->width_mm = ddata->panel_data->width_mm;
> + mode->height_mm = ddata->panel_data->height_mm;
> + mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
> + drm_mode_set_name(mode);
>  
>   ddata->supplies[0].supply = "vpnl";
>   ddata->supplies[1].supply = "vddi";
> @@ -531,6 +523,7 @@ static int dsicm_probe(struct mipi_dsi_device *dsi)
>   struct panel_drv_data *ddata;
>   struct backlight_device *bldev = NULL;
>   struct device *dev = >dev;
> + const struct of_device_id *id;
>   int r;
>  
>   dev_dbg(dev, "probe\n");
> @@ -542,6 +535,12 @@ static int dsicm_probe(struct mipi_dsi_device *dsi)
>   mipi_dsi_set_drvdata(dsi, ddata);
>   ddata->dsi = dsi;
>  
> + id = of_match_node(dsicm_of_match, dev->of_node);
> + if (!id)
> + return -ENODEV;
> +
> + ddata->panel_data = id->data;

ddata->panel_data = 

Re: [PATCH -next] fbdev: s3c2410fb: convert comma to semicolon

2020-12-14 Thread Krzysztof Kozlowski
On Mon, Dec 14, 2020 at 09:33:17PM +0800, Zheng Yongjun wrote:
> Replace a comma between expression statements by a semicolon.
> 
> Signed-off-by: Zheng Yongjun 
> ---
>  drivers/video/fbdev/s3c2410fb.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 

Reviewed-by: Krzysztof Kozlowski 

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


Re: [PATCH 1/4] dma-buf: Remove kmap kerneldoc vestiges

2020-12-14 Thread Daniel Vetter
On Mon, Dec 14, 2020 at 11:33:10AM +0100, Christian König wrote:
> Am 11.12.20 um 16:58 schrieb Daniel Vetter:
> > Also try to clarify a bit when dma_buf_begin/end_cpu_access should
> > be called.
> > 
> > Signed-off-by: Daniel Vetter 
> > Cc: Thomas Zimmermann 
> > Cc: Sumit Semwal 
> > Cc: "Christian König" 
> > Cc: linux-me...@vger.kernel.org
> > Cc: linaro-mm-...@lists.linaro.org
> > ---
> >   drivers/dma-buf/dma-buf.c | 20 ++--
> >   include/linux/dma-buf.h   | 25 +
> >   2 files changed, 23 insertions(+), 22 deletions(-)
> > 
> > diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c
> > index e63684d4cd90..a12fdffa130f 100644
> > --- a/drivers/dma-buf/dma-buf.c
> > +++ b/drivers/dma-buf/dma-buf.c
> > @@ -1001,15 +1001,15 @@ EXPORT_SYMBOL_GPL(dma_buf_move_notify);
> >*   vmalloc space might be limited and result in vmap calls failing.
> >*
> >*   Interfaces::
> > + *
> >*  void \*dma_buf_vmap(struct dma_buf \*dmabuf)
> >*  void dma_buf_vunmap(struct dma_buf \*dmabuf, void \*vaddr)
> >*
> >*   The vmap call can fail if there is no vmap support in the exporter, 
> > or if
> > - *   it runs out of vmalloc space. Fallback to kmap should be implemented. 
> > Note
> > - *   that the dma-buf layer keeps a reference count for all vmap access and
> > - *   calls down into the exporter's vmap function only when no vmapping 
> > exists,
> > - *   and only unmaps it once. Protection against concurrent vmap/vunmap 
> > calls is
> > - *   provided by taking the dma_buf->lock mutex.
> > + *   it runs out of vmalloc space. Note that the dma-buf layer keeps a 
> > reference
> > + *   count for all vmap access and calls down into the exporter's vmap 
> > function
> > + *   only when no vmapping exists, and only unmaps it once. Protection 
> > against
> > + *   concurrent vmap/vunmap calls is provided by taking the _buf.lock 
> > mutex.
> 
> Who is talking the lock? The caller of the dma_buf_vmap/vunmap() functions,
> the functions itself or the callback inside the exporter?

That's the part I didn't change at all here, just re-laid out the line
breaking. I only removed the outdated kmap section here.

Should I do another patch and remove this one sentence here (it's kinda
pointless and generally we don't muse about implementation details that
callers don't care about)?

I did try and do a cursory review of the dma-buf docs, but this is kinda
not meant as an all-out revamp. Just a few things I've noticed while
reviewing Thomas' vmap_local stuff.
-Daniel

> 
> Christian.
> 
> >*
> >* - For full compatibility on the importer side with existing userspace
> >*   interfaces, which might already support mmap'ing buffers. This is 
> > needed in
> > @@ -1098,6 +1098,11 @@ static int __dma_buf_begin_cpu_access(struct dma_buf 
> > *dmabuf,
> >* dma_buf_end_cpu_access(). Only when cpu access is braketed by both 
> > calls is
> >* it guaranteed to be coherent with other DMA access.
> >*
> > + * This function will also wait for any DMA transactions tracked through
> > + * implicit synchronization in _buf.resv. For DMA transactions with 
> > explicit
> > + * synchronization this function will only ensure cache coherency, callers 
> > must
> > + * ensure synchronization with such DMA transactions on their own.
> > + *
> >* Can return negative error values, returns 0 on success.
> >*/
> >   int dma_buf_begin_cpu_access(struct dma_buf *dmabuf,
> > @@ -1199,7 +1204,10 @@ EXPORT_SYMBOL_GPL(dma_buf_mmap);
> >* This call may fail due to lack of virtual mapping address space.
> >* These calls are optional in drivers. The intended use for them
> >* is for mapping objects linear in kernel space for high use objects.
> > - * Please attempt to use kmap/kunmap before thinking about these 
> > interfaces.
> > + *
> > + * To ensure coherency users must call dma_buf_begin_cpu_access() and
> > + * dma_buf_end_cpu_access() around any cpu access performed through this
> > + * mapping.
> >*
> >* Returns 0 on success, or a negative errno code otherwise.
> >*/
> > diff --git a/include/linux/dma-buf.h b/include/linux/dma-buf.h
> > index cf72699cb2bc..7eca37c8b10c 100644
> > --- a/include/linux/dma-buf.h
> > +++ b/include/linux/dma-buf.h
> > @@ -183,24 +183,19 @@ struct dma_buf_ops {
> >  * @begin_cpu_access:
> >  *
> >  * This is called from dma_buf_begin_cpu_access() and allows the
> > -* exporter to ensure that the memory is actually available for cpu
> > -* access - the exporter might need to allocate or swap-in and pin the
> > -* backing storage. The exporter also needs to ensure that cpu access is
> > -* coherent for the access direction. The direction can be used by the
> > -* exporter to optimize the cache flushing, i.e. access with a different
> > +* exporter to ensure that the memory is actually coherent for cpu
> > +* access. The exporter also needs to ensure that 

  1   2   3   >