feat: skip two-way copy for cuda devices when decoding video wallpapers + cache wallpapers as blobs in new database
C++ / fmt (pull_request) Failing after 11s
C++ / build (pull_request) Failing after 14s
C++ / clang-tidy (pull_request) Failing after 9s
JS/TS / fmt (pull_request) Successful in 10s
JS/TS / lint (pull_request) Successful in 8s
Python / static (pull_request) Failing after 28s
Rust / build (pull_request) Successful in 47s
Python / verify (pull_request) Failing after 1m20s
Rust / fmt (pull_request) Successful in 28s
Rust / clippy (pull_request) Successful in 59s
C++ / fmt (pull_request) Failing after 11s
C++ / build (pull_request) Failing after 14s
C++ / clang-tidy (pull_request) Failing after 9s
JS/TS / fmt (pull_request) Successful in 10s
JS/TS / lint (pull_request) Successful in 8s
Python / static (pull_request) Failing after 28s
Rust / build (pull_request) Successful in 47s
Python / verify (pull_request) Failing after 1m20s
Rust / fmt (pull_request) Successful in 28s
Rust / clippy (pull_request) Successful in 59s
This commit is contained in:
@@ -18,6 +18,11 @@
|
||||
#include <QtQml/qqml.h>
|
||||
#include <qtmetamacros.h>
|
||||
#include <atomic>
|
||||
#include <memory>
|
||||
|
||||
#ifdef ZHAVE_VIDEO
|
||||
#include "videoplayer.hpp"
|
||||
#endif
|
||||
|
||||
#include <qwayland-wlr-layer-shell-unstable-v1.h>
|
||||
#include <wayland-client-protocol.h>
|
||||
@@ -39,6 +44,10 @@ class WallpaperService : public QObject {
|
||||
|
||||
Q_PROPERTY(QString path READ path WRITE setPath NOTIFY pathChanged REQUIRED)
|
||||
Q_PROPERTY(QVariantMap crops READ crops WRITE setCrops NOTIFY cropsChanged)
|
||||
Q_PROPERTY(QString dbPath READ dbPath WRITE setDbPath NOTIFY dbPathChanged)
|
||||
Q_PROPERTY(
|
||||
QSize largestBufferSize READ largestBufferSize NOTIFY
|
||||
largestBufferSizeChanged)
|
||||
|
||||
public:
|
||||
explicit WallpaperService(QObject* parent = nullptr);
|
||||
@@ -47,6 +56,11 @@ class WallpaperService : public QObject {
|
||||
[[nodiscard]] QString path() const;
|
||||
void setPath(const QString& path);
|
||||
|
||||
[[nodiscard]] QSize largestBufferSize() const;
|
||||
|
||||
[[nodiscard]] QString dbPath() const;
|
||||
void setDbPath(const QString& path);
|
||||
|
||||
void addScreen(const QString& screen);
|
||||
void removeScreen(const QString& screen);
|
||||
|
||||
@@ -57,9 +71,13 @@ class WallpaperService : public QObject {
|
||||
|
||||
Q_INVOKABLE void setCrop(const QString& screen, const QVariantMap& crop);
|
||||
|
||||
Q_INVOKABLE void invalidateCache();
|
||||
|
||||
signals:
|
||||
void pathChanged();
|
||||
void cropsChanged();
|
||||
void dbPathChanged();
|
||||
void largestBufferSizeChanged();
|
||||
|
||||
private:
|
||||
friend class WallpaperSurface;
|
||||
@@ -77,7 +95,6 @@ class WallpaperService : public QObject {
|
||||
void applyPath(const QString& path);
|
||||
|
||||
void startVideo(const QString& path);
|
||||
void stopVideo();
|
||||
void teardownMpv();
|
||||
|
||||
void initMpvRender();
|
||||
@@ -87,6 +104,23 @@ class WallpaperService : public QObject {
|
||||
static void* getMpvProcAddress(void* ctx, const char* name);
|
||||
static void mpvUpdate(void* ctx);
|
||||
|
||||
#ifdef ZHAVE_VIDEO
|
||||
bool startPlayerVideo(const QString& path);
|
||||
void stopPlayerVideo();
|
||||
[[nodiscard]] uint32_t createVideoProgram();
|
||||
void drawVideoTexture(
|
||||
uint32_t lumaTex,
|
||||
uint32_t chromaTex,
|
||||
int matrix,
|
||||
int range,
|
||||
const QRectF& rect,
|
||||
float sizeW,
|
||||
float sizeH,
|
||||
float srcW,
|
||||
float srcH,
|
||||
float alpha);
|
||||
#endif
|
||||
|
||||
void bindGlobals();
|
||||
static void registryGlobal(
|
||||
void* data,
|
||||
@@ -111,16 +145,18 @@ class WallpaperService : public QObject {
|
||||
float sizeH,
|
||||
float alpha);
|
||||
|
||||
bool decode(const QString& path);
|
||||
[[nodiscard]] QImage decodeImage(
|
||||
const QString& path, const QSize& decodeSize) const;
|
||||
|
||||
bool ensureDecodeSize();
|
||||
[[nodiscard]] QByteArray cachedBlob(const QString& path) const;
|
||||
|
||||
[[nodiscard]] QSize largestBufferSize();
|
||||
void ensureImage();
|
||||
|
||||
void notifyBufferSizes();
|
||||
|
||||
void queue(WallpaperSurface* surface);
|
||||
void queueAll();
|
||||
|
||||
void startDrawing();
|
||||
void loop();
|
||||
|
||||
void present();
|
||||
@@ -143,6 +179,7 @@ class WallpaperService : public QObject {
|
||||
void addSurface(const QString& screen);
|
||||
|
||||
QString m_path;
|
||||
QString m_dbPath;
|
||||
QStringList m_screens;
|
||||
QVariantMap m_crops;
|
||||
|
||||
@@ -160,9 +197,15 @@ class WallpaperService : public QObject {
|
||||
|
||||
QProcess* m_transcode = nullptr;
|
||||
|
||||
QSize m_sourceSize;
|
||||
QSize m_decodeSize;
|
||||
|
||||
QImage m_stagedImage;
|
||||
QString m_stagedPath;
|
||||
bool m_stagedReady = false;
|
||||
bool m_decoding = false;
|
||||
QString m_decodePath;
|
||||
bool m_replacementReady = false;
|
||||
|
||||
wl_display* m_display = nullptr;
|
||||
wl_registry* m_registry = nullptr;
|
||||
wl_compositor* m_compositor = nullptr;
|
||||
@@ -178,10 +221,29 @@ class WallpaperService : public QObject {
|
||||
int m_sizeUniform = -1;
|
||||
int m_cropUniform = -1;
|
||||
int m_alphaUniform = -1;
|
||||
int m_sourceUniform = -1;
|
||||
|
||||
uint32_t m_videoProgram = 0;
|
||||
uint32_t m_vao = 0;
|
||||
int m_videoSizeUniform = -1;
|
||||
int m_videoSrcSizeUniform = -1;
|
||||
int m_videoCropUniform = -1;
|
||||
int m_videoAlphaUniform = -1;
|
||||
int m_videoLumaUniform = -1;
|
||||
int m_videoChromaUniform = -1;
|
||||
int m_videoMatrixUniform = -1;
|
||||
int m_videoRangeUniform = -1;
|
||||
int m_videoChromaOffUniform = -1;
|
||||
|
||||
#ifdef ZHAVE_VIDEO
|
||||
std::unique_ptr<VideoPlayer> m_player;
|
||||
bool m_usePlayer = true;
|
||||
#endif
|
||||
|
||||
QImage m_previousImage;
|
||||
QVariantMap m_previousCrops;
|
||||
uint32_t m_previousTexture = 0;
|
||||
std::vector<uint32_t> m_orphanTextures;
|
||||
bool m_fading = false;
|
||||
bool m_fadeClockStarted = false;
|
||||
bool m_firstFadeDone = false;
|
||||
|
||||
Reference in New Issue
Block a user