summaryrefslogtreecommitdiff
path: root/glamor
AgeCommit message (Collapse)AuthorFilesLines
2018-06-27glamor: Work around GEM usage v2Thomas Hellstrom1-2/+12
KMS drivers are not required to support GEM. In particular, vmwgfx doesn't support flink and handles and names are identical. Getting a bo name should really be part of a lower level API, if needed, but in the mean time work around this by setting the name identical to the handle if GEM isn't supported. This fixes modesetting driver dri2 on vmwgfx. Reviewed-by: Deepak Rawat <drawat@vmware.com> Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
2018-06-27glamor: Unbreak glamor_fd_from_pixmap()Lyude Paul4-25/+43
When support for allocating GBM BOs with modifiers was added, glamor_fd_from_pixmap() was changed so that it would return an error if it got a bo with modifiers set from glamor_fds_from_pixmap(). The problem is that on systems that support BOs with modifiers, glamor_fds_from_pixmap() will always return BOs with modifiers. This means that glamor_fd_from_pixmap() was broken entirely, which broke a number of other things including glamor_shareable_fd_from_pixmap(), which meant that modesetting using multiple GPUs with the modesetting DDX was also broken. Easy reproducer: - Find a laptop with DRI prime that has outputs connected to the dedicated GPU and integrated GPU - Try to enable one display on each using the modesetting DDX - Fail Since there isn't a way to ask for no modifiers from glamor_fds_from_pixmap, we create a shared _glamor_fds_from_pixmap() function used by both glamor_fds_from_pixmap() and glamor_fd_from_pixmap() that calls down to the appropriate glamor_egl_fd*_from_pixmap() function. Signed-off-by: Lyude Paul <lyude@redhat.com> Reviewed-by: Dave Airlie <airlied@redhat.com> Cc: Louis-Francis Ratté-Boulianne <lfrb@collabora.com> Fixes: c8c276c956 ("glamor: Implement PixmapFromBuffers and BuffersFromPixmap")
2018-06-07glamor: Enable modifier support for xfree86 tooAdam Jackson1-2/+2
This was left disabled in 1.20.0, it's time to start being sure it works. Signed-off-by: Adam Jackson <ajax@redhat.com> Acked-by: Keith Packard <keithp@keithp.com> Acked-by: Daniel Stone <daniels@collabora.com>
2018-05-28glamor: Propagate glamor_fds_from_pixmap error in glamor_fd_from_pixmapMichel Dänzer1-1/+1
glamor_fds_from_pixmap returns 0 on error, but we were treating that as success, continuing with uninitialized stride and fd values. Also bail if the offset isn't 0, same as in dri3_fd_from_pixmap. v2: * Reduce to a simple one-liner fix (Emil Velikov) Fixes: c8c276c9569b "glamor: Implement PixmapFromBuffers and BuffersFromPixmap" Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
2018-05-23glamor: Always return 0 from glamor_fds_from_pixmap on errorMichel Dänzer1-3/+3
This matches what glamor_egl_fds_from_pixmap and dri3_fds_from_pixmap do and what proc_dri3_buffers_from_pixmap expects. Fixes: c8c276c9569b "glamor: Implement PixmapFromBuffers and BuffersFromPixmap" Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
2018-05-16glamor_init: clamp GLSL to 120 if platform doesn't have instanced arraysLukas F. Hartmann1-0/+8
Hi, I upgraded Xwayland and the assorted libraries from git masters today, and noticed that glamor wouldn't work anymore on i.MX6/etnaviv. The error was: No provider of glVertexAttribDivisor found. Requires one of: Desktop OpenGL 3.3 OpenGL ES 3.0 GL extension "GL_ANGLE_instanced_arrays" GL extension "GL_ARB_instanced_arrays" GL extension "GL_EXT_instanced_arrays" GL extension "GL_NV_instanced_arrays" The problem is that etnaviv offers GLSL 140 on GL 2.1 and glamor rendering assumes that glVertexAttribDivisor() is always available on GLSL>=130, which is not the case here. Forcing GLSL 120 makes glamor work fine again on this platform. After chatting with ajax in #xorg-devel, the following solution was proposed. This is my first time of submitting a patch, so please excuse me and advise if I'm doing it wrong ;) Cheers Lukas (mntmn) Reviewed-by: Eric Anholt <eric@anholt.net>
2018-05-08dri3: Switch get_modifiers to using stdint.Eric Anholt2-4/+4
We were mixing stdint and CARD* types, causing compiler warnings on 32-bit. Just switch over to stdint, which is what we'd like the server to be using long term, anyway. Reviewed-by: Adam Jackson <ajax@redhat.com>
2018-05-08dri3: Switch get_drawable_modifiers to using stdint.Eric Anholt2-6/+6
We were mixing stdint and CARD* types, causing compiler warnings on 32-bit. Just switch over to stdint, which is what we'd like the server to be using long term, anyway. Signed-off-by: Eric Anholt <eric@anholt.net> Reviewed-by: Adam Jackson <ajax@redhat.com>
2018-04-30glamor: Don't fail in glamor_get_formats if not dmabuf_capable.Mario Kleiner1-1/+1
If dmabuf_capable is false, because the server "dmabuf_capable" debug flag isn't set, treat it as successfull query with zero returned formats, instead of failure. This allows the servers cache_formats_and_modifiers() function to cache the fact that formats are not supported during the current server generation, instead of pointless retesting at every invocation. Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com> Reviewed-by: Adam Jackson <ajax@redhat.com>
2018-04-17glamor: fix glamor_xv_query_image_attributes() for odd-width imagesDavid Woodhouse1-0/+1
Images which are one pixel wider than a multiple of 8 are being handled incorrectly. Other drivers round up the width to a multiple of two before they start calculating. Do the same. https://bugzilla.gnome.org/show_bug.cgi?id=795235 Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2018-04-10glamor: zero num_formats from the startEmil Velikov1-10/+6
The caller may ignore the return value (will be addressed with later commit) so simply zero the count from the get-go. We're pretty much do so, in all cases but one :-\ Fixes: cef12efc15c ("glamor: Implement GetSupportedModifiers") Cc: Louis-Francis Ratté-Boulianne <lfrb@collabora.com> Cc: Daniel Stone <daniels@collabora.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
2018-04-10glamor: zero num_modifiers from the startEmil Velikov1-10/+6
The caller may ignore the return value (will be addressed with later commit) so simply zero the count from the get-go. We're pretty much do so, in all cases but one :-\ Fixes: cef12efc15c ("glamor: Implement GetSupportedModifiers") Cc: Louis-Francis Ratté-Boulianne <lfrb@collabora.com> Cc: Daniel Stone <daniels@collabora.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
2018-04-10dri3: annotate fds/strides/offsets arrays as constEmil Velikov2-5/+5
It makes it perfectly clear that we should not be modifying them. Should help highlight issues like the one fixed with previous commit. Fixes: cef12efc15c ("glamor: Implement GetSupportedModifiers") Cc: Louis-Francis Ratté-Boulianne <lfrb@collabora.com> Cc: Daniel Stone <daniels@collabora.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
2018-04-10dri3: annotate the dri3_screen_info data as constEmil Velikov1-1/+1
dri3_screen_info is the user provide dispatch. Something that we do not and should not change. When using the _ptr typecast + const the compiler barfs at us (rightfully so), so use the _rec one. [Silence a new const mismatch warning too - ajax] Fixes: 56313829886 ("dri3: Add DRI3 extension") Cc: Keith Packard <keithp@keithp.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
2018-04-04glamor: Add fd_from_pixmap hookDaniel Stone1-0/+27
Add a fd_from_pixmap (singular) hook to go with fds_from_pixmap, which will ensure that the pixmap is allocated without modifiers and is thus exportable to non-modifier-aware clients. This makes it possible to run a compositing manager on an old GLX/EGL stack on top of an X server which allocates internal buffer storage using exotic modifiers from modifier-aware GBM/EGL/KMS. Signed-off-by: Daniel Stone <daniels@collabora.com> Reported-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Adam Jackson <ajax@redhat.com>
2018-04-04glamor: Fall back to non-modifier allocationsDaniel Stone1-2/+3
If we try to allocate with particular modifiers but it fails, try to fall back to non-modifier allocations. Signed-off-by: Daniel Stone <daniels@collabora.com> Reported-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Adam Jackson <ajax@redhat.com>
2018-04-04glamor: Reallocate pixmap storage without modifiers if necessaryDaniel Stone1-5/+6
If we need a pixmap's storage to be exported to a context in which we aren't aware of modifiers, reallocate the buffer again without modifiers. This makes it possible to run a compositing manager on an old GLX/EGL stack on top of an X server which allocates internal buffer storage using exotic modifiers from modifier-aware GBM/EGL/KMS. Signed-off-by: Daniel Stone <daniels@collabora.com> Reported-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Adam Jackson <ajax@redhat.com>
2018-04-04glamor: Push make_exportable into callersDaniel Stone1-1/+4
Rather than calling make_exportable from the get_bo entrypoint, make sure that someone has already explicitly requested the pixmap be exportable. This is technically an ABI break in that it changes observable behaviour, but no driver other than modesetting has ever used get_bo. Signed-off-by: Daniel Stone <daniels@collabora.com> Reported-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Adam Jackson <ajax@redhat.com>
2018-04-04glamor: Track if BO allocation used modifiersDaniel Stone3-10/+23
Keep track of whether or not we fed modifiers into GBM when we allocated a BO. We'll use this later inside Glamor, to reallocate buffer storage if we allocate buffer storage using modifiers, and a non-modifier-aware client requests an export of that pixmap. This makes it possible to run a compositing manager on an old GLX/EGL stack on top of an X server which allocates internal buffer storage using exotic modifiers from modifier-aware GBM/EGL/KMS. Signed-off-by: Daniel Stone <daniels@collabora.com> Reported-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Adam Jackson <ajax@redhat.com>
2018-04-02glamor: sanitze handling of "Debug" Option for "dmabuf_capable"Tobias Klausmann1-3/+7
With the appearance of the this new Option the X Server would crash if the option is not set. Default dmabuf_capable to off/FALSE for now - a user without knowledge about this option does not want to enable it until its save. Fixes: d11d5bb80 ("glamor: Hide new DRI behind Option "Debug" "dmabuf_capable") Signed-off-by: Tobias Klausmann <tobias.johannes.klausmann@mni.thm.de> Reviewed-by: Adam Jackson <ajax@redhat.com>
2018-03-28glamor: Hide new DRI behind Option "Debug" "dmabuf_capable"Adam Jackson1-1/+3
... for xfree86, at least for now. Things appear to work for Xwayland but not yet for modesetting. Hopefully we can fix that before 1.20 but in the meantime this makes testing both paths easier than a rebuild. Signed-off-by: Adam Jackson <ajax@redhat.com>
2018-03-21Remove always true GLAMOR_HAS_DRM_* guardsEmil Velikov1-4/+0
With earlier commit the required version was bumped to 2.4.89, thus the guards always evaluate to true. Fixes: e4e3447603b ("Add RandR leases with modesetting driver support [v6]") Cc: Keith Packard <keithp@keithp.com> Cc: Daniel Stone <daniels@collabora.com> Cc: Louis-Francis Ratté-Boulianne <lfrb@collabora.com> Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Adam Jackson <ajax@redhat.com>
2018-03-09glamor/xwayland: Add depth 30 format mapping for DRI 3.2 as well.Mario Kleiner1-0/+2
Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com> Reviewed-by: Daniel Stone <daniels@collabora.com>
2018-03-06glamor: Restore glamor_fd_from_pixmap and glamor_pixmap_from_fdMichel Dänzer3-12/+80
They're part of the 1.20 RC1 ABI, and actually used by external drivers. Also, requiring drivers which don't support the new functionality in DRI3 1.2 to switch to the new interfaces seems unreasonable. Signed-off-by: Michel Dänzer <michel.daenzer@amd.com> Reviewed-by: Daniel Stone <daniels@collabora.com>
2018-03-05glamor: Use gbm_bo_create_with_modifiers for internal pixmap allocationLouis-Francis Ratté-Boulianne1-6/+26
Using modifier might allow the driver to use a more optimal format (e.g. tiled/compressed). Let's try to use those if possible. v2: Don't filter out multi-plane modifiers Signed-off-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com> Reviewed-by: Daniel Stone <daniels@collabora.com> Acked-by: Keith Packard <keithp@keithp.com> Reviewed-by: Adam Jackson <ajax@redhat.com>
2018-03-05glamor: Implement GetSupportedModifiersLouis-Francis Ratté-Boulianne5-1/+144
Implement function added in DRI3 v1.1. A newest version of libepoxy (>= 1.4.4) is required as earlier versions use a problematic version of Khronos EXT_image_dma_buf_import_modifiers spec. v4: Only send scanout-supported modifiers if flipping is possible v5: Fix memory corruption in XWayland (uninitialized pointer) Signed-off-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com> Reviewed-by: Daniel Stone <daniels@collabora.com> Acked-by: Keith Packard <keithp@keithp.com> Reviewed-by: Adam Jackson <ajax@redhat.com>
2018-03-05glamor: Implement PixmapFromBuffers and BuffersFromPixmapLouis-Francis Ratté-Boulianne7-64/+257
It relies on GBM >= 17.1.0 where we can import BO with multiple planes and a format modifier (GBM_BO_IMPORT_FD_MODIFIER). v2: Properly free fds in Xwayland [Also add glamor_egl_ext.h to Makefile.am for distcheck's sake - ajax] Signed-off-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com> Reviewed-by: Daniel Stone <daniels@collabora.com> Acked-by: Keith Packard <keithp@keithp.com> Reviewed-by: Adam Jackson <ajax@redhat.com>
2018-02-27glamor: Bump version to 1.0.1 to signal depth 30 support.Mario Kleiner1-1/+1
Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com> Reviewed-by: Antoine Martin <antoine@nagafix.co.uk>
2018-02-27glamor: Enable composite acceleration for rgb10 formats. (v2)Mario Kleiner1-0/+1
Specifically for xrgb2101010 format. Tested on KDE Plasma-5 with XRender based composite acceleration backend. Much smoother and faster. (v2) Dropped argb2101010, because of depth 32 confusion with argb8888, as pointed out by Eric. Thanks! Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com> Reviewed-by: Antoine Martin <antoine@nagafix.co.uk>
2018-02-27glamor: Fix loose ends in color depth 30 support.Mario Kleiner3-3/+15
This makes it work properly with OpenGL based desktop compositing, as tested with EGL and GLX based compositing under OpenGL-2/3, and also artifact free with XRender based 2D compositing. Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com> Reviewed-by: Eric Anholt <eric@anholt.net> Reviewed-by: Antoine Martin <antoine@nagafix.co.uk>
2018-02-26render: Store and use all 16bpc of precision for solid pixels (v2.1)Adam Jackson3-15/+21
This plumbs the full width color for solid pictures through to fb, exa, and glamor. External drivers and acceleration code may wish to make a similar change for sufficiently new servers. v2: Don't break ABI (Michel Dänzer) v2.1: Use the (correct) full color in fb too (Michel Dänzer) Signed-off-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Keith Packard <keithp@keithp.com>
2018-02-26glamor: unifdef XORG_VERSION_CURRENTAdam Jackson1-4/+0
This is always true now that glamor is in-tree. Signed-off-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2018-01-29glamor: tidy up some gradient color formulasJeff Smith1-36/+30
- Avoid some needlessly complex equations for calculating the color at a point in a gradient field. - Avoid calculating certain values multiple times. - Use similar variable names across the two versions of the get_color function where practical. Signed-off-by: Jeff Smith <whydoubt@gmail.com> Reviewed-by: Adam Jackson <ajax@redhat.com>
2018-01-29glamor: remove unused variables in linear gradient shaderJeff Smith1-7/+0
Signed-off-by: Jeff Smith <whydoubt@gmail.com> Reviewed-by: Adam Jackson <ajax@redhat.com>
2018-01-29glamor: fix no-reflect case for gradientsJeff Smith1-11/+16
When compositing a no-reflect gradient, 'before' the gradient is empty, but 'after' the gradient is padded with the final color. Both sides are supposed to be empty. This is fixed by moving the virtual stops to match the first and last client-supplied stops for no-reflect gradients, then causing everything 'before' the initial virtual stop and 'after' the final virtual stop to emit rgba(0,0,0,0). This does not impact gradients using the other reflect modes. Signed-off-by: Jeff Smith <whydoubt@gmail.com> Reviewed-by: Adam Jackson <ajax@redhat.com>
2018-01-29glamor: fix repeat-reflect case in linear gradient shaderJeff Smith1-7/+4
If _pt_distance is negative, it causes the final distance to be negative in the repeat-reflect case. Moving the scaling by _pt_distance earlier avoids this problem, and simplifies some equations as a bonus. Bugzilla: https://bugs.freedesktop.org/98508 Signed-off-by: Jeff Smith <whydoubt@gmail.com> Reviewed-by: Adam Jackson <ajax@redhat.com>
2018-01-25glamor: Add 30bit RGB color format supportHawking Zhang4-3/+16
Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com> [ Michel Dänzer: Adapt to glamor changes since 1.19 ] Signed-off-by: Michel Dänzer <michel.daenzer@amd.com> Acked-by: Alex Deucher <alexander.deucher@amd.com>
2018-01-08glamor: Specify GLSL version for xv shaderCorentin Rossignon1-0/+2
SAMPLE is a GLSL keyword in newer OpenGL version. This fix issue with gnome-shell and playing video using xv Signed-off-by: Corentin Rossignon <corentin.rossignon@gmail.com> Bugzilla: https://bugs.freedesktop.org/104405 Reviewed-by: Adam Jackson <ajax@redhat.com>
2017-11-15glamor: Drop the non-VAO rendering pathAdam Jackson3-12/+10
GLES spells this extension as GL_OES_vertex_array_object, but it is functionally equivalent to the GL_ARB version. Mesa has supported both since 9.0, let's go ahead and require it. Signed-off-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Eric Anholt <eric@anholt.net>
2017-11-07glamor: Remove unused glamor_create_screen_resourcesAdam Jackson2-26/+0
Reviewed-by: Emil Velikov <emil.velikov@collabora.com> Signed-off-by: Adam Jackson <ajax@redhat.com>
2017-11-07glamor: Un-inline glamor_[gs]et_screen_privateAdam Jackson2-11/+17
text data bss dec hex filename 2134764 45210 128704 2308678 233a46 build/hw/kdrive/ephyr/Xephyr.before 2129972 45210 128704 2303886 23278e build/hw/kdrive/ephyr/Xephyr.after Reviewed-by: Emil Velikov <emil.velikov@collabora.com> Signed-off-by: Adam Jackson <ajax@redhat.com>
2017-10-30Use ARRAY_SIZE all over the treeDaniel Martin1-4/+0
Roundhouse kick replacing the various (sizeof(foo)/sizeof(foo[0])) with the ARRAY_SIZE macro from dix.h when possible. A semantic patch for coccinelle has been used first. Additionally, a few macros have been inlined as they had only one or two users. Signed-off-by: Daniel Martin <consume.noise@gmail.com> Reviewed-by: Adam Jackson <ajax@redhat.com>
2017-10-30glamor: Unconditionalize GLAMOR_TEXTURED_LARGE_PIXMAPAdam Jackson2-4/+1
Signed-off-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Eric Anholt <eric@anholt.net>
2017-10-30glamor: Unconditionalize GLAMOR_PIXMAP_DYNAMIC_UPLOADAdam Jackson2-21/+1
Signed-off-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Eric Anholt <eric@anholt.net>
2017-10-30glamor: Unconditionalize GLAMOR_GRADIENT_SHADERAdam Jackson4-10/+1
Effectively always true anyway. Signed-off-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Eric Anholt <eric@anholt.net>
2017-10-13glamor: Use GL_MESA_tile_raster_order for overlapping blits.Eric Anholt3-25/+52
Improves Raspberry Pi 3 x11perf -copywinwin500 from ~480/sec to ~700/sec. Signed-off-by: Eric Anholt <eric@anholt.net> Reviewed-by: Keith Packard <keithp@keithp.com>
2017-09-13glamor: Avoid overflow between box32 and box16 boxOlivier Fourdan1-5/+6
glamor_compute_transform_clipped_regions() uses a temporary box32 internally which is copied back to a box16 to init the regions16, thus causing a potential overflow. If an overflow occurs, the given region is invalid and the pixmap init region will fail. Simply check that the coordinates won't overflow when copying back to the box16, avoiding a crash later down the line in glamor. Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=101894 Signed-off-by: Olivier Fourdan <ofourdan@redhat.com> Tested-by: Fabrice Bellet <fabrice@bellet.info> Reviewed-by: Adam Jackson <ajax@redhat.com>
2017-09-13glamor: handle NULL source pictureOlivier Fourdan1-2/+3
COMPOSITE_REGION() can pass NULL as a source picture, make sure we handle that nicely in both glamor_composite_clipped_region() and glamor_composite_choose_shader(). Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=101894 Signed-off-by: Olivier Fourdan <ofourdan@redhat.com> Reviewed-by: Adam Jackson <ajax@redhat.com>
2017-09-06glamor: use the lowercase xnf.*alloc APIEmil Velikov1-1/+1
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-08-14glamor: Scissor Render composite operations to the bounds of the drawing.Eric Anholt1-0/+25
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>