Commit Graph

228 Commits

Author SHA1 Message Date
Zhigang Gong cea0fe3e1f fallback_optimize: Prepare for downloading/uploading subregion.
Introduced two function glamor_get_sub_pixmap/glamor_put_sub_pixmap,
can easily used to get and put sub region of a big textured pixmap.
And it can use pbo if possible.

To support download a big textured pixmap's sub region to another
pixmap's pbo, we introduce a new type of pixmap GLAMOR_MEMORY_MAP.
This type of pixmap has a valid devPrivate.ptr pointer, and that
pointer points to a pbo mapped address.

Now, we are ready to refine those
glamor_prepare_access/glamor_finish_access pairs.

Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
2013-12-18 11:23:49 -08:00
Zhigang Gong 3add375065 gles2: Fixed color conversion for the formats except 1555 and 2101010.
This patch fixed two major problems when we do the color convesion with
GLES2.

1. lack of necessary formats in FBO pool.
GLES2 has three different possible texture formats, GL_RGBA,
GL_BGRA and GL_ALPHA. Previous implementation only has one bucket
for all the three formats which may reuse a incorrect texture format
when do the cache lookup. After this fix, we can enable fbo safely
when running with GLES2.

2. Refine the format matching method in
glamor_get_tex_format_type_from_pictformat.
If both revertion and swap_rb are needed, for example use GL_RGBA
to represent PICT_b8g8r8a8. Then the downloading and uploading should
be handled differently.

    The picture's format is PICT_b8g8r8a8,
    Then the expecting color layout is as below (little endian):
    0   1       2       3   : address
    a   r       g       b

    Now the in GLES2 the supported color format is GL_RGBA, type is
    GL_UNSIGNED_TYPE, then we need to shuffle the fragment
    color as :
        frag_color = sample(texture).argb;
    before we use glReadPixel to get it back.

    For the uploading process, the shuffle is a revert shuffle.
    We still use GL_RGBA, GL_UNSIGNED_BYTE to upload the color
    to a texture, then let's see
    0   1       2       3   : address
    a   r       g       b   : correct colors
    R   G       B       A   : GL_RGBA with GL_UNSIGNED_BYTE

    Now we need to shuffle again, the mapping rule is
    r = G, g = B, b = A, a = R. Then the uploading shuffle is as
    below:
        frag_color = sample(texture).gbar;

After this commit, gles2 version can pass render check with all
the formats except those 1555/2101010.

Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
2013-12-18 11:23:49 -08:00
Junyan He ccf5d7f52b Prepare for modification of gradient using shader.
Prepare for modification of gradient using shader. The
 gradient pixmaps now is generated by pixman and we will
 replace them with shader. Add structure fields and
 dispatch functions which will be needed. Some auxiliary
 macro for vertex convert.

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com>

Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
2013-12-18 11:23:49 -08:00
Zhigang Gong 213285f2b8 For DRI swap buffers.
This commit added two APIs to support the DRI swap buffer.
one is glamor_egl_exchange_buffers() which can swap two
pixmaps' underlying KHRimages/fbos/texs. The DDX layer should
exchange the DRM bos to make them consistent to each other.

Another API is glamor_egl_create_textured_screen_ext(), which
extent one more parameters to track the DDX layer's back pixmap
pointer. This is for the triple buffer support. When using triple
buffer, the DDX layer will keep a back pixmap rather then the
front pixmap and the pixmap used by the DRI2 client. And during
the closing screen stage, we have to dereference all the back
pixmap's glamor resources. Thus we have to extent this API to
register it when create new screen.

Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
2013-12-18 11:23:49 -08:00
Chris Wilson 556adfa6b9 Fixup glx support
Renaming glamor_priv->dispatch and wrapping the access to
the dispatch table with a function that also ensured the
context was bound.

 dispatch = glamor_get_dispatch(glamor_priv);
 ...
 glamor_put_dispatch(glamor_priv);

