Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Path: blob/next/external/patch/misc/0004-bootsplash.patch
Views: 3959
diff --git a/drivers/video/fbdev/core/bootsplash_render.c b/drivers/video/fbdev/core/bootsplash_render.c1index 8c09c306ff67..07e3a4eab811 1006442--- a/drivers/video/fbdev/core/bootsplash_render.c3+++ b/drivers/video/fbdev/core/bootsplash_render.c4@@ -155,6 +155,7 @@ void bootsplash_do_render_pictures(struct fb_info *info,5for (i = 0; i < fp->header->num_pics; i++) {6struct splash_blob_priv *bp;7struct splash_pic_priv *pp = &fp->pics[i];8+ const struct splash_pic_header *ph = pp->pic_header;9long dst_xoff, dst_yoff;1011if (pp->blobs_loaded < 1)12@@ -165,8 +166,139 @@ void bootsplash_do_render_pictures(struct fb_info *info,13if (!bp || bp->blob_header->type != 0)14continue;1516- dst_xoff = (info->var.xres - pp->pic_header->width) / 2;17- dst_yoff = (info->var.yres - pp->pic_header->height) / 2;18+ switch (ph->position) {19+ case SPLASH_POS_FLAG_CORNER | SPLASH_CORNER_TOP_LEFT:20+ dst_xoff = 0;21+ dst_yoff = 0;22+23+ dst_xoff += ph->position_offset;24+ dst_yoff += ph->position_offset;25+ break;26+ case SPLASH_POS_FLAG_CORNER | SPLASH_CORNER_TOP:27+ dst_xoff = info->var.xres - pp->pic_header->width;28+ dst_xoff /= 2;29+ dst_yoff = 0;30+31+ dst_yoff += ph->position_offset;32+ break;33+ case SPLASH_POS_FLAG_CORNER | SPLASH_CORNER_TOP_RIGHT:34+ dst_xoff = info->var.xres - pp->pic_header->width;35+ dst_yoff = 0;36+37+ dst_xoff -= ph->position_offset;38+ dst_yoff += ph->position_offset;39+ break;40+ case SPLASH_POS_FLAG_CORNER | SPLASH_CORNER_RIGHT:41+ dst_xoff = info->var.xres - pp->pic_header->width;42+ dst_yoff = info->var.yres - pp->pic_header->height;43+ dst_yoff /= 2;44+45+ dst_xoff -= ph->position_offset;46+ break;47+ case SPLASH_POS_FLAG_CORNER | SPLASH_CORNER_BOTTOM_RIGHT:48+ dst_xoff = info->var.xres - pp->pic_header->width;49+ dst_yoff = info->var.yres - pp->pic_header->height;50+51+ dst_xoff -= ph->position_offset;52+ dst_yoff -= ph->position_offset;53+ break;54+ case SPLASH_POS_FLAG_CORNER | SPLASH_CORNER_BOTTOM:55+ dst_xoff = info->var.xres - pp->pic_header->width;56+ dst_xoff /= 2;57+ dst_yoff = info->var.yres - pp->pic_header->height;58+59+ dst_yoff -= ph->position_offset;60+ break;61+ case SPLASH_POS_FLAG_CORNER | SPLASH_CORNER_BOTTOM_LEFT:62+ dst_xoff = 0 + ph->position_offset;63+ dst_yoff = info->var.yres - pp->pic_header->height64+ - ph->position_offset;65+ break;66+ case SPLASH_POS_FLAG_CORNER | SPLASH_CORNER_LEFT:67+ dst_xoff = 0;68+ dst_yoff = info->var.yres - pp->pic_header->height;69+ dst_yoff /= 2;70+71+ dst_xoff += ph->position_offset;72+ break;73+74+ case SPLASH_CORNER_TOP_LEFT:75+ dst_xoff = info->var.xres - pp->pic_header->width;76+ dst_xoff /= 2;77+ dst_yoff = info->var.yres - pp->pic_header->height;78+ dst_yoff /= 2;79+80+ dst_xoff -= ph->position_offset;81+ dst_yoff -= ph->position_offset;82+ break;83+ case SPLASH_CORNER_TOP:84+ dst_xoff = info->var.xres - pp->pic_header->width;85+ dst_xoff /= 2;86+ dst_yoff = info->var.yres - pp->pic_header->height;87+ dst_yoff /= 2;88+89+ dst_yoff -= ph->position_offset;90+ break;91+ case SPLASH_CORNER_TOP_RIGHT:92+ dst_xoff = info->var.xres - pp->pic_header->width;93+ dst_xoff /= 2;94+ dst_yoff = info->var.yres - pp->pic_header->height;95+ dst_yoff /= 2;96+97+ dst_xoff += ph->position_offset;98+ dst_yoff -= ph->position_offset;99+ break;100+ case SPLASH_CORNER_RIGHT:101+ dst_xoff = info->var.xres - pp->pic_header->width;102+ dst_xoff /= 2;103+ dst_yoff = info->var.yres - pp->pic_header->height;104+ dst_yoff /= 2;105+106+ dst_xoff += ph->position_offset;107+ break;108+ case SPLASH_CORNER_BOTTOM_RIGHT:109+ dst_xoff = info->var.xres - pp->pic_header->width;110+ dst_xoff /= 2;111+ dst_yoff = info->var.yres - pp->pic_header->height;112+ dst_yoff /= 2;113+114+ dst_xoff += ph->position_offset;115+ dst_yoff += ph->position_offset;116+ break;117+ case SPLASH_CORNER_BOTTOM:118+ dst_xoff = info->var.xres - pp->pic_header->width;119+ dst_xoff /= 2;120+ dst_yoff = info->var.yres - pp->pic_header->height;121+ dst_yoff /= 2;122+123+ dst_yoff += ph->position_offset;124+ break;125+ case SPLASH_CORNER_BOTTOM_LEFT:126+ dst_xoff = info->var.xres - pp->pic_header->width;127+ dst_xoff /= 2;128+ dst_yoff = info->var.yres - pp->pic_header->height;129+ dst_yoff /= 2;130+131+ dst_xoff -= ph->position_offset;132+ dst_yoff += ph->position_offset;133+ break;134+ case SPLASH_CORNER_LEFT:135+ dst_xoff = info->var.xres - pp->pic_header->width;136+ dst_xoff /= 2;137+ dst_yoff = info->var.yres - pp->pic_header->height;138+ dst_yoff /= 2;139+140+ dst_xoff -= ph->position_offset;141+ break;142+143+ default:144+ /* As a fallback, center the picture. */145+ dst_xoff = info->var.xres - pp->pic_header->width;146+ dst_xoff /= 2;147+ dst_yoff = info->var.yres - pp->pic_header->height;148+ dst_yoff /= 2;149+ break;150+ }151152if (dst_xoff < 0153|| dst_yoff < 0154diff --git a/include/uapi/linux/bootsplash_file.h b/include/uapi/linux/bootsplash_file.h155index 89dc9cca8f0c..71cedcc68933 100644156--- a/include/uapi/linux/bootsplash_file.h157+++ b/include/uapi/linux/bootsplash_file.h158@@ -91,7 +91,32 @@ struct splash_pic_header {159*/160uint8_t num_blobs;161162- uint8_t padding[27];163+ /*164+ * Corner to move the picture to / from.165+ * 0x00 - Top left166+ * 0x01 - Top167+ * 0x02 - Top right168+ * 0x03 - Right169+ * 0x04 - Bottom right170+ * 0x05 - Bottom171+ * 0x06 - Bottom left172+ * 0x07 - Left173+ *174+ * Flags:175+ * 0x10 - Calculate offset from the corner towards the center,176+ * rather than from the center towards the corner177+ */178+ uint8_t position;179+180+ /*181+ * Pixel offset from the selected position.182+ * Example: If the picture is in the top right corner, it will183+ * be placed position_offset pixels from the top and184+ * position_offset pixels from the right margin.185+ */186+ uint16_t position_offset;187+188+ uint8_t padding[24];189} __attribute__((__packed__));190191192@@ -115,4 +140,22 @@ struct splash_blob_header {193uint8_t padding[9];194} __attribute__((__packed__));195196+197+198+199+/*200+ * Enums for on-disk types201+ */202+enum splash_position {203+ SPLASH_CORNER_TOP_LEFT = 0,204+ SPLASH_CORNER_TOP = 1,205+ SPLASH_CORNER_TOP_RIGHT = 2,206+ SPLASH_CORNER_RIGHT = 3,207+ SPLASH_CORNER_BOTTOM_RIGHT = 4,208+ SPLASH_CORNER_BOTTOM = 5,209+ SPLASH_CORNER_BOTTOM_LEFT = 6,210+ SPLASH_CORNER_LEFT = 7,211+ SPLASH_POS_FLAG_CORNER = 0x10,212+};213+214#endif215216217