Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | RSS feed

  1. /*
  2.  * Copyright (c) 2007 Intel Corporation. All Rights Reserved.
  3.  *
  4.  * Permission is hereby granted, free of charge, to any person obtaining a
  5.  * copy of this software and associated documentation files (the
  6.  * "Software"), to deal in the Software without restriction, including
  7.  * without limitation the rights to use, copy, modify, merge, publish,
  8.  * distribute, sub license, and/or sell copies of the Software, and to
  9.  * permit persons to whom the Software is furnished to do so, subject to
  10.  * the following conditions:
  11.  *
  12.  * The above copyright notice and this permission notice (including the
  13.  * next paragraph) shall be included in all copies or substantial portions
  14.  * of the Software.
  15.  *
  16.  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  17.  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  18.  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
  19.  * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
  20.  * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  21.  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  22.  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  23.  */
  24.  
  25. #define _GNU_SOURCE 1
  26. #include "sysdeps.h"
  27. #include "va.h"
  28. #include "va_backend.h"
  29. #include "va_backend_tpi.h"
  30.  
  31. #include <assert.h>
  32. #include <stdarg.h>
  33. #include <stdio.h>
  34. #include <stdlib.h>
  35. #include <string.h>
  36. #include <unistd.h>
  37.  
  38. #define CTX(dpy) (((VADisplayContextP)dpy)->pDriverContext)
  39. #define CHECK_DISPLAY(dpy) if( !vaDisplayIsValid(dpy) ) { return VA_STATUS_ERROR_INVALID_DISPLAY; }
  40.  
  41.  
  42. /*
  43.  * Create surfaces with special inputs/requirements
  44.  */
  45. VAStatus vaCreateSurfacesWithAttribute (
  46.         VADisplay dpy,
  47.         int width,
  48.         int height,
  49.         int format,
  50.         int num_surfaces,
  51.         VASurfaceID *surfaces,       /* out */
  52.         VASurfaceAttributeTPI *attribute_tpi
  53. )
  54. {
  55.   VADriverContextP ctx;
  56.   struct VADriverVTableTPI *tpi;
  57.   CHECK_DISPLAY(dpy);
  58.   ctx = CTX(dpy);
  59.  
  60.   tpi = (struct VADriverVTableTPI *)ctx->vtable_tpi;
  61.   if (tpi && tpi->vaCreateSurfacesWithAttribute) {
  62.       return tpi->vaCreateSurfacesWithAttribute( ctx, width, height, format, num_surfaces, surfaces, attribute_tpi);
  63.   } else
  64.       return VA_STATUS_ERROR_UNIMPLEMENTED;
  65. }
  66.  
  67.  
  68. VAStatus vaPutSurfaceBuf (
  69.     VADisplay dpy,
  70.     VASurfaceID surface,
  71.     unsigned char* data,
  72.     int* data_len,
  73.     short srcx,
  74.     short srcy,
  75.     unsigned short srcw,
  76.     unsigned short srch,
  77.     short destx,
  78.     short desty,
  79.     unsigned short destw,
  80.     unsigned short desth,
  81.     VARectangle *cliprects, /* client supplied clip list */
  82.     unsigned int number_cliprects, /* number of clip rects in the clip list */
  83.     unsigned int flags /* de-interlacing flags */
  84. )
  85. {
  86.   VADriverContextP ctx;
  87.   struct VADriverVTableTPI *tpi;
  88.   CHECK_DISPLAY(dpy);
  89.   ctx = CTX(dpy);
  90.  
  91.   tpi = ( struct VADriverVTableTPI *)ctx->vtable_tpi;
  92.   if (tpi && tpi->vaPutSurfaceBuf) {
  93.       return tpi->vaPutSurfaceBuf( ctx, surface, data, data_len, srcx, srcy, srcw, srch,
  94.                                   destx, desty, destw, desth, cliprects, number_cliprects, flags );
  95.   } else
  96.       return VA_STATUS_ERROR_UNIMPLEMENTED;
  97. }
  98.