So that we catch all places where we attempt to call into GL withouta
context. As an optimisation we can then do glamor_get_context();
glamor_put_context() around the rendering entry points to reduce the
frequency of having to restore the old context. (Along with allowing
the context to be recursively acquired and making the old context part of
the glamor_egl state.)

Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
2013-12-18 11:23:48 -08:00
Zhigang Gong 430bc16ca0 GLX: Enable glx support.
If we are using MESA as our GL library, then both xserver's
GLX and glamor are link to the same library. As xserver's
GLX has its own _glapi_get/set_context/dispatch etc, and it
is a simplified version derived from mesa thus is not
sufficient for mesa/egl's dri loader which is used by glamor.

Then if glx module is loaded before glamoregl module, the
initialization of mesa/egl/opengl will not be correct, and
will fail at a very early stage, most likely fail to map
the element buffer.

Two methodis to fix this problem, first is to modify the xserver's
glx's glapi.c to fit mesa's requirement. The second is to put
a glamor.conf as below, to the system's xorg.conf path.

Section "Module"
        Load  "glamoregl"
EndSection

Then glamor will be loaded firstly, and the mesa's libglapi.so
will be used. As current xserver's dispatch table is the same
as mesa's, then the glx's dri loader can work without problem.

We took the second method as it don't need any change to xorg.:)
Although this is not a graceful implementation as it depends
on the xserver's dispatch table and the mesa's dispatch table
is the same and the context set and get is using the same method.
Anyway it works.

As by default, xserver will enable GLX_USE_TLS. But mesa will not
enable it, you may need to enable that when build mesa.

Three pre-requirements to make this glamor version work:

0. Make sure xserver has commit 66e603, if not please pull the latest
   master branch.
1. Rebuild mesa by enable GLX_USE_TLS.
2. Put the glamor.conf to your system's xorg.conf path and make sure
   it loaded prior to glx module.

Preliminary testing shows indirect glxgears works fine.

If user want to use GLES2 for glamor by using MESA, GLX will not
work correctly.

If you are not using normal MESA, for example PVR's private GLES
implementation, then it should be ok to use GLES2 glamor and the
GLX should work as expected. In this commit, I use gbm to check
whether we are using MESA or non-mesa. Maybe not the best way.

Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
2013-12-18 11:23:48 -08:00
Zhigang Gong 1ab4002874 Don't call dixSetPrivate directly.
We may change the way to set/get those private data latter.
consolidate to glamor_set_pixmap/screen_private is better
than call those dixSetPrivate directly.

Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
2013-12-18 11:23:48 -08:00
Zhigang Gong bf7d79dc0a Refine CloseScreen and FreeScreen processes.
This commit move the calling to glamor_close_screen from
glamor_egl_free_screen to glamor_egl_close_screen, as this
is the right place to do this.

We should detach screen fbo and destroy the corresponding
KHR image at glamor_egl_close_screen stage. As latter
DDX driver will call DestroyPixmap to destroy screen pixmap,
if the fbo and image are still there but glamor screen private
data pointer has been freed, then it causes segfault.

This commit also introduces a new flag GLAMOR_USE_EGL_SCREEN.
if DDX driver is using EGL layer then should set this bit
when call to glamor_init and then both glamor_close_screen
and glamor_egl_close_screen will be registered correctly,
DDX layer will not need to call these two functions manually.
This way is also the preferred method within Xorg domain.

As interfaces changed, bump the version to 0.3.0.

Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Tested-by: Peng Li <peng.li@intel.com>
2013-12-18 11:23:48 -08:00
Zhigang Gong a1de528c56 glamor_create_fbo: Concentrate the fbo size/depth checking.
Concentrate checking the size/depth when creating fbo. Simply
the pixmap creation and the uploading fbo/texture preparing.

