aboutsummaryrefslogtreecommitdiffstats
path: root/src/gbm
Commit message (Collapse)AuthorAgeFilesLines
* gbm: Export a get modifiersBen Widawsky2017-03-155-0/+66
| | | | | | | | | | | | | | | | | | | | | | | | | This patch originally had i965 specific code and was named: commit 61cd3c52b868cf8cb90b06e53a382a921eb42754 Author: Ben Widawsky <[email protected]> Date: Thu Oct 20 18:21:24 2016 -0700 gbm: Get modifiers from DRI To accomplish this, two new query tokens are added to the extension: __DRI_IMAGE_ATTRIB_MODIFIER_UPPER __DRI_IMAGE_ATTRIB_MODIFIER_LOWER The query extension only supported 32b queries, and modifiers are 64b, so we needed two of them. NOTE: The extension version is still set to 13, so none of this will actually be called. v2: Error handling of queryImage (Emil) Signed-off-by: Ben Widawsky <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* gbm: Introduce modifiers into surface/bo creationBen Widawsky2017-03-155-12/+116
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The idea behind modifiers like this is that the user of GBM will have some mechanism to query what properties the hardware supports for its BO or surface. This information is directly passed in (and stored) so that the DRI implementation can create an image with the appropriate attributes. A getter() will be added later so that the user GBM will be able to query what modifier should be used. Only in surface creation, the modifiers are stored until the BO is actually allocated. In regular buffer allocation, the correct modifier can (will be, in future patches be chosen at creation time. v2: Make sure to check if count is non-zero in addition to testing if calloc fails. (Daniel) v3: Remove "usage" and "flags" from modifier creation. Requested by Kristian. v4: Take advantage of the "INVALID" modifier added by the GET_PLANE2 series. v5: Don't bother with storing modifiers for gbm_bo_create because that's a synchronous operation and we can actually select the correct modifier at create time (done in a later patch) (Jason) v6: Make modifier condition outside the check so that dri_use will work properly (Jason) Cc: Kristian Høgsberg <[email protected]> References (v4): https://lists.freedesktop.org/archives/intel-gfx/2017-January/116636.html Signed-off-by: Ben Widawsky <[email protected]> Reviewed-by: Eric Engestrom <[email protected]> (v1) Reviewed-by: Jason Ekstrand <[email protected]> Acked-by: Daniel Stone <[email protected]>
* gbm/gbm-symbols-check: do not mandate bashEmil Velikov2017-03-101-1/+1
| | | | | | | | Analogous to previous commit. Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Andreas Boll <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* gbm: Export a per plane getter for offsetBen Widawsky2017-03-095-0/+55
| | | | | | | | | | | | | | | | | | | | | Unlike stride, there was no previous offset getter, so it can be right on the first try. v2: Return EINVAL when plane is greater than total planes to make it match the similar APIs. Avoid leak after fromPlanar (Daniel) Make sure when getting offsets we consider dumb images (Daniel) v3: Use Jason's recommendation for handling the non-planar case. v4: Return int64_t so we can get real errors v5: Add an assertion for dumb BOs (Jason) Signed-off-by: Ben Widawsky <[email protected]> Reviewed-by: Eric Engestrom <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]> Acked-by: Daniel Stone <[email protected]>
* gbm: Export a per plane getter for strideBen Widawsky2017-03-094-2/+52
| | | | | | | | | | | | | | | | | | | | v2: Preserve legacy behavior when plane is 0 (Jason Ekstrand) EINVAL when input plane is greater than total planes (Jason Ekstrand) Don't leak the image after fromPlanar (Daniel) Move bo->image check below plane count preventing bad index succeeding (Daniel) v3: Fix DRIimage leak (using Jason's recommended change) Make plane 0 return planar stride. This might break legacy behavior (Jason) v4: Move bogus hunk for get_handle_for_plane to the right patch (Jason) Fix error handling path to be cleaner (Jason) v5: Add assert for dumb BOs to make sure plane == 0 (Jason) Signed-off-by: Ben Widawsky <[email protected]> Reviewed-by: Eric Engestrom <[email protected]> (v1) Reviewed-by: Jason Ekstrand <[email protected]> Acked-by: Daniel Stone <[email protected]>
* gbm: Create a gbm_device getter for strideBen Widawsky2017-03-093-1/+9
| | | | | | | | | This will be used so we can query information per plane. Signed-off-by: Ben Widawsky <[email protected]> Reviewed-by: Eric Engestrom <[email protected]> Cc: Jason Ekstrand <[email protected]> Acked-by: Daniel Stone <[email protected]>
* gbm: Export a getter for per plane handlesBen Widawsky2017-03-095-0/+61
| | | | | | | | | | | | | | | | | | | | v2: Make the error return be -1 instead of 0 because I think 0 is actually valid. v3: Set errno to EINVAL when the specified plane is above the total planes. (Jason Ekstrand) Return the bo's handle if there is no image ie. for dumb images like cursor (Daniel) v4: - Add assertions about plane == 0 (Jason) - Add a comment about new restriction on planar dumb bo which is not an earlier patch in the series. - Correctly refactor from v2 in this patch; it ended up rebased into the wrong patch. Signed-off-by: Ben Widawsky <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]> Acked-by: Daniel Stone <[email protected]>
* gbm: Export a plane getter functionBen Widawsky2017-03-095-0/+42
| | | | | | | | | | | | | | This will be used by clients that need to know the number of planes allocated for them on behalf of the GL or other API. The best current example of this is when an extra "plane" is allocated to store compression data for the primary plane. v2: Return 1 for cases where there is no image, ie. dumb bo (Daniel) Signed-off-by: Ben Widawsky <[email protected]> Reviewed-by: Eric Engestrom <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]> Acked-by: Daniel Stone <[email protected]>
* gbm: Explicitly disallow a planar dumb BOBen Widawsky2017-03-091-0/+31
| | | | | | | | | | | | As more GBM functionality support planes is being evaluated, it becomes clear that a dumb bo can never actually be planar. It's questionable whether it was ever feasible to do this, and later functionality will implicitly assume a dumb BO is non-planar. v2: Include stdbool.h Signed-off-by: Ben Widawsky <[email protected]> Acked-by: Daniel Stone <[email protected]>
* gbm/dri: fix memory leaks in error pathEric Engestrom2017-01-271-1/+6
| | | | | | Signed-off-by: Eric Engestrom <[email protected]> [Emil Velikov: make sure it builds] Signed-off-by: Emil Velikov <[email protected]>
* gbm: Fix width height getters return type (trivial)Ben Widawsky2017-01-231-2/+2
| | | | | | | | | | v2: Other way round... to make consistent, make both return type have the fixed width - uint32_t. Cc: Daniel Stone <[email protected]> Signed-off-by: Ben Widawsky <[email protected]> Reviewed-by: Eric Engestrom <[email protected]> Acked-by: Daniel Stone <[email protected]>
* gbm: Move getters to match order in header file (trivial)Ben Widawsky2017-01-231-11/+11
| | | | | | | | | | | | Other things are out of order, but I need to add a getter so I'm just fixing those. This helps people adding to GBM know where the right place to put things is. Signed-off-by: Ben Widawsky <[email protected]> Reviewed-by: Eric Engestrom <[email protected]> Acked-by: Daniel Stone <[email protected]>
* gbm: request correct version of the DRI2_FENCE extensionLucas Stach2016-11-221-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" <[email protected]> Signed-off-by: Lucas Stach <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* gbm: automake: remove unused definesEmil Velikov2016-11-211-2/+0
| | | | | Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Eduardo Lima Mitev <[email protected]>
* dri: make use of loader_get_extensions_name(..) helperChristian Gmeiner2016-11-151-2/+2
| | | | | | | | | | | | Changes since v1: - removed not needed includes - use the loader version of the helper v2 [Emil Velikov] - Keep the includes - they are required. Signed-off-by: Christian Gmeiner <[email protected]> Signed-off-by: Emil Velikov <[email protected]>
* Revert "dri: make use of dri_get_extensions_name(..) helper"Emil Velikov2016-11-151-3/+2
| | | | | | This reverts commit 1a21d21580965eff751414d140b3c176eeee2eb3. Pushed the wrong version of the patch.
* dri: make use of dri_get_extensions_name(..) helperChristian Gmeiner2016-11-151-2/+3
| | | | | Signed-off-by: Christian Gmeiner <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* gbm: set up the interop extension for egl/drmMarek Olšák2016-11-012-0/+2
| | | | | | | breaking libgbm -> libEGL ABI? Acked-by: Alex Deucher <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* 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 <[email protected]> Reviewed-by: Axel Davy <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
* gbm: remove superfluous/incorrect udev commentEmil Velikov2016-10-181-1/+0
| | | | | | | | | | The gbm_device_get_backend_name() provides an (somewhat) internal name of the implementation/backend used. Is has nothing to do with the udev, one cannot and should not attempt to derive the name from it. Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Axel Davy <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
* gbm: add a couple missing includesEric Engestrom2016-10-171-0/+2
| | | | | | | Needed for memset() and drmIoctl(). Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Edward O'Callaghan <[email protected]>
* 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 <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* gbm: return appropriate error when queryImage() failsNicholas Bishop2016-09-272-2/+4
| | | | | | | | | | | | | | 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: [email protected] Signed-off-by: Nicholas Bishop <[email protected]> Reviewed-by: Eric Engestrom <[email protected]> (v1) [Emil Velikov: Split from larger patch, polish coding style, cc stable] Signed-off-by: Emil Velikov <[email protected]>
* gbm: remove left-over arrayEric Engestrom2016-09-141-12/+0
| | | | | | | | e7c8c85785b3a8f29e3f ("gbm: Removed unused function.") forgot to remove the global array used only by that function. Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* 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: <[email protected]> Signed-off-by: Chuanbo Weng <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* 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 <[email protected]>
* gbm: add missing R8 and GR88 formatsRob Clark2016-09-072-1/+13
| | | | | Reviewed-by: Eric Engestrom <[email protected]> Signed-off-by: Rob Clark <[email protected]>
* gbm: Correct bo_import documentation (trivial)Ben Widawsky2016-08-031-1/+1
| | | | | | | | | | | | | | Missed here: commit a43d286ef7ff65087b1f051d071b829ca7b02073 Author: Kristian Høgsberg <[email protected]> Date: Fri Mar 28 10:17:11 2014 -0700 gbm: Add import from fd Cc: Kristian Høgsberg <[email protected]> Signed-off-by: Ben Widawsky <[email protected]> Signed-off-by: Eric Anholt <[email protected]> Reviewed-by: Alejandro Piñeiro <[email protected]>
* gbm: Removed unused function.Ben Widawsky2016-08-012-29/+0
| | | | | | | | | | | | | | AFAICT, it's never been used. It was briefly nudged in the right direction here: commit 10e5ffd4961055ebba5be4d85a93cc66cdd5a635 Author: Emil Velikov <[email protected]> Date: Sat Jan 25 17:19:10 2014 +0000 gbm: do not export _gbm_mesa_get_device Signed-off-by: Ben Widawsky <[email protected]> Reviewed-by: Kristian H. Kristensen <[email protected]>
* mesa: Use AC_HEADER_MAJOR to include correct header for major().Matt Turner2016-07-261-1/+6
| | | | | | Gentoo has been smoke testing an upcoming change to glibc. Bugzilla: https://bugs.gentoo.org/show_bug.cgi?id=580392
* gbm: Fix commentsGurkirpal Singh2016-06-231-2/+2
| | | | Reviewed-by: Chad Versace <[email protected]>
* gbm: doc fixesEric Engestrom2016-06-232-4/+4
| | | | | Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Chad Versace <[email protected]>
* Remove wrongly repeated words in commentsGiuseppe Bilotta2016-06-231-1/+1
| | | | | | | | | | | | | | | | | Clean up misrepetitions ('if if', 'the the' etc) found throughout the comments. This has been done manually, after grepping case-insensitively for duplicate if, is, the, then, do, for, an, plus a few other typos corrected in fly-by v2: * proper commit message and non-joke title; * replace two 'as is' followed by 'is' to 'as-is'. v3: * 'a integer' => 'an integer' and similar (originally spotted by Jason Ekstrand, I fixed a few other similar ones while at it) Signed-off-by: Giuseppe Bilotta <[email protected]> Reviewed-by: Chad Versace <[email protected]>
* Android: move libdrm settings to top-level Android.common.mkRob Herring2016-06-131-1/+0
| | | | | | | | | | | | | | Fix warnings like these due to HAVE_LIBDRM being inconsistently defined: external/libdrm/include/drm/drm.h:839:30: warning: redefinition of typedef 'drm_clip_rect_t' is a C11 feature [-Wtypedef-redefinition] typedef struct drm_clip_rect drm_clip_rect_t; HAVE_LIBDRM needs to be set project wide to fix this. This change also harmlessly links libdrm with everything, but simplifies the makefiles a bit. Signed-off-by: Rob Herring <[email protected]> Acked-by: Emil Velikov <[email protected]>
* gbm: remove define _DEFAULT_SOURCEEmil Velikov2016-05-231-2/+0
| | | | | | | The build systems already add this as applicable. There's no need to have this in the source file. Signed-off-by: Emil Velikov <[email protected]>
* gbm: remove define _BSD_SOURCEEmil Velikov2016-05-231-1/+0
| | | | | | | The build systems already add this as applicable. There's no need to have this in the source file. Signed-off-by: Emil Velikov <[email protected]>
* gbm: Add map/unmap functionsRob Herring2016-05-237-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 <[email protected]> [Emil Velikov: drop no longer relevant hunk from commit message.] Reviewed-by: Emil Velikov <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* 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 <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* gbm: Add Android build supportRob Herring2016-05-231-0/+44
| | | | | | | | In order to use libgbm for gralloc, add it to the Android build. Signed-off-by: Rob Herring <[email protected]> Reviewed-by: Emil Velikov <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* 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 <[email protected]> Reviewed-by: Emil Velikov <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* gbm: split out source file to Makefile.sourcesRob Herring2016-05-232-8/+15
| | | | | | | | | | | In preparation to add Android build support, split out the source file lists to Makefile.sources Signed-off-by: Rob Herring <[email protected]> Reviewed-by: Eric Anholt <[email protected]> [Emil Velikov: Whitespace cleanup.] Signed-off-by: Emil Velikov <[email protected]>
* automake: drop "EGL_" from HAVE_EGL_PLATFORM_WAYLANDEmil Velikov2016-05-011-1/+1
| | | | | | Analogous to previous commit. Signed-off-by: Emil Velikov <[email protected]>
* 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 <[email protected]> Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* gbm: do not wrap header inclusion in extern "C"Emil Velikov2016-03-091-5/+5
| | | | Signed-off-by: Emil Velikov <[email protected]>
* gbm.h: Add a missing stddef.h include for size_t.Emmanuel Gil Peyrot2015-10-301-0/+1
| | | | | | | | This was causing compilation issues when one of its providers wasn’t already included before gbm.h. Cc: "11.0" <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* 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" <[email protected]> Reviewed-by: Emil Velikov <[email protected]> Reviewed-by: Kristian Høgsberg <[email protected]>
* mesa/gbm: Resolve GCC sign-compare warning.Rhys Kidd2015-08-181-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 <[email protected]> Reviewed-by: Thomas Helland <[email protected]>
* gbm: do not build intermittent libgbm_dri static libraryEmil Velikov2015-07-221-5/+2
| | | | | | | | The only user of it (libgbm.la) immediately links it. Just build it directly into the library. Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* mesa: Enable subdir-objects globally.Matt Turner2015-06-261-2/+0
| | | | Reviewed-by: Emil Velikov <[email protected]>
* gbm: do not (over)link against libglapi.soEmil Velikov2015-06-231-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" <[email protected]> Signed-off-by: Emil Velikov <[email protected]>