~misterc/libva/Trunk

« back to all changes in this revision

Viewing changes to va/wayland/va_wayland_drm.c

  • Committer: Xiang, Haihao
  • Date: 2016-09-19 06:03:30 UTC
  • Revision ID: git-v1:a55ea7cb3143d57c8dba1b76ccea3511ea69adf2
wayland: Check whether prime fd can be used in buffer sharing mechanism

Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>

Show diffs side-by-side

added added

removed removed

Lines of Context:
98
98
    drm_state->auth_type         = VA_DRM_AUTH_CUSTOM;
99
99
}
100
100
 
 
101
static void
 
102
drm_handle_capabilities(void *data, struct wl_drm *wl_drm, uint32_t value)
 
103
{
 
104
    VADisplayContextP const pDisplayContext = data;
 
105
    VADriverContextP const ctx = pDisplayContext->pDriverContext;
 
106
    struct VADriverVTableWayland *vtable = ctx->vtable_wayland;
 
107
 
 
108
    vtable->has_prime_sharing = !!(value & WL_DRM_CAPABILITY_PRIME);
 
109
}
 
110
 
101
111
static const struct wl_drm_listener drm_listener = {
102
112
    drm_handle_device,
103
113
    drm_handle_format,
104
 
    drm_handle_authenticated
 
114
    drm_handle_authenticated,
 
115
    drm_handle_capabilities,
105
116
};
106
117
 
107
118
static VAStatus
121
132
    VADriverContextP const ctx = pDisplayContext->pDriverContext;
122
133
    struct va_wayland_drm_context * const wl_drm_ctx = pDisplayContext->opaque;
123
134
    struct drm_state * const drm_state = ctx->drm_state;
 
135
    struct VADriverVTableWayland *vtable = ctx->vtable_wayland;
 
136
 
 
137
    vtable->has_prime_sharing = 0;
124
138
 
125
139
    if (wl_drm_ctx->drm) {
126
140
        wl_drm_destroy(wl_drm_ctx->drm);
156
170
 
157
171
    if (strcmp(interface, "wl_drm") == 0) {
158
172
        wl_drm_ctx->drm =
159
 
            wl_registry_bind(wl_drm_ctx->registry, id, wl_drm_ctx->drm_interface, 1);
 
173
            wl_registry_bind(wl_drm_ctx->registry, id, wl_drm_ctx->drm_interface, 2);
160
174
    }
161
175
}
162
176
 
171
185
    VADriverContextP const ctx = pDisplayContext->pDriverContext;
172
186
    struct va_wayland_drm_context *wl_drm_ctx;
173
187
    struct drm_state *drm_state;
 
188
    struct VADriverVTableWayland *vtable = ctx->vtable_wayland;
174
189
 
175
190
    wl_drm_ctx = malloc(sizeof(*wl_drm_ctx));
176
191
    if (!wl_drm_ctx)
189
204
    drm_state->fd        = -1;
190
205
    drm_state->auth_type = 0;
191
206
    ctx->drm_state       = drm_state;
 
207
    vtable->has_prime_sharing = 0;
192
208
 
193
209
    wl_drm_ctx->handle = dlopen(LIBWAYLAND_DRM_NAME, RTLD_LAZY|RTLD_LOCAL);
194
210
    if (!wl_drm_ctx->handle)