Remove unused GVFG internal code
This commit is contained in:
@@ -16,16 +16,6 @@ typedef enum xdma_status_t
|
||||
XDMA_EABI
|
||||
} xdma_status_t;
|
||||
|
||||
typedef struct xdma_device_info_t
|
||||
{
|
||||
char friendly_name[GDRIVER_MAX_FRIENDLY_NAME];
|
||||
char serial_number[GDRIVER_MAX_SERIAL_NUMBER];
|
||||
char firmware_version[GDRIVER_MAX_FIRMWARE_VERSION];
|
||||
char driver_version[GDRIVER_MAX_DRIVER_VERSION];
|
||||
uint32_t supported_inputs_mask;
|
||||
uint32_t supported_pixel_formats_mask;
|
||||
} xdma_device_info_t;
|
||||
|
||||
typedef struct xdma_stream_desc_t
|
||||
{
|
||||
gdriver_input_t input;
|
||||
|
||||
@@ -256,18 +256,6 @@ namespace
|
||||
return oss.str();
|
||||
}
|
||||
|
||||
static void copy_string(const std::string &src, char *dst, size_t dstSize)
|
||||
{
|
||||
if (!dst || dstSize == 0)
|
||||
return;
|
||||
dst[0] = '\0';
|
||||
if (src.empty())
|
||||
return;
|
||||
const size_t n = (std::min)(src.size(), dstSize - 1);
|
||||
std::memcpy(dst, src.data(), n);
|
||||
dst[n] = '\0';
|
||||
}
|
||||
|
||||
static void reset_stats(xdma_stream_stats_t &stats, gdriver_stream_state_t state)
|
||||
{
|
||||
std::memset(&stats, 0, sizeof(stats));
|
||||
@@ -370,15 +358,6 @@ namespace gvfg::internal
|
||||
close();
|
||||
}
|
||||
|
||||
xdma_status_t XdmaCaptureSession::open_default()
|
||||
{
|
||||
const auto devices = enumerate_xdma_devices();
|
||||
XDMA_LOG("open_default: device_count=%zu", devices.size());
|
||||
if (devices.empty())
|
||||
return fail(XDMA_ENODEV, "enumerate_xdma_devices", ERROR_NOT_FOUND);
|
||||
return open_device(devices.front());
|
||||
}
|
||||
|
||||
xdma_status_t XdmaCaptureSession::open_device_index(size_t deviceIndex)
|
||||
{
|
||||
const auto devices = enumerate_xdma_devices();
|
||||
@@ -507,23 +486,6 @@ namespace gvfg::internal
|
||||
return XDMA_OK;
|
||||
}
|
||||
|
||||
xdma_status_t XdmaCaptureSession::get_device_info(xdma_device_info_t &out) const
|
||||
{
|
||||
if (!opened_)
|
||||
return XDMA_ESTATE;
|
||||
std::memset(&out, 0, sizeof(out));
|
||||
copy_string(wide_to_utf8(friendly_name_), out.friendly_name, sizeof(out.friendly_name));
|
||||
copy_string("XDMA", out.driver_version, sizeof(out.driver_version));
|
||||
out.supported_inputs_mask = (1u << GDRIVER_INPUT_SDI) | (1u << GDRIVER_INPUT_HDMI);
|
||||
out.supported_pixel_formats_mask = (1u << GDRIVER_PIXFMT_YUY2) |
|
||||
(1u << GDRIVER_PIXFMT_Y210) |
|
||||
(1u << GDRIVER_PIXFMT_RGB24) |
|
||||
(1u << GDRIVER_PIXFMT_NV12) |
|
||||
(1u << GDRIVER_PIXFMT_P010) |
|
||||
(1u << GDRIVER_PIXFMT_YUV444);
|
||||
return XDMA_OK;
|
||||
}
|
||||
|
||||
xdma_status_t XdmaCaptureSession::get_signal_status(xdma_signal_status_t &out) const
|
||||
{
|
||||
if (!opened_)
|
||||
@@ -591,14 +553,6 @@ namespace gvfg::internal
|
||||
return XDMA_OK;
|
||||
}
|
||||
|
||||
xdma_status_t XdmaCaptureSession::get_stream_stats(xdma_stream_stats_t &out) const
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(mutex_);
|
||||
out = stats_;
|
||||
out.state = running_ ? GDRIVER_STREAM_RUNNING : (configured_ ? GDRIVER_STREAM_CONFIGURED : GDRIVER_STREAM_STOPPED);
|
||||
return XDMA_OK;
|
||||
}
|
||||
|
||||
xdma_status_t XdmaCaptureSession::set_event_callback(xdma_event_callback_t callback, void *user, uint32_t eventMask)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(event_callback_mutex_);
|
||||
|
||||
@@ -31,14 +31,11 @@ namespace gvfg::internal
|
||||
XdmaCaptureSession &operator=(const XdmaCaptureSession &) = delete;
|
||||
~XdmaCaptureSession();
|
||||
|
||||
xdma_status_t open_default();
|
||||
xdma_status_t open_device_index(size_t deviceIndex);
|
||||
xdma_status_t close();
|
||||
|
||||
xdma_status_t set_input(gdriver_input_t input);
|
||||
xdma_status_t get_device_info(xdma_device_info_t &out) const;
|
||||
xdma_status_t get_signal_status(xdma_signal_status_t &out) const;
|
||||
xdma_status_t get_stream_stats(xdma_stream_stats_t &out) const;
|
||||
|
||||
xdma_status_t set_event_callback(xdma_event_callback_t callback, void *user, uint32_t eventMask);
|
||||
xdma_status_t configure_stream(const xdma_stream_desc_t &desc);
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
#include <thread>
|
||||
#include <vector>
|
||||
|
||||
#include <d2d1.h>
|
||||
#include <d3d11_4.h>
|
||||
#include <dxgi.h>
|
||||
#include <wrl/client.h>
|
||||
@@ -656,23 +655,9 @@ struct gvfg_handle_t
|
||||
if (SUCCEEDED(d3d.As(&mt)) && mt)
|
||||
mt->SetMultithreadProtected(TRUE);
|
||||
|
||||
if (FAILED(D2D1CreateFactory(D2D1_FACTORY_TYPE_MULTI_THREADED, d2dFactory.ReleaseAndGetAddressOf())) || !d2dFactory)
|
||||
return false;
|
||||
|
||||
ComPtr<IDXGIDevice> dxgiDev;
|
||||
if (FAILED(d3d.As(&dxgiDev)) || !dxgiDev)
|
||||
return false;
|
||||
if (FAILED(d2dFactory->CreateDevice(dxgiDev.Get(), &d2dDevice)) || !d2dDevice)
|
||||
return false;
|
||||
if (FAILED(d2dDevice->CreateDeviceContext(D2D1_DEVICE_CONTEXT_OPTIONS_NONE, &d2dCtx)) || !d2dCtx)
|
||||
return false;
|
||||
if (FAILED(DWriteCreateFactory(DWRITE_FACTORY_TYPE_SHARED, __uuidof(IDWriteFactory), &dwrite)) || !dwrite)
|
||||
return false;
|
||||
d2dCtx->CreateSolidColorBrush(D2D1::ColorF(1, 1, 1, 1), &d2dWhite);
|
||||
d2dCtx->CreateSolidColorBrush(D2D1::ColorF(0, 0, 0, 0.55f), &d2dBlack);
|
||||
}
|
||||
|
||||
if (!pipeline->initialize(d3d.Get(), ctx.Get(), d2dCtx.Get(), dwrite.Get(), d2dWhite.Get(), d2dBlack.Get()))
|
||||
if (!pipeline->initialize(d3d.Get(), ctx.Get()))
|
||||
return false;
|
||||
|
||||
pipeline->configurePreview(toRenderPreviewDesc());
|
||||
@@ -688,12 +673,6 @@ struct gvfg_handle_t
|
||||
pipeline->release_preview_swapchain();
|
||||
pipeline.reset();
|
||||
}
|
||||
d2dBlack.Reset();
|
||||
d2dWhite.Reset();
|
||||
dwrite.Reset();
|
||||
d2dCtx.Reset();
|
||||
d2dDevice.Reset();
|
||||
d2dFactory.Reset();
|
||||
ctx.Reset();
|
||||
d3d.Reset();
|
||||
}
|
||||
@@ -988,12 +967,6 @@ struct gvfg_handle_t
|
||||
|
||||
ComPtr<ID3D11Device> d3d;
|
||||
ComPtr<ID3D11DeviceContext> ctx;
|
||||
ComPtr<ID2D1Factory1> d2dFactory;
|
||||
ComPtr<ID2D1Device> d2dDevice;
|
||||
ComPtr<ID2D1DeviceContext> d2dCtx;
|
||||
ComPtr<IDWriteFactory> dwrite;
|
||||
ComPtr<ID2D1SolidColorBrush> d2dWhite;
|
||||
ComPtr<ID2D1SolidColorBrush> d2dBlack;
|
||||
std::unique_ptr<SharedScenePipeline> pipeline;
|
||||
};
|
||||
|
||||
|
||||
@@ -10,9 +10,7 @@ namespace gvfg::internal
|
||||
GVFG_RENDER_FMT_YUY2,
|
||||
GVFG_RENDER_FMT_ARGB,
|
||||
GVFG_RENDER_FMT_P010,
|
||||
GVFG_RENDER_FMT_Y210,
|
||||
GVFG_RENDER_FMT_V210,
|
||||
GVFG_RENDER_FMT_R210
|
||||
GVFG_RENDER_FMT_Y210
|
||||
} gvfg_render_pixfmt_t;
|
||||
|
||||
typedef struct
|
||||
@@ -42,18 +40,4 @@ namespace gvfg::internal
|
||||
int swapchain_10bit;
|
||||
} gvfg_render_preview_desc_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GVFG_RENDER_EXPORT_RAW_NATIVE = 1 << 0,
|
||||
GVFG_RENDER_EXPORT_RAW_RGB10_U16 = 1 << 1,
|
||||
GVFG_RENDER_EXPORT_RAW_RGBA16 = 1 << 2,
|
||||
GVFG_RENDER_EXPORT_TIFF = 1 << 3,
|
||||
GVFG_RENDER_EXPORT_STATS = 1 << 4,
|
||||
GVFG_RENDER_EXPORT_PNG = 1 << 5,
|
||||
GVFG_RENDER_EXPORT_RAW_GIGABYTE_HEADER = 1 << 6,
|
||||
GVFG_RENDER_EXPORT_RAW_RGBA8 = 1 << 7,
|
||||
GVFG_RENDER_EXPORT_RAW_ALL = GVFG_RENDER_EXPORT_RAW_NATIVE | GVFG_RENDER_EXPORT_RAW_RGB10_U16 | GVFG_RENDER_EXPORT_RAW_RGBA16
|
||||
} gvfg_render_export_flags_t;
|
||||
|
||||
enum { GVFG_RENDER_GIGABYTE_RAW_HEADER_SIZE = 128 };
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -3,8 +3,6 @@
|
||||
#include "../internal/gvfg_render_types.h"
|
||||
|
||||
#include <d3d11_1.h>
|
||||
#include <d2d1_1.h>
|
||||
#include <dwrite.h>
|
||||
#include <dxgi1_2.h>
|
||||
#include <wrl.h>
|
||||
|
||||
@@ -18,51 +16,32 @@ public:
|
||||
~SharedScenePipeline() = default;
|
||||
|
||||
bool initialize(ID3D11Device *d3d,
|
||||
ID3D11DeviceContext *ctx,
|
||||
ID2D1DeviceContext *d2d_ctx,
|
||||
IDWriteFactory *dwrite = nullptr,
|
||||
ID2D1SolidColorBrush *white = nullptr,
|
||||
ID2D1SolidColorBrush *black = nullptr);
|
||||
void shutdown();
|
||||
ID3D11DeviceContext *ctx);
|
||||
|
||||
bool configurePreview(const gvfg_render_preview_desc_t &desc);
|
||||
void set_source_bit_depth(int bits);
|
||||
int source_bit_depth() const { return preview_source_bit_depth_; }
|
||||
void release_preview_swapchain();
|
||||
|
||||
bool create_shaders_and_states();
|
||||
bool ensure_rt_and_pipeline(int w, int h);
|
||||
uint64_t last_ensure_rt_ns() const { return lastEnsureRtNs_; }
|
||||
uint64_t total_ensure_rt_ns() const { return totalEnsureRtNs_; }
|
||||
uint64_t ensure_rt_calls() const { return ensureRtCalls_; }
|
||||
bool last_ensure_rt_rebuilt() const { return lastEnsureRtRebuilt_; }
|
||||
const char *last_ensure_rt_rebuild_reason() const { return lastEnsureRtReason_; }
|
||||
bool ensure_preview_swapchain(int w, int h);
|
||||
bool preview_swapchain_10bit() const { return preview_swapchain_10bit_; }
|
||||
int preview_swapchain_mode() const { return preview_swapchain_mode_; }
|
||||
bool present_preview(int src_w, int src_h);
|
||||
DXGI_FORMAT preview_backbuffer_format() const;
|
||||
DXGI_FORMAT scene_texture_format() const;
|
||||
DXGI_FORMAT linear_fp16_texture_format() const;
|
||||
bool gpu_overlay_text(const wchar_t *text, int frame_w, int frame_h);
|
||||
bool composite_overlay_to_scene_fp16(int frame_w, int frame_h);
|
||||
bool blit_fp16_to_rgba8(int frame_w, int frame_h);
|
||||
bool upload_argb_frame(const void *data, int frame_w, int frame_h, int src_stride);
|
||||
bool render_uploaded_argb_to_fp16(int frame_w, int frame_h);
|
||||
bool upload_nv12_frame(const uint8_t *y, int stride_y, const uint8_t *uv, int stride_uv, int frame_w, int frame_h);
|
||||
bool upload_p010_frame(const uint8_t *y, int stride_y, const uint8_t *uv, int stride_uv, int frame_w, int frame_h);
|
||||
bool upload_yuy2_frame(const uint8_t *data, int src_stride, int frame_w, int frame_h);
|
||||
bool upload_y210_frame(const uint8_t *data, int src_stride, int frame_w, int frame_h);
|
||||
bool upload_v210_frame(const uint8_t *data, int src_stride, int frame_w, int frame_h);
|
||||
bool render_uploaded_yuv_to_fp16(gvfg_render_pixfmt_t fmt, int frame_w, int frame_h);
|
||||
bool copy_fp16_to_scene();
|
||||
bool readback_to_frame(int frame_w, int frame_h, uint64_t pts_ns, uint64_t frame_id,
|
||||
gvfg_render_frame_t *out);
|
||||
bool export_scene_rgb10(const wchar_t *base_path, int raw_flags, bool export_tiff, bool export_stats, bool export_gigabyte_raw);
|
||||
|
||||
ID3D11Device *d3d_ = nullptr;
|
||||
ID3D11DeviceContext *ctx_ = nullptr;
|
||||
ID2D1DeviceContext *d2d_ctx_ = nullptr;
|
||||
|
||||
Microsoft::WRL::ComPtr<ID3D11Texture2D> rt_fp16_;
|
||||
Microsoft::WRL::ComPtr<ID3D11RenderTargetView> rtv_fp16_;
|
||||
@@ -81,7 +60,6 @@ public:
|
||||
Microsoft::WRL::ComPtr<ID3D11Texture2D> upload_y210_packed_;
|
||||
Microsoft::WRL::ComPtr<ID3D11RenderTargetView> rtv_rgba_;
|
||||
Microsoft::WRL::ComPtr<ID3D11Texture2D> rt_stage_;
|
||||
Microsoft::WRL::ComPtr<ID3D11Texture2D> rt_scene_stage_fp16_;
|
||||
|
||||
Microsoft::WRL::ComPtr<ID3D11Buffer> cs_params_;
|
||||
Microsoft::WRL::ComPtr<ID3D11UnorderedAccessView> rt_uav_;
|
||||
@@ -93,20 +71,10 @@ public:
|
||||
Microsoft::WRL::ComPtr<ID3D11PixelShader> ps_y210_;
|
||||
Microsoft::WRL::ComPtr<ID3D11PixelShader> ps_fp16_to_rgba8_;
|
||||
Microsoft::WRL::ComPtr<ID3D11PixelShader> ps_fp16_to_preview_;
|
||||
Microsoft::WRL::ComPtr<ID3D11PixelShader> ps_composite_overlay_fp16_;
|
||||
Microsoft::WRL::ComPtr<ID3D11InputLayout> il_;
|
||||
Microsoft::WRL::ComPtr<ID3D11Buffer> vb_;
|
||||
Microsoft::WRL::ComPtr<ID3D11SamplerState> samp_;
|
||||
|
||||
Microsoft::WRL::ComPtr<ID2D1Bitmap1> d2d_bitmap_rt_;
|
||||
|
||||
Microsoft::WRL::ComPtr<IDWriteFactory> dwrite_;
|
||||
Microsoft::WRL::ComPtr<ID2D1SolidColorBrush> d2d_white_;
|
||||
Microsoft::WRL::ComPtr<ID2D1SolidColorBrush> d2d_black_;
|
||||
Microsoft::WRL::ComPtr<ID3D11Texture2D> overlay_rgba_;
|
||||
Microsoft::WRL::ComPtr<ID3D11RenderTargetView> overlay_rtv_;
|
||||
Microsoft::WRL::ComPtr<ID3D11ShaderResourceView> overlay_srv_;
|
||||
|
||||
void *preview_hwnd_ = nullptr;
|
||||
bool preview_enabled_ = false;
|
||||
bool preview_use_fp16_ = false;
|
||||
@@ -117,14 +85,8 @@ public:
|
||||
int preview_w_ = 0;
|
||||
int preview_h_ = 0;
|
||||
|
||||
|
||||
int rt_w_ = 0;
|
||||
int rt_h_ = 0;
|
||||
uint64_t lastEnsureRtNs_ = 0;
|
||||
uint64_t totalEnsureRtNs_ = 0;
|
||||
uint64_t ensureRtCalls_ = 0;
|
||||
bool lastEnsureRtRebuilt_ = false;
|
||||
const char *lastEnsureRtReason_ = "never";
|
||||
|
||||
Microsoft::WRL::ComPtr<IDXGISwapChain1> preview_swapchain_;
|
||||
Microsoft::WRL::ComPtr<ID3D11Texture2D> preview_backbuf_;
|
||||
|
||||
Reference in New Issue
Block a user