Patrick Rudolph has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/41189 )
Change subject: payloads: Add gfxtest ......................................................................
payloads: Add gfxtest
Draws 4 colored bars to the screen. To be used when debugging framebuffer code.
Change-Id: I0e1fd6344925edc0ceb42286bf7492bc16a2668c Signed-off-by: Patrick Rudolph siro@das-labor.org --- M payloads/Kconfig M payloads/Makefile.inc A payloads/gfxtest/Makefile A payloads/gfxtest/gfxtest.c 4 files changed, 95 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/89/41189/1
diff --git a/payloads/Kconfig b/payloads/Kconfig index cfb28d6..3e34101 100644 --- a/payloads/Kconfig +++ b/payloads/Kconfig @@ -138,6 +138,14 @@ nvramcui can be loaded as a secondary payload under SeaBIOS, GRUB, or any other payload that can load additional payloads.
+config GFXTEST_SECONDARY_PAYLOAD + bool "Load gfxtest as a secondary payload" + default n + depends on ARCH_X86 + help + gfxtest can be loaded as a secondary payload under SeaBIOS, GRUB, + or any other payload that can load additional payloads. + config TINT_SECONDARY_PAYLOAD bool "Load tint as a secondary payload" default n diff --git a/payloads/Makefile.inc b/payloads/Makefile.inc index 83d3910..df68b18 100644 --- a/payloads/Makefile.inc +++ b/payloads/Makefile.inc @@ -18,6 +18,11 @@ img/coreinfo-type := payload img/coreinfo-compression := $(CBFS_SECONDARY_PAYLOAD_COMPRESS_FLAG)
+cbfs-files-$(CONFIG_GFXTEST_SECONDARY_PAYLOAD) += img/gfxtest +img/gfxtest-file := payloads/gfxtest/gfxtest.elf +img/gfxtest-type := payload +img/gfxtest-compression := $(CBFS_SECONDARY_PAYLOAD_COMPRESS_FLAG) + cbfs-files-$(CONFIG_NVRAMCUI_SECONDARY_PAYLOAD) += img/nvramcui img/nvramcui-file := payloads/nvramcui/nvramcui.elf img/nvramcui-type := payload @@ -25,6 +30,7 @@
PAYLOADS_LIST=\ payloads/coreinfo \ +payloads/gfxtest \ payloads/nvramcui \ payloads/libpayload \ payloads/external/depthcharge \ @@ -41,6 +47,9 @@ payloads/coreinfo/build/coreinfo.elf coreinfo: $(MAKE) -C payloads/coreinfo defaultbuild
+payloads/gfxtest/gfxtest.elf gfxtest: + $(MAKE) -C payloads/gfxtest + payloads/nvramcui/nvramcui.elf nvramcui: $(MAKE) -C payloads/nvramcui
@@ -53,4 +62,4 @@ print-repo-info-payloads: -$(foreach payload, $(PAYLOADS_LIST), $(MAKE) -C $(payload) print-repo-info 2>/dev/null; )
-.PHONY: clean-payloads distclean-payloads print-repo-info-payloads nvramcui coreinfo +.PHONY: clean-payloads distclean-payloads print-repo-info-payloads nvramcui coreinfo gfxtest diff --git a/payloads/gfxtest/Makefile b/payloads/gfxtest/Makefile new file mode 100644 index 0000000..c4cfff9 --- /dev/null +++ b/payloads/gfxtest/Makefile @@ -0,0 +1,34 @@ +LIBPAYLOAD_DIR=$(CURDIR)/libpayload +XCOMPILE=$(LIBPAYLOAD_DIR)/libpayload.xcompile +# build libpayload and put .config file in $(CURDIR) instead of ../libpayload +# to avoid pollute the libpayload source directory and possible conflicts +LPOPTS=obj="$(CURDIR)/build" DESTDIR="$(CURDIR)" DOTCONFIG="$(CURDIR)/.config" +CFLAGS += -Wall -Wvla -Werror -Os -ffreestanding -nostdinc -nostdlib + +all: gfxtest.elf + +$(LIBPAYLOAD_DIR): + $(MAKE) -C ../libpayload $(LPOPTS) defconfig + $(MAKE) -C ../libpayload $(LPOPTS) + $(MAKE) -C ../libpayload $(LPOPTS) install + +ifneq ($(strip $(wildcard libpayload)),) +include $(XCOMPILE) +LPGCC = CC="$(GCC_CC_x86_32)" "$(LIBPAYLOAD_DIR)/bin/lpgcc" +%.elf: %.c Makefile + $(LPGCC) $(CFLAGS) -o $*.elf $*.c +else +# If libpayload is not found, first build libpayload, +# then do the make, this time it'll find libpayload +# and generate the gfxtest.elf target +%.elf: $(LIBPAYLOAD_DIR) + $(MAKE) all +endif + +clean: + rm -f gfxtest.elf + +distclean: clean + rm -rf build libpayload .config .config.old + +.PHONY: all clean distclean diff --git a/payloads/gfxtest/gfxtest.c b/payloads/gfxtest/gfxtest.c new file mode 100644 index 0000000..91bf4ff --- /dev/null +++ b/payloads/gfxtest/gfxtest.c @@ -0,0 +1,43 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* This file is part of the coreboot project. */ + +#include <libpayload.h> + +int main(void) +{ + struct rgb_color black = {0}; + int i; + + struct rgb_color colors[] = { + {0xff, 0x00, 0x00}, + {0x00, 0xff, 0x00}, + {0x00, 0x00, 0xff}, + {0xff, 0xff, 0xff}, + }; + + if (CONFIG(LP_USB)) + usb_initialize(); + + /* coreboot data structures */ + lib_get_sysinfo(); + + if (!lib_sysinfo.framebuffer) { + printf("No framebuffer found\n"); + halt(); + } + + clear_screen(&black); + printf("GFXTEST - R G B W\n"); + + for (i = 0; i < ARRAY_SIZE(colors); i++) { + struct rect box; + box.size.width = CANVAS_SCALE / ARRAY_SIZE(colors); + box.offset.x = box.size.width * i; + box.offset.y = CANVAS_SCALE * 1 / 10; + box.size.height = CANVAS_SCALE * 9 / 10; + + draw_box(&box, &colors[i]); + } + + halt(); +}
Paul Menzel has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/41189 )
Change subject: payloads: Add gfxtest ......................................................................
Patch Set 1: Code-Review+1
(3 comments)
Very nice.
https://review.coreboot.org/c/coreboot/+/41189/1/payloads/gfxtest/gfxtest.c File payloads/gfxtest/gfxtest.c:
https://review.coreboot.org/c/coreboot/+/41189/1/payloads/gfxtest/gfxtest.c@... PS1, Line 8: {0} Spaces around 0? Did you run this through, for example, clang-format?
https://review.coreboot.org/c/coreboot/+/41189/1/payloads/gfxtest/gfxtest.c@... PS1, Line 9: int unsigned int
https://review.coreboot.org/c/coreboot/+/41189/1/payloads/gfxtest/gfxtest.c@... PS1, Line 19: usb_initialize(); Why? I do not see any input handling?
Attention is currently required from: Nico Huber, Angel Pons, Daisuke Nojiri, Yu-Ping Wu, Patrick Rudolph. Paul Menzel has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/41189 )
Change subject: payloads: Add gfxtest ......................................................................
Patch Set 1:
(1 comment)
File payloads/gfxtest/gfxtest.c:
https://review.coreboot.org/c/coreboot/+/41189/comment/470f5b7a_942ff41e PS1, Line 8: {0}
Spaces around 0? Did you run this through, for example, clang-format?
Below no spaces are used either, so leave it.
Attention is currently required from: Nico Huber, Daisuke Nojiri, Yu-Ping Wu, Patrick Rudolph. Paul Menzel has uploaded a new patch set (#2) to the change originally created by Patrick Rudolph. ( https://review.coreboot.org/c/coreboot/+/41189 )
Change subject: payloads: Add gfxtest ......................................................................
payloads: Add gfxtest
Draws 4 colored bars to the screen. To be used when debugging framebuffer code.
Change-Id: I0e1fd6344925edc0ceb42286bf7492bc16a2668c Signed-off-by: Patrick Rudolph siro@das-labor.org Signed-off-by: Paul Menzel pmenzel@molgen.mpg.de --- M payloads/Kconfig M payloads/Makefile.inc A payloads/gfxtest/.gitignore A payloads/gfxtest/Makefile A payloads/gfxtest/gfxtest.c M util/testing/Makefile.inc 6 files changed, 77 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/89/41189/2
Attention is currently required from: Nico Huber, Daisuke Nojiri, Yu-Ping Wu, Patrick Rudolph. Paul Menzel has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/41189 )
Change subject: payloads: Add gfxtest ......................................................................
Patch Set 2:
(1 comment)
Patchset:
PS2: Fails with:
/opt/xgcc/lib/gcc/i386-elf/11.2.0/../../../../i386-elf/bin/ld.bfd: /home/coreboot/node-root/workspace/coreboot-gerrit/payloads/gfxtest/libpayload/libpayload.a(main.libc.o): in function `start_main':
Also, with OBJS empty/not set, `$(shell mkdir -p $(sort $(dir $(OBJS))))` in `payloads/libpayload/Makefile.payload` fails:
mkdir: missing operand Try 'mkdir --help' for more information.
Attention is currently required from: Nico Huber, Daisuke Nojiri, Yu-Ping Wu, Patrick Rudolph. Paul Menzel has uploaded a new patch set (#3) to the change originally created by Patrick Rudolph. ( https://review.coreboot.org/c/coreboot/+/41189 )
Change subject: payloads: Add gfxtest ......................................................................
payloads: Add gfxtest
Draws 4 colored bars to the screen. To be used when debugging framebuffer code.
Change-Id: I0e1fd6344925edc0ceb42286bf7492bc16a2668c Signed-off-by: Patrick Rudolph siro@das-labor.org Signed-off-by: Paul Menzel pmenzel@molgen.mpg.de --- M payloads/Kconfig M payloads/Makefile.inc A payloads/gfxtest/.gitignore A payloads/gfxtest/Makefile A payloads/gfxtest/gfxtest.c M util/testing/Makefile.inc 6 files changed, 78 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/89/41189/3
Attention is currently required from: Nico Huber, Daisuke Nojiri, Yu-Ping Wu, Patrick Rudolph. Paul Menzel has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/41189 )
Change subject: payloads: Add gfxtest ......................................................................
Patch Set 3:
(1 comment)
Patchset:
PS3: It builds now, but does not work in QEMU (i440fx/q35):
Run img/gfxtest Calling addr 0x00100000 No framebuffer found