Skip to content

Commit 38ba2b8

Browse files
committed
gem5 display: a bit more info on dp650
1 parent 61fa998 commit 38ba2b8

File tree

4 files changed

+55
-7
lines changed

4 files changed

+55
-7
lines changed

README.adoc

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1704,7 +1704,7 @@ Bibliography:
17041704

17051705
We source the Linux kernel GDB scripts by default for `lx-symbols`, but they also contains some other goodies worth looking into.
17061706

1707-
Those scripts basically parse some in-kernel datastructures to offer greater visibility with GDB.
1707+
Those scripts basically parse some in-kernel data structures to offer greater visibility with GDB.
17081708

17091709
All defined commands are prefixed by `lx-`, so to get a full list just try to tab complete that.
17101710

@@ -3532,7 +3532,7 @@ and when we connect it shows a message:
35323532
info: VNC client attached
35333533
....
35343534

3535-
Alternatively, you can also view the frames with `--frame-capture`:
3535+
Alternatively, you can also dump each new frame to an image file with `--frame-capture`:
35363536

35373537
....
35383538
./run \
@@ -3543,9 +3543,15 @@ Alternatively, you can also view the frames with `--frame-capture`:
35433543
;
35443544
....
35453545

3546-
This option dumps one compressed PNG whenever the screen image changes inside `m5out`, indexed by the cycle ID. This allows for more controlled experiments.
3546+
This creates on compressed PNG whenever the screen image changes inside the <<m5out-directory>> with filename of type:
35473547

3548-
It is fun to see how we get one new frame whenever the white underscore cursor appears and reappears under the penguin.
3548+
....
3549+
frames_system.vncserver/fb.<frame-index>.<timestamp>.png.gz
3550+
....
3551+
3552+
It is fun to see how we get one new frame whenever the white underscore cursor appears and reappears under the penguin!
3553+
3554+
The last frame is always available uncompressed at: `system.framebuffer.png`.
35493555

35503556
TODO <<kmscube>> failed on `aarch64` with:
35513557

@@ -3574,6 +3580,28 @@ git -C "$(./getvar linux_src_dir)" checkout -
35743580

35753581
This is because the gem5 `aarch64` defconfig does not enable HDLCD like the 32 bit one `arm` one for some reason.
35763582

3583+
==== gem5 graphic mode DP650
3584+
3585+
TODO get working. There is an unmerged patchset at: https://gem5-review.googlesource.com/c/public/gem5/+/11036/1
3586+
3587+
The DP650 is a newer display hardware than HDLCD. TODO is its interface publicly documented anywhere? Since it has a gem5 model and link:https://github.com/torvalds/linux/blob/v4.19/drivers/gpu/drm/arm/Kconfig#L39[in-tree Linux kernel support], that information cannot be secret?
3588+
3589+
The key option to enable support in Linux is `DRM_MALI_DISPLAY=y` which we enable at link:linux_config/display[].
3590+
3591+
....
3592+
./build-linux
3593+
git -C "$(./getvar linux_src_dir)" fetch https://gem5.googlesource.com/arm/linux gem5/v4.15:gem5/v4.15
3594+
git -C "$(./getvar linux_src_dir)" checkout gem5/v4.15
3595+
./build-linux \
3596+
--arch aarch64 \
3597+
--config-fragment linux_config/display \
3598+
--custom-config-file "$(./getvar linux_src_dir)/arch/arm64/configs/gem5_defconfig" \
3599+
--linux-build-id gem5-v4.15 \
3600+
;
3601+
git -C "$(./getvar linux_src_dir)" checkout -
3602+
./run --arch aarch64 --dp650 --gem5 --linux-build-id gem5-v4.15
3603+
....
3604+
35773605
==== Graphic mode gem5 internals
35783606

35793607
We cannot use mainline Linux because the <<gem5-arm-linux-kernel-patches>> are required at least to provide the `CONFIG_DRM_VIRT_ENCODER` option.
@@ -9333,7 +9361,7 @@ since boot has already happened, and the parameters are already in the RAM of th
93339361
Checkpoints are stored inside the <<m5out-directory>> at:
93349362

93359363
....
9336-
"$(./getvar --gem5 run_dir)/m5out/cpt.<checkpoint-time>"
9364+
"$(./getvar --gem5 m5out_dir)/cpt.<checkpoint-time>"
93379365
....
93389366

93399367
where `<checkpoint-time>` is the cycle number at which the checkpoint was taken.

common.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,10 @@ def get_argparse(default_args=None, argparse_args=None):
312312
'-L', '--linux-build-id', default=default_build_id,
313313
help='Linux build ID. Allows you to keep multiple separate Linux builds. Default: %(default)s'
314314
)
315+
parser.add_argument(
316+
'--linux-build-dir',
317+
help='Select the directory that contains the Linux kernel build. Overrides linux-build-id.'
318+
)
315319
parser.add_argument(
316320
'--machine',
317321
help='''Machine type.
@@ -856,8 +860,11 @@ def setup(parser):
856860

857861
# Linux
858862
common.linux_buildroot_build_dir = os.path.join(common.buildroot_build_build_dir, 'linux-custom')
859-
common.linux_build_dir = os.path.join(common.out_dir, 'linux', args.linux_build_id, args.arch)
860-
common.lkmc_vmlinux = os.path.join(common.linux_build_dir, "vmlinux")
863+
if args.linux_build_dir is None:
864+
common.linux_build_dir = os.path.join(common.out_dir, 'linux', args.linux_build_id, args.arch)
865+
else:
866+
common.linux_build_dir = args.linux_build_dir
867+
common.lkmc_vmlinux = os.path.join(common.linux_build_dir, 'vmlinux')
861868
if args.arch == 'arm':
862869
common.linux_arch = 'arm'
863870
common.linux_image_prefix = os.path.join('arch', common.linux_arch, 'boot', 'zImage')

linux_config/display

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,7 @@ CONFIG_DRM_VIRTIO_GPU=y
55

66
## gem5
77
CONFIG_DRM_HDLCD=y
8+
# DP650.
9+
DRM_MALI_DISPLAY=y
810
# Only present in the gem5 fork.
911
CONFIG_DRM_VIRT_ENCODER=y

test-gem5-graphics

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env bash
2+
# Quick and dirty implementation, relies on configs.
3+
# Check that the third image matches a reference penguin SHA.
4+
# https://softwarerecs.stackexchange.com/questions/9774/command-line-tool-to-check-whether-two-images-are-exactly-the-same-graphically/9779#9779
5+
set -eux
6+
rm -rf "$(./getvar "$@" m5out_dir)/frames_system.vncserver"
7+
./run --eval 'm5 exit' --tmux "$@" -- --frame-capture
8+
gz="$(echo "$(./getvar m5out_dir)/frames_system.vncserver/fb.000002."*.gz)"
9+
png="${gz%.*}"
10+
gunzip --keep "$gz"
11+
[ "$(identify -format '%#' "$png")" = dc41b947487026acdceae8a757259d5a1a4752fd97c1da9ce6df9b49013babed ]

0 commit comments

Comments
 (0)