summaryrefslogtreecommitdiffstats
path: root/src/gbm/main/gbm.c
diff options
context:
space:
mode:
authorBen Widawsky <[email protected]>2016-11-03 16:14:44 -0700
committerBen Widawsky <[email protected]>2017-03-15 10:36:05 -0700
commit63bd2ae7452d48f25962ae9985a34bbdba9c52cf (patch)
treed681018c1f51398472c8adf56aac3d800fffe67a /src/gbm/main/gbm.c
parent5e7d8d396196af61ce0b1663534d97bef7895993 (diff)
gbm: Introduce modifiers into surface/bo creation
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]>
Diffstat (limited to 'src/gbm/main/gbm.c')
-rw-r--r--src/gbm/main/gbm.c39
1 files changed, 37 insertions, 2 deletions
diff --git a/src/gbm/main/gbm.c b/src/gbm/main/gbm.c
index afcca63da3a..7bacd8b86a6 100644
--- a/src/gbm/main/gbm.c
+++ b/src/gbm/main/gbm.c
@@ -369,9 +369,28 @@ gbm_bo_create(struct gbm_device *gbm,
return NULL;
}
- return gbm->bo_create(gbm, width, height, format, usage);
+ return gbm->bo_create(gbm, width, height, format, usage, NULL, 0);
}
+GBM_EXPORT struct gbm_bo *
+gbm_bo_create_with_modifiers(struct gbm_device *gbm,
+ uint32_t width, uint32_t height,
+ uint32_t format,
+ const uint64_t *modifiers,
+ const unsigned int count)
+{
+ if (width == 0 || height == 0) {
+ errno = EINVAL;
+ return NULL;
+ }
+
+ if ((count && !modifiers) || (modifiers && !count)) {
+ errno = EINVAL;
+ return NULL;
+ }
+
+ return gbm->bo_create(gbm, width, height, format, 0, modifiers, count);
+}
/**
* Create a gbm buffer object from an foreign object
*
@@ -477,7 +496,23 @@ gbm_surface_create(struct gbm_device *gbm,
uint32_t width, uint32_t height,
uint32_t format, uint32_t flags)
{
- return gbm->surface_create(gbm, width, height, format, flags);
+ return gbm->surface_create(gbm, width, height, format, flags, NULL, 0);
+}
+
+GBM_EXPORT struct gbm_surface *
+gbm_surface_create_with_modifiers(struct gbm_device *gbm,
+ uint32_t width, uint32_t height,
+ uint32_t format,
+ const uint64_t *modifiers,
+ const unsigned int count)
+{
+ if ((count && !modifiers) || (modifiers && !count)) {
+ errno = EINVAL;
+ return NULL;
+ }
+
+ return gbm->surface_create(gbm, width, height, format, 0,
+ modifiers, count);
}
/**