Besides pkg-query(8), you can also use ports-mgmt/pkg_tree (there are others 'more graphical'). pkg_tree(7) gives an 'ascii-art'-like overview of the dependencies.
Below an example run wrt graphics/drm-61-kmod. Discovering the dependencies from top to bottom,
and
Below an example run wrt graphics/drm-61-kmod. Discovering the dependencies from top to bottom,
and
-reverse
:
Rich (BB code):
[1-0] % pkg_tree -rv drm-61-kmod | nl
1 drm-61-kmod-6.1.128.1402000_2
2 \__ drm-kmod-20220907_3
[2-0] % pkg_tree -v drm-kmod | nl
1 drm-kmod-20220907_3
2 |\__ gpu-firmware-kmod-20241114,1
3 | |\__ gpu-firmware-radeon-kmod-aruba-20220511.1402000
<snap>
129 | \__ gpu-firmware-amd-kmod-yellow-carp-20230625.1402000_2
130 \__ drm-61-kmod-6.1.128.1402000_2
[3-0] % pkg_tree -rv gpu-firmware-amd-kmod-yellow-carp | nl
1 gpu-firmware-amd-kmod-yellow-carp-20230625.1402000_2
2 \__ gpu-firmware-kmod-20241114,1
3 \__ drm-kmod-20220907_3
[4-0] %