summaryrefslogtreecommitdiff
path: root/glamor
AgeCommit message (Collapse)AuthorFilesLines
2016-09-29glamor: Require GL_OES_texture_border_clamp for GLES2.Eric Anholt2-19/+22
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-28glamor: Fall back to software for CopyPlane if we need toAdam Jackson3-0/+6
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-26glamor: Properly handle mask formats without alpha.Eric Anholt1-1/+4
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 355334fcd99e4dce62e2be1e27290c9a74ea944f. 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-26glamor: Require that pixmap depths match for Render copies.Eric Anholt1-0/+2
The copy optimization in d37329cba42fa8e72fe4be8a7be18e512268b5bd 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-26glamor: Fix some awful formatting of some fallback debug code.Eric Anholt1-6/+6
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-25glamor: Make glamor_sync_init work with --disable-xshmfenceMark Kettenis1-0/+3
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-25glamor: Make glamor_name_from_pixmap work without DRI3Matthieu Herrb1-4/+0
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-25glamor: fix spelling mistakesEric Engestrom3-6/+6
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-13glamor: Fix crash when master gpu is using glamor and another gpu is hotpluggedHans de Goede1-0/+10
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-13glamor: Add glamor_shareable_fd_from_pixmap()Hans de Goede2-0/+40
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-08-23glamor: Declare "pos" in the composite glyph GLSL 1.20 vertex shaderMichel Dänzer1-1/+2
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-22glamor: Handle bitplane in glamor_copy_fbo_cpuMichel Dänzer1-7/+33
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-07-18Remove readmask from screen block/wakeup handlerKeith Packard1-2/+2
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-18dix: Switch to the libXfont2 API (v2)Keith Packard1-3/+3
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-18glamor: Remove the FBO cache.Eric Anholt3-275/+6
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-15glamor: Translate solid text background region after clippingMichel Dänzer1-6/+7
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-06-20dix: Call screen block/wakeup handlers closest to blocking [v3]Keith Packard1-3/+3
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-14glamor: Use DestroyPixmap instead of FreePicture for glyph atlas pixmapKeith Packard1-1/+1
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-08glamor: Call eglBindAPI after eglInitializeMichel Dänzer1-5/+6
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-05-30glamor: Cannot use copies when accessing outside of composite sourceMichel Dänzer1-12/+15
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-27glamor: Adjust for drawable x/y in composite's copy optimizationKeith Packard1-0/+4
Patch b64108fa305e956e4edaae9d53071ff0abee268e 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-26glamor: Preserve GL_RED bits in R channel when destination is GL_RED [v2]Keith Packard12-26/+103
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-26glamor: glamor_make_current sooner in glamor_composite_with_shaderKeith Packard1-2/+2
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-26glamor: Disable logic ops when doing compositing [v4]Keith Packard2-0/+7
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-25glamor: Check for composite operations which are equivalent to copiesMichel Dänzer1-0/+23
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-25glamor: Fix sampling outside of RGBx source/mask picturesMichel Dänzer1-12/+24
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-04-29glamor: add glamor_finish APIDave Airlie2-0/+10
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-15glamor: fix wrong offset on composite rectanglesOlivier Fourdan1-9/+9
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-03-16glamor: swizzle RED to 0 for alpha texturesDave Airlie1-1/+3
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-11glamor: Make context current in glamor_pixmap_fbo_cache_putMichel Dänzer1-0/+1
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-10glamor: Replace "finish access" shader with texture swizzling.Eric Anholt5-407/+160
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-10glamor: Drop dead large-pixmap handling code in temp picture uploads.Eric Anholt2-112/+16
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-10glamor: Drop unused PBO code in temporary picture uploading.Eric Anholt1-23/+7
Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Eric Anholt <eric@anholt.net>
2016-03-10glamor: Generalize the a1-to-a8 conversion path.Eric Anholt1-37/+28
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-10glamor: Drop the REVERT_UPLOADING_1_5_5_5 path.Eric Anholt2-119/+5
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-10glamor: Drop the GLES2 REVERT_UPLOADING_2_10_10_10 paths.Eric Anholt2-57/+2
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-10glamor: Merge the two GL-type-from-pictformat paths.Eric Anholt1-201/+121
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-10glamor: Propagate that is_upload is always true.Eric Anholt3-120/+46
Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Eric Anholt <eric@anholt.net>
2016-03-10glamor: Drop dead fbo handling from GLAMOR_MEMORY pict uploads.Eric Anholt1-23/+2
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-10glamor: Make sure that GLAMOR_MEMORY pixmaps don't retain an FBO.Eric Anholt3-7/+18
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-10glamor: Simplify temporary picture uploading call stack.Eric Anholt3-76/+37
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-09glamor: do not build Xv support when --disable-xvOlivier Fourdan1-1/+5
Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
2016-03-08glamor: Source pictures are always depth 32Michel Dänzer1-3/+3
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-08glamor: Factor out glamor_set_color_depth from glamor_set_colorMichel Dänzer2-9/+19
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-08glamor: Fix XvPutImage when src_y != 0Hans de Goede1-1/+1
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-01-29glamor: Flip around conditionals in RepeatNone fixups.Eric Anholt1-2/+2
Signed-off-by: Eric Anholt <eric@anholt.net> Reviewed-by: Dave Airlie <airlied@redhat.com> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2016-01-29glamor: Cut down a bunch of conditional handling for RepeatFix.Eric Anholt1-31/+19
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-29glamor: Clarify how the repeat values being passed around work.Eric Anholt1-6/+6
Signed-off-by: Eric Anholt <eric@anholt.net> Reviewed-by: Dave Airlie <airlied@redhat.com> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2016-01-29glamor: Clean up formatting of RepeatFix shader code.Eric Anholt1-27/+30
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-29glamor: Clarify some logic in RepeatFix handling.Eric Anholt1-14/+7
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>