summaryrefslogtreecommitdiffstats
path: root/src/gbm/backends
Commit message (Collapse)AuthorAgeFilesLines
* gbm: request correct version of the DRI2_FENCE extensionLucas Stach2016-11-241-1/+1
| | | | | | | | | | | There is no version 2 of the DRI2_FENCE extension. So only a request for version 1 has a chance to succeed. Fixes: 74b1969d717f (gbm: wire up fence extension) Cc: "13.0" <mesa-stable@lists.freedesktop.org> Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Reviewed-by: Emil Velikov <emil.velikov@collabora.com> (cherry picked from commit d9a3ad94cac34c51603660af6647290d238f64bc)
* loader: remove loader_get_driver_for_fd() driver_typeEmil Velikov2016-10-181-1/+1
| | | | | | | | | | | | | | Reminiscent from the pre-loader days, were we had multiple instances of the loader logic in separate places and one could build a "GALLIUM_ONLY" version. Since that is no longer the case and the loaders (glx/egl/gbm) do not (and should not) require to know any classic/gallium specific we can drop the argument and the related code. Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Axel Davy <axel.davy@ens.fr> Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
* gbm: add a couple missing includesEric Engestrom2016-10-171-0/+2
| | | | | | | Needed for memset() and drmIoctl(). Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com> Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
* gbm: rename gbm_dri_device::{,loader_}extensionsEmil Velikov2016-10-142-7/+7
| | | | | | | To align with the name used in the EGL and GLX loaders. Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Eric Engestrom <eric@engestrom.ch>
* gbm: return appropriate error when queryImage() failsNicholas Bishop2016-09-271-1/+2
| | | | | | | | | | | | | | Change gbm_dri_bo_get_fd to check the return value of queryImage and return -1 (an invalid file descriptor) if an error occurs. Update the comment for gbm_bo_get_fd to return -1, since (apart from the above) we've already return -1 on error. 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>
* gbm: fix potential NULL deref of mapImage/unmapImage.Chuanbo Weng2016-09-121-2/+3
| | | | | | | | | The mapImage/unmapImage functions of DRIimage extension can be NULL, so we should add additional check for them. Cc: <mesa-stable@lists.freedesktop.org> Signed-off-by: Chuanbo Weng <chuanbo.weng@intel.com> Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
* gbm: wire up fence extensionRob Clark2016-09-072-1/+4
| | | | | | | | 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>
* gbm: add missing R8 and GR88 formatsRob Clark2016-09-071-1/+7
| | | | | Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com> Signed-off-by: Rob Clark <robdclark@gmail.com>
* gbm: Add map/unmap functionsRob Herring2016-05-232-0/+65
| | | | | | | | | | | | | | | This adds map and unmap functions to GBM utilizing the DRIimage extension mapImage/unmapImage functions or existing internal mapping for dumb buffers. Unlike prior attempts, this version provides a region to map and usage flags for the mapping. The operation follows the same semantics as the gallium transfer_map() function. This was tested with GBM based gralloc on Android. Signed-off-by: Rob Herring <robh@kernel.org> [Emil Velikov: drop no longer relevant hunk from commit message.] Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com> Reviewed-by: Eric Anholt <eric@anholt.net>
* gbm: rename gbm_dri_bo_{map,unmap} to gbm_dri_bo_{map,unmap}_dumbRob Herring2016-05-232-4/+4
| | | | | | | | | In preparation to add public map/unmap functions, rename the existing gbm_dri_bo_{map,unmap} functions to indicate that they are only for dumb buffers. Signed-off-by: Rob Herring <robh@kernel.org> Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
* gbm: add Android gallium_dri.so library loading supportRob Herring2016-05-231-0/+9
| | | | | | | | | GBM needs the same special gallium_dri.so loading as EGL for Android, so copy over the same hunk from the EGL code. Signed-off-by: Rob Herring <robh@kernel.org> Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com> Reviewed-by: Eric Anholt <eric@anholt.net>
* gbm: add GBM_FORMAT_XBGR8888 format supportRob Herring2016-04-211-0/+7
| | | | | | | | | Add GBM_FORMAT_XBGR8888/__DRI_IMAGE_FORMAT_XBGR8888 format support which is needed 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>
* gbm: convert gbm bo format to fourcc format on dma-buf importRay Strode2015-09-151-1/+17
| | | | | | | | | | | | | | | | | | | | | At the moment if a gbm buffer is imported and the gbm buffer has an old-style GBM_BO_FORMAT format, the import will crash, since it's passed directly to DRI functions that expect a fourcc format (as provided by the newer GBM_FORMAT definitions) This commit addresses the problem in two ways: 1) it prevents invalid formats from leading to a crash by returning EINVAL if the image couldn't be created 2) it translates GBM_BO_FORMAT formats into the comparable GBM_FORMAT formats. Reference: https://bugzilla.gnome.org/show_bug.cgi?id=753531 CC: "10.6 11.0" <mesa-stable@lists.freedesktop.org> Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com> Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
* gbm: dlopen libglapi so gbm_create_device worksFrank Henigman2015-06-231-0/+8
| | | | | | | | | | | | | Dri driver libs are not linked to pull in libglapi so gbm_create_device() fails when it tries to dlopen them (unless the application is linked with something that does pull in libglapi, like libGL). Until dri drivers can be fixed properly, dlopen libglapi before trying to dlopen them. Cc: "10.5 10.6" <mesa-stable@lists.freedesktop.org> Signed-off-by: Frank Henigman <fjhenigman@google.com> [Emil Velikov: Drop misleading bugzilla link, mention that libname differs] Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
* gbm: Add GBM_BO_USE_LINEAR flagFlora Cui2015-04-161-0/+2
| | | | | | | Signed-off-by: Flora Cui <flora.cui@amd.com> Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com> Reviewed-by: Michel Dänzer <michel.daenzer@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
* gbm/dri: Fix const confusionKristian Høgsberg2015-01-161-4/+3
| | | | | | | | The driver name is no longer const, it's always allocated dynamically one way or another. Drop const from dri_screen_create_dri2 driver_name argument to avoid warning. Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
* dri/kms: Always zero out struct drm_mode_create_dumbThierry Reding2014-11-161-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | The DRM_IOCTL_MODE_CREATE_DUMB (and others) IOCTL isn't very rigorously specified, which has the effect that some kernel drivers do not consider the .pitch and .size fields of struct drm_mode_create_dumb outputs only. Instead they will use these as lower bounds and overwrite them only if the values that they compute are larger than what userspace provided. This works if and only if userspace initializes the fields explicitly to either 0 or some meaningful value. However, if userspace just leaves the values uninitialized and the struct drm_mode_create_dumb is allocated on the stack for example, the driver may try to overallocate buffers. Fortunately most userspace does zero out the structure before passing it to the IOCTL, but there are rare exceptions. Mesa is one of them. In an attempt to rectify this situation, kernel drivers are being updated to not use the .pitch and .size fields as inputs. However in order to fix the issue with older kernels, make sure that Mesa always zeros out the structure as well. Future IOCTLs should be more rigorously defined so that structures can be validated and IOCTLs rejected if output fields aren't set to zero. Signed-off-by: Thierry Reding <treding@nvidia.com> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
* gbm/dri: cleanup memory leak on teardownEmil Velikov2014-11-071-0/+3
| | | | | | | | During teardown we free the driver_configs list pointer, but we forget to deallocate each config in that list. Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com> Reviewed-and-tested-by: Kenneth Graunke <kenneth@whitecape.org>
* gbm: Log at least one dlerror() when we fail to open any drivers.Eric Anholt2014-07-301-0/+1
| | | | | | | | | | | | We don't want to log every single error (such as all the ones where the file wasn't even present in our list of search paths), but if you didn't find any driver, then seeing at least one error is useful (since the common case as a developer is a single DEFAULT_DRIVER_DIR or GBM_DRIVERS_PATH entry). v2: Rebase on swrast changes. Reviewed-by: Michel Dänzer <michel.daenzer@amd.com> Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
* gbm: Fix a debug log messageEric Anholt2014-07-301-1/+1
| | | | | Reviewed-by: Michel Dänzer <michel.daenzer@amd.com> Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
* gallium: Add a dumb drm/kms winsys backed swrast providerGiovanni Campagna2014-07-301-4/+34
| | | | | | | | | | | | | | | | | | | | | | Add a new winsys and target that can be used with a dri2 state tracker and loader instead of drisw. This allows to use gbm as a dri2/image loader and avoid the extra copy from the backbuffer to the shadow frontbuffer. The new driver is called "kms_swrast", and is loaded by gbm as a fallback, because it is only useful with the gbm platform (as no buffer sharing is possible) To force select the driver set the environment variable GBM_ALWAYS_SOFTWARE [Emil Velikov] - Rebase on top of gallium megadriver. - s/text/test/ in configure.ac (Spotted by Andreas Pokorny). - Add scons support for winsys/sw/kms-dri and fix the build. - Provide separate DriverAPI, due to different InitScreen hook. Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
* Add support for swrast to the DRM EGL platformGiovanni Campagna2014-07-302-27/+233
| | | | | | | | | | | | | | | | | | | | Turn GBM into a swrast loader (providing putimage/getimage backed by a dumb KMS buffer). This allows to run KMS+DRM GL applications (such as weston or mutter-wayland) unmodified on cards that don't have any client side HW acceleration component but that can do modeset (examples include simpledrm and qxl) [Emil Velikov] - Fix make check. - Split dri_open_driver() from dri_load_driver(). - Don't try to bind the swrast extensions when using dri. - Handle swrast->CreateNewScreen() failure. - strdup the driver_name, as it's free'd at destruction. - s/LIBGL_ALWAYS_SOFTWARE/GBM_ALWAYS_SOFTWARE/ - Move gbm_dri_bo_map/unmap to gbm_driiint.h. - Correct swrast fallback logic. Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
* gbm: Search LIBGL_DRIVERS_PATH if GBM_DRIVERS_PATH is not setDylan Baker2014-07-241-1/+11
| | | | | | | | | | | | | | | | | | | | | The GBM_DRIVERS_PATH environment variable is not documented, and only used to set the location of gbm drivers, while LIBGL_DRIVERS_PATH is used for everything else, and is documented. Generally this split leads to confusion as to why gbm doesn't work. This patch will read LIBGL_DRIVERS_PATH as a fallback if GBM_DRIVERS_PATH is not set. The comments clearly indicate that using LIBGL_DRIVERS_PATH is preferred over GBM_DRIVERS_PATH. v2: - Use GBM_DRIVERS_PATH as a fallback v3: [jordan.l.justen@intel.com] - Make LIBGL_DRIVERS_PATH the fallback Signed-off-by: Dylan Baker <baker.dylan.c@gmail.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
* gbm: Remove 64x64 restriction from GBM_BO_USE_CURSORMichel Dänzer2014-06-121-4/+4
| | | | | | | | | | GBM_BO_USE_CURSOR_64X64 is kept so that existing users of GBM continue to build, but it no longer rejects widths or heights other than 64. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=79809 Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
* gbm: cleanup __DRI*extension handlingEmil Velikov2014-04-282-14/+18
| | | | | | | | Use designated initialisers, store all extension pointers as const and use a const __DRIextensions array over assigning each element individually. Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
* gbm: Set errno on errorsAnder Conselvan de Oliveira2014-04-251-8/+28
| | | | | | | | | This should give the caller some information of what called the error. For the gbm_bo_import() case, for instance, it is possible to know if the import is not supported or the error was caused by an invalid parameter. Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
* gbm/dri: Fix out-of-memory error path in dri_device_create()Ander Conselvan de Oliveira2014-04-251-0/+2
| | | | | Cc: "10.0" "10.1" <mesa-stable@lists.freedesktop.org> Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
* gbm: Add import from fdKristian Høgsberg2014-04-011-2/+19
| | | | | | | Add a new import type that lets us create a gbm bo from a DMA-BUF file descriptor. Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
* gbm: Add gbm_bo_get_fd()Kristian Høgsberg2014-04-011-0/+16
| | | | | | Add gbm function to get a DMA-BUF file descriptor for a gbm bo. Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
* gbm/dri: Fixed buffer object memory leak in case of failure.Siavash Eliasi2014-02-281-2/+6
| | | | Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
* gbm: explicitly set __DRIimageLoaderExtension membersEmil Velikov2014-02-231-3/+4
| | | | | Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
* gbm: explicitly set __DRIdri2LoaderExtension membersEmil Velikov2014-02-231-4/+5
| | | | | Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>y
* gbm: use the loader util libEmil Velikov2014-01-183-94/+2
| | | | | | | | | | | | | | | | | | | Additionally this commit removes the following exported functions _gbm_udev_device_new_from_fd() _gbm_fd_get_device_name() _gbm_log() All three were erroneously marked as exported since their inception. Neither of them has ever been a part of the API thus there should be no users of them. Cc: Chad Versace <chad.versace@linux.intel.com> Cc: Kristian Høgsberg <krh@bitplanet.net> Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com> Reviewed-by: Rob Clark <robdclark@gmail.com> Reviewed-by: Kristian Høgsberg <krh@bitplanet.net> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
* egl: break instead of looping after driver is foundQuanxian Wang2013-12-191-2/+3
| | | | | | | | Stop searching for a driver after success. Signed-off-by: Quanxian Wang <quanxian.wang@intel.com> Reviewed-By: Gong, Zhigang <zhigang.gong@gmail.com> Reviewed-by: Brian Paul <brianp@vmware.com>
* gbm/dri: hide extension loader symbolsMaarten Lankhorst2013-11-251-2/+2
| | | | | | They should not be exposed. Cc: "10.0" <mesa-stable@lists.freedesktop.org>
* gbm: Add support for __DRIimage based getBuffers when availableKristian Høgsberg2013-11-122-2/+34
| | | | | | | | | | | | | | | | | | This lets us allocate color buffers as __DRIimages and pass them into the driver instead of having to create a __DRIbuffer with the flink that requires. With this patch, we can now run gbm on render-nodes. A render-node is a drm device that doesn't support modesetting and all the legacy DRI ioctls. flink is also not supported, but now that gbm doesn't need flink, we can run piglit on head-less gbm or head-less GPGPU. Signed-off-by: Kristian Høgsberg <krh@bitplanet.net> Reviewed-by: Chad Versace <chad.versace@linux.intel.com> Reviewed-by: Eric Anholt <eric@anholt.net> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> Tested-by: Jordan Justen <jordan.l.justen@intel.com> Cc: "10.0" <mesa-stable@lists.freedesktop.org>
* dri: Pass in the dlsym()ed driver extension to screen creation.Eric Anholt2013-10-242-4/+12
| | | | | | | | | | | This will allow a megadrivers build to reference the actual driver being loaded from the shared dri_util screen creation code. v2: Fix indentation, fallback case in EGL (review by Emil). Reviewed-by: Matt Turner <mattst88@gmail.com> (v1) Reviewed-by: Chad Versace <chad.versace@linux.intel.com> (v1) Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
* gbm: Add support for the new __driDriverGetExtensions interface.Eric Anholt2013-10-241-2/+15
| | | | | | | v2: Fix uninitialized variable use in the old-ABI case. Reviewed-by: Chad Versace <chad.versace@linux.intel.com> (v1) Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
* gbm-dri: Support importing RGB565 buffersKristian Høgsberg2013-10-211-0/+3
|
* gbm: Add support for gbm bos and surfaces using GBM_FORMAT_ARGB2101010Kristian Høgsberg2013-10-151-0/+6
| | | | | | | | We can now add GBM support for the 10 bit/channel formats which lets us create a gbm surface that we can use with KMS for display hardware that support the format. Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
* wayland: Don't rely on static variable for identifying wl_drm buffersKristian Høgsberg2013-10-112-1/+6
| | | | | | | | | | | | Now that libEGL has been fixed to not leak all kinds of symbols, gbm links to its own copy of the libwayland-drm.a helper library. That means we can't rely on comparing the addresses of a static vtable symbol in that library to determine if a wl_buffer is a wl_drm_buffer. Instead, we move the vtable into the wl_drm struct and use that for comparing. https://bugs.freedesktop.org/show_bug.cgi?id=69437 Cc: 9.2 <mesa-stable@lists.freedesktop.org>
* egl: Update to Wayland 1.2 server APIAnder Conselvan de Oliveira2013-08-071-2/+3
| | | | | | | | | | Since Wayland 1.2, struct wl_buffer and a few functions are deprecated. References to wl_buffer are replaced with wl_resource and some getter functions and calls to deprecated functions are replaced with the proper new API. The latter changes are related to resource versioning. Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
* gbm: Remember to init format on gbm_dri_bo_create.Daniel van Vugt2013-02-071-0/+2
| | | | https://bugs.freedesktop.org/show_bug.cgi?id=60143
* Remove gbm's unused Makefile.templateMatt Turner2013-01-101-55/+0
|
* gbm: Use the kms dumb ioctls for cursor instead of libkmsKristian Høgsberg2012-10-212-48/+77
| | | | | | We need to create bos suitable for cursor usage that we can map and write data into. The kms dumb ioctls is all we need for this, so drop the dependency on libkms.
* gbm: Reject buffers that are not wl_drm buffers in gbm_bo_import()Kristian Høgsberg2012-10-151-0/+3
| | | | Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
* dri: Rework planar image interfaceJakob Bornecrantz2012-08-311-20/+13
| | | | | | | | | | | | | | | | | | | | | | As discussed with Kristian on #wayland. Pushes the decision of components into the dri driver giving it greater freedom to allow t to implement YUV samplers in hardware, and which mode to use. This interface will also allow drivers like SVGA to implement YUV surfaces without the need to sub-allocate and instead send 3 seperate buffers for each channel, currently not implemented. I have tested these changes on Gallium Svga. Scott tested them on both intel and Gallium Radeon. Kristan and Pekka tested them on intel. v2: Fix typo in dri2_from_planar. v3: Merge in intel changes. Tested-by: Scott Moreau <oreaus@gmail.com> Tested-by: Pekka Paalanen <ppaalanen@gmail.com> Tested-by: Kristian Høgsberg <krh@bitplanet.net> Reviewed-by: Kristian Høgsberg <krh@bitplanet.net> Signed-off-by: Jakob Bornecrantz <jakob@vmware.com>
* dri: Make query image WIDTH and HEIGHT be version 4Jakob Bornecrantz2012-08-261-0/+4
| | | | | Tested-by: Scott Moreau <oreaus@gmail.com> Signed-off-by: Jakob Bornecrantz <jakob@vmware.com>
* dri: Remove image write functionJakob Bornecrantz2012-08-261-2/+0
| | | | | | | | Since its not used by anything anymore and no release has gone out where it was being used. Tested-by: Scott Moreau <oreaus@gmail.com> Signed-off-by: Jakob Bornecrantz <jakob@vmware.com>
* gbm: Use libkms to replace DRI cursor imagesJakob Bornecrantz2012-08-262-11/+62
| | | | | | | | | | | | | | Uses libkms instead of dri image cursor. Since this is the only user of the DRI cursor and write interface we can remove cursor surfaces entirely from the DRI interface and as a consequence also from the Gallium interface as well. Tho to make everybody happy with this it would probably should add a kms_bo_write function, but that is probably wise in anyways. The only downside is that it adds a dependancy on libkms, this could how ever be replaced with the dumb_bo drm ioctl interface. Tested-by: Scott Moreau <oreaus@gmail.com> Signed-off-by: Jakob Bornecrantz <jakob@vmware.com>