Commit Graph

961 Commits

Author SHA1 Message Date
Emil Velikov e12e02b2e6 glamor: use the lowercase xnf.*alloc API
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Olivier Fourdan <ofourdan@redhat.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-09-06 08:57:06 +10:00
Eric Anholt 27500ee82e glamor: Scissor Render composite operations to the bounds of the drawing.
Unlike the previous two fixes, this one introduces new GL calls and
statechanges of the scissor.  However, given that our Render drawing
already does CPU side transformation and inefficient box upload, this
shouldn't be a limiting factor for Render acceleration.

Surprisingly, it improves x11perf -comppixwin10 -repeat 1 -reps 10000
on i965 by 3.21191% +/- 1.79977% (n=50).

v2: Make the jump to the exit land after scissor disable.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2017-08-14 12:37:37 -07:00
Eric Anholt e6ab3b1109 glamor: Scissor CopyArea to the bounds of the drawing.
Like the previous fix to rectangles, this reduces the area drawn on
tiled renderers by letting the CPU-side tile setup know what tiles
might be drawn at all.

Surprisingly, it improves x11perf -copypixwin1 -repeat 1 -reps 10000
on i965 by 2.93185% +/- 1.5561% (n=90).

v2: Drop extra glamor_bounds_union_box() from previous debugging
    (caught by Mark Marshall).

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Keith Packard <keithp@keithp.com> (v1)
2017-08-14 12:36:35 -07:00
Eric Anholt 60cc7e367a glamor: Scissor rectangle drawing to the bounds of the rects.
Scissors provide a critical hint to tiled renderers as to what tiles
need to be load/stored because they could be modified by the
rendering.

The bounds calculation here is limited to when we have a small number
of rects (large enough to cover rounded window corners, but probably
not xeyes) to avoid overhead on desktop GL.

No performance difference on i965 with x11perf -rect1 -repeat 1 -reps
10000 (n=50)

