Re: [Intel-gfx] [patch V3 13/37] mips/mm/highmem: Switch to generic kmap atomic

2021-01-11 Thread Paul Cercueil

Hi Thomas,

Le sam. 9 janv. 2021 à 1:33, Thomas Bogendoerfer 
 a écrit :

On Sat, Jan 09, 2021 at 12:58:05AM +0100, Thomas Bogendoerfer wrote:

 On Fri, Jan 08, 2021 at 08:20:43PM +, Paul Cercueil wrote:
 > Hi Thomas,
 >
 > 5.11 does not boot anymore on Ingenic SoCs, I bisected it to this 
commit.

 >
 > Any idea what could be happening?

 not yet, kernel crash log of a Malta QEMU is below.


update:

This dirty hack lets the Malta QEMU boot again:

diff --git a/mm/highmem.c b/mm/highmem.c
index c3a9ea7875ef..190cdda1149d 100644
--- a/mm/highmem.c
+++ b/mm/highmem.c
@@ -515,7 +515,7 @@ void *__kmap_local_pfn_prot(unsigned long pfn, 
pgprot_t prot)

vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx);
BUG_ON(!pte_none(*(kmap_pte - idx)));
pteval = pfn_pte(pfn, prot);
-   set_pte_at(&init_mm, vaddr, kmap_pte - idx, pteval);
+   set_pte(kmap_pte - idx, pteval);
arch_kmap_local_post_map(vaddr, pteval);
current->kmap_ctrl.pteval[kmap_local_idx()] = pteval;
preempt_enable();

set_pte_at() tries to update cache and could do an kmap_atomic() 
there.

Not sure, if this is allowed at this point.


Yes, I can confirm that your workaround works here too.

Cheers,
-Paul


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


Re: [Intel-gfx] [patch V3 13/37] mips/mm/highmem: Switch to generic kmap atomic

2021-01-11 Thread Paul Cercueil

Hi Thomas,

5.11 does not boot anymore on Ingenic SoCs, I bisected it to this 
commit.


Any idea what could be happening?

Cheers,
-Paul


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


Re: [Intel-gfx] [PATCH 06/11] drm/: drm_gem_plane_helper_prepare_fb is now the default

2021-05-21 Thread Paul Cercueil

Hi Daniel,

Le ven., mai 21 2021 at 11:09:54 +0200, Daniel Vetter 
 a écrit :

No need to set it explicitly.

Signed-off-by: Daniel Vetter 
Cc: Laurentiu Palcu 
Cc: Lucas Stach 
Cc: Shawn Guo 
Cc: Sascha Hauer 
Cc: Pengutronix Kernel Team 
Cc: Fabio Estevam 
Cc: NXP Linux Team 
Cc: Philipp Zabel 
Cc: Paul Cercueil 
Cc: Chun-Kuang Hu 
Cc: Matthias Brugger 
Cc: Neil Armstrong 
Cc: Kevin Hilman 
Cc: Jerome Brunet 
Cc: Martin Blumenstingl 
Cc: Marek Vasut 
Cc: Stefan Agner 
Cc: Sandy Huang 
Cc: "Heiko Stübner" 
Cc: Yannick Fertre 
Cc: Philippe Cornu 
Cc: Benjamin Gaignard 
Cc: Maxime Coquelin 
Cc: Alexandre Torgue 
Cc: Maxime Ripard 
Cc: Chen-Yu Tsai 
Cc: Jernej Skrabec 
Cc: Jyri Sarha 
Cc: Tomi Valkeinen 
Cc: linux-arm-ker...@lists.infradead.org
Cc: linux-m...@vger.kernel.org
Cc: linux-media...@lists.infradead.org
Cc: linux-amlo...@lists.infradead.org
Cc: linux-rockc...@lists.infradead.org
Cc: linux-st...@st-md-mailman.stormreply.com
Cc: linux-su...@lists.linux.dev
---
 drivers/gpu/drm/imx/dcss/dcss-plane.c   | 1 -
 drivers/gpu/drm/imx/ipuv3-plane.c   | 1 -
 drivers/gpu/drm/ingenic/ingenic-drm-drv.c   | 1 -
 drivers/gpu/drm/ingenic/ingenic-ipu.c   | 1 -


