Commit Graph

72 Commits

Author SHA1 Message Date
Dor Askayo ebf549db2d glamor: make sure the correct FBO is cleared
This also removes an unnecesary call to glDrawBuffer.

Signed-off-by: Dor Askayo <dor.askayo@gmail.com>
Fixes: 0e9a0c20 - "xwayland: clear pixmaps after creation in rootless
                   mode"
Closes: https://gitlab.freedesktop.org/xorg/xserver/issues/933
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
2019-11-22 17:12:03 +01:00
Dor Askayo 0e9a0c203c xwayland: clear pixmaps after creation in rootless mode
When a pixmap is created with a backing FBO, the FBO should be cleared
to avoid rendering uninitialized memory. This could happen when the
pixmap is rendered without being filled in its entirety.

One example is when a top-level window without a background is
resized. The pixmap would be reallocated to prepare for more pixels,
but uninitialized memory would be rendered in the resize offset until
the client sends a frame that fills these additional pixels.

Another example is when a new top-level window is created without a
background. Uninitialized memory would be rendered after the pixmap is
allocated and before the client sends its first frame.

This issue is only apparent in OpenGL implementations that don't zero
the VRAM of allocated buffers by default, such as RadeonSI.

Signed-off-by: Dor Askayo <dor.askayo@gmail.com>
Closes: https://gitlab.freedesktop.org/xorg/xserver/issues/636
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
2019-11-07 12:25:42 +01:00
Eric Anholt 8702c938b3 glamor: Introduce a central place for our pixmap format/type handling.
We had various helper functions trying to come up with the
internalformat/format/type/render formats for pixmaps, and it's much
nicer to just detect what those should be once at startup.  This gives
us a chance to do the right thing for GLES.

It also, notably, fixes our format/type for depth 15 and 16 setup for
desktop GL, so that we actually allocate 16bpp (GL_RGB/565) on most
drivers instead of 32bpp (GL_RGB/UBYTE).

GLES still has regressions over desktop (2 regressions in llvmpipe
XTS, many in rendercheck), but I think this is a good baseline.

Signed-off-by: Eric Anholt <eric@anholt.net>
2019-04-17 19:34:48 +00:00
Eric Anholt c94da112a7 glamor: Plumb the pixmap through fbo creation instead of a "format"
For GLES, we're going to need a lot more logic for picking the
iformat/format/type of texture setup, so we'll want the pixmap's depth
and is_cbcr flag.

Signed-off-by: Eric Anholt <eric@anholt.net>
2019-04-17 19:34:48 +00:00
Eric Anholt 34485be256 glamor: Stop trying to store the pixmap's "format" in glamor_pixmap_fbo.
"format" is a bit of a confused term (internalformat vs GL format),
and all we really needed was "is this GL_RED?"

Signed-off-by: Eric Anholt <eric@anholt.net>
2019-04-17 19:34:48 +00:00
Hawking Zhang 9a416a478c glamor: Add 30bit RGB color format support
Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>

[ Michel Dänzer: Adapt to glamor changes since 1.19 ]

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
2018-01-25 12:21:49 -05:00
Olivier Fourdan 8805a48ed3 glamor: avoid a crash if texture allocation failed
Texture creation in _glamor_create_tex() can fail if a GL_OUT_OF_MEMORY
is raised, in which case the texture returned is zero.

But the texture value is not checked in glamor_create_fbo() and glamor
will abort in glamor_pixmap_ensure_fb() because the fbo->tex is 0:

  Truncated backtrace:
  Thread no. 1 (10 frames)
   #4 glamor_pixmap_ensure_fb at glamor_fbo.c:57
   #5 glamor_create_fbo_from_tex at glamor_fbo.c:112
   #6 glamor_create_fbo at glamor_fbo.c:159
   #7 glamor_create_fbo_array at glamor_fbo.c:210
   #8 glamor_create_pixmap at glamor.c:226
   #9 compNewPixmap at compalloc.c:536
   #10 compAllocPixmap at compalloc.c:605
   #11 compCheckRedirect at compwindow.c:167
   #12 compRealizeWindow at compwindow.c:267
   #13 RealizeTree at window.c:2617

