Commit Graph

100 Commits

Author SHA1 Message Date
Zhigang Gong
7aecfa245f glamor-es2: Add --enable-glamor-gles2 to build system.
Now, to build a gles2 version of glamor server, we could
use ./autogen.sh --enable-glamor-ddx --enable-glamor-gles2
Signed-off-by: Zhigang Gong <zhigang.gong@gmail.com>
2011-09-26 16:47:01 +08:00
Zhigang Gong
ee33c947aa glamor-es: Use glVertexAttribPointer to replace glVertexPointer.
As GLES2 doesn't support glVertexPointer.

Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
2011-09-26 16:47:01 +08:00
Zhigang Gong
94d884a198 glamor-es2: Fix some non-es2 functions.
ES2.0 doesn't support QUADS and also doesn't support
some EXT APIs. Fix some of them in this commit.

Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
2011-09-26 16:47:00 +08:00
Zhigang Gong
98f8ef5f99 glamor: Change to use official APIs rather than ARB version function.
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
2011-09-26 16:47:00 +08:00
Zhigang Gong
f961390db6 glamor: Don't need to pad the tile image if pixmap is ni texture.
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
2011-09-26 16:46:36 +08:00
Zhigang Gong
ca36ada041 glamor: Don't always fallback everything when change window attr.
Change the glamor_change_window_attributes's handling. We don't need
to fallback every thing to cpu at the beginning. Only when there
is a real need to change the pixmap's format, we need to do something.
Otherwise, we need do nothing here.

Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
2011-09-26 16:46:35 +08:00
Zhigang Gong
355334fcd9 glamor : Add dynamic texture uploading feature.
Major refactoring.
1. Rewrite the pixmap texture uploading and downloading functions.
   Add some new functions for both the prepare/finish access and
   the new performance feature dynamic texture uploading, which
   could download and upload the current image to/from a private
   texture/fbo. In the uploading or downloading phase, we need to
   handle two things:
   The first is the yInverted option, If it set, then we don't need
   to flip y. If not set, if it is from a dynamic texture uploading
   then we don't need to flip either if the current drawing process
   will flip it latter. If it is from finish_access, then we must
   flip the y axis.

   The second thing is the alpha channel hanlding, if the pixmap's
   format is something like x8a8r8g8, x1r5g5b5 which means it doesn't
   has alpha channel, but it do has those extra bits. Then we need to
   wire those bits to 1.

2. Add almost all the required picture format support.
   This is not as trivial as it looks like. The previous implementation
   only support GL_a8,GL_a8r8g8b8,GL_x8r8g8b8. All the other format,
   we have to fallback to cpu. The reason why we can't simply add those
   other color format is because the exists of picture. one drawable
   pixmap may has one or even more container pictures. The drawable pixmap's
   depth can't map to a specified color format, for example depth 16 can
   mapped to r5g6b5, x1r5g5b5, a1r5g5b5, or even b5g6r5. So we can't get
   get the color format just from the depth value. But the pixmap do not
   has a pict_format element. We have to make a new one in the pixmap
   private data structure. Reroute the CreatePicture to glamor_create_picture
   and then store the picture's format to the pixmap's private structure.

   This is not an ideal solution, as there may be more than one pictures
   refer to the same pixmap. Then we will have trouble. There is an example
   in glamor_composite_with_shader. The source and mask often share the
   same pixmap, but use different picture format. Our current solution is to
   combine those two different picture formats to one which will not lose any
   data. Then change the source's format to this new format and then upload
   the pixmap to texture once. It works. If we fail to find a matched new
   format then we fallback.

   There still is a potential problem, if two pictures refer to the same
   pixmap, and one of them destroy the picture, but the other still remained
   to be used latter. We don't handle that situation currently. To be fixed.

3. Dynamic texture uploading.
   This is a performance feature. Although we don't like the client to hold
   a pixmap data to shared memory and we can't accelerate it. And even worse,
   we may need to fallback all the required pixmaps to cpu memory and then
   process them on CPU. This feature is to mitigate this penalty. When the
   target pixmap has a valid gl fbo attached to it. But the other pixmaps are
   not. Then it will be more efficient to upload the other pixmaps to GPU and
   then do the blitting or rendering on GPU than fallback all the pixmaps to CPU.
   To enable this feature, I experienced a significant performance improvement
   in the Game "Mines" :).

4. Debug facility.
   Modify the debug output mechanism. Now add a new macro:
   glamor_debug_output(_level_, _format_,...) to conditional output some messages
   according to the environment variable GLAMOR_DEBUG. We have the following
   levels currently.
    exports GLAMOR_DEBUG to 3 will enable all the above messages.