Also slightly change the uploading fbo's preparation. If don't
need fbo, then a fbo only has valid texture should be enough
to return.

Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
2013-12-18 11:23:48 -08:00
Zhigang Gong c244969b33 glamor_init: Should set gl_flavor before sub-module intialization.
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
2013-12-18 11:23:48 -08:00
Zhigang Gong 9c6fd931a6 glamor-fbo-pool: Enable to reuse different size fbo/texture.
Fixup three special cases, one is in tile and the other is in
composite. Both cases are due to repeat texture issue. Maybe
we can refine the shader to recalculate texture coords to
support partial texture's repeating.

The third is when upload a memory pixmap to texture, as now
the texture may not have the exact size as the pixmap, we
should not use the full rect coords.

Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
2013-12-18 11:23:47 -08:00
Zhigang Gong c7e79d6acf glamor-fbo-pool: Implement fbo cache mechanism.
We classify the cache according to the texture's format/width/height.
As openGL doesn't allow us to change a texture's format/width/height
after the internal texture object is already allocated, we can't
just calculate the size and then according ths size to put the
fbo to an bucket which is just like SNA does. We can only put
the fbo to the corresponding format/width/height bucket.

This commit only support the exact size match. The following patch
will remove this restriction, just need to handle the repeat/tile
case when the size is not exactly match.

Should use fls instead of ffs when decide the width/height bucket,
thanks for Chris to point this out.

Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
2013-12-18 11:23:47 -08:00
Zhigang Gong 2ff4100849 glamor_fbo: Introduce glamor fbo to manage all the fb/tex.
This is the first patch to implement a fbo/tex pool mechanism which
is like the sna's BO cache list. We firstly need to decopule the
fbo/tex from each pixmap. The new glamor_pixmap_fbo data
structure is for that purpose. It's somehow independent to each
pixmap and can be reused latter by other pixmaps once it's detached
from the current pixmap.

And this commit also slightly change the way to create a
memory pixmap. We will not create a pixmap private data structure
by default, instead we will crete that structure when a memory
pixmap is attaching a fbo to it.

Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
2013-12-18 11:23:47 -08:00
Zhigang Gong ca2ddd33a1 glamor_set_pixmap_texture/screen_pixmap: Remove useless parameters.
As after we got a texture, no matter the texture is created
on the glamor_create_pixmap or on the egl layer, we all already
know the texture's width and height there. We don't need
to pass them in.

This commit also simply the glamor_egl_create_textured_screen to
reuse the egl_create_textured_pixmap. And also remove the useless
root image from the egl private structure. As now the root image
is bound to the screen image, we don't take care it separately
here. It will be freed at the screen closing.

Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
2013-12-18 11:23:47 -08:00
Zhigang Gong 28fcd7cd01 Rearrange data structure and remove unused fileds.
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
2013-12-18 11:23:47 -08:00
Zhigang Gong bdd72da0c5 Release previous textre/fb when bind a new texture to a pixmap.
As we want to support DRI2 drawable which may create a new textured_drm
to a pre-existing texture_only pixmap, we have to add this logical.

Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Tested-by: He Junyan<junyan.he@linux.intel.com>
2013-12-18 11:23:47 -08:00
Zhigang Gong d7352d57b9 Add glFinish after glFlush.
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
2013-12-18 11:23:47 -08:00
Zhigang Gong 96085017c8 Consolidate the choose of internal texture format to one function.
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
2013-12-18 11:23:47 -08:00
Zhigang Gong 3ba546b699 Code cleanup.
Remove useless code, and after a fbCreatePixmap, we
do not need to modify its header there.

Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
2013-12-18 11:23:46 -08:00
Zhigang Gong 7285f2e836 Make sure the devPrivate.ptr of a textured pixmap is NULL.
Just in case when wrongly fallback to DDX layer and cause
random memory corruption. Pointed out by Chris.

Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
2013-12-18 11:23:46 -08:00
Zhigang Gong 8c7fcefb96 glamor-for-ddx: Exports all rendering/drawing functions.
This commit exports all the rest rendering/drawing functions
to the DDX drivers. And introduce some new pixmap type. For
a pixmap which has a separated texture, we never fallback
it to the DDX layer.

