SDL XRender GSOC 2010 Status Update

Hey.

XRender support is right on schedule. The following things work* now:

  1. Rendering primitives such as points, lines, rectangles, etc.
  2. Support for blending modes for these primitives. Currently
    supported blending modes:
    a. SDL_BLENDMODE_NONE
    b. SDL_BLENDMODE_BLEND
    c. SDL_BLENDMODE_ADD
  3. Preliminary support for rendering textures with scaling. Rendering
    uses SDL_BLENDMODE_BLEND by default. Scaling uses the XRender Nearest
    filter by default which corresponds with SDL_TEXTURESCALEMODE_FAST.

Work that is planned for the coming weeks:

  1. Support SDL_BLENDMODE_MASK and SDL_BLENDMODE_MOD somehow. MASK
    might not be possible due to limitations in XRender.
  2. Add support for these blending modes to texture rendering.
  3. Allow the user to set the texture scaling mode.

Do test out the XRender branch at http://hg.libsdl.org/SDL-gsoc2010_xrender/
Compile all your test programs with -lXrender -lSDL because all
XRender functions aren’t exported yet. See the attached test case and
tell me if it works. :slight_smile:

Thanks.-----------------------------------------------------------------------------

Sunny Sachanandani
BITS Pilani, Pilani Campus
2008B4A7580P

+91-9784313832
+91-9967247780
-------------- next part --------------
A non-text attachment was scrubbed…
Name: test.c
Type: text/x-csrc
Size: 1164 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20100710/d5971f99/attachment.c

Hey, everyone.

It’s been a long time since I last posted about the project. I am
happy to announce that the project is mostly complete. The following
things definitely work now using XRender:

  1. Drawing primitives.
  2. Rendering textures.
  3. Blending for all blending modes except:
    SDL_BLENDMODE_MASK which works like SDL_BLENDMODE_BLEND
    SDL_BLENDMODE_MOD which works only on platforms where component alpha works
    as it stands intel’s UXA driver might be broken for component alpha
  4. Texture scaling with scaling modes.
  5. The testsprite2 example works properly now.

The only issues which remain standing are:

  1. Improving code style and readability.
  2. Proper clean-up of the renderer.

Some things I have planned for after the GSOC period:

  1. Client-side rasterization of primitives.
  2. Adding circles and arcs to the x11 renderer. (the API supports this already)

You can get the code right now at http://hg.libsdl.org/SDL-gsoc2010_xrender/

Any feedback is welcome.

Thanks.-----------------------------------------------------------------------------

Sunny Sachanandani
BITS Pilani, Pilani Campus

+91-9784313832
+91-9967247780

You can also disable XRender on runtime by setting the
SDL_VIDEO_X11_XRENDER environment variable with export
SDL_VIDEO_X11_XRENDER=0

The XRender based renderer also uses XDamage when it’s available. Use
SDL_VIDEO_X11_XDAMAGE to disable that too if you want.-----------------------------------------------------------------------------

Sunny Sachanandani
BITS Pilani, Pilani Campus

+91-9784313832
+91-9967247780

On Wed, Jul 21, 2010 at 6:16 PM, Sunny Sachanandani <@Sunny_Sachanandani> wrote:

Hey, everyone.

It’s been a long time since I last posted about the project. I am
happy to announce that the project is mostly complete. The following
things definitely work now using XRender:

  1. Drawing primitives.
  2. Rendering textures.
  3. Blending for all blending modes except:
    ? ?SDL_BLENDMODE_MASK which works like SDL_BLENDMODE_BLEND
    ? ?SDL_BLENDMODE_MOD which works only on platforms where component alpha works
    ? ?as it stands intel’s UXA driver might be broken for component alpha
  4. Texture scaling with scaling modes.
  5. The testsprite2 example works properly now.

The only issues which remain standing are:

  1. Improving code style and readability.
  2. Proper clean-up of the renderer.

Some things I have planned for after the GSOC period:

  1. Client-side rasterization of primitives.
  2. Adding circles and arcs to the x11 renderer. (the API supports this already)

You can get the code right now at http://hg.libsdl.org/SDL-gsoc2010_xrender/

Any feedback is welcome.

Thanks.

Sunny Sachanandani
BITS Pilani, Pilani Campus

+91-9784313832
+91-9967247780

Very good work!

On a side note, the `software’ renderer is not working for me in your
branch, while it does in SDL hg. The window goes black and the CPU is at
100%.–
Alberto

I can confirm that the software renderer isn’t working. My repository
hasn’t been in sync with SDL hg. It was cloned from SDL hg in mid-May
and the software renderer might not have been working then. Once my
repository is merged with SDL hg (sometime during August) it should be
fine.

Can you confirm that the x11 renderer is working properly for you?
Also tell me what hardware you have and the fps reported by
testsprite2.

Thanks!-----------------------------------------------------------------------------

Sunny Sachanandani
BITS Pilani, Pilani Campus

+91-9784313832
+91-9967247780

On Wed, Jul 21, 2010 at 7:49 PM, Alberto Luaces wrote:

Very good work!

On a side note, the `software’ renderer is not working for me in your
branch, while it does in SDL hg. The window goes black and the CPU is at
100%.


