diff options
author | Benjamin Franzke <benjaminfranzke@googlemail.com> | 2012-04-06 11:45:28 +0200 |
---|---|---|
committer | Gwenole Beauchesne <gwenole.beauchesne@intel.com> | 2012-09-26 11:44:45 +0200 |
commit | 4b553202ca1ba85b7754a8bdad2771c0a4562ed1 (patch) | |
tree | 92605c50b7ad5c293283fb4dfb5b3caaf4324047 /va/x11 | |
parent | 0d1bc5a24652c11bd5d3f45f4e57b854dcb4cdcb (diff) | |
download | libva-4b553202ca1ba85b7754a8bdad2771c0a4562ed1.tar.gz |
API: introduce DRM common utilities and data structures.
Add <va/va_drmcommon.h> header for DRM-based drivers to use common
base utilities and data structures. So far, only the DRM state is
shared so that to maintain binary compatibility.
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
Diffstat (limited to 'va/x11')
-rw-r--r-- | va/x11/dri2_util.c | 24 | ||||
-rw-r--r-- | va/x11/va_dricommon.h | 16 |
2 files changed, 20 insertions, 20 deletions
diff --git a/va/x11/dri2_util.c b/va/x11/dri2_util.c index ab3f58a..47f663a 100644 --- a/va/x11/dri2_util.c +++ b/va/x11/dri2_util.c @@ -168,8 +168,8 @@ dri2Close(VADriverContextP ctx) free_drawable_hashtable(ctx); - if (dri_state->fd >= 0); - close(dri_state->fd); + if (dri_state->base.fd >= 0); + close(dri_state->base.fd); } Bool @@ -182,8 +182,8 @@ isDRI2Connected(VADriverContextP ctx, char **driver_name) char *device_name = NULL; drm_magic_t magic; *driver_name = NULL; - dri_state->fd = -1; - dri_state->driConnectedFlag = VA_NONE; + dri_state->base.fd = -1; + dri_state->base.auth_type = VA_NONE; if (!VA_DRI2QueryExtension(ctx->native_dpy, &event_base, &error_base)) goto err_out; @@ -195,20 +195,20 @@ isDRI2Connected(VADriverContextP ctx, char **driver_name) driver_name, &device_name)) goto err_out; - dri_state->fd = open(device_name, O_RDWR); - assert(dri_state->fd >= 0); + dri_state->base.fd = open(device_name, O_RDWR); + assert(dri_state->base.fd >= 0); - if (dri_state->fd < 0) + if (dri_state->base.fd < 0) goto err_out; - if (drmGetMagic(dri_state->fd, &magic)) + if (drmGetMagic(dri_state->base.fd, &magic)) goto err_out; if (!VA_DRI2Authenticate(ctx->native_dpy, RootWindow(ctx->native_dpy, ctx->x11_screen), magic)) goto err_out; - dri_state->driConnectedFlag = VA_DRI2; + dri_state->base.auth_type = VA_DRI2; dri_state->createDrawable = dri2CreateDrawable; dri_state->destroyDrawable = dri2DestroyDrawable; dri_state->swapBuffer = dri2SwapBuffer; @@ -228,11 +228,11 @@ err_out: if (*driver_name) Xfree(*driver_name); - if (dri_state->fd >= 0) - close(dri_state->fd); + if (dri_state->base.fd >= 0) + close(dri_state->base.fd); *driver_name = NULL; - dri_state->fd = -1; + dri_state->base.fd = -1; return False; } diff --git a/va/x11/va_dricommon.h b/va/x11/va_dricommon.h index 4d6e3aa..eb6ddad 100644 --- a/va/x11/va_dricommon.h +++ b/va/x11/va_dricommon.h @@ -32,18 +32,19 @@ #endif #include <va/va_backend.h> +#include <va/va_drmcommon.h> #ifdef ANDROID #define XID unsigned int #define Bool int #endif -enum -{ - VA_NONE = 0, - VA_DRI1 = 1, - VA_DRI2 = 2, - VA_DUMMY = 3 +enum { + /* Compatibility. Do not use for newly-written code. */ + VA_NONE = VA_DRM_AUTH_NONE, + VA_DRI1 = VA_DRM_AUTH_DRI1, + VA_DRI2 = VA_DRM_AUTH_DRI2, + VA_DUMMY = VA_DRM_AUTH_CUSTOM }; union dri_buffer @@ -71,8 +72,7 @@ struct dri_drawable #define DRAWABLE_HASH_SZ 32 struct dri_state { - int fd; - int driConnectedFlag; /* 0: disconnected, 1: DRI, 2: DRI2 */ + struct drm_state base; #ifndef ANDROID struct dri_drawable *drawable_hash[DRAWABLE_HASH_SZ]; |