xvmc_private.h revision e5f78a74f8294ee02015552db664dae1e7da9f47
1fcb595c04f9ee275eae49b7bb7c61246671f5ce2Younes Manton/************************************************************************** 280468464897682b8e10aeab310f20fdd7ddc6cb4Younes Manton * 3fcb595c04f9ee275eae49b7bb7c61246671f5ce2Younes Manton * Copyright 2009 Younes Manton. 4fcb595c04f9ee275eae49b7bb7c61246671f5ce2Younes Manton * All Rights Reserved. 580468464897682b8e10aeab310f20fdd7ddc6cb4Younes Manton * 6fcb595c04f9ee275eae49b7bb7c61246671f5ce2Younes Manton * Permission is hereby granted, free of charge, to any person obtaining a 7fcb595c04f9ee275eae49b7bb7c61246671f5ce2Younes Manton * copy of this software and associated documentation files (the 8fcb595c04f9ee275eae49b7bb7c61246671f5ce2Younes Manton * "Software"), to deal in the Software without restriction, including 9fcb595c04f9ee275eae49b7bb7c61246671f5ce2Younes Manton * without limitation the rights to use, copy, modify, merge, publish, 10fcb595c04f9ee275eae49b7bb7c61246671f5ce2Younes Manton * distribute, sub license, and/or sell copies of the Software, and to 11fcb595c04f9ee275eae49b7bb7c61246671f5ce2Younes Manton * permit persons to whom the Software is furnished to do so, subject to 12fcb595c04f9ee275eae49b7bb7c61246671f5ce2Younes Manton * the following conditions: 1380468464897682b8e10aeab310f20fdd7ddc6cb4Younes Manton * 14fcb595c04f9ee275eae49b7bb7c61246671f5ce2Younes Manton * The above copyright notice and this permission notice (including the 15fcb595c04f9ee275eae49b7bb7c61246671f5ce2Younes Manton * next paragraph) shall be included in all copies or substantial portions 16fcb595c04f9ee275eae49b7bb7c61246671f5ce2Younes Manton * of the Software. 1780468464897682b8e10aeab310f20fdd7ddc6cb4Younes Manton * 18fcb595c04f9ee275eae49b7bb7c61246671f5ce2Younes Manton * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 19fcb595c04f9ee275eae49b7bb7c61246671f5ce2Younes Manton * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20fcb595c04f9ee275eae49b7bb7c61246671f5ce2Younes Manton * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. 21fcb595c04f9ee275eae49b7bb7c61246671f5ce2Younes Manton * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR 22fcb595c04f9ee275eae49b7bb7c61246671f5ce2Younes Manton * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 23fcb595c04f9ee275eae49b7bb7c61246671f5ce2Younes Manton * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 24fcb595c04f9ee275eae49b7bb7c61246671f5ce2Younes Manton * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 2580468464897682b8e10aeab310f20fdd7ddc6cb4Younes Manton * 26fcb595c04f9ee275eae49b7bb7c61246671f5ce2Younes Manton **************************************************************************/ 27fcb595c04f9ee275eae49b7bb7c61246671f5ce2Younes Manton 28e44c85637a3298918e292e9ddba812856cf92924Younes Manton#ifndef xvmc_private_h 29e44c85637a3298918e292e9ddba812856cf92924Younes Manton#define xvmc_private_h 30e44c85637a3298918e292e9ddba812856cf92924Younes Manton 31e44c85637a3298918e292e9ddba812856cf92924Younes Manton#include <X11/Xlib.h> 32e44c85637a3298918e292e9ddba812856cf92924Younes Manton#include <X11/extensions/XvMClib.h> 338580b7a0eeed3fc29320b2c0a184084e4267661aYounes Manton#include <util/u_debug.h> 34e44c85637a3298918e292e9ddba812856cf92924Younes Manton 35e44c85637a3298918e292e9ddba812856cf92924Younes Manton#define BLOCK_SIZE_SAMPLES 64 36e44c85637a3298918e292e9ddba812856cf92924Younes Manton#define BLOCK_SIZE_BYTES (BLOCK_SIZE_SAMPLES * 2) 37e44c85637a3298918e292e9ddba812856cf92924Younes Manton 38e60a8e4fcf2b4073a5fc2d9ec1de5a6ca6c7b9feYounes Mantonstruct vl_context; 394a0b80f00dbc77d333027afd195daae7ef1e651cChristian Königstruct pipe_sampler_view; 40e44c85637a3298918e292e9ddba812856cf92924Younes Mantonstruct pipe_fence_handle; 41e44c85637a3298918e292e9ddba812856cf92924Younes Manton 42e44c85637a3298918e292e9ddba812856cf92924Younes Mantontypedef struct 43e44c85637a3298918e292e9ddba812856cf92924Younes Manton{ 4480468464897682b8e10aeab310f20fdd7ddc6cb4Younes Manton struct vl_context *vctx; 45e5f78a74f8294ee02015552db664dae1e7da9f47Christian König struct pipe_video_compositor *compositor; 46e5f78a74f8294ee02015552db664dae1e7da9f47Christian König 475eb822cb6a8fb461ee5b1bd881e0ef1b91c432b5Younes Manton unsigned short subpicture_max_width; 485eb822cb6a8fb461ee5b1bd881e0ef1b91c432b5Younes Manton unsigned short subpicture_max_height; 49e44c85637a3298918e292e9ddba812856cf92924Younes Manton} XvMCContextPrivate; 50e44c85637a3298918e292e9ddba812856cf92924Younes Manton 51e44c85637a3298918e292e9ddba812856cf92924Younes Mantontypedef struct 52e44c85637a3298918e292e9ddba812856cf92924Younes Manton{ 53ba0bff85307c9b107cf432da05b39fd4ab242579Christian König struct pipe_video_buffer *pipe_buffer; 54884cb79edfefb1133229a002f41b4d370d717a7eChristian König bool mapped; // are we still mapped to memory? 55884cb79edfefb1133229a002f41b4d370d717a7eChristian König 56884cb79edfefb1133229a002f41b4d370d717a7eChristian König XvMCSurface *ref_surfaces[2]; 57884cb79edfefb1133229a002f41b4d370d717a7eChristian König 58884cb79edfefb1133229a002f41b4d370d717a7eChristian König struct pipe_fence_handle *flush_fence; 5980468464897682b8e10aeab310f20fdd7ddc6cb4Younes Manton struct pipe_fence_handle *render_fence; 6080468464897682b8e10aeab310f20fdd7ddc6cb4Younes Manton struct pipe_fence_handle *disp_fence; 6180468464897682b8e10aeab310f20fdd7ddc6cb4Younes Manton 6280468464897682b8e10aeab310f20fdd7ddc6cb4Younes Manton /* The subpicture associated with this surface, if any. */ 6380468464897682b8e10aeab310f20fdd7ddc6cb4Younes Manton XvMCSubpicture *subpicture; 6480468464897682b8e10aeab310f20fdd7ddc6cb4Younes Manton short subx, suby; 6580468464897682b8e10aeab310f20fdd7ddc6cb4Younes Manton unsigned short subw, subh; 6680468464897682b8e10aeab310f20fdd7ddc6cb4Younes Manton short surfx, surfy; 6780468464897682b8e10aeab310f20fdd7ddc6cb4Younes Manton unsigned short surfw, surfh; 6880468464897682b8e10aeab310f20fdd7ddc6cb4Younes Manton 6980468464897682b8e10aeab310f20fdd7ddc6cb4Younes Manton /* Some XvMC functions take a surface but not a context, 7080468464897682b8e10aeab310f20fdd7ddc6cb4Younes Manton so we keep track of which context each surface belongs to. */ 7180468464897682b8e10aeab310f20fdd7ddc6cb4Younes Manton XvMCContext *context; 72e44c85637a3298918e292e9ddba812856cf92924Younes Manton} XvMCSurfacePrivate; 73e44c85637a3298918e292e9ddba812856cf92924Younes Manton 745f730690f8166c94ee010605b6437a6fb2a7771dYounes Mantontypedef struct 755f730690f8166c94ee010605b6437a6fb2a7771dYounes Manton{ 764a0b80f00dbc77d333027afd195daae7ef1e651cChristian König struct pipe_sampler_view *sampler; 7780468464897682b8e10aeab310f20fdd7ddc6cb4Younes Manton 78849a0b0a821ecc59a50fe53498a6354cfd0b24a4Christian König /* optional palette for this subpicture */ 79849a0b0a821ecc59a50fe53498a6354cfd0b24a4Christian König struct pipe_sampler_view *palette; 80849a0b0a821ecc59a50fe53498a6354cfd0b24a4Christian König 8180468464897682b8e10aeab310f20fdd7ddc6cb4Younes Manton /* The surface this subpicture is currently associated with, if any. */ 8280468464897682b8e10aeab310f20fdd7ddc6cb4Younes Manton XvMCSurface *surface; 8380468464897682b8e10aeab310f20fdd7ddc6cb4Younes Manton 8480468464897682b8e10aeab310f20fdd7ddc6cb4Younes Manton /* Some XvMC functions take a subpicture but not a context, 8580468464897682b8e10aeab310f20fdd7ddc6cb4Younes Manton so we keep track of which context each subpicture belongs to. */ 8680468464897682b8e10aeab310f20fdd7ddc6cb4Younes Manton XvMCContext *context; 8780468464897682b8e10aeab310f20fdd7ddc6cb4Younes Manton} XvMCSubpicturePrivate; 885f730690f8166c94ee010605b6437a6fb2a7771dYounes Manton 898580b7a0eeed3fc29320b2c0a184084e4267661aYounes Manton#define XVMC_OUT 0 908580b7a0eeed3fc29320b2c0a184084e4267661aYounes Manton#define XVMC_ERR 1 918580b7a0eeed3fc29320b2c0a184084e4267661aYounes Manton#define XVMC_WARN 2 928580b7a0eeed3fc29320b2c0a184084e4267661aYounes Manton#define XVMC_TRACE 3 938580b7a0eeed3fc29320b2c0a184084e4267661aYounes Mantonstatic INLINE void XVMC_MSG(unsigned int level, const char *fmt, ...) 948580b7a0eeed3fc29320b2c0a184084e4267661aYounes Manton{ 958580b7a0eeed3fc29320b2c0a184084e4267661aYounes Manton static boolean check_dbg_level = TRUE; 968580b7a0eeed3fc29320b2c0a184084e4267661aYounes Manton static unsigned int debug_level; 978580b7a0eeed3fc29320b2c0a184084e4267661aYounes Manton 988580b7a0eeed3fc29320b2c0a184084e4267661aYounes Manton if (check_dbg_level) { 998580b7a0eeed3fc29320b2c0a184084e4267661aYounes Manton debug_level = debug_get_num_option("XVMC_DEBUG", 0); 1008580b7a0eeed3fc29320b2c0a184084e4267661aYounes Manton check_dbg_level = FALSE; 1018580b7a0eeed3fc29320b2c0a184084e4267661aYounes Manton } 1028580b7a0eeed3fc29320b2c0a184084e4267661aYounes Manton 1038580b7a0eeed3fc29320b2c0a184084e4267661aYounes Manton if (level <= debug_level) { 1048580b7a0eeed3fc29320b2c0a184084e4267661aYounes Manton va_list ap; 1058580b7a0eeed3fc29320b2c0a184084e4267661aYounes Manton va_start(ap, fmt); 1068580b7a0eeed3fc29320b2c0a184084e4267661aYounes Manton _debug_vprintf(fmt, ap); 1078580b7a0eeed3fc29320b2c0a184084e4267661aYounes Manton va_end(ap); 1088580b7a0eeed3fc29320b2c0a184084e4267661aYounes Manton } 1098580b7a0eeed3fc29320b2c0a184084e4267661aYounes Manton} 1108580b7a0eeed3fc29320b2c0a184084e4267661aYounes Manton 111e44c85637a3298918e292e9ddba812856cf92924Younes Manton#endif /* xvmc_private_h */ 112