aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSubhajit Paul2018-01-30 02:58:53 -0600
committerSubhajit Paul2018-07-04 05:10:06 -0500
commitc5ddc6a37bb78ac753b317b17d890d1f7338dea6 (patch)
treee9ec1db0f2374089e15c47436c302f999cf718f2
parentf316cf4b98ca3f4a1ca92a48ddd8aa559894a45c (diff)
downloadexternal-libgbm-c5ddc6a37bb78ac753b317b17d890d1f7338dea6.tar.gz
external-libgbm-c5ddc6a37bb78ac753b317b17d890d1f7338dea6.tar.xz
external-libgbm-c5ddc6a37bb78ac753b317b17d890d1f7338dea6.zip
gbm: add support to import gbm_bos to surface
Signed-off-by: Subhajit Paul <subhajit_paul@ti.com>
-rw-r--r--gbm.c37
-rw-r--r--gbm.h6
-rw-r--r--gbmint.h4
3 files changed, 47 insertions, 0 deletions
diff --git a/gbm.c b/gbm.c
index c046b1ad..7bc58809 100644
--- a/gbm.c
+++ b/gbm.c
@@ -408,6 +408,43 @@ gbm_surface_create(struct gbm_device *gbm,
408} 408}
409 409
410/** 410/**
411 * Create a gbm_surface object from a pool of gbm_bo objects
412 *
413 * This function imports a pool of gbm_bo objects and creates a new gbm_surface
414 * object for it.
415 *
416 * The GBM APIs support creation of gbm_bo objects by importing external
417 * memory. This function extends this feature by allowing creation of a
418 * gbm_surface object using previously created gbm_bo objects
419 *
420 * Calling gbm_surface_destroy() does not destroy the gbm_bo objects,
421 * and the application must call gbm_bo_destroy() for each gbm_bo object
422 *
423 * \param gbm The gbm device returned from gbm_create_device()
424 * \param width Width of each gbm_bo object in the array
425 * \param height Height of each gbm_bo object in the array
426 * \param format GBM Format of eacg gbm_bo object in the array
427 * \param bos Array of gbm_bo objects
428 * \param count Number of gbm_bo objects in the array
429 *
430 * \return A newly allocated surface object that should be freed with
431 * gbm_surface_destroy() when no longer needed. On error, %NULL is returned
432 * and errno is set.
433 */
434GBM_EXPORT struct gbm_surface *
435gbm_surface_import(struct gbm_device *gbm,
436 uint32_t width, uint32_t height,
437 uint32_t format, uint32_t flags,
438 struct gbm_bo **bos, uint32_t count)
439{
440 if(!gbm->surface_import) {
441 errno = ENOTSUP;
442 return NULL;
443 }
444 return gbm->surface_import(gbm, width, height, format, flags, bos, count);
445}
446
447/**
411 * Destroys the given surface and frees all resources associated with 448 * Destroys the given surface and frees all resources associated with
412 * it. 449 * it.
413 * 450 *
diff --git a/gbm.h b/gbm.h
index 8db2153e..297711a8 100644
--- a/gbm.h
+++ b/gbm.h
@@ -292,6 +292,12 @@ gbm_surface_create(struct gbm_device *gbm,
292 uint32_t width, uint32_t height, 292 uint32_t width, uint32_t height,
293 uint32_t format, uint32_t flags); 293 uint32_t format, uint32_t flags);
294 294
295struct gbm_surface *
296gbm_surface_import(struct gbm_device *gbm,
297 uint32_t width, uint32_t height,
298 uint32_t format, uint32_t flags,
299 struct gbm_bo **bos, uint32_t count);
300
295int 301int
296gbm_surface_needs_lock_front_buffer(struct gbm_surface *surface); 302gbm_surface_needs_lock_front_buffer(struct gbm_surface *surface);
297 303
diff --git a/gbmint.h b/gbmint.h
index 155eb12b..3076a2a2 100644
--- a/gbmint.h
+++ b/gbmint.h
@@ -75,6 +75,10 @@ struct gbm_device {
75 struct gbm_surface *(*surface_create)(struct gbm_device *gbm, 75 struct gbm_surface *(*surface_create)(struct gbm_device *gbm,
76 uint32_t width, uint32_t height, 76 uint32_t width, uint32_t height,
77 uint32_t format, uint32_t flags); 77 uint32_t format, uint32_t flags);
78 struct gbm_surface *(*surface_import)(struct gbm_device *gbm,
79 uint32_t width, uint32_t height,
80 uint32_t format, uint32_t flags,
81 struct gbm_bo **bos, uint32_t count);
78 struct gbm_bo *(*surface_lock_front_buffer)(struct gbm_surface *surface); 82 struct gbm_bo *(*surface_lock_front_buffer)(struct gbm_surface *surface);
79 void (*surface_release_buffer)(struct gbm_surface *surface, 83 void (*surface_release_buffer)(struct gbm_surface *surface,
80 struct gbm_bo *bo); 84 struct gbm_bo *bo);