This commit also adds the following new functions:
glamor_composite_rects, glamor_get_image_nf which are needed
by UXA framework. Just a simple wrapper function of miXXX.
Will consider to optimize them next few weeks.

This commit also Fixed a glyphs rendering bug pointed by Chris.

Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
2013-12-18 11:23:46 -08:00
Zhigang Gong e3d16c9ebd Classfy glamor pixmap to different types.
During the integration with intel driver, we introduce two
new type of pixmap, one is TEXTURE_DRM, the other is DRM_ONLY.
TEXTURE_DRM means we create a texture bind to the DRM buffer
successfully. And then the texture and the external BO is
consistent. DRM_ONLY means that we failed to create a texture
from the external DRM BO. We need to handle those different
types carefully, so we have to track them in the data structure.

Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
2013-12-18 11:23:46 -08:00
Zhigang Gong 36d424feae Call glamor_create_pixmap directly in glamor rendering path.
When glamor is rendering pixmaps, and needs to create some
temporary pixmap, it's better to use glamor version create
pixmap directly. As if goes to external DDX's create pixmap,
it may create a external DRM buffer which is not necessary.
All the case within glamor scope is to create a texture only
pixmap or a in memory pixmap.

Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
2013-12-18 11:23:46 -08:00
Zhigang Gong b5480e64ac Override create/destroy picture to track pict format.
When create a piccture, we need to attach a pixmap to it.
A pixmap only has a depth, which is not sufficant for glamor.
As in openGL texture only has a few internal formats which
is not sufficant to represent all the possible picture
format. So we always transform the picture format to GL_RGBA.
And when we need to read back the picture, we must know the
original picture format. So we have to override create
and destroy picture to track a pixmap's real picture format
if it is attached to a picture.

Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
2013-12-18 11:23:46 -08:00
Zhigang Gong 90eaac96ae If caller is not using glamor screen, we can't register
the block handler.

Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
2013-12-18 11:23:46 -08:00
Zhigang Gong b861aad8e2 Initial version.
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
2013-12-18 11:23:46 -08:00
Zhigang Gong fe4c95ce84 glamor: Refine the screen pixmap initialization for Xephyr.
The previous implementation is to override the CreatePixmap
firstly and assume the first call to CreatePixmap must be
screen pixmap. This is not clean. Now Refine it to normal
way. Let the Xephyr to set texture 0 to screen pixmap
during creating screen resources.

Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
2011-09-26 16:47:03 +08:00
Zhigang Gong 937d3bcecf glamor: Correct the version check for GLES2.
If we are using GLES2, then the version number should be no
less than 2.0 rather than no less than 1.3 which is for GL
API.
2011-09-26 16:47:03 +08:00
Zhigang Gong 0dff23d65b glamor: Don't direct call to any gl functions.
Create a new structure glamor_gl_dispatch to hold all the
gl function's pointer and initialize them at run time ,
rather than use them directly. To do this is to avoid
symbol conflicts.

Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
2011-09-26 16:47:02 +08:00
Zhigang Gong f08988455c glamor: Route UnrealizeGlyph to glamor_glyph_unrealize.
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
2011-09-26 16:47:02 +08:00
Zhigang Gong bf4cbbd4e9 glamor: Move glamor_glyphs_init to create screen resources stage.
As in glamor_glyphs_init, we may need to create pixmap. Thus it must
be called after the pixmap resources allocation. Just move it to
screen resource creation stage is good enough for mow.

Also introduce a macro GLAMOR_FOR_XORG to glamor.h. As glamor may
be used by Xephyr which doesn't don't have those xorg header files
and also don't need the egl extension.

Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
2011-09-26 16:47:02 +08:00
Zhigang Gong 5e7fdbb498 glamor: Disable ALPHA8 fbo.
As some platform doesn't support to use ALPHA8 texture as
draw target, we have to disable it. It seems there is no
easy way to check that.