Check the value returned by _glamor_create_tex() in glamor_create_fbo()
and return NULL in the texture is zero.

All callers of glamor_create_fbo() actually check the returned value and
will use a fallback code path if it's NULL.

Please cherry-pick this to active stable branches.

Bugzilla: https://bugzilla.redhat.com/1433305
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2017-03-17 13:17:31 -07:00
Eric Anholt 950ffb8d6f glamor: Remove the FBO cache.
It is a modest performance improvement (2.7% on Intel), with the
significant downside that it keeps extra pixmap contents laying around
for 1000 BlockHandlers without the ability for the system to purge
them when under memory pressure, and tiled renderers don't know that
we could avoid reading their current contents when beginning to render
again.  We could use the FB invalidate functions, but they aren't
always available, aren't hooked up well in Mesa, and would eat into
the performance gains of having the cache.

[ajax: rebased to master]

Reviewed-by: Adam Jackson <ajax@redhat.com>
2016-07-18 15:22:04 -04:00
Keith Packard 181a4bd0cc glamor: Preserve GL_RED bits in R channel when destination is GL_RED [v2]
A1 and A8 pixmaps are usually stored in the Red channel to conform
with more recent GL versions. When using these pixmaps as mask values,
that works great. When using these pixmaps as source values, then the
value we want depends on what the destination looks like.

For RGBA or RGB destinations, then we want to use the Red channel
for A values and leave RGB all set to zero.

For A destinations, then we want to leave the R values in the Red
channel so that they end up in the Red channel of the output.

This patch adds a helper function, glamor_bind_texture, which performs
the glBindTexture call along with setting the swizzle parameter
correctly for the Red channel. The swizzle parameter for the Alpha
channel doesn't depend on the destination as it's safe to leave it
always swizzled from the Red channel.

This fixes incorrect rendering in firefox for this page:

	https://gfycat.com/HoarseCheapAmericankestrel

while not breaking rendering for this page:

	https://feedly.com

v2: Add change accidentally left in patch for missing
    glDisable(GL_COLOR_LOGIC_OP).
    Found by Emil Velikov <emil.l.velikov@gmail.com>

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=63397
Signed-off-by: Keith Packard <keithp@keithp.com>
Tested-by: Michel Dänzer <michel.daenzer@amd.com>
2016-05-26 09:17:59 -07:00
Dave Airlie a288cf58a0 glamor: swizzle RED to 0 for alpha textures
I'm pretty sure Eric suspected this could cause a problem, and we
couldn't find a test. Well loading feedly in firefox seems to trigger
badness that this solves.

bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94554
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Tested-by: Timo Aaltonen <tjaalton@ubuntu.com>
2016-03-16 09:42:54 -04:00
Michel Dänzer 316948734c glamor: Make context current in glamor_pixmap_fbo_cache_put
Without this, we may be manipulating the context of another screen.

In a system with two GPUs using glamor, this fixes lots of

(EE) glamor256: GL error: GL_INVALID_OPERATION in glBindTexture(non-gen name)