v2: Clamp rectangle bounds addition.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2017-08-14 12:35:55 -07:00
Emil Velikov 05a4396f08 glamor: update "required EGL extensions" comment
The extensions listed have not been needed in a while. Replace with the
only remaining requirement.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
2017-07-05 10:15:32 -04:00
Emil Velikov 06419a5b17 glamor: remove no longer needed KHR_gl_texture_2D_image requirement
The code that needed it was introduced with commit 7cfd9cc232 ("Add
DRI3 support to glamor") back in 2013. And was nuked a couple of years
ago with commit 51984dddfc ("glamor: Delay making pixmaps shareable
until we need to.")

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2017-06-29 08:48:25 -07:00
Keith Packard c86fc56b10 glamor: Clarify variable names in glamor_copy_cpu_fbo
This function creates a temporary pixmap to hold data being moved from
the source to the destination. However, it labeled all of the
variables associated with this as src_, which makes it confusing to
read the code. Rename them tmp_ instead. Also fix the comment
describing the function to note that it copies from CPU to GPU, not
GPU to GPU.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2017-06-12 20:15:49 -07:00
Michel Dänzer ffda82ed04 glamor: Fix temporary pixmap coordinate offsets
The previous values happened to work in basic cases, but not in general
if the destination is a subwindow or has a border.

Fixes crash with xli, which moves a large subwindow inside a smaller
parent window for scrolling.

No regressions with xterm, x11perf -copyplane or the xscreensaver
phosphor hack.

Bug: https://bugs.debian.org/857983
Reviewed-by: Keith Packard <keithp@keithp.com>
2017-06-13 11:13:22 +09:00
Michel Dänzer 7c88977d33 glamor: Store the actual EGL/GLX context pointer in lastGLContext
Fixes subtle breakage which could sometimes trigger after a server reset
with multiple screens using glamor:

Screen A enters glamor_close_screen last and calls various cleanup
functions, which at some point call glamor_make_current to make sure
screen A's GL context is current. This sets lastGLContext to screen A's
&glamor_priv->ctx. Finally, glamor_close_screen calls
glamor_release_screen_priv, which calls free(glamor_priv).

Later, screen B enters glamor_init, which allocates a new glamor_priv.
With bad luck, this can return the same pointer which was previously
used for screen A's glamor_priv. So when screen B's glamor_init calls
glamor_make_current, lastGLContext == &glamor_priv->ctx, so MakeCurrent
isn't called for screen B's GL context, and the following OpenGL API
calls triggered by glamor_init mess up screen A's GL context.

The observed end result of this was a crash in glamor_get_vbo_space
because glamor_priv->vbo didn't match the GL context, though there might
be other possible outcomes.

Assigning the actual GL context pointer to lastGLContext prevents this
by preventing the false negative test in glamor_make_current.

Reviewed-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2017-06-05 18:32:15 +09:00
Eric Anholt 87db150d8a glamor: Remove the "delayed fallback" code.
The usage of this died with the old core rendering code.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2017-06-02 17:46:48 -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
Eric Anholt fd0d2523a3 glamor_egl: Stop saving the EGL major/minor version.
We don't use them for anything.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2017-06-02 17:46:01 -07:00
Eric Anholt d0675e96f1 glamor_egl: Drop glamor_egl_create_textured_screen_ext().
The function hasn't been doing anything useful since keithp's resource
freeing fixes in 2014.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2017-05-18 11:33:41 -04:00
Eric Anholt c36f56808f glamor_egl: Automatically choose a GLES2 context if desktop GL fails.
GLES2 support has been requested multiple times, and we've had this
code laying around trying to implement it.  The GLES2 implementation
is not quite there yet (some pixel transfer failures), but it
shouldn't take much fixing at this point.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2017-05-18 11:33:38 -04:00
Eric Anholt f6bf5f1c74 glamor_egl: Remove check for KHR_surfaceless_context_*
Those extensions don't exist.  There's only surfaceless_context.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
2017-05-18 11:33:35 -04:00
Eric Anholt 6e793ae085 glamor_egl: Drop warning about indirect GLX and GLES2.
Indirect GLX uses its own context and doesn't care what glamor is
using.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2017-05-18 11:33:32 -04:00
Eric Anholt 59de50d6ef glamor_egl: Avoid flink names in glamor_egl_create_textured_pixmap().
Using flink is banned on render nodes, and they needlessly expose our
screen pixmap contents to any authenticated client.  This also
incidentally drops the dependency on EGL_MESA_drm_image.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2017-05-18 11:33:26 -04:00
Eric Anholt 5d6f17d913 glamor_egl: Drop dead "cpp" field
It's been unused since the initial import.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2017-05-18 11:33:24 -04:00
Eric Anholt 37618e810b glamor_egl: Drop dead gl_context_depth.
This was replaced in 4afe15d8bf, but not
deleted.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2017-05-18 11:33:21 -04:00
Eric Anholt a6a751e5d8 glamor_egl: Drop unnecessary check for KHR_gl_renderbuffer_image.
I couldn't find it being used anywhere in the history of the code.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2017-05-18 11:33:18 -04:00
Eric Anholt 40a153ee45 glamor_egl: Always require the gbm-based image import path.
This has been associated with dri3 for now, but we need to use it
elsewhere in order to avoid flink.  The extensions have been
implemented for long enough that I couldn't find when it was that we
turned them on.  Oddly, we already required renderbuffer import
support, which is basically as hard to implement as texture import.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
Acked-by: Daniel Stone <daniels@collabora.com>
2017-05-18 11:33:09 -04:00
Eric Anholt b1b71b7a8b glamor_egl: Drop the has_gem flag.
We're using GBM, so we know we've got GEM.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2017-05-18 11:33:07 -04:00
Eric Anholt 5102ea38eb glamor_egl: Unifdef GLAMOR_HAS_GBM.
We only build this code with GBM, and supporting non-GBM well would be
invasive.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2017-05-18 11:33:03 -04:00
Eric Anholt 5064153c79 glamor_egl: Print a useful identifying string on initialization.
The EGL version is not used anywhere in the glamor code, so it's not
interesting.  And when saying that we've started using GL
acceleration, it's nice to know what GL we're actually using.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2017-05-18 11:32:59 -04:00
Eric Anholt 1549e30372 Add a Meson build system alongside autotools.
This is a work in progress that builds Xvfb, Xephyr, Xwayland, Xnest,
and Xdmx so far.  The outline of Xquartz/Xwin support is in tree, but
hasn't been built yet.  The unit tests are also not done.

The intent is to build this as a complete replacement for the
autotools system, then eventually replace autotools.  meson is faster
to generate the build, faster to run the bulid, shorter to write the
build files in, and less error-prone than autotools.

v2: Fix indentation nits, move version declaration to project(), use
    existing meson_options for version-config.h's vendor name/web.

Signed-off-by: Eric Anholt <eric@anholt.net>
Acked-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-04-26 15:25:27 -07:00
Eric Anholt c7be7a688a Use #ifdef instead of #if for features to make Meson easier.
We mostly use #ifdef throughout the tree, and this lets the generated
config.h files just be #define TOKEN instead of #define TOKEN 1.

Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2017-04-26 17:30:12 -04:00
Olivier Fourdan 7bfb87a213 glamor: an FBO is not needed for Xv pixmaps
It appears that on some hardware/diver combo such as nv30/nouveau, using
GL_ALPHA as format for 8-bit depth will cause an incomplete attachment
error (GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT) when trying to bind the
texture.

As a result, the FBO is NULL and glamor segfaults when trying to access
the FBO width/height in pixmap_priv_get_scale() in glamor_xv_render().

This happens with glamor-xv which uses 8-bit pixmaps, meaning that on
such hardware/driver, trying to play a video using Xv will lead to a
crash of the Xserver. This affects Xwayland, Xephyr, modesetting driver
with glamor accel.

But the use of an FBO is not actually needed for glamox-xv, so by
disabling FBO at pixmap creation, we can avoid the issue entirely.

Fix suggested by Eric Anholt <eric@anholt.net>

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=100710
Fixes: https://bugzilla.redhat.com/1412814
Reviewed-by: Eric Anholt <eric@anholt.net>
2017-04-21 11:53:13 -07:00
Eric Anholt 266af991c8 glamor: Fix some formatting that confused the unifdef command.
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2017-03-23 13:17:42 -04:00
Adam Jackson 1ad2306823 glamor: Avoid software fallback for planemasked ZPixmap GetImage
Same trick as in fb: just do a normal GetImage and deal with the
planemask on the CPU if you have to. Since the software fallback hit for
glamor is pretty brutal, this is a much more impressive win for glamor
than it was for fb:

  11100.0  87700.0 (7.901) (copy 0xaaaaaaaa) ShmGetImage 10x10 square
   9840.0  47800.0 (4.858) (copy 0xaaaaaaaa) ShmGetImage 100x100 square
   1550.0   4240.0 (2.735) (copy 0xaaaaaaaa) ShmGetImage 500x500 square
   9450.0  78900.0 (8.349) (0xaaaaaaaa) GetImage 10x10 square
   6910.0  30900.0 (4.472) (0xaaaaaaaa) GetImage 100x100 square
    431.0   2020.0 (4.687) (0xaaaaaaaa) GetImage 500x500 square

Measured with Xephyr -glamor on Skylake GT3e.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2017-03-20 13:48:40 -04: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
Adam Jackson 0803918e64 fb: Remove 24bpp support (v3)
v2:
- Require power-of-two bpp in ScreenInit
- Eliminate fbCreatePixmapBpp

v3
- Squash in the exa and glamor changes so we can remove pRotatedPixmap
  in the same stroke.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Adam Jackson <ajax@redhat.com>
2017-03-17 15:14:42 -04:00
Eric Anholt fe0b297420 glamor: Fix dashed line rendering.
We were binding the screen pixmap as the dash and sampling its alpha,
which is usually just 1.0 (no dashing at all).

Please cherry-pick this to active stable branches.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2017-03-16 11:30:58 -07:00
Olivier Fourdan 455051a0f1 glamor: Check glamor_set_destination_drawable() return value
Check the value returned by glamor_set_destination_drawable() and use
the fallback code path where possible.

Bugzilla: https://bugzilla.redhat.com/1417575
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
2017-03-15 15:41:13 -04:00
Olivier Fourdan 04b4bad7c0 glamor: glamor_set_destination_drawable() can fail
The fbo_array of a given glamor pixmap can be NULL in some cases, as
glamor_create_fbo_array() can fail to allocate the FBO array.

If this is the case, glamor_pixmap_fbo_at() will return NULL even though
the box index is valid, and glamor_set_destination_drawable() simply
assumes glamor_pixmap_fbo_at() will return an FBO prior to pass the
value to glamor_set_destination_pixmap_fbo(), which will segfault.

We need a way for glamor_set_destination_drawable() to fail safely and
let the caller know about the failure.

Add a boolean return value to glamor_set_destination_drawable() for that
purpose.

Bugzilla: https://bugzilla.redhat.com/1417575
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
2017-03-15 15:41:12 -04: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
Michel Dänzer 0c1574d988 glamor: Fix typo: "vec2_pos" -> "vec2 pos"
Fixes crash when trying to use dashed lines:

 Failed to compile VS: 0:8(2): error: `vec2_pos' undeclared

Trivial.

Fixes: 	d8161aeb50 ("glamor: Fix missing declaration in dash vertex
                       shader")
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99943
2017-03-09 18:13:31 +09:00
Qiang Yu 9232835bd1 glamor: use drmGetDeviceNameFromFD2 when available
This is for glamor can support fd from DRM render node which is useful
for a render only DDX.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Qiang Yu <Qiang.Yu@amd.com>
2017-03-07 16:00:27 -05:00
Dr.-Ing. Dieter Jurzitza d8161aeb50 glamor: Fix missing declaration in dash vertex shader
Fixes a GLSL compilation error:

Failed to compile VS: 0:13(43): error: `pos' undeclared
0:13(14): error: operands to arithmetic operators must be numeric
0:13(13): error: operands to arithmetic operators must be numeric

Tested-by: Stefan Dirsch <sndirsch@suse.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2017-02-23 12:57:26 -05:00
Olivier Fourdan 8646398136 glamor: Two pass won't work on memory pixmaps
When selecting "CA_TWO_PASS" in glamor_composite_clipped_region() when
the hardware does not support "GL_ARB_blend_func_extended", we call
glamor_composite_choose_shader() twice in a row, which in turn calls
glamor_pixmap_ensure_fbo().

On memory pixmaps, the first call will set the FBO and the second one
will fail an assertion in glamor_upload_picture_to_texture() because
the FBO is already set.

Bail out earlier when the mask pixmap is in memory and the hardware
capabilities would require to use two pass, so that the assertion is not
failed and the rendering is correct.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99346
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2017-01-24 11:27:33 -08:00
Adam Jackson 29a4f3db60 glamor: Squash unused variable warning
Accidentally introduced in 05e19644.

Signed-off-by: Adam Jackson <ajax@redhat.com>
2017-01-02 15:38:45 -05:00
Hans De Goede 05e1964425 glamor: Trust eglGetPlatformDisplayEXT if it exists
If the libEGL we are using has eglGetPlatformDisplayEXT, yet it still
returns NULL, then this very likely means that it does not support the
type (e.g. EGL_PLATFORM_GBM_MESA) passed in, and then returning NULL is
the right thing to do.

This avoids falling back to an eglGetDisplay() implementation which does
not understands the passed in gbm handle, treats it as a pointer to
something else completely, followed by a crash sooner or later.

Specifically this fixes using the nvidia binary driver, with nvidia's
libEGL + the modesetting driver on a secondary GPU crashing inside
glamor_egl_init() sometimes.

Cc: Eric Anholt <eric@anholt.net>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2017-01-02 13:07:25 -05: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
Emil Velikov 7fc96fb02d glamor: don't look for non-existing EGL_KHR_platform_base
The extension does not exist in the registry, thus needs to know they're
using EGL 1.5 in order to determine the eglGetPlatformDisplay function
pointer is valid.

Thus brings us into some lovely circular dependency.

Since mesa won't be able (in the foreseeable future) to export the KHR
flavour of extension (another way one could assume that EGL 1.5 is
available) just drop all the heuristics and use the
EGL_EXT_platform_base extension.

In practise (checked with the Mali driver) any EGL 1.5 driver will
advertise support for EGL_EXT_platform_base.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2016-10-25 13:04:48 -04:00
Adam Jackson f4a4115547 glamor: Use eglGetPlatformDisplay{,EXT} if we can
eglGetDisplay forces the implementation to guess which kind of display
it's been handed. glvnd does something different from Mesa, and in
general it's impossible for the library to get this right. Add a new
inline that gets the logic right, and works around a quirk in epoxy.

Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2016-10-05 16:03:13 -04:00
Olivier Fourdan 1c2fcb9548 glamor: Fix pixmap offset for bitplane in glamor_copy_fbo_cpu
Commit cba28d5 - "glamor: Handle bitplane in glamor_copy_fbo_cpu"
introduced a regression as the computed pixmap offset would not match
the actual coordinates and write data elsewhere in memory causing a
segfault in fbBltOne().

Translate the pixmap coordinates so that the data is read and written at
the correct location.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97974
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-and-Tested-by: Michel Dänzer <michel.daenzer@amd.com>
2016-10-05 13:57:13 -04:00
Mark Yao c9b8ce7392 glamor: spans: fixup wrong count on glDrawArrays
In commit 9e9fcf5 (glamor: Add a helper function for the common
GL_QUADS fallback pattern.), the glDrawArrays count change was
accidentally changed to nbox.

Fixes xlogo with MESA_GL_VERSION_OVERRIDE=2.1 and
MESA_GLSL_VERSION_OVERRIDE=120

Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2016-09-30 08:46:03 -07:00
Eric Anholt 2aca2dadda glamor: Fix link failure on GLES2.
Current Mesa requires that the precision qualifier on uniforms matches
between stages, even if (as in this case) the uniform isn't used in
one of the stages.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2016-09-29 09:11:12 -07:00
Eric Anholt 20fcdfcf39 glamor: Remove #if 0-ed picture dumping code.
I don't think anybody has run this code since it was pulled into the
server.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2016-09-29 09:11:11 -07:00
Eric Anholt 4b5326aeba glamor: Remove many unused glamor util functions.
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2016-09-29 09:11:09 -07: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
Eric Anholt 453f813bb4 glamor: Properly handle mask formats without alpha.
Even if the pixmap's storage has alpha, it may have been uploaded with
garbage in the alpha channel, so we need to force the shader to set
alpha to 1.  This was broken way back in
355334fcd9.

Fixes rendercheck -t composite -f x8r8g8b8.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2016-09-26 10:16:06 -07:00
Eric Anholt 905c877f09 glamor: Require that pixmap depths match for Render copies.
The copy optimization in d37329cba4
replicated a bug from last time we did a copy optimization: CopyArea
is only defined for matching depths.  This is only a problem at 15 vs
16 depth right now (24 vs 32 would also have matching Render formats,
but they should work) but be strict in case we store other depths
differently in the future.

Fixes rendercheck -t blend -o src -f x4r4g4b4,x3r4g4b4

v2: Drop excessive src->depth == dst->depth check that snuck in.
v3: Switch back to src->depth == dst->depth
v4: Touch up commit message (s/bpp/depth).

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2016-09-26 10:15:58 -07:00
Eric Anholt b87a075674 glamor: Fix some awful formatting of some fallback debug code.
This was clearly x-indent.sh damage.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2016-09-26 10:15:38 -07:00
Mark Kettenis ba199cb901 glamor: Make glamor_sync_init work with --disable-xshmfence
Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-09-25 11:00:24 -07: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
Eric Engestrom 128d40b2dd glamor: fix spelling mistakes
v2: Fix "orignal" too (review feedback by ajax, change by anholt)_

Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Eric Anholt <eric@anholt.net>
2016-09-25 10:40:08 -07:00
Hans de Goede 3fe4107643 glamor: Fix crash when master gpu is using glamor and another gpu is hotplugged
When a GPU gets hotplugged while X is already running, glamor_egl_init()
gets called and changes the current egl context, without updating
lastGLContext, potentially causing the next glamor call on another GPU to
run in the wrong context.

This causes glamor to e.g. crash in the next glamor_create_pixmap() call
(called through the master's screen->CreatePixmap), note this is not the
only troublesome entry point I've seen other backtraces when using a
compositing window manager.

Set lastGLContext to NULL to force the next glamor_make_current() call
to set the right context.

Note that we cannot use glamor_make_current() here to replace the
eglMakeCurrent() call and update lastGLContext for us because
glamor_make_current takes a glamor_priv struct as argument and that
has not been created yet when glamor_egl_init() gets called.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
2016-09-13 10:26:35 +02: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
Michel Dänzer be334f42a1 glamor: Declare "pos" in the composite glyph GLSL 1.20 vertex shader
Fixes shader compile failure:

 Failed to compile VS: 0:13(43): error: `pos' undeclared
0:13(14): error: operands to arithmetic operators must be numeric
0:13(13): error: operands to arithmetic operators must be numeric

 Program source:
#define ATLAS_DIM_INV 0.000976562500000000
attribute vec2 primitive;
attribute vec2 source;
varying vec2 glyph_pos;
uniform vec2 fill_offset;
uniform vec2 fill_size_inv;
varying vec2 fill_pos;
uniform vec4 v_matrix;
void main() {
       gl_Position.xy = primitive.xy * v_matrix.xz + v_matrix.yw;
       gl_Position.zw = vec2(0.0,1.0);
       glyph_pos = source.xy * ATLAS_DIM_INV;
       fill_pos = (fill_offset + primitive.xy + pos) * fill_size_inv;
}
 (EE) Fatal server error:
 (EE) GLSL compile failure

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97300
Reviewed-by: Keith Packard <keithp@keithp.com>
2016-08-23 12:59:55 +09:00
Michel Dänzer cba28d572a glamor: Handle bitplane in glamor_copy_fbo_cpu
This can significantly speed up at least some CopyPlane cases, e.g.
indirectly for stippled fills.

v2:
* Make temporary pixmap the same size as the destination pixmap
  (instead of the destination drawable size), and fix coordinate
  parameters passed to fbCopyXtoX and glamor_upload_boxes. Fixes
  incorrect rendering with x11perf -copyplane* and crashes with the
  xscreensaver phosphor hack.
v3:
* Make the change a bit more compact and hopefully more readable by
  re-using the existing src_* locals in the bitplane case as well.

Reported-by: Keith Raghubar <keith.raghubar@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Acked-by: Eric Anholt <eric@anholt.net>
2016-08-22 10:15:32 +09: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
Keith Packard 05a793f5b3 dix: Switch to the libXfont2 API (v2)
This new libXfont API eliminates exposing internal X server symbols to
the font library, replacing those with a struct full of the entire API
needed to use that library.

v2: Use libXfont2 instead of libXfont_2

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2016-07-18 15:25:59 -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
Michel Dänzer e8e36755ab glamor: Translate solid text background region after clipping
Fixes incorrect clipping for redirected windows which don't happen to be
located at the top left corner of the screen.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=96742
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2016-07-15 12:59:43 -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 2d6230e773 glamor: Use DestroyPixmap instead of FreePicture for glyph atlas pixmap
Nice of FreePicture to take a void * instead of a PicturPtr so that
this error wasn't caught by the compiler.

Noticed when resetting the X server left a dangling pixmap around.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2016-06-14 22:47:00 -07:00
Michel Dänzer d798b8318a glamor: Call eglBindAPI after eglInitialize
Current Mesa Git master checks that the EGL display actually supports
the API passed to eglBindAPI, which can only succeed after
eglInitialize.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=96344
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
2016-06-08 11:51:04 -04:00
Michel Dänzer 5ff75da317 glamor: Cannot use copies when accessing outside of composite source
Commit b64108fa ("glamor: Check for composite operations which are
equivalent to copies") failed to copy conditions from exaComposite which
ensure that the composite operation doesn't access outside of the source
picture.

This fixes rendercheck regressions from the commit above.

Reviewed-by: Keith Packard <keithp@keithp.com>
2016-05-30 17:49:32 +09:00
Keith Packard 8b9b4387e8 glamor: Adjust for drawable x/y in composite's copy optimization
Patch b64108fa30 added a short cut that
identifies composite operations that can be performed with a simple
copy instead.

glamor_copy works in absolute coordinates, so the dx and dy values
passed in need to be converted from drawable-relative to absolute by
adding the drawable x/y values.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-05-27 13:24:39 -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
Keith Packard b07bc700b3 glamor: glamor_make_current sooner in glamor_composite_with_shader
glamor_make_current is supposed to be called before any GL APIs.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2016-05-26 09:17:59 -07:00
Keith Packard 743b6f231e glamor: Disable logic ops when doing compositing [v4]
If the logic op gets left enabled, it overrides the blending
operation, causing incorrect contents on the display.

v2: Disable only on non-ES2, but disable even for PictOpSrc

v3: Found another place this is needed in
    glamor_composite_set_shader_blend

v4: Remove change dependent on new glamor_set_composite_texture
    API. This belongs in a different patch.
    Found by Emil Velikov <emil.l.velikov@gmail.com>

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2016-05-26 09:17:59 -07:00
Michel Dänzer b64108fa30 glamor: Check for composite operations which are equivalent to copies
Increases x11perf -compwinwin500 numbers by a factor of 10 for me with
radeonsi.

Conditions copied from exaComposite().

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-05-25 11:10:14 -04:00
Michel Dänzer 4711ebc174 glamor: Fix sampling outside of RGBx source/mask pictures
RENDER requires that sampling outside of any source/mask picture results
in alpha == 0.0.

The OpenGL border colour cannot set alpha = 0.0 if the texture format
doesn't have an alpha channel, so we have to use the RepeatFix handling
in that case.

Also, only force alpha = 1.0 when sampling inside of RGBx source/mask
pictures.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94514
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-05-25 11:09:09 -04: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
Olivier Fourdan 8437955515 glamor: fix wrong offset on composite rectangles
When using PictOpSrc, the destination is wrongly shifted back to (0, 0).

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94568
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
2016-04-15 16:31:36 -04: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 b0cc04992c glamor: Drop dead large-pixmap handling code in temp picture uploads.
The glamor_pixmap_ensure_fbo() in glamor_pixmap_upload_prepare() will
always fail on a large pixmap, so we can just be explicit about
bailing out here and then dump the rest of this garbage.

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 094b1bea8b glamor: Drop unused PBO code in temporary picture uploading.
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 6112fecc3a glamor: Generalize the a1-to-a8 conversion path.
Pixman is quite qualified to allocate our temporary memory, and all we
need to do is decide what formats to convert from and to.

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 8f1411c384 glamor: Drop the REVERT_UPLOADING_1_5_5_5 path.
There was only a pretty special case that could have even worked --
you've got a GLES2 renderer, you've got a SHM pixmap, it's 1555 (not
the usual 565 for 16-bit), and you're little endian (BE was broken,
since GL's 5_5_5_1 picks the 1 bit from the lowest bit of the short,
and on BE we weren't doing the conversion path that swaps around the
channels).  This is just not worth the complexity.

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 2cc7a0815e glamor: Drop the GLES2 REVERT_UPLOADING_2_10_10_10 paths.
These just smash your 2_10_10_10 data into 8888, despite what the
comments said.  That's not valid rendering, so just ditch this path
and fall back to software.  One might also note in the code being
removed here that the REVERT_UPLOADING_10_10_10_2 path wasn't even
connected.

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 f667d51770 glamor: Merge the two GL-type-from-pictformat paths.
It clarifies what the difference is between the two paths, and would
potentially encourage us to handle GLES extensions that expose
additional types.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2016-03-10 11:12:42 -05:00
Eric Anholt c7574c63c6 glamor: Propagate that is_upload is always true.
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2016-03-10 11:12:42 -05:00
Eric Anholt 1bed5ef2b8 glamor: Drop dead fbo handling from GLAMOR_MEMORY pict uploads.
The previous commit asserts that we don't have one.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2016-03-10 11:12:42 -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
Eric Anholt a96c6d4658 glamor: Simplify temporary picture uploading call stack.
glamor_upload_sub_pixmap_to_texture() only had the one caller, so we
can merge it in, fix its silly return value, and propagate a bunch of
constants.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
2016-03-10 11:12:42 -05:00
Olivier Fourdan 25ce263fd8 glamor: do not build Xv support when --disable-xv
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
2016-03-09 14:03:06 -05:00
Michel Dänzer a3e681eafa glamor: Source pictures are always depth 32
We were using the destination pixmap depth to determine the source
picture format.

Fixes incorrect text rendering with some MATE desktop GTK3 themes.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94246
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
2016-03-08 15:17:19 -05:00
Michel Dänzer b05ae79ee3 glamor: Factor out glamor_set_color_depth from glamor_set_color
The former takes explicit screen and depth parameters instead of
deriving them from a pixmap.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
2016-03-08 15:17:16 -05:00
Hans de Goede 947e94a341 glamor: Fix XvPutImage when src_y != 0
We already take src_y into account when uploading the src data by
starting at the top line of the src data when uploading.

Adjust src_y accordingly when rendering.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2016-03-08 13:05:38 -05:00
Eric Anholt 2c3e876844 glamor: Flip around conditionals in RepeatNone fixups.
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2016-01-29 18:52:41 -08:00
Eric Anholt e82c8c81df glamor: Cut down a bunch of conditional handling for RepeatFix.
For hardware that doesn't do actual jumps for conditionals (i915,
current vc4 driver), this reduces the number of texture fetches
performed (assuming the driver isn't really smart about noticing that
the same sampler is used on each side of an if just with different
coordinates).

No performance difference on i965 with x11perf -magpixwin100 (n=40).
Improves -magpixwin100 by 12.9174% +/- 0.405272% (n=5) on vc4.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2016-01-29 18:52:41 -08:00
Eric Anholt 2c3273861c glamor: Clarify how the repeat values being passed around work.
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2016-01-29 18:52:41 -08:00
Eric Anholt 990a8ee013 glamor: Clean up formatting of RepeatFix shader code.
All sorts of weird indentation, and some cuddled conditional
statements deep in the if tree.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2016-01-29 18:52:41 -08:00
Eric Anholt 20cb5b2d65 glamor: Clarify some logic in RepeatFix handling.
wh ratios are != 1.0 only when large, so with that we can simplify
down how we end up with RepeatFix being used.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2016-01-29 18:52:41 -08:00
Eric Anholt 07f0d90e4a glamor: Simplify the pixmap box looping.
We had a double loop across h and w, and passed the current x and y
out to callers who then used w to multiply/add to an index.  Instead,
just single loop across w * h.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2016-01-29 18:13:09 -08:00
Eric Anholt 0dbce65b08 glamor: Reuse the glamor_program_alpha_* enums for Render.
This is a step toward using glamor_program.c for Render acceleration.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2016-01-29 18:13:07 -08:00
Eric Anholt 9b676786de glamor: Drop extra SHADER_IN type for no mask present.
We can just hand in a constant mask and the driver will optimize away
the multiplication for us.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2016-01-29 18:13:05 -08:00
Eric Anholt 03f34f8556 glamor: Convert XV to using glamor_program.c.
One less custom path!  By following the common glamor_program.c use
pattern, we get the ability to handle large pixmaps as the
destination.  It's also one less place where glamor_utils.h coordinate
transformation happens.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2016-01-29 18:13:04 -08:00
Eric Anholt f368a0ba3a glamor: Simplify XV vertex setup.
We were clipping the drawn rectangle to each clip box, then expanding
the box to a big triangle to avoid tearing, then drawing each triangle
to the destination through a scissor.  If we're using a scissor for
clipping, though, then we don't need to clip the drawn primitive on
the CPU in the first place.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2016-01-29 18:13:01 -08:00
Eric Anholt 294e45b60d glamor: Set up XV sampler uniforms once at program build time.
No sense doing it on every draw.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2016-01-29 18:12:57 -08:00
Eric Anholt 5d7bef2eed glamor: Drop dead glamor_pict_format_is_compatible().
This hasn't been used since 2f80c7791b
(GLAMOR_SEPARATE_TEXTURE removal).

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2016-01-29 18:12:55 -08:00
Eric Anholt 4494a45040 glamor: Drop comment about dead yInverted flag.
Wait long enough, and you don't need to think about it at all.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2016-01-29 18:12:53 -08:00
Eric Anholt f7c24e6ac3 glamor: Rename the *y_inverted helpers to not say "inverted".
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2016-01-29 18:12:51 -08:00
Eric Anholt 1fcb6f4cbf glamor: Drop dead *_from_x_coord_y() functions.
They've been dead since the yInverted removal
(e310387f44).

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2016-01-29 18:12:48 -08:00
Eric Anholt 9ef11f13af glamor: Clarify when Render fallbacks happen due to an unsupported op.
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2016-01-29 18:12:44 -08:00
Eric Anholt b8229cc5f5 glamor: Label programs before linking them.
i965 does most of its compiling at link time, so our debug output for
its shaders didn't have the name on.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2016-01-29 18:12:39 -08:00
Dave Airlie 79c3925532 glamor: add core profile support to EGL glamor. (v2)
v1.1: use version defines.
v2: let glamor work it out itself

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2016-01-26 12:04:19 -08: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
Eric Anholt 5042b0652b glamor: Drop duplicated GLAMOR_DEFAULT_PRECISIONs in render accel.
We only need it once at the top of the shader, so just put it
there.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Dave Airlie <airlied@redhat.com>
2016-01-26 12:03:49 -08:00
Dave Airlie 1fd82c764d glamor: don't do copy if we have 0 boxes to copy.
This happens if you run twm + mplayer + xclock and drag
the clock over the mplayer. If we don't catch it, we cause
an illegal draw elements command to be passed to GL.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2016-01-26 12:02: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
Eric Anholt cab14a9a08 glamor: Drop the composite_with_copy path entirely.
I originally inherited this from the EXA code, without determining
whether it was really needed.  Regular composite should end up doing
the same thing, since it's all just shaders anyway.  To the extent
that it doesn't, we should fix composite.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Dave Airlie <airlied@redhat.com>
2016-01-26 12:02:37 -08:00
Eric Anholt 510c860564 glamor: Fix copy-like Render operations between 15 and 16 depth.
Reading and writing to 16-depth pixmaps using PICT_x1r5g5b5 ends up
failing, unless you're doing a straight copy at the same bpp where the
misinterpretation matches on both sides.

Fixes rendercheck/blend/over and renderhceck/blend/src in piglit.

Please cherry-pick this to active stable branches.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Dave Airlie <airlied@redhat.com>
2016-01-21 17:50:25 -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
Dave Airlie d99204fb5e glamor/xv: add vbo support (v2.1)
This converts the Xv code to using VBOs instead of
client ptrs. This is necessary to move towards using
the core profile later.

v2: put all boxes into single vbo, use draw arrays
to offset things. (Eric)
v2.1: brown paper bag with releasing vbo.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2016-01-21 06:47:41 +10:00
Dave Airlie 5582ad1b9b glamor: use vbos in gradient/picture code.
This converts two client arrays users to using vbos,
this is necessary to move to using core profile later.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2016-01-21 06:47:35 +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
Dave Airlie 8116fd8a76 glamor: store old fonts in double width textures.
There is a problem with some fonts that the height necessary
to store the font is greater than the max texture size, which
causes a fallback to occur. We can avoid this by storing two
macro columns side-by-side in the texture and adjusting
the calculations to suit.

This fixes
xfd -fn -*-*-*-*-*-*-*-*-*-*-*-*-*-*
falling back here, when it picks
-arabic-newspaper-medium-r-normal--32-246-100-100-p-137-iso10646-1

Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2016-01-13 11:21:02 +10:00
Dave Airlie 64081d0eac glamor: fallback if font is too large for FBO size.
running xfontsel on haswell here, with a max texture size
of 8kx8k, one font wants 9711 height. This fallsback to
sw in this case.

A proper solution probably involves using an array texture.

Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2016-01-13 11:20:59 +10: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 7cd495a888 glamor: Make glamor_get_name_from_bo static.
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 6be33fd044 glamor: Simplify DRI3 pixmap-from-fd, using GBM.
This GBM import path was introduced in 10.2, which we already require.

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 1b8f16d8e6 glamor: Use real types for glamor_egl's public gbm functions.
I think void * was just used to avoid needing to #include gbm.h, but
we can just forward-declare the structs and be fine.

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 f80758f32a glamor: Use the GBM function for getting an FD from a GBM BO.
We were rolling ioctl calls ourselves, when there's a nice interface
for it.

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 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 3dd202933f glamor: Remove glamor_egl_destroy_textured_pixmap().
The DestroyPixmap chain and CloseScreen chain all do pixmap teardown
already, and calling it manually would be redundant.

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 98a1993536 glamor: No need to glFlush before destroying a pixmap.
I assume this was a workaround for an old, broken, closed driver.  The
driver doesn't get to throw away rendering just because the rendering
context's shared-across-processes render target is getting freed from
the local address space.  If the rendering isn't to a shared render
target, then we *do* want to throw away the rendering to it.

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 9a5972801f glamor: Fix segfault in fallback picture uploading.
If the source/mask pixmap is a pixmap that doesn't have an FBO
attached, and it doesn't match the Render operation's size, then we'll
composite it to a CPU temporary (not sure why).  We would take the
PictFormatShort from the source Picture, make a pixmap of that depth,
and try to look up the PictFormat description from the depth and the
PictFormatShort.  However, the screen's PictFormats are only attached
to the screen's visuals' depths.  So, with an x2r10g10b10 short format
(depth 30), we wouldn't find the screen's PictFormat for it
(associated with depth 32).

Instead of trying to look up from the screen, just use the pFormat
that came from our source picture.  The only time we need to look up a
PictFormat when we're doing non-shader gradients, which we put in
a8r8g8b8.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2015-11-10 13:55:51 -08:00
Eric Anholt e7aa4d3c74 glamor: Fix assert failures when fallback picture upload alloc fails.
If the glTexImage (or glTexSubImage) out-of-memories, error out
cleanly so that we can 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:49 -08:00
Eric Anholt ff8ef975df glamor: Fix rendering when core font texture allocation fails.
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2015-11-10 13:55:47 -08:00
Eric Anholt a6b05d10da glamor: Fix crashes when the glyph atlas allocation fails.
We already have a fallback path, so we just need to jump to it when we
hit the failure.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2015-11-10 13:55: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 74be466d40 glamor: Avoid GL errors from mapping with size == 0.
GL 4.5 / GLES 3.0 require throwing GL errors at map time, and Mesa
before that might throw errors accidentally if a malloc(0) call was
made to return the mapping.

Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Rob Clark <robdclark@gmail.com>
2015-11-10 13:50:09 -08:00
Alan Coopersmith c1f5f9022f glamor: Get rid of an extraneous ; at the end of a C source line
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2015-09-30 10:24:33 -07:00
Emil Velikov 19a87257f9 glamor: move 'dri3_capable' extension checks after eglMakeCurrent
Otherwise we'll fail and/or crash as no context is bound.

Fixes: 64e6124f27 (glamor: move GL_OES_EGL_image check next to EGL_EXT_image_dma_buf_import)
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92105
Cc: Michel Dänzer <michel@daenzer.net>
Cc: Nick Sarnie <commendsarnex@gmail.com>
Reported-by: Nick Sarnie <commendsarnex@gmail.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Tested-by: Nick Sarnie <commendsarnex@gmail.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
2015-09-29 10:21:39 -04: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
Dave Airlie db5337afb2 glamor: make current in prepare paths
Lots of the accel paths only make current once they start
doing someting, so a lot of them call the bail paths without
make current, which means on PRIME systems for example
we end up in the wrong context.

Add a prepare pixmap in the prepare fallback path.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90667
Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-and-Tested-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2015-07-16 10:57:00 -07:00
Michel Dänzer 1a18513a4e glamor: Use glamor_prepare_access_box() for PutImage/GetImage fallback
Fixes slow text display in xdvi.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91260
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-16 10:43:54 -07:00
Eric Anholt fde13565c1 glamor: Drop unused box translation/bounds code.
These are dead since the glamor_copy.c replacement.

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