summaryrefslogtreecommitdiffstats
path: root/src/gbm
Commit message (Collapse)AuthorAgeFilesLines
* meson: Use consistent style for testsDylan Baker2018-01-111-1/+2
| | | | | | | Don't use intermediate variables, use consistent whitespace. Acked-by: Eric Engestrom <[email protected]> Signed-off-by: Dylan Baker <[email protected]>
* meson: add dep_thread to every lib that includes threads.hEric Engestrom2017-12-071-1/+1
| | | | | | Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104141 Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Dylan Baker <[email protected]>
* wayland-drm: static inline wayland_drm_buffer_getEmil Velikov2017-11-082-4/+2
| | | | | | | | | | | | | | | | | | | | The function is effectively a direct function call into libwayland-server.so. Thus GBM no longer depends on the wayland-drm static library, making the build more straight forward. And the resulting binary is a bit smaller. Note: we need to move struct wayland_drm_callbacks further up, otherwise we'll get an error since the type is incomplete. v2: Rebase, beef-up commit message, update meson, move struct wayland_drm_callbacks. Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Daniel Stone <[email protected]> (v1) Reviewed-by: Eric Engestrom <[email protected]> # meson bit only Acked-by: Eric Engestrom <[email protected]> # for the rest Reviewed-by: Dylan Baker <[email protected]> # meson
* meson: standardize .so version to major.minor.patchEric Engestrom2017-11-071-1/+1
| | | | | | | | | | | | | | This `version` field defines the filename for the .so. The plan .so as well as .so.$major are always symlinks to this. Unless I'm mistaken, only the major is ever used, so this shouldn't matter, but for consistency with autotools (and in case it does matter), let's always have all 3 major.minor.patch components. (The soname isn't affected, and is always .so.$major) Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Dylan Baker <[email protected]>
* gbm: Don't traverse backwards for includesDylan Baker2017-11-023-5/+10
| | | | | | | | | | | | | | This is just a bad idea and should be avoided. Instead, make the #include flat and fix the build systems to pass the proper -I flags v2: - add an inc_wayland_drm instead passing a path to include_directories (Emil) - update commit message (Emil) Signed-off-by: Dylan Baker <[email protected]> Reviewed-by: Emil Velikov <[email protected]> Reviewed-by: Daniel Stone <[email protected]> (v1) Reviewed-by: Eric Engestrom <[email protected]> (v1)
* meson: pass correct args to gbm symbol testEric Engestrom2017-10-311-2/+4
| | | | | | Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Dylan Baker <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* gbm: fail symbol check if lib is missingEric Engestrom2017-10-311-1/+10
| | | | | | Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Dylan Baker <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* meson: set visibility flags on gbmDylan Baker2017-10-311-1/+1
| | | | | | | | | This is done in autotools, and is an oversight in the meson build. Signed-off-by: Dylan Baker <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Eric Engestrom <[email protected]> Tested-by: Eric Engestrom <[email protected]>
* meson: Don't link gbm with threadsDylan Baker2017-10-311-1/+1
| | | | | | | | | | It's supposed to be linked with pthread-stubs (if the platform needs pthread-stubs). Pthread stubs support isn't (yet) implemented in the meson build, so add a TODO. Signed-off-by: Dylan Baker <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* meson: build libEGLDylan Baker2017-10-201-2/+10
| | | | | | | | | | | | | | | | | | This is based heavily on Daniel Stone's work for the same, rebased on master and with a number of TODO's fixed. This does not implement glvnd (which is coming in a later patch) Meson builds egl slightly differently than autotools, namely it doesn't build an intermediate shared library. It doesn't do this because meson doesn't have problems with the name of the library being dynamically generated, so the glvnd and non-glvnd code can follow the same path. v2: - Don't reuse variable (Eric E.) Signed-off-by: Dylan Baker <[email protected]> Tested-by: Eric Engestrom <[email protected]> Reviewed-by: Daniel Stone <[email protected]>
* meson: build gbmDylan Baker2017-10-091-0/+67
| | | | | | | | | | | | | This doesn't include egl support, just dri support. v2: - when gbm is set to 'auto', only build if a dri driver is also enabled - Fix conditional to check for x11 modules with vulkan as well as with dri drivers v3: - Set pkgconfig libraries.private value Signed-off-by: Dylan Baker <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* configure.ac: split the wayland client/server confusionEmil Velikov2017-09-191-2/+2
| | | | | | | | | | | | | | | | | | | | At the moment wayland-clients, such as the Vulkan drivers were over-linking against libwayland-server.so. That went unnoticed, since both client and server code uses the wl*interface symbols, which are present in both libwayland-client.so and libwayland-server.so. I've looked at correcting that, although that's orthogonal to this fix. Note: wayland-egl does _not_ depend on wayland-client, although it does need wayland-egl.h. There's no distinct package that provides it (I have a WIP on the topic) so current solution will do for now. v2: Rebase with the "...inline wayland_drm_buffer_get" patch removed. Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Daniel Stone <[email protected]>
* gbm: Add gbm_device_get_format_modifier_plane_count to testGert Wollny2017-09-171-0/+1
| | | | | | | | | | | | | Adding gbm_device_get_format_modifier_plane_count made the test gbm-symbols-check fail, this patch adds the according function name to the test. Fixes: 8824141b8d48d9120ddbf542d6fb661046c41c62 (gbm: Add a gbm_device_get_format_modifier_plane_count function) Signed-off-by: Gert Wollny <[email protected]> Reviewed-by: Eric Engestrom <[email protected]> Reviewed-by: Andres Gomez <[email protected]>
* gbm: Add a gbm_device_get_format_modifier_plane_count functionJason Ekstrand2017-09-144-0/+48
| | | | | | | | This allows the user to query the number of planes required by a given format+modifier combination without having to create a bo or surface. Reviewed-by: Emil Velikov <[email protected]> Reviewed-by: Daniel Stone <[email protected]>
* gbm: turn GBM_ALWAYS_SOFTWARE into a booleanEric Engestrom2017-09-123-3/+9
| | | | | | | Instead of setting based on set/unset, allow users to use boolean values. Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* loader: rework xmlconfig dependencyEmil Velikov2017-08-041-0/+1
| | | | | | | | | | | | | | | | | | | | | | Currently xmlconfig is conditionally used, only when --enable-dri is available. As the library has moved to src/util and has wider wisebase, this guard is no longer correct. Strictly speaking - it wasn't since the introduction of xmlconfig into st/nine a while ago. Unconditionally enable xmlconfig and drop the linking. As said before there's other users of the library, so depending on the configure options we will get multiple definitions of said symbols. NOTE: To avoid breaking other combinations, this commit adds the xmlconfig link to the required places - throughout gallium and the DRI loaders. Cc: Aaron Watry <[email protected]> Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]> Tested-by: Dieter Nützel <[email protected]>
* gbm: add gbm_bo_get_bpp()Eric Engestrom2017-08-013-0/+70
| | | | | Signed-off-by: Eric Engestrom <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* gbm: fix typoEric Engestrom2017-07-191-1/+1
| | | | Signed-off-by: Eric Engestrom <[email protected]>
* gbm: fix typo in doxygen commentGwan-gyeong Mun2017-07-191-2/+2
| | | | | | | This fixes the misspelling of gbm_bo_import api param. Signed-off-by: Mun Gwan-gyeong <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* gbm: Remove is_planar_format dead codeDaniel Stone2017-07-181-30/+0
| | | | | | | | | | This was only used in create_dumb() to blacklist planar formats. However, the start of the function already whitelists ARGB8888 (cursor) and XRGB8888 (scanout), and nothing else. So this entire function can be removed. Reviewed-by: Lucas Stach <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* gbm: Check harder for supported formatsDaniel Stone2017-07-181-15/+26
| | | | | | | | | | Luckily no-one really used the is_format_supported() call, because it only supported three formats. Also, since buffers with alpha can be displayed on planes, stop banning them from use. Reviewed-by: Emil Velikov <[email protected]>
* gbm: Pull out FourCC <-> DRIimage format tableDaniel Stone2017-07-182-85/+70
| | | | | | | Rather than duplicated (yet asymmetric) open-coded tables, pull them out to a common structure. Reviewed-by: Emil Velikov <[email protected]>
* gbm: Axe buffer import format conversion tableDaniel Stone2017-07-182-40/+28
| | | | | | | | | | | | | Wayland buffers coming from wl_drm use the WL_DRM_FORMAT_* enums, which are identical to GBM_FORMAT_*. Similarly, FD imports do not need to convert between GBM and DRI FourCC, since they are (almost) completely compatible. This widens the formats accepted by gbm_bo_import() when importing wl_buffers; previously, only XRGB8888, ARGB8888, RGB565 and YUYV were supported. Reviewed-by: Emil Velikov <[email protected]>
* gbm: add XBGR8888 support for dumb buffersRob Herring2017-06-301-1/+1
| | | | | | | | | Add GBM_FORMAT_XBGR8888 format support which is needed for Android. Signed-off-by: Rob Herring <[email protected]> Reviewed-by: Tapani Pälli <[email protected]> Reviewed-by: Daniel Stone <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* Android: use symlinks for driver loadingRob Herring2017-06-291-9/+0
| | | | | | | | | Instead of having special driver loading logic for Android, create symlinks to gallium_dri.so so we can use the standard loading logic. Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Emil Velikov <[email protected]> Signed-off-by: Rob Herring <[email protected]>
* gbm: implement FD import with modifierLucas Stach2017-06-151-0/+54
| | | | | | | | | | This implements a way to import FDs with modifiers on plain GBM devices, without the need to go through EGL. This is mostly to the benefit of gbm_gralloc, which can keep its dependencies low. Signed-off-by: Lucas Stach <[email protected]> Tested-by: Robert Foss <[email protected]> Reviewed-by: Daniel Stone <[email protected]>
* gbm: add API to to import FD with modifierLucas Stach2017-06-151-0/+12
| | | | | | | | | This allows to import an FD with an explicit modifier passed through userspace protocols. Signed-off-by: Lucas Stach <[email protected]> Tested-by: Robert Foss <[email protected]> Reviewed-by: Daniel Stone <[email protected]>
* gbm: manage only the required set of DRI extensionsEmil Velikov2017-05-292-2/+0
| | | | | | | | | | | | | | | | Currently GBM attempts to know all the extensions that might be required by EGL/DRM [at some later stage]. That is a bit unclear and we often forget to update GBM as EGL gets attention. To avoid that, simply let EGL manage it's own required extensions based on the base primitive (screen) we provide it. v2: Rework the approach - GBM should not dive into EGL/DRM. Signed-off-by: Emil Velikov <[email protected]> Tested-by: Rob Herring <[email protected]>
* gbm: remove unneeded gbm_drm_device abstractionEmil Velikov2017-05-294-74/+27
| | | | | Signed-off-by: Emil Velikov <[email protected]> Tested-by: Rob Herring <[email protected]>
* gbm: move gbm_drm_device::driver_name to gbm_dri_deviceEmil Velikov2017-05-293-10/+10
| | | | | | | | | | | The former already keeps track of the DRI module opened, based on the driver_name provided. So let's keep them together. As a nice bonus this Will allows us to remove the gbm_drm_device all together with next patch. Signed-off-by: Emil Velikov <[email protected]> Tested-by: Rob Herring <[email protected]>
* gbm: remove "struct gbm_drm_bo" abstractionEmil Velikov2017-05-293-31/+27
| | | | | | | | The struct is a simple wraper around gbm_bo and brings no actual benefit. Signed-off-by: Emil Velikov <[email protected]> Tested-by: Rob Herring <[email protected]>
* gbm: remove unused gbm_dri_device::loaderEmil Velikov2017-05-291-1/+0
| | | | | | | | | | | Introduced back in 2012 with fd6acb97fb9 ("gbm: Create hooks for dri2_loader_extension in dri backend") and hasn't been used since. Seemingly a copy/paste thinko from development stage. Cc: Ander Conselvan de Oliveira <[email protected]> Signed-off-by: Emil Velikov <[email protected]> Tested-by: Rob Herring <[email protected]>
* configure: set HAVE_foo_PLATFORM as applicableEmil Velikov2017-05-191-1/+0
| | | | | | | | | | Rather than having multiple places that define the macros, do it just once in configure. Makes existing code a bit shorter and easier to manage as we fix the VL targets with follow-up commits. Cc: [email protected] Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Eric Engestrom <[email protected]>
* gbm/dri: Fix sign-extension in modifier queryDaniel Stone2017-05-021-1/+1
| | | | | | | | | | | | | When we were assembling the unsigned 64-bit query return from its two signed 32-bit component parts, the lower half was getting sign-extended into the top half. Be more explicit about what we want to do. Fixes gbm_bo_get_modifier() returning ((1 << 64) - 1) rather than ((1 << 56) - 1), i.e. DRM_FORMAT_MOD_INVALID. Signed-off-by: Daniel Stone <[email protected]> Reviewed-by: Ben Widawsky <[email protected]>
* gbm: Assert modifiers and count are copaceticBen Widawsky2017-04-091-0/+3
| | | | | | | | | | | | | The API/entry point in mesa already checks the correct behavior, however, it's possible to be handled by another implementation and those implementations should not be able to abuse a weird combination of count and pointer. This fixes CID 1403193 Cc: Mark Janes <[email protected]> Signed-off-by: Ben Widawsky <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* gbm/dri: Check dri extension version before flush after unmapThomas Hellstrom2017-03-311-2/+3
| | | | | | | | | | | | | | The commit mentioned below required the __DRI2FlushExtension to have version 4 or above, for GBM functionality. That broke GBM with some classic dri drivers. Relax that requirement so that we only flush after unmap if we have version 4 or above. Drivers that require the flush for correct functionality should implement the desired version. Fixes: ba8df228 ("gbm/dri: Flush after unmap") Cc: <[email protected]> Signed-off-by: Thomas Hellstrom <[email protected]> Reviewed-by: Emil Velikov <[email protected]> Tested-by: Dylan Baker <[email protected]>
* gbm/dri: Flush after unmapThomas Hellstrom2017-03-291-1/+8
| | | | | | | | | | | | | | Drivers may queue dma operations on the context at unmap time so we need to flush to make sure the data gets to the bo. Ideally the application would take care of this, but since there appears to be no exported gbm flush functionality we need to explicitly flush at unmap time. This fixes a problem where kmscube on vmwgfx in rgba textured mode would render using an uninitialized texture rather than the intended rgba pattern. Signed-off-by: Thomas Hellstrom <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* gbm: Use unsigned for BO offset getterDaniel Stone2017-03-234-12/+13
| | | | | | | | | | | | | | | | The actual offset returned is uint32_t, however int64_t was used as the return type from gbm_bo_get_offset to allow negative returns to signal errors to the caller. In case of an error getting the offset, the user will also be unable to get the handle/FD, and thus have nothing to offset into. This means that returning 0 as an error value is harmless, allowing us to change the return type to uint32_t in order to avoid signed/unsigned confusion in callers. Signed-off-by: Daniel Stone <[email protected]> Cc: Ben Widawsky <[email protected]> Cc: Jason Ekstrand <[email protected]>
* gbm: Disallow INVALID modifiers returned upon image creationBen Widawsky2017-03-211-0/+32
| | | | | | | v2: Add a TODO about modifier validation (Jason) Signed-off-by: Ben Widawsky <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* 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]>