Slick2D game flickers on Linux

I have made a game in Slick2D that works just fine in Windows OS. The same can not be said for Linux. The graphics flicker a lot!
This is a major problem to all Linux and probably Mac users.

I am not using any LWJGL calls, so what can be causing this?

Some code:

Starting the game:

			Engine engine = new Engine(title, stage, replay, frame);
			
			AppGameContainer agc = new AppGameContainer(engine, stage.visibleWidth, stage.visibleHeight, false);
			engine.setAppGameContainer(agc);
			agc.setTargetFrameRate(60);
			agc.setShowFPS(false);
			agc.setVSync(true);
			agc.start();

Rendering method:

	@Override
	public void render(GameContainer gc, Graphics g) throws SlickException 
	{
		g.setAntiAlias(AA);
		
		if(state == GameState.PAUSED)
		{
			renderPause(g);
			return;
		}
		if(prevPaused && stage.music != null)
			stage.music.setVolume(Stage.MUSIC_VOLUME);
		prevPaused = false;
		
		if(autoTranslate)
		{
			float focusX = focus.currX + focus.width  /2,
				  focusY = focus.currY + focus.height / 2;
			
			tx = Math.min(stage.width  - stage.visibleWidth,   Math.max(0, focusX - stage.visibleWidth  / 2)); 
			ty = Math.min(stage.height - stage.visibleHeight,  Math.max(0, focusY - stage.visibleHeight / 2));
		}
		
		if(vertSpeed > 0)
			moveVert();
		if(horSpeed > 0)
			moveHor();
		if(scaleSpeed > 0)
			scale();
		
		g.translate(-tx, -ty);
		g.scale(sx, sy);
		g.rotate(rx, ry, ang);		
		
		if(stage.map != null)
			g.drawImage(stage.map, 0,0);
		
		if(stage.background != null)
			stage.background.getObject().draw(0,0);
		
		for(ReplayData rd : ghosts)
		{
			DataImage di = rd.character.getFrame();
			if(rd.character.visible && di != null)
				di.draw(rd.character.currX + rd.character.offsetX, rd.character.currY + rd.character.offsetY);
		}
		
		if(!mainHighPriority)
		{
			DataImage mainImg = main.getFrame();
			if(main.visible && mainImg != null)
				mainImg.draw(main.currX + main.offsetX, main.currY + main.offsetY);
		}
		
		if (state == GameState.DEAD && main.death != null)
		{
			Image img = main.death.getObject();
			img.draw(main.currX + main.offsetX, main.currY + main.offsetY);
		}
		
		for (Enemy enemy : stage.enemies)
			if (enemy.visible)
			{
				if(enemy.particleBehind)
					for(ParticleSystem ps : enemy.particles)
						ps.render(enemy.currX + enemy.partOffsetX, enemy.currY + enemy.partOffsetY);
					
				if(enemy.drawSpecialBehind)
					enemy.drawSpecial(g);

				drawObject(enemy);

				if(!enemy.drawSpecialBehind)
					enemy.drawSpecial(g);
				
				if(!enemy.particleBehind)
					for(ParticleSystem ps : enemy.particles)
						ps.render(enemy.currX + enemy.partOffsetX, enemy.currY + enemy.partOffsetY);
			}
		
		for(GameObject go : stage.stageObjects)
			drawObject(go);
		
		stage.playEffectEvents(g);
		
		if(mainHighPriority)
		{
			DataImage mainImg = main.getFrame();
			if(main.visible && mainImg != null)
				mainImg.draw(main.currX + main.offsetX, main.currY + main.offsetY);
		}

		if(stage.foreground != null)		
			stage.foreground.getObject().draw(0,0);

		g.translate(tx, ty);
		g.rotate(rx, ry, -ang);

		renderStatusBar(g);
		
		if(state == GameState.DEAD)
			renderDeadText(g);
	}

DataImage extends slick Image and only add pixel data for fast pixel-perfect collision.

So why is the game flickering on Linux?

Slick2D is built on top of LWJGL. Every time you call a method in, say, Graphics, Slick makes at least one LWJGL call. Just saying.

I know that. To make Slick2D work correctly, you should not call any LWJGL functions. You should leave it to Slick2D. Otherwise you may get inconsistent behavior.
I am not making any calls to LWJGL, I am leaving that to Slick. So this bug should not occur.

I am considering switching to LibGDX but I am not sure that it will solve this problem.
If it doesn’t, then I am positive that LWJGL 3.0 will. Hopefully, LibGDX will update their framework to make it compatible with the new version.

Flickering might mean unstable FPS, meaning, fps-spikes. I would suggest profiling Your code and find the hotspots and then see what and if You can make things better

I made only one game with slick2d before I got LibGDX. I am not sure what exactly your flickering problem is. But as I remember I have some weird choppiness and flickering problem on my windows machine.

Bumping this.

Alright, I have just ported my game to LibGDX. Works great in Windows.
But guess how it looks in Linux. Its flickering! How is that even possible? My games flickers in Linux on both frame Slick2D AND LibGDX!!! >_>

What is causing this? Really.

I want to note that the only things that are flickering is animated entities.

Probably bad graphics drivers.

No. The very same flickering issue exists on other computers as well.

You were doing this on an actual Linux system, and not a VM, right?

Have you checked you have the latest and correct drivers installed?