spew since 0b4c0c75 ('glamor: Replace "finish access" shader with texture
swizzling').

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
2016-03-11 10:32:22 -05:00
Eric Anholt 0b4c0c75d0 glamor: Replace "finish access" shader with texture swizzling.
For pictures without alpha, and for most other formats for GLES2, we
would make a temporary FBO, make another temporary texture, upload our
GLAMOR_MEMORY pixmap to the texture, then run the "finish access" shader
across it to swizzle its values around into the temporary FBO (which we
would use for a single Render operation and then throw away).

We can simplify everything by using GL_ARB_texture_swizzle (or its
GLES3 counterpart).  It's just not worth the complexity to try to
improve the performance of this already low-performance path (SHM
pixmaps + Render) on GLES2.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2016-03-10 11:12:43 -05:00
Eric Anholt ee7ca670b1 glamor: Make sure that GLAMOR_MEMORY pixmaps don't retain an FBO.
glamor_composite_choose_shader() may upload our scratch pixmaps to get
a Render operation completed.  We don't want to hang onto GL memory
for our scratch pixmaps, since we'll just have to reallocate them at a
new w/h next time around, and the contents will be updated as well.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2016-03-10 11:12:42 -05:00
Keith Packard e6754dcb59 glamor: Use GL_RED instead of GL_ALPHA if we have texture_swizzle (v3)
GL_RED is supported by core profiles while GL_ALPHA is not; use GL_RED
for one channel objects (depth 1 to 8), and then swizzle them into the
alpha channel when used as a mask.

[airlied: updated to master, add swizzle to composited glyphs and xv paths]

v2: consolidate setting swizzle into the texture creation code, it
    should work fine there. Handle swizzle when setting color as well.
v3: Fix drawing to a8 with Render (changes by anholt, reviewed by airlied).

Signed-off-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2016-01-26 12:03:54 -08:00
Eric Anholt 51984dddfc glamor: Delay making pixmaps shareable until we need to.
If a pixmap isn't getting exported as a dmabuf, then we don't need to
make an EGLImage/GBM bo for it.  This should reduce normal pixmap
allocation overhead, and also lets the driver choose non-scanout
formats which may be much higher performance.

On Raspberry Pi, where scanout isn't usable as a texture source, this
improves x11perf -copypixwin100 from about 4300/sec to 5780/sec under
xcompmgr -a, because we no longer need to upload our x11perf window to
a tiled temporary in order to render it to the screen.

v2: Just use pixmap->usage_hint instead of a new field.  Drop the
    changes that started storing gbm_bos in the pixmap priv due to
    lifetime issues.
v3: Fix a missing gbm_bo_destroy() on the pixmap-from-fd success path.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2015-11-18 10:04:44 -08:00
Eric Anholt de959ec939 glamor: Handle GL_OUT_OF_MEMORY when allocating texture images.
The spec allows general undefined behavior when GL_OOM is thrown.  But
if the driver happens to throw the error at this point, it probably
means the pixmap was just too big, so we should delete that texture
and have this pixmap fall back to software.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2015-11-10 13:55:35 -08:00
Eric Anholt ab5aa270c7 glamor: Move cache_format to glamor_fbo.c, where it's used.
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
2015-07-10 09:42:58 -07:00
Eric Anholt a2a2f6e34b glamor: Ask the server to always allocate our private.
This avoids a lot of screwing around to attach our privates later.  It
means that non-glamor pixmaps now gain 120 bytes of glamor privates on
64-bit (which has quite a bit of fixable bloat), and glamor pixmaps
take one less pointer of storage (not counting malloc overhead).

Note that privates start out zero-filled, which matches the callocs we
were doing when making our own privates, and in the case of an fb
pixmap that has a priv where it didn't before, the type ends up being
GLAMOR_MEMORY as we would want.

v2: Clarify that the GLAMOR_MEMORY enum must be 0 (as it was
    previosuly), so that the new pixmap private behavior is as
    expected.  Suggested by keithp.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com> (v1)
Reviewed-by: Keith Packard <keithp@keithp.com>
2015-07-10 09:42:57 -07:00
Eric Anholt 7adb38a0d1 glamor: Fix up some weird formatting in _glamor_create_fbo_array().
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2015-07-02 10:05:59 -07:00
Eric Anholt bfb6a290af glamor: Drop a dead flag to glamor_create_fbo_array().
v2: Don't forget to set priv->block_w/block_h like the wrapper used
    to.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> (v1)
2015-07-02 10:05:59 -07:00
Eric Anholt 33d6384b29 glamor: Drop the dead "PBO" field in an FBO cache struct.
PBOs are only used at the whole pixmap level.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2015-07-02 10:05:59 -07:00
Eric Anholt 1734aa2856 glamor: Remove dead gl_tex flag in the fbo struct.
This used to be used in the old copy_area path.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2015-07-02 10:05:59 -07:00
Dave Airlie ea0e4d752b glamor: add support for allocating linear buffers (v2)
We need this for doing USB offload scenarios using glamor
and modesetting driver.

unfortunately only gbm in mesa 10.6 has support for the
linear API.

v1.1: fix bad define
v2: update the configure.ac test as per amdgpu. (Michel)
set linear bos to external to avoid cache. (Eric)

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2015-06-30 12:17:55 +10:00
Keith Packard e0788a0314 glamor: Eliminate GLAMOR_TEXTURE_LARGE pixmap type
Initialize full pixmap private for all pixmaps, including block
dimensions and counts so that no checks are needed when walking the
fbos.

Signed-off-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Eric Anholt <eric@anholt.net>
2015-03-24 12:43:34 -07:00
Keith Packard cc731ce0ca glamor: Create inline tests for small/large pixmaps
This will let us eliminate the pixmap types shortly

Signed-off-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Eric Anholt <eric@anholt.net>
2015-03-24 12:35:02 -07:00
Keith Packard 020fcc5828 glamor: Eliminate separate 'large' pixmap private structure
Just embed the large elements in the regular pixmap private and
collapse the union to a single struct.

Signed-off-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Eric Anholt <eric@anholt.net>
2015-03-24 12:34:50 -07:00
Keith Packard af687396f1 glamor: Remove screen private and pixmap ptrs from pixmap private and fbo
There's no reason to waste memory storing redundant copies of the same
pointer all over the system; just pass in pointers as necessary to
each function.

Signed-off-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Eric Anholt <eric@anholt.net>
2015-03-24 12:32:46 -07:00
Keith Packard 1eb954c383 glamor: Remove remaining support for FBOs not matching pixmap size
The core rendering code already requires that FBOs be allocated at
exactly the pixmap size so that tiling and stippling work
correctly. Remove the allocation support for that, along with the
render code.

Signed-off-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Eric Anholt <eric@anholt.net>
2015-03-24 12:32:05 -07:00
Keith Packard 28ff815c4b glamor: Eliminate GLAMOR_CREATE_PIXMAP_MAP and GLAMOR_MEMORY_MAP
GLAMOR_MEMORY_MAP was only used with GLAMOR_CREATE_PIXMAP_MAP, and
GLAMOR_CREATE_PIXMAP_MAP doesn't appear to be used anywhere, so just
remove both of them.

v2: Fix a stray whitespace bug that was introduced (change by anholt).

Signed-off-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Eric Anholt <eric@anholt.net>
2015-03-24 12:01:39 -07:00
Maarten Lankhorst 0e1372e1bd glamor: GL_TEXTURE_MAX_LEVEL is not available on GLES2
Remove the calls to GL_TEXTURE_MAX_LEVEL. Setting the filtering is
a sufficient hint to the driver about texture mipmap allocation.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@ubuntu.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2015-03-24 12:01:38 -07:00
Michel Dänzer 11b85ab2fc glamor: Make glamor_purge_fbo static
Only called from glamor_fbo.c now.

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2014-12-25 13:03:10 -08:00
Michel Dänzer c8d4c0a25d glamor: Make glamor_destroy_textured_pixmap idempotent
For robustness against drivers which may call both
glamor_(egl_)destroy_textured_pixmap and glamor_destroy_pixmap.

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
2014-12-11 19:36:31 -08:00
Keith Packard 65cc0982af glamor: Don't insert fbos from external objects into fbo cache
Mark fbos created from external buffers so that when the associated
pixmap is destroyed, they aren't put into the fbo cache for later
re-use and are instead freed immediately.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2014-11-20 14:33:00 -08:00
Markus Wick 3778fab34b glamor: Fix no-mipmap allocations
With GL_TEXTURE_MIN_FILTER, we configure not to use mipmaps, but
there's no real way until GL_ARB_texture_storage to dictate whether
memory should be allocated for mipmap levels or not.

GL_TEXTURE_MAX_LEVEL is a stronger hint to the driver than the
filtering that we really don't want mipmap allocations.  Stops VARM
wasting warnings from the nvidia driver.

Signed-off-by: Markus Wick <markus@selfnet.de>
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2014-06-12 21:24:36 -07:00
Zhigang Gong a4d96afdbd glamor: Fallback to system memory when fail to allocate one big fbo.
Even when create a pixmap which smaller than the max_fbo_size,
it may fail due to some low level driver limitation. If that is
the case, we don't need to crash the xserver. We just need to
fallback to system memory.

See the related bug at:
https://bugs.freedesktop.org/show_bug.cgi?id=71190

Signed-off-by: Zhigang Gong <zhigang.gong@intel.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Tested-by: Kai Wasserbach <kai@dev.carbon-project.org>
Tested-by: Erich Seifert <eseifert@error-reports.org>
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2014-04-23 10:41:19 -07:00
Eric Anholt fab0a4a4c9 glamor: Replace glamor_get/put_context() with just glamor_make_current().
Now that we have the DIX global state for the current context, we
don't need to track nesting to try to reduce MakeCurrent overhead.

v2: Fix a mistaken replacement of a put_context with make_current in
    glamor_fill_spans_gl() (caught by keithp).

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com> (v1)
Reviewed-by: Adam Jackson <ajax@redhat.com> (v1)
2014-04-23 10:32:23 -07:00
Keith Packard c917fa4115 glamor: Always allocate precisely the requested pixmap size
Using a pixmap as a tile or stipple means that we must have the
underlying FBO match the pixmap geometry exactly. We may want to add
some complexity here to migrate pixmaps into exact sized objects as
necessary, but for now, make the server work correctly by skipping
this optimization.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2014-04-17 15:01:26 -07:00
Keith Packard 82f91433e2 glamor: Get testing code using small FBOs working again
Glamor has a mode where pixmaps will be constructed from numerous
small FBOs. This allows testing of the tiled pixmap code without
needing to create huge pixmaps.

However, the render glyph code assumed that it could create a pixmap
large enough for the glyph atlas. Instead of attempting to fix that
(which would be disruptive and not helpful), I've added a new pixmap
creation usage, GLAMOR_CREATE_NO_LARGE which forces allocation of a
single large FBO.

Now that we have pixmaps with varying FBO sizes, I then went around
and fixed the few places using the global FBO max size and replaced
that with the per-pixmap FBO tiling sizes, which were already present
in each large pixmap.

Xephyr has been changed to pass GLAMOR_CREATE_NO_LARGE when it creates
the screen pixmap as it doesn't want to deal with tiling either.

Signed-off-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Eric Anholt <eric@anholt.net>
2014-03-26 12:58:40 -07:00
Eric Anholt f7cd1189d0 glamor: Replace some goofy enum-likes with a real enum.
This unpacks the bitfield into an int size, but my experience has been
that packing bitfields doesn't matter for performance.

v2: Convert more comparisons against numbers or implicit bool
    comparisons to comparisons against the enum names, and fix up some
    comments.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Markus Wick <markus@selfnet.de>
2014-03-17 14:30:51 -07:00
Eric Anholt 781c692cf9 glamor: Rename glamor_get/put_dispatch to glamor_get/put_context.
It used to be the thing that returned your dispatch table and happeend
to set up the context, but now it just sets up the context.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2014-02-14 18:29:56 -08:00
Eric Anholt 0373b3f4f7 glamor: Convert to using libepoxy.
Libepoxy hides all the GL versus GLES2 dispatch handling for us, with
higher performance.

v2: Squash in the later patch to drop the later of two repeated
    glamor_get_dispatch()es instead (caught by keithp)

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2014-02-14 18:28:56 -08:00
Eric Anholt 7f6e865359 glamor: Fix some indent damage of putting a ' ' after the '*' for pointers.
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
2014-01-27 09:30:47 -08:00
Eric Anholt d84d71029a glamor: Apply x-indent.sh.
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
2014-01-27 09:30:47 -08:00
Axel Davy 7cfd9cc232 Add DRI3 support to glamor
This implements some DRI3 helpers to help the DDXs using
glamor to support DRI3.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com>
2013-12-18 11:23:54 -08:00
Zhigang Gong 2925db6616 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>
2013-12-18 11:23:54 -08:00
Zhigang Gong b8f0a21882 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>
2013-12-18 11:23:53 -08:00
Zhigang Gong c1bd50d58d 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>
2013-12-18 11:23:52 -08:00
Zhigang Gong 1e4fc85a71 glamor_fbo: fix a memory leak for large pixmap.
Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
2013-12-18 11:23:52 -08:00
Zhigang Gong e96ea02010 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>
2013-12-18 11:23:51 -08:00
Zhigang Gong ace35e408c 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>
2013-12-18 11:23:51 -08:00