summaryrefslogtreecommitdiff
path: root/src/gbm
AgeCommit message (Collapse)AuthorFilesLines
2016-05-23gbm: Add map/unmap functionsRob Herring7-2/+165
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>
2016-05-23gbm: rename gbm_dri_bo_{map,unmap} to gbm_dri_bo_{map,unmap}_dumbRob Herring2-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>
2016-05-23gbm: Add Android build supportRob Herring1-0/+44
In order to use libgbm for gralloc, add it to the Android build. Signed-off-by: Rob Herring <robh@kernel.org> Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com> Reviewed-by: Eric Anholt <eric@anholt.net>
2016-05-23gbm: add Android gallium_dri.so library loading supportRob Herring1-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>
2016-05-23gbm: split out source file to Makefile.sourcesRob Herring2-8/+15
In preparation to add Android build support, split out the source file lists to Makefile.sources Signed-off-by: Rob Herring <robh@kernel.org> Reviewed-by: Eric Anholt <eric@anholt.net> [Emil Velikov: Whitespace cleanup.] Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2016-05-01automake: drop "EGL_" from HAVE_EGL_PLATFORM_WAYLANDEmil Velikov1-1/+1
Analogous to previous commit. Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
2016-04-21gbm: add GBM_FORMAT_XBGR8888 format supportRob Herring1-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>
2016-03-09gbm: do not wrap header inclusion in extern "C"Emil Velikov1-5/+5
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
2015-10-30gbm.h: Add a missing stddef.h include for size_t.Emmanuel Gil Peyrot1-0/+1
This was causing compilation issues when one of its providers wasn’t already included before gbm.h. Cc: "11.0" <mesa-stable@lists.freedesktop.org> Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2015-09-15gbm: convert gbm bo format to fourcc format on dma-buf importRay Strode1-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>
2015-08-18mesa/gbm: Resolve GCC sign-compare warning.Rhys Kidd1-2/+2
mesa/src/gbm/main/backend.c: In function 'find_backend': mesa/src/gbm/main/backend.c:70:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (i = 0; i < ARRAY_SIZE(backends); ++i) { ^ mesa/src/gbm/main/backend.c: In function '_gbm_create_device': mesa/src/gbm/main/backend.c:95:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (i = 0; i < ARRAY_SIZE(backends) && dev == NULL; ++i) { ^ Signed-off-by: Rhys Kidd <rhyskidd@gmail.com> Reviewed-by: Thomas Helland <thomashelland90@gmail.com>
2015-07-22gbm: do not build intermittent libgbm_dri static libraryEmil Velikov1-5/+2
The only user of it (libgbm.la) immediately links it. Just build it directly into the library. Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com> Reviewed-by: Matt Turner <mattst88@gmail.com>
2015-06-26mesa: Enable subdir-objects globally.Matt Turner1-2/+0
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
2015-06-23gbm: do not (over)link against libglapi.soEmil Velikov1-1/+2
The whole of GBM does not rely on even a single symbol from the GL dispatch library, unsuprisingly. The only need for it comes from the unresolved symbols in the DRI modules, which are now correctly handled with Frank's commit. Cc: "10.5 10.6" <mesa-stable@lists.freedesktop.org> Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2015-06-23gbm: dlopen libglapi so gbm_create_device worksFrank Henigman1-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>
2015-04-16gbm: Add GBM_BO_USE_LINEAR flagFlora Cui2-0/+6
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>
2015-03-24gbm: remove gbm_gallium_drm from the loaderEmil Velikov1-24/+0
No longer used as of commit 48c7461d5a0(st/gbm: remove state-tracker) v2: Add commit message. Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com> Reviewed-by: Kristian Høgsberg <krh@bitplanet.net> (v1)
2015-01-16gbm: Define _DEFAULT_SOURCE to avoid warningKristian Høgsberg1-0/+1
glibc 2.19 introduced _DEFUAULT_SOURCE as a replacement for _BSD_SOURCE, and deprecates _BSD_SOURCE with an annoying warning. Defining both is how you're supposed to transition so let's do that. It gets rid of the warning and we can figure out when/if we can drop _BSD_SOURCE later. Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
2015-01-16gbm/dri: Fix const confusionKristian Høgsberg1-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>
2014-12-17gbm: remove support for GCC older than 4.1.0Timothy Arceri1-1/+1
Signed-off-by: Timothy Arceri <t_arceri@yahoo.com.au> Reviewed-By: Jose Fonseca <jfonseca@vmware.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Matt Turner <mattst88@gmail.com>
2014-12-12egl+gbm: Add symbols-check tests to distribution.Matt Turner1-0/+1
2014-11-16dri/kms: Always zero out struct drm_mode_create_dumbThierry Reding1-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>
2014-11-07gbm/dri: cleanup memory leak on teardownEmil Velikov1-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>
2014-07-30gbm: Log at least one dlerror() when we fail to open any drivers.Eric Anholt1-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>
2014-07-30gbm: Fix a debug log messageEric Anholt1-1/+1
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com> Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
2014-07-30gallium: Add a dumb drm/kms winsys backed swrast providerGiovanni Campagna1-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>
2014-07-30Add support for swrast to the DRM EGL platformGiovanni Campagna4-27/+237
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>
2014-07-24gbm: Search LIBGL_DRIVERS_PATH if GBM_DRIVERS_PATH is not setDylan Baker1-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>
2014-06-12gbm: Remove 64x64 restriction from GBM_BO_USE_CURSORMichel Dänzer3-15/+11
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>
2014-05-23Make DRI dependencies and build depend on the targetJon TURNEY1-1/+1
- Don't require xcb-dri[23] etc. if we aren't building for a target with DRM, as we won't be using dri[23] - Enable a more fine-grained control of what DRI code is built, so that a libGL using direct swrast can be built on targets which don't have DRM. The HAVE_DRI automake conditional is retired in favour of a number of other conditionals: HAVE_DRI2 enables building of code using the DRI2 interface (and possibly DRI3 with HAVE_DRI3) HAVE_DRISW enables building of DRI swrast HAVE_DRICOMMON enables building of target-independent DRI code, and also enables some makefile cases where a more detailled decision is made at a lower level. HAVE_APPLEDRI enables building of an Apple-specific direct rendering interface, still which requires additional fixing up to build properly. v2: Place xfont.c and drisw_glx.c into correct categories. Update 'make check' as well Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk> Reviewed-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com> Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
2014-04-28gbm: cleanup __DRI*extension handlingEmil Velikov2-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>
2014-04-25gbm: Set errno on errorsAnder Conselvan de Oliveira2-15/+41
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>
2014-04-25gbm/dri: Fix out-of-memory error path in dri_device_create()Ander Conselvan de Oliveira1-0/+2
Cc: "10.0" "10.1" <mesa-stable@lists.freedesktop.org> Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
2014-04-07gbm/build: Add headers to distribution.Matt Turner1-2/+8
Acked-by: Emil Velikov <emil.l.velikov@gmail.com>
2014-04-05automake: don't enable -Wl,--no-undefined on OpenBSDJonathan Gray1-1/+1
OpenBSD does not have DT_NEEDED entries for libc by design, over concerns how the symbols would be referenced after changing the major version of the library. So avoid -no-undefined checks on OpenBSD as they will fail. v2: don't include the -no-undefined libtool option in the variable and change -Wl,--no-undefined references in Automake.inc as well. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=76856 Signed-off-by: Jonathan Gray <jsg@jsg.id.au> Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com> Reviewed-by: Matt Turner <mattst88@gmail.com>
2014-04-01gbm: Add gbm_bo_get_fd to gbm-symbols-check scriptKristian Høgsberg1-0/+1
2014-04-01gbm: Add import from fdKristian Høgsberg3-2/+29
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>
2014-04-01gbm: Add gbm_bo_get_fd()Kristian Høgsberg4-0/+37
Add gbm function to get a DMA-BUF file descriptor for a gbm bo. Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
2014-03-31automake: ask the linker to do garbage collectionEmil Velikov1-0/+1
By doing GC the linker removes all the symbols that are not referenced and/or used by the final library. This results in a saving of ~100K up-to ~600K per (stripped) binary (classic vs gallium drivers). If interested one can ask the compiler to print the sections that are removed using -Wl,--print-gc-sections. v2: Check if ld supports the flag before using it. Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com> Acked-by: Matt Turner <mattst88@gmail.com> (v1)
2014-03-31automake: add -Wl,--no-undefined to all librariesEmil Velikov1-1/+3
... apart from the dri drivers. With this final change we can build mesa without fear that the resulting libraries will have unresolved symbols. Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com> Reviewed-by: Matt Turner <mattst88@gmail.com>
2014-03-31automake: consistently use -no-undefinedEmil Velikov1-1/+3
Set the flag for all but the dri targets. They have missing glapi symbols which are required for the normal operation with the X server. Jon, I fear that you'll need to carry the "no-undefined" hunk locally when building the dri drivers under cygwin. Cc: Jon TURNEY <jon.turney@dronecode.org.uk> Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com> Reviewed-by: Matt Turner <mattst88@gmail.com>
2014-03-08gbm: make 'devices' array staticJulien Cristau1-1/+1
It's only used in this one file as far as I can tell, and exporting a symbol named 'devices' from a shared library is a recipe for trouble. Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
2014-02-28gbm/dri: Fixed buffer object memory leak in case of failure.Siavash Eliasi1-2/+6
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
2014-02-28gbm: export gbm_device_is_format_supportedMarek Chalupa1-1/+1
Probably depending on compiler settings, the definition can be hidden, so undefined reference error can be encountred during linking. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=75528 Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
2014-02-23gbm: explicitly set __DRIimageLoaderExtension membersEmil Velikov1-3/+4
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2014-02-23gbm: explicitly set __DRIdri2LoaderExtension membersEmil Velikov1-4/+5
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>y
2014-02-18automake: remove leftover XORG and LIBKMS variablesEmil Velikov1-2/+0
No longer set or used since the removal of st/xorg. Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com> Reviewed-by: Matt Turner <mattst88@gmail.com>
2014-02-11gbm: automake: add symbol testsEmil Velikov2-0/+35
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2014-02-11gbm: do not export _gbm_mesa_get_deviceEmil Velikov2-2/+2
This symbol is internal and was never part of the API. Unused by any of the gbm backends, it makes sense to simply not export it. Cc: Kristian Høgsberg <krh@bitplanet.net> Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com> Reviewed-by: Matt Turner <mattst88@gmail.com>
2014-02-11gbm: automake: addEmil Velikov1-1/+2
VISIBILITY_CFLAGS Currently the library exports every symbol imaginable, rather than the ones defined by the API. Note: This may cause issues for libraries that are linking agaist libgbm's internals. Cc: Kristian Høgsberg <krh@bitplanet.net> Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com> Reviewed-by: Matt Turner <mattst88@gmail.com>