Hi Matthijs, Andreas proposes a fix for the OMAP3 issue which should not harm OMAP5.
Comments?
BR, Nikolaus
Anfang der weitergeleiteten Nachricht:
Von: Andreas Kemnade andreas@kemnade.info Betreff: [Letux-kernel] [PATCH] omapdrm: try to allocate non-tiled buffer object if tiled fails Datum: 15. Februar 2017 um 07:29:48 MEZ An: letux-kernel@openphoenux.org Antwort an: Discussions about the Letux Kernel letux-kernel@openphoenux.org
If omap_gem_new is called with OMAP_BO_TILED_32 and there is no DMM it immediatetly returns NULL. That causes a framebuffer device not to be created if there is no DMM available. So do a second try to allocate a buffer object using the old parameters so a framebuffer will still be created on OMAP3 devices.
Signed-off-by: Andreas Kemnade andreas@kemnade.info
drivers/gpu/drm/omapdrm/omap_fbdev.c | 46 ++++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 21 deletions(-)
diff --git a/drivers/gpu/drm/omapdrm/omap_fbdev.c b/drivers/gpu/drm/omapdrm/omap_fbdev.c index 4a06444..fa52a94 100644 --- a/drivers/gpu/drm/omapdrm/omap_fbdev.c +++ b/drivers/gpu/drm/omapdrm/omap_fbdev.c @@ -119,26 +119,6 @@ static int omap_fbdev_create(struct drm_fb_helper *helper, mode_cmd.pixel_format = drm_mode_legacy_fb_format(sizes->surface_bpp, sizes->surface_depth);
-#if 0
- mode_cmd.width = sizes->surface_width;
- mode_cmd.height = sizes->surface_height;
- mode_cmd.pitches[0] =
DIV_ROUND_UP(mode_cmd.width * sizes->surface_bpp, 8);
- fbdev->ywrap_enabled = priv->has_dmm && ywrap_enabled;
- if (fbdev->ywrap_enabled) {
/* need to align pitch to page size if using DMM scrolling */
mode_cmd.pitches[0] = PAGE_ALIGN(mode_cmd.pitches[0]);
- }
- /* allocate backing bo */
- gsize = (union omap_gem_size){
.bytes = PAGE_ALIGN(mode_cmd.pitches[0] * mode_cmd.height),
- };
- DBG("allocating %d bytes for fb %d", gsize.bytes, dev->primary->index);
- fbdev->bo = omap_gem_new(dev, gsize, OMAP_BO_SCANOUT | OMAP_BO_WC);
-#else mode_cmd.width = 8192; // XXX HACK mode_cmd.height = sizes->surface_height;
@@ -155,7 +135,31 @@ static int omap_fbdev_create(struct drm_fb_helper *helper, } }; fbdev->bo = omap_gem_new(dev, gsize, OMAP_BO_TILED_32 | OMAP_BO_WC); -#endif
- if (!fbdev->bo) {
mode_cmd.width = sizes->surface_width;
mode_cmd.height = sizes->surface_height;
mode_cmd.pitches[0] =
DIV_ROUND_UP(mode_cmd.width * sizes->surface_bpp, 8);
fbdev->ywrap_enabled = priv->has_dmm && ywrap_enabled;
if (fbdev->ywrap_enabled) {
/* need to align pitch to page size
* if using DMM scrolling
*/
mode_cmd.pitches[0] = PAGE_ALIGN(mode_cmd.pitches[0]);
}
/* allocate backing bo */
gsize = (union omap_gem_size){
.bytes = PAGE_ALIGN(mode_cmd.pitches[0] *
mode_cmd.height),
};
DBG("allocating %d bytes for fb %d", gsize.bytes,
dev->primary->index);
fbdev->bo = omap_gem_new(dev, gsize, OMAP_BO_SCANOUT |
OMAP_BO_WC);
- } if (!fbdev->bo) { dev_err(dev->dev, "failed to allocate buffer object\n"); ret = -ENOMEM;
-- 2.1.4
http://projects.goldelico.com/p/gta04-kernel/ Letux-kernel mailing list Letux-kernel@openphoenux.org http://lists.goldelico.com/mailman/listinfo.cgi/letux-kernel
Hi,
On Wed, 15 Feb 2017 10:15:49 +0100 "H. Nikolaus Schaller" hns@goldelico.com wrote:
Hi Matthijs, Andreas proposes a fix for the OMAP3 issue which should not harm OMAP5.
Comments?
seems not to be the full fix but probably a valid part of it. framebuffer console works (by adding console=tty0 to bootargs.scr). Xorg seems still to have problems when is is not using the generic modesetting driver but the framebuffer driver.
Regards, Andreas
Hi Andreas,
Am 15.02.2017 um 20:09 schrieb Andreas Kemnade andreas@kemnade.info:
Hi,
On Wed, 15 Feb 2017 10:15:49 +0100 "H. Nikolaus Schaller" hns@goldelico.com wrote:
Hi Matthijs, Andreas proposes a fix for the OMAP3 issue which should not harm OMAP5.
Comments?
seems not to be the full fix but probably a valid part of it. framebuffer console works (by adding console=tty0 to bootargs.scr). Xorg seems still to have problems when is is not using the generic modesetting driver but the framebuffer driver.
That might be unrelated. Tomi Valkeinen mentioned something long ago. I haven't used the fb (driver) with X for a while and switched completely to drm because fb did no longer work.
BR, Nikolaus
Hd,
On Wed, 15 Feb 2017 20:14:12 +0100 "H. Nikolaus Schaller" hns@goldelico.com wrote:
Hi Andreas,
Am 15.02.2017 um 20:09 schrieb Andreas Kemnade andreas@kemnade.info:
Hi,
On Wed, 15 Feb 2017 10:15:49 +0100 "H. Nikolaus Schaller" hns@goldelico.com wrote:
Hi Matthijs, Andreas proposes a fix for the OMAP3 issue which should not harm OMAP5.
Comments?
seems not to be the full fix but probably a valid part of it. framebuffer console works (by adding console=tty0 to bootargs.scr). Xorg seems still to have problems when is is not using the generic modesetting driver but the framebuffer driver.
That might be unrelated. Tomi Valkeinen mentioned something long ago. I haven't used the fb (driver) with X for a while and switched completely to drm because fb did no longer work.
well it still works without the tiler branch. My old rootfs did not have the generic modesetting driver installed. Thats why I stumbled immediatedly over that problem. Without the fb tiler branch, it still works. And I had statically compiled fb, usb+charging stuff and console on framebuffer. I am also testing with another quite new lxde rootfs with letux_defconfig which has the generic xorg modesetting driver. So there are probably just some more if (have_tiled_fb) {} else {} somewhere necessary.
here are some warnings (I had a kernel crash after one of them): Feb 15 06:56:22 letux kernel: [37620.927307] ------------[ cut here ]------------ Feb 15 06:56:22 letux kernel: [37620.932769] WARNING: CPU: 0 PID: 2688 at ../drivers/gpu/drm/omapdrm/omap_gem.c:938 omap_gem_put_paddr+0x30/0x60 [omapdrm] Feb 15 06:56:22 letux kernel: [37620.945770] Modules linked in: bnep bluetooth ipv6 arc4 twl4030_madc_hwmon wl18xx wlcore mac80211 cfg80211 w2cbw003_bluetooth snd_soc_simple_card snd_soc_simple_card_utils snd_soc_omap_twl4030 snd_soc_gtm601 generic_adc_battery extcon_gpio omap3_isp videobuf2_dma_contig videobuf2_memops videobuf2_v4l2 videobuf2_core wlcore_sdio bmp280_i2c ov9650 bmg160_i2c v4l2_common bmp280 bmg160_core at24 nvmem_core bmc150_accel_i2c bmc150_magn_i2c videodev bmc150_magn bmc150_accel_core tsc2007 media leds_tca6507 bno055 industrialio_triggered_buffer snd_soc_omap_mcbsp kfifo_buf snd_soc_omap snd_pcm_dmaengine gpio_twl4030 snd_soc_twl4030 twl4030_vibra twl4030_madc hso wwan_on_off ehci_omap pwm_bl pwm_omap_dmtimer panel_tpo_td028ttec1 encoder_opa362 connector_analog_tv omapdrm drm_kms_helper cfbfillrect syscopyarea Feb 15 06:56:22 letux kernel: [37621.020935] cfbimgblt sysfillrect sysimgblt fb_sys_fops cfbcopyarea drm omapdss usb_f_ecm g_ether usb_f_rndis u_ether libcomposite configfs omap2430 phy_twl4030_usb musb_hdrc twl4030_charger industrialio w2sg0004 twl4030_pwrbutton bq27xxx_battery w1_bq27000 omap_hdq Feb 15 06:56:22 letux kernel: [37621.049621] CPU: 0 PID: 2688 Comm: kworker/0:1 Tainted: G W 4.10.0-rc8-letux+ #1 Feb 15 06:56:22 letux kernel: [37621.058593] Hardware name: Generic OMAP36xx (Flattened Device Tree) Feb 15 06:56:22 letux kernel: [37621.065734] Workqueue: events drm_mode_rmfb_work_fn [drm] Feb 15 06:56:22 letux kernel: [37621.071472] [<c010f368>] (unwind_backtrace) from [<c010b914>] (show_stack+0x10/0x14) Feb 15 06:56:22 letux kernel: [37621.079620] [<c010b914>] (show_stack) from [<c042e740>] (dump_stack+0x98/0xd0) Feb 15 06:56:22 letux kernel: [37621.087249] [<c042e740>] (dump_stack) from [<c012f7cc>] (__warn+0xd0/0x100) Feb 15 06:56:22 letux kernel: [37621.094573] [<c012f7cc>] (__warn) from [<c012f8a0>] (warn_slowpath_null+0x1c/0x24) Feb 15 06:56:22 letux kernel: [37621.102661] [<c012f8a0>] (warn_slowpath_null) from [<bf1a7250>] (omap_gem_put_paddr+0x30/0x60 [omapdrm]) Feb 15 06:56:22 letux kernel: [37621.112854] [<bf1a7250>] (omap_gem_put_paddr [omapdrm]) from [<bf1a61c8>] (omap_framebuffer_unpin+0x5c/0x70 [omapdrm]) Feb 15 06:56:22 letux kernel: [37621.124420] [<bf1a61c8>] (omap_framebuffer_unpin [omapdrm]) from [<bf17ba7c>] (drm_atomic_helper_cleanup_planes+0x48/0x50 [drm_kms_helper]) Feb 15 06:56:22 letux kernel: [37621.137786] [<bf17ba7c>] (drm_atomic_helper_cleanup_planes [drm_kms_helper]) from [<bf1a3458>] (omap_atomic_complete+0xac/0x128 [omapdrm]) Feb 15 06:56:22 letux kernel: [37621.150970] [<bf1a3458>] (omap_atomic_complete [omapdrm]) from [<bf1a3944>] (omap_atomic_commit+0x1f8/0x224 [omapdrm]) Feb 15 06:56:22 letux kernel: [37621.162384] [<bf1a3944>] (omap_atomic_commit [omapdrm]) from [<bf17f304>] (drm_atomic_helper_set_config+0x50/0xbc [drm_kms_helper]) Feb 15 06:56:22 letux kernel: [37621.175323] [<bf17f304>] (drm_atomic_helper_set_config [drm_kms_helper]) from [<bf0fcfdc>] (drm_mode_set_config_internal+0x4c/0xcc [drm]) Feb 15 06:56:22 letux kernel: [37621.188842] [<bf0fcfdc>] (drm_mode_set_config_internal [drm]) from [<bf0fd084>] (drm_crtc_force_disable+0x28/0x30 [drm]) Feb 15 06:56:22 letux kernel: [37621.200805] [<bf0fd084>] (drm_crtc_force_disable [drm]) from [<bf1091d4>] (drm_framebuffer_remove+0x74/0xec [drm]) Feb 15 06:56:22 letux kernel: [37621.212219] [<bf1091d4>] (drm_framebuffer_remove [drm]) from [<bf109284>] (drm_mode_rmfb_work_fn+0x38/0x40 [drm]) Feb 15 06:56:22 letux kernel: [37621.223266] [<bf109284>] (drm_mode_rmfb_work_fn [drm]) from [<c014c678>] (process_one_work+0x384/0x764) Feb 15 06:56:22 letux kernel: [37621.233154] [<c014c678>] (process_one_work) from [<c014ca80>] (process_scheduled_works+0x28/0x30) Feb 15 06:56:22 letux kernel: [37621.242492] [<c014ca80>] (process_scheduled_works) from [<c014da90>] (worker_thread+0x2d4/0x3d4) Feb 15 06:56:22 letux kernel: [37621.251770] [<c014da90>] (worker_thread) from [<c0152a98>] (kthread+0x118/0x134) Feb 15 06:56:22 letux kernel: [37621.259552] [<c0152a98>] (kthread) from [<c01070d0>] (ret_from_fork+0x14/0x24) Feb 15 06:56:22 letux kernel: [37621.275543] ---[ end trace 0832b38dd354c386 ]---
Regards, Andreas
Hi,
On Wed, 15 Feb 2017 20:09:54 +0100 Andreas Kemnade andreas@kemnade.info wrote:
Hi,
On Wed, 15 Feb 2017 10:15:49 +0100 "H. Nikolaus Schaller" hns@goldelico.com wrote:
Hi Matthijs, Andreas proposes a fix for the OMAP3 issue which should not harm OMAP5.
Comments?
seems not to be the full fix but probably a valid part of it. framebuffer console works (by adding console=tty0 to bootargs.scr). Xorg seems still to have problems when is is not using the generic modesetting driver but the framebuffer driver.
also my fbpng pragram crashes the kernel with a quite strange message. So it is really not enough.
Regards, Andreas
Hi Matthijs,
Am 22.02.2017 um 19:15 schrieb Andreas Kemnade andreas@kemnade.info:
Hi,
On Wed, 15 Feb 2017 20:09:54 +0100 Andreas Kemnade andreas@kemnade.info wrote:
Hi,
On Wed, 15 Feb 2017 10:15:49 +0100 "H. Nikolaus Schaller" hns@goldelico.com wrote:
Hi Matthijs, Andreas proposes a fix for the OMAP3 issue which should not harm OMAP5.
Comments?
seems not to be the full fix but probably a valid part of it. framebuffer console works (by adding console=tty0 to bootargs.scr). Xorg seems still to have problems when is is not using the generic modesetting driver but the framebuffer driver.
also my fbpng pragram crashes the kernel with a quite strange message.
I was able to reproduce and it is an "imprecise external abort".
So it is really not enough.
I have found that merging your patches
ARM: introduce pgprot_device() XXX ARM: fbdev: force use of device memtype
and none of the others, is already sufficient to start the trouble.
Reverting makes it work on OMAP3 and interestingly, the rotation on OMAP5 is still working fine (X11 and console).
So what is this patch intended for? Or what is it (not) good for, if it appears to work without?
Otherwise I think some of the patches are sane so that we should start to get them reviewed for upstream.
If you agree, I can take care of managing this process, but ask for your signed-offs and include you technical comments (because I don't know what the code is really doing).
BR and thanks, Nikolaus