minigbm: Refactored minigbm on top a private API

We would like to reuse the same set of drivers for ChromeOS (with
a minigbm frontend) and Android (with a gralloc frontend).  Since
we don't want to pollute the gbm API with gralloc formats and usages,
we can refactor minigbm on top a private API that will be a superset
of gbm and gralloc.  This change redirects gbm calls to the
private API.

TEST=Ran graphics_Gbm on minnie and cyan, and checked if Chrome boots.
BUG=chromium:616275

CQ-DEPEND=CL:367791

Change-Id: I50d10f9d6c7ea936b0d76c5299a58d948939fdf9
Reviewed-on: https://chromium-review.googlesource.com/367780
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
This commit is contained in:
Gurchetan Singh 2016-08-05 14:40:07 -07:00 committed by chrome-bot
parent 0fd114250d
commit 46faf6bf43
21 changed files with 1067 additions and 497 deletions

View file

@ -10,15 +10,13 @@
#include <stdint.h>
#include <sys/types.h>
#include <stdlib.h>
#include "gbm.h"
#define GBM_MAX_PLANES 4
#include "drv.h"
#include "gbm.h"
struct gbm_device
{
int fd;
struct gbm_driver *driver;
void *priv;
struct driver *drv;
};
struct gbm_surface
@ -28,33 +26,10 @@ struct gbm_surface
struct gbm_bo
{
struct gbm_device *gbm;
uint32_t width;
uint32_t height;
uint32_t format;
uint32_t tiling;
size_t num_planes;
union gbm_bo_handle handles[GBM_MAX_PLANES];
uint32_t offsets[GBM_MAX_PLANES];
uint32_t sizes[GBM_MAX_PLANES];
uint32_t strides[GBM_MAX_PLANES];
uint64_t format_modifiers[GBM_MAX_PLANES];
void *priv;
struct bo *bo;
uint32_t gbm_format;
void *user_data;
void (*destroy_user_data)(struct gbm_bo *, void *);
};
struct gbm_driver
{
char *name;
int (*init)(struct gbm_device *gbm);
void (*close)(struct gbm_device *gbm);
int (*bo_create)(struct gbm_bo *bo, uint32_t width, uint32_t height, uint32_t format, uint32_t flags);
int (*bo_destroy)(struct gbm_bo *bo);
struct format_supported {
uint32_t format;
enum gbm_bo_flags usage;
}
format_list[18];
};
#endif