dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH AUTOSEL 4.9 001/141] drm/gma500: Fixup fbdev stolen size usage evaluation
@ 2020-02-14 16:19 Sasha Levin
  2020-02-14 16:19 ` [PATCH AUTOSEL 4.9 009/141] pxa168fb: Fix the function used to release some memory in an error handling path Sasha Levin
                   ` (23 more replies)
  0 siblings, 24 replies; 25+ messages in thread
From: Sasha Levin @ 2020-02-14 16:19 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Paul Kocialkowski, Sasha Levin, dri-devel

From: Paul Kocialkowski <paul.kocialkowski@bootlin.com>

[ Upstream commit fd1a5e521c3c083bb43ea731aae0f8b95f12b9bd ]

psbfb_probe performs an evaluation of the required size from the stolen
GTT memory, but gets it wrong in two distinct ways:
- The resulting size must be page-size-aligned;
- The size to allocate is derived from the surface dimensions, not the fb
  dimensions.

When two connectors are connected with different modes, the smallest will
be stored in the fb dimensions, but the size that needs to be allocated must
match the largest (surface) dimensions. This is what is used in the actual
allocation code.

Fix this by correcting the evaluation to conform to the two points above.
It allows correctly switching to 16bpp when one connector is e.g. 1920x1080
and the other is 1024x768.

Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Signed-off-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20191107153048.843881-1-paul.kocialkowski@bootlin.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/gpu/drm/gma500/framebuffer.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/gma500/framebuffer.c b/drivers/gpu/drm/gma500/framebuffer.c
index 3a44e705db538..d224fc12b7571 100644
--- a/drivers/gpu/drm/gma500/framebuffer.c
+++ b/drivers/gpu/drm/gma500/framebuffer.c
@@ -516,6 +516,7 @@ static int psbfb_probe(struct drm_fb_helper *helper,
 		container_of(helper, struct psb_fbdev, psb_fb_helper);
 	struct drm_device *dev = psb_fbdev->psb_fb_helper.dev;
 	struct drm_psb_private *dev_priv = dev->dev_private;
+	unsigned int fb_size;
 	int bytespp;
 
 	bytespp = sizes->surface_bpp / 8;
@@ -525,8 +526,11 @@ static int psbfb_probe(struct drm_fb_helper *helper,
 	/* If the mode will not fit in 32bit then switch to 16bit to get
 	   a console on full resolution. The X mode setting server will
 	   allocate its own 32bit GEM framebuffer */
-	if (ALIGN(sizes->fb_width * bytespp, 64) * sizes->fb_height >
-	                dev_priv->vram_stolen_size) {
+	fb_size = ALIGN(sizes->surface_width * bytespp, 64) *
+		  sizes->surface_height;
+	fb_size = ALIGN(fb_size, PAGE_SIZE);
+
+	if (fb_size > dev_priv->vram_stolen_size) {
                 sizes->surface_bpp = 16;
                 sizes->surface_depth = 16;
         }
-- 
2.20.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2020-02-14 16:24 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-14 16:19 [PATCH AUTOSEL 4.9 001/141] drm/gma500: Fixup fbdev stolen size usage evaluation Sasha Levin
2020-02-14 16:19 ` [PATCH AUTOSEL 4.9 009/141] pxa168fb: Fix the function used to release some memory in an error handling path Sasha Levin
2020-02-14 16:19 ` [PATCH AUTOSEL 4.9 032/141] drm/amdgpu: remove 4 set but not used variable in amdgpu_atombios_get_connector_info_from_object_table Sasha Levin
2020-02-14 16:19 ` [PATCH AUTOSEL 4.9 033/141] drm/amdgpu: remove set but not used variable 'dig_connector' Sasha Levin
2020-02-14 16:19 ` [PATCH AUTOSEL 4.9 034/141] drm/amdgpu: remove set but not used variable 'dig' Sasha Levin
2020-02-14 16:19 ` [PATCH AUTOSEL 4.9 035/141] drm/amdgpu: remove always false comparison in 'amdgpu_atombios_i2c_process_i2c_ch' Sasha Levin
2020-02-14 16:19 ` [PATCH AUTOSEL 4.9 036/141] drm/amdgpu: remove set but not used variable 'mc_shared_chmap' Sasha Levin
2020-02-14 16:19 ` [PATCH AUTOSEL 4.9 037/141] drm/amdgpu: remove set but not used variable 'amdgpu_connector' Sasha Levin
2020-02-14 16:19 ` [PATCH AUTOSEL 4.9 038/141] drm/gma500: remove set but not used variable 'htotal' Sasha Levin
2020-02-14 16:19 ` [PATCH AUTOSEL 4.9 039/141] drm/gma500: remove set but not used variable 'error' Sasha Levin
2020-02-14 16:19 ` [PATCH AUTOSEL 4.9 040/141] drm/gma500: remove set but not used variable 'is_hdmi', 'is_crt' Sasha Levin
2020-02-14 16:19 ` [PATCH AUTOSEL 4.9 041/141] drm/gma500: remove set but not used variable 'channel_eq' Sasha Levin
2020-02-14 16:19 ` [PATCH AUTOSEL 4.9 042/141] drm/radeon: remove set but not used variable 'size', 'relocs_chunk' Sasha Levin
2020-02-14 16:19 ` [PATCH AUTOSEL 4.9 043/141] drm/radeon: remove set but not used variable 'backbias_response_time' Sasha Levin
2020-02-14 16:19 ` [PATCH AUTOSEL 4.9 044/141] drm/radeon: remove set but not used variable 'dig_connector' Sasha Levin
2020-02-14 16:19 ` [PATCH AUTOSEL 4.9 045/141] drm/radeon: remove set but not used variable 'radeon_connector' Sasha Levin
2020-02-14 16:19 ` [PATCH AUTOSEL 4.9 046/141] drm/radeon: remove set but not used variable 'blocks' Sasha Levin
2020-02-14 16:19 ` [PATCH AUTOSEL 4.9 047/141] drm/radeon: remove set but not used variable 'tv_pll_cntl1' Sasha Levin
2020-02-14 16:20 ` [PATCH AUTOSEL 4.9 069/141] drm/mediatek: handle events when enabling/disabling crtc Sasha Levin
2020-02-14 16:20 ` [PATCH AUTOSEL 4.9 080/141] drm/gma500: remove set but not used variables 'hist_reg' Sasha Levin
2020-02-14 16:20 ` [PATCH AUTOSEL 4.9 098/141] drm/nouveau/gr/gk20a, gm200-: add terminators to method lists read from fw Sasha Levin
2020-02-14 16:20 ` [PATCH AUTOSEL 4.9 099/141] drm/nouveau: Fix copy-paste error in nouveau_fence_wait_uevent_handler Sasha Levin
2020-02-14 16:20 ` [PATCH AUTOSEL 4.9 100/141] drm/vmwgfx: prevent memory leak in vmw_cmdbuf_res_add Sasha Levin
2020-02-14 16:21 ` [PATCH AUTOSEL 4.9 127/141] drm/nouveau/disp/nv50-: prevent oops when no channel method map provided Sasha Levin
2020-02-14 16:21 ` [PATCH AUTOSEL 4.9 131/141] radeon: insert 10ms sleep in dce5_crtc_load_lut Sasha Levin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).