5. Changes in pixmap private data structure.
   Add some for the full color format supports and relate it to the pictures which
   already described. Also Add the following new elements:
   gl_fbo - to indicates whether this pixmap is on gpu only.
   gl_tex - to indicates whether the tex is valid and is containing the pixmap's
            image originally.
   As we bring the dynamic pixmap uploading feature, so a cpu memory pixmap may
   also has a valid fbo or tex attached to it. So we will have to use the above
   new element to check it true type.

After this commit, we can pass the rendercheck testing for all the picture formats.
And is much much fater than fallback to cpu when doing rendercheck testing.

Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
2011-09-26 16:46:35 +08:00
Zhigang Gong
d7f8b888d0 glamor: For non-supported fill style fallback to fbFill.
The previous implementation will just skip the rendering
which is not good.

Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
2011-09-26 16:46:35 +08:00
Zhigang Gong
ac0589c916 glamor: Use software fb for 1bpp pixmap.
For 1bpp pixmap, software fb get better performance than
GL surface. The main reason is that fbo doesn't support
1bpp texture as internal format, so we have to translate
a 1bpp bitmap to a 8bit alpha format each time which is
very inefficient. And the previous implementation is
not supported by the latest OpenGL 4.0, the GL_BITMAP
was deprecated.

Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
2011-09-26 16:46:35 +08:00
Zhigang Gong
3c44e3e0ce glamor: Optimize composite when soure/mask is xrgb.
Added a new shader aswizlle_prog to wired the alpha to 1 when
the image color depth is 24 (xrgb). Then we don't need to fallback
the xrgb source/mask to software composite in render phase. Also
don't wire the alpha bit to 1 in the render phase. This can get
about 2x performance gain with the cairo performance trace's
firefox-planet case.

Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
2011-09-26 16:46:35 +08:00
Zhigang Gong
925fc9724f glamor: Optimize glamor_finish_access.
use pbo if possible when we load texture to a temporary tex.
And for the previous direct texture load function, it's not
correct and get removed in this commit.

Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
2011-09-26 16:46:35 +08:00
Zhigang Gong
28835be1b8 glamor: improve glamor_finish_access.
When the platform's coordinate system is the same as X11's . We
can load the texture to the fbo directly without one extra texture
transformation.
2011-09-26 16:46:35 +08:00
Zhigang Gong
1edf0cc6ab glamor: Don't write back read only pixmap to fbo.
For those pixmap which has valid fbo and opened as GLAMOR_ACCESS_RO
mode, we don't need to upload the texture back when calling the
glamor_finish_access(). This will get about 10% performance gain.
2011-09-26 16:46:35 +08:00
Zhigang Gong
1495ba9e64 glamor: Use buffer object as much as possible.
Change the row length of 1bit color depth pixmap to the actual stride.
The previous implementation use the width as its stride which is not
good. As it will waste 8 times of space and also bring some non-unify
code path. With this commit, we can merge those 1bit or other color
depth to almost one code path. And we will use pixel buffer object
as much as possible due to performance issue. By default, some mesa
hardware driver will fallback to software rasterization when use
glReadPixels on a non-buffer-object frame buffer. This change will
get about 4x times performance improvemention when we use y-inverted
glamor or the driver support hardware y-flipped blitting.
2011-09-26 16:46:35 +08:00
Zhigang Gong
8593f22fb8 glamor: glamor_set_alu should enable GL_COLOR_LOGIC_OP.
GL_COLOR_OP seems not supported in current MESA.
2011-09-26 16:46:35 +08:00
Zhigang Gong
c97d4533f2 glamor: Silent compilation warnings due to some deprecated APIs.
those xcalloc/xfree/xalloc/XNFprintf/... are deprecated. Replace
then with the new one. And fix some other minor problems.
2011-09-26 16:46:34 +08:00
Zhigang Gong
eb3487a448 glamor: Add new feature which is to flip output on y axis.
Due to the coordinate system on EGL is different from FBO
object. To support EGL surface well, we add this new feature.
When calling glamor_init from EGL ddx driver, it should use
the new flag GLAMOR_INVERTED_Y_AXIS.
2011-09-26 16:46:34 +08:00
Eric Anholt
be82a06242 glamor: Fix screen_x/screen_y handling for compositing.
It's not an offset from pixmap coords to composited pixmap coords,
it's an offset from screen-relative window drawable coords to
composited pixmap coords.
2011-09-26 16:46:33 +08:00
Eric Anholt
d8c2662bf4 glamor: Set active texture in finishaccess drawing. 2011-09-26 16:46:33 +08:00
Eric Anholt
95d4a5a6ab glamor: Enable fill acceleration and flip opposite for pixmaps too.
Here's my theory for the flipping: It doesn't really matter which
orientation we store the pixmaps if we don't scan them out.  We have
to flip coordinates for the window system framebuffer.  Doing so for
everything else makes things consistent.  I'm not sure how this will
interact with future GLX integration, though.
2011-09-26 16:46:32 +08:00
Eric Anholt
5332547a0a glamor: Fix prepare_access on 1bpp data.
Apparently I don't have anything hitting this path, so I'm not sure if
it's good or not.
2011-09-26 16:46:32 +08:00
Eric Anholt
c3c3a63497 glamor: Use the pixmap stride in fallbacks instead of trying to guess it.
Mostly fixes gnome-terminal text.
2011-09-26 16:46:32 +08:00
Eric Anholt
45de3d24b4 glamor: Replace the glDrawPixels in glamor_finish_access with GLSL.
Root weave displays. \o/
2011-09-26 16:46:32 +08:00
Eric Anholt
b5087ff9b1 glamor: Fix the row length of 1bpp prepare_access. 2011-09-26 16:46:32 +08:00
Eric Anholt
e93070affd glamor: Fix up the access flags for glamor_prepare_access(). 2011-09-26 16:46:32 +08:00
Eric Anholt
55dac9b42e glamor: Add glamor_prepare_access_gc() from UXA. 2011-09-26 16:46:32 +08:00
Eric Anholt
72a757ba00 glamor: Use GL_MESA_pack_invert to avoid complexity in prepare_access. 2011-09-26 16:46:32 +08:00
Eric Anholt
de675893b7 glamor: Add fallbacks for glamor_copy_area(). 2011-09-26 16:46:32 +08:00
Eric Anholt
ca58607a44 glamor: Move glamor_poly_lines to a separate file. 2011-09-26 16:46:32 +08:00
Eric Anholt
c4343dfa0a glamor: Add prepare/finishaccess code based on UXA. 2011-09-26 16:46:32 +08:00
Eric Anholt
1159ebb30b glamor: Add untested copyarea implementation 2011-09-26 16:46:32 +08:00
Eric Anholt
936385142c glamor: Accelerate PolyFillRect using glamor_fill instead of spans. 2011-09-26 16:46:32 +08:00
Eric Anholt
8a53566acb glamor: make the polylines complaint a little more useful. 2011-09-26 16:46:31 +08:00
Eric Anholt
44e4599b83 glamor: Move planemask to a function in case I decide to fill it in. 2011-09-26 16:46:31 +08:00
Eric Anholt
cdb1fe6d96 glamor: Move setspans to a separate file. 2011-09-26 16:46:31 +08:00
Eric Anholt
e3c02c09c1 glamor: Add ALU support to solid, tile, and putimage. 2011-09-26 16:46:31 +08:00
Eric Anholt
2b657d91d8 glamor: Add untested putimage support. 2011-09-26 16:46:31 +08:00
Eric Anholt
f66e5c4145 glamor: Add 8bpp to get/setspans. 2011-09-26 16:46:31 +08:00
Eric Anholt
60ca0260f2 glamor: Add more solid_fail_regions for software fallbacks. 2011-09-26 16:46:31 +08:00
Eric Anholt
16c3b929dd glamor: Add untested support for tile filling. 2011-09-26 16:46:31 +08:00
Eric Anholt
8016135ec7 glamor: Fill out glamor_get_color_4f_from_pixel() a bit. 2011-09-26 16:46:31 +08:00
Eric Anholt
519103565c glamor: Create FBOs for pixmaps. 2011-09-26 16:46:31 +08:00
Eric Anholt
f92d1478e9 glamor: Maybe fix up the format/type for setspans. 2011-09-26 16:46:30 +08:00
Eric Anholt
f1dbed5456 glamor: Move to using shader objects. 2011-09-26 16:46:30 +08:00
Eric Anholt
fbbdd788cb glamor: Fix up DrawPixels arguments to bear some relation to reality. 2011-09-26 16:46:30 +08:00
Eric Anholt
74f262bcdb glamor: remove gratuitous flush. 2011-09-26 16:46:30 +08:00
Eric Anholt
2e35ceca65 ephyr: Use GLEW.
This will hide all sorts of extension stuff from us.
2011-09-26 16:46:30 +08:00
Eric Anholt
df083fab84 glamor: first real attempt at rendering. 2011-09-26 16:46:30 +08:00
Eric Anholt
b530cdea4a glamor: Use a nicer struct initializer for gcops. 2011-09-26 16:46:30 +08:00
Eric Anholt
4d52ae7f2d glamor: Start trying to hook up the rendering bits 2011-09-26 16:46:30 +08:00