Signed-off-by: Zhigang Gong <zhigang.gong@gmail.com>
2011-09-26 16:47:01 +08:00
Zhigang Gong 172e8cfcd4 glamor: Remove GLEW dependency.
Glamor doesn't need to use GLEW. We can parse the extension by
ourself. This patch also fix the fbo size checking from a hard
coded style to a dynamic checking style.

Signed-off-by: Zhigang Gong <zhigang.gong@gmail.com>
2011-09-26 16:47:01 +08:00
Zhigang Gong d66bd9714e glamor: Concentrate FBO's creation to one function.
And add status checking for it.

Signed-off-by: Zhigang Gong <zhigang.gong@gmail.com>
2011-09-26 16:47:01 +08:00
Zhigang Gong 36a93f62c7 glamor_gles2: Use gl_flavor to determine which version of GL.
Signed-off-by: Zhigang Gong <zhigang.gong@gmail.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 0ef1698be2 glamor: Fix one bug for Xephyr.
Xephyr doesn't has a bounded valid texture. It seems that we can't
load texture 0 directly sometimes. Especially in the copyarea, function
if that is the case, we prefer to use fbo blit to read the screen pixmap
rather than load the bound texture.

Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
2011-09-26 16:47:00 +08:00
Zhigang Gong 9b667ffd56 glamor: Use small internal texture format if possible.
Reduce some texture memory requirement and also save
some bandwidth.

Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
2011-09-26 16:47:00 +08:00
Zhigang Gong 5c4d53c512 glamor: Implement delayed solid filling.
When we need to solid fill an entire pixmap with a specific color,
we do not need to draw it immediately. We can defer it to the
following occasions:

1. The pixmap will be used as source, then we can just use a shader
   to instead of one copyarea.
2. The pixmap will be used as target, then we can do the filling
   just before drawing new pixel onto it. The filling and drawing
   will have the same target texture, we can save one time of
   fbo context switching.

Actually, for the 2nd case, we have opportunity to further optimize
it. We can just fill the untouched region.

By applying this patch, the cairo-trace for the firefox-planet-gnome's
rendering time decrease to 14seconds from 16 seconds.

Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
2011-09-26 16:47:00 +08:00
Zhigang Gong 7fbdc60fd4 glamor: comment out the message when creating a system memory pixmap.
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
2011-09-26 16:46:49 +08:00
Zhigang Gong 33c6c78ae9 glamor: Add one option to force create a cpu memory pixmap.
Some special case we want to get a cpu memory pixmap. For example
to gather a large cpu memory pixmap's block to a small pixmap.

Add pixmap's priviate data's deallocation when destroy a pixmap.

Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
2011-09-26 16:46:36 +08:00
Zhigang Gong 8890b38857 glamor: Don't map the vbo to system memory.
Access mapped vbo address is too slow. And by use system memory
directly, rgb10text/aa10text increases from 980K/1160K to 117K/140K.

Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
2011-09-26 16:46:36 +08:00
Zhigang Gong 489e6c4e6f glamor: Initialize pixmap private's container to correct value.
When calling from ephyr, we forgot to initialize it to the correct
value. Will cause segfault when run Xephyr.

Signed-off-by: Zhigang Gong <zhigang.gong@gmail.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 b60e6cb66d glamor: Silence compilation warnings.
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
2011-09-26 16:46:35 +08:00
Zhigang Gong 229240e565 glamor: Add render triangles support.
By default, fallback to frame buffer currently. This commit
makes us pass the rendercheck's triangles testing.

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 b8ce483f58 glamor: Don't use glamor_pixmap_type currently.
Added comments to glamor_pixmap_create. To be refined in the future.
We need to identify whether a pixmap is a CPU memory pixmap or a
GPU pixmap. Current implementation is not correct. There are three
cases:

