drm/tegra: dc: Parameterize maximum resolution
authorThierry Reding <treding@nvidia.com>
Fri, 26 Mar 2021 14:51:33 +0000 (15:51 +0100)
committerThierry Reding <treding@nvidia.com>
Wed, 31 Mar 2021 15:42:14 +0000 (17:42 +0200)
Tegra186 and later support a higher maximum resolution than earlier
chips, so make sure to reflect that in the mode configuration.

Signed-off-by: Thierry Reding <treding@nvidia.com>
drivers/gpu/drm/tegra/dc.c
drivers/gpu/drm/tegra/drm.c
drivers/gpu/drm/tegra/drm.h

index 935717e7410d9400637e79e845e8dab74c343733..0541d7b5c841b821a21c3f649ded10f92508b1ec 100644 (file)
@@ -2117,6 +2117,12 @@ static int tegra_dc_init(struct host1x_client *client)
        if (dc->soc->pitch_align > tegra->pitch_align)
                tegra->pitch_align = dc->soc->pitch_align;
 
+       /* track maximum resolution */
+       if (dc->soc->has_nvdisplay)
+               drm->mode_config.max_width = drm->mode_config.max_height = 16384;
+       else
+               drm->mode_config.max_width = drm->mode_config.max_height = 4096;
+
        err = tegra_dc_rgb_init(drm, dc);
        if (err < 0 && err != -ENODEV) {
                dev_err(dc->dev, "failed to initialize RGB output: %d\n", err);
index ce5bdc58d315fe9e584f22447a521b1f74fc23ea..0c350b0daab47f29d9cdda8da307a20aaa070fe5 100644 (file)
@@ -1121,9 +1121,8 @@ static int host1x_drm_probe(struct host1x_device *dev)
 
        drm->mode_config.min_width = 0;
        drm->mode_config.min_height = 0;
-
-       drm->mode_config.max_width = 4096;
-       drm->mode_config.max_height = 4096;
+       drm->mode_config.max_width = 0;
+       drm->mode_config.max_height = 0;
 
        drm->mode_config.allow_fb_modifiers = true;
 
@@ -1142,6 +1141,14 @@ static int host1x_drm_probe(struct host1x_device *dev)
        if (err < 0)
                goto fbdev;
 
+       /*
+        * Now that all display controller have been initialized, the maximum
+        * supported resolution is known and the bitmask for horizontal and
+        * vertical bitfields can be computed.
+        */
+       tegra->hmask = drm->mode_config.max_width - 1;
+       tegra->vmask = drm->mode_config.max_height - 1;
+
        if (tegra->use_explicit_iommu) {
                u64 carveout_start, carveout_end, gem_start, gem_end;
                u64 dma_mask = dma_get_mask(&dev->dev);
index f38de08e0c95194c7f19077d61c66f72cf27fd69..1b23bb0e29e3d9a41c3a61b7ff7e827830f99c7f 100644 (file)
@@ -54,6 +54,7 @@ struct tegra_drm {
        struct tegra_fbdev *fbdev;
 #endif
 
+       unsigned int hmask, vmask;
        unsigned int pitch_align;
 
        struct tegra_display_hub *hub;