#include <DSCompositor.h>
-#include <DSOutput.h>
+#include <IDSOutput.h>
#include <DSInput.h>
#include <DSCanvas.h>
#include <DSSeat.h>
// DSCompositor listen signals. OutputAdd/Remove/ResolutionSet and InputAdd/Remove.
// compositor->connectSignal(DSOuptut::ADD_SIGNAL, DSCompositor::OutputAdd);
-// compositor->connectSignal(DSOutput::REMOVE_SIGNAL, DSCompositor::OutputRemove);
-// compositor->connectSignal(DSOutput::RESOLUTION_SET_SIGNAL, DSCompositor::OutputResolutionSet);
+// compositor->connectSignal(IDSOutput::REMOVE_SIGNAL, DSCompositor::OutputRemove);
+// compositor->connectSignal(IDSOutput::RESOLUTION_SET_SIGNAL, DSCompositor::OutputResolutionSet);
// compositor->connectSignal(DSInput::ADD_SIGNAL, DSCompositor::InputAdd);
// compositor->connectSignal(DSInput::REMOVE_SIGNAL, DSCompositor::InputRemove);
__canvas->attachDisplayArea(__displayArea);
}
- void _onOutputAdded(std::shared_ptr<DSOutput> output) override
+ void _onOutputAdded(std::shared_ptr<IDSOutput> output) override
{
// set the resolution.
output->applyResolutionAuto();
__displayArea->setSize(output->getResolutionWidth(), output->getResolutionHeight());
}
- void _onOutputRemoved(std::shared_ptr<DSOutput> output) override
+ void _onOutputRemoved(std::shared_ptr<IDSOutput> output) override
{
__displayArea.reset(); // delete shared_ptr
}
#include <DSCore.h>
#include <DSObject.h>
-#include <DSOutput.h>
+#include <IDSOutput.h>
#include <DSInput.h>
#include <memory>
protected:
virtual void _onPrepareCanvas() = 0;
- virtual void _onOutputAdded(std::shared_ptr<DSOutput> output) = 0;
- virtual void _onOutputRemoved(std::shared_ptr<DSOutput> output) = 0;
+ virtual void _onOutputAdded(std::shared_ptr<IDSOutput> output) = 0;
+ virtual void _onOutputRemoved(std::shared_ptr<IDSOutput> output) = 0;
virtual void _onInputAdded(std::shared_ptr<DSInput> input) = 0;
virtual void _onInputRemoved(std::shared_ptr<DSInput> input) = 0;
};
namespace display_server
{
-DSDisplayArea::DSDisplayArea(std::shared_ptr<DSOutput> output)
+DSDisplayArea::DSDisplayArea(std::shared_ptr<IDSOutput> output)
: _d_ptr(std::make_unique<DSDisplayAreaPrivate>(this, output))
{}
return priv->getHeight();
}
-std::shared_ptr<DSOutput> DSDisplayArea::getOutput()
+std::shared_ptr<IDSOutput> DSDisplayArea::getOutput()
{
DS_GET_PRIV(DSDisplayArea);
return priv->getOutput();
}
-DSDisplayAreaPrivate::DSDisplayAreaPrivate(DSDisplayArea *p_ptr, std::shared_ptr<DSOutput> output)
+DSDisplayAreaPrivate::DSDisplayAreaPrivate(DSDisplayArea *p_ptr, std::shared_ptr<IDSOutput> output)
: DSObjectPrivate(p_ptr),
__p_ptr(p_ptr),
__output(output),
return __height;
}
-std::shared_ptr<DSOutput> DSDisplayAreaPrivate::getOutput()
+std::shared_ptr<IDSOutput> DSDisplayAreaPrivate::getOutput()
{
return __output;
}
#include <DSCore.h>
#include <DSObject.h>
-#include <DSOutput.h>
+#include <IDSOutput.h>
#include <memory>
namespace display_server
{
DS_PIMPL_USE_PRIVATE(DSDisplayArea);
public:
- explicit DSDisplayArea(std::shared_ptr<DSOutput> output);
+ explicit DSDisplayArea(std::shared_ptr<IDSOutput> output);
virtual ~DSDisplayArea();
bool setPosition(int x, int y);
bool setSize(int width, int height);
int getWidth();
int getHeight();
- std::shared_ptr<DSOutput> getOutput();
+ std::shared_ptr<IDSOutput> getOutput();
};
}
#define __DS_DISPLAY_AREA_PRIVATE_H__
#include "DSDisplayArea.h"
-#include <DSOutput.h>
+#include <IDSOutput.h>
#include <memory>
namespace display_server
DS_PIMPL_USE_PUBLIC(DSDisplayArea);
public:
DSDisplayAreaPrivate() = delete;
- DSDisplayAreaPrivate(DSDisplayArea *p_ptr, std::shared_ptr<DSOutput> output);
+ DSDisplayAreaPrivate(DSDisplayArea *p_ptr, std::shared_ptr<IDSOutput> output);
virtual ~DSDisplayAreaPrivate();
bool setPosition(int x, int y);
int getWidth();
int getHeight();
- bool setOutput(std::shared_ptr<DSOutput> output);
- std::shared_ptr<DSOutput> getOutput();
+ bool setOutput(std::shared_ptr<IDSOutput> output);
+ std::shared_ptr<IDSOutput> getOutput();
private:
- std::shared_ptr<DSOutput> __output;
+ std::shared_ptr<IDSOutput> __output;
int __x, __y;
int __width, __height;
};
+++ /dev/null
-#include "DSOutput.h"
-
-namespace display_server
-{
-DSOutput::DSOutput()
- : __resolutionWidth{0},
- __resolutionHeight{0}
-{}
-
-DSOutput::~DSOutput()
-{}
-
-int DSOutput::getResolutionWidth()
-{
- return __resolutionWidth;
-}
-
-int DSOutput::getResolutionHeight()
-{
- return __resolutionHeight;
-}
-
-bool DSOutput::applyResolutionAuto()
-{
- return false;
-}
-
-} // namespace display_server
+++ /dev/null
-#ifndef _DSOUTPUT_H_
-#define _DSOUTPUT_H_
-
-#include <memory>
-
-namespace display_server
-{
-
-class DSOutput
-{
-public:
- DSOutput();
- virtual ~DSOutput();
-
- int getResolutionWidth();
- int getResolutionHeight();
- bool applyResolutionAuto();
-
-private:
- int __resolutionWidth;
- int __resolutionHeight;
-};
-
-}
-
-#endif
--- /dev/null
+#include "DSOutputImpl.h"
+#include "DSDebugLog.h"
+
+namespace display_server
+{
+
+DSOutputImpl::DSOutputImpl(std::shared_ptr<IDSDisplayDeviceOutput> displayDeviceOutput)
+ : __resolutionWidth{0},
+ __resolutionHeight{0},
+ __displayDeviceOutput{displayDeviceOutput}
+{}
+
+DSOutputImpl::~DSOutputImpl()
+{}
+
+int DSOutputImpl::getResolutionWidth()
+{
+ return __resolutionWidth;
+}
+
+int DSOutputImpl::getResolutionHeight()
+{
+ return __resolutionHeight;
+}
+
+bool DSOutputImpl::applyResolutionAuto()
+{
+ if (!__displayDeviceOutput) {
+ DSLOG_ERR("DSOutputImpl", "__displayDeviceOutput is null.");
+ return false;
+ }
+
+ std::list<std::shared_ptr<IDSDisplayDeviceOutputMode>> modes = __displayDeviceOutput->getAvailableModes();
+ if (modes.empty()) {
+ DSLOG_ERR("DSOutputImpl", "modes are empty.");
+ return false;
+ }
+
+ auto bestMode = modes.front();
+ if (!bestMode) {
+ DSLOG_ERR("DSOutputImpl", "bestMode is null.");
+ return false;
+ }
+
+ if (!__displayDeviceOutput->setMode(bestMode)) {
+ DSLOG_ERR("DSOutputImpl", "output->setMode(bestMode) fails.");
+ return false;
+ }
+
+ return true;
+}
+
+std::shared_ptr<IDSBufferQueue> DSOutputImpl::getDisplayBufferQueue()
+{
+ std::shared_ptr<IDSDisplayDeviceHWC> displayDeviceHWC = __displayDeviceOutput->getHWC();
+ if (!displayDeviceHWC) {
+ DSLOG_ERR("DSOutputImpl", "displayDeviceHWC is NULL.");
+ return nullptr;
+ }
+
+ return displayDeviceHWC->getTargetBufferQueue();
+}
+
+} // namespace display_server
--- /dev/null
+#ifndef __I_DS_OUTPUT_IMPL_H__
+#define __I_DS_OUTPUT_IMPL_H__
+
+#include "IDSOutput.h"
+#include "IDSDisplayDeviceOutput.h"
+
+namespace display_server
+{
+
+class DSOutputImpl : public IDSOutput
+{
+public:
+ DSOutputImpl(std::shared_ptr<IDSDisplayDeviceOutput> displayDeviceOutput);
+ ~DSOutputImpl();
+
+ int getResolutionWidth() override;
+ int getResolutionHeight() override;
+ bool applyResolutionAuto() override;
+
+ std::shared_ptr<IDSBufferQueue> getDisplayBufferQueue();
+
+private:
+ int __resolutionWidth;
+ int __resolutionHeight;
+ std::shared_ptr<IDSDisplayDeviceOutput> __displayDeviceOutput;
+};
+
+}
+
+#endif
\ No newline at end of file
--- /dev/null
+#ifndef __I_DS_OUTPUT_H__
+#define __I_DS_OUTPUT_H__
+
+#include <memory>
+
+namespace display_server
+{
+
+class IDSOutput
+{
+public:
+ virtual ~IDSOutput() = default;
+
+ virtual int getResolutionWidth() = 0;
+ virtual int getResolutionHeight() = 0;
+ virtual bool applyResolutionAuto() = 0;
+};
+
+}
+
+#endif
\ No newline at end of file
'DSObject/DSObject.h',
'DSObject/DSObjectPrivate.cpp',
'DSObject/DSObjectPrivate.h',
- 'DSOutput/DSOutput.cpp',
+ 'DSOutput/DSOutputImpl.cpp',
'DSPolicyArea/DSPolicyArea.cpp',
'DSProperty/DSProperty.cpp',
'DSProperty/DSProperty.h',
#include "libds-tests.h"
#include "DSCanvas.h"
+#include "IDSOutput.h"
+#include "DSOutputImpl.h"
+#include "IDSDisplayDeviceOutput.h"
+#include "DSDisplayDeviceOutputTDMImpl.h"
using namespace display_server;
{
std::unique_ptr<DSCanvas> canvas = std::make_unique<DSCanvas>();
EXPECT_TRUE(canvas != nullptr);
- auto output = std::make_shared<DSOutput>();
+ auto displayDeviceOutput = std::make_shared<DSDisplayDeviceOutputTDMImpl>();
+ EXPECT_TRUE(displayDeviceOutput != nullptr);
+ auto output = std::make_shared<DSOutputImpl>(displayDeviceOutput);
EXPECT_TRUE(output != nullptr);
auto displayArea = std::make_shared<DSDisplayArea>(output);
EXPECT_TRUE(displayArea != nullptr);
void _onPrepareCanvas() override
{}
- void _onOutputAdded(std::shared_ptr<DSOutput> output) override
+ void _onOutputAdded(std::shared_ptr<IDSOutput> output) override
{}
- void _onOutputRemoved(std::shared_ptr<DSOutput> output) override
+ void _onOutputRemoved(std::shared_ptr<IDSOutput> output) override
{}
void _onInputAdded(std::shared_ptr<DSInput> input) override
#include "libds-tests.h"
#include "DSDisplayArea.h"
+#include "IDSOutput.h"
+#include "DSOutputImpl.h"
+#include "IDSDisplayDeviceOutput.h"
+#include "DSDisplayDeviceOutputTDMImpl.h"
using namespace display_server;
TEST_F(DSDisplayAreaTest, NewDSDisplayArea)
{
- auto output = std::make_shared<DSOutput>();
+ auto displayDeviceOutput = std::make_shared<DSDisplayDeviceOutputTDMImpl>();
+ EXPECT_TRUE(displayDeviceOutput != nullptr);
+ auto output = std::make_shared<DSOutputImpl>(displayDeviceOutput);
EXPECT_TRUE(output != nullptr);
auto displayArea = std::make_unique<DSDisplayArea>(output);
TEST_F(DSDisplayAreaTest, BasicMethods)
{
- auto output = std::make_shared<DSOutput>();
+ auto displayDeviceOutput = std::make_shared<DSDisplayDeviceOutputTDMImpl>();
+ EXPECT_TRUE(displayDeviceOutput != nullptr);
+ auto output = std::make_shared<DSOutputImpl>(displayDeviceOutput);
EXPECT_TRUE(output != nullptr);
auto displayArea = std::make_unique<DSDisplayArea>(output);
+++ /dev/null
-#include "libds-tests.h"
-#include "DSOutput.h"
-
-using namespace display_server;
-
-class DSOutputTest : public ::testing::Test
-{
-public:
- void SetUp(void) override
- {}
- void TearDown(void) override
- {}
-};
-
-TEST_F(DSOutputTest, NewDSOutput)
-{
- std::shared_ptr<DSOutput> output = std::make_shared<DSOutput>();
- EXPECT_TRUE(output != nullptr);
-}
-
-TEST_F(DSOutputTest, BasicMethods)
-{
- DSOutput output;
-
- EXPECT_TRUE(output.getResolutionWidth() != 0);
- EXPECT_TRUE(output.getResolutionHeight() != 0);
- EXPECT_TRUE(output.applyResolutionAuto() == true);
-}
--- /dev/null
+#include "libds-tests.h"
+#include "IDSOutput.h"
+#include "DSOutputImpl.h"
+#include "IDSDisplayDeviceOutput.h"
+#include "DSDisplayDeviceOutputTDMImpl.h"
+
+using namespace display_server;
+
+class DSOutputTest : public ::testing::Test
+{
+public:
+ void SetUp(void) override
+ {}
+ void TearDown(void) override
+ {}
+};
+
+TEST_F(DSOutputTest, NewDSOutput)
+{
+ auto displayDeviceOutput = std::make_shared<DSDisplayDeviceOutputTDMImpl>();
+ EXPECT_TRUE(displayDeviceOutput != nullptr);
+ auto output = std::make_shared<DSOutputImpl>(displayDeviceOutput);
+ EXPECT_TRUE(output != nullptr);
+}
+
+TEST_F(DSOutputTest, BasicMethods)
+{
+ auto displayDeviceOutput = std::make_shared<DSDisplayDeviceOutputTDMImpl>();
+ EXPECT_TRUE(displayDeviceOutput != nullptr);
+ auto output = std::make_shared<DSOutputImpl>(displayDeviceOutput);
+ EXPECT_TRUE(output != nullptr);
+
+ EXPECT_TRUE(output->getResolutionWidth() != 0);
+ EXPECT_TRUE(output->getResolutionHeight() != 0);
+ EXPECT_TRUE(output->applyResolutionAuto() == true);
+}
'DSRenderEngineEcoreEvasImpl-test.cpp',
'DSRenderEngineDaliImpl-test.cpp',
'DSCompositor-test.cpp',
- 'DSOutput-test.cpp',
+ 'DSOutputImpl-test.cpp',
'DSInput-test.cpp',
'DSCanvas-test.cpp',
'DSSeat-test.cpp',