Skip to content

Commit dc49c3b

Browse files
committed
Merge tag 'drm-misc-fixes-2023-05-11' of git://anongit.freedesktop.org/drm/drm-misc into drm-fixes
drm-misc-fixes for v6.4-rc2: - More DSC macro fixes. - Small mipi-dsi fix. - Scheduler timeout handling fix. --- drm-misc-fixes for v6.4-rc1: - Fix DSC macros. - Fix VESA format for simplefb. - Prohibit potential out-of-bounds access in generic fbdev emulation. - Improve AST2500+ compat on ARM. Signed-off-by: Dave Airlie <[email protected]> From: Maarten Lankhorst <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2 parents ac9a786 + 2da5bff commit dc49c3b

File tree

10 files changed

+32
-20
lines changed

10 files changed

+32
-20
lines changed

drivers/firmware/sysfb_simplefb.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ __init bool sysfb_parse_mode(const struct screen_info *si,
5151
*
5252
* It's not easily possible to fix this in struct screen_info,
5353
* as this could break UAPI. The best solution is to compute
54-
* bits_per_pixel here and ignore lfb_depth. In the loop below,
54+
* bits_per_pixel from the color bits, reserved bits and
55+
* reported lfb_depth, whichever is highest. In the loop below,
5556
* ignore simplefb formats with alpha bits, as EFI and VESA
5657
* don't specify alpha channels.
5758
*/
@@ -60,6 +61,7 @@ __init bool sysfb_parse_mode(const struct screen_info *si,
6061
si->green_size + si->green_pos,
6162
si->blue_size + si->blue_pos),
6263
si->rsvd_size + si->rsvd_pos);
64+
bits_per_pixel = max_t(u32, bits_per_pixel, si->lfb_depth);
6365
} else {
6466
bits_per_pixel = si->lfb_depth;
6567
}

drivers/gpu/drm/ast/ast_main.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -425,11 +425,12 @@ struct ast_device *ast_device_create(const struct drm_driver *drv,
425425
return ERR_PTR(-EIO);
426426

427427
/*
428-
* If we don't have IO space at all, use MMIO now and
429-
* assume the chip has MMIO enabled by default (rev 0x20
430-
* and higher).
428+
* After AST2500, MMIO is enabled by default, and it should be adopted
429+
* to be compatible with Arm.
431430
*/
432-
if (!(pci_resource_flags(pdev, 2) & IORESOURCE_IO)) {
431+
if (pdev->revision >= 0x40) {
432+
ast->ioregs = ast->regs + AST_IO_MM_OFFSET;
433+
} else if (!(pci_resource_flags(pdev, 2) & IORESOURCE_IO)) {
433434
drm_info(dev, "platform has no IO space, trying MMIO\n");
434435
ast->ioregs = ast->regs + AST_IO_MM_OFFSET;
435436
}

drivers/gpu/drm/drm_fb_helper.c

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -641,19 +641,27 @@ static void drm_fb_helper_damage(struct drm_fb_helper *helper, u32 x, u32 y,
641641
static void drm_fb_helper_memory_range_to_clip(struct fb_info *info, off_t off, size_t len,
642642
struct drm_rect *clip)
643643
{
644+
u32 line_length = info->fix.line_length;
645+
u32 fb_height = info->var.yres;
644646
off_t end = off + len;
645647
u32 x1 = 0;
646-
u32 y1 = off / info->fix.line_length;
648+
u32 y1 = off / line_length;
647649
u32 x2 = info->var.xres;
648-
u32 y2 = DIV_ROUND_UP(end, info->fix.line_length);
650+
u32 y2 = DIV_ROUND_UP(end, line_length);
651+
652+
/* Don't allow any of them beyond the bottom bound of display area */
653+
if (y1 > fb_height)
654+
y1 = fb_height;
655+
if (y2 > fb_height)
656+
y2 = fb_height;
649657

650658
if ((y2 - y1) == 1) {
651659
/*
652660
* We've only written to a single scanline. Try to reduce
653661
* the number of horizontal pixels that need an update.
654662
*/
655-
off_t bit_off = (off % info->fix.line_length) * 8;
656-
off_t bit_end = (end % info->fix.line_length) * 8;
663+
off_t bit_off = (off % line_length) * 8;
664+
off_t bit_end = (end % line_length) * 8;
657665

658666
x1 = bit_off / info->var.bits_per_pixel;
659667
x2 = DIV_ROUND_UP(bit_end, info->var.bits_per_pixel);

drivers/gpu/drm/drm_mipi_dsi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ mipi_dsi_device_register_full(struct mipi_dsi_host *host,
221221
return dsi;
222222
}
223223

224-
dsi->dev.of_node = info->node;
224+
device_set_node(&dsi->dev, of_fwnode_handle(info->node));
225225
dsi->channel = info->channel;
226226
strlcpy(dsi->name, info->type, sizeof(dsi->name));
227227

drivers/gpu/drm/nouveau/include/nvif/if0012.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
#ifndef __NVIF_IF0012_H__
33
#define __NVIF_IF0012_H__
44

5+
#include <drm/display/drm_dp.h>
6+
57
union nvif_outp_args {
68
struct nvif_outp_v0 {
79
__u8 version;
@@ -63,7 +65,7 @@ union nvif_outp_acquire_args {
6365
__u8 hda;
6466
__u8 mst;
6567
__u8 pad04[4];
66-
__u8 dpcd[16];
68+
__u8 dpcd[DP_RECEIVER_CAP_SIZE];
6769
} dp;
6870
};
6971
} v0;

drivers/gpu/drm/nouveau/nvkm/engine/disp/outp.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#define __NVKM_DISP_OUTP_H__
44
#include "priv.h"
55

6+
#include <drm/display/drm_dp.h>
67
#include <subdev/bios.h>
78
#include <subdev/bios/dcb.h>
89
#include <subdev/bios/dp.h>
@@ -42,7 +43,7 @@ struct nvkm_outp {
4243
bool aux_pwr_pu;
4344
u8 lttpr[6];
4445
u8 lttprs;
45-
u8 dpcd[16];
46+
u8 dpcd[DP_RECEIVER_CAP_SIZE];
4647

4748
struct {
4849
int dpcd; /* -1, or index into SUPPORTED_LINK_RATES table */

drivers/gpu/drm/nouveau/nvkm/engine/disp/uoutp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ nvkm_uoutp_mthd_release(struct nvkm_outp *outp, void *argv, u32 argc)
146146
}
147147

148148
static int
149-
nvkm_uoutp_mthd_acquire_dp(struct nvkm_outp *outp, u8 dpcd[16],
149+
nvkm_uoutp_mthd_acquire_dp(struct nvkm_outp *outp, u8 dpcd[DP_RECEIVER_CAP_SIZE],
150150
u8 link_nr, u8 link_bw, bool hda, bool mst)
151151
{
152152
int ret;

drivers/gpu/drm/scheduler/sched_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ static void drm_sched_start_timeout(struct drm_gpu_scheduler *sched)
309309
*/
310310
void drm_sched_fault(struct drm_gpu_scheduler *sched)
311311
{
312-
if (sched->ready)
312+
if (sched->timeout_wq)
313313
mod_delayed_work(sched->timeout_wq, &sched->work_tdr, 0);
314314
}
315315
EXPORT_SYMBOL(drm_sched_fault);

include/drm/display/drm_dp.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -286,9 +286,8 @@
286286

287287
#define DP_DSC_MAX_BITS_PER_PIXEL_HI 0x068 /* eDP 1.4 */
288288
# define DP_DSC_MAX_BITS_PER_PIXEL_HI_MASK (0x3 << 0)
289-
# define DP_DSC_MAX_BITS_PER_PIXEL_HI_SHIFT 8
290-
# define DP_DSC_MAX_BPP_DELTA_VERSION_MASK 0x06
291-
# define DP_DSC_MAX_BPP_DELTA_AVAILABILITY 0x08
289+
# define DP_DSC_MAX_BPP_DELTA_VERSION_MASK (0x3 << 5) /* eDP 1.5 & DP 2.0 */
290+
# define DP_DSC_MAX_BPP_DELTA_AVAILABILITY (1 << 7) /* eDP 1.5 & DP 2.0 */
292291

293292
#define DP_DSC_DEC_COLOR_FORMAT_CAP 0x069
294293
# define DP_DSC_RGB (1 << 0)

include/drm/display/drm_dp_helper.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,9 +181,8 @@ static inline u16
181181
drm_edp_dsc_sink_output_bpp(const u8 dsc_dpcd[DP_DSC_RECEIVER_CAP_SIZE])
182182
{
183183
return dsc_dpcd[DP_DSC_MAX_BITS_PER_PIXEL_LOW - DP_DSC_SUPPORT] |
184-
(dsc_dpcd[DP_DSC_MAX_BITS_PER_PIXEL_HI - DP_DSC_SUPPORT] &
185-
DP_DSC_MAX_BITS_PER_PIXEL_HI_MASK <<
186-
DP_DSC_MAX_BITS_PER_PIXEL_HI_SHIFT);
184+
((dsc_dpcd[DP_DSC_MAX_BITS_PER_PIXEL_HI - DP_DSC_SUPPORT] &
185+
DP_DSC_MAX_BITS_PER_PIXEL_HI_MASK) << 8);
187186
}
188187

189188
static inline u32

0 commit comments

Comments
 (0)