drm/mediatek: Implement gem prime vmap/vunmap function
Subsystems (3)
PATCH 1/2 drm/mediatek: Implement gem prime vmap/vunmap function
For some application which need kernel virtual address, such as fbcon, implement these function to map/unmap kernel virtual address of prime buffer.
--- drivers/gpu/drm/mediatek/mtk_drm_drv.c | 2 ++ drivers/gpu/drm/mediatek/mtk_drm_gem.c | 46 ++++++++++++++++++++++++++ drivers/gpu/drm/mediatek/mtk_drm_gem.h | 3 ++ 3 files changed, 51 insertions(+)
drivers/gpu/drm/mediatek/mtk_drm_drv.c +2 -0
@@ -341,6 +341,8 @@ static struct drm_driver mtk_drm_driver = { .gem_prime_get_sg_table = mtk_gem_prime_get_sg_table, .gem_prime_import_sg_table = mtk_gem_prime_import_sg_table, .gem_prime_mmap = mtk_drm_gem_mmap_buf, + .gem_prime_vmap = mtk_drm_gem_prime_vmap, + .gem_prime_vunmap = mtk_drm_gem_prime_vunmap, .fops = &mtk_drm_fops, .name = DRIVER_NAME,
drivers/gpu/drm/mediatek/mtk_drm_gem.c +46 -0
49 lines not on this page · raw message
drivers/gpu/drm/mediatek/mtk_drm_gem.h +3 -0
@@ -37,6 +37,7 @@ struct mtk_drm_gem_obj {dma_addr_t dma_addr;unsigned long dma_attrs;struct sg_table *sg; +struct page **pages; };#define to_mtk_gem_obj (x) container_of(x, struct mtk_drm_gem_obj, base)
@@ -52,5 +53,7 @@ int mtk_drm_gem_mmap_buf(struct drm_gem_object *obj,struct sg_table *mtk_gem_prime_get_sg_table (struct drm_gem_object *obj);struct drm_gem_object *mtk_gem_prime_import_sg_table (struct drm_device *dev,struct dma_buf_attachment *attach,struct sg_table *sg); +void *mtk_drm_gem_prime_vmap (struct drm_gem_object *obj); +void mtk_drm_gem_prime_vunmap (struct drm_gem_object *obj,void *vaddr);#endif
Signature · 6 lines
2.18.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 2/2 drm/mediatek: Add Mediatek framebuffer device
For Mediatek drm driver, use fbdev emulation to create a framebuffer device.
--- drivers/gpu/drm/mediatek/mtk_drm_drv.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/gpu/drm/mediatek/mtk_drm_drv.c +5 -0
@@ -16,6 +16,7 @@#include <drm/drm_atomic.h> #include <drm/drm_atomic_helper.h> #include <drm/drm_crtc_helper.h> +#include <drm/drm_fb_helper.h> #include <drm/drm_gem.h> #include <drm/drm_gem_cma_helper.h> #include <drm/drm_of.h>
@@ -378,6 +379,10 @@ static int mtk_drm_bind(struct device *dev)if (ret <0 ) goto err_deinit; + ret =drm_fbdev_generic_setup (drm,32 ); +if (ret) +DRM_ERROR ("Failed to initialize fbdev: %d\n" , ret); +return 0 ; err_deinit:
Signature · 6 lines
2.18.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Aw: [PATCH 2/2] drm/mediatek: Add Mediatek framebuffer device
Hi,
this Patchset does not hang on Bananapi R2, but does not show anything on FB-Console...seems anything is missing
https://github.com/frank-w/BPI-R2-4.14/tree/4.20-fbdev
dmesg | grep 'fb\|framebuffer'
[ 0.000000] Linux version 4.20.0-rc7-bpi-r2-fbdev (frank@frank-N56VZ) (gcc version 7.3.0 (Ubuntu/Linaro 7.3.0-27ubuntu1~18.04)) 9 [ 0.000000] cma: Reserved 64 MiB at 0xfb800000 [ 0.000000] Kernel command line: board=bpi-r2 console=earlyprintk console=tty1 fbcon=map:0 console=ttyS0,115200 root=/dev/mmcblk7 [ 5.733185] [drm:drm_fb_helper_generic_probe] surface width(1280), height(1024) and bpp(32) [ 5.754452] [drm:drm_mode_addfb2] [FB:44] [ 5.792878] mediatek-drm 14000000.dispsys: fb0: DRM emulated frame buffer device [ 5.814067] [drm:drm_fb_helper_hotplug_event.part.11] [ 6.203083] mediatek-drm 14000000.dispsys: [drm:drm_client_dev_hotplug] fbdev: ret=0 [ 24.930347] mediatek-drm 14000000.dispsys: [drm:drm_client_dev_restore] fbdev: ret=0 [ 25.196872] mediatek-drm 14000000.dispsys: [drm:drm_client_dev_restore] fbdev: ret=0 [ 25.281184] [drm:drm_mode_addfb2] [FB:49] [ 27.947962] [drm:drm_mode_addfb2] [FB:49]
regards Frank
Quoted 41 lines
Gesendet: Mittwoch, 16. Januar 2019 um 02:39 Uhr
Von: "CK Hu" <[email protected]>
An: "Philipp Zabel" <[email protected]>, "David Airlie" <[email protected]>, "Daniel Vetter" <[email protected]>, "Matthias Brugger" <[email protected]>, "Noralf Tr�nnes" <[email protected]>, "Frank Wunderlich" <[email protected]>
Cc: [email protected], [email protected], [email protected], [email protected], [email protected], "CK Hu" <[email protected]>
Betreff: [PATCH 2/2] drm/mediatek: Add Mediatek framebuffer deviceFor Mediatek drm driver, use fbdev emulation to create a framebuffer device.
Signed-off-by CK Hu <[email protected]>--- drivers/gpu/drm/mediatek/mtk_drm_drv.c | 5 +++++ 1 file changed, 5 insertions(+)drivers/gpu/drm/mediatek/mtk_drm_drv.c +5
-0@@ -16,6 +16,7 @@#include <drm/drm_atomic.h> #include <drm/drm_atomic_helper.h> #include <drm/drm_crtc_helper.h> +#include <drm/drm_fb_helper.h> #include <drm/drm_gem.h> #include <drm/drm_gem_cma_helper.h> #include <drm/drm_of.h> @@ -378,6 +379,10 @@ static int mtk_drm_bind(struct device *dev)if (ret <0 ) goto err_deinit; + ret =drm_fbdev_generic_setup (drm,32 ); +if (ret) +DRM_ERROR ("Failed to initialize fbdev: %d\n" , ret); +return 0 ; err_deinit:Signature · 1 line
2.18.1
Re: Aw: [PATCH 2/2] drm/mediatek: Add Mediatek framebuffer device
Hi, Frank:
Quoted 7 lines · Frank Wunderlich
Hi,
this Patchset does not hang on Bananapi R2, but does not show anything on FB-Console...seems anything is missing
https://github.com/frank-w/BPI-R2-4.14/tree/4.20-fbdev
dmesg | grep 'fb\|framebuffer'
Quoted 12 lines
[ 0.000000] Linux version 4.20.0-rc7-bpi-r2-fbdev (frank@frank-N56VZ) (gcc version 7.3.0 (Ubuntu/Linaro 7.3.0-27ubuntu1~18.04)) 9 [ 0.000000] cma: Reserved 64 MiB at 0xfb800000 [ 0.000000] Kernel command line: board=bpi-r2 console=earlyprintk console=tty1 fbcon=map:0 console=ttyS0,115200 root=/dev/mmcblk7 [ 5.733185] [drm:drm_fb_helper_generic_probe] surface width(1280), height(1024) and bpp(32) [ 5.754452] [drm:drm_mode_addfb2] [FB:44] [ 5.792878] mediatek-drm 14000000.dispsys: fb0: DRM emulated frame buffer device [ 5.814067] [drm:drm_fb_helper_hotplug_event.part.11] [ 6.203083] mediatek-drm 14000000.dispsys: [drm:drm_client_dev_hotplug] fbdev: ret=0 [ 24.930347] mediatek-drm 14000000.dispsys: [drm:drm_client_dev_restore] fbdev: ret=0 [ 25.196872] mediatek-drm 14000000.dispsys: [drm:drm_client_dev_restore] fbdev: ret=0 [ 25.281184] [drm:drm_mode_addfb2] [FB:49] [ 27.947962] [drm:drm_mode_addfb2] [FB:49]
The log does not show any information of error, but it close fbdev at the time 24.930347.
I just test vmap() by writing white color into framebuffer after vmap() and use user space program to control fbdev to show this framebuffer and the panel shows white screen. So I believe that vmap() and fbdev works fine, but I'm not sure what happen to fbcon. I would try to setup fbcon to find out the bug. If you could try to debug parallelly, it would be much help.
Regards,
CK
Quoted 40 lines
regards Frank
Quoted 36 lines
Gesendet: Mittwoch, 16. Januar 2019 um 02:39 Uhr
Von: "CK Hu" <[email protected]>
An: "Philipp Zabel" <[email protected]>, "David Airlie" <[email protected]>, "Daniel Vetter" <[email protected]>, "Matthias Brugger" <[email protected]>, "Noralf Tr�nnes" <[email protected]>, "Frank Wunderlich" <[email protected]>
Cc: [email protected], [email protected], [email protected], [email protected], [email protected], "CK Hu" <[email protected]>
Betreff: [PATCH 2/2] drm/mediatek: Add Mediatek framebuffer deviceFor Mediatek drm driver, use fbdev emulation to create a framebuffer device.
Signed-off-by CK Hu <[email protected]>--- drivers/gpu/drm/mediatek/mtk_drm_drv.c | 5 +++++ 1 file changed, 5 insertions(+)drivers/gpu/drm/mediatek/mtk_drm_drv.c +5
-0@@ -16,6 +16,7 @@#include <drm/drm_atomic.h> #include <drm/drm_atomic_helper.h> #include <drm/drm_crtc_helper.h> +#include <drm/drm_fb_helper.h> #include <drm/drm_gem.h> #include <drm/drm_gem_cma_helper.h> #include <drm/drm_of.h> @@ -378,6 +379,10 @@ static int mtk_drm_bind(struct device *dev)if (ret <0 ) goto err_deinit; + ret =drm_fbdev_generic_setup (drm,32 ); +if (ret) +DRM_ERROR ("Failed to initialize fbdev: %d\n" , ret); +return 0 ;
Quoted 10 lines
Quoted 5 lines
drivers/gpu/drm/mediatek/mtk_drm_drv.c +0
-0err_deinit:Signature · 1 line
2.18.1_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Matthias Brugger
maintainerRe: Aw: [PATCH 2/2] drm/mediatek: Add Mediatek framebuffer device
Quoted 26 lines · CK Hu
Hi, Frank:
Quoted 7 lines · Frank Wunderlich
Hi,
this Patchset does not hang on Bananapi R2, but does not show anything on FB-Console...seems anything is missing
https://github.com/frank-w/BPI-R2-4.14/tree/4.20-fbdev
dmesg | grep 'fb\|framebuffer'
Quoted 12 lines
[ 0.000000] Linux version 4.20.0-rc7-bpi-r2-fbdev (frank@frank-N56VZ) (gcc version 7.3.0 (Ubuntu/Linaro 7.3.0-27ubuntu1~18.04)) 9 [ 0.000000] cma: Reserved 64 MiB at 0xfb800000 [ 0.000000] Kernel command line: board=bpi-r2 console=earlyprintk console=tty1 fbcon=map:0 console=ttyS0,115200 root=/dev/mmcblk7 [ 5.733185] [drm:drm_fb_helper_generic_probe] surface width(1280), height(1024) and bpp(32) [ 5.754452] [drm:drm_mode_addfb2] [FB:44] [ 5.792878] mediatek-drm 14000000.dispsys: fb0: DRM emulated frame buffer device [ 5.814067] [drm:drm_fb_helper_hotplug_event.part.11] [ 6.203083] mediatek-drm 14000000.dispsys: [drm:drm_client_dev_hotplug] fbdev: ret=0 [ 24.930347] mediatek-drm 14000000.dispsys: [drm:drm_client_dev_restore] fbdev: ret=0 [ 25.196872] mediatek-drm 14000000.dispsys: [drm:drm_client_dev_restore] fbdev: ret=0 [ 25.281184] [drm:drm_mode_addfb2] [FB:49] [ 27.947962] [drm:drm_mode_addfb2] [FB:49]The log does not show any information of error, but it close fbdev at the time 24.930347.
Quoted 7 lines
I just test
vmap()by writing white color into framebuffer aftervmap()and use user space program to control fbdev to show this framebuffer and the panel shows white screen. So I believe thatvmap()and fbdev works fine, but I'm not sure what happen to fbcon. I would try to setup fbcon to find out the bug. If you could try to debug parallelly, it would be much help.
may it be the not yet fixed mmsys compatible problem? Frank, did you test with my last series [1]?
Regards,
Matthias
[1] https://patchwork.kernel.org/cover/10686345/
Quoted 61 lines
Regards,
CKQuoted 40 lines
regards Frank
Quoted 36 lines
Gesendet: Mittwoch, 16. Januar 2019 um 02:39 Uhr
Von: "CK Hu" <[email protected]>
An: "Philipp Zabel" <[email protected]>, "David Airlie" <[email protected]>, "Daniel Vetter" <[email protected]>, "Matthias Brugger" <[email protected]>, "Noralf Tr�nnes" <[email protected]>, "Frank Wunderlich" <[email protected]>
Cc: [email protected], [email protected], [email protected], [email protected], [email protected], "CK Hu" <[email protected]>
Betreff: [PATCH 2/2] drm/mediatek: Add Mediatek framebuffer deviceFor Mediatek drm driver, use fbdev emulation to create a framebuffer device.
Signed-off-by CK Hu <[email protected]>--- drivers/gpu/drm/mediatek/mtk_drm_drv.c | 5 +++++ 1 file changed, 5 insertions(+)drivers/gpu/drm/mediatek/mtk_drm_drv.c +5
-0@@ -16,6 +16,7 @@#include <drm/drm_atomic.h> #include <drm/drm_atomic_helper.h> #include <drm/drm_crtc_helper.h> +#include <drm/drm_fb_helper.h> #include <drm/drm_gem.h> #include <drm/drm_gem_cma_helper.h> #include <drm/drm_of.h> @@ -378,6 +379,10 @@ static int mtk_drm_bind(struct device *dev)if (ret <0 ) goto err_deinit; + ret =drm_fbdev_generic_setup (drm,32 ); +if (ret) +DRM_ERROR ("Failed to initialize fbdev: %d\n" , ret); +return 0 ;Quoted 10 lines
Quoted 5 lines
drivers/gpu/drm/mediatek/mtk_drm_drv.c +0
-0err_deinit:Signature · 1 line
2.18.1_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek
Aw: Re: [PATCH 2/2] drm/mediatek: Add Mediatek framebuffer device
I have tested same codebase where my FBDev-Patch works (4.20-hdmiv5), only without it and CK Hu's 2 Patches
does generic fbdev depend on the mmsys-Patch?
regards Frank
Quoted 9 lines
Gesendet: Freitag, 18. Januar 2019 um 09:39 Uhr
Von: "Matthias Brugger" <[email protected]> may it be the not yet fixed mmsys compatible problem? Frank, did you test with my last series [1]?Regards,
Matthias
Aw: Re: [PATCH 2/2] drm/mediatek: Add Mediatek framebuffer device
In reply to Matthias BruggerTested with mmsys-Patch, but same result, no fbcon, tft is switched on but i see no kernel-log
after boot is finished, i see X-server, until this point i see only black screen
regards Frank
Quoted 5 lines
Gesendet: Freitag, 18. Januar 2019 um 09:39 Uhr
Von: "Matthias Brugger" <[email protected]> may it be the not yet fixed mmsys compatible problem? Frank, did you test with my last series [1]?
[1] https://patchwork.kernel.org/cover/10686345/
Re: Aw: Re: [PATCH 2/2] drm/mediatek: Add Mediatek framebuffer device
Hi, Frank:
My platform's fbcon works correctly, so I've applied this series to [1]. If you have another patch, I'd treat it as a bug-fix.
[1]
https://github.com/ckhu-mediatek/linux.git-tags/commits/mediatek-drm-fixes-5.1
Regards,
CK
Quoted 12 lines · Frank Wunderlich
Tested with mmsys-Patch, but same result, no fbcon, tft is switched on but i see no kernel-log
after boot is finished, i see X-server, until this point i see only black screen
regards Frank
Quoted 5 lines
Gesendet: Freitag, 18. Januar 2019 um 09:39 Uhr
Von: "Matthias Brugger" <[email protected]> may it be the not yet fixed mmsys compatible problem? Frank, did you test with my last series [1]?
[1] https://patchwork.kernel.org/cover/10686345/
Aw: Re: Re: [PATCH 2/2] drm/mediatek: Add Mediatek framebuffer device
Hi,
i try to get hdmi running on bananapi-r2 with 5.1 but also without CK Hu's frambuffer-Patch i get no x-server working
my codebase: https://github.com/frank-w/BPI-R2-4.14/commits/5.1-hdmi
reused some Patches working on 5.0 (here X-server is working, but not fbcon)
WARNING: CPU: 2 PID: 895 at drivers/gpu/drm/drm_atomic_helper.c:1430 drm_atomic_helper_wait_for_vblanks.part.1+0x2a4/0x2a8
any hint how to fix this? if needed i can send full bootlog (with drm.debug=7)
regards Frank