va_context.c revision 8bc7ccede1e126329c371e22b6d462edd21720d0
1/**************************************************************************
2 *
3 * Copyright 2010 Thomas Balling Sørensen & Orasanu Lucian.
4 * All Rights Reserved.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
13 *
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
16 * of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21 * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
22 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 *
26 **************************************************************************/
27
28#include <va/va.h>
29#include <va/va_backend.h>
30
31#include "pipe/p_screen.h"
32#include "pipe/p_screen.h"
33#include "pipe/p_video_decoder.h"
34
35#include "util/u_debug.h"
36#include "util/u_memory.h"
37
38#include "vl_winsys.h"
39
40#include "va_private.h"
41
42PUBLIC VAStatus
43__vaDriverInit_0_31(VADriverContextP ctx)
44{
45   vlVaDriverContextPriv *driver_context = NULL;
46
47   if (!ctx)
48      return VA_STATUS_ERROR_INVALID_CONTEXT;
49
50
51   /* Create private driver context */
52   driver_context = CALLOC(1,sizeof(vlVaDriverContextPriv));
53   if (!driver_context)
54      return VA_STATUS_ERROR_ALLOCATION_FAILED;
55
56   driver_context->vscreen = vl_screen_create(ctx->native_dpy, ctx->x11_screen);
57   if (!driver_context->vscreen) {
58      FREE(driver_context);
59      return VA_STATUS_ERROR_ALLOCATION_FAILED;
60   }
61
62   ctx->str_vendor = "mesa gallium vaapi";
63   ctx->vtable = vlVaGetVtable();
64   ctx->max_attributes = 1;
65   ctx->max_display_attributes = 1;
66   ctx->max_entrypoints = VA_MAX_ENTRYPOINTS;
67   ctx->max_image_formats = VA_MAX_IMAGE_FORMATS_SUPPORTED;
68   ctx->max_profiles = 1;
69   ctx->max_subpic_formats = VA_MAX_SUBPIC_FORMATS_SUPPORTED;
70   ctx->version_major = 3;
71   ctx->version_minor = 1;
72   ctx->pDriverData = (void *)driver_context;
73
74   VA_INFO("vl_screen_pointer %p\n",ctx->native_dpy);
75
76   return VA_STATUS_SUCCESS;
77}
78
79VAStatus
80vlVaCreateContext(VADriverContextP ctx, VAConfigID config_id, int picture_width,
81                  int picture_height, int flag, VASurfaceID *render_targets,
82                  int num_render_targets, VAContextID *conext)
83{
84   if (!ctx)
85      return VA_STATUS_ERROR_INVALID_CONTEXT;
86
87   return VA_STATUS_ERROR_UNIMPLEMENTED;
88}
89
90VAStatus
91vlVaDestroyContext(VADriverContextP ctx, VAContextID context)
92{
93   if (!ctx)
94      return VA_STATUS_ERROR_INVALID_CONTEXT;
95
96   return VA_STATUS_ERROR_UNIMPLEMENTED;
97}
98
99VAStatus
100vlVaTerminate(VADriverContextP ctx)
101{
102   if (!ctx)
103      return VA_STATUS_ERROR_INVALID_CONTEXT;
104
105   return VA_STATUS_ERROR_UNIMPLEMENTED;
106}
107