summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/dri/dri2.c
Commit message (Collapse)AuthorAgeFilesLines
* android: more fixes for llvmpipe software renderingChih-Wei Huang2016-11-011-2/+2
| | | | | * add dri2_create_from_texture to driswImageExtension * add dri2FenceExtension to drisw_screen_extensions
* android: support swrastWuZhen2016-11-011-3/+3
| | | | | | | | | | System boots up with gles_mesa/softpipe/llvmpipe. NO_REF_TASK Tested: local run Change-Id: I629ed0ca9fad12e32270eb8e8bfa9f7681b68474 Signed-off-by: Chih-Wei Huang <cwhuang@linux.org.tw>
* gallium: introduce load_pipe_screen()Rob Herring2016-11-011-3/+1
| | | | | | | | | | | | Introduce load_pipe_screen() public entry point for other code which dlopen()'s gralloc_dri.so for purposes of loading a pipe_screen. This way drm_gralloc can avoid static linking of each gallium winsys and driver, and avoid duplicated logic to figure out which pipe driver to load. This is based on Rob Clark's work. I moved it into pipe_loader which seems to be a better spot. Signed-off-by: Rob Herring <robh@kernel.org>
* st/dri: replace calls to dup(2) with fcntl(F_DUPFD_CLOEXEC)Matt Whitlock2016-10-041-2/+3
| | | | | | | | | | Without this fix, duplicated file descriptors leak into child processes. See commit aaac913e901229d11a1894f6aaf646de6b1a542c for one instance where the same fix was employed. Cc: <mesa-stable@lists.freedesktop.org> Signed-off-by: Matt Whitlock <freedesktop@mattwhitlock.name> Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
* st/dri: check pipe_screen->resource_get_handle() return valueNicholas Bishop2016-09-271-2/+4
| | | | | | | | | | | | | | | | | | | | | Change dri2_query_image to check the return value of resource_get_handle and return GL_FALSE if an error occurs. For reference this is an example callstack that should propagate the error back to the user: i915_drm_buffer_get_handle i915_texture_get_handle u_resource_get_handle_vtbl dri2_query_image gbm_dri_bo_get_fd gbm_bo_get_fd Cc: mesa-stable@lists.freedesktop.org Signed-off-by: Nicholas Bishop <nbishop@neverware.com> Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com> (v1) [Emil Velikov: Split from larger patch, polish coding style, cc stable] Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
* mesa/st: support lowering multi-planar YUVRob Clark2016-09-261-22/+97
| | | | | | | | | | | | | | | Support multi-planar YUV for external EGLImage's (currently just in the dma-buf import path) by lowering to multiple texture fetch's for each plane and CSC in shader. There was some discussion of alternative approaches for tracking the additional UV or U/V planes: https://lists.freedesktop.org/archives/mesa-dev/2016-September/127832.html They all seemed worse than pipe_resource::next Signed-off-by: Rob Clark <robdclark@gmail.com>
* gbm: wire up fence extensionRob Clark2016-09-071-0/+1
| | | | | | | | v2: make fence extension optional to not break non-i965 classic drivers, and move __DRI2_FENCE into core extensions, based on comments from Emil Signed-off-by: Rob Clark <robdclark@gmail.com>
* gallium: add a pipe_context parameter to resource_get_handleMarek Olšák2016-08-251-6/+7
| | | | | | | | radeonsi needs to do some operations (DCC decompression) for OpenGL-OpenCL interop and this is the only way to make it coherent with the current context. It can optionally be set to NULL. Reviewed-by: Brian Paul <brianp@vmware.com>
* gallium: add a pipe_context parameter to fence_finishMarek Olšák2016-08-101-3/+3
| | | | | | | | required by glClientWaitSync (GL 4.5 Core spec) that can optionally flush the context Reviewed-by: Rob Clark <robdclark@gmail.com> Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
* st/dri: Clear drawable texture_mask in dri2_invalidate_drawableMichel Dänzer2016-06-141-0/+1
| | | | | | | | | | | | This makes sure that dri_set_tex_buffer2 -> dri_drawable_validate_att will re-create the front left attachment buffer after the drawable got invalidated. Fixes window contents not updating until the window is resized when using DRI2 PRIME. Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com>
* mesa_glinterop: remove mesa_glinterop typedefsEmil Velikov2016-05-301-3/+3
| | | | | | | | | | | | | | | | As is there are two places that do the typedefs - dri_interface.h and this header. As we cannot include the former in here, just drop the typedefs and use the struct directly (as needed). This is required because typedef redefinition is C11 feature which is not supported on all the versions of GCC used to build mesa. v2: Kill the typedef alltogether, as per Marek. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=96236 Cc: Vinson Lee <vlee@freedesktop.org> Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com>
* gallium: push offset down to driverStanimir Varbanov2016-05-301-5/+2
| | | | | | | | | | | | | Push offset down to drivers when importing dmabuf. This is needed to more fully support EGL_EXT_image_dma_buf_import when a non-zero offset is specified. Tesing has been done for freedreno, and compile tested following gallium drivers: nouveau,svga,virgl,r600,r300,radeonsi,swrast,i915,ilo Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org> Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
* st/dri: cleanup image_from_fd/dma_buf pathsStanimir Varbanov2016-05-301-37/+44
| | | | | Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org> Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
* st/dri: add handling of R8 and GR88 DRI fourcc formatsStanimir Varbanov2016-05-301-0/+20
| | | | | | | | | This helps to import dmabuf buffers from DRM_FORMAT_R8 and DRM_FORMAT_GR88 used for example by GStreamer for YUV to RGB conversion using shaders. Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org> Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
* mesa_glinterop: make GL interop version field bidirectionalEmil Velikov2016-05-241-1/+8
| | | | | | | | | | | | | | This allows clear and easy communication between the two. Caller: Requesting information (struct vN) Callee: I know how to deal with older version (vN-1) only. Here is your data and the version I support. Caller: Older version ? Sure I'll cap all access to the fields provided by the older version (vN-1) Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com> Tested-by: Tom Stellard <thomas.stellard@amd.com>
* mesa_glinterop: drop mesa_glinterop_device_info::interop_versionEmil Velikov2016-05-241-2/+0
| | | | | | | | | | | | One cannot use a single version to control both export_in and export_out versions. Using this forces us to always extend/bump both structs at the same time. An alternative scheme is coming with next patch. Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com> Tested-by: Tom Stellard <thomas.stellard@amd.com>
* st/dri: add note about GL interop version checksEmil Velikov2016-05-241-2/+4
| | | | | | | | ... and make them more explicit. Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com> Tested-by: Tom Stellard <thomas.stellard@amd.com>
* mesa_glinterop: rename MESA_GLINTEROP_INVALID_{VALUE,VERSION}Emil Velikov2016-05-241-2/+2
| | | | | | | | Be more explicit what it actually does. Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com> Tested-by: Tom Stellard <thomas.stellard@amd.com>
* mesa_glinterop: s/struct_version/version/Emil Velikov2016-05-241-2/+2
| | | | | | | | OCD polish for consistency with other mesa interfaces. Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com> Tested-by: Tom Stellard <thomas.stellard@amd.com>
* mesa_glinterop: use consistent naming scheme for GL interopEmil Velikov2016-05-241-3/+3
| | | | | | Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com> Tested-by: Tom Stellard <thomas.stellard@amd.com>
* st/dri: don't call close(-1) in dri{2, kms_}_init_screen error pathEmil Velikov2016-05-231-10/+20
| | | | | | | Add separate labels and jump to the correct one as needed. Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com> Reviewed-by: Leo Liu <leo.liu@amd.com>
* st/dri: Add support for DRIimage extension mapImage/unmapImageRob Herring2016-05-231-1/+42
| | | | | | | | | | Implement support for mapImage/unmapImage functions in version 12 of the DRIimage extension. Signed-off-by: Rob Herring <robh@kernel.org> [Emil Velikov: align/indent the map/unmap vfuncs] Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com> Reviewed-by: Eric Anholt <eric@anholt.net>
* Revert "st/dri: add 32-bit RGBX/RGBA formats"Marek Olšák2016-04-241-6/+0
| | | | | | | | | This reverts commit ccdcf91104a5f07127b5b8d8570b5c4bbcf86647. It breaks most KDE apps, because DRI doesn't support the RGBA component ordering. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=95071
* st/dri: add 32-bit RGBX/RGBA formatsRob Herring2016-04-211-0/+6
| | | | | | | | Add support for 32-bit RGBX/RGBA formats which are preferred for Android. Signed-off-by: Rob Herring <robh@kernel.org> Reviewed-by: Marek Olšák <marek.olsak@amd.com> Reviewed-by: Eric Anholt <eric@anholt.net>
* st/dri: implement the GL interop DRI extension (v2.2)Marek Olšák2016-04-201-0/+258
| | | | | | | | | | v2: - set interop_version - simplify the offset_after macro v2.1: - use version numbers, remove offset_after - set "out_driver_data_written" v2.2: - set buf_offset & buf_size for GL_ARRAY_BUFFER too - add whandle.offset to buf_offset - disable the minmax cache for GL_TEXTURE_BUFFER
* st/dri: Fix RGB565 EGLImage creationNicolas Dufresne2016-04-201-20/+24
| | | | | | | | | | When creating egl images we do a bytes to pixel conversion by deviding by 4 regardless of the pixel format. This does not work for RGB565. In this patch, we avoid useless conversion and use proper API when the conversion cannot be avoided. Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
* st/dri: Factor out DRI2 to PIPE_FORMAT conversionNicolas Dufresne2016-04-201-34/+27
| | | | | | | | This code is already duplicated twice and will be useful again. This will also help when adding formats. Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
* gallium/winsys/drm: add offset to struct winsys_handleChristian König2016-03-171-0/+2
| | | | | | | We are going to need this for EGL_EXT_image_dma_buf_import. Signed-off-by: Christian König <christian.koenig@amd.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com>
* gallium: add external usage flags to resource_from(get)_handle (v2)Marek Olšák2016-03-091-7/+18
| | | | | | | | | This will allow drivers to make better decisions about texture sharing for DRI2, DRI3, Wayland, and OpenCL. v2: add read/write flags, take advantage of __DRI_IMAGE_USE_BACKBUFFER Reviewed-by: Axel Davy <axel.davy@ens.fr>
* st/dri: fd management cleanupsEmil Velikov2015-11-291-2/+14
| | | | | | | | | | | Add some checks if the original/dup'd fd is valid and ensure that we don't leak it on error. The former is implicitly handled within the pipe_loader, although let's make things explicit and check beforehand. Spotted by Coverity (CID 1339865) Cc: mesa-stable@lists.freedesktop.org Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
* st/dri: NULL check the pscreen earlierEmil Velikov2015-11-211-10/+12
| | | | | | | | We delay the null check only to jump through hoops to work around that. Check early to make our lives easier. Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com> Acked-by: Rob Clark <robclark@freedesktop.org>
* st/dri: Don't close the drm fd on failureEmil Velikov2015-11-211-2/+2
| | | | | | | | | | | | | Ported from an identically named commit in st/xa commit 35cf3831d71770211f29da6608313dc1f6213d7b Author: Thomas Hellstrom <thellstrom@vmware.com> Date: Thu Jul 3 02:07:36 2014 -0700 st/xa: Don't close the drm fd on failure v2 Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com> Acked-by: Rob Clark <robclark@freedesktop.org>
* {st,targets}/dri: use static/dynamic pipe-loaderEmil Velikov2015-11-211-16/+4
| | | | | | | | | | Covert DRI to use only the pipe-loader interface. With drisw_create_screen and kms_swrast_create_screen replaced by their pipe-loader equivalent, we can now drop them. Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com> Acked-by: Rob Clark <robclark@freedesktop.org>
* gallium: remove library_path argument from pipe_loader_create_screen()Emil Velikov2015-11-211-1/+1
| | | | | | | | | | | | | | | Currently the location is determined at configure/build time and consistently copied across gallium. Just remove the extra argument, and use PIPE_SEARCH_DIR where appropriate. This will allow us to remove the duplication in the *configuration and *screen_create APIs by moving util_dl_get_proc_address() and friends to probe time. v2: rebase on top of vl_winsys_drm.c addition Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com> Acked-by: Rob Clark <robclark@freedesktop.org>
* st/dri: Use packed RGB formatsMichel Dänzer2015-10-041-13/+13
| | | | | | | | | | Fixes Gallium based DRI drivers failing to load on big endian hosts because they can't find any matching fbconfigs. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=71789 Signed-off-by: Michel Dänzer <michel.daenzer@amd.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com> Tested-by: Ilia Mirkin <imirkin@alum.mit.edu>
* st/dri: don't use _ctx in client_wait_syncMarek Olšák2015-10-031-2/+5
| | | | | | | | | Not needed and it can be NULL. v2: fix dri2_get_fence_from_cl_event - thanks Albert Cc: 10.6 11.0 <mesa-stable@lists.freedesktop.org> Reviewed-by: Albert Freeman <albertwdfreeman@gmail.com>
* pipe-loader: remove pipe_loader_drm_probe_fd() x_auth argumentEmil Velikov2015-07-131-1/+1
| | | | | | | | No longer used by anyone, as of last commit. Cc: Tom Stellard <thomas.stellard@amd.com> Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com> Reviewed-by: Francisco Jerez <currojerez@riseup.net>
* st/dri: don't set PIPE_BIND_SCANOUT for MSAA surfacesMarek Olšák2015-07-071-1/+1
| | | | | | Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91231 Reviewed-by: Brian Paul <brianp@vmware.com>
* st/dri: check pscreen is valid before querying paramDave Airlie2015-06-101-1/+1
| | | | | | | | | we don't check the validity of pscreen until dri_init_screen_helper hit this trying to init glamor on a device with no driver (udl). Acked-by: Michel Dänzer <michel.daenzer@amd.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
* st/dri: add support for create_context_robustness GLX and EGL extensionsMarek Olšák2015-05-121-1/+22
| | | | Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
* st/dri: implement the fence interface for CL eventsMarek Olšák2015-04-301-1/+71
|
* st/dri: implement the fence interfaceMarek Olšák2015-04-301-0/+80
|
* egl: add initial EGL_MESA_image_dma_buf_export v2.4Dave Airlie2015-04-011-1/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | At the moment to get an EGL image to a dma-buf file descriptor, you have to use EGL_MESA_drm_image, and then use libdrm to convert this to a file descriptor. This extension just provides an API modelled on EGL_MESA_drm_image, to return a dma-buf file descriptor. v2: update spec for new API proposal add internal queries to get the fourcc back from intel driver. v2.1: add gallium pieces. v2.2: add offsets to spec and API, rename fd->fds, stride->strides in API. rewrite spec a bit more, add some q/a v2.3: add modifiers to query interface and 64-bit type for that (Daniel Stone) specifiy what happens to num fds vs num planes differences. (Chad Versace) v2.4: fix grammar (Daniel Stone) Signed-off-by: Dave Airlie <airlied@redhat.com>
* gallium/dri: Shut up a compiler warning.Eric Anholt2015-02-181-1/+1
| | | | | | | The compiler doesn't see that buffers is set in the !image case and used in the !image case. Reviewed-by: Matt Turner <mattst88@gmail.com>
* targets/pipe-loader: drop unused authenticationEmil Velikov2014-09-241-1/+1
| | | | | | | | | The dri, vdpau, omx, xvmc and gbm targets don't need any authentication even the VL ones never used it. Either the respective loader or the library itself (vl) is doing its auth prior to calling create_screen() Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com> Acked-by: Matt Turner <mattst88@gmail.com>
* kms-swrast: Support Prime fd handlingAndreas Pokorny2014-09-051-0/+8
| | | | | | | | Allows using prime fds as display target and from display target. Test for PRIME capability after initializing kms_swrast screen. Cc: mesa-stable@lists.freedesktop.org Signed-off-by: Andreas Pokorny <andreas.pokorny@canonical.com>
* st/dri: Add __DRI2rendererQueryExtension supportEmil Velikov2014-08-151-0/+2
| | | | | | | | | | | The final step to get GLX_MESA_query_renderer working with gallium drivers. v2: Remove __DRI2_RENDERER_PREFERRED_PROFILE handling. It's already handled in dri/common. Spotted by Marek. Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com>
* st/dri: define GALLIUM_SOFTPIPE when building kms_swrastEmil Velikov2014-08-121-2/+0
| | | | | | | | | | | | | | | To avoid unresolved symbols in the DRI modules with earlier commit we wrapped the innards of dri_kms_init_screen() in a DRI_TARGET/GALLIUM_SOFTPIPE ifdef. At the same time we forgot to adds the defines to the st/dri build systems, breaking kms_swrast and gnome-continuous. Drop the DRI_TARGET define, we're already in st/DRI. Reported-by: Jasper St. Pierre <jstpierre@mecheye.net> Reported-by: Vadim Rutkovsky <vrutkovs@redhat.com> Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
* st/dri: Fix driver loading if swrast isn't builtAaron Watry2014-08-031-0/+4
| | | | | | | | | | | | | | | | | | | | If building hardware drivers only, then kms_swrast_create_screen won't be defined in inline_drm_helper.h and hardware drivers will fail to dlopen as a result. Copy the #if guards from inline_drm_helper.h to dri_kms_init_screen to make the definition/use of the function match. Fixes radeonsi_dri.so dlopen with the following configure: ./configure --with-dri-drivers= --with-dri-driverdir=/usr/local/lib/dri/ \ --enable-gbm --enable-gallium-gbm --enable-debug --enable-opencl \ --enable-opencl-icd --with-gallium-drivers=radeonsi \ --with-egl-platforms=drm --enable-glx-tls --enable-texture-float \ --enable-omx Signed-off-by: Aaron Watry <awatry@gmail.com> Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
* dri: Add a new capabilities for drivers that can't share buffersGiovanni Campagna2014-07-301-4/+21
| | | | | | | | | | | | | | | | | | | The kms-dri swrast driver cannot share buffers using the GEM, so it must tell the loader to disable extensions relying on that, without disabling the image DRI extension altogether (which would prevent the loader from working at all). This requires a new gallium capability (which is queried on the pipe_screen and for swrast drivers it's forwarded to the winsys), and requires a new version of the DRI image extension. [Emil Velikov] - Rebased on top of gallium-dri megadrivers. - Drop PIPE_CAP_BUFFER_SHARE and sw_winsys::get_param hook. The can_share_buffer cap is set at InitScreen. We use a different InitScreen (and thus value for the cap) function for kms_dri, due to deeper differences originating from dri megadrivers. Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>