[Yellowstone] Add a method to get the framebuffer info from yellowstone.

This commit is contained in:
Drew Galbraith 2023-11-09 11:33:32 -08:00
parent d13e1a238f
commit 9e05b3b3dd
10 changed files with 267 additions and 8 deletions

View file

@ -175,6 +175,130 @@ uint64_t AhciInfo::SerializeToBytes(glcr::ByteBuffer& bytes, uint64_t offset, gl
return next_extension;
}
void FramebufferInfo::ParseFromBytes(const glcr::ByteBuffer& bytes, uint64_t offset) {
CheckHeader(bytes);
// Parse address_phys.
set_address_phys(bytes.At<uint64_t>(offset + header_size + (8 * 0)));
// Parse width.
set_width(bytes.At<uint64_t>(offset + header_size + (8 * 1)));
// Parse height.
set_height(bytes.At<uint64_t>(offset + header_size + (8 * 2)));
// Parse pitch.
set_pitch(bytes.At<uint64_t>(offset + header_size + (8 * 3)));
// Parse bpp.
set_bpp(bytes.At<uint64_t>(offset + header_size + (8 * 4)));
// Parse memory_model.
set_memory_model(bytes.At<uint64_t>(offset + header_size + (8 * 5)));
// Parse red_mask_size.
set_red_mask_size(bytes.At<uint64_t>(offset + header_size + (8 * 6)));
// Parse red_mask_shift.
set_red_mask_shift(bytes.At<uint64_t>(offset + header_size + (8 * 7)));
// Parse green_mask_size.
set_green_mask_size(bytes.At<uint64_t>(offset + header_size + (8 * 8)));
// Parse green_mask_shift.
set_green_mask_shift(bytes.At<uint64_t>(offset + header_size + (8 * 9)));
// Parse blue_mask_size.
set_blue_mask_size(bytes.At<uint64_t>(offset + header_size + (8 * 10)));
// Parse blue_mask_shift.
set_blue_mask_shift(bytes.At<uint64_t>(offset + header_size + (8 * 11)));
}
void FramebufferInfo::ParseFromBytes(const glcr::ByteBuffer& bytes, uint64_t offset, const glcr::CapBuffer& caps) {
CheckHeader(bytes);
// Parse address_phys.
set_address_phys(bytes.At<uint64_t>(offset + header_size + (8 * 0)));
// Parse width.
set_width(bytes.At<uint64_t>(offset + header_size + (8 * 1)));
// Parse height.
set_height(bytes.At<uint64_t>(offset + header_size + (8 * 2)));
// Parse pitch.
set_pitch(bytes.At<uint64_t>(offset + header_size + (8 * 3)));
// Parse bpp.
set_bpp(bytes.At<uint64_t>(offset + header_size + (8 * 4)));
// Parse memory_model.
set_memory_model(bytes.At<uint64_t>(offset + header_size + (8 * 5)));
// Parse red_mask_size.
set_red_mask_size(bytes.At<uint64_t>(offset + header_size + (8 * 6)));
// Parse red_mask_shift.
set_red_mask_shift(bytes.At<uint64_t>(offset + header_size + (8 * 7)));
// Parse green_mask_size.
set_green_mask_size(bytes.At<uint64_t>(offset + header_size + (8 * 8)));
// Parse green_mask_shift.
set_green_mask_shift(bytes.At<uint64_t>(offset + header_size + (8 * 9)));
// Parse blue_mask_size.
set_blue_mask_size(bytes.At<uint64_t>(offset + header_size + (8 * 10)));
// Parse blue_mask_shift.
set_blue_mask_shift(bytes.At<uint64_t>(offset + header_size + (8 * 11)));
}
uint64_t FramebufferInfo::SerializeToBytes(glcr::ByteBuffer& bytes, uint64_t offset) const {
uint32_t next_extension = header_size + 8 * 12;
const uint32_t core_size = next_extension;
// Write address_phys.
bytes.WriteAt<uint64_t>(offset + header_size + (8 * 0), address_phys());
// Write width.
bytes.WriteAt<uint64_t>(offset + header_size + (8 * 1), width());
// Write height.
bytes.WriteAt<uint64_t>(offset + header_size + (8 * 2), height());
// Write pitch.
bytes.WriteAt<uint64_t>(offset + header_size + (8 * 3), pitch());
// Write bpp.
bytes.WriteAt<uint64_t>(offset + header_size + (8 * 4), bpp());
// Write memory_model.
bytes.WriteAt<uint64_t>(offset + header_size + (8 * 5), memory_model());
// Write red_mask_size.
bytes.WriteAt<uint64_t>(offset + header_size + (8 * 6), red_mask_size());
// Write red_mask_shift.
bytes.WriteAt<uint64_t>(offset + header_size + (8 * 7), red_mask_shift());
// Write green_mask_size.
bytes.WriteAt<uint64_t>(offset + header_size + (8 * 8), green_mask_size());
// Write green_mask_shift.
bytes.WriteAt<uint64_t>(offset + header_size + (8 * 9), green_mask_shift());
// Write blue_mask_size.
bytes.WriteAt<uint64_t>(offset + header_size + (8 * 10), blue_mask_size());
// Write blue_mask_shift.
bytes.WriteAt<uint64_t>(offset + header_size + (8 * 11), blue_mask_shift());
// The next extension pointer is the length of the message.
WriteHeader(bytes, offset, core_size, next_extension);
return next_extension;
}
uint64_t FramebufferInfo::SerializeToBytes(glcr::ByteBuffer& bytes, uint64_t offset, glcr::CapBuffer& caps) const {
uint32_t next_extension = header_size + 8 * 12;
const uint32_t core_size = next_extension;
uint64_t next_cap = 0;
// Write address_phys.
bytes.WriteAt<uint64_t>(offset + header_size + (8 * 0), address_phys());
// Write width.
bytes.WriteAt<uint64_t>(offset + header_size + (8 * 1), width());
// Write height.
bytes.WriteAt<uint64_t>(offset + header_size + (8 * 2), height());
// Write pitch.
bytes.WriteAt<uint64_t>(offset + header_size + (8 * 3), pitch());
// Write bpp.
bytes.WriteAt<uint64_t>(offset + header_size + (8 * 4), bpp());
// Write memory_model.
bytes.WriteAt<uint64_t>(offset + header_size + (8 * 5), memory_model());
// Write red_mask_size.
bytes.WriteAt<uint64_t>(offset + header_size + (8 * 6), red_mask_size());
// Write red_mask_shift.
bytes.WriteAt<uint64_t>(offset + header_size + (8 * 7), red_mask_shift());
// Write green_mask_size.
bytes.WriteAt<uint64_t>(offset + header_size + (8 * 8), green_mask_size());
// Write green_mask_shift.
bytes.WriteAt<uint64_t>(offset + header_size + (8 * 9), green_mask_shift());
// Write blue_mask_size.
bytes.WriteAt<uint64_t>(offset + header_size + (8 * 10), blue_mask_size());
// Write blue_mask_shift.
bytes.WriteAt<uint64_t>(offset + header_size + (8 * 11), blue_mask_shift());
// The next extension pointer is the length of the message.
WriteHeader(bytes, offset, core_size, next_extension);
return next_extension;
}
void DenaliInfo::ParseFromBytes(const glcr::ByteBuffer& bytes, uint64_t offset) {
CheckHeader(bytes);
// Parse denali_endpoint.