• R/O
  • HTTP
  • SSH
  • HTTPS

提交

标签
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

hardware/intel/common/libva


Commit MetaInfo

修订版1b04587eee33537fe862baf6fc6fc3937dccfdcc (tree)
时间2017-09-27 13:48:16
作者Mark Thompson <sw@jkqx...>
CommiterXiang, Haihao

Log Message

Move VADisplay allocation to common code

This is slightly cleaner, and will be required to set common
options on a newly-created display.

Signed-off-by: Mark Thompson <sw@jkqxz.net>

更改概述

差异

--- a/va/android/va_android.cpp
+++ b/va/android/va_android.cpp
@@ -26,6 +26,7 @@
2626 #include "sysdeps.h"
2727 #include "va.h"
2828 #include "va_backend.h"
29+#include "va_internal.h"
2930 #include "va_trace.h"
3031 #include "va_fool.h"
3132 #include "va_android.h"
@@ -135,13 +136,11 @@ VADisplay vaGetDisplay (
135136 /* create new entry */
136137 VADriverContextP pDriverContext = 0;
137138 struct drm_state *drm_state = 0;
138- pDisplayContext = (VADisplayContextP)calloc(1, sizeof(*pDisplayContext));
139+ pDisplayContext = va_newDisplayContext();
139140 pDriverContext = (VADriverContextP)calloc(1, sizeof(*pDriverContext));
140141 drm_state = (struct drm_state*)calloc(1, sizeof(*drm_state));
141142 if (pDisplayContext && pDriverContext && drm_state)
142143 {
143- pDisplayContext->vadpy_magic = VA_DISPLAY_MAGIC;
144-
145144 pDriverContext->native_dpy = (void *)native_dpy;
146145 pDriverContext->display_type = VA_DISPLAY_ANDROID;
147146 pDisplayContext->pDriverContext = pDriverContext;
--- a/va/drm/va_drm.c
+++ b/va/drm/va_drm.c
@@ -26,6 +26,7 @@
2626 #include <xf86drm.h>
2727 #include "va_drm.h"
2828 #include "va_backend.h"
29+#include "va_internal.h"
2930 #include "va_drmcommon.h"
3031 #include "va_drm_auth.h"
3132 #include "va_drm_utils.h"
@@ -109,11 +110,10 @@ vaGetDisplayDRM(int fd)
109110 VA_DISPLAY_DRM_RENDERNODES : VA_DISPLAY_DRM;
110111 pDriverContext->drm_state = drm_state;
111112
112- pDisplayContext = calloc(1, sizeof(*pDisplayContext));
113+ pDisplayContext = va_newDisplayContext();
113114 if (!pDisplayContext)
114115 goto error;
115116
116- pDisplayContext->vadpy_magic = VA_DISPLAY_MAGIC;
117117 pDisplayContext->pDriverContext = pDriverContext;
118118 pDisplayContext->vaIsValid = va_DisplayContextIsValid;
119119 pDisplayContext->vaDestroy = va_DisplayContextDestroy;
--- a/va/va.c
+++ b/va/va.c
@@ -27,6 +27,7 @@
2727 #include "va.h"
2828 #include "va_backend.h"
2929 #include "va_backend_vpp.h"
30+#include "va_internal.h"
3031 #include "va_trace.h"
3132 #include "va_fool.h"
3233
@@ -234,6 +235,17 @@ void va_infoMessage(const char *msg, ...)
234235 #endif
235236 }
236237
238+VADisplayContextP va_newDisplayContext(void)
239+{
240+ VADisplayContextP dctx = calloc(1, sizeof(*dctx));
241+ if (!dctx)
242+ return NULL;
243+
244+ dctx->vadpy_magic = VA_DISPLAY_MAGIC;
245+
246+ return dctx;
247+}
248+
237249 static bool va_checkVtable(void *ptr, char *function)
238250 {
239251 if (!ptr) {
--- a/va/va_internal.h
+++ b/va/va_internal.h
@@ -33,4 +33,6 @@ void va_infoMessage(const char *msg, ...);
3333
3434 int va_parseConfig(char *env, char *env_value);
3535
36+VADisplayContextP va_newDisplayContext(void);
37+
3638 #endif /* VA_INTERNAL_H */
--- a/va/wayland/va_wayland.c
+++ b/va/wayland/va_wayland.c
@@ -32,6 +32,7 @@
3232 #include "va_wayland_private.h"
3333 #include "va_backend.h"
3434 #include "va_backend_wayland.h"
35+#include "va_internal.h"
3536
3637 static inline VADriverContextP
3738 get_driver_context(VADisplay dpy)
@@ -120,11 +121,10 @@ vaGetDisplayWl(struct wl_display *display)
120121 struct VADriverVTableWayland *vtable;
121122 unsigned int i;
122123
123- pDisplayContext = calloc(1, sizeof(*pDisplayContext));
124+ pDisplayContext = va_newDisplayContext();
124125 if (!pDisplayContext)
125126 return NULL;
126127
127- pDisplayContext->vadpy_magic = VA_DISPLAY_MAGIC;
128128 pDisplayContext->vaIsValid = va_DisplayContextIsValid;
129129 pDisplayContext->vaDestroy = va_DisplayContextDestroy;
130130 pDisplayContext->vaGetDriverName = va_DisplayContextGetDriverName;
--- a/va/x11/va_x11.c
+++ b/va/x11/va_x11.c
@@ -26,6 +26,7 @@
2626 #include "sysdeps.h"
2727 #include "va.h"
2828 #include "va_backend.h"
29+#include "va_internal.h"
2930 #include "va_trace.h"
3031 #include "va_fool.h"
3132 #include "va_x11.h"
@@ -163,13 +164,11 @@ VADisplay vaGetDisplay (
163164 /* create new entry */
164165 VADriverContextP pDriverContext;
165166 struct dri_state *dri_state;
166- pDisplayContext = calloc(1, sizeof(*pDisplayContext));
167+ pDisplayContext = va_newDisplayContext();
167168 pDriverContext = calloc(1, sizeof(*pDriverContext));
168169 dri_state = calloc(1, sizeof(*dri_state));
169170 if (pDisplayContext && pDriverContext && dri_state)
170171 {
171- pDisplayContext->vadpy_magic = VA_DISPLAY_MAGIC;
172-
173172 pDriverContext->native_dpy = (void *)native_dpy;
174173 pDriverContext->x11_screen = XDefaultScreen(native_dpy);
175174 pDriverContext->display_type = VA_DISPLAY_X11;