For drivers/gpu/drm/ingenic/*:
Acked-by: Paul Cercueil 

Cheers,
-Paul


 drivers/gpu/drm/mediatek/mtk_drm_plane.c| 1 -
 drivers/gpu/drm/meson/meson_overlay.c   | 1 -
 drivers/gpu/drm/meson/meson_plane.c | 1 -
 drivers/gpu/drm/mxsfb/mxsfb_kms.c   | 2 --
 drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 1 -
 drivers/gpu/drm/stm/ltdc.c  | 1 -
 drivers/gpu/drm/sun4i/sun4i_layer.c | 1 -
 drivers/gpu/drm/sun4i/sun8i_ui_layer.c  | 1 -
 drivers/gpu/drm/sun4i/sun8i_vi_layer.c  | 1 -
 drivers/gpu/drm/tidss/tidss_plane.c | 1 -
 14 files changed, 15 deletions(-)

diff --git a/drivers/gpu/drm/imx/dcss/dcss-plane.c 
b/drivers/gpu/drm/imx/dcss/dcss-plane.c

index 044d3bdf313c..ac45d54acd4e 100644
--- a/drivers/gpu/drm/imx/dcss/dcss-plane.c
+++ b/drivers/gpu/drm/imx/dcss/dcss-plane.c
@@ -361,7 +361,6 @@ static void dcss_plane_atomic_disable(struct 
drm_plane *plane,

 }

 static const struct drm_plane_helper_funcs dcss_plane_helper_funcs = 
{

-   .prepare_fb = drm_gem_plane_helper_prepare_fb,
.atomic_check = dcss_plane_atomic_check,
.atomic_update = dcss_plane_atomic_update,
.atomic_disable = dcss_plane_atomic_disable,
diff --git a/drivers/gpu/drm/imx/ipuv3-plane.c 
b/drivers/gpu/drm/imx/ipuv3-plane.c

index 8710f55d2579..ef114b6aa691 100644
--- a/drivers/gpu/drm/imx/ipuv3-plane.c
+++ b/drivers/gpu/drm/imx/ipuv3-plane.c
@@ -772,7 +772,6 @@ static void ipu_plane_atomic_update(struct 
drm_plane *plane,

 }

 static const struct drm_plane_helper_funcs ipu_plane_helper_funcs = {
-   .prepare_fb = drm_gem_plane_helper_prepare_fb,
.atomic_check = ipu_plane_atomic_check,
.atomic_disable = ipu_plane_atomic_disable,
.atomic_update = ipu_plane_atomic_update,
diff --git a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c 
b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c

index 389cad59e090..62db7349bf6a 100644
--- a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
+++ b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
@@ -786,7 +786,6 @@ static const struct drm_plane_helper_funcs 
ingenic_drm_plane_helper_funcs = {

.atomic_update  = ingenic_drm_plane_atomic_update,
.atomic_check   = ingenic_drm_plane_atomic_check,
.atomic_disable = ingenic_drm_plane_atomic_disable,
-   .prepare_fb = drm_gem_plane_helper_prepare_fb,
 };

 static const struct drm_crtc_helper_funcs 
ingenic_drm_crtc_helper_funcs = {
diff --git a/drivers/gpu/drm/ingenic/ingenic-ipu.c 
b/drivers/gpu/drm/ingenic/ingenic-ipu.c

index 3b1091e7c0cd..caf038f3e231 100644
--- a/drivers/gpu/drm/ingenic/ingenic-ipu.c
+++ b/drivers/gpu/drm/ingenic/ingenic-ipu.c
@@ -615,7 +615,6 @@ static const struct drm_plane_helper_funcs 
ingenic_ipu_plane_helper_funcs = {

.atomic_update  = ingenic_ipu_plane_atomic_update,
.atomic_check   = ingenic_ipu_plane_atomic_check,
.atomic_disable = ingenic_ipu_plane_atomic_disable,
-   .prepare_fb = drm_gem_plane_helper_prepare_fb,
 };

 static int
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_plane.c 
b/drivers/gpu/drm/mediatek/mtk_drm_plane.c

index b5582dcf564c..1667a7e7de38 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_plane.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_plane.c
@@ -227,7 +227,6 @@ static void mtk_plane_atomic_update(struct 
drm_plane *plane,

 }

 static const struct drm_plane_helper_funcs mtk_plane_helper_funcs = {
-   .prepare_fb = drm_gem_plane_helper_prepare_fb,
.atomic_check = mtk_plane_atomic_check,
.atomic_update = mtk_plane_atomic_update,
.atomic_disable = mtk_plane_atomic_disable,
diff --git a/drivers/gpu/drm/meson/meson_overlay.c 
b/drivers/gpu/drm/meson/meson_overlay.c

index ed063152aecd..dfef8afcc245 10

[Intel-gfx] [PATCH] drm/ingenic: Fix bad revert

2020-10-12 Thread Paul Cercueil
Fix a badly reverted commit. The revert commit was cherry-picked from
drm-misc-next to drm-misc-next-fixes, and in the process some unrelated
code was added.

Fixes: a3fb64c00d44 "Revert "gpu/drm: ingenic: Add option to mmap GEM buffers 
cached""
Signed-off-by: Paul Cercueil 
---
 drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 16 
 1 file changed, 16 deletions(-)

diff --git a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c 
b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
index 1be1235bd546..a3d1617d7c67 100644
--- a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
+++ b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
@@ -440,20 +440,6 @@ void ingenic_drm_plane_config(struct device *dev,
}
 }
 
-static void ingenic_drm_update_palette(struct ingenic_drm *priv,
-  const struct drm_color_lut *lut)
-{
-   unsigned int i;
-
-   for (i = 0; i < ARRAY_SIZE(priv->dma_hwdescs->palette); i++) {
-   u16 color = drm_color_lut_extract(lut[i].red, 5) << 11
-   | drm_color_lut_extract(lut[i].green, 6) << 5
-   | drm_color_lut_extract(lut[i].blue, 5);
-
-   priv->dma_hwdescs->palette[i] = color;
-   }
-}
-
 static void ingenic_drm_plane_atomic_update(struct drm_plane *plane,
struct drm_plane_state *oldstate)
 {
@@ -464,8 +450,6 @@ static void ingenic_drm_plane_atomic_update(struct 
drm_plane *plane,
dma_addr_t addr;
 
if (state && state->fb) {
-   crtc_state = state->crtc->state;
-
addr = drm_fb_cma_get_gem_addr(state->fb, state, 0);
width = state->src_w >> 16;
height = state->src_h >> 16;
-- 
2.28.0

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


Re: [Intel-gfx] linux-next: build failure after merge of the drm-misc tree

2020-10-12 Thread Paul Cercueil

Hi Stephen,

Le lun. 12 oct. 2020 à 15:24, Stephen Rothwell  
a écrit :

Hi all,

On Thu, 8 Oct 2020 15:42:02 +1100 Stephen Rothwell 
 wrote:


 On Thu, 8 Oct 2020 14:09:03 +1100 Stephen Rothwell 
 wrote:

 >
 > After merging the drm-misc tree, today's linux-next build (x86_64
 > allmodconfig) failed like this:

 In file included from include/linux/clk.h:13,
  from drivers/gpu/drm/ingenic/ingenic-drm-drv.c:10:
 drivers/gpu/drm/ingenic/ingenic-drm-drv.c: In function 
'ingenic_drm_update_palette':
 drivers/gpu/drm/ingenic/ingenic-drm-drv.c:448:35: error: 'struct 
ingenic_drm' has no member named 'dma_hwdescs'; did you mean 
'dma_hwdesc_f0'?
   448 |  for (i = 0; i < ARRAY_SIZE(priv->dma_hwdescs->palette); 
i++) {

   |   ^~~
 include/linux/kernel.h:47:33: note: in definition of macro 
'ARRAY_SIZE'
47 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + 
__must_be_array(arr))

   | ^~~
 drivers/gpu/drm/ingenic/ingenic-drm-drv.c:448:35: error: 'struct 
ingenic_drm' has no member named 'dma_hwdescs'; did you mean 
'dma_hwdesc_f0'?
   448 |  for (i = 0; i < ARRAY_SIZE(priv->dma_hwdescs->palette); 
i++) {

   |   ^~~
 include/linux/kernel.h:47:48: note: in definition of macro 
'ARRAY_SIZE'
47 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + 
__must_be_array(arr))

   |^~~
 In file included from include/linux/bits.h:22,
  from include/linux/bitops.h:5,
  from drivers/gpu/drm/ingenic/ingenic-drm.h:10,
  from drivers/gpu/drm/ingenic/ingenic-drm-drv.c:7:
 drivers/gpu/drm/ingenic/ingenic-drm-drv.c:448:35: error: 'struct 
ingenic_drm' has no member named 'dma_hwdescs'; did you mean 
'dma_hwdesc_f0'?
   448 |  for (i = 0; i < ARRAY_SIZE(priv->dma_hwdescs->palette); 
i++) {

   |   ^~~
 include/linux/build_bug.h:16:62: note: in definition of macro 
'BUILD_BUG_ON_ZERO'
16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { 
int:(-!!(e)); })))
   | 
 ^
 include/linux/compiler.h:224:46: note: in expansion of macro 
'__same_type'
   224 | #define __must_be_array(a) 
BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))

   |  ^~~
 include/linux/kernel.h:47:59: note: in expansion of macro 
'__must_be_array'
47 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + 
__must_be_array(arr))
   |   
^~~
 drivers/gpu/drm/ingenic/ingenic-drm-drv.c:448:18: note: in 
expansion of macro 'ARRAY_SIZE'
   448 |  for (i = 0; i < ARRAY_SIZE(priv->dma_hwdescs->palette); 
i++) {

   |  ^~
 drivers/gpu/drm/ingenic/ingenic-drm-drv.c:448:35: error: 'struct 
ingenic_drm' has no member named 'dma_hwdescs'; did you mean 
'dma_hwdesc_f0'?
   448 |  for (i = 0; i < ARRAY_SIZE(priv->dma_hwdescs->palette); 
i++) {

   |   ^~~
 include/linux/build_bug.h:16:62: note: in definition of macro 
'BUILD_BUG_ON_ZERO'
16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { 
int:(-!!(e)); })))
   | 
 ^
 include/linux/compiler.h:224:46: note: in expansion of macro 
'__same_type'
   224 | #define __must_be_array(a) 
BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))

   |  ^~~
 include/linux/kernel.h:47:59: note: in expansion of macro 
'__must_be_array'
47 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + 
__must_be_array(arr))
   |   
^~~
 drivers/gpu/drm/ingenic/ingenic-drm-drv.c:448:18: note: in 
expansion of macro 'ARRAY_SIZE'
   448 |  for (i = 0; i < ARRAY_SIZE(priv->dma_hwdescs->palette); 
i++) {

   |  ^~
 include/linux/build_bug.h:16:51: error: bit-field '' 
width not an integer constant
16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { 
int:(-!!(e)); })))

   |   ^
 include/linux/compiler.h:224:28: note: in expansion of macro 
'BUILD_BUG_ON_ZERO'
   224 | #define __must_be_array(a) 
BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))

   |^
 include/linux/kernel.h:47:59: note: in expansion of macro 
'__must_be_array'
47 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + 
__must_be_array(arr))
   |   
^~~
 drivers/gpu/drm/ingenic/ingenic-drm-drv.c:448:18: note: in 
expansion of macro 'ARRAY_SIZE'
   448 |  for (i = 0; i < ARRAY_SIZE(priv->dma_hwdescs->palette); 
i++) {

  

Re: [Intel-gfx] linux-next: build failure after merge of the drm-misc tree

2020-10-13 Thread Paul Cercueil

Hi Stephen,

Le lun. 12 oct. 2020 à 15:24, Stephen Rothwell  
a écrit :

Hi all,

On Thu, 8 Oct 2020 15:42:02 +1100 Stephen Rothwell 
 wrote:


 On Thu, 8 Oct 2020 14:09:03 +1100 Stephen Rothwell 
 wrote:

 >
 > After merging the drm-misc tree, today's linux-next build (x86_64
 > allmodconfig) failed like this:

 In file included from include/linux/clk.h:13,
  from drivers/gpu/drm/ingenic/ingenic-drm-drv.c:10:
 drivers/gpu/drm/ingenic/ingenic-drm-drv.c: In function 
'ingenic_drm_update_palette':
 drivers/gpu/drm/ingenic/ingenic-drm-drv.c:448:35: error: 'struct 
ingenic_drm' has no member named 'dma_hwdescs'; did you mean 
'dma_hwdesc_f0'?
   448 |  for (i = 0; i < ARRAY_SIZE(priv->dma_hwdescs->palette); 
i++) {

   |   ^~~
 include/linux/kernel.h:47:33: note: in definition of macro 
'ARRAY_SIZE'
47 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + 
__must_be_array(arr))

   | ^~~
 drivers/gpu/drm/ingenic/ingenic-drm-drv.c:448:35: error: 'struct 
ingenic_drm' has no member named 'dma_hwdescs'; did you mean 
'dma_hwdesc_f0'?
   448 |  for (i = 0; i < ARRAY_SIZE(priv->dma_hwdescs->palette); 
i++) {

   |   ^~~
 include/linux/kernel.h:47:48: note: in definition of macro 
'ARRAY_SIZE'
47 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + 
__must_be_array(arr))

   |^~~
 In file included from include/linux/bits.h:22,
  from include/linux/bitops.h:5,
  from drivers/gpu/drm/ingenic/ingenic-drm.h:10,
  from drivers/gpu/drm/ingenic/ingenic-drm-drv.c:7:
 drivers/gpu/drm/ingenic/ingenic-drm-drv.c:448:35: error: 'struct 
ingenic_drm' has no member named 'dma_hwdescs'; did you mean 
'dma_hwdesc_f0'?
   448 |  for (i = 0; i < ARRAY_SIZE(priv->dma_hwdescs->palette); 
i++) {

   |   ^~~
 include/linux/build_bug.h:16:62: note: in definition of macro 
'BUILD_BUG_ON_ZERO'
16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { 
int:(-!!(e)); })))
   | 
 ^
 include/linux/compiler.h:224:46: note: in expansion of macro 
'__same_type'
   224 | #define __must_be_array(a) 
BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))

   |  ^~~
 include/linux/kernel.h:47:59: note: in expansion of macro 
'__must_be_array'
47 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + 
__must_be_array(arr))
   |   
^~~
 drivers/gpu/drm/ingenic/ingenic-drm-drv.c:448:18: note: in 
expansion of macro 'ARRAY_SIZE'
   448 |  for (i = 0; i < ARRAY_SIZE(priv->dma_hwdescs->palette); 
i++) {

   |  ^~
 drivers/gpu/drm/ingenic/ingenic-drm-drv.c:448:35: error: 'struct 
ingenic_drm' has no member named 'dma_hwdescs'; did you mean 
'dma_hwdesc_f0'?
   448 |  for (i = 0; i < ARRAY_SIZE(priv->dma_hwdescs->palette); 
i++) {

   |   ^~~
 include/linux/build_bug.h:16:62: note: in definition of macro 
'BUILD_BUG_ON_ZERO'
16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { 
int:(-!!(e)); })))
   | 
 ^
 include/linux/compiler.h:224:46: note: in expansion of macro 
'__same_type'
   224 | #define __must_be_array(a) 
BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))

   |  ^~~
 include/linux/kernel.h:47:59: note: in expansion of macro 
'__must_be_array'
47 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + 
__must_be_array(arr))
   |   
^~~
 drivers/gpu/drm/ingenic/ingenic-drm-drv.c:448:18: note: in 
expansion of macro 'ARRAY_SIZE'
   448 |  for (i = 0; i < ARRAY_SIZE(priv->dma_hwdescs->palette); 
i++) {

   |  ^~
 include/linux/build_bug.h:16:51: error: bit-field '' 
width not an integer constant
16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { 
int:(-!!(e)); })))

   |   ^
 include/linux/compiler.h:224:28: note: in expansion of macro 
'BUILD_BUG_ON_ZERO'
   224 | #define __must_be_array(a) 
BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))

   |^
 include/linux/kernel.h:47:59: note: in expansion of macro 
'__must_be_array'
47 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + 
__must_be_array(arr))
   |   
^~~
 drivers/gpu/drm/ingenic/ingenic-drm-drv.c:448:18: note: in 
expansion of macro 'ARRAY_SIZE'
   448 |  for (i = 0; i < ARRAY_SIZE(priv->dma_hwdescs->palette); 
i++) {

  

Re: [Intel-gfx] [PATCH] drm/ingenic: Fix bad revert

2020-10-13 Thread Paul Cercueil




Le lun. 12 oct. 2020 à 16:10, Daniel Vetter  a écrit 
:

On Mon, Oct 12, 2020 at 12:25:09PM +0200, Paul Cercueil wrote:
 Fix a badly reverted commit. The revert commit was cherry-picked 
from
 drm-misc-next to drm-misc-next-fixes, and in the process some 
unrelated

 code was added.

 Fixes: a3fb64c00d44 "Revert "gpu/drm: ingenic: Add option to mmap 
GEM buffers cached""

 Signed-off-by: Paul Cercueil 


Acked-by: Daniel Vetter 


I applied the patch to drm-misc-next-fixes.

Thanks,
-Paul


And yes if you use git cherry-pick it'll do a 3 way merge, and
occasionally it's very tricky to resolve that properly. Especially 
when

you're not used to it.

What I tend to do to double check cerry-picks is git show both 
commits,
and compare the entire diff line-by-line to make sure I didn't 
misplace

anything.

Another trick is to use the raw patch instead of cherry-pick, since 
that
won't do a 3 way merge where you might get confused with other 
context and

fun stuff like that.

Cheers, Daniel

 ---
  drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 16 
  1 file changed, 16 deletions(-)

 diff --git a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c 
b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c

 index 1be1235bd546..a3d1617d7c67 100644
 --- a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
 +++ b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
 @@ -440,20 +440,6 @@ void ingenic_drm_plane_config(struct device 
*dev,

}
  }

 -static void ingenic_drm_update_palette(struct ingenic_drm *priv,
 - const struct drm_color_lut *lut)
 -{
 -  unsigned int i;
 -
 -  for (i = 0; i < ARRAY_SIZE(priv->dma_hwdescs->palette); i++) {
 -  u16 color = drm_color_lut_extract(lut[i].red, 5) << 11
 -  | drm_color_lut_extract(lut[i].green, 6) << 5
 -  | drm_color_lut_extract(lut[i].blue, 5);
 -
 -  priv->dma_hwdescs->palette[i] = color;
 -  }
 -}
 -
  static void ingenic_drm_plane_atomic_update(struct drm_plane 
*plane,

struct drm_plane_state *oldstate)
  {
 @@ -464,8 +450,6 @@ static void 
ingenic_drm_plane_atomic_update(struct drm_plane *plane,

dma_addr_t addr;

if (state && state->fb) {
 -  crtc_state = state->crtc->state;
 -
addr = drm_fb_cma_get_gem_addr(state->fb, state, 0);
width = state->src_w >> 16;
height = state->src_h >> 16;
 --
 2.28.0



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



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


Re: [Intel-gfx] [PATCH 16/51] drm/inigenic: Use drmm_add_final_kfree

2020-03-03 Thread Paul Cercueil

Hi Daniel,


Le jeu., févr. 27, 2020 at 19:14, Daniel Vetter 
 a écrit :

With this we can drop the final kfree from the release function.

Signed-off-by: Daniel Vetter 
Cc: Paul Cercueil 


Reviewed-by: Paul Cercueil 

Cheers,
-Paul


---
 drivers/gpu/drm/ingenic/ingenic-drm.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/ingenic/ingenic-drm.c 
b/drivers/gpu/drm/ingenic/ingenic-drm.c

index 9dfe7cb530e1..e2c832eb4e9a 100644
--- a/drivers/gpu/drm/ingenic/ingenic-drm.c
+++ b/drivers/gpu/drm/ingenic/ingenic-drm.c
@@ -23,6 +23,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -490,11 +491,8 @@ static irqreturn_t ingenic_drm_irq_handler(int 
irq, void *arg)


 static void ingenic_drm_release(struct drm_device *drm)
 {
-   struct ingenic_drm *priv = drm_device_get_priv(drm);
-
drm_mode_config_cleanup(drm);
drm_dev_fini(drm);
-   kfree(priv);
 }

 static int ingenic_drm_enable_vblank(struct drm_crtc *crtc)
@@ -639,6 +637,7 @@ static int ingenic_drm_probe(struct 
platform_device *pdev)

kfree(priv);
return ret;
}
+   drmm_add_final_kfree(drm, priv);

drm_mode_config_init(drm);
drm->mode_config.min_width = 0;
--
2.24.1




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


Re: [Intel-gfx] [PATCH 31/51] drm/ingenic: Drop explicit drm_mode_config_cleanup call

2020-03-03 Thread Paul Cercueil

Hi Daniel,


Le jeu., févr. 27, 2020 at 19:15, Daniel Vetter 
 a écrit :

Allows us to drop the drm_driver.release callback.

This is made possible by a preceeding patch which added a drmm_
cleanup action to drm_mode_config_init(), hence all we need to do to
ensure that drm_mode_config_cleanup() is run on final drm_device
cleanup is check the new error code for _init().

v2: Explain why this cleanup is possible (Laurent).

Cc: Laurent Pinchart 
Signed-off-by: Daniel Vetter 
Cc: Paul Cercueil 


Reviewed-by: Paul Cercueil 

Cheers,
-Paul


---
 drivers/gpu/drm/ingenic/ingenic-drm.c | 11 ---
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/ingenic/ingenic-drm.c 
b/drivers/gpu/drm/ingenic/ingenic-drm.c

index 192aaa4421a3..f5689521428e 100644
--- a/drivers/gpu/drm/ingenic/ingenic-drm.c
+++ b/drivers/gpu/drm/ingenic/ingenic-drm.c
@@ -489,11 +489,6 @@ static irqreturn_t ingenic_drm_irq_handler(int 
irq, void *arg)

return IRQ_HANDLED;
 }

-static void ingenic_drm_release(struct drm_device *drm)
-{
-   drm_mode_config_cleanup(drm);
-}
-
 static int ingenic_drm_enable_vblank(struct drm_crtc *crtc)
 {
struct ingenic_drm *priv = drm_crtc_get_priv(crtc);
@@ -537,7 +532,6 @@ static struct drm_driver ingenic_drm_driver_data 
= {

.gem_prime_mmap = drm_gem_cma_prime_mmap,

.irq_handler= ingenic_drm_irq_handler,
-   .release= ingenic_drm_release,
 };

 static const struct drm_plane_funcs ingenic_drm_primary_plane_funcs 
= {
@@ -638,7 +632,10 @@ static int ingenic_drm_probe(struct 
platform_device *pdev)

}
drmm_add_final_kfree(drm, priv);

-   drm_mode_config_init(drm);
+   ret = drm_mode_config_init(drm);
+   if (ret)
+   return ret;
+
drm->mode_config.min_width = 0;
drm->mode_config.min_height = 0;
drm->mode_config.max_width = soc_info->max_width;
--
2.24.1




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


[Intel-gfx] [PATCH v2 26/26] drm/i915/gt: Remove #ifdef guards for PM related functions

2022-11-29 Thread Paul Cercueil
Instead of defining two versions of intel_sysfs_rc6_init(), one for each
value of CONFIG_PM, add a check on !IS_ENABLED(CONFIG_PM) early in the
function. This will allow the compiler to automatically drop the dead
code when CONFIG_PM is disabled, without having to use #ifdef guards.

This has the advantage of always compiling these functions in,
independently of any Kconfig option. Thanks to that, bugs and other
regressions are subsequently easier to catch.

Signed-off-by: Paul Cercueil 
---
Cc: Jani Nikula 
Cc: Joonas Lahtinen 
Cc: Rodrigo Vivi 
Cc: Tvrtko Ursulin 
Cc: intel-gfx@lists.freedesktop.org
---
 drivers/gpu/drm/i915/gt/intel_gt_sysfs_pm.c | 8 +---
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/i915/gt/intel_gt_sysfs_pm.c 
b/drivers/gpu/drm/i915/gt/intel_gt_sysfs_pm.c
index cf71305ad586..09b9365ededd 100644
--- a/drivers/gpu/drm/i915/gt/intel_gt_sysfs_pm.c
+++ b/drivers/gpu/drm/i915/gt/intel_gt_sysfs_pm.c
@@ -164,7 +164,6 @@ sysfs_gt_attribute_r_func(struct kobject *kobj, struct 
attribute *attr,
 NULL); 
\
INTEL_GT_ATTR_RO(_name)
 
-#ifdef CONFIG_PM
 static u32 get_residency(struct intel_gt *gt, enum intel_rc6_res_type id)
 {
intel_wakeref_t wakeref;
@@ -300,7 +299,7 @@ static void intel_sysfs_rc6_init(struct intel_gt *gt, 
struct kobject *kobj)
 {
int ret;
 
-   if (!HAS_RC6(gt->i915))
+   if (!IS_ENABLED(CONFIG_PM) || !HAS_RC6(gt->i915))
return;
 
ret = __intel_gt_sysfs_create_group(kobj, rc6_attr_group);
@@ -329,11 +328,6 @@ static void intel_sysfs_rc6_init(struct intel_gt *gt, 
struct kobject *kobj)
 gt->info.id, ERR_PTR(ret));
}
 }
-#else
-static void intel_sysfs_rc6_init(struct intel_gt *gt, struct kobject *kobj)
-{
-}
-#endif /* CONFIG_PM */
 
 static u32 __act_freq_mhz_show(struct intel_gt *gt)
 {
-- 
2.35.1



Re: [Intel-gfx] [PATCH] drm/i915: Remove CONFIG_PM dependency from RC6.

2022-12-07 Thread Paul Cercueil
Hi Rodrigo,

Le mercredi 30 novembre 2022 à 13:37 +, Vivi, Rodrigo a écrit :
> On Wed, 2022-11-30 at 11:47 +, Tvrtko Ursulin wrote:
> > 
> > On 30/11/2022 02:29, Rodrigo Vivi wrote:
> > > RC6 is a sleep state that doesn't depend on the cpu sleep,
> > > or any of the APM or ACPI or anything related to the
> > > CONFIG_PM.
> > > 
> > > A long time ago we have removed the module parameter
> > > that allows the RC6 disablement. We want that feature enabled
> > > everywhere. However, for some reason this CONFIG_PM was long
> > > forgotten behind.
> > > 
> > > If we end up needing knobs to disable RC6 we should create
> > > individual ones, rather than relying on this master one.
> > 
> > Digging in history shows 5ab3633d6907 ("drm/i915: make rc6 in sysfs
> > functions conditional") and then it appears the issue could still
> > be 
> > present, since we still use power_group_name which is NULL when
> > !CONFIG_PM.
> 
> oh, indeed!
> So, we should probably go with Paul's proposal:
> https://lists.freedesktop.org/archives/intel-gfx/2022-November/311569.html

Could you ack it then? Or is there something to change?

Cheers,
-Paul

> > 
> > $ ls -l /sys/class/drm/card0/power/
> > total 0
> > -rw-r--r-- 1 root root 4096 Nov 30 11:45 async
> > -rw-r--r-- 1 root root 4096 Nov 30 11:45 autosuspend_delay_ms
> > -rw-r--r-- 1 root root 4096 Nov 30 11:45 control
> > -r--r--r-- 1 root root 4096 Nov 30 11:45 rc6_enable
> > -r--r--r-- 1 root root 4096 Nov 30 11:45 rc6_residency_ms
> > -r--r--r-- 1 root root 4096 Nov 30 11:45 runtime_active_kids
> > -r--r--r-- 1 root root 4096 Nov 30 11:45 runtime_active_time
> > -r--r--r-- 1 root root 4096 Nov 30 11:45 runtime_enabled
> > -r--r--r-- 1 root root 4096 Nov 30 11:45 runtime_status
> > -r--r--r-- 1 root root 4096 Nov 30 11:45 runtime_suspended_time
> > -r--r--r-- 1 root root 4096 Nov 30 11:45 runtime_usage
> > 
> > Other than rc6 entries I guess come from somewhere else but I
> > haven't
> > looked from where exactly.
> 
> 
> Ouch! Everything else here comes from the pci's pm_runtime.
> Probably our bad decision was to add rc6 to it.
> But we do need to stick to that.
> 
> 
> > 
> > Regards,
> > 
> > Tvrtko
> > 
> > > Cc: Paul Cercueil 
> > > Signed-off-by: Rodrigo Vivi 
> > > ---
> > >   drivers/gpu/drm/i915/gt/intel_gt_sysfs_pm.c | 6 --
> > >   1 file changed, 6 deletions(-)
> > > 
> > > diff --git a/drivers/gpu/drm/i915/gt/intel_gt_sysfs_pm.c
> > > b/drivers/gpu/drm/i915/gt/intel_gt_sysfs_pm.c
> > > index cf71305ad586..77327ede18ad 100644
> > > --- a/drivers/gpu/drm/i915/gt/intel_gt_sysfs_pm.c
> > > +++ b/drivers/gpu/drm/i915/gt/intel_gt_sysfs_pm.c
> > > @@ -164,7 +164,6 @@ sysfs_gt_attribute_r_func(struct kobject
> > > *kobj,
> > > struct attribute *attr,
> > > 
> > > NULL); \
> > > INTEL_GT_ATTR_RO(_name)
> > >   
> > > -#ifdef CONFIG_PM
> > >   static u32 get_residency(struct intel_gt *gt, enum
> > > intel_rc6_res_type id)
> > >   {
> > > intel_wakeref_t wakeref;
> > > @@ -329,11 +328,6 @@ static void intel_sysfs_rc6_init(struct
> > > intel_gt *gt, struct kobject *kobj)
> > >  gt->info.id, ERR_PTR(ret));
> > > }
> > >   }
> > > -#else
> > > -static void intel_sysfs_rc6_init(struct intel_gt *gt, struct
> > > kobject *kobj)
> > > -{
> > > -}
> > > -#endif /* CONFIG_PM */
> > >   
> > >   static u32 __act_freq_mhz_show(struct intel_gt *gt)
> > >   {
> 
> 



[Intel-gfx] [PATCH 26/26] drm/i915/gt: Remove #ifdef guards for PM related functions

2022-11-07 Thread Paul Cercueil
Instead of defining two versions of intel_sysfs_rc6_init(), one for each
value of CONFIG_PM, add a check on !IS_ENABLED(CONFIG_PM) early in the
function. This will allow the compiler to automatically drop the dead
code when CONFIG_PM is disabled, without having to use #ifdef guards.

This has the advantage of always compiling these functions in,
independently of any Kconfig option. Thanks to that, bugs and other
regressions are subsequently easier to catch.

Signed-off-by: Paul Cercueil 
---
Cc: Jani Nikula 
Cc: Joonas Lahtinen 
Cc: Rodrigo Vivi 
Cc: Tvrtko Ursulin 
Cc: intel-gfx@lists.freedesktop.org
---
 drivers/gpu/drm/i915/gt/intel_gt_sysfs_pm.c | 8 +---
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/i915/gt/intel_gt_sysfs_pm.c 
b/drivers/gpu/drm/i915/gt/intel_gt_sysfs_pm.c
index 2b5f05b31187..decf892a4508 100644
--- a/drivers/gpu/drm/i915/gt/intel_gt_sysfs_pm.c
+++ b/drivers/gpu/drm/i915/gt/intel_gt_sysfs_pm.c
@@ -164,7 +164,6 @@ sysfs_gt_attribute_r_func(struct kobject *kobj, struct 
attribute *attr,
 NULL); 
\
INTEL_GT_ATTR_RO(_name)
 
-#ifdef CONFIG_PM
 static u32 get_residency(struct intel_gt *gt, i915_reg_t reg)
 {
intel_wakeref_t wakeref;
@@ -300,7 +299,7 @@ static void intel_sysfs_rc6_init(struct intel_gt *gt, 
struct kobject *kobj)
 {
int ret;
 
-   if (!HAS_RC6(gt->i915))
+   if (!IS_ENABLED(CONFIG_PM) || !HAS_RC6(gt->i915))
return;
 
ret = __intel_gt_sysfs_create_group(kobj, rc6_attr_group);
@@ -329,11 +328,6 @@ static void intel_sysfs_rc6_init(struct intel_gt *gt, 
struct kobject *kobj)
 gt->info.id, ERR_PTR(ret));
}
 }
