X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fbase%2Fframebuffer.hh;h=fbeafb4673e826ff415fb0adda6a604ad8772bf4;hb=97887eb6dc9e548c9b5719727fd4783ef157917c;hp=457c6d06de9d0c2d2461cd2a35ccfbe37a2a6058;hpb=db5c9a5f9028fd87a74e1750068511bd311435ae;p=gem5.git diff --git a/src/base/framebuffer.hh b/src/base/framebuffer.hh index 457c6d06d..fbeafb467 100644 --- a/src/base/framebuffer.hh +++ b/src/base/framebuffer.hh @@ -43,9 +43,14 @@ #include #include +#include #include +#include "base/compiler.hh" +#include "base/cprintf.hh" +#include "base/str.hh" #include "base/types.hh" +#include "sim/serialize.hh" /** * Internal gem5 representation of a Pixel. @@ -73,7 +78,6 @@ operator==(const Pixel &lhs, const Pixel &rhs) lhs.padding == rhs.padding; } - /** * Configurable RGB pixel converter. * @@ -208,6 +212,24 @@ class PixelConverter static const PixelConverter rgb565_be; }; +inline bool +to_number(const std::string &value, Pixel &retval) +{ + uint32_t num; + if (!to_number(value, num)) + return false; + + retval = PixelConverter::rgba8888_le.toPixel(num); + return true; +} + +inline std::ostream & +operator<<(std::ostream &os, const Pixel &pxl) +{ + os << csprintf("0x%.08x", PixelConverter::rgba8888_le.fromPixel(pxl)); + return os; +} + /** * Internal gem5 representation of a frame buffer * @@ -219,7 +241,7 @@ class PixelConverter * corner. The backing store is a linear vector of Pixels ordered left * to right starting in the upper left corner. */ -class FrameBuffer +class FrameBuffer : public Serializable { public: /** @@ -234,6 +256,9 @@ class FrameBuffer virtual ~FrameBuffer(); + void serialize(CheckpointOut &cp) const override; + void unserialize(CheckpointIn &cp) override; + /** * Resize the frame buffer. *