1 /************************************************************************** 2 * 3 * Copyright 2010 Thomas Balling Srensen & 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 #include "vl/vl_winsys.h" 38 39 #include "va_private.h" 40 41 PUBLIC VAStatus 42 __vaDriverInit_0_31(VADriverContextP ctx) 43 { 44 vlVaDriverContextPriv *driver_context = NULL; 45 46 if (!ctx) 47 return VA_STATUS_ERROR_INVALID_CONTEXT; 48 49 50 /* Create private driver context */ 51 driver_context = CALLOC(1,sizeof(vlVaDriverContextPriv)); 52 if (!driver_context) 53 return VA_STATUS_ERROR_ALLOCATION_FAILED; 54 55 driver_context->vscreen = vl_screen_create(ctx->native_dpy, ctx->x11_screen); 56 if (!driver_context->vscreen) { 57 FREE(driver_context); 58 return VA_STATUS_ERROR_ALLOCATION_FAILED; 59 } 60 61 ctx->str_vendor = "mesa gallium vaapi"; 62 ctx->vtable = vlVaGetVtable(); 63 ctx->max_attributes = 1; 64 ctx->max_display_attributes = 1; 65 ctx->max_entrypoints = VA_MAX_ENTRYPOINTS; 66 ctx->max_image_formats = VA_MAX_IMAGE_FORMATS_SUPPORTED; 67 ctx->max_profiles = 1; 68 ctx->max_subpic_formats = VA_MAX_SUBPIC_FORMATS_SUPPORTED; 69 ctx->version_major = 3; 70 ctx->version_minor = 1; 71 ctx->pDriverData = (void *)driver_context; 72 73 VA_INFO("vl_screen_pointer %p\n",ctx->native_dpy); 74 75 return VA_STATUS_SUCCESS; 76 } 77 78 VAStatus 79 vlVaCreateContext(VADriverContextP ctx, VAConfigID config_id, int picture_width, 80 int picture_height, int flag, VASurfaceID *render_targets, 81 int num_render_targets, VAContextID *conext) 82 { 83 if (!ctx) 84 return VA_STATUS_ERROR_INVALID_CONTEXT; 85 86 return VA_STATUS_ERROR_UNIMPLEMENTED; 87 } 88 89 VAStatus 90 vlVaDestroyContext(VADriverContextP ctx, VAContextID context) 91 { 92 if (!ctx) 93 return VA_STATUS_ERROR_INVALID_CONTEXT; 94 95 return VA_STATUS_ERROR_UNIMPLEMENTED; 96 } 97 98 VAStatus 99 vlVaTerminate(VADriverContextP ctx) 100 { 101 if (!ctx) 102 return VA_STATUS_ERROR_INVALID_CONTEXT; 103 104 return VA_STATUS_ERROR_UNIMPLEMENTED; 105 } 106