gbm: assume USE_SCANOUT in create_with_modifiers

gbm_{bo,surface}_create_with_modifiers doesn't allow callers to
pass usage flags. Assume USE_SCANOUT since this is what most
callers want.

Bump the GBM ABI version so that other backends can discover when
the usage flags can be used.

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>
This commit is contained in:
Simon Ser 2021-08-27 15:03:39 +02:00
parent 268e12c605
commit ad50b47a14
3 changed files with 19 additions and 5 deletions

View File

@ -498,7 +498,7 @@ gbm_bo_create_with_modifiers(struct gbm_device *gbm,
const unsigned int count)
{
return gbm_bo_create_with_modifiers2(gbm, width, height, format, modifiers,
count, 0);
count, GBM_BO_USE_SCANOUT);
}
GBM_EXPORT struct gbm_bo *
@ -649,7 +649,8 @@ gbm_surface_create_with_modifiers(struct gbm_device *gbm,
const unsigned int count)
{
return gbm_surface_create_with_modifiers2(gbm, width, height, format,
modifiers, count, 0);
modifiers, count,
GBM_BO_USE_SCANOUT);
}
GBM_EXPORT struct gbm_surface *

View File

@ -46,8 +46,13 @@
* -Add a new block of checks in main()
*/
/* From: 49a7331cb02 - James Jones - gbm: Version the backend interface */
#define GBM_BACKEND_ABI_VERSION_abi0 0
/*
* From: Simon Ser - "gbm: assume USE_SCANOUT in create_with_modifiers"
*
* Note: ABI 1 is identical to ABI 0, except gbm_device_v0.bo_create can
* provide both modifiers and usage.
*/
#define GBM_BACKEND_ABI_VERSION_abi0 1
struct gbm_device_v0_abi0 {
const struct gbm_backend_desc *backend_desc;
uint32_t backend_version;

View File

@ -72,7 +72,7 @@ struct gbm_backend_desc;
* Core ABI version: 4
* ABI version of a buffer object created by a device from the backend: 4
*/
#define GBM_BACKEND_ABI_VERSION 0
#define GBM_BACKEND_ABI_VERSION 1
/**
* GBM device interface corresponding to GBM_BACKEND_ABI_VERSION = 0
@ -113,6 +113,10 @@ struct gbm_device_v0 {
uint32_t format,
uint64_t modifier);
/**
* Since version 1, usage is properly populated when modifiers are
* supplied. Version 0 always set usage to 0 in this case.
*/
struct gbm_bo *(*bo_create)(struct gbm_device *gbm,
uint32_t width, uint32_t height,
uint32_t format,
@ -137,6 +141,10 @@ struct gbm_device_v0 {
uint64_t (*bo_get_modifier)(struct gbm_bo *bo);
void (*bo_destroy)(struct gbm_bo *bo);
/**
* Since version 1, flags are properly populated when modifiers are
* supplied. Version 0 always set flags to 0 in this case.
*/
struct gbm_surface *(*surface_create)(struct gbm_device *gbm,
uint32_t width, uint32_t height,
uint32_t format, uint32_t flags,