summaryrefslogtreecommitdiff
path: root/va/android
diff options
context:
space:
mode:
authorMark Thompson <sw@jkqxz.net>2017-10-02 23:49:33 +0100
committerXiang, Haihao <haihao.xiang@intel.com>2017-11-21 21:38:52 -0800
commit4cc9a74bd82e9b1c5cfe7fc5fce056a01b99ecdb (patch)
tree75ab72891e8f7910b02ae0d86a684e14bec1e1dd /va/android
parentcff70165e08ab3372487d619564590abf6fbfb04 (diff)
downloadlibva-4cc9a74bd82e9b1c5cfe7fc5fce056a01b99ecdb.tar.gz
Move driver context allocation to common code
This will be required to set common options on a newly-created driver context. Signed-off-by: Mark Thompson <sw@jkqxz.net>
Diffstat (limited to 'va/android')
-rw-r--r--va/android/va_android.cpp59
1 files changed, 28 insertions, 31 deletions
diff --git a/va/android/va_android.cpp b/va/android/va_android.cpp
index ae96236..4a8fe9f 100644
--- a/va/android/va_android.cpp
+++ b/va/android/va_android.cpp
@@ -125,43 +125,40 @@ VADisplay vaGetDisplay (
void *native_dpy /* implementation specific */
)
{
- VADisplay dpy = NULL;
VADisplayContextP pDisplayContext;
+ VADriverContextP pDriverContext;
+ struct drm_state *drm_state;
if (!native_dpy)
return NULL;
- if (!dpy)
- {
- /* create new entry */
- VADriverContextP pDriverContext = 0;
- struct drm_state *drm_state = 0;
- pDisplayContext = va_newDisplayContext();
- pDriverContext = (VADriverContextP)calloc(1, sizeof(*pDriverContext));
- drm_state = (struct drm_state*)calloc(1, sizeof(*drm_state));
- if (pDisplayContext && pDriverContext && drm_state)
- {
- pDriverContext->native_dpy = (void *)native_dpy;
- pDriverContext->display_type = VA_DISPLAY_ANDROID;
- pDisplayContext->pDriverContext = pDriverContext;
- pDisplayContext->vaIsValid = va_DisplayContextIsValid;
- pDisplayContext->vaDestroy = va_DisplayContextDestroy;
- pDisplayContext->vaGetDriverName = va_DisplayContextGetDriverName;
- pDriverContext->drm_state = drm_state;
- dpy = (VADisplay)pDisplayContext;
- }
- else
- {
- if (pDisplayContext)
- free(pDisplayContext);
- if (pDriverContext)
- free(pDriverContext);
- if (drm_state)
- free(drm_state);
- }
+ pDisplayContext = va_newDisplayContext();
+ if (!pDisplayContext)
+ return NULL;
+
+ pDisplayContext->vaIsValid = va_DisplayContextIsValid;
+ pDisplayContext->vaDestroy = va_DisplayContextDestroy;
+ pDisplayContext->vaGetDriverName = va_DisplayContextGetDriverName;
+
+ pDriverContext = va_newDriverContext(pDisplayContext);
+ if (!pDriverContext) {
+ free(pDisplayContext);
+ return NULL;
}
-
- return dpy;
+
+ pDriverContext->native_dpy = (void *)native_dpy;
+ pDriverContext->display_type = VA_DISPLAY_ANDROID
+
+ drm_state = calloc(1, sizeof(*drm_state));
+ if (!drm_state) {
+ free(pDisplayContext);
+ free(pDriverContext);
+ return NULL;
+ }
+
+ pDriverContext->drm_state = drm_state;
+
+ return (VADisplay)pDisplayContext;
}