1. Too large pixmap, we direct it to CPU memory pixmap.
2. w ==0 ||  h == 0 pixmap, this case has two possibilities:
   2.1 It will become a screen pixmap latter, then it should be
       GPU type.
   2.2 It's a scratch pixmap or created from a share memory, then
       it should belong to CPU memory.

XXX, need to be refined latter.
2011-09-26 16:46:35 +08:00
Zhigang Gong f871d174a8 glamor: Switch to software fb for too large pixmap.
If pixmap's size exceeds the limitation of the MESA library, the
rendering will fail. So we switch to software fb if it is the case.
Add one new element for pixmap private structure to indicate whehter
we are a software fb type or a opengl type.
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
Zhigang Gong 26ff612171 glamor: Resolved merge conflictions with Kristian's glamor-ddx patch. 2011-09-26 16:46:34 +08:00
Zhigang Gong 47b6531273 glamor: Fixed one segfault bug when close screen.
move the original glamor_fini to glamor_close_screen. And wrap the CloseScreen
with glamor_close_screen, Then we can do some thing before call the underlying
CloseScreen().
The root cause is that glamor_fini will be called after the ->CloseScreen().
This may trigger a segmentation fault at
glamor_unrealize_glyph_caches() at calling into FreePicture().
2011-09-26 16:46:34 +08:00
Zhigang Gong b3577a1c85 glamor: Merged with latest xserver.
Merged with latest xserver, the major change is due to the API change of
the management of devPrivates.
2011-09-26 16:46:34 +08:00
Eric Anholt 955ccfbc34 glamor: Fix the segfault at screen fini. 2011-09-26 16:46:34 +08:00
Eric Anholt f4a3194837 glamor: Add the glyph cache from UXA (de-camelCased).
This doesn't yet have an optimized glamor_composite_rects()
implementation, but it does triple the speed of x11perf -aa10text.
2011-09-26 16:46:33 +08:00
Eric Anholt 4f398b29dd glamor: Align stride of fallback pixmap data to 32 bits.
fb/pixman demand this alignment, and all sorts of things go badly otherwise.
Fixes piglit x11-8bpp-7x8-draw.
2011-09-26 16:46:33 +08:00
Eric Anholt 647b9fb49a glamor: Add CopyWindow implementation so it doesn't crash. 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 745502af96 glamor: Add check for EXT_bgra which we rely on. 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 854e9bd20a glamor: Add untested PutImage XYBitmap support. 2011-09-26 16:46:31 +08:00
Eric Anholt aa13306974 glamor: Start adding render acceleration support.
This brings in idr's glu3 code.  We'll probably want to move to linking to
it as a library, once an ABI-stable release is out.
2011-09-26 16:46:31 +08:00
Eric Anholt cfb8dea815 glamor: Hook up miGetImage to fix some invalid accesses. 2011-09-26 16:46:31 +08:00
Eric Anholt 93ad091442 glamor: Add trapezoids code.
This fixes segfaults on starting gnome-terminal.
2011-09-26 16:46:31 +08:00
Eric Anholt f6cffbb2ba glamor: Add stub Composite support. 2011-09-26 16:46:31 +08:00
Eric Anholt 2fa26c4958 glamor: Free resources when destroying pixmaps. 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 519103565c glamor: Create FBOs for pixmaps. 2011-09-26 16:46:31 +08:00
Eric Anholt 4f139db92f glamor: Add getspans implementation. 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 399e006989 glamor: Fix up block/wakeup handler.
Prototypes are fixed, and we don't need to flush on wakeup.
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 1b151f2e6a glamor: glFlush from the blockhandler so rendering happens. 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
Eric Anholt da6e0ffad2 More ephyr/glamor glue. 2011-09-26 16:46:30 +08:00
Eric Anholt 0ec823ce5b Add build infrastructure for glamor. 2011-09-26 16:37:50 +08:00