Commit 48740664 authored by Xaver Hugl's avatar Xaver Hugl
Browse files

port many Qt shared pointers to standard smart pointers

There are a few benefits to using smart pointers from the standard library:
- std::unique_ptr has move semantics. With move semantics, transfer of ownership
can be properly expressed
- std::shared_ptr is more efficient than QSharedPointer
- more developers are used to them, making contributions for newcomers easier

We're also already using a mix of both; because Qt shared pointers provide
no benefits, porting to standard smart pointers improves consistency in
the code base. Because of that, this commit ports most of the uses of QSharedPointer
to std::shared_ptr, and some uses of QScopedPointer to std::unique_ptr
parent 13800002
Pipeline #185469 passed with stage
in 17 minutes and 48 seconds
......@@ -80,7 +80,7 @@ static QStringList splitPathList(const QString &input, const QChar delimiter)
DrmBackend::DrmBackend(QObject *parent)
: Platform(parent)
, m_udev(new Udev)
, m_udev(std::make_unique<Udev>())
, m_udevMonitor(m_udev->monitor())
, m_session(Session::create(this))
, m_explicitGpus(splitPathList(qEnvironmentVariable("KWIN_DRM_DEVICES"), ':'))
......@@ -118,12 +118,12 @@ Outputs DrmBackend::enabledOutputs() const
void DrmBackend::createDpmsFilter()
{
if (!m_dpmsFilter.isNull()) {
if (m_dpmsFilter) {
// already another output is off
return;
}
m_dpmsFilter.reset(new DpmsInputEventFilter);
input()->prependInputEventFilter(m_dpmsFilter.data());
m_dpmsFilter = std::make_unique<DpmsInputEventFilter>();
input()->prependInputEventFilter(m_dpmsFilter.get());
}
void DrmBackend::turnOutputsOn()
......@@ -136,7 +136,7 @@ void DrmBackend::turnOutputsOn()
void DrmBackend::checkOutputsAreOn()
{
if (m_dpmsFilter.isNull()) {
if (!m_dpmsFilter) {
// already disabled, all outputs are on
return;
}
......@@ -550,8 +550,8 @@ void DrmBackend::enableOutput(DrmAbstractOutput *output, bool enable)
m_placeHolderOutput = primaryGpu()->createVirtualOutput({}, m_enabledOutputs.constFirst()->pixelSize(), 1, DrmVirtualOutput::Type::Placeholder);
// placeholder doesn't actually need to render anything
m_placeHolderOutput->renderLoop()->inhibit();
m_placeholderFilter.reset(new PlaceholderInputEventFilter());
input()->prependInputEventFilter(m_placeholderFilter.data());
m_placeholderFilter = std::make_unique<PlaceholderInputEventFilter>();
input()->prependInputEventFilter(m_placeholderFilter.get());
}
m_enabledOutputs.removeOne(output);
Q_EMIT output->gpu()->outputDisabled(output);
......@@ -624,7 +624,7 @@ void DrmBackend::removeVirtualOutput(Output *output)
primaryGpu()->removeVirtualOutput(virtualOutput);
}
QSharedPointer<DmaBufTexture> DrmBackend::createDmaBufTexture(const QSize &size)
std::shared_ptr<DmaBufTexture> DrmBackend::createDmaBufTexture(const QSize &size)
{
if (const auto eglBackend = dynamic_cast<EglGbmBackend *>(m_renderBackend); eglBackend && primaryGpu()->gbmDevice()) {
eglBackend->makeCurrent();
......@@ -654,7 +654,7 @@ QSharedPointer<DmaBufTexture> DrmBackend::createDmaBufTexture(const QSize &size)
const DmaBufAttributes attributes = dmaBufAttributesForBo(bo);
gbm_bo_destroy(bo);
return QSharedPointer<DmaBufTexture>::create(eglBackend->importDmaBufAsTexture(attributes), attributes);
return std::make_shared<DmaBufTexture>(eglBackend->importDmaBufAsTexture(attributes), attributes);
} else {
return nullptr;
}
......
......@@ -44,7 +44,7 @@ public:
InputBackend *createInputBackend() override;
QPainterBackend *createQPainterBackend() override;
OpenGLBackend *createOpenGLBackend() override;
QSharedPointer<DmaBufTexture> createDmaBufTexture(const QSize &size) override;
std::shared_ptr<DmaBufTexture> createDmaBufTexture(const QSize &size) override;
Session *session() const override;
bool initialize() override;
......@@ -97,8 +97,8 @@ private:
void handleUdevEvent();
DrmGpu *addGpu(const QString &fileName);
QScopedPointer<Udev> m_udev;
QScopedPointer<UdevMonitor> m_udevMonitor;
std::unique_ptr<Udev> m_udev;
std::unique_ptr<UdevMonitor> m_udevMonitor;
Session *m_session = nullptr;
// all outputs, enabled and disabled
QVector<DrmAbstractOutput *> m_outputs;
......@@ -109,8 +109,8 @@ private:
bool m_active = false;
const QStringList m_explicitGpus;
QVector<DrmGpu *> m_gpus;
QScopedPointer<DpmsInputEventFilter> m_dpmsFilter;
QScopedPointer<PlaceholderInputEventFilter> m_placeholderFilter;
std::unique_ptr<DpmsInputEventFilter> m_dpmsFilter;
std::unique_ptr<PlaceholderInputEventFilter> m_placeholderFilter;
DrmRenderBackend *m_renderBackend = nullptr;
};
......
......@@ -10,9 +10,9 @@
#pragma once
#include <QImage>
#include <QSharedPointer>
#include <QSize>
#include <array>
#include <memory>
#include <optional>
namespace KWin
......
......@@ -12,7 +12,6 @@
#include "drm_buffer.h"
#include <QSharedPointer>
#include <epoxy/egl.h>
#include <gbm.h>
......@@ -43,7 +42,6 @@ public:
KWaylandServer::ClientBuffer *clientBuffer() const;
bool map(uint32_t flags);
QSharedPointer<GLTexture> createTexture(EGLDisplay eglDisplay) const;
static std::shared_ptr<GbmBuffer> importBuffer(DrmGpu *gpu, KWaylandServer::LinuxDmaBufV1ClientBuffer *clientBuffer);
static std::shared_ptr<GbmBuffer> importBuffer(DrmGpu *gpu, GbmBuffer *buffer, uint32_t flags = GBM_BO_USE_SCANOUT);
......
......@@ -21,7 +21,7 @@ QRegion DrmOutputLayer::currentDamage() const
return {};
}
QSharedPointer<GLTexture> DrmOutputLayer::texture() const
std::shared_ptr<GLTexture> DrmOutputLayer::texture() const
{
return nullptr;
}
......
......@@ -10,7 +10,7 @@
#include "outputlayer.h"
#include <QRegion>
#include <QSharedPointer>
#include <memory>
#include <optional>
namespace KWin
......@@ -26,7 +26,7 @@ class DrmOutputLayer : public OutputLayer
public:
virtual ~DrmOutputLayer();
virtual QSharedPointer<GLTexture> texture() const;
virtual std::shared_ptr<GLTexture> texture() const;
virtual QRegion currentDamage() const;
virtual void releaseBuffers() = 0;
};
......
......@@ -9,8 +9,6 @@
#pragma once
#include "drm_layer.h"
#include <QSharedPointer>
namespace KWin
{
......
......@@ -198,12 +198,12 @@ QSize DrmConnector::physicalSize() const
return m_physicalSize;
}
QList<QSharedPointer<DrmConnectorMode>> DrmConnector::modes() const
QList<std::shared_ptr<DrmConnectorMode>> DrmConnector::modes() const
{
return m_modes;
}
QSharedPointer<DrmConnectorMode> DrmConnector::findMode(const drmModeModeInfo &modeInfo) const
std::shared_ptr<DrmConnectorMode> DrmConnector::findMode(const drmModeModeInfo &modeInfo) const
{
const auto it = std::find_if(m_modes.constBegin(), m_modes.constEnd(), [&modeInfo](const auto &mode) {
return checkIfEqual(mode->nativeMode(), &modeInfo);
......@@ -341,7 +341,7 @@ bool DrmConnector::updateProperties()
// reload modes
m_driverModes.clear();
for (int i = 0; i < m_conn->count_modes; i++) {
m_driverModes.append(QSharedPointer<DrmConnectorMode>::create(this, m_conn->modes[i]));
m_driverModes.append(std::make_shared<DrmConnectorMode>(this, m_conn->modes[i]));
}
if (m_driverModes.isEmpty()) {
return false;
......@@ -417,9 +417,9 @@ static const QVector<QSize> s_commonModes = {
QSize(1280, 720),
};
QList<QSharedPointer<DrmConnectorMode>> DrmConnector::generateCommonModes()
QList<std::shared_ptr<DrmConnectorMode>> DrmConnector::generateCommonModes()
{
QList<QSharedPointer<DrmConnectorMode>> ret;
QList<std::shared_ptr<DrmConnectorMode>> ret;
uint32_t maxBandwidthEstimation = 0;
QSize maxSize;
for (const auto &mode : qAsConst(m_driverModes)) {
......@@ -440,7 +440,7 @@ QList<QSharedPointer<DrmConnectorMode>> DrmConnector::generateCommonModes()
return ret;
}
QSharedPointer<DrmConnectorMode> DrmConnector::generateMode(const QSize &size, uint32_t refreshRate)
std::shared_ptr<DrmConnectorMode> DrmConnector::generateMode(const QSize &size, uint32_t refreshRate)
{
auto modeInfo = libxcvt_gen_mode_info(size.width(), size.height(), refreshRate, false, false);
......@@ -461,7 +461,7 @@ QSharedPointer<DrmConnectorMode> DrmConnector::generateMode(const QSize &size, u
sprintf(mode.name, "%dx%d@%d", size.width(), size.height(), mode.vrefresh);
free(modeInfo);
return QSharedPointer<DrmConnectorMode>::create(this, mode);
return std::make_shared<DrmConnectorMode>(this, mode);
}
QDebug &operator<<(QDebug &s, const KWin::DrmConnector *obj)
......
......@@ -93,8 +93,8 @@ public:
QString modelName() const;
QSize physicalSize() const;
QList<QSharedPointer<DrmConnectorMode>> modes() const;
QSharedPointer<DrmConnectorMode> findMode(const drmModeModeInfo &modeInfo) const;
QList<std::shared_ptr<DrmConnectorMode>> modes() const;
std::shared_ptr<DrmConnectorMode> findMode(const drmModeModeInfo &modeInfo) const;
Output::SubPixel subpixel() const;
bool hasOverscan() const;
......@@ -105,15 +105,15 @@ public:
LinkStatus linkStatus() const;
private:
QList<QSharedPointer<DrmConnectorMode>> generateCommonModes();
QSharedPointer<DrmConnectorMode> generateMode(const QSize &size, uint32_t refreshRate);
QList<std::shared_ptr<DrmConnectorMode>> generateCommonModes();
std::shared_ptr<DrmConnectorMode> generateMode(const QSize &size, uint32_t refreshRate);
QScopedPointer<DrmPipeline> m_pipeline;
DrmScopedPointer<drmModeConnector> m_conn;
Edid m_edid;
QSize m_physicalSize = QSize(-1, -1);
QList<QSharedPointer<DrmConnectorMode>> m_driverModes;
QList<QSharedPointer<DrmConnectorMode>> m_modes;
QList<std::shared_ptr<DrmConnectorMode>> m_driverModes;
QList<std::shared_ptr<DrmConnectorMode>> m_modes;
uint32_t m_possibleCrtcs = 0;
friend QDebug &operator<<(QDebug &s, const KWin::DrmConnector *obj);
......
......@@ -81,8 +81,8 @@ DrmOutput::DrmOutput(DrmPipeline *pipeline)
.internal = conn->isInternal(),
});
const QList<QSharedPointer<OutputMode>> modes = getModes();
QSharedPointer<OutputMode> currentMode = m_pipeline->mode();
const QList<std::shared_ptr<OutputMode>> modes = getModes();
std::shared_ptr<OutputMode> currentMode = m_pipeline->mode();
if (!currentMode) {
currentMode = modes.constFirst();
}
......@@ -184,13 +184,13 @@ void DrmOutput::moveCursor()
}
}
QList<QSharedPointer<OutputMode>> DrmOutput::getModes() const
QList<std::shared_ptr<OutputMode>> DrmOutput::getModes() const
{
const auto drmModes = m_pipeline->connector()->modes();
QList<QSharedPointer<OutputMode>> ret;
QList<std::shared_ptr<OutputMode>> ret;
ret.reserve(drmModes.count());
for (const QSharedPointer<DrmConnectorMode> &drmMode : drmModes) {
for (const auto &drmMode : drmModes) {
ret.append(drmMode);
}
return ret;
......@@ -282,7 +282,7 @@ DrmPlane::Transformations outputToPlaneTransform(DrmOutput::Transform transform)
void DrmOutput::updateModes()
{
const QList<QSharedPointer<OutputMode>> modes = getModes();
const QList<std::shared_ptr<OutputMode>> modes = getModes();
if (m_pipeline->crtc()) {
const auto currentMode = m_pipeline->connector()->findMode(m_pipeline->crtc()->queryCurrentMode());
......@@ -299,7 +299,7 @@ void DrmOutput::updateModes()
}
}
QSharedPointer<OutputMode> currentMode = m_pipeline->mode();
std::shared_ptr<OutputMode> currentMode = m_pipeline->mode();
if (!currentMode) {
currentMode = modes.constFirst();
}
......@@ -410,7 +410,7 @@ DrmOutputLayer *DrmOutput::outputLayer() const
return m_pipeline->primaryLayer();
}
void DrmOutput::setColorTransformation(const QSharedPointer<ColorTransformation> &transformation)
void DrmOutput::setColorTransformation(const std::shared_ptr<ColorTransformation> &transformation)
{
m_pipeline->setColorTransformation(transformation);
if (DrmPipeline::commitPipelines({m_pipeline}, DrmPipeline::CommitMode::Test)) {
......
......@@ -15,7 +15,6 @@
#include <QObject>
#include <QPoint>
#include <QSharedPointer>
#include <QSize>
#include <QTimer>
#include <QVector>
......@@ -54,14 +53,14 @@ public:
void updateCursor();
void moveCursor();
void setColorTransformation(const QSharedPointer<ColorTransformation> &transformation) override;
void setColorTransformation(const std::shared_ptr<ColorTransformation> &transformation) override;
private:
void updateEnablement(bool enable) override;
bool setDrmDpmsMode(DpmsMode mode);
void setDpmsMode(DpmsMode mode) override;
QList<QSharedPointer<OutputMode>> getModes() const;
QList<std::shared_ptr<OutputMode>> getModes() const;
void renderCursorOpengl(const RenderTarget &renderTarget, const QSize &cursorSize);
void renderCursorQPainter(const RenderTarget &renderTarget);
......
......@@ -468,7 +468,7 @@ DrmCrtc *DrmPipeline::currentCrtc() const
return m_current.crtc;
}
DrmGammaRamp::DrmGammaRamp(DrmCrtc *crtc, const QSharedPointer<ColorTransformation> &transformation)
DrmGammaRamp::DrmGammaRamp(DrmCrtc *crtc, const std::shared_ptr<ColorTransformation> &transformation)
: m_gpu(crtc->gpu())
, m_lut(transformation, crtc->gammaRampSize())
{
......@@ -565,7 +565,7 @@ DrmCrtc *DrmPipeline::crtc() const
return m_pending.crtc;
}
QSharedPointer<DrmConnectorMode> DrmPipeline::mode() const
std::shared_ptr<DrmConnectorMode> DrmPipeline::mode() const
{
return m_pending.mode;
}
......@@ -618,7 +618,7 @@ Output::RgbRange DrmPipeline::rgbRange() const
void DrmPipeline::setCrtc(DrmCrtc *crtc)
{
if (crtc && m_pending.crtc && crtc->gammaRampSize() != m_pending.crtc->gammaRampSize() && m_pending.colorTransformation) {
m_pending.gamma = QSharedPointer<DrmGammaRamp>::create(crtc, m_pending.colorTransformation);
m_pending.gamma = std::make_shared<DrmGammaRamp>(crtc, m_pending.colorTransformation);
}
m_pending.crtc = crtc;
if (crtc) {
......@@ -628,7 +628,7 @@ void DrmPipeline::setCrtc(DrmCrtc *crtc)
}
}
void DrmPipeline::setMode(const QSharedPointer<DrmConnectorMode> &mode)
void DrmPipeline::setMode(const std::shared_ptr<DrmConnectorMode> &mode)
{
m_pending.mode = mode;
}
......@@ -643,7 +643,7 @@ void DrmPipeline::setEnable(bool enable)
m_pending.enabled = enable;
}
void DrmPipeline::setLayers(const QSharedPointer<DrmPipelineLayer> &primaryLayer, const QSharedPointer<DrmOverlayLayer> &cursorLayer)
void DrmPipeline::setLayers(const std::shared_ptr<DrmPipelineLayer> &primaryLayer, const std::shared_ptr<DrmOverlayLayer> &cursorLayer)
{
m_pending.layer = primaryLayer;
m_pending.cursorLayer = cursorLayer;
......@@ -674,9 +674,9 @@ void DrmPipeline::setRgbRange(Output::RgbRange range)
m_pending.rgbRange = range;
}
void DrmPipeline::setColorTransformation(const QSharedPointer<ColorTransformation> &transformation)
void DrmPipeline::setColorTransformation(const std::shared_ptr<ColorTransformation> &transformation)
{
m_pending.colorTransformation = transformation;
m_pending.gamma = QSharedPointer<DrmGammaRamp>::create(m_pending.crtc, transformation);
m_pending.gamma = std::make_shared<DrmGammaRamp>(m_pending.crtc, transformation);
}
}
......@@ -10,7 +10,6 @@
#pragma once
#include <QPoint>
#include <QSharedPointer>
#include <QSize>
#include <QVector>
......@@ -36,7 +35,7 @@ class DrmOverlayLayer;
class DrmGammaRamp
{
public:
DrmGammaRamp(DrmCrtc *crtc, const QSharedPointer<ColorTransformation> &transformation);
DrmGammaRamp(DrmCrtc *crtc, const std::shared_ptr<ColorTransformation> &transformation);
~DrmGammaRamp();
const ColorLUT &lut() const;
......@@ -91,7 +90,7 @@ public:
DrmOutput *output() const;
DrmCrtc *crtc() const;
QSharedPointer<DrmConnectorMode> mode() const;
std::shared_ptr<DrmConnectorMode> mode() const;
bool active() const;
bool enabled() const;
DrmPipelineLayer *primaryLayer() const;
......@@ -103,16 +102,16 @@ public:
Output::RgbRange rgbRange() const;
void setCrtc(DrmCrtc *crtc);
void setMode(const QSharedPointer<DrmConnectorMode> &mode);
void setMode(const std::shared_ptr<DrmConnectorMode> &mode);
void setActive(bool active);
void setEnable(bool enable);
void setLayers(const QSharedPointer<DrmPipelineLayer> &primaryLayer, const QSharedPointer<DrmOverlayLayer> &cursorLayer);
void setLayers(const std::shared_ptr<DrmPipelineLayer> &primaryLayer, const std::shared_ptr<DrmOverlayLayer> &cursorLayer);
void setRenderOrientation(DrmPlane::Transformations orientation);
void setBufferOrientation(DrmPlane::Transformations orientation);
void setSyncMode(RenderLoopPrivate::SyncMode mode);
void setOverscan(uint32_t overscan);
void setRgbRange(Output::RgbRange range);
void setColorTransformation(const QSharedPointer<ColorTransformation> &transformation);
void setColorTransformation(const std::shared_ptr<ColorTransformation> &transformation);
enum class CommitMode {
Test,
......@@ -162,15 +161,15 @@ private:
QMap<uint32_t, QVector<uint64_t>> formats;
bool active = true; // whether or not the pipeline should be currently used
bool enabled = true; // whether or not the pipeline needs a crtc
QSharedPointer<DrmConnectorMode> mode;
std::shared_ptr<DrmConnectorMode> mode;
uint32_t overscan = 0;
Output::RgbRange rgbRange = Output::RgbRange::Automatic;
RenderLoopPrivate::SyncMode syncMode = RenderLoopPrivate::SyncMode::Fixed;
QSharedPointer<ColorTransformation> colorTransformation;
QSharedPointer<DrmGammaRamp> gamma;
std::shared_ptr<ColorTransformation> colorTransformation;
std::shared_ptr<DrmGammaRamp> gamma;
QSharedPointer<DrmPipelineLayer> layer;
QSharedPointer<DrmOverlayLayer> cursorLayer;
std::shared_ptr<DrmPipelineLayer> layer;
std::shared_ptr<DrmOverlayLayer> cursorLayer;
QPoint cursorHotspot;
// the transformation that this pipeline will apply to submitted buffers
......
......@@ -8,7 +8,7 @@
*/
#pragma once
#include <QSharedPointer>
#include <memory>
namespace KWin
{
......@@ -24,9 +24,9 @@ class DrmRenderBackend
public:
virtual ~DrmRenderBackend() = default;
virtual QSharedPointer<DrmPipelineLayer> createPrimaryLayer(DrmPipeline *pipeline) = 0;
virtual QSharedPointer<DrmOverlayLayer> createCursorLayer(DrmPipeline *pipeline) = 0;
virtual QSharedPointer<DrmOutputLayer> createLayer(DrmVirtualOutput *output) = 0;
virtual std::shared_ptr<DrmPipelineLayer> createPrimaryLayer(DrmPipeline *pipeline) = 0;
virtual std::shared_ptr<DrmOverlayLayer> createCursorLayer(DrmPipeline *pipeline) = 0;
virtual std::shared_ptr<DrmOutputLayer> createLayer(DrmVirtualOutput *output) = 0;
};
}
......@@ -24,9 +24,9 @@ DrmVirtualOutput::DrmVirtualOutput(const QString &name, DrmGpu *gpu, const QSize
: DrmAbstractOutput(gpu)
, m_vsyncMonitor(SoftwareVsyncMonitor::create(this))
{
connect(m_vsyncMonitor, &VsyncMonitor::vblankOccurred, this, &DrmVirtualOutput::vblank);
connect(m_vsyncMonitor.get(), &VsyncMonitor::vblankOccurred, this, &DrmVirtualOutput::vblank);
auto mode = QSharedPointer<OutputMode>::create(size, 60000, OutputMode::Flag::Preferred);
auto mode = std::make_shared<OutputMode>(size, 60000, OutputMode::Flag::Preferred);
setModesInternal({mode}, mode);
m_renderLoop->setRefreshRate(mode->refreshRate());
......@@ -71,7 +71,7 @@ void DrmVirtualOutput::updateEnablement(bool enable)
DrmOutputLayer *DrmVirtualOutput::outputLayer() const
{
return m_layer.data();
return m_layer.get();
}
void DrmVirtualOutput::recreateSurface()
......
......@@ -43,10 +43,10 @@ private:
void setDpmsMode(DpmsMode mode) override;
void updateEnablement(bool enable) override;
QSharedPointer<DrmOutputLayer> m_layer;
std::shared_ptr<DrmOutputLayer> m_layer;
bool m_pageFlipPending = true;
SoftwareVsyncMonitor *m_vsyncMonitor;
std::unique_ptr<SoftwareVsyncMonitor> m_vsyncMonitor;
};
}
......@@ -12,9 +12,9 @@
#include "utils/damagejournal.h"
#include <QImage>
#include <QSharedPointer>
#include <QSize>
#include <QVector>
#include <memory>
namespace KWin
{
......
......@@ -214,7 +214,7 @@ OutputLayer *EglGbmBackend::primaryLayer(Output *output)
return static_cast<DrmAbstractOutput *>(output)->outputLayer();
}
QSharedPointer<GLTexture> EglGbmBackend::textureForOutput(Output *output) const
std::shared_ptr<GLTexture> EglGbmBackend::textureForOutput(Output *output) const
{
const auto drmOutput = static_cast<DrmAbstractOutput *>(output);
return static_cast<EglGbmLayer *>(drmOutput->outputLayer())->texture();
......@@ -239,23 +239,23 @@ EGLConfig EglGbmBackend::config(uint32_t format) const
return m_configs.value(format, EGL_NO_CONFIG_KHR);
}
QSharedPointer<DrmPipelineLayer> EglGbmBackend::createPrimaryLayer(DrmPipeline *pipeline)
std::shared_ptr<DrmPipelineLayer> EglGbmBackend::createPrimaryLayer(DrmPipeline *pipeline)
{
if (pipeline->output()) {
return QSharedPointer<EglGbmLayer>::create(this, pipeline);
return std::make_shared<EglGbmLayer>(this, pipeline);
} else {
return QSharedPointer<DrmLeaseEglGbmLayer>::create(pipeline);
return std::make_shared<DrmLeaseEglGbmLayer>(pipeline);
}
}
QSharedPointer<DrmOverlayLayer> EglGbmBackend::createCursorLayer(DrmPipeline *pipeline)
std::shared_ptr<DrmOverlayLayer> EglGbmBackend::createCursorLayer(DrmPipeline *pipeline)
{
return QSharedPointer<EglGbmCursorLayer>::create(this, pipeline);
return std::make_shared<EglGbmCursorLayer>(this, pipeline);
}
QSharedPointer<DrmOutputLayer> EglGbmBackend::createLayer(DrmVirtualOutput *output)
std::shared_ptr<DrmOutputLayer> EglGbmBackend::createLayer(DrmVirtualOutput *output)
{
return QSharedPointer<VirtualEglGbmLayer>::create(this, output);
return std::make_shared<VirtualEglGbmLayer>(this, output);
}
DrmGpu *EglGbmBackend::gpu() const
......@@ -341,22 +341,22 @@ EGLImageKHR EglGbmBackend::importDmaBufAsImage(gbm_bo *bo)
return image;
}
QSharedPointer<GLTexture> EglGbmBackend::importDmaBufAsTexture(const DmaBufAttributes &attributes)
std::shared_ptr<GLTexture> EglGbmBackend::importDmaBufAsTexture(const DmaBufAttributes &attributes)
{
EGLImageKHR image = importDmaBufAsImage(attributes);
if (image != EGL_NO_IMAGE_KHR) {
return QSharedPointer<EGLImageTexture>::create(eglDisplay(), image, GL_RGBA8, QSize(attributes.width, attributes.height));
return std::make_shared<EGLImageTexture>(eglDisplay(), image, GL_RGBA8, QSize(attributes.width, attributes.height));
} else {
qCWarning(KWIN_DRM) << "Failed to record frame: Error creating EGLImageKHR - " << getEglErrorString();
return nullptr;
}
}
QSharedPointer<GLTexture> EglGbmBackend::importDmaBufAsTexture(gbm_bo *bo)
std::shared_ptr<GLTexture> EglGbmBackend::importDmaBufAsTexture(gbm_bo *bo)
{
EGLImageKHR image = importDmaBufAsImage(bo);
if (image != EGL_NO_IMAGE_KHR) {
return QSharedPointer<EGLImageTexture>::create(eglDisplay(), image, GL_RGBA8, QSize(gbm_bo_get_width(bo), gbm_bo_get_height(bo)));
return std::make_shared<EGLImageTexture>(eglDisplay(), image, GL_RGBA8, QSize(gbm_bo_get_width(bo), gbm_bo_get_height(bo)));
} else {
qCWarning(KWIN_DRM) << "Failed to record frame: Error creating EGLImageKHR - " << getEglErrorString();
return nullptr;
......
......@@ -14,7 +14,6 @@
#include <QHash>
#include <QPointer>
#include <QSharedPointer>
#include <optional>
struct gbm_surface;
......@@ -70,21 +69,21 @@ public:
void init() override;
bool prefer10bpc() const override;
QSharedPointer<DrmPipelineLayer