Commit Graph

210 Commits

Author SHA1 Message Date
Louis-Francis Ratté-Boulianne
cef12efc15 glamor: Implement GetSupportedModifiers
Implement function added in DRI3 v1.1.

A newest version of libepoxy (>= 1.4.4) is required as earlier
versions use a problematic version of Khronos
EXT_image_dma_buf_import_modifiers spec.

v4: Only send scanout-supported modifiers if flipping is possible
v5: Fix memory corruption in XWayland (uninitialized pointer)

Signed-off-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2018-03-05 13:27:55 -05:00
Louis-Francis Ratté-Boulianne
c8c276c956 glamor: Implement PixmapFromBuffers and BuffersFromPixmap
It relies on GBM >= 17.1.0 where we can import BO with multiple
planes and a format modifier (GBM_BO_IMPORT_FD_MODIFIER).

v2: Properly free fds in Xwayland

[Also add glamor_egl_ext.h to Makefile.am for distcheck's sake - ajax]

Signed-off-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2018-03-05 13:27:49 -05:00
Mario Kleiner
c326c717c8 glamor: Fix loose ends in color depth 30 support.
This makes it work properly with OpenGL based desktop
compositing, as tested with EGL and GLX based compositing
under OpenGL-2/3, and also artifact free with XRender
based 2D compositing.

Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Antoine Martin <antoine@nagafix.co.uk>
2018-02-27 10:18:06 -05:00
Adam Jackson
66e8eaa456 glamor: Drop the non-VAO rendering path
GLES spells this extension as GL_OES_vertex_array_object, but it is
functionally equivalent to the GL_ARB version. Mesa has supported both
since 9.0, let's go ahead and require it.

Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2017-11-15 09:53:50 -05:00
Adam Jackson
9bd5a198dc glamor: Remove unused glamor_create_screen_resources
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2017-11-07 15:57:57 -05:00
Adam Jackson
081675f7ff glamor: Un-inline glamor_[gs]et_screen_private
text	   data	    bss	    dec	    hex	filename
2134764	  45210	 128704	2308678	 233a46	build/hw/kdrive/ephyr/Xephyr.before
2129972	  45210	 128704	2303886	 23278e	build/hw/kdrive/ephyr/Xephyr.after

Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2017-11-07 15:57:57 -05:00
Adam Jackson
2230e6c8af glamor: Unconditionalize GLAMOR_TEXTURED_LARGE_PIXMAP
Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2017-10-30 13:16:50 -04:00
Adam Jackson
13409b91b1 glamor: Unconditionalize GLAMOR_GRADIENT_SHADER
Effectively always true anyway.

Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2017-10-30 13:16:30 -04:00
Eric Anholt
c66d65a645 glamor: Use GL_MESA_tile_raster_order for overlapping blits.
Improves Raspberry Pi 3 x11perf -copywinwin500 from ~480/sec to
~700/sec.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2017-10-13 17:23:46 -07:00
Eric Anholt
72ddad7a97 glamor: Drop glamor_set_screen_pixmap().
All that was left here was updating the FBO's size.  However, the FBO
size was always set correctly already through
glamor_set_pixmap_texture() from whoever had attached a new BO to the
pixmap.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2017-06-02 17:46:46 -07:00
Eric Anholt
49b12cb736 glamor: Stop tracking the screen_fbo.
This means we no longer get "s" for on-screen drawing in glamor_debug,
and there's only "m" (CPU memory) or "f" (Any GPU memory, aka FBOs).
That seems fine to me.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2017-06-02 17:46:45 -07:00
Olivier Fourdan
f40ff18c96 glamor: Check for NULL pixmap in glamor_get_pixmap_texture()
glamor_create_pixmap() would return a NullPixmap if the given size is
larger than the maximum size of a pixmap.

But glamor_get_pixmap_texture() won't check if the given pixmap is
non-null, leading to a segfault if glamor_create_pixmap() failed.

This can be reproduced by passing Xephyr a very large screen width,
e.g.:

 $ Xephyr -glamor -screen 32768x1024 :10

 (EE)
 (EE) Backtrace:
 (EE) 0: Xephyr (OsSigHandler+0x29)
 (EE) 1: /lib64/libpthread.so.0 (__restore_rt+0x0)
 (EE) 2: Xephyr (glamor_get_pixmap_texture+0x30)
 (EE) 3: Xephyr (ephyr_glamor_create_screen_resources+0xc6)
 (EE) 4: Xephyr (ephyrCreateResources+0x98)
 (EE) 5: Xephyr (dix_main+0x275)
 (EE) 6: /lib64/libc.so.6 (__libc_start_main+0xf1)
 (EE) 7: Xephyr (_start+0x2a)
 (EE) 8: ? (?+0x2a) [0x2a]
 (EE)
 (EE) Segmentation fault at address 0x0
 (EE)
 Fatal server error:
 (EE) Caught signal 11 (Segmentation fault). Server aborting
 (EE)
 Aborted (core dumped)

Bugzilla: https://bugzilla.redhat.com/1431633
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
2017-03-15 15:36:44 -04:00
Olivier Fourdan
f43207c1c4 glamor: restore vfunc handlers on init failure
In glamor_init(), if the minimum requirements are not met, glamor may
fail after setting up its own CloseScreen() and DestroyPixmap()
routines, leading to a crash when either of the two routines is called
if glamor failed to complete its initialization, e.g:

  (EE) Backtrace:
  (EE) 0:  Xwayland (OsSigHandler+0x29)
  (EE) 1: /lib64/libpthread.so.0 (__restore_rt+0x0)
  (EE) 2: Xwayland (glamor_sync_close+0x2a)
  (EE) 3: Xwayland (glamor_close_screen+0x52)
  (EE) 4: Xwayland (CursorCloseScreen+0x88)
  (EE) 5: Xwayland (AnimCurCloseScreen+0xa4)
  (EE) 6: Xwayland (present_close_screen+0x42)
  (EE) 7: Xwayland (dix_main+0x4f9)
  (EE) 8: /lib64/libc.so.6 (__libc_start_main+0xf1)
  (EE) 9:  Xwayland (_start+0x2a)

Restore the previous CloseScreen() and DestroyPixmap() vfunc handlers in
case of failure when checking for the minimum requirements, so that if
any of the requirement is not met we don't leave the CloseScreen() and
DestroyPixmap() from glamor handlers in place.

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1390018

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2016-11-30 09:45:52 +01:00
Eric Anholt
117d614d1b glamor: Require GL_OES_texture_border_clamp for GLES2.
The extension came out in 2000, and all Mesa-supported hardware that
can do glamor supports it.  We were already relying on the ARB version
being present on desktop.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2016-09-29 09:10:53 -07:00
Adam Jackson
fd4a6dc06f glamor: Fall back to software for CopyPlane if we need to
glUniform4ui is available starting in GL{,ES} 3.0. Technically it's
also in EXT_gpu_shader4, but that's not worth supporting. There was also
a MESA_shading_language_130 spec proposed at one point; if that ever
gets finished, we can update epoxy to know about it and fix up the
feature check.

Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2016-09-28 12:52:05 -04:00
Matthieu Herrb
8bb4b11298 glamor: Make glamor_name_from_pixmap work without DRI3
This function is used by the modesetting driver to implement DRI2 and
shouldn't fail on systems that don't support DRI3.

v2: Drop stale commit message wording, fix compiler warning (by anholt)

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Eric Anholt <eric@anholt.net>
2016-09-25 10:59:14 -07:00
Hans de Goede
a74d553cb9 glamor: Add glamor_shareable_fd_from_pixmap()
Add glamor_shareable_fd_from_pixmap function to get dma-buf fds suitable
for sharing across GPUs (not using GPU specific tiling).

This is necessary for the modesetting driver to correctly implement
the DRI2 SharePixmapBacking callback.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
2016-09-13 10:26:21 +02:00
Keith Packard
fb0802113b Remove readmask from screen block/wakeup handler
With no users of the interface needing the readmask anymore, we can
remove it from the argument passed to these functions.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2016-07-18 15:27:51 -04: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
fb1edccf3c dix: Call screen block/wakeup handlers closest to blocking [v3]
The screen block and wakeup handlers are the only ones which provide a
well known ordering between the wrapping layers; placing these as
close as possible to the server blocking provides a way for the driver
to control the flow of execution correctly.

Switch the shadow code to run in the screen block handler so that it
now occurrs just before the server goes to sleep.

Switch glamor to call down to the driver after it has executed its own
block handler piece, in case the driver needs to perform additional
flushing work after glamor has called glFlush.

These changes ensure that the following modules update the screen in
the correct order:

animated cursors        (uses RegisterBlockAndWakeupHandlers dynamically)
composite               (dynamic wrapping)
misprite                (dynamic wrapping)
shadow                  (static wrapping)
glamor                  (static wrapping)
driver                  (static wrapping)

It looks like there's still a bit of confusion between composite and
misprite; if composite updates after misprite, then it's possible
you'd exit the block handler chain with the cursor left hidden. To fix
that, misprite should be wrapping during ScreenInit time and not
unwrapping. And composite might as well join in that fun, just to make
things consistent.

[v2] Unwrap BlockHandler in shadowCloseScreen (ajax)
[v3] ephyr: Use screen block handler for flushing changes

ephyr needs to make sure it calls glXSwapBuffers after glamor finishes
its rendering. As the screen block handler is now called last, we have
to use that instead of a registered block/wakeup handler to make sure
the GL rendering is done before we copy it to the front buffer.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2016-06-20 11:54:57 -07: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
aa4e757130 glamor: add glamor_finish API
Some drivers are calling glFinish, they really should be doing this.

This also is needed for some reverse prime scenarios.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2016-04-29 10:19:17 -04: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
Dave Airlie
564d9f0f8c glamor: add core profile support. (v2)
Glamor works out from the profile if it is
core.

This flag is used to disable quads for rendering.

v1.1: split long line + make whitespace conform (Michel)
v1.2: add GL 3.1 version defines
v2: move to having glamor work out the profile.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2016-01-26 12:04:03 -08: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
Dave Airlie
e7308b6c77 glamor: Add support for CA rendering in a single pass.
It's been on the list to add dual source blending support to avoid the
two pass componentAlpha code.  Radeon has done this for a while in
EXA, so let's add support to bring glamor up to using it.

This adds dual blend to both render and composite glyphs paths.

Initial results show close to doubling of speed of x11perf -rgb10text.

v2: Fix breakage of all of CA acceleration for systems without
    GL_ARB_blend_func_extended.  Add CA support for all the ops we
    support in non-CA mode when blend_func_extended is present.  Clean
    up some comments and formatting.  (changes by anholt)

Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2016-01-26 12:02:42 -08:00
Keith Packard
49aa5e3ea4 glamor: Use vertex array objects
Core contexts require the use of vertex array objects, so switch both glamor
and ephyr/glamor over.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2016-01-21 06:49:40 +10:00
Michel Dänzer
1db6de7b6a glamor: Disable debugging messages other than GL API errors
According to Nicolai Hähnle, the relevant specification says "All
messages are initially enabled unless their assigned severity is
DEBUG_SEVERITY_LOW", so we need to explicitly disable the messages we
don't want to get. Failing that, we were accidentally logging e.g.
shader stats intended for shader-db.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93659
Tested-by: Laurent Carlier <lordheavym@gmail.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2016-01-19 12:48:25 -08:00
Eric Anholt
ff2850424c glamor: Hook up EGL DestroyPixmap through the normal wrap chain.
One less layering violation (EGL should call glamor, if anything, not
the other way around).

v2: Move glamor.c's DestroyPixmap wrapping up above the
    glamor_egl_screen_init() call, since glamor.c's DestroyPixmap
    needs to be the bottom of the stack (it calls fb directly and
    doesn't wrap).  Caught by Michel.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2015-11-18 10:02:15 -08:00
Eric Anholt
e91fd30049 glamor: Unexport glamor_destroy_textured_pixmap().
This is just a bit of the DestroyPixmap chain.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2015-11-18 10:02:15 -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
Emil Velikov
64e6124f27 glamor: move GL_OES_EGL_image check next to EGL_EXT_image_dma_buf_import
We're using the former only as the latter is present. Thus in some cases
we might incorrectly error out if it's missing.

Namely - glamor_glx, glamor_egl without gbm, EGL_KHR_gl_texture_2D_image
or EGL_EXT_image_dma_buf_import.

Fixes 58d54ee82df(glamor: explicitly check for GL_OES_EGL_image)
Cc: Eric Anholt <eric@anholt.net>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Suggested-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2015-09-22 11:11:49 -04:00
Emil Velikov
58d54ee82d glamor: explicitly check for GL_OES_EGL_image
Otherwise we'll fail miserably later on as we try to use
glEGLImageTargetTexture2DOES.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2015-09-17 11:03:15 -04:00
Eric Anholt
ea03e314f9 glamor: Don't try to free the pixmap priv if we fail to allocate FBO.
Fixes a regression since a2a2f6e34b.  I
missed this in testing on x86, because we never fail to allocate an
FBO.  We do hit this path on VC4, though.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Dave Airlie <airlied@redhat.com>
2015-07-29 13:58:54 -07:00
Michel Dänzer
0a458a908e glamor: Make our EGL context current before calling into GL in glamor_init
Without this, the context of another screen may be current, or no context
at all if glamor_egl_init failed for another screen.

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2015-07-27 14:27:21 -07:00
Eric Anholt
8097c88702 glamor: Drop tracking of the last picture attached to pixmaps.
Signed-off-by: Eric Anholt <eric@anholt.net>
Acked-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
80b6652c9f glamor: Drop a bunch of glamor_priv == NULL checks.
Now that it's always non-null when the pixmap is non-null, we don't
need so much of this.  glamor_get_pixmap_private() itself still
accepts a NULL pixmap and returns NULL, because of glamor_render.c

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
2015-07-10 09:42:57 -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
3703c88ac1 glamor: Use GL_ARB_debug_output to log GL errors.
This should help people debugging when glamor does something stupid on
their driver.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2015-07-06 12:01:33 -07:00
Eric Anholt
cad56dc62d glamor: Restore the hook to glamor_composite_rectangles().
It was apparently accidentally dropped in keithp's removal of _nf
functions in 90d326fcc6.

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
0e3f1252da glamor: Avoid using GL_QUADS on VC4.
Improves text rendering from about 284k glyphs per second to 320k
glyphs per second.  There's no GL extension for probing this, because
of the philosophy of "Don't expose whether things are really in
hardware or not."

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Dave Airlie <airlied@redhat.com>
2015-06-29 21:43:36 -07:00
Eric Anholt
4001a7465e glamor: Provide a fallback path for using an index buffer to do quads.
Improves x11perf -aa10text performance by 1377.59% +/- 23.8198% (n=93)
on Intel with GLES2.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Dave Airlie <airlied@redhat.com>
2015-06-29 21:43:35 -07:00
Eric Anholt
e8fc929d4a glamor: Use GL_EXT_map_buffer_range if present.
We were only looking for the desktop GL version of the extension, so
GLES2 missed out.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Dave Airlie <airlied@redhat.com>
2015-06-29 21:43:35 -07:00
Eric Anholt
4fc4cde0ce glamor: Use the normal GL_QUADS drawing helper in the render code.
We use this for all of our other performance-sensitive rendering, too.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Dave Airlie <airlied@redhat.com>
2015-06-29 21:43:35 -07:00
Eric Anholt
c5e6fffbdd glamor: Drop CloseScreen-time GL resource cleanup code.
These will all be freed when the context is freed.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Dave Airlie <airlied@redhat.com>
2015-06-29 21:43:35 -07:00
Eric Anholt
bf7a3bcb00 glamor: Actually allow glyphs of dimension 65 to 128 in the cache.
The cache was trying to allow glyph_max_dim in, but since we were
putting over 64x64 into HW memory, it would end up in the
single-glyph-per-render bail_one path.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2015-06-19 19:10:33 -07:00
Keith Packard
b0d2e01031 glamor: Replace CompositeGlyphs code [v2]
New composite glyphs code uses the updated glamor program
infrastructure to create efficient shaders for drawing render text.

Glyphs are cached in two atlases (one 8-bit, one 32-bit) in a simple
linear fashion. When the atlas fills, it is discarded and a new one
constructed.

v2: Eric Anholt changed the non-GLSL 130 path to use quads instead of
two triangles for a significant performance improvement on hardware
with quads. Someone can fix the GLES quads emulation if they want to
make it faster there.

v3: Eric found more dead code to delete

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2015-05-14 16:32:07 -07:00
Keith Packard
ff3195aadd glamor: Compute GLSL version from GL_SHADING_LANGUAGE_VERSION (v3)
Use code from Piglit project to compute GLSL version for either GL or
GLES. The Piglit code was originally written by Chad Versace.

v2: bail if the parse fails (requested by Eric Anholt)
v3: Use version 1.20 for GLES until we fix our programs (Eric Anholt)

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2015-05-14 15:56:46 -07:00
Olivier Fourdan
4218a1e066 glamor: check max native ALU instructions
When using glamor (either in Xephyr or Xwayland) on hardware with too
low instructions limit, glamor fallbacks to sw due to large shaders.

This makes glamor unbearably slow on such hardware.

Check reported value for GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB
and fail in glamor_init() if the limit is lower than 128.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=88316
Signed-off-by: Olivier Fourdan <ofourdan@redhat.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
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