summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/tegra
diff options
context:
space:
mode:
authorThierry Reding <treding@nvidia.com>2017-11-14 16:09:30 +0100
committerThierry Reding <treding@nvidia.com>2017-12-13 14:36:39 +0100
commit71835caa00e8a64ada3c2e30c56468c39c81f60c (patch)
tree90d73b05ff0493e666a66799df17fe53cdd84359 /drivers/gpu/drm/tegra
parent7b2c2845e5d59db1d9dfa822436a71b2de18a7ee (diff)
drm/tegra: fb: Force alpha formats
Tegra20 and Tegra30 don't actually support the 24-bit RGB formats that don't have an alpha component. In order to allow the fbdev emulation to run on those chips, force the 32-bit RGBA formats. Signed-off-by: Thierry Reding <treding@nvidia.com>
Diffstat (limited to 'drivers/gpu/drm/tegra')
-rw-r--r--drivers/gpu/drm/tegra/fb.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/gpu/drm/tegra/fb.c b/drivers/gpu/drm/tegra/fb.c
index 406e895d82cc..1af4ef9241f1 100644
--- a/drivers/gpu/drm/tegra/fb.c
+++ b/drivers/gpu/drm/tegra/fb.c
@@ -253,6 +253,19 @@ static int tegra_fbdev_probe(struct drm_fb_helper *helper,
cmd.height = sizes->surface_height;
cmd.pitches[0] = round_up(sizes->surface_width * bytes_per_pixel,
tegra->pitch_align);
+
+ /*
+ * Early generations of Tegra (Tegra20 and Tegra30) do not support any
+ * of the X* or *X formats, only their A* or *A equivalents. Force the
+ * legacy framebuffer format to include an alpha component so that the
+ * framebuffer emulation can be supported on all generations.
+ */
+ if (sizes->surface_bpp == 32 && sizes->surface_depth == 24)
+ sizes->surface_depth = 32;
+
+ if (sizes->surface_bpp == 16 && sizes->surface_depth == 15)
+ sizes->surface_depth = 16;
+
cmd.pixel_format = drm_mode_legacy_fb_format(sizes->surface_bpp,
sizes->surface_depth);