-#else
-static void intel_sysfs_rc6_init(struct intel_gt *gt, struct kobject *kobj)
-{
-}
-#endif /* CONFIG_PM */
 
 static u32 __act_freq_mhz_show(struct intel_gt *gt)
 {
-- 
2.35.1



Re: [Intel-gfx] [PATCH 26/26] drm/i915/gt: Remove #ifdef guards for PM related functions

2022-11-21 Thread Paul Cercueil

Hi Rodrigo,

Le lun. 7 nov. 2022 à 15:31:49 -0500, Rodrigo Vivi 
 a écrit :

On Mon, Nov 07, 2022 at 05:55:10PM +, Paul Cercueil wrote:
 Instead of defining two versions of intel_sysfs_rc6_init(), one for 
each
 value of CONFIG_PM, add a check on !IS_ENABLED(CONFIG_PM) early in 
the
 function. This will allow the compiler to automatically drop the 
dead
 code when CONFIG_PM is disabled, without having to use #ifdef 
guards.


Making the RC6 to depend on the CONFIG_PM is probably an historical
mistake and probably the right solution is simply to remove that
dependency.


I don't know anything about i915, so the best I can do is update the 
code without changing the functionality.


Then someone with a better understanding can send a patch to remove the 
check on CONFIG_PM.


Cheers,
-Paul



 This has the advantage of always compiling these functions in,
 independently of any Kconfig option. Thanks to that, bugs and other
 regressions are subsequently easier to catch.

 Signed-off-by: Paul Cercueil 
 ---
 Cc: Jani Nikula 
 Cc: Joonas Lahtinen 
 Cc: Rodrigo Vivi 
 Cc: Tvrtko Ursulin 
 Cc: intel-gfx@lists.freedesktop.org
 ---
  drivers/gpu/drm/i915/gt/intel_gt_sysfs_pm.c | 8 +---
  1 file changed, 1 insertion(+), 7 deletions(-)

 diff --git a/drivers/gpu/drm/i915/gt/intel_gt_sysfs_pm.c 
b/drivers/gpu/drm/i915/gt/intel_gt_sysfs_pm.c

 index 2b5f05b31187..decf892a4508 100644
 --- a/drivers/gpu/drm/i915/gt/intel_gt_sysfs_pm.c
 +++ b/drivers/gpu/drm/i915/gt/intel_gt_sysfs_pm.c
 @@ -164,7 +164,6 @@ sysfs_gt_attribute_r_func(struct kobject *kobj, 
struct attribute *attr,

 NULL); 
\
INTEL_GT_ATTR_RO(_name)

 -#ifdef CONFIG_PM
  static u32 get_residency(struct intel_gt *gt, i915_reg_t reg)
  {
intel_wakeref_t wakeref;
 @@ -300,7 +299,7 @@ static void intel_sysfs_rc6_init(struct 
intel_gt *gt, struct kobject *kobj)

  {
int ret;

 -  if (!HAS_RC6(gt->i915))
 +  if (!IS_ENABLED(CONFIG_PM) || !HAS_RC6(gt->i915))
return;

ret = __intel_gt_sysfs_create_group(kobj, rc6_attr_group);
 @@ -329,11 +328,6 @@ static void intel_sysfs_rc6_init(struct 
intel_gt *gt, struct kobject *kobj)

 gt->info.id, ERR_PTR(ret));
}
  }
 -#else
 -static void intel_sysfs_rc6_init(struct intel_gt *gt, struct 
kobject *kobj)

 -{
 -}
 -#endif /* CONFIG_PM */

  static u32 __act_freq_mhz_show(struct intel_gt *gt)
  {
 --
 2.35.1






Re: [PATCH 22/86] drm/ingenic: Run DRM default client setup

2024-08-17 Thread Paul Cercueil
Hi Thomas,

Le vendredi 16 août 2024 à 14:22 +0200, Thomas Zimmermann a écrit :
> Call drm_client_setup() to run the kernel's default client setup
> for DRM. Set fbdev_probe in struct drm_driver, so that the client
> setup can start the common fbdev client.
> 
> The ingenic driver specifies a preferred color mode of 32. As this
> is the default if no format has been given, leave it out entirely.
> 
> Signed-off-by: Thomas Zimmermann 
> Cc: Paul Cercueil 

Acked-by: Paul Cercueil 

Cheers,
-Paul

> ---
>  drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
> b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
> index 39fa291f43dd..056b70b63554 100644
> --- a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
> +++ b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
> @@ -24,6 +24,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -960,6 +961,7 @@ static const struct drm_driver
> ingenic_drm_driver_data = {
>   .fops   = &ingenic_drm_fops,
>   .gem_create_object  = ingenic_drm_gem_create_object,
>   DRM_GEM_DMA_DRIVER_OPS,
> + DRM_FBDEV_DMA_DRIVER_OPS,
>  };
>  
>  static const struct drm_plane_funcs ingenic_drm_primary_plane_funcs
> = {
> @@ -1399,7 +1401,7 @@ static int ingenic_drm_bind(struct device *dev,
> bool has_components)
>   goto err_clk_notifier_unregister;
>   }
>  
> - drm_fbdev_dma_setup(drm, 32);
> + drm_client_setup(drm, NULL);
>  
>   return 0;
>