diff options
author | Tom Rini <trini@konsulko.com> | 2022-06-25 08:38:00 -0400 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2022-06-25 08:38:00 -0400 |
commit | 75967970850a932a2359e167fd9950b01e9b99d3 (patch) | |
tree | 9caab0de4f5e3d2aaa3cf8fc0a4ff28ead895e16 | |
parent | 625756083e3358744fbe0a60e0eedc009041782d (diff) | |
parent | 5bc6f8c2a97e5dd3b94e8c3cff3a77c2f5bffd8d (diff) | |
download | u-boot-WIP/25Jun2022.zip u-boot-WIP/25Jun2022.tar.gz u-boot-WIP/25Jun2022.tar.bz2 |
Merge tag 'video-20220625' of https://source.denx.de/u-boot/custodians/u-boot-videoWIP/25Jun2022
- fix building sandbox with NO_SDL=1
- fix stb TrueType to check return value of STBTT_malloc()
- remove not required DM_REGULATOR test in stm32 dsi driver
-rw-r--r-- | arch/sandbox/include/asm/sdl.h | 5 | ||||
-rw-r--r-- | drivers/video/stb_truetype.h | 18 | ||||
-rw-r--r-- | drivers/video/stm32/stm32_dsi.c | 25 |
3 files changed, 30 insertions, 18 deletions
diff --git a/arch/sandbox/include/asm/sdl.h b/arch/sandbox/include/asm/sdl.h index e271a84..56dcb84 100644 --- a/arch/sandbox/include/asm/sdl.h +++ b/arch/sandbox/include/asm/sdl.h @@ -94,6 +94,11 @@ static inline int sandbox_sdl_init_display(int width, int height, int log2_bpp, return -ENODEV; } +static inline int sandbox_sdl_remove_display(void) +{ + return -ENODEV; +} + static inline int sandbox_sdl_sync(void *lcd_base) { return -ENODEV; diff --git a/drivers/video/stb_truetype.h b/drivers/video/stb_truetype.h index 26f4ac2..438bfce 100644 --- a/drivers/video/stb_truetype.h +++ b/drivers/video/stb_truetype.h @@ -1768,10 +1768,13 @@ static void stbtt__rasterize_sorted_edges(stbtt__bitmap *result, stbtt__edge *e, int s; // vertical subsample index unsigned char scanline_data[512], *scanline; - if (result->w > 512) + if (result->w > 512) { scanline = (unsigned char *) STBTT_malloc(result->w, userdata); - else + if (!scanline) + return; + } else { scanline = scanline_data; + } y = off_y * vsubsample; e[n].y0 = (off_y + result->h) * (float) vsubsample + 1; @@ -1821,6 +1824,8 @@ static void stbtt__rasterize_sorted_edges(stbtt__bitmap *result, stbtt__edge *e, while (e->y0 <= scan_y) { if (e->y1 > scan_y) { stbtt__active_edge *z = stbtt__new_active(&hh, e, off_x, scan_y, userdata); + if (!z) + return; // find insertion point if (active == NULL) active = z; @@ -2068,10 +2073,13 @@ static void stbtt__rasterize_sorted_edges(stbtt__bitmap *result, stbtt__edge *e, int y,j=0, i; float scanline_data[129], *scanline, *scanline2; - if (result->w > 64) + if (result->w > 64) { scanline = (float *) STBTT_malloc((result->w*2+1) * sizeof(float), userdata); - else + if (!scanline) + return; + } else { scanline = scanline_data; + } scanline2 = scanline + result->w; @@ -2105,6 +2113,8 @@ static void stbtt__rasterize_sorted_edges(stbtt__bitmap *result, stbtt__edge *e, while (e->y0 <= scan_y_bottom) { if (e->y0 != e->y1) { stbtt__active_edge *z = stbtt__new_active(&hh, e, off_x, scan_y_top, userdata); + if (!z) + return; STBTT_assert(z->ey >= scan_y_top); // insert at front z->next = active; diff --git a/drivers/video/stm32/stm32_dsi.c b/drivers/video/stm32/stm32_dsi.c index 134abd9..5871ac7 100644 --- a/drivers/video/stm32/stm32_dsi.c +++ b/drivers/video/stm32/stm32_dsi.c @@ -433,19 +433,17 @@ static int stm32_dsi_probe(struct udevice *dev) return -EINVAL; } - if (IS_ENABLED(CONFIG_DM_REGULATOR)) { - ret = device_get_supply_regulator(dev, "phy-dsi-supply", - &priv->vdd_reg); - if (ret && ret != -ENOENT) { - dev_err(dev, "Warning: cannot get phy dsi supply\n"); - return -ENODEV; - } + ret = device_get_supply_regulator(dev, "phy-dsi-supply", + &priv->vdd_reg); + if (ret && ret != -ENOENT) { + dev_err(dev, "Warning: cannot get phy dsi supply\n"); + return -ENODEV; + } - if (ret != -ENOENT) { - ret = regulator_set_enable(priv->vdd_reg, true); - if (ret) - return ret; - } + if (ret != -ENOENT) { + ret = regulator_set_enable(priv->vdd_reg, true); + if (ret) + return ret; } ret = clk_get_by_name(device->dev, "pclk", &clk); @@ -493,8 +491,7 @@ static int stm32_dsi_probe(struct udevice *dev) err_clk: clk_disable(&clk); err_reg: - if (IS_ENABLED(CONFIG_DM_REGULATOR)) - regulator_set_enable(priv->vdd_reg, false); + regulator_set_enable(priv->vdd_reg, false); return ret; } |