summaryrefslogtreecommitdiff
path: root/src/gbm/backends/dri/gbm_dri.c
AgeCommit message (Collapse)AuthorFilesLines
2024-02-27gbm: Remove hardcoded color-channel dataDaniel Stone1-92/+18
We don't need to write out the shifts and sizes everywhere; we already have them as part of the format description. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27709>
2024-02-27gbm/dri: Query DRIImage for FourCC directlyDaniel Stone1-15/+2
No need to go through the DRIImage format query when we can just get the FourCC directly. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27709>
2023-10-09gbm: delete some zink handlingMike Blumenkrantz1-12/+5
this has never been functional and may never be Fixes: d760a9151b7 ("gallium: Learn about kopper") Reviewed-by: Marek Olšák <marek.olsak@amd.com> Acked-by: Daniel Stone <daniels@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25526>
2023-07-28egl/drm: Assume modern DRI interface versionsDaniel Stone1-45/+9
We know we always have modern versions of DRI_IMAGE and DRI_FLUSH as we're version-locked to our same Mesa version. Signed-off-by: Daniel Stone <daniels@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24347>
2023-07-28egl/drm: Use IMAGE_DRIVER instead of DRI2_LOADERDaniel Stone1-47/+10
We always have this extension available to us, since we demand matching Mesa builds, and it's much better. Just use it always when we're not on swrast. Signed-off-by: Daniel Stone <daniels@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24347>
2023-01-12gbm: Avoid leaks on screen creation failuresCorentin Noël1-15/+10
Some of the code paths were not freeing the allocated strings, also remove the unused ret variable as we are always returning -1 on failure. Signed-off-by: Corentin Noël <corentin.noel@collabora.com> Reviewed-by: Simon Ser <contact@emersion.fr> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20667>
2022-12-09gbm: Don't look up the DRI2_FENCE extension.Emma Anholt1-1/+0
It's optional, and nothing references it. Reviewed-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20171>
2022-12-05dri: Add createNewScreen into the __DRI_MESA extension.Emma Anholt1-13/+6
Now the loaders don't have to switch on dri2/dri3/swrast. Reviewed-by: Adam Jackson <ajax@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20069>
2022-12-05dri: Introduce internal Mesa DRI driver loader extension.Emma Anholt1-0/+2
All DRI loaders in Mesa (EGL, GLX, gbm) now require this ext and that the driver come from a matching build. This will let us use Mesa-internal types and enums across the loader-driver bounary inside of Mesa. Reviewed-by: Adam Jackson <ajax@redhat.com> Acked-by: Eric Engestrom <eric@igalia.com> LOL-YESed-by: Kristian Høgsberg <krh@bitplanet.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20069>
2022-12-05gbm: Refactor screen creation a bit.Emma Anholt1-86/+42
A lot of the screen creation path was duplicated between swrast and dri2. Reviewed-by: Adam Jackson <ajax@redhat.com> Acked-by: Eric Engestrom <eric@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20069>
2022-12-05gbm: Drop redundant extension error checks.Emma Anholt1-6/+0
loader_bind_extensions error handling has already made sure these are present. Reviewed-by: Adam Jackson <ajax@redhat.com> Acked-by: Eric Engestrom <eric@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20069>
2022-12-05gbm: Promote dri_bind_extensions() to the loader util library.Emma Anholt1-46/+9
It's better than EGL's copy of it by having optional ext support in the match structs, and GLX wishes it had either of the two. Reviewed-by: Adam Jackson <ajax@redhat.com> Acked-by: Eric Engestrom <eric@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20069>
2022-12-01gbm: Bump required __DRI_IMAGE version to 6.Emma Anholt1-5/+3
That's the minimum implemented in tree (gallium swrast). Drops a few more version checks. Reviewed-by: Adam Jackson <ajax@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20044>
2022-12-01gbm: Drop support for __DRI_DRI2 < 4 and __DRI_SWRAST < 4.Emma Anholt1-20/+9
We're always loading a gallium driver built from this tree, so it's always v4. Reviewed-by: Marek Olšák <marek.olsak@amd.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20044>
2022-11-02utils: Merge util/debug.* into util/u_debug.* and remove util/debug.*Illia Abernikhin1-2/+2
Rename env_var_as_unsigned() -> debug_get_num_option(), because duplicate Rename env_var_as_bool() -> debug_get_bool_option(), because duplicate Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7177 Signed-off-by: Illia Abernikhin <illia.abernikhin@globallogic.com> Reviewed-by: Yonggang Luo <luoyonggang@gmail.com> Reviewed-by: Rob Clark <robdclark@chromium.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19336>
2022-08-05gbm: Add USE_FRONT_RENDERING flagRob Clark1-0/+2
Provide a use flag to let the driver know that the allocated buffer will be used for frontbuffer rendering. For example, bandwidth compressed formats should usually be avoided for frontbuffer rendering to avoid the visual corruption that results from this display racing with the GPU writing header data vs. pixel data. Signed-off-by: Rob Clark <robdclark@chromium.org> Reviewed-by: Emma Anholt <emma@anholt.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17799>
2022-07-27gbm: add GBM_FORMAT_[AX]BGR16161616Manuel Stoeckl1-0/+10
Signed-off-by: Manuel Stoeckl <code@mstoeckl.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14580>
2022-04-07gallium: Learn about kopperAdam Jackson1-5/+20
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14541>
2022-04-07egl: Learn about kopperAdam Jackson1-0/+1
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14541>
2021-10-27gbm: add GBM_FORMAT_GR1616 and RG1616Manuel Stoeckl1-0/+5
Only GR1616 has a corresponding DRI format. Signed-off-by: Manuel Stoeckl <code@mstoeckl.com> Reviewed-by: Simon Ser <contact@emersion.fr> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13501>
2021-10-01gbm: add gbm_{bo,surface}_create_with_modifiers2Simon Ser1-5/+0
gbm_{bo,surface}_create_with_modifiers is missing the usage flags. Add a new function which lets library users specify it. Signed-off-by: Simon Ser <contact@emersion.fr> Reviewed-by: James Jones <jajones@nvidia.com> Reviewed-by: Daniel Stone <daniels@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3197>
2021-09-09gbm/dri: implement image lookup extension version 2Qiang Yu1-2/+26
Reviewed-by: Marek Olšák <marek.olsak@amd.com> Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com> Signed-off-by: Qiang Yu <yuq825@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12336>
2021-08-06gbm: add GBM_FORMAT_R16Simon Zeni1-0/+5
Signed-off-by: Simon Zeni <simon@bl4ckb0ne.ca> Reviewed-by: Simon Ser <contact@emersion.fr> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12101>
2021-07-13gbm/dri: Fix leaking bo memory on failure pathHeinrich Fink1-1/+1
In gbm_dri_bo_create, when modifiers are requested but not supported, do not return NULL immediately, but first go to cleanup section to free already allocated buffer object. Fixes: cb9ae4273d68 ("dri: add loader_dri_create_image helper") Signed-off-by: Heinrich Fink <hfink@snap.com> Reviewed-by: Daniel Stone <daniels@collabora.com> Reviewed-by: Simon Ser <contact@emersion.fr> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11844>
2021-07-06gbm: Version the GBM backend interfaceJames Jones1-67/+76
Define a version number for the interface GBM uses to offload work to its backends/drivers. Store the version in the backend interface structs provided to the loader by backends, as well as in the core interface struct provided to backends by the GBM loader code to backends. The backend can create structures of any version it supports, which can be greater or less than the interface version specified by GBM in the core interface structure. Hence, GBM will need to take care to check the backend version before accessing any members added to structs defined in gbm_backend_abi.h after this change. Similarly, the backend may need to check the interface version supported by the GBM library before passing back data in any structure members that require the GBM library to interact with them for correct operation. For example, if for some reason a structure defined in gbm_backend_abi.h gained a field which was a pointer to memory allocated by the backend and freed by GBM, the backend should avoid allocating this memory if the GBM library did not specify an interface version new enough to indicate that it was aware of the new structure member. Signed-off-by: James Jones <jajones@nvidia.com> Reviewed-by: Michel Dänzer <mdaenzer@redhat.com> Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9902>
2021-07-06gbm: Add gbm_core struct to export code to backendsJames Jones1-7/+7
The GBM core/loader code defines one helper function used by both itself and the built-in DRI backend. Presumably, external backend authors would want to use such functions as well, so package them into a single struct that will be passed explicitly to externally loaded backends in subsequent changes. Another option considered was to simply export the gbm_format_canonicalize() function directly, optionally renaming it to better indicate it is intended only for "internal" use first. However, even with a rename, this would expose it to potential use by applications as well, which is not ideal, as it is not intended to be part of the application-facing GBM ABI. Signed-off-by: James Jones <jajones@nvidia.com> Reviewed-by: Michel Dänzer <mdaenzer@redhat.com> Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9902>
2021-05-24gbm: list to stderr all the missing extensionEmil Velikov1-0/+2
This way people have a fighting chance of figuring out what's wrong. v2: add gbm: prefix to the warning (Simon Ser) Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Simon Ser <contact@emersion.fr> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10732>
2021-05-19dri: add loader_dri_create_image helperLucas Stach1-41/+12
The DRI image extension already has two different ways to allocate an image (with and without a modifier) and will soon grow a third one. Add a helper, which handles calling the appropriate implementation to get rid of code duplication in the winsys. This convert the two obvious call sites (GBM dri and EGL wayland) that profit from the code dedup. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Reviewed-by: Daniel Stone <daniels@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8106>
2021-03-26egl: fix software flag in _eglAddDevice call on DRMSimon Ser1-2/+5
On the EGL DRM platform, call _eglAddDevice with the software flag set if GBM has loaded a software driver. This allows _eglAddDevice to make the difference between llvmpipe and kmsro. This is important on split render/display SoCs: we don't want to advertise EGL_MESA_device_software on these systems. Completely drop disp->Options.ForceSoftware, because GBM is responsible for choosing software rendering and doesn't take this hint into account. Signed-off-by: Simon Ser <contact@emersion.fr> Fixes: 5743a36b2b32 ("egl: Don't add hardware device if there is no render node v2.") References: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4178 Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9697>
2021-03-25gbm: add gbm_bo_get_fd_for_planeSimon Ser1-0/+40
This commit adds a new gbm_bo_get_fd_for_plane function, which does the same as gbm_bo_get_fd but allows specifying the plane. v2: - Rename to gbm_bo_get_fd_for_plane (Emil) Signed-off-by: Simon Ser <contact@emersion.fr> Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com> Reviewed-by: Daniel Stone <daniels@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5442>
2021-03-17gbm: remove fprintf calls in gbm_dri_bo_createSimon Ser1-2/+0
These errors can be handled by the caller. The caller can't guess whether the GBM implementation supports modifiers, for instance. Signed-off-by: Simon Ser <contact@emersion.fr> References: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7601#note_778845 Reviewed-by: Daniel Stone <daniel@fooishbar.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8715>
2021-03-17gbm: fail early when modifier list only contains INVALIDSimon Ser1-2/+10
The current check only accomodates for a list with a single INVALID item. However the driver won't be able to pick any modifier if the list only contains INVALID. This includes the following cases: - The modifier list is empty (count == 0) - The modifier list contains more than a single item, but all items are INVALID In these cases, also fail early. Signed-off-by: Simon Ser <contact@emersion.fr> References: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7601#note_778845 Reviewed-by: Daniel Stone <daniel@fooishbar.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8715>
2020-11-02egl: implement EGL_EXT_protected_surface supportPierre-Eric Pelloux-Prayer1-0/+2
Reviewed-by: Eric Engestrom <eric@engestrom.ch> Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5096>
2020-04-16gbm/dri: Propagate queryDmaBufModifiers return valueMichel Dänzer1-4/+2
We were treating count == 0 as the format not being supported at all, but queryDmaBufModifiers would return false in that case. Fixes spuriously reporting all formats as unsupported with radeonsi (which doesn't support modifiers yet), which would e.g. cause mutter to think the HW cursor format isn't supported and fall back to SW cursor. Suggested-by: Daniel Stone <daniels@collabora.com> Fixes: 4e3a7dcf6ee4 "gallium: enable EGL_EXT_image_dma_buf_import_modifiers unconditionally" Reviewed-by: Daniel Stone <daniels@collabora.com> Reviewed-by: Simon Ser <contact@emersion.fr> Reviewed-by: Adam Jackson <ajax@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4532>
2019-10-13gbm: use size_t for array indexesEric Engestrom1-10/+5
Signed-off-by: Eric Engestrom <eric@engestrom.ch> Reviewed-by: Eric Anholt <eric@anholt.net>
2019-10-13gbm: replace NULL sentinel with explicit ARRAY_SIZE()Eric Engestrom1-9/+12
Signed-off-by: Eric Engestrom <eric@engestrom.ch> Reviewed-by: Eric Anholt <eric@anholt.net>
2019-10-13gbm: replace 1/0 bool with true/falseEric Engestrom1-8/+8
Signed-off-by: Eric Engestrom <eric@engestrom.ch> Reviewed-by: Eric Anholt <eric@anholt.net>
2019-10-13gbm: turn 0/-1 bool into true/falseEric Engestrom1-6/+7
Signed-off-by: Eric Engestrom <eric@engestrom.ch> Reviewed-by: Eric Anholt <eric@anholt.net>
2019-09-20libgbm: Wire up getCapability for the image loaderAdam Jackson1-1/+2
2019-08-21gbm: Add buffer handling and visuals for fp16 formatsKevin Strasser1-1/+26
Define and set a new loader cap DRI_LOADER_CAP_FP16, indicating that gbm can handle fp16 formats. Signed-off-by: Kevin Strasser <kevin.strasser@intel.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com> Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2019-08-21egl: Convert configs to use shifts and sizes instead of masksKevin Strasser1-12/+24
Change dri2_add_config to take arrays of shifts and sizes, and compare with those set in the dri config. Convert all platform driver masks to shifts and sizes. In order to handle older drivers, where shift attributes aren't available, we fall back to the mask attributes and compute the shifts with ffs. Signed-off-by: Kevin Strasser <kevin.strasser@intel.com> Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
2019-05-15gbm: gbm_bo_get_handle_for_plane fallback to nonplanar handleAlex Villacís Lasso1-0/+6
Commit f9567ab435217a72cbae628336ead84dc0b2a803 (gbm: Export a getter for per plane handles) contains an API version check that fails on i915 (API version 7 vs. check for minimum API version 13). Any client that migrates to the planar API will start failing on i915 (see https://gitlab.gnome.org/GNOME/mutter/issues/127 for mutter, and https://bugs.freedesktop.org/show_bug.cgi?id=108487 for weston). This commit adds a fallback for plane 0 when the API check fails and returns the non-planar handle in this scenario, making the call equivalent to gbm_bo_get_handle(). This is enough for weston 6.0.0 to start working again on an i915 system. Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=108487 Signed-off-by: Alex Villacís Lasso <a_villacis@palosanto.com> Reviewed-by: Daniel Stone <daniels@collabora.com>
2019-04-26gbm: don't return voidcoypu1-1/+1
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
2019-02-14gbm: drop duplicate #definesEric Engestrom1-8/+0
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com> Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org>
2019-02-14drm-uapi: use local files, not system libdrmEric Engestrom1-1/+1
There was an issue recently caused by the system header being included by mistake, so let's just get rid of this include path and always explicitly #include "drm-uapi/FOO.h" Signed-off-by: Eric Engestrom <eric.engestrom@intel.com> Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org>
2018-11-19gbm: add missing comma between stringsEric Engestrom1-1/+1
Fixes: d971a4230d54069c996bc "loader: Factor out the common driver opening logic from each loader." Signed-off-by: Eric Engestrom <eric@engestrom.ch> Reviewed-by: Eric Anholt <eric@anholt.net>
2018-11-16loader: Factor out the common driver opening logic from each loader.Eric Anholt1-72/+12
I copied the code from egl_dri2.c, but the functionality was equivalent between all the loaders other than their particular environment variables. v2: Drop the logging function equivalent to loader_default_logger() (requested by Eric, Emil). Move the SCons workaround across. Drop the now-unused driGetDriverExtensions() declaration that was lost in a rebase. Reviewed-by: Eric Engestrom <eric.engestrom@intel.com> (v1) Reviewed-by: Emil Velikov <emil.velikov@collabora.com> (v1)
2018-11-12gbm: Move gbm_format_canonicalize() to the core.Eric Anholt1-16/+0
I want it for the format name debugging code. Reviewed-by: Eric Engestrom <eric.engestrom@intel.com> Reviewed-by: Daniel Stone <daniels@collabora.com>
2018-10-09gbm: Add GBM_FORMAT_ARGB1555 supportMichel Dänzer1-0/+4
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2018-08-01gbm: Add support for 10bpp BGR formatsDaniel Stone1-0/+8
Add support for XBGR2101010 and ABGR2101010 formats. Signed-off-by: Daniel Stone <daniels@collabora.com> Reviewed-by: Mario Kleiner <mario.kleiner.de@gmail.com> Tested-by: Mario Kleiner <mario.kleiner.de@gmail.com> Tested-by: Ilia Mirkin <imirkin@alum.mit.edu> Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>