summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmil Velikov <emil.l.velikov@gmail.com>2014-08-01 20:11:07 +0100
committerChih-Wei Huang <cwhuang@linux.org.tw>2015-01-22 09:45:51 +0800
commiteccafc5cee44cb0a42a465bd6d9e3ec9018d5a2a (patch)
tree57ce15ca45466b453bf29a3bbb8968ffdcbb0fae
parentc46b2ee2cace20f67b0c5e1121e1973a7678fd60 (diff)
downloadexternal_drm_gralloc-eccafc5cee44cb0a42a465bd6d9e3ec9018d5a2a.zip
external_drm_gralloc-eccafc5cee44cb0a42a465bd6d9e3ec9018d5a2a.tar.gz
external_drm_gralloc-eccafc5cee44cb0a42a465bd6d9e3ec9018d5a2a.tar.bz2
gralloc_drm: bail out early when we find the driver
... rather than going through all the conditionals. Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
-rw-r--r--gralloc_drm.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/gralloc_drm.c b/gralloc_drm.c
index c53e556..a175cbe 100644
--- a/gralloc_drm.c
+++ b/gralloc_drm.c
@@ -70,36 +70,41 @@ init_drv_from_fd(int fd)
if (version->name) {
#ifdef ENABLE_PIPE
drv = gralloc_drm_drv_create_for_pipe(fd, version->name);
- ALOGI_IF(drv, "create pipe for driver %s", version->name);
+ if (drv) {
+ ALOGI("create pipe for driver %s", version->name);
+ } else
#endif
#ifdef ENABLE_FREEDRENO
- if (!drv && !strcmp(version->name, "msm"))
+ if (!strcmp(version->name, "msm")) {
drv = gralloc_drm_drv_create_for_freedreno(fd);
+ ALOGI_IF(drv, "create freedreno for driver msm");
+ } else
#endif
#ifdef ENABLE_INTEL
- if (!drv && !strcmp(version->name, "i915")) {
+ if (!strcmp(version->name, "i915")) {
drv = gralloc_drm_drv_create_for_intel(fd);
ALOGI_IF(drv, "create intel for driver i915");
- }
+ } else
#endif
#ifdef ENABLE_RADEON
- if (!drv && !strcmp(version->name, "radeon")) {
+ if (!strcmp(version->name, "radeon")) {
drv = gralloc_drm_drv_create_for_radeon(fd);
ALOGI_IF(drv, "create radeon for driver radeon");
- }
+ } else
#endif
#ifdef ENABLE_NOUVEAU
- if (!drv && !strcmp(version->name, "nouveau")) {
+ if (!strcmp(version->name, "nouveau")) {
drv = gralloc_drm_drv_create_for_nouveau(fd);
ALOGI_IF(drv, "create nouveau for driver nouveau");
- }
+ } else
#endif
+ if (!drv) {
+ ALOGE("unsupported driver: %s", (version->name) ?
+ version->name : "NULL");
+ }
}
- ALOGE_IF(!drv, "unsupported driver: %s", (version->name) ?
- version->name : "NULL");
-
drmFreeVersion(version);
return drv;