Alberto


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Sunny Sachanandani writes:

I can confirm that the software renderer isn’t working. My repository
hasn’t been in sync with SDL hg. It was cloned from SDL hg in mid-May
and the software renderer might not have been working then. Once my
repository is merged with SDL hg (sometime during August) it should be
fine.

You are right; I tried with revision 4474, from Sun Jun 27 23:17:36 2010
and with today’s trunk, so maybe the problem was addressed between those
dates.

Can you confirm that the x11 renderer is working properly for you?

Yes :wink:

Also tell me what hardware you have and the fps reported by
testsprite2.

Linux 2.6.32-5-amd64 #1 SMP Tue Jun 1 04:34:03 UTC 2010 x86_64 GNU/Linux

OpenGL vendor string: NVIDIA Corporation
OpenGL renderer string: GeForce 9500 GT/PCI/SSE2
OpenGL version string: 3.2.0 NVIDIA 195.36.24

Intel® Core™2 CPU 6300 @ 1.86GHz
cpu MHz : 1596.000

$ ./testsprite2 --info render

[…]

Renderer x11:
Flags: 0x00000042 (PresentCopy | Accelerated)
Blend: 0x0000000F (Mask | Blend | Add | Mod)
Scale: 0x00000000 ()
Texture formats (7): RGB888, YV12, IYUV, YUY2, UYVY, YVYU, ARGB8888
552.20 frames per second–
Alberto

Thanks. BTW, the problem that occured with the software renderer was
my fault. I have fixed it in my repository now. The XRender based
renderer is about 3 times faster than the software based one. Try it
out and post the results if possible.

Thanks again for spotting the bug.-----------------------------------------------------------------------------

Sunny Sachanandani
BITS Pilani, Pilani Campus

+91-9784313832
+91-9967247780

On Wed, Jul 21, 2010 at 8:10 PM, Alberto Luaces wrote:

Sunny Sachanandani writes:

I can confirm that the software renderer isn’t working. My repository
hasn’t been in sync with SDL hg. It was cloned from SDL hg in mid-May
and the software renderer might not have been working then. Once my
repository is merged with SDL hg (sometime during August) it should be
fine.

You are right; I tried with revision 4474, from Sun Jun 27 23:17:36 2010
and with today’s trunk, so maybe the problem was addressed between those
dates.

Can you confirm that the x11 renderer is working properly for you?

Yes :wink:

Also tell me what hardware you have and the fps reported by
testsprite2.

Linux 2.6.32-5-amd64 #1 SMP Tue Jun 1 04:34:03 UTC 2010 x86_64 GNU/Linux

OpenGL vendor string: NVIDIA Corporation
OpenGL renderer string: GeForce 9500 GT/PCI/SSE2
OpenGL version string: 3.2.0 NVIDIA 195.36.24

Intel® Core™2 CPU ? ? ? ? ?6300 ?@ 1.86GHz
cpu MHz ? ? ? ? : 1596.000

$ ./testsprite2 --info render

[…]

?Renderer x11:
? ?Flags: 0x00000042 (PresentCopy | Accelerated)
? ?Blend: 0x0000000F (Mask | Blend | Add | Mod)
? ?Scale: 0x00000000 ()
? ?Texture formats (7): RGB888, YV12, IYUV, YUY2, UYVY, YVYU, ARGB8888
552.20 frames per second


Alberto


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Sunny Sachanandani writes:

Thanks. BTW, the problem that occured with the software renderer was
my fault. I have fixed it in my repository now.

Great, it works now!

The XRender based renderer is about 3 times faster than the software
based one. Try it out and post the results if possible.

Your assumptions are correct on my system:

$ ./testsprite2 --renderer software
221.10 frames per second

$ ./testsprite2 --renderer x11
567.48 frames per second

Regards,–
Alberto

Alberto Luaces writes:

Sunny Sachanandani writes:

Thanks. BTW, the problem that occured with the software renderer was
my fault. I have fixed it in my repository now.

Great, it works now!

The XRender based renderer is about 3 times faster than the software
based one. Try it out and post the results if possible.

Your assumptions are correct on my system:

$ ./testsprite2 --renderer software
221.10 frames per second

$ ./testsprite2 --renderer x11
567.48 frames per second

Ooops! I compiled SDL with -O0, and indeed it makes a difference for the
software renderer when using -O2:

$ ./testsprite2 --renderer software
377.91 frames per second

$ ./testsprite2 --renderer x11
570.29 frames per second–
Alberto