Initial project snapshot
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
#pragma once
|
||||
|
||||
#include <optional>
|
||||
|
||||
#include "rdp_worker/graphics/render_update.hpp"
|
||||
|
||||
namespace rdp_worker::graphics {
|
||||
|
||||
struct GraphicsAdapterPolicy {
|
||||
int max_region_area_percent{60};
|
||||
bool allow_full_frame_fallback{true};
|
||||
bool prefer_encoded_updates{true};
|
||||
};
|
||||
|
||||
class GraphicsAdapter {
|
||||
public:
|
||||
explicit GraphicsAdapter(GraphicsAdapterPolicy policy = {});
|
||||
|
||||
[[nodiscard]] const GraphicsAdapterPolicy& Policy() const;
|
||||
|
||||
[[nodiscard]] RenderUpdate MakeFullBgraFrame(std::uint64_t sequence,
|
||||
int width,
|
||||
int height,
|
||||
int stride,
|
||||
std::vector<std::uint8_t> pixels,
|
||||
bool baseline) const;
|
||||
|
||||
[[nodiscard]] std::optional<RenderUpdate> TryMakeBgraRegion(std::uint64_t sequence,
|
||||
int desktop_width,
|
||||
int desktop_height,
|
||||
int stride,
|
||||
Rect region,
|
||||
std::vector<std::uint8_t> pixels) const;
|
||||
|
||||
private:
|
||||
[[nodiscard]] bool RegionAllowed(int desktop_width, int desktop_height, const Rect& region) const;
|
||||
|
||||
GraphicsAdapterPolicy policy_;
|
||||
};
|
||||
|
||||
} // namespace rdp_worker::graphics
|
||||
@@ -0,0 +1,50 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace rdp_worker::graphics {
|
||||
|
||||
enum class RenderUpdateKind {
|
||||
kFullBgraFrame,
|
||||
kBgraRegion,
|
||||
kSurfaceCreate,
|
||||
kSurfaceDelete,
|
||||
kSurfaceBits,
|
||||
kEncodedFrame,
|
||||
kCursorUpdate,
|
||||
};
|
||||
|
||||
struct Rect {
|
||||
int x{0};
|
||||
int y{0};
|
||||
int width{0};
|
||||
int height{0};
|
||||
};
|
||||
|
||||
struct RenderUpdate {
|
||||
RenderUpdateKind kind{RenderUpdateKind::kFullBgraFrame};
|
||||
std::uint64_t sequence{0};
|
||||
int desktop_width{0};
|
||||
int desktop_height{0};
|
||||
int frame_width{0};
|
||||
int frame_height{0};
|
||||
int stride{0};
|
||||
Rect region;
|
||||
std::string pixel_format{"bgra32"};
|
||||
std::string codec;
|
||||
std::vector<std::uint8_t> payload;
|
||||
bool droppable{true};
|
||||
bool baseline{false};
|
||||
};
|
||||
|
||||
const char* RenderUpdateKindName(RenderUpdateKind kind);
|
||||
|
||||
bool IsFullFrameUpdate(const RenderUpdate& update);
|
||||
|
||||
bool IsRegionUpdate(const RenderUpdate& update);
|
||||
|
||||
bool IsEncodedUpdate(const RenderUpdate& update);
|
||||
|
||||
} // namespace rdp_worker::graphics
|
||||
Reference in New Issue
Block a user