* [PATCH] drm/vkms: Add overlay plane support
@ 2019-03-02 13:04 Mamta Shukla
2019-03-03 20:41 ` kbuild test robot
2019-03-03 20:45 ` kbuild test robot
0 siblings, 2 replies; 3+ messages in thread
From: Mamta Shukla @ 2019-03-02 13:04 UTC (permalink / raw)
To: dri-devel
Cc: manasi.d.navare, daniel.vetter, rodrigosiqueiramelo, hamohammed.sa
Add overlay plane support in vkms aligned with cursor and primary
plane with module option 'enable_overlay' to enable/disable overlay
plane while testing.
This currently passes plane-position-covered-pipe-A-plane subtest
from IGT kms_plane test.
Signed-off-by: Mamta Shukla <mamtashukla555@gmail.com>
---
drivers/gpu/drm/vkms/vkms_crc.c | 36 +++++++++++++++++++++++++++----
drivers/gpu/drm/vkms/vkms_drv.c | 4 ++++
drivers/gpu/drm/vkms/vkms_drv.h | 8 +++++++
drivers/gpu/drm/vkms/vkms_plane.c | 36 ++++++++++++++++++++++++++++++-
4 files changed, 79 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/vkms/vkms_crc.c b/drivers/gpu/drm/vkms/vkms_crc.c
index 5135642fb204..a07c50484b3d 100644
--- a/drivers/gpu/drm/vkms/vkms_crc.c
+++ b/drivers/gpu/drm/vkms/vkms_crc.c
@@ -108,6 +108,25 @@ static void blend(void *vaddr_dst, void *vaddr_src,
}
}
+static void compose_overlay(struct vkms_crc_data *overlay_crc,
+ struct vkms_crc_data *primary_crc, void *vaddr_out) {
+ struct drm_gem_object *overlay_obj;
+ struct vkms_gem_object *overlay_vkms_obj;
+
+ overlay_obj = drm_gem_fb_get_obj(&overlay_crc->fb, 0);
+ overlay_vkms_obj = drm_gem_to_vkms_gem(overlay_obj);
+ mutex_lock(&overlay_vkms_obj->pages_lock);
+ if(!overlay_vkms_obj->vaddr){
+ DRM_WARN("overlay palne vaddr is NULL");
+ goto out;
+ }
+
+ blend(vaddr_out, overlay_vkms_obj->vaddr, primary_crc, overlay_crc);
+
+out:
+ mutex_unlock(&overlay_vkms_obj->pages_lock);
+}
+
static void compose_cursor(struct vkms_crc_data *cursor_crc,
struct vkms_crc_data *primary_crc, void *vaddr_out)
{
@@ -130,7 +149,8 @@ static void compose_cursor(struct vkms_crc_data *cursor_crc,
}
static uint32_t _vkms_get_crc(struct vkms_crc_data *primary_crc,
- struct vkms_crc_data *cursor_crc)
+ struct vkms_crc_data *cursor_crc,
+ struct vkms_crc_data *overlay_crc)
{
struct drm_framebuffer *fb = &primary_crc->fb;
struct drm_gem_object *gem_obj = drm_gem_fb_get_obj(fb, 0);
@@ -153,6 +173,8 @@ static uint32_t _vkms_get_crc(struct vkms_crc_data *primary_crc,
memcpy(vaddr_out, vkms_obj->vaddr, vkms_obj->gem.size);
mutex_unlock(&vkms_obj->pages_lock);
+ if (overlay_crc)
+ compose_overlay(overlay_crc, primary_crc, vaddr_out);
if (cursor_crc)
compose_cursor(cursor_crc, primary_crc, vaddr_out);
@@ -183,6 +205,7 @@ void vkms_crc_work_handle(struct work_struct *work)
output);
struct vkms_crc_data *primary_crc = NULL;
struct vkms_crc_data *cursor_crc = NULL;
+ struct vkms_crc_data *overlay_crc = NULL;
struct drm_plane *plane;
u32 crc32 = 0;
u64 frame_start, frame_end;
@@ -209,12 +232,17 @@ void vkms_crc_work_handle(struct work_struct *work)
if (plane->type == DRM_PLANE_TYPE_PRIMARY)
primary_crc = crc_data;
- else
+
+ if (plane->type == DRM_PLANE_TYPE_CURSOR)
cursor_crc = crc_data;
+
+ if (plane->type == DRM_PLANE_TYPE_OVERLAY)
+ overlay_crc = crc_data;
}
- if (primary_crc)
- crc32 = _vkms_get_crc(primary_crc, cursor_crc);
+ if (primary_crc){
+ crc32 = _vkms_get_crc(primary_crc, cursor_crc, overlay_crc);
+ }
frame_end = drm_crtc_accurate_vblank_count(crtc);
diff --git a/drivers/gpu/drm/vkms/vkms_drv.c b/drivers/gpu/drm/vkms/vkms_drv.c
index b13f99a5c849..90b730b6aa0e 100644
--- a/drivers/gpu/drm/vkms/vkms_drv.c
+++ b/drivers/gpu/drm/vkms/vkms_drv.c
@@ -34,6 +34,10 @@ bool enable_cursor;
module_param_named(enable_cursor, enable_cursor, bool, 0444);
MODULE_PARM_DESC(enable_cursor, "Enable/Disable cursor support");
+bool enable_overlay;
+module_param_named(enable_overlay, enable_overlay, bool, 0444);
+MODULE_PARM_DESC(enable_overlay, "Enable/Disable overlay support");
+
static const struct file_operations vkms_driver_fops = {
.owner = THIS_MODULE,
.open = drm_open,
diff --git a/drivers/gpu/drm/vkms/vkms_drv.h b/drivers/gpu/drm/vkms/vkms_drv.h
index e4469cd3d254..4b1ef94e5bf8 100644
--- a/drivers/gpu/drm/vkms/vkms_drv.h
+++ b/drivers/gpu/drm/vkms/vkms_drv.h
@@ -18,6 +18,8 @@
extern bool enable_cursor;
+extern bool enable_overlay;
+
static const u32 vkms_formats[] = {
DRM_FORMAT_XRGB8888,
};
@@ -26,6 +28,10 @@ static const u32 vkms_cursor_formats[] = {
DRM_FORMAT_ARGB8888,
};
+static const u32 vkms_overlay_formats[] ={
+ DRM_FORMAT_ARGB8888,
+};
+
struct vkms_crc_data {
struct drm_framebuffer fb;
struct drm_rect src, dst;
@@ -116,6 +122,8 @@ int vkms_output_init(struct vkms_device *vkmsdev);
struct drm_plane *vkms_plane_init(struct vkms_device *vkmsdev,
enum drm_plane_type type);
+struct drm_plane *vkms_overlay_init(struct vkms_device *vkmsdev);
+
/* Gem stuff */
struct drm_gem_object *vkms_gem_create(struct drm_device *dev,
struct drm_file *file,
diff --git a/drivers/gpu/drm/vkms/vkms_plane.c b/drivers/gpu/drm/vkms/vkms_plane.c
index 418817600ad1..0625b9ff8bd3 100644
--- a/drivers/gpu/drm/vkms/vkms_plane.c
+++ b/drivers/gpu/drm/vkms/vkms_plane.c
@@ -120,7 +120,7 @@ static int vkms_plane_atomic_check(struct drm_plane *plane,
if (IS_ERR(crtc_state))
return PTR_ERR(crtc_state);
- if (plane->type == DRM_PLANE_TYPE_CURSOR)
+ if ((plane->type == DRM_PLANE_TYPE_CURSOR)|(plane->type == DRM_PLANE_TYPE_OVERLAY))
can_position = true;
ret = drm_atomic_helper_check_plane_state(state, crtc_state,
@@ -173,6 +173,40 @@ static const struct drm_plane_helper_funcs vkms_primary_helper_funcs = {
.cleanup_fb = vkms_cleanup_fb,
};
+struct drm_plane *vkms_overlay_init(struct vkms_device *vkmsdev)
+{
+ struct drm_device *dev = &vkmsdev->drm;
+ const struct drm_plane_helper_funcs *funcs;
+ struct drm_plane *overlay;
+ const u32 *formats;
+ int ret, nformats;
+ unsigned int blend_caps = BIT(DRM_MODE_BLEND_PIXEL_NONE) |
+ BIT(DRM_MODE_BLEND_PREMULTI);
+
+ overlay = kzalloc(sizeof(*overlay), GFP_KERNEL);
+ if (!overlay)
+ return -ENOMEM;
+
+ formats = vkms_overlay_formats;
+ nformats = ARRAY_SIZE(vkms_overlay_formats);
+ funcs = &vkms_primary_helper_funcs;
+ drm_plane_helper_add(overlay, funcs);
+ drm_plane_create_alpha_property(overlay);
+ drm_plane_create_blend_mode_property(overlay, blend_caps);
+
+ ret = drm_universal_plane_init(dev, overlay, 0,
+ &vkms_plane_funcs,
+ formats, nformats,
+ NULL,
+ DRM_PLANE_TYPE_OVERLAY, NULL);
+ if (ret){
+ kfree(overlay);
+ return ERR_PTR(ret);
+ }
+
+ return overlay;
+}
+
struct drm_plane *vkms_plane_init(struct vkms_device *vkmsdev,
enum drm_plane_type type)
{
--
2.17.1
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] drm/vkms: Add overlay plane support
2019-03-02 13:04 [PATCH] drm/vkms: Add overlay plane support Mamta Shukla
@ 2019-03-03 20:41 ` kbuild test robot
2019-03-03 20:45 ` kbuild test robot
1 sibling, 0 replies; 3+ messages in thread
From: kbuild test robot @ 2019-03-03 20:41 UTC (permalink / raw)
To: Mamta Shukla
Cc: hamohammed.sa, rodrigosiqueiramelo, daniel.vetter, dri-devel,
manasi.d.navare, kbuild-all
[-- Attachment #1: Type: text/plain, Size: 2231 bytes --]
Hi Mamta,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on linus/master]
[also build test WARNING on v5.0-rc8 next-20190301]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Mamta-Shukla/drm-vkms-Add-overlay-plane-support/20190304-034802
config: i386-randconfig-x006-201909 (attached as .config)
compiler: gcc-8 (Debian 8.2.0-20) 8.2.0
reproduce:
# save the attached .config to linux build tree
make ARCH=i386
All warnings (new ones prefixed by >>):
drivers/gpu/drm/vkms/vkms_plane.c: In function 'vkms_overlay_init':
>> drivers/gpu/drm/vkms/vkms_plane.c:182:10: warning: returning 'int' from a function with return type 'struct drm_plane *' makes pointer from integer without a cast [-Wint-conversion]
return -ENOMEM;
^
vim +182 drivers/gpu/drm/vkms/vkms_plane.c
169
170 struct drm_plane *vkms_overlay_init(struct vkms_device *vkmsdev)
171 {
172 struct drm_device *dev = &vkmsdev->drm;
173 const struct drm_plane_helper_funcs *funcs;
174 struct drm_plane *overlay;
175 const u32 *formats;
176 int ret, nformats;
177 unsigned int blend_caps = BIT(DRM_MODE_BLEND_PIXEL_NONE) |
178 BIT(DRM_MODE_BLEND_PREMULTI);
179
180 overlay = kzalloc(sizeof(*overlay), GFP_KERNEL);
181 if (!overlay)
> 182 return -ENOMEM;
183
184 formats = vkms_overlay_formats;
185 nformats = ARRAY_SIZE(vkms_overlay_formats);
186 funcs = &vkms_primary_helper_funcs;
187 drm_plane_helper_add(overlay, funcs);
188 drm_plane_create_alpha_property(overlay);
189 drm_plane_create_blend_mode_property(overlay, blend_caps);
190
191 ret = drm_universal_plane_init(dev, overlay, 0,
192 &vkms_plane_funcs,
193 formats, nformats,
194 NULL,
195 DRM_PLANE_TYPE_OVERLAY, NULL);
196 if (ret){
197 kfree(overlay);
198 return ERR_PTR(ret);
199 }
200
201 return overlay;
202 }
203
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 29870 bytes --]
[-- Attachment #3: Type: text/plain, Size: 159 bytes --]
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] drm/vkms: Add overlay plane support
2019-03-02 13:04 [PATCH] drm/vkms: Add overlay plane support Mamta Shukla
2019-03-03 20:41 ` kbuild test robot
@ 2019-03-03 20:45 ` kbuild test robot
1 sibling, 0 replies; 3+ messages in thread
From: kbuild test robot @ 2019-03-03 20:45 UTC (permalink / raw)
To: Mamta Shukla
Cc: hamohammed.sa, rodrigosiqueiramelo, daniel.vetter, dri-devel,
manasi.d.navare, kbuild-all
[-- Attachment #1: Type: text/plain, Size: 2324 bytes --]
Hi Mamta,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on linus/master]
[also build test WARNING on v5.0-rc8 next-20190301]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Mamta-Shukla/drm-vkms-Add-overlay-plane-support/20190304-034802
config: nds32-allyesconfig (attached as .config)
compiler: nds32le-linux-gcc (GCC) 6.4.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=6.4.0 make.cross ARCH=nds32
All warnings (new ones prefixed by >>):
drivers/gpu/drm/vkms/vkms_plane.c: In function 'vkms_overlay_init':
>> drivers/gpu/drm/vkms/vkms_plane.c:182:10: warning: return makes pointer from integer without a cast [-Wint-conversion]
return -ENOMEM;
^
vim +182 drivers/gpu/drm/vkms/vkms_plane.c
169
170 struct drm_plane *vkms_overlay_init(struct vkms_device *vkmsdev)
171 {
172 struct drm_device *dev = &vkmsdev->drm;
173 const struct drm_plane_helper_funcs *funcs;
174 struct drm_plane *overlay;
175 const u32 *formats;
176 int ret, nformats;
177 unsigned int blend_caps = BIT(DRM_MODE_BLEND_PIXEL_NONE) |
178 BIT(DRM_MODE_BLEND_PREMULTI);
179
180 overlay = kzalloc(sizeof(*overlay), GFP_KERNEL);
181 if (!overlay)
> 182 return -ENOMEM;
183
184 formats = vkms_overlay_formats;
185 nformats = ARRAY_SIZE(vkms_overlay_formats);
186 funcs = &vkms_primary_helper_funcs;
187 drm_plane_helper_add(overlay, funcs);
188 drm_plane_create_alpha_property(overlay);
189 drm_plane_create_blend_mode_property(overlay, blend_caps);
190
191 ret = drm_universal_plane_init(dev, overlay, 0,
192 &vkms_plane_funcs,
193 formats, nformats,
194 NULL,
195 DRM_PLANE_TYPE_OVERLAY, NULL);
196 if (ret){
197 kfree(overlay);
198 return ERR_PTR(ret);
199 }
200
201 return overlay;
202 }
203
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 49921 bytes --]
[-- Attachment #3: Type: text/plain, Size: 159 bytes --]
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-03-03 20:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-02 13:04 [PATCH] drm/vkms: Add overlay plane support Mamta Shukla
2019-03-03 20:41 ` kbuild test robot
2019-03-03 20:45 ` kbuild test robot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.