Hi all,
This patch adds support for the zpos plane prop in the VKMS driver.
It should be applied after the "drm/vkms: add support for multiple
overlay planes" series [1] because this new patch takes advantage of
the new constant "NUM_OVERLAY_PLANES" to set the maximum overlay
plane zpos.
Notice that, as explained in the commit message, there is one test
failling (plane-immutable-zpos) because of the timeout capturing CRC.
This is a known bug [2] that needs to be fixed in a different series.
It happens when the primary plane is disabled. The vkms_composer.c
vkms_composer_worker() function is not able to find the
"primary_composer" variable and the test fails.
As a quick fix, commenting the line:
if (act_plane->base.base.plane->type == DRM_PLANE_TYPE_PRIMARY)
Fixes the issue. However, more work is required to properly clear the
background and blend the first active plane. I'll look into it,
feedback from someone that already investigated the issue is welcome :)
Thanks in advance,
José Expósito
[1] https://lore.kernel.org/dri-devel/[email protected]/T/
[2] https://www.kernel.org/doc/html/latest/gpu/vkms.html#igt-better-support
José Expósito (1):
drm/vkms: add zpos plane property
drivers/gpu/drm/vkms/vkms_crtc.c | 3 +--
drivers/gpu/drm/vkms/vkms_drv.c | 1 +
drivers/gpu/drm/vkms/vkms_plane.c | 23 +++++++++++++++++++++++
3 files changed, 25 insertions(+), 2 deletions(-)
--
2.25.1
Add support for the zpos plane property. Depending on the plane type:
- Primary and cursor planes: Create an immutable zpos property. The
primary plane is always at the bottom and the cursor plane is always
on the top.
- Overlay planes: Create a mutable zpos property allowing to change
their order but always keep them between the primary and cursor
planes.
As documented, "vkms_crtc_state.active_planes" must be sorted by zpos.
This is achieved by inserting them in the array at their
normalized_zpos index.
The following igt-gpu-tools tests were executed:
| master branch | this patch |
| SUCCESS | SKIP | FAIL | SUCCESS | SKIP | FAIL |
kms_atomic | 10 | 02 | 00 | 09 | 02 | 01 |
kms_plane | 06 | 00 | 14 | 06 | 00 | 14 |
kms_plane_cursor | 09 | 45 | 00 | 09 | 45 | 00 |
kms_plane_multiple | 01 | 23 | 00 | 01 | 23 | 00 |
kms_writeback | 04 | 00 | 00 | 04 | 00 | 00 |
Notice that there is one test failing in the kms_atomic row
(plane-immutable-zpos) but it is due to timeout capturing CRC.
This happens when the primary plane is disabled and the composer is not
able to find the "primary_composer" variable.
While the timeout bug needs to be fixed in a different series, the zpos
property works as expected.
Signed-off-by: José Expósito <[email protected]>
---
v2:
- Use number of planes constant introduced in "drm/vkms: add support
for multiple overlay planes" v2
- Add a test results in the commit message
---
drivers/gpu/drm/vkms/vkms_crtc.c | 3 +--
drivers/gpu/drm/vkms/vkms_drv.c | 1 +
drivers/gpu/drm/vkms/vkms_plane.c | 23 +++++++++++++++++++++++
3 files changed, 25 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/vkms/vkms_crtc.c b/drivers/gpu/drm/vkms/vkms_crtc.c
index 57bbd32e9beb..4f23488b15f3 100644
--- a/drivers/gpu/drm/vkms/vkms_crtc.c
+++ b/drivers/gpu/drm/vkms/vkms_crtc.c
@@ -207,7 +207,6 @@ static int vkms_crtc_atomic_check(struct drm_crtc *crtc,
return -ENOMEM;
vkms_state->num_active_planes = i;
- i = 0;
drm_for_each_plane_mask(plane, crtc->dev, crtc_state->plane_mask) {
plane_state = drm_atomic_get_existing_plane_state(crtc_state->state,
plane);
@@ -215,7 +214,7 @@ static int vkms_crtc_atomic_check(struct drm_crtc *crtc,
if (!plane_state->visible)
continue;
- vkms_state->active_planes[i++] =
+ vkms_state->active_planes[plane_state->normalized_zpos] =
to_vkms_plane_state(plane_state);
}
diff --git a/drivers/gpu/drm/vkms/vkms_drv.c b/drivers/gpu/drm/vkms/vkms_drv.c
index 0ffe5f0e33f7..d7ee64f5e339 100644
--- a/drivers/gpu/drm/vkms/vkms_drv.c
+++ b/drivers/gpu/drm/vkms/vkms_drv.c
@@ -153,6 +153,7 @@ static int vkms_modeset_init(struct vkms_device *vkmsdev)
* fbdev helpers. We have to go with 0, meaning "pick the default",
* which ix XRGB8888 in all cases. */
dev->mode_config.preferred_depth = 0;
+ dev->mode_config.normalize_zpos = true;
dev->mode_config.helper_private = &vkms_mode_config_helpers;
return vkms_output_init(vkmsdev, 0);
diff --git a/drivers/gpu/drm/vkms/vkms_plane.c b/drivers/gpu/drm/vkms/vkms_plane.c
index 32409e15244b..55d22a6a401a 100644
--- a/drivers/gpu/drm/vkms/vkms_plane.c
+++ b/drivers/gpu/drm/vkms/vkms_plane.c
@@ -81,6 +81,8 @@ static void vkms_plane_reset(struct drm_plane *plane)
}
__drm_gem_reset_shadow_plane(plane, &vkms_state->base);
+ vkms_state->base.base.zpos = drm_plane_index(plane);
+ vkms_state->base.base.normalized_zpos = drm_plane_index(plane);
}
static const struct drm_plane_funcs vkms_plane_funcs = {
@@ -158,6 +160,22 @@ static const struct drm_plane_helper_funcs vkms_primary_helper_funcs = {
DRM_GEM_SHADOW_PLANE_HELPER_FUNCS,
};
+static int vkms_plane_create_zpos_property(struct vkms_plane *plane)
+{
+ int ret;
+ unsigned int zpos = drm_plane_index(&plane->base);
+
+ if (plane->base.type == DRM_PLANE_TYPE_OVERLAY) {
+ ret = drm_plane_create_zpos_property(&plane->base, zpos,
+ 1, NUM_OVERLAY_PLANES);
+ } else {
+ ret = drm_plane_create_zpos_immutable_property(&plane->base,
+ zpos);
+ }
+
+ return ret;
+}
+
struct vkms_plane *vkms_plane_init(struct vkms_device *vkmsdev,
enum drm_plane_type type, int index)
{
@@ -166,6 +184,7 @@ struct vkms_plane *vkms_plane_init(struct vkms_device *vkmsdev,
struct vkms_plane *plane;
const u32 *formats;
int nformats;
+ int ret;
switch (type) {
case DRM_PLANE_TYPE_PRIMARY:
@@ -195,5 +214,9 @@ struct vkms_plane *vkms_plane_init(struct vkms_device *vkmsdev,
drm_plane_helper_add(&plane->base, funcs);
+ ret = vkms_plane_create_zpos_property(plane);
+ if (ret)
+ return ERR_PTR(ret);
+
return plane;
}
--
2.25.1
Hi "Jos?,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on drm/drm-next]
[also build test ERROR on v5.16-rc6 next-20211224]
[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/Jos-Exp-sito/drm-vkms-zpos/20211226-191434
base: git://anongit.freedesktop.org/drm/drm drm-next
config: hexagon-randconfig-r041-20211226 (https://download.01.org/0day-ci/archive/20211226/[email protected]/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 0c553cc1af2e4c14100df6cf4a6fc91987e778e6)
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
# https://github.com/0day-ci/linux/commit/48c96494b71972f4bf1769682e94e59724dba874
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Jos-Exp-sito/drm-vkms-zpos/20211226-191434
git checkout 48c96494b71972f4bf1769682e94e59724dba874
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash drivers/gpu/drm/vkms/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>
All errors (new ones prefixed by >>):
>> drivers/gpu/drm/vkms/vkms_plane.c:170:15: error: use of undeclared identifier 'NUM_OVERLAY_PLANES'
1, NUM_OVERLAY_PLANES);
^
1 error generated.
vim +/NUM_OVERLAY_PLANES +170 drivers/gpu/drm/vkms/vkms_plane.c
162
163 static int vkms_plane_create_zpos_property(struct vkms_plane *plane)
164 {
165 int ret;
166 unsigned int zpos = drm_plane_index(&plane->base);
167
168 if (plane->base.type == DRM_PLANE_TYPE_OVERLAY) {
169 ret = drm_plane_create_zpos_property(&plane->base, zpos,
> 170 1, NUM_OVERLAY_PLANES);
171 } else {
172 ret = drm_plane_create_zpos_immutable_property(&plane->base,
173 zpos);
174 }
175
176 return ret;
177 }
178
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]
Hi "Jos?,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on drm/drm-next]
[also build test ERROR on v5.16-rc6 next-20211224]
[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/Jos-Exp-sito/drm-vkms-zpos/20211226-191434
base: git://anongit.freedesktop.org/drm/drm drm-next
config: arc-randconfig-r043-20211226 (https://download.01.org/0day-ci/archive/20211226/[email protected]/config)
compiler: arceb-elf-gcc (GCC) 11.2.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
# https://github.com/0day-ci/linux/commit/48c96494b71972f4bf1769682e94e59724dba874
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Jos-Exp-sito/drm-vkms-zpos/20211226-191434
git checkout 48c96494b71972f4bf1769682e94e59724dba874
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=arc SHELL=/bin/bash drivers/gpu/drm/vkms/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>
All errors (new ones prefixed by >>):
drivers/gpu/drm/vkms/vkms_plane.c: In function 'vkms_plane_create_zpos_property':
>> drivers/gpu/drm/vkms/vkms_plane.c:170:57: error: 'NUM_OVERLAY_PLANES' undeclared (first use in this function)
170 | 1, NUM_OVERLAY_PLANES);
| ^~~~~~~~~~~~~~~~~~
drivers/gpu/drm/vkms/vkms_plane.c:170:57: note: each undeclared identifier is reported only once for each function it appears in
vim +/NUM_OVERLAY_PLANES +170 drivers/gpu/drm/vkms/vkms_plane.c
162
163 static int vkms_plane_create_zpos_property(struct vkms_plane *plane)
164 {
165 int ret;
166 unsigned int zpos = drm_plane_index(&plane->base);
167
168 if (plane->base.type == DRM_PLANE_TYPE_OVERLAY) {
169 ret = drm_plane_create_zpos_property(&plane->base, zpos,
> 170 1, NUM_OVERLAY_PLANES);
171 } else {
172 ret = drm_plane_create_zpos_immutable_property(&plane->base,
173 zpos);
174 }
175
176 return ret;
177 }
178
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]