Skip to content

Commit

Permalink
Fix android VM boot issue
Browse files Browse the repository at this point in the history
Tracked-On: OAM-117251
Signed-off-by: HeYue <[email protected]>
  • Loading branch information
zhonghuis committed Apr 12, 2024
1 parent f7f0962 commit 2861e6e
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 15 deletions.
4 changes: 1 addition & 3 deletions cros_gralloc/cros_gralloc_driver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,7 @@ cros_gralloc_driver::cros_gralloc_driver()
}

if (drv_render_) {
if (drv_init(drv_render_, gpu_grp_type)) {
drv_loge("Failed to init render driver\n");
}
drv_init(drv_render_, gpu_grp_type);
}
}

Expand Down
16 changes: 10 additions & 6 deletions drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ static const struct backend *drv_get_backend(int fd)
struct driver *drv_create(int fd)
{
struct driver *drv;
int ret;

drv = (struct driver *)calloc(1, sizeof(*drv));

Expand Down Expand Up @@ -139,6 +140,14 @@ struct driver *drv_create(int fd)
if (!drv->combos)
goto free_mappings;

if (drv->backend->init) {
ret = drv->backend->init(drv);
if (ret) {
drv_array_destroy(drv->combos);
goto free_mappings;
}
}

return drv;

free_mappings:
Expand All @@ -154,18 +163,13 @@ struct driver *drv_create(int fd)
return NULL;
}

int drv_init(struct driver * drv, uint32_t grp_type)
void drv_init(struct driver * drv, uint32_t grp_type)
{
int ret = 0;
assert(drv);
assert(drv->backend);

drv->gpu_grp_type = grp_type;

if (drv->backend->init) {
ret = drv->backend->init(drv);
}
return ret;
}

void drv_destroy(struct driver *drv)
Expand Down
2 changes: 1 addition & 1 deletion drv.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ void drv_preload(bool load);

struct driver *drv_create(int fd);

int drv_init(struct driver * drv, uint32_t grp_type);
void drv_init(struct driver * drv, uint32_t grp_type);

void drv_destroy(struct driver *drv);

Expand Down
6 changes: 1 addition & 5 deletions gbm.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,7 @@ PUBLIC struct gbm_device *gbm_create_device(int fd)
return NULL;
}

if (drv_init(gbm->drv, 0) != 0) {
drv_destroy(gbm->drv);
free(gbm);
return NULL;
}
drv_init(gbm->drv, 0);

return gbm;
}
Expand Down

0 comments on commit 2861e6e

Please sign in to comment.