if (renderer)
{
shader = renderer->createShader(&m_vertName, &m_fragName);
+ break;
}
- break;
}
if (shader)
{
ExecutionResult ShaderDestroyCommand::execute(ICommandExecutor* executor)
{
Scene& scene = *(executor->getScene());
- ShaderMap& shaderMap = scene.m_shaderMap;
ExecutionResult result = ExecutionFailed;
// get shader by its ID
- ShaderMapIterator iter = shaderMap.find(m_id);
- ShaderMapIterator iterEnd = shaderMap.end();
+ ShaderMapIterator iter = scene.m_shaderMap.find(m_id);
+ ShaderMapIterator iterEnd = scene.m_shaderMap.end();
if (iter == iterEnd)
{
vec3f m_position;
vec3f m_target;
IlmMatrix m_viewProjectionMatrix;
- IlmMatrix m_translationMatrix;
- IlmMatrix m_rotationMatrix;
- IlmMatrix m_projectionMatrix;
- IlmMatrix m_identityMatrix;
- IlmMatrix eyeMatrix;
+ IlmMatrix m_translationMatrix;
+ IlmMatrix m_rotationMatrix;
+ IlmMatrix m_projectionMatrix;
+ IlmMatrix m_identityMatrix;
};
#endif
private:
Camera m_camera;
- int lastUpdateTime;
int m_houseCount;
list<IRenderable*> m_renderList;
list<IUpdateable*> m_updateList;
virtual void use(vec3f* position, vec4f* color);
private:
- vec3f* m_pPosition;
- vec4f* m_pColor;
int m_uniformModelMatrix;
int m_uniformColor;
};
0.1f, // near
1000.0f, // far
viewportWidth/viewportHeight); // aspect ratio
+ m_viewProjectionMatrix = m_identityMatrix;
}
Camera::~Camera()
bool ShaderBase::initShader()
{
- t_ilm_bool result = ILM_TRUE;
+ GLint glResult = GL_FALSE;
// Create the fragment shader object
fragmentShaderId = glCreateShader(GL_FRAGMENT_SHADER);
// Compile the source code of fragment shader
glCompileShader(fragmentShaderId);
- glGetShaderiv(fragmentShaderId, GL_COMPILE_STATUS, (GLint*) &result);
+ glGetShaderiv(fragmentShaderId, GL_COMPILE_STATUS, &glResult);
- if (!result)
+ if (glResult == GL_FALSE)
{
t_ilm_int infoLength, numberChars;
glGetShaderiv(fragmentShaderId, GL_INFO_LOG_LENGTH, &infoLength);
// Compile the source code of fragment shader
glCompileShader(vertexShaderId);
- glGetShaderiv(vertexShaderId, GL_COMPILE_STATUS, (GLint*) &result);
+ glGetShaderiv(vertexShaderId, GL_COMPILE_STATUS, &glResult);
- if (!result)
+ if (glResult == GL_FALSE)
{
t_ilm_int infoLength, numberChars;
glGetShaderiv(vertexShaderId, GL_INFO_LOG_LENGTH, &infoLength);
glLinkProgram(shaderProgramId);
- glGetProgramiv(shaderProgramId, GL_LINK_STATUS, (GLint*) &result);
+ glGetProgramiv(shaderProgramId, GL_LINK_STATUS, &glResult);
- if (!result)
+ if (glResult == GL_FALSE)
{
t_ilm_int infoLength, numberChars;
glGetShaderiv(shaderProgramId, GL_INFO_LOG_LENGTH, &infoLength);
#if 1 /* ADIT */
glValidateProgram(shaderProgramId);
- glGetProgramiv(shaderProgramId, GL_VALIDATE_STATUS, (GLint*) &result);
+ glGetProgramiv(shaderProgramId, GL_VALIDATE_STATUS, &glResult);
- if (!result)
+ if (glResult == GL_FALSE)
{
t_ilm_int infoLength, numberChars;
glGetShaderiv(shaderProgramId, GL_INFO_LOG_LENGTH, &infoLength);
m_uniformProjectionMatrix = glGetUniformLocation(shaderProgramId, "u_projectionMatrix");
- if (result)
- {
- cout << "Shader setup complete.\n";
- }
- else
- {
- cout << "Shader setup failed.\n";
- }
+ cout << "Shader setup complete.\n";
- return result;
+ return ILM_TRUE;
}
bool ShaderBase::destroyShader()
vec3f m_position;
vec3f m_target;
IlmMatrix m_viewProjectionMatrix;
- IlmMatrix m_translationMatrix;
- IlmMatrix m_rotationMatrix;
- IlmMatrix m_projectionMatrix;
- IlmMatrix m_identityMatrix;
- IlmMatrix eyeMatrix;
+ IlmMatrix m_translationMatrix;
+ IlmMatrix m_rotationMatrix;
+ IlmMatrix m_projectionMatrix;
+ IlmMatrix m_identityMatrix;
};
#endif
private:
Camera m_camera;
- int lastUpdateTime;
int m_houseCount;
list<IRenderable*> m_renderList;
list<IUpdateable*> m_updateList;
virtual void use(vec3f* position, vec4f* color);
private:
- vec3f* m_pPosition;
- vec4f* m_pColor;
int m_uniformModelMatrix;
int m_uniformColor;
};
0.1f, // near
1000.0f, // far
viewportWidth/viewportHeight); // aspect ratio
+ m_viewProjectionMatrix = m_identityMatrix;
}
Camera::~Camera()
bool ShaderBase::initShader()
{
- t_ilm_bool result = ILM_TRUE;
+ GLint glResult = GL_FALSE;
// Create the fragment shader object
fragmentShaderId = glCreateShader(GL_FRAGMENT_SHADER);
// Compile the source code of fragment shader
glCompileShader(fragmentShaderId);
- glGetShaderiv(fragmentShaderId, GL_COMPILE_STATUS, (GLint*) &result);
+ glGetShaderiv(fragmentShaderId, GL_COMPILE_STATUS, &glResult);
- if (!result)
+ if (glResult == GL_FALSE)
{
t_ilm_int infoLength, numberChars;
glGetShaderiv(fragmentShaderId, GL_INFO_LOG_LENGTH, &infoLength);
// Compile the source code of fragment shader
glCompileShader(vertexShaderId);
- glGetShaderiv(vertexShaderId, GL_COMPILE_STATUS, (GLint*) &result);
+ glGetShaderiv(vertexShaderId, GL_COMPILE_STATUS, &glResult);
- if (!result)
+ if (glResult == GL_FALSE)
{
t_ilm_int infoLength, numberChars;
glGetShaderiv(vertexShaderId, GL_INFO_LOG_LENGTH, &infoLength);
glLinkProgram(shaderProgramId);
- glGetProgramiv(shaderProgramId, GL_LINK_STATUS, (GLint*) &result);
+ glGetProgramiv(shaderProgramId, GL_LINK_STATUS, &glResult);
- if (!result)
+ if (glResult == GL_FALSE)
{
t_ilm_int infoLength, numberChars;
glGetShaderiv(shaderProgramId, GL_INFO_LOG_LENGTH, &infoLength);
m_uniformProjectionMatrix = glGetUniformLocation(shaderProgramId, "u_projectionMatrix");
- if (result)
- {
- cout << "Shader setup complete.\n";
- }
- else
- {
- cout << "Shader setup failed.\n";
- }
+ cout << "Shader setup complete.\n";
- return result;
+ return ILM_TRUE;
}
bool ShaderBase::destroyShader()
printf("\tRendered frames\t: %i\n\n",surfaceProperties.frameCounter);
}
-
-
bool fillLayerRenderOrder(char * param, t_param_struct* pStruct)
{
bool result = true;
char * pRes = new char[strlen(param)+1];
strcpy(pRes,param);
int i = 0;
- pRes = strtok (pRes,",");
+ char* tokens = strtok (pRes,",");
+ delete[] pRes;
+ pRes = tokens;
while (pRes != NULL)
{
pRes = strtok (NULL, ",");
pStruct->layerro = new t_ilm_layer[i];
pStruct->layerro_length = i;
i = 0;
- pRes = strtok (pRes,",");
+ tokens = strtok (pRes,",");
+ delete[] pRes;
+ pRes = tokens;
+
printf("Set Renderorder : [\n");
while (pRes != NULL)
{
while (pos != std::string::npos)
{
std::string tempString = pRes.substr(0,pos);
- printf("Dim param %s\n",tempString.c_str());
+ printf("Dim param %s\n",tempString.c_str());
tempArray[i++] = atoi(tempString.c_str());
pRes = pRes.substr(pos+1);
pos = pRes.find(",");
int i=0;
if ( param_struct->screenid != -1 )
{
- error = ilm_getLayerIDsOnScreen(param_struct->screenid, &layerLength,&layerIds);
- } else {
+ error = ilm_getLayerIDsOnScreen(param_struct->screenid, &layerLength, &layerIds);
+ }
+ else
+ {
error = ilm_getLayerIDs(&layerLength,&layerIds);
}
if (layerLength > 0 && error == ILM_SUCCESS)
{
- printf("List Layer Ids for screen %i\n[\n",param_struct->screenid);
+ printf("List Layer Ids for screen %i\n[\n", param_struct->screenid);
for (i=0;i<layerLength;i++)
{
t_ilm_int surfaceLength=0;
t_ilm_surface* surfaceIds = NULL;
int j=0;
printf("\tLayer : 0x%08x\n",layerIds[i]);
- ilm_getSurfaceIDsOnLayer(layerIds[i], &surfaceLength,&surfaceIds);
+ ilm_getSurfaceIDsOnLayer(layerIds[i], &surfaceLength, &surfaceIds);
if (surfaceLength > 0 )
{
for (j=0;j<surfaceLength;j++)
{
printf("\t\tSurface : 0x%08x\n",surfaceIds[j]);
}
- delete[] surfaceIds;
}
+ delete[] surfaceIds;
}
printf("]\n");
- delete [] layerIds;
}
+ delete [] layerIds;
return error;
}
{
printf("\tSurface : 0x%08x\n",surfaceIds[j]);
}
- delete[] surfaceIds;
printf("]\n");
}
+ delete[] surfaceIds;
return error;
}
/* setup inital layer scenery */
for (i = 0;i<numberOfLayers;i++)
{
- m_executor->execute(new LayerCreateCommand(screenResolution[0], screenResolution[1], &(gInitialLayerScene[i].layer)));
- m_executor->execute(new LayerSetSourceRectangleCommand(gInitialLayerScene[i].layer, 0, 0, screenResolution[0], screenResolution[1]));
- m_executor->execute(new LayerSetDestinationRectangleCommand(gInitialLayerScene[i].layer, 0, 0, screenResolution[0], screenResolution[1]));
- m_executor->execute(new LayerSetOpacityCommand(gInitialLayerScene[i].layer, gInitialLayerScene[i].opacity) );
- m_executor->execute(new LayerSetVisibilityCommand(gInitialLayerScene[i].layer, gInitialLayerScene[i].visibility) );
- m_executor->execute(new CommitCommand());
+ result &= m_executor->execute(new LayerCreateCommand(screenResolution[0], screenResolution[1], &(gInitialLayerScene[i].layer)));
+ result &= m_executor->execute(new LayerSetSourceRectangleCommand(gInitialLayerScene[i].layer, 0, 0, screenResolution[0], screenResolution[1]));
+ result &= m_executor->execute(new LayerSetDestinationRectangleCommand(gInitialLayerScene[i].layer, 0, 0, screenResolution[0], screenResolution[1]));
+ result &= m_executor->execute(new LayerSetOpacityCommand(gInitialLayerScene[i].layer, gInitialLayerScene[i].opacity) );
+ result &= m_executor->execute(new LayerSetVisibilityCommand(gInitialLayerScene[i].layer, gInitialLayerScene[i].visibility) );
+ result &= m_executor->execute(new CommitCommand());
renderOrder[i]=gInitialLayerScene[i].layer;
}
/* Finally set the first executed renderorder */
- m_executor->execute(new ScreenSetRenderOrderCommand(renderOrder, numberOfLayers));
- m_executor->execute(new CommitCommand());
+ result &= m_executor->execute(new ScreenSetRenderOrderCommand(renderOrder, numberOfLayers));
+ result &= m_executor->execute(new CommitCommand());
}
if ( numberOfSurfaces > 0 )
/* setup inital surface scenery */
for (i = 0;i<numberOfSurfaces;i++)
{
- m_executor->execute(new SurfaceCreateCommand( &(gInitialSurfaceScene[i].surface)));
- m_executor->execute(new SurfaceSetOpacityCommand(gInitialSurfaceScene[i].surface, gInitialSurfaceScene[i].opacity));
- m_executor->execute(new SurfaceSetVisibilityCommand(gInitialSurfaceScene[i].surface, gInitialSurfaceScene[i].visibility));
- m_executor->execute(new CommitCommand());
-
+ result &= m_executor->execute(new SurfaceCreateCommand( &(gInitialSurfaceScene[i].surface)));
+ result &= m_executor->execute(new SurfaceSetOpacityCommand(gInitialSurfaceScene[i].surface, gInitialSurfaceScene[i].opacity));
+ result &= m_executor->execute(new SurfaceSetVisibilityCommand(gInitialSurfaceScene[i].surface, gInitialSurfaceScene[i].visibility));
+ result &= m_executor->execute(new CommitCommand());
}
/* Finally set the first executed renderorder */
}
- return result;
+ return result;
}
extern "C" ISceneProvider* createLayerScene(ICommandExecutor* executor)
dbus_uint32_t m_serial;
DBusConnection* m_pConnection;
DBusError m_err;
- DBusObjectPathVTable m_objectPathVTable;
};
{
result = DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
+
+ free(owner);
+
return result;
}
void* comInstance)
{
bool result = true;
- m_objectPathVTable.unregister_function = fUnregisterFunc;
- m_objectPathVTable.message_function = fMessageFunc;
+ DBusObjectPathVTable objectPathVTable;
+ memset(&objectPathVTable, 0, sizeof(objectPathVTable));
+ objectPathVTable.unregister_function = fUnregisterFunc;
+ objectPathVTable.message_function = fMessageFunc;
- if (!dbus_connection_register_object_path(m_pConnection,DBUS_SERVICE_OBJECT_PATH,&m_objectPathVTable, comInstance) )
+ if (!dbus_connection_register_object_path(m_pConnection, DBUS_SERVICE_OBJECT_PATH, &objectPathVTable, comInstance) )
{
result = false;
}
char* DBUSMessageHandler::getString()
{
- char* param;
+ char* param = NULL;
if (DBUS_TYPE_STRING != dbus_message_iter_get_arg_type(&m_MessageIter))
{
dbus_bool_t DBUSMessageHandler::getBool()
{
- dbus_bool_t boolparam;
+ dbus_bool_t boolparam = FALSE;
if (DBUS_TYPE_BOOLEAN != dbus_message_iter_get_arg_type(&m_MessageIter))
{
char DBUSMessageHandler::getByte()
{
- char param;
+ char param = 0;
if (DBUS_TYPE_BYTE != dbus_message_iter_get_arg_type(&m_MessageIter))
{
dbus_uint32_t DBUSMessageHandler::getUInt()
{
- dbus_uint32_t param;
+ dbus_uint32_t param = 0;
if (DBUS_TYPE_UINT32 != dbus_message_iter_get_arg_type(&m_MessageIter))
{
double DBUSMessageHandler::getDouble()
{
- double param;
+ double param = 0.0;
if (DBUS_TYPE_DOUBLE != dbus_message_iter_get_arg_type(&m_MessageIter))
{
MockCommandExecutor mockCommandExecutor;
MockLayerList layerlist;
- DBUSCommunicatorTest() {
+ DBUSCommunicatorTest()
+ : processThread(0)
+ , running(false)
+ , communicatorUnderTest(NULL)
+ {
}
virtual ~DBUSCommunicatorTest() {
void TearDown() {
running = false;
- this->communicatorUnderTest->stop();
- pthread_join(processThread, NULL);
if (communicatorUnderTest) {
+ this->communicatorUnderTest->stop();
+ pthread_join(processThread, NULL);
delete communicatorUnderTest;
}
}
fseek(pFile, 0, SEEK_END);
long size = ftell(pFile);
+
+ if (size < 0)
+ {
+ LOG_ERROR("RenderUtilLoadShaderFile","Unable get size of ShaderFile " << szFilename);
+ fclose(pFile);
+ return(NULL);
+ }
+
fseek(pFile, 0, SEEK_SET);
char *pBuffer = new char[size+1];
GLESGraphicsystem::GLESGraphicsystem(int windowWidth, int windowHeight, PfnShaderProgramCreator shaderProgram)
: m_windowWidth(windowWidth)
, m_windowHeight(windowHeight)
+, m_nativeDisplay(0)
+, m_nativeWindow(0)
, m_shaderCreatorFunc(shaderProgram)
+, m_eglConfig(0)
+, m_eglContext(0)
+, m_eglSurface(0)
+, m_eglDisplay(0)
+, m_vbo(0)
+, m_displayWidth(0)
+, m_displayHeight(0)
+, m_blendingStatus(false)
+, m_defaultShader(0)
+, m_defaultShaderNoUniformAlpha(0)
+, m_currentLayer(0)
+#ifdef DRAW_LAYER_DEBUG
+, m_layerShader(0)
+#endif
{
LOG_DEBUG("GLESGraphicsystem", "creating GLESGraphicsystem");
}
ViewportTransform::applyLayerSource(layerSourceRegion, targetSurfaceSource, targetSurfaceDestination);
ViewportTransform::applyLayerDestination(layerDestinationRegion, layerSourceRegion, targetSurfaceDestination);
- float* textureCoordinates = new float[4];
+ float textureCoordinates[4];
ViewportTransform::transformRectangleToTextureCoordinates(targetSurfaceSource, surface->OriginalSourceWidth, surface->OriginalSourceHeight, textureCoordinates);
glBindBuffer(GL_ARRAY_BUFFER, m_vbo);
{
LOG_ERROR("GLESGraphicsystem", "GL Error occured :" << glErrorCode );
};
-
- delete[] textureCoordinates;
}
bool GLESGraphicsystem::initOpenGLES(EGLint displayWidth, EGLint displayHeight)
#include "Bitmap.h"
GLXGraphicsystem::GLXGraphicsystem(int WindowWidth, int WindowHeight)
+: m_windowWidth(WindowWidth)
+, m_windowHeight(WindowHeight)
+, m_x11display(0)
+, m_window(0)
+, m_context(0)
+, m_currentLayer(0)
+, m_zerocopy(false)
+
{
LOG_DEBUG("GLXGraphicsystem", "creating GLXGraphicsystem");
- this->m_windowHeight = WindowHeight;
- this->m_windowWidth = WindowWidth;
- m_zerocopy = false;
}
GLXGraphicsystem::~GLXGraphicsystem()
ViewportTransform::applyLayerSource(layerSourceRegion, targetSurfaceSource, targetSurfaceDestination);
ViewportTransform::applyLayerDestination(layerDestinationRegion, layerSourceRegion, targetSurfaceDestination);
- float* textureCoordinates = new float[4];
+ float textureCoordinates[4];
ViewportTransform::transformRectangleToTextureCoordinates(targetSurfaceSource, currentSurface->OriginalSourceWidth, currentSurface->OriginalSourceHeight, textureCoordinates);
glPushMatrix();
if ( GL_NO_ERROR != glErrorCode )
{
LOG_ERROR("GLXGraphicsystem", "GL Error occured :" << glErrorCode );
- };
- currentSurface->frameCounter++;
- currentSurface->drawCounter++;
- delete[] textureCoordinates;
+ }
+ currentSurface->frameCounter++;
+ currentSurface->drawCounter++;
}
void GLXGraphicsystem::saveScreenShotOfFramebuffer(std::string fileToSave)
bool X11CopyGLX::bindSurfaceTexture(Surface* surface)
{
- XPlatformSurface* nativeSurface = (XPlatformSurface*)surface->platform;
+ XPlatformSurface* nativeSurface = NULL;
Pixmap pixmap = 0;
GLenum targetType = GL_BGRA;
GLenum sourceType = GL_RGBA;
WaylandBaseWindowSystem::WaylandBaseWindowSystem(const char* displayname, int width, int height, Scene* pScene)
: BaseWindowSystem(pScene)
+, m_wlDisplay(NULL)
+, renderThread(0)
+, run_lock()
+, graphicSystem(NULL)
+, m_wlShm(NULL)
, m_initialized(false)
, m_takeScreenshot(ScreenShotNone)
, m_displayname(displayname)
, m_success(false)
, m_systemState(IDLE_STATE)
, m_manageConnectionId(256)
+, m_screenShotFile()
+, m_screenShotSurfaceID(0)
+, m_screenShotLayerID(0)
, m_debugMode(false)
, m_error(false)
, m_width(width)
, m_height(height)
+, m_listFrameCallback()
+, m_connectionList()
{
LOG_DEBUG("WaylandBaseWindowSystem", "creating WaylandBaseWindowSystem width:" << width << " height:" << height);
WaylandX11WindowSystem::WaylandX11WindowSystem(const char* displayname, int width, int height, Scene* pScene)
: WaylandBaseWindowSystem(displayname, width, height, pScene)
+, m_x11Window(0)
+, m_x11Display(0)
+, m_x11Screen(0)
+, m_x11Visual(0)
+, m_x11Colormap(0)
{
LOG_DEBUG("WaylandX11WindowSystem", "creating WaylandX11WindowSystem width:" << width << " height:" << height);
}
bool WaylandX11WindowSystem::createNativeContext()
{
bool result = true;
- Window rootWindow = NULL;
+ Window rootWindow = 0;
XSetWindowAttributes windowAttributes;
unsigned int windowMask = 0;
int colorDepth = 0;
X11WindowSystem::X11WindowSystem(const char* displayname, int width, int height, Scene* pScene,GetVisualInfoFunction func)
: BaseWindowSystem(pScene)
, takeScreenshot(ScreenShotNone)
+, screenShotFile()
+, screenShotSurfaceID(0)
+, screenShotLayerID()
, displayname(displayname)
, getVisualFunc(func)
, debugMode(false)
, resolutionWidth(width)
, resolutionHeight(height)
+, composite_event(0)
+, composite_error(0)
+, composite_major(0)
+, composite_minor(0)
+, damage_event(0)
+, damage_error(0)
+, damage_major(0)
+, damage_minor(0)
+, m_running(false)
, m_initialized(false)
, m_success(false)
, m_systemState(IDLE_STATE)
, m_displayEnvironment(NULL)
+, x11Display(0)
+, renderThread(0)
, windowWidth(width)
, windowHeight(height)
+, CompositorWindow(0)
+, windowVis(0)
+, run_lock()
+, graphicSystem(0)
{
LOG_DEBUG("X11WindowSystem", "creating X11WindowSystem");
char* name;
status = XFetchName(x11Display, window, &name);
LOG_DEBUG("X11WindowSystem", "Got window name");
- if (status >= Success)
+ if (status >= Success && name)
{
- LOG_DEBUG("X11WindowSystem", "Found window: " << window << " " << name);
+ LOG_DEBUG("X11WindowSystem", "Found window: " << window << " " << name);
char GuiTitle[] = "Layermanager Remote GUI\0";
- if (name != NULL && strcmp(name,GuiTitle)==0)
+ if (strcmp(name,GuiTitle)==0)
{
LOG_DEBUG("X11WindowSystem", "Found gui window: repositioning it");
XCompositeUnredirectWindow(x11Display,window,CompositeRedirectManual);
XMoveWindow(x11Display, window, 50, 500);
XMapRaised(x11Display, window);
}
- }else {
+ }
+ else
+ {
LOG_DEBUG("X11WindowSystem", "Error fetching window name");
}
LOG_DEBUG("X11WindowSystem","Creating New Damage for window - " << window);
: BaseRenderer(pScene)
, m_pWindowSystem(0)
, m_pGraphicSystem(0)
+, m_width(0)
+, m_height(0)
{
}
if ( m_pWindowSystem->init(m_pGraphicSystem ) )
{
Display* x11Display = m_pWindowSystem->getNativeDisplayHandle();
- GLXFBConfig *currentConfig = m_pGraphicSystem->GetMatchingPixmapConfig(x11Display);
- if (x11Display != NULL && currentConfig != NULL )
+ if (x11Display)
{
- LOG_INFO("X11GLXRenderer", "Initialization successfull.");
-#ifdef WITH_FORCE_COPY
- binder = new X11CopyGLX(x11Display);
-#else // WITH_FORCE_COPY
- if ( m_pGraphicSystem->isZeroCopyEnabled() == true )
+ GLXFBConfig *currentConfig = m_pGraphicSystem->GetMatchingPixmapConfig(x11Display);
+ if (currentConfig)
{
- binder = new X11TextureFromPixmap(x11Display, *currentConfig);
- } else {
+ LOG_INFO("X11GLXRenderer", "Initialization successful.");
+#ifdef WITH_FORCE_COPY
binder = new X11CopyGLX(x11Display);
- }
+#else // WITH_FORCE_COPY
+ if (m_pGraphicSystem->isZeroCopyEnabled())
+ {
+ binder = new X11TextureFromPixmap(x11Display, *currentConfig);
+ }
+ else
+ {
+ binder = new X11CopyGLX(x11Display);
+ }
#endif // WITH_FORCE_COPY
- if ( binder != NULL )
- {
- m_pGraphicSystem->setTextureBinder(binder);
- result = m_pWindowSystem->start();
- }
+ if ( binder != NULL )
+ {
+ m_pGraphicSystem->setTextureBinder(binder);
+ result = m_pWindowSystem->start();
+ }
+ }
}
}
return result;
void X11GLXRenderer::signalWindowSystemRedraw()
{
- m_pWindowSystem->signalRedrawEvent();
+ m_pWindowSystem->signalRedrawEvent();
}
void X11GLXRenderer::forceCompositionWindowSystem()
}
extern "C" IRenderer* createX11GLXRenderer(Scene* pScene) {
- return new X11GLXRenderer(pScene);
+ return new X11GLXRenderer(pScene);
}
extern "C" void destroyX11GLXRenderer(X11GLXRenderer* p)
#include "GraphicSystems/GLESGraphicSystem.h"
#include "WindowSystems/WaylandBaseWindowSystem.h"
+class ITextureBinder;
+
class WaylandGLESRenderer : public BaseRenderer
{
public:
GLESGraphicsystem* m_pGraphicSystem;
uint m_width;
uint m_height;
+ ITextureBinder* m_binder;
};
#endif /* _WAYLANDGLESRENDERER_H_*/
, m_pGraphicSystem(0)
, m_width(0)
, m_height(0)
+, m_binder(0)
{
LOG_DEBUG("WaylandGLESRenderer", "Creating Renderer");
}
{
struct wl_display* nativeDisplayHandle = NULL;
EGLDisplay eglDisplayhandle = NULL;
- ITextureBinder* binder = NULL;
+ m_binder = NULL;
m_width = width;
m_height = height;
// create Wayland windows, register as composite manager etc
eglDisplayhandle = m_pGraphicSystem->getEGLDisplay();
#ifdef WITH_FORCE_COPY
- binder = new WaylandCopyGLES(eglDisplayhandle, nativeDisplayHandle);
+ m_binder = new WaylandCopyGLES(eglDisplayhandle, nativeDisplayHandle);
#else // WITH_FORCE_COPY
#ifdef EGL_NATIVE_PIXMAP_KHR
- binder = new WaylandEglImage(eglDisplayhandle, nativeDisplayHandle);
+ m_binder = new WaylandEglImage(eglDisplayhandle, nativeDisplayHandle);
#else // EGL_NATIVE_PIXMAP_KHR
- binder = new WaylandCopyGLES(eglDisplayhandle, nativeDisplayHandle);
+ m_binder = new WaylandCopyGLES(eglDisplayhandle, nativeDisplayHandle);
#endif // EGL_NATIVE_PIXMAP_KHR
#endif // WITH_FORCE_COPY
- if ( binder && nativeDisplayHandle && eglDisplayhandle)
+ if (m_binder && nativeDisplayHandle && eglDisplayhandle)
{
- m_pGraphicSystem->setTextureBinder(binder);
+ m_pGraphicSystem->setTextureBinder(m_binder);
if (!m_pWindowSystem->start())
{
void WaylandGLESRenderer::stop()
{
m_pWindowSystem->stop();
+ if(m_binder)
+ {
+ delete m_binder;
+ }
}
void WaylandGLESRenderer::doScreenShot(std::string fileToSave)
GLESGraphicsystem* m_pGraphicSystem;
uint m_width;
uint m_height;
+ ITextureBinder* m_binder;
};
#endif /* _X11GLESRENDERER_H_*/
const char* pluginLookupPath = getenv("LM_PLUGIN_PATH");
if (pluginLookupPath != NULL )
{
- strcpy(defaultShaderDir,pluginLookupPath);
- } else {
- strcpy(defaultShaderDir,"/usr/lib/layermanager");
+ strncpy(defaultShaderDir, pluginLookupPath, sizeof(defaultShaderDir) - 1);
+ }
+ else
+ {
+ strncpy(defaultShaderDir,"/usr/lib/layermanager", sizeof(defaultShaderDir));
}
strcat(defaultShaderDir,"/renderer");
, m_pGraphicSystem(0)
, m_width(0)
, m_height(0)
+, m_binder(NULL)
{
LOG_DEBUG("X11GLESRenderer", "Creating Renderer");
}
{
Display* nativeDisplayHandle = NULL;
EGLDisplay eglDisplayhandle = NULL;
- ITextureBinder* binder = NULL;
+ m_binder = NULL;
m_width = width;
m_height = height;
// create X11 windows, register as composite manager etc
eglDisplayhandle = m_pGraphicSystem->getEGLDisplay();
#ifdef WITH_FORCE_COPY
- binder = new X11CopyGLES(eglDisplayhandle, nativeDisplayHandle);
+ m_binder = new X11CopyGLES(eglDisplayhandle, nativeDisplayHandle);
#else // WITH_FORCE_COPY
#ifdef EGL_NATIVE_PIXMAP_KHR
- binder = new X11EglImage(eglDisplayhandle, nativeDisplayHandle);
+ m_binder = new X11EglImage(eglDisplayhandle, nativeDisplayHandle);
#else // EGL_NATIVE_PIXMAP_KHR
- binder = new X11CopyGLES(eglDisplayhandle, nativeDisplayHandle);
+ m_binder = new X11CopyGLES(eglDisplayhandle, nativeDisplayHandle);
#endif // EGL_NATIVE_PIXMAP_KHR
#endif // WITH_FORCE_COPY
- if ( binder && nativeDisplayHandle && eglDisplayhandle)
+ if (m_binder && nativeDisplayHandle && eglDisplayhandle)
{
- m_pGraphicSystem->setTextureBinder(binder);
+ m_pGraphicSystem->setTextureBinder(m_binder);
if (!m_pWindowSystem->start())
{
void X11GLESRenderer::stop()
{
m_pWindowSystem->stop();
+ if (m_binder)
+ {
+ delete m_binder;
+ }
}
void X11GLESRenderer::doScreenShot(std::string fileToSave)
, frameCounter(0)
, updateCounter(0)
, drawCounter(0)
+ , m_nativeHandle(0)
, m_pixformat(PIXELFORMAT_UNKNOWN)
, m_layerId(INVALID_ID)
, m_hasNativeContent(false)
, platform(NULL)
, frameCounter(0)
, updateCounter(0)
- , drawCounter(0)
+ , drawCounter(0)
+ , m_nativeHandle(0)
, m_pixformat(PIXELFORMAT_UNKNOWN)
, m_layerId(INVALID_ID)
, m_hasNativeContent(false)
{
delete m_pCommunicatorList;
}
+
+ if (m_pSceneProviderList)
+ {
+ delete m_pSceneProviderList;
+ }
+
+ if (m_pApplicationReferenceMap)
+ {
+ delete m_pApplicationReferenceMap;
+ }
}
uint Layermanager::getLayerTypeCapabilities(const LayerType layertype) const
if (!libraryHandle || dlopen_error)
{
LOG_ERROR("LayerManagerService", "dlopen failed: " << dlopen_error);
+ free(libraryHandle);
return 0;
}
LOG_ERROR("LayerManagerService", "Failed to load shared lib entry point: " << dlsym_error);
}
+ // TODO: free these resources on shutdown
+ //dlclose(libraryHandle);
+ //free(libraryHandle);
+
return createFunction;
}
for (uint dirIndex = 0; dirIndex < gScenePluginDirectoriesCount; ++dirIndex)
{
char directoryName[1024];
- strcpy(directoryName,gPluginLookupPath);
- strcat(directoryName,gScenePluginDirectories[dirIndex]);
+ strncpy(directoryName, gPluginLookupPath, sizeof(directoryName) - 1);
+ strncat(directoryName, gScenePluginDirectories[dirIndex], sizeof(directoryName) - 1 - strlen(directoryName));
LOG_DEBUG("LayerManagerService", "Searching for SceneProviders in: " << directoryName);
getSharedLibrariesFromDirectory(sharedLibraryNameList, directoryName);
}
for (uint dirIndex = 0; dirIndex < gCommunicatorPluginDirectoriesCount; ++dirIndex)
{
char directoryName[1024];
- strcpy(directoryName,gPluginLookupPath);
- strcat(directoryName,gCommunicatorPluginDirectories[dirIndex]);
+ strncpy(directoryName, gPluginLookupPath, sizeof(directoryName) - strlen(directoryName));
+ strncat(directoryName, gCommunicatorPluginDirectories[dirIndex], sizeof(directoryName) -strlen(directoryName));
LOG_DEBUG("LayerManagerService", "Searching for communicator in: " << directoryName);
getSharedLibrariesFromDirectory(sharedLibraryNameList, directoryName);
}
for (uint dirIndex = 0; dirIndex < gRendererPluginDirectoriesCount; ++dirIndex)
{
char directoryName[1024];
- strcpy(directoryName,gPluginLookupPath);
- strcat(directoryName,gRendererPluginDirectories[dirIndex]);
+ strncpy(directoryName, gPluginLookupPath, sizeof(directoryName) - 1);
+ strncat(directoryName, gRendererPluginDirectories[dirIndex], sizeof(directoryName) - 1 - strlen(directoryName));
LOG_DEBUG("LayerManagerService", "Searching for renderer in: " << directoryName);
getSharedLibrariesFromDirectory(sharedLibraryNameList, directoryName);
}
}
// get element count
- int count;
- if ((iss >> count).fail())
+ unsigned int count = 0;
+ iss >> count;
+ if (iss.fail())
{
// failed to parse element count
- LOG_ERROR("Shader Uniform","Fail to parse element count " << count);
+ LOG_ERROR("Shader Uniform","Fail to parse element count.");
return NULL;
}
size_t numValuesExpected = count * m_vectorSizesOfDataTypes[type];
for (size_t i = 0; i < numValuesExpected; i++)
{
- float value;
- if ((iss >> value).fail())
+ float value = 0.0;
+ iss >> value;
+ if (iss.fail())
{
// failed to parse value
LOG_ERROR("Shader Uniform","Fail to parse value " << value);