Fabio Pedretti [Mon, 4 Nov 2013 11:08:42 +0000 (12:08 +0100)]
glamor: remove unused variable
Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Maarten Lankhorst [Wed, 6 Nov 2013 09:25:27 +0000 (10:25 +0100)]
fixup picture in SetWindowPixmap
When creating a window with recordmydesktop running, the following may happen:
create picture 0x1cd457e0, with drawable 0x1327d1f0
(SetWindowPixmap is called)
destroy picture 0x1cd457e0, with drawable 0x1cd65820
Obtaining format for pixmap 0x1327d1f0 and picture 0x1cd457e0
==7989== Invalid read of size 4
==7989== at 0x8CAA0CA: glamor_get_tex_format_type_from_pixmap (glamor_utils.h:1252)
==7989== by 0x8CAD1B7: glamor_download_sub_pixmap_to_cpu (glamor_pixmap.c:1074)
==7989== by 0x8CA8BB7: _glamor_get_image (glamor_getimage.c:66)
==7989== by 0x8CA8D2F: glamor_get_image (glamor_getimage.c:92)
==7989== by 0x29AEF2: miSpriteGetImage (misprite.c:413)
==7989== by 0x1E7674: compGetImage (compinit.c:148)
==7989== by 0x1F5E5B: ProcShmGetImage (shm.c:684)
==7989== by 0x1F686F: ProcShmDispatch (shm.c:1121)
==7989== by 0x15D00D: Dispatch (dispatch.c:432)
==7989== by 0x14C569: main (main.c:298)
==7989== Address 0x1cd457f0 is 16 bytes inside a block of size 120 free'd
==7989== at 0x4C2B60C: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==7989== by 0x228897: FreePicture (picture.c:1477)
==7989== by 0x228B23: PictureDestroyWindow (picture.c:73)
==7989== by 0x234C19: damageDestroyWindow (damage.c:1646)
==7989== by 0x1E92C0: compDestroyWindow (compwindow.c:590)
==7989== by 0x20FF85: DbeDestroyWindow (dbe.c:1389)
==7989== by 0x185D46: FreeWindowResources (window.c:907)
==7989== by 0x1889A7: DeleteWindow (window.c:975)
==7989== by 0x17EBF1: doFreeResource (resource.c:873)
==7989== by 0x17FC1B: FreeClientResources (resource.c:1139)
==7989== by 0x15C4DE: CloseDownClient (dispatch.c:3402)
==7989== by 0x2AB843: CheckConnections (connection.c:1008)
==7989==
(II) fail to get matched format for
dfdfdfdf
The fix is to update the picture pointer when the window pixmap is changed,
so it moves the picture around with the window rather than the pixmap.
This makes FreePicture work correctly.
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=71088
Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Zhigang Gong [Fri, 1 Nov 2013 16:08:11 +0000 (00:08 +0800)]
Fixed an incorrect printf format.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=69573
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Brian Paul [Sat, 19 Oct 2013 22:10:54 +0000 (16:10 -0600)]
Remove useless return statement
Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Brian Paul [Sat, 19 Oct 2013 22:10:53 +0000 (16:10 -0600)]
Remove redundant dispatch->glEnable(GL_TEXTURE_2D)
The same call was already made a few lines earlier.
Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Brian Paul [Sat, 19 Oct 2013 22:10:52 +0000 (16:10 -0600)]
Fix _glamor_set_spans() bug (re-used 'n' variable)
n was used as a function parameter. But inside the for (i=1..n) loop,
n got reassigned as REGION_NUM_RECTS() and then decremented to zero by
the while loop. This caused the for loop to only iterate once instead
of 'n' times.
This patch renames the n parameter to numPoints.
Found by code inspection. Untested.
Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Grigori Goronzy [Tue, 1 Oct 2013 22:37:57 +0000 (00:37 +0200)]
glamor_render: fix PictFilters
Add Fast/Good/Best and appropriately map to Nearest and
Bilinear. Additionally, add a fallback path for unsupported filters.
Notably, this fixes window shadow rendering with Compiz, which uses
PictFilterConvolution for some odd reason.
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Grigori Goronzy [Tue, 1 Oct 2013 22:37:56 +0000 (00:37 +0200)]
Use GL_STATIC_DRAW for element index buffer
The buffer never changes anyway.
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Grigori Goronzy [Tue, 1 Oct 2013 22:37:55 +0000 (00:37 +0200)]
Use glDrawRangeElements instead of glDrawElements
This lets us explicitly specify the range of vertices that are used,
which the OpenGL driver can use for optimization. Particularly,
it results in lower CPU overhead with Mesa-based drivers.
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Zhigang Gong [Thu, 26 Sep 2013 21:25:54 +0000 (05:25 +0800)]
Shoud return null subpixmap if we fail to get a valid map address.
The patch is prepared by Raul Fernandes.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=86693
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Dave Airlie [Mon, 23 Sep 2013 05:42:24 +0000 (06:42 +0100)]
glamor: add initial Xv support
This does YV12 and I420 for now, not sure if we can do packed without
a GL extension.
Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Michel Dänzer [Fri, 20 Sep 2013 08:41:10 +0000 (10:41 +0200)]
Reset traps_count and ptrap when necessary for the next trapezoid cliprect
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=64912
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: He Junyan <junyan.he@inbox.com>
Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Michel Dänzer [Tue, 17 Sep 2013 11:25:02 +0000 (13:25 +0200)]
Fix RegionContainsRect test for PutImage
The return value of RegionContainsRect() is not a boolean but an enum
indicating that the region contains the rectangle completely, partially
or not at all. We can only take the PutImage fastpath when the region
contatins the rectangle completely.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=65964
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Christian König [Mon, 26 Aug 2013 06:57:47 +0000 (14:57 +0800)]
Use GBM_LIBS and GBM_CFLAGS
Signed-off-by: Christian König <christian.koenig at amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer at amd.com>
Armin K [Wed, 13 Mar 2013 17:49:32 +0000 (18:49 +0100)]
First attempt to make libglamor.so shared versioned library
As recommended by Michel in this thread reply:
http://lists.freedesktop.org/archives/glamor/2013-March/000305.html
v2: Correct shared library location in glamor.pc.in
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=62259
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Armin K [Wed, 13 Mar 2013 17:28:58 +0000 (18:28 +0100)]
Properly dist necesary headers
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Armin K [Wed, 13 Mar 2013 17:28:57 +0000 (18:28 +0100)]
Silence Automake 1.13 warnings
warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Michel Dänzer [Wed, 13 Mar 2013 16:15:33 +0000 (17:15 +0100)]
glamoregl: Use xf86ScreenToScrn()
Fixes crashes when glamor is used for a GPU screen with xserver 1.13 or
newer.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=57200#c17
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Dave Airlie [Sat, 29 Dec 2012 06:42:30 +0000 (06:42 +0000)]
glamor_utils: fix unlikely define use
using a define across a split line expression is failure, compiling
with warnings shows this up.
Signed-off-by: Dave Airlie <airlied@redhat.com>
Dave Airlie [Sat, 29 Dec 2012 06:42:10 +0000 (06:42 +0000)]
glamor: add compiler.h
This is also required for distchecking.
Signed-off-by: Dave Airlie <airlied@redhat.com>
Dave Airlie [Sat, 29 Dec 2012 06:28:17 +0000 (06:28 +0000)]
glamor: fix make distcheck part 1
This just adds the headers, then it falls over on the sdk_HEADERS
as it overrides proper install paths by the looks of it.
Signed-off-by: Dave Airlie <airlied@redhat.com>
Zhigang Gong [Tue, 13 Nov 2012 02:08:02 +0000 (10:08 +0800)]
glamor_compositerects: Need to initialize region before fallback.
As we need to call DamageRegionAppend even for fallback path,
we must initialize the region before do that. Pointed by
Igor Vagulin.
https://bugs.freedesktop.org/show_bug.cgi?id=56940
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Michel Dänzer [Wed, 31 Oct 2012 15:56:00 +0000 (16:56 +0100)]
Don't use glBlitFramebufferEXT for overlapping copies.
According to the GL_EXT_framebuffer_blit spec, the result of doing so is
undefined. But we need well-defined results. :)
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Zhigang Gong [Wed, 8 Aug 2012 12:43:38 +0000 (20:43 +0800)]
Increase vbo size to 64K verts.
This commit will benefit vertex stressing cases such as
aa10text/rgb10text, and can get about 15% performance gain.
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Acked-by: Junyan <junyan.he@linux.intel.com>
Zhigang Gong [Wed, 8 Aug 2012 12:11:43 +0000 (20:11 +0800)]
Silence compilation warnings.
After increase to gcc4.7, it reports more warnings, now
fix them.
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Tested-by: Junyan He<junyan.he@linux.intel.com>
Zhigang Gong [Wed, 8 Aug 2012 12:08:12 +0000 (20:08 +0800)]
glamor_largepixmap: Fixed a bug in repeat clipping.
If the repeat direction only has one block, then we need to set the
dx/dy to cover all the extent. This commit also silence some compilation
warnings.
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Michel Dänzer [Tue, 7 Aug 2012 16:16:58 +0000 (18:16 +0200)]
Prefer KHR_surfaceless_context EGL extension over KHR_surfaceless_opengl/gles2.
Current Mesa Git only advertises the former instead of the latter.
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Michel Dänzer [Tue, 7 Aug 2012 16:13:32 +0000 (18:13 +0200)]
Print space between name of missing EGL extension and 'required'.
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Junyan He [Mon, 6 Aug 2012 21:01:59 +0000 (05:01 +0800)]
Fallback to pixman when trapezoid mask is big.
The trapezoid generating speed of the shader is relatively
slower when the trapezoid area is big. We fallback when
the trapezoid's width and height is bigger enough.
The big traps number will also slow down the render because
of the VBO size. We fallback if ntrap > 256
Signed-off-by: Junyan He <junyan.he@linux.intel.com>
Reviewed-By: Zhigang Gong <zhigang.gong@linux.intel.com>
Zhigang Gong [Thu, 2 Aug 2012 10:07:07 +0000 (18:07 +0800)]
glamor_glyphs: When dst arg point to a NULL buffer, dont't flush.
This is a corner case, when we render glyphs via mask cache, and
when we need to upload new glyphs cache, we need to flush both the
mask and dest buffer. But we the dest arg may point to a NULL buffer
at that time, we need to check it firstly. If the dest buffer is NULL.
Then we don't need to flush both the dest and mask buffer.
This commit fix a potential crash.
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Zhigang Gong [Wed, 1 Aug 2012 10:27:29 +0000 (18:27 +0800)]
glamor_trapezoid: workaround a glsl like problem.
It seems that the following statement cann't run as expected on SNB.
bool trap_left_vertical = (abs(trap_left_vertical_f - 1.0) <= 0.0001);
Have to rewrite it to another style to let the vertical edge trapezoid
to be rendered correctly.
Reviewed-by: Junyan He <junyan.he@linux.intel.com>
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Junyan He [Thu, 19 Jul 2012 21:52:57 +0000 (05:52 +0800)]
Fix the problem of VBO leak.
In some cases we allocate the VBO but have no vertex to
emit, which cause the VBO fail to be released. Fix it.
Signed-off-by: Junyan He <junyan.he@linux.intel.com>
Junyan He [Thu, 19 Jul 2012 21:52:50 +0000 (05:52 +0800)]
Just use the shader to generate trapezoid if PolyMode == Imprecise
The precise mode of trapezoid rendering need to sample the trapezoid on
the centre points of an (2*n+1)x(2*n-1) subpixel grid. It is computationally
expensive in shader, and we use inside area ratio to replace it.
The result has some difference, and we just use it if the polymode == Imprecise.
Signed-off-by: Junyan He <junyan.he@linux.intel.com>
Junyan He [Thu, 19 Jul 2012 21:52:43 +0000 (05:52 +0800)]
Change the trapezoid render to use VBO.
Because some uniform variables need to be set for every
trapezoid rendering, we can not use vbo to render multi
trapezoids one time, which have performance big loss.
We now add attributes which contain the same value to bypass
the uniform variable problem. The uniform value for one
trapezoid will be set to the same value to all the vertex
of that trapezoid as an attribute, then in FS, it is still
a constant.
Signed-off-by: Junyan He <junyan.he@linux.intel.com>
Zhigang Gong [Mon, 16 Jul 2012 09:27:22 +0000 (17:27 +0800)]
Added the missed header file for xorg 1.13 compat.
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Zhigang Gong [Mon, 16 Jul 2012 03:25:09 +0000 (11:25 +0800)]
Synch with xorg 1.13 change.
As xorg 1.13 change the scrn interaces and remove those
global arrays. Some API change cause we can't build. Now
fix it.
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Zhigang Gong [Fri, 13 Jul 2012 01:20:02 +0000 (09:20 +0800)]
gles2: Fixed the compilation problem and some bugs.
Previous patch doesn't set the offset to zero for GLESv2
path. Now fix it.
This patch also fix a minor problem in pixmap uploading
preparation. If the revert is not REVERT_NORMAL, then we
don't need to prepare a fbo for it. As current mesa i965
gles2 driver doesn't support to set a A8 texture as a fbo
target, we must fix this problem. As some A1/A8 picture
need to be uploaded, this is the only place a A8 texture
may be attached to a fbo.
This patch also enable the shader gradient for GLESv2.
The reason we disable it before is that some glsl linker
doesn't support link different objects which have cross
reference. Now we don't have that problem.
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Michel Dänzer [Thu, 12 Jul 2012 10:57:06 +0000 (18:57 +0800)]
Stream vertex data to VBOs.
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Michel D=C3=A4nzer [Wed, 11 Jul 2012 07:01:15 +0000 (15:01 +0800)]
Fix translation of clip region for composite fallback.
Fixes incorrectly clipped rendering. E.g. the cursor in Evolution
composer windows became invisible.
Signed-off-by: Michel Daenzer <michel.daenzer@amd.com>
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Zhigang Gong [Wed, 4 Jul 2012 09:59:25 +0000 (17:59 +0800)]
glamor_glyphs: Don't merge extents for different lists.
If we merge all lists's extent together, than we may have
some fail overlap checking. Here is a simple:
A E
B F
C
D
The first list has vertical "ABCD". And the second list
has two char "EF". When detecting E, it can successfully
find it doesn't overlap with previous glyphs. But after
that, the original code will merge the previous extent with
E's extent, then the extent will cover "F", so when detecting
F, it will be treated as overlapped.
We can simply solve this issue by not merge extent from different
list. We can union different list's extent to a global region.
And then do the intersect checkint between that region and
current glyph extent, then we can avoid that fail checking.
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Zhigang Gong [Tue, 3 Jul 2012 10:24:07 +0000 (18:24 +0800)]
glamor_copyarea: Use blitcopy if current state is not render.
Practically, for pure 2D blit, the blit copy is much faster
than textured copy. For the x11perf copywinwin100, it's about
3x faster. But if we have heavy rendering/compositing, then use
textured copy will get much better (>30%)performance for most
of the cases.
So we simply add a data element to track current state. For
rendering state we use textured copy, otherwise, we use blit
copy.
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Zhigang Gong [Tue, 3 Jul 2012 10:11:12 +0000 (18:11 +0800)]
glamor_glyphs: Use cache picture to store mask picture if possible.
By default, mask picture is newly created, and each time we need to
clear the whole mask picture, and then composite glyphs to the mask
picture and then composite the mask picture to destination.
Testing results shows that the filling of the mask picture takes a
big portion of the rendering time. As we don't really need to clear
the whole region, we just need to clear the real overlapped region.
This commit is to solve this issue. We split a large glyphs list to
serval lists and each list is non-overlapped or overlapped.
we can reduce the length of overlapped glyphs to do the glyphs_via_mask
to 2 or 3 glyphs one time for most cases. Thus it give us a case to allocate a
small portion of the corresponding cache directly as the mask picture.
Then we can rendering the glyphs to this mask picture, and latter we
can accumulate the second steps, composite the mask to the dest with
the other non-overlapped glyphs's rendering process.
It also make us implement a batch mask cache blocks clearing
algorithm to avoid too frequently small region clearing.
If there is no any overlapping, this method will not get performance gain.
If there is some overlapping, then this algorithm can get about 15% performance
gain.
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Zhigang Gong [Wed, 27 Jun 2012 04:53:40 +0000 (12:53 +0800)]
glamor_compositerects: Implement optimized version.
Don't call miCompositeRects. Use glamor_composite_clipped_region
to render those boxes at once.
Also add a new function glamor_solid_boxes to fill boxes at once.
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Zhigang Gong [Tue, 26 Jun 2012 12:00:21 +0000 (20:00 +0800)]
optimize: Use likely and unlikely.
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Zhigang Gong [Tue, 26 Jun 2012 11:56:27 +0000 (19:56 +0800)]
create_pixmap: use texture for large glyphs.
As we only cache glyphs smaller than 64x64, we need to use
texutre for the large glyphs.
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Zhigang Gong [Tue, 26 Jun 2012 09:19:16 +0000 (17:19 +0800)]
glamor_copyarea: Fixed a bug introduced by 996194...
Default return value should be FALSE.
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Zhigang Gong [Tue, 26 Jun 2012 08:24:32 +0000 (16:24 +0800)]
glamor_glyphs: Slightly performance tuning.
As glamor_glyphs never fallback, we don't need to keep the
underlying glyphs routines, just override the ps->glys
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Zhigang Gong [Tue, 26 Jun 2012 07:39:24 +0000 (15:39 +0800)]
glamor_render: Don't allocate buffer for vbo each time.
We can reuse the last one if the last one is big enough
to contain current vertext data. In the meantime, Use
MapBufferRange instead of MapBuffer.
Testing shows, this patch brings some benefit for
aa10text/rgb10text. Not too much, but indeed faster.
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Zhigang Gong [Tue, 26 Jun 2012 05:09:05 +0000 (13:09 +0800)]
glamor_largepixmap: Walkaround for large texture's upload.
I met a problem with large texture (larger than 7000x7000)'s
uploading on SNB platform. The map_gtt get back a mapped VA
without error, but write to that virtual address triggers
BUS error. This work around is to avoid that direct uploading.
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Zhigang Gong [Mon, 25 Jun 2012 15:24:37 +0000 (23:24 +0800)]
glamor_render: Optimize the two pass ca rendering.
For the componentAlpha with PictOpOver, we use two pass
rendering to implement it. Previous implementation call
two times the glamor_composite_... independently which is
very inefficient. Now we change the control flow, and do
the two pass internally and avoid duplicate works.
For the x11perf -rgb10text, this optimization can get about
30% improvement.
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Zhigang Gong [Mon, 25 Jun 2012 08:37:22 +0000 (16:37 +0800)]
glamor_composite_glyph: Optimize glyphs with non-solid pattern.
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Zhigang Gong [Thu, 21 Jun 2012 11:30:51 +0000 (19:30 +0800)]
glamor_glyphs: Detect fake or real glyphs overlap.
To split a glyph's extent region to three sub-boxes
as below.
left box 2 x h
center box (w-4) x h
right box 2 x h
Take a simple glyph A as an example:
*
__* *__
*****
* *
~~ ~~
The left box and right boxes are both 2 x 2. The center box
is 2 x 4.
The left box has two bitmaps 0001'b and 0010'b to indicate
the real inked area.
The right box also has two bitmaps 0010'b and 0001'b.
And then we can check the inked area in left and right boxes with
previous glyph. If the direction is from left to right, then we
need to check the previous right bitmap with current left bitmap.
And if we found the center box has overlapped or we overlap with
not only the previous glyph, we will treat it as real overlapped
and will render the glyphs via mask.
If we only intersect with previous glyph on the left/right edge.
Then we further compute the real overlapped bits. We set a loose
check criteria here, if it has less than two pixel overlapping, we
treat it as non-overlapping.
With this patch, The aa10text boost fom 1660000 to 320000.
Almost double the performance! And the cairo test result is the
same as without this patch.
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Zhigang Gong [Thu, 21 Jun 2012 11:29:06 +0000 (19:29 +0800)]
glamor_render: Don't fallback when rendering glyphs with OpOver.
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Zhigang Gong [Thu, 21 Jun 2012 11:27:07 +0000 (19:27 +0800)]
glamor_create_pixmap: Allocate glyphs pixmap in memory.
As we have glyphs atlas cache, we don't need to hold each
glyphs on GPU. And for the subsequent optimization, we need
to store the original glyphs pixmap on system memory.
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Zhigang Gong [Thu, 21 Jun 2012 11:26:28 +0000 (19:26 +0800)]
glamor_fbo: fix a memory leak for large pixmap.
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Junyan He [Fri, 15 Jun 2012 01:00:15 +0000 (09:00 +0800)]
Fix a bug for trapezoid clip
We find in some cases the trapezoid will be render as a triangle and
the left edge and right edge will cross with each other just bellow
the top or over the bottom. The distance between the cross poind and
the top or bottom is less than pixman_fixed_1_minus_e, so after the
fixed converted to int, the cross point has the same value with the
top or botton and the triangle should not be affected. But in our
clip logic, the cross point will be clipped out. So add a logic
to fix this problem.
Signed-off-by: Junyan He <junyan.he@linux.intel.com>
Zhigang Gong [Fri, 15 Jun 2012 05:31:30 +0000 (13:31 +0800)]
gles2_largepixmap: force clip for a non-large pixmap.
One case we need force clip when download/upload a drm_texture
pixmap. Actually, this is only meaningful for testing purpose.
As we may set the max_fbo_size to a very small value, but the
drm texture may exceed this value but the drm texture pixmap
is not largepixmap. This is not a problem with OpenGL. But for
GLES2, we may need to call glamor_es2_pixmap_read_prepare to
create a temporary fbo to do the color conversion. Then we have
to force clip the drm pixmap here to avoid large pixmap handling
at glamor_es2_pixmap_read_prepare.
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Zhigang Gong [Fri, 15 Jun 2012 01:03:42 +0000 (09:03 +0800)]
glamor_emit_composite_vert: Optimize to don't do two times vert coping.
We change some macros to put the vert to the vertex buffer
directly when we cacluating it. This way, we can get about
4% performance gain.
This commit also fixed one RepeatPad bug, when we RepeatPad
a not eaxct size fbo. We need to calculate the edge. The edge
should be 1.0 - half point, not 1.0.
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Zhigang Gong [Fri, 15 Jun 2012 00:46:24 +0000 (08:46 +0800)]
glamor_glyphs: Before get upload to cache flush is needed.
When we can't get a cache hit and have to evict one cache
entry to upload new picture, we need to flush the previous
buffer. Otherwise, we may get corrupt glyphs rendering result.
This is the reason why user-font-proxy may fail sometimes.
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Zhigang Gong [Fri, 15 Jun 2012 00:43:37 +0000 (08:43 +0800)]
copyarea: Cleanup the error handling logic.
Should use ok rather than mixed ok or ret.
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Zhigang Gong [Tue, 12 Jun 2012 10:21:10 +0000 (18:21 +0800)]
trapezoid: Fallback to sw-rasterize for largepixmap.
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Junyan He [Mon, 4 Jun 2012 19:21:03 +0000 (03:21 +0800)]
Use the direct render path for A1
Because when mask depth is 1, there is no Anti-Alias at all,
in this case, the directly render can work well and it is faseter.
Signed-off-by: Junyan He <junyan.he@linux.intel.com>
Junyan He [Sun, 3 Jun 2012 23:52:05 +0000 (07:52 +0800)]
Add the trapezoid direct render logic
We firstly get the render area by clipping the trapezoid
with the clip rect, then split the clipped area into small
triangles and use the composite logic to generate the result
directly. This manner is fast but have the problem that
some implementation of GL do not implement the Anti-Alias
of triangles fill, so the edge sometimes has sawtooth. It is
not acceptable when use trapezoid to approximate circles and
wide lines.
Signed-off-by: Junyan He <junyan.he@linux.intel.com>
Junyan He [Sun, 3 Jun 2012 23:22:27 +0000 (07:22 +0800)]
Modilfy the composite logic to two phases
We seperate the composite to two phases, firstly to
select the shader according to source type and logic
op, setting the right parameters. Then we emit the
vertex array to generate the dest result.
The reason why we do this is that the shader may be
used to composite no only rect, trapezoid and triangle
render function can also use it to render triangles and
polygens. The old function glamor_composite_with_shader
do the whole two phases work and can not match the
new request.
Signed-off-by: Junyan He <junyan.he@linux.intel.com>
Junyan He [Sun, 3 Jun 2012 19:18:40 +0000 (03:18 +0800)]
Add macro of vertex setting for triangle stripe
Add macro of vertex setting for triangle stripe draw,
and make the code clear.
Signed-off-by: Junyan He <junyan.he@linux.intel.com>
RobinHe [Sat, 2 Jun 2012 14:00:09 +0000 (22:00 +0800)]
Use shader to generate the temp trapezoid mask
The old manner of trapezoid render uses pixman to
generate a mask pixmap and upload it to the GPU.
This effect the performance. We now use shader to
generate the temp trapezoid mask to avoid the
uploading of this pixmap.
We implement a anti-alias manner in the shader
according to pixman, which will caculate the area
inside the trapezoid dividing total area for every
pixel and assign it to the alpha value of that pixel.
The pixman use a int-to-fix manner to approximate but
the shader use float, so the result may have some
difference.
Because the array in the shader has optimization problem,
we need to emit the vertex of every trapezoid every
time, which will effect the performance a lot. Need to
improve it.
Signed-off-by: Junyan He <junyan.he@linux.intel.com>
RobinHe [Sat, 2 Jun 2012 13:52:25 +0000 (21:52 +0800)]
Create the file glamor_triangles.c
Create the file glamor_trapezoid.c, extract the logic
relating to trapezoid from glamor_render.c to this file.
Signed-off-by: Junyan He <junyan.he@linux.intel.com>
Zhigang Gong [Mon, 11 Jun 2012 06:02:59 +0000 (14:02 +0800)]
Enable large pixmap by default.
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Zhigang Gong [Mon, 11 Jun 2012 05:05:48 +0000 (13:05 +0800)]
largepixmap: Fix the selfcopy issue.
If the source and destination are the same pixmap/fbo, and we
need to split the copy to small pieces. Then we do need to
consider the sequence of the small pieces when the copy area
has overlaps. This commit take the reverse/upsidedown into
the clipping function, thus it can generate correct sequence
and avoid corruption self copying.
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Zhigang Gong [Mon, 11 Jun 2012 03:42:46 +0000 (11:42 +0800)]
largepixmap: Support self composite for large pixmap.
The simplest way to support large pixmap's self compositing
is to just clone a pixmap private data structure, and change
the fbo and box to point to the correct postions. Don't need
to copy a new box.
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Zhigang Gong [Mon, 11 Jun 2012 01:36:56 +0000 (09:36 +0800)]
largepixmap: Add transform/repeat/reflect/pad support.
This commit implement almost all the needed functions for
the large pixmap support. It's almost complete.
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Zhigang Gong [Sun, 10 Jun 2012 18:27:00 +0000 (02:27 +0800)]
glamor_getimage: should call miGetimage if failed to get sub-image.
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Zhigang Gong [Sun, 10 Jun 2012 18:24:41 +0000 (02:24 +0800)]
glamor_putimage: Correct the wrong stride value.
We should not use the destination pixmap's devkind as the input
image data's stride.
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Zhigang Gong [Sun, 10 Jun 2012 18:15:53 +0000 (02:15 +0800)]
largepixmap: Enable glamor_composite.
Now we start to enable glamor_composite on large pixmap.
We need to do a three layer clipping to split the dest/source/mask
to small pieces. This commit only support non-transformation and
repeat normal case.
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Zhigang Gong [Sun, 10 Jun 2012 17:52:14 +0000 (01:52 +0800)]
largepixmap: Implement infrastructure for large pixmap.
Added infrastructure for largepixmap, this commit implemented:
1. Create/Destroy large pixmap.
2. Upload/Download large pixmap.
3. Implement basic repeat normal support.
3. tile/fill/copyarea large pixmap get supported.
The most complicated part glamor_composite still not implemented.
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Zhigang Gong [Sun, 10 Jun 2012 17:02:30 +0000 (01:02 +0800)]
glamor_largepixmap: first commit for large pixmap.
This is the first commit to add support for large pixmap.
The large here means a pixmap is larger than the texutre's
size limitation thus can't fit into one single texutre.
The previous implementation will simply fallback to use a
in memory pixmap to contain the large pixmap which is
very slow in practice.
The basic idea here is to use an array of texture to hold
the large pixmap. And when we need to get a specific area
of the pixmap, we just need to compute/clip the correct
region and find the corresponding fbo.
We need to implement some auxiliary routines to clip every
rendering operations into small pieces which can fit into
one texture.
The complex part is the transformation/repeat/repeatReflect
and repeat pad and their comination. We will support all of
them step by step.
This commit just add some necessary data structure to represent
the large pixmap, and doesn't change any rendering process.
This commit doesn't add real large pixmap support.
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Junyan He [Tue, 15 May 2012 02:08:03 +0000 (10:08 +0800)]
Fix the problem of x_source and y_source causing radial error
The x_source and y_source cause some problem in
gradient. The old way to handle it by recaulate P1 P2
to minus the x_source and y_source, but this causes
problem in radial shader. Now we modify the manner to
set the texture coordinates: (x_source, y_source) -->
(x_source + width, y_source + height) to handle all the
cases.
Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Signed-off-by: Junyan He <junyan.he@linux.intel.com>
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Junyan He [Tue, 15 May 2012 02:07:55 +0000 (10:07 +0800)]
Fix the problem of vertical and horizontal case error in linear gradient.
1. The vertical and horizontal judgement in linear
gradient have problem when p1 point and p2 point
distance is very small but the gradient pict have a
transform matrix which will convert the X Y coordinates
to small values. So the judgement is not suitable.
Because this judgement's purpose is to assure the
divisor not to be zero, so we simply it to enter
horizontal judgement when p1 and p2's Y is same.
Vertical case is deleted. 2. Delete the unused p1 p2
uniform variable.
Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Signed-off-by: Junyan He <junyan.he@linux.intel.com>
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Junyan He [Tue, 15 May 2012 02:07:46 +0000 (10:07 +0800)]
Fix the problem of set the same stop several times.
Some gradient set the stops at the same position, for
example: firstly 0.5 to red color and then set 0.5 to
blue. This kind of setting will cause the shader work
not correctly because the percentage caculating need to
use the stop[i] - stop[i-1] as dividend. The previous
patch we just kill some stop if the distance between
them is 0. But this cause the problem that the color
for next stop is wrong. We now modify to handle it in
the shader to avoid the 0 as dividend.
Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Signed-off-by: Junyan He <junyan.he@linux.intel.com>
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Junyan He [Tue, 15 May 2012 02:07:35 +0000 (10:07 +0800)]
Fix a bugy macro definition.
The macro like "#define LINEAR_SMALL_STOPS 6 + 2" causes
the problem. When use it to define like "GLfloat
stop_colors_st[LINEAR_SMALL_STOPS*4];" The array is
small than what we supposed it to be. Cause memory
corruption problem and cause the bug of render wrong
result. Fix it.
Signed-off-by: Junyan He <junyan.he@linux.intel.com>
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Junyan He [Tue, 15 May 2012 02:07:24 +0000 (10:07 +0800)]
Extract the gradient related code out.
1. Extract the logic of gradient from the glamor_render.c
to the file glamor_gradient.c.
2. Modify the logic of gradient pixmap gl draw. Use the
logic like composite before, but the gradient always just
have one rect to render, so no need to set the VB and EB,
replace it with just call glDrawArrays. 3.Kill all the
warning in glamor_render.c
Reviewed-by: Zhigang Gong<zhigang.gong@linux.intel.com>
Signed-off-by: Junyan He <junyan.he@linux.intel.com>
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Zhigang Gong [Tue, 15 May 2012 07:25:41 +0000 (15:25 +0800)]
glamor_set_destination_pixmap_priv_nc: set drawable's width x height.
Previous implementation set the whole fbo's width and height as the
viewpoint. This may increase the numerical error as we may only has
a partial region as the valid pixmap. So add a new marco
pixmap_priv_get_dest_scale to get proper scale factor for the
destination pixmap. For the source/mask pixmap, we still need to
consider the whole fbo's size.
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Zhigang Gong [Tue, 15 May 2012 02:52:37 +0000 (10:52 +0800)]
Remove the texture cache code.
Caching texture objects is not necessary based on previous testing.
To keep the code simple, we remove it.
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Zhigang Gong [Tue, 15 May 2012 02:42:41 +0000 (10:42 +0800)]
Added strict warning flags to CFLAGS.
We miss the strict warning flags for a long time, now add it back.
This commit also fixed most of the warnings after enable the strict
flags.
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Zhigang Gong [Sat, 28 Apr 2012 10:23:09 +0000 (18:23 +0800)]
We should not call gradient finalization code if we disable it.
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Zhigang Gong [Sat, 28 Apr 2012 06:55:34 +0000 (14:55 +0800)]
Fixed all unused variables warnings.
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Zhigang Gong [Sat, 28 Apr 2012 06:54:38 +0000 (14:54 +0800)]
Fixed an uninitialized problem at gradient shader functions.
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Zhigang Gong [Sat, 28 Apr 2012 06:51:27 +0000 (14:51 +0800)]
Fixed one typo bug when fixup a mask picture.
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Zhigang Gong [Sat, 28 Apr 2012 06:13:47 +0000 (14:13 +0800)]
Added some copyright and author information.
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Zhigang Gong [Sat, 28 Apr 2012 05:43:39 +0000 (13:43 +0800)]
Added --enable-debug configuration option.
For release version, we disable asserts.
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Zhigang Gong [Sat, 28 Apr 2012 05:42:48 +0000 (13:42 +0800)]
Remove unecessary header file.
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Zhigang Gong [Fri, 27 Apr 2012 07:34:15 +0000 (15:34 +0800)]
glamor_render: Fix the repeat none for GLES2.
As GLES2 doesn't support clamp to the border, we have to
handle it seprately from the normal case.
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Zhigang Gong [Thu, 26 Apr 2012 12:35:09 +0000 (20:35 +0800)]
glamor_blockhandler: Don't do glFinish every time.
To do glfinish every time bring some performance overhead.
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Zhigang Gong [Thu, 26 Apr 2012 11:59:58 +0000 (19:59 +0800)]
glamor_copyarea: Return earlier if have zero nbox.
Almost all callers will check whether the regions is empty
before call to this internal API, but it seems the
glamor_composite_with_copy may call into here with a zero
nbox. A little weird, as the miComputeCompositeRegion return
a Non-NULL, but the region is empty.
Also remove a unecessary glflush.
So let's check it here.
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Zhigang Gong [Thu, 26 Apr 2012 11:57:21 +0000 (19:57 +0800)]
glamor_render: Have to use eaxct size pixmap for transformation.
Use partial texture as the pixmap for the transformation
source/mask may introduce extra errors. have to use
eaxct size.
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Zhigang Gong [Thu, 26 Apr 2012 10:31:07 +0000 (18:31 +0800)]
glamor_fbo: Added a threshold value for the fbo cache pool.
Currently set it to 256MB. If cache pool watermark increases
to this value, then don't push any fbo to this pool, will purge
the fbo directly.
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Zhigang Gong [Thu, 26 Apr 2012 10:28:17 +0000 (18:28 +0800)]
Fixed a1 bug.
It seems that mesa has bugs when uploading bitmap to texture.
We switch to convert bitmap to a8 format and then upload the
a8 texture.
Also added a helper routine to dump 1bpp pixmap.
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Zhigang Gong [Wed, 25 Apr 2012 14:35:12 +0000 (22:35 +0800)]
glamor_render.c: Fixed repeatPad and repeatRelect.
We should use difference calculation for these two repeat mode
when we are a sub region within one texture.
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Zhigang Gong [Wed, 25 Apr 2012 11:50:57 +0000 (19:50 +0800)]
gradient: Don't need fixup flag when creating pixmap.
Gradient can use a larger texture/fbo directly, don't need
an eaxct size texture.
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Zhigang Gong [Wed, 25 Apr 2012 10:58:16 +0000 (18:58 +0800)]
glamor_copyarea: Don't access a DRM only pixmap.
As EGL image/gbm only support ARGB8888 image, we don't support
other format. We may change the way to use gbm directly latter.
But now, we have to face this limitation, and thus if a client
create a 16bpp drawable, and call get texture from pixmap then
a copy to here may occur and thus we have to force retur a TRUE
without do nothing.
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>