Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <airlied@redhat.com>
From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/b34135e3-2651-4e0a-a776-9b047882b1b2@linux.intel.com

+32 -20
+3 -1
drivers/firmware/sysfb_simplefb.c
··· 51 51 * 52 52 * It's not easily possible to fix this in struct screen_info, 53 53 * 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, 55 56 * ignore simplefb formats with alpha bits, as EFI and VESA 56 57 * don't specify alpha channels. 57 58 */ ··· 61 60 si->green_size + si->green_pos, 62 61 si->blue_size + si->blue_pos), 63 62 si->rsvd_size + si->rsvd_pos); 63 + bits_per_pixel = max_t(u32, bits_per_pixel, si->lfb_depth); 64 64 } else { 65 65 bits_per_pixel = si->lfb_depth; 66 66 }
+5 -4
drivers/gpu/drm/ast/ast_main.c
··· 425 425 return ERR_PTR(-EIO); 426 426 427 427 /* 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. 431 430 */ 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)) { 433 434 drm_info(dev, "platform has no IO space, trying MMIO\n"); 434 435 ast->ioregs = ast->regs + AST_IO_MM_OFFSET; 435 436 }
+12 -4
drivers/gpu/drm/drm_fb_helper.c
··· 641 641 static void drm_fb_helper_memory_range_to_clip(struct fb_info *info, off_t off, size_t len, 642 642 struct drm_rect *clip) 643 643 { 644 + u32 line_length = info->fix.line_length; 645 + u32 fb_height = info->var.yres; 644 646 off_t end = off + len; 645 647 u32 x1 = 0; 646 - u32 y1 = off / info->fix.line_length; 648 + u32 y1 = off / line_length; 647 649 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; 649 657 650 658 if ((y2 - y1) == 1) { 651 659 /* 652 660 * We've only written to a single scanline. Try to reduce 653 661 * the number of horizontal pixels that need an update. 654 662 */ 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; 657 665 658 666 x1 = bit_off / info->var.bits_per_pixel; 659 667 x2 = DIV_ROUND_UP(bit_end, info->var.bits_per_pixel);
+1 -1
drivers/gpu/drm/drm_mipi_dsi.c
··· 221 221 return dsi; 222 222 } 223 223 224 - dsi->dev.of_node = info->node; 224 + device_set_node(&dsi->dev, of_fwnode_handle(info->node)); 225 225 dsi->channel = info->channel; 226 226 strlcpy(dsi->name, info->type, sizeof(dsi->name)); 227 227
+3 -1
drivers/gpu/drm/nouveau/include/nvif/if0012.h
··· 2 2 #ifndef __NVIF_IF0012_H__ 3 3 #define __NVIF_IF0012_H__ 4 4 5 + #include <drm/display/drm_dp.h> 6 + 5 7 union nvif_outp_args { 6 8 struct nvif_outp_v0 { 7 9 __u8 version; ··· 65 63 __u8 hda; 66 64 __u8 mst; 67 65 __u8 pad04[4]; 68 - __u8 dpcd[16]; 66 + __u8 dpcd[DP_RECEIVER_CAP_SIZE]; 69 67 } dp; 70 68 }; 71 69 } v0;
+2 -1
drivers/gpu/drm/nouveau/nvkm/engine/disp/outp.h
··· 3 3 #define __NVKM_DISP_OUTP_H__ 4 4 #include "priv.h" 5 5 6 + #include <drm/display/drm_dp.h> 6 7 #include <subdev/bios.h> 7 8 #include <subdev/bios/dcb.h> 8 9 #include <subdev/bios/dp.h> ··· 43 42 bool aux_pwr_pu; 44 43 u8 lttpr[6]; 45 44 u8 lttprs; 46 - u8 dpcd[16]; 45 + u8 dpcd[DP_RECEIVER_CAP_SIZE]; 47 46 48 47 struct { 49 48 int dpcd; /* -1, or index into SUPPORTED_LINK_RATES table */
+1 -1
drivers/gpu/drm/nouveau/nvkm/engine/disp/uoutp.c
··· 146 146 } 147 147 148 148 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], 150 150 u8 link_nr, u8 link_bw, bool hda, bool mst) 151 151 { 152 152 int ret;
+1 -1
drivers/gpu/drm/scheduler/sched_main.c
··· 309 309 */ 310 310 void drm_sched_fault(struct drm_gpu_scheduler *sched) 311 311 { 312 - if (sched->ready) 312 + if (sched->timeout_wq) 313 313 mod_delayed_work(sched->timeout_wq, &sched->work_tdr, 0); 314 314 } 315 315 EXPORT_SYMBOL(drm_sched_fault);
+2 -3
include/drm/display/drm_dp.h
··· 286 286 287 287 #define DP_DSC_MAX_BITS_PER_PIXEL_HI 0x068 /* eDP 1.4 */ 288 288 # 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 */ 292 291 293 292 #define DP_DSC_DEC_COLOR_FORMAT_CAP 0x069 294 293 # define DP_DSC_RGB (1 << 0)
+2 -3
include/drm/display/drm_dp_helper.h
··· 181 181 drm_edp_dsc_sink_output_bpp(const u8 dsc_dpcd[DP_DSC_RECEIVER_CAP_SIZE]) 182 182 { 183 183 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); 187 186 } 188 187 189 188 static inline u32