Add pvrvideosink element

PVRVideoSink uses PVR2D library to blit images.

Author: Alessandro Decina <alessandro.decina@collabora.co.uk>
Author: Luciana Fujii <luciana.fujii@collabora.co.uk>
This commit is contained in:
Luciana Fujii Pontello 2011-08-30 23:39:36 -03:00 committed by Alessandro Decina
parent c61f85da82
commit cdcc39455c
16 changed files with 5752 additions and 2 deletions

View file

@ -229,6 +229,8 @@ if test "x$BUILD_EXAMPLES" = "xyes"; then
fi
AM_CONDITIONAL(HAVE_GTK, test "x$HAVE_GTK" = "xyes")
dnl Needed for GtkBuilder to autoconnect signals
PKG_CHECK_MODULES(GMODULE_EXPORT, gmodule-export-2.0, HAVE_GMODULE_EXPORT=yes, HAVE_GMODULE_EXPORT=no)
@ -1401,6 +1403,20 @@ AG_GST_CHECK_FEATURE(OPUS, [opus], opus, [
AC_SUBST(OPUS_LIBS)
])
dnl *** pvr ***
translit(dnm, m, l) AM_CONDITIONAL(USE_PVR, true)
AG_GST_CHECK_FEATURE(PVR, [pvrvideosink], pvr, [
PKG_CHECK_MODULES([PVR], [libtimemmgr], HAVE_PVR=yes, HAVE_PVR=no)
AC_SUBST(PVR_CFLAGS)
AC_SUBST(PVR_LIBS)
])
AC_ARG_WITH([pvr-external-headers],
AC_HELP_STRING([--with-pvr-external-headers], [Use system installed PVR2D headers]),
[AS_IF([test "x$with_pvr_external_headers" = "xno"],
[PVR_CFLAGS="$PVR_CFLAGS -I\$(srcdir)/pvr_includes"])],
[PVR_CFLAGS="$PVR_CFLAGS -I\$(srcdir)/pvr_includes"])
dnl *** rsvg ***
translit(dnm, m, l) AM_CONDITIONAL(USE_RSVG, true)
AG_GST_CHECK_FEATURE(RSVG, [rsvg decoder], rsvg, [
@ -1792,6 +1808,7 @@ AM_CONDITIONAL(USE_OFA, false)
AM_CONDITIONAL(USE_OPENAL, false)
AM_CONDITIONAL(USE_OPENCV, false)
AM_CONDITIONAL(USE_OPUS, false)
AM_CONDITIONAL(USE_PVR, false)
AM_CONDITIONAL(USE_RSVG, false)
AM_CONDITIONAL(USE_TIMIDITY, false)
AM_CONDITIONAL(USE_WILDMIDI, false)
@ -1991,6 +2008,7 @@ sys/vcd/Makefile
sys/vdpau/Makefile
sys/vdpau/gstvdp/Makefile
sys/vdpau/basevideodecoder/Makefile
sys/pvr2d/Makefile
sys/wasapi/Makefile
sys/wininet/Makefile
sys/winks/Makefile

View file

@ -101,6 +101,7 @@ else
VDPAU_DIR=
endif
if USE_SHM
SHM_DIR=shm
else
@ -113,9 +114,15 @@ else
AVC_DIR=
endif
SUBDIRS = $(ACM_DIR) $(APPLE_MEDIA_DIR) $(AVC_DIR) $(D3DVIDEOSINK_DIR) $(DECKLINK_DIR) $(DIRECTDRAW_DIR) $(DIRECTSOUND_DIR) $(DVB_DIR) $(FBDEV_DIR) $(LINSYS_DIR) $(OSX_VIDEO_DIR) $(QT_DIR) $(SHM_DIR) $(VCD_DIR) $(VDPAU_DIR) $(WININET_DIR)
if USE_PVR
PVR_DIR=pvr2d
else
PVR_DIR=
endif
SUBDIRS = $(ACM_DIR) $(APPLE_MEDIA_DIR) $(AVC_DIR) $(D3DVIDEOSINK_DIR) $(DECKLINK_DIR) $(DIRECTDRAW_DIR) $(DIRECTSOUND_DIR) $(DVB_DIR) $(FBDEV_DIR) $(LINSYS_DIR) $(OSX_VIDEO_DIR) $(QT_DIR) $(SHM_DIR) $(VCD_DIR) $(VDPAU_DIR) $(WININET_DIR) $(PVR_DIR)
DIST_SUBDIRS = acmenc acmmp3dec applemedia avc d3dvideosink decklink directdraw directsound dvb linsys fbdev dshowdecwrapper dshowsrcwrapper dshowvideosink \
osxvideo qtwrapper shm vcd vdpau wasapi wininet winks winscreencap
osxvideo qtwrapper shm vcd vdpau wasapi wininet winks winscreencap pvr2d
include $(top_srcdir)/common/parallel-subdirs.mak

22
sys/pvr2d/Makefile.am Normal file
View file

@ -0,0 +1,22 @@
plugin_LTLIBRARIES = libgstpvr.la
libgstpvr_la_SOURCES = \
gstpvr.c \
gstpvrbufferpool.c \
gstpvrvideosink.c
libgstpvr_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS) $(PVR_CFLAGS)
libgstpvr_la_LIBADD = $(GST_LIBS) $(GST_BASE_LIBS) \
$(GST_PLUGINS_BASE_LIBS) $(X11_LIBS) -lgstvideo-$(GST_MAJORMINOR) \
-lgstinterfaces-$(GST_MAJORMINOR) -lpvr2d -lpvrPVR2D_DRIWSEGL\
$(PVR_LIBS) \
$(LIBM)
libgstpvr_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
libgstpvr_la_LIBTOOLFLAGS = --tag=disable-static
noinst_HEADERS = \
gstpvr.h \
gstpvrbufferpool.h \
gstpvrvideosink.h

85
sys/pvr2d/gstpvr.c Normal file
View file

@ -0,0 +1,85 @@
/*
* GStreamer
* Copyright (c) 2010, Texas Instruments Incorporated
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation
* version 2.1 of the License.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "gstpvr.h"
#include "gstpvrvideosink.h"
GST_DEBUG_CATEGORY (gst_debug_pvrvideosink);
static gboolean
plugin_init (GstPlugin * plugin)
{
GST_DEBUG_CATEGORY_INIT (gst_debug_pvrvideosink, "pvrvideosink", 0,
"pvrvideosink");
return gst_element_register (plugin, "pvrvideosink", GST_RANK_PRIMARY,
GST_TYPE_PVRVIDEOSINK);
}
void *
gst_ducati_alloc_1d (gint sz)
{
MemAllocBlock block = {
.pixelFormat = PIXEL_FMT_PAGE,
.dim.len = sz,
};
return MemMgr_Alloc (&block, 1);
}
void *
gst_ducati_alloc_2d (gint width, gint height, guint * sz)
{
MemAllocBlock block[] = { {
.pixelFormat = PIXEL_FMT_8BIT,
.dim = {.area = {
.width = width,
.height = ALIGN2 (height, 1),
}},
.stride = 4096}, {
.pixelFormat = PIXEL_FMT_16BIT,
.dim = {.area = {
.width = width,
.height = ALIGN2 (height, 1) / 2,
}},
.stride = 4096}
};
if (sz) {
*sz = (4096 * ALIGN2 (height, 1) * 3) / 2;
}
return MemMgr_Alloc (block, 2);
}
/* PACKAGE: this is usually set by autotools depending on some _INIT macro
* in configure.ac and then written into and defined in config.h, but we can
* just set it ourselves here in case someone doesn't use autotools to
* compile this code. GST_PLUGIN_DEFINE needs PACKAGE to be defined.
*/
#ifndef PACKAGE
# define PACKAGE "ducati"
#endif
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
GST_VERSION_MINOR,
"pvr",
"Pvr2d based plugin",
plugin_init, VERSION, "LGPL", "GStreamer", "http://gstreamer.net/")

42
sys/pvr2d/gstpvr.h Normal file
View file

@ -0,0 +1,42 @@
/*
* GStreamer
* Copyright (c) 2010, Texas Instruments Incorporated
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation
* version 2.1 of the License.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef __GST_DUCATI_H__
#define __GST_DUCATI_H__
#include <stdint.h>
#include <string.h>
#include <tiler.h>
#include <tilermem.h>
#include <memmgr.h>
#include <gst/gst.h>
G_BEGIN_DECLS
/* align x to next highest multiple of 2^n */
#define ALIGN2(x,n) (((x) + ((1 << (n)) - 1)) & ~((1 << (n)) - 1))
void * gst_ducati_alloc_1d (gint sz);
void * gst_ducati_alloc_2d (gint width, gint height, guint * sz);
G_END_DECLS
#endif /* __GST_DUCATI_H__ */

View file

@ -0,0 +1,320 @@
/*
* GStreamer
* Copyright (c) 2010, Texas Instruments Incorporated
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation
* version 2.1 of the License.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "gstpvrbufferpool.h"
GST_DEBUG_CATEGORY_EXTERN (gst_debug_pvrvideosink);
#define GST_CAT_DEFAULT gst_debug_pvrvideosink
/*
* GstDucatiBuffer
*/
static GstBufferClass *buffer_parent_class;
/* Get the original buffer, or whatever is the best output buffer.
* Consumes the input reference, produces the output reference
*/
GstBuffer *
gst_ducati_buffer_get (GstDucatiBuffer * self)
{
if (self->orig) {
// TODO copy to orig buffer.. if needed.
gst_buffer_unref (self->orig);
self->orig = NULL;
}
return GST_BUFFER (self);
}
PVR2DMEMINFO *
gst_ducati_buffer_get_meminfo (GstDucatiBuffer * self)
{
return self->src_mem;
}
static GstDucatiBuffer *
gst_ducati_buffer_new (GstPvrBufferPool * pool)
{
PVR2DERROR pvr_error;
GstDucatiBuffer *self = (GstDucatiBuffer *)
gst_mini_object_new (GST_TYPE_DUCATIBUFFER);
GST_LOG_OBJECT (pool->element, "creating buffer %p in pool %p", self, pool);
self->pool = (GstPvrBufferPool *)
gst_mini_object_ref (GST_MINI_OBJECT (pool));
GST_BUFFER_DATA (self) = gst_ducati_alloc_1d (pool->size);
GST_BUFFER_SIZE (self) = pool->size;
GST_LOG_OBJECT (pool->element, "width=%d, height=%d and size=%d",
pool->padded_width, pool->padded_height, pool->size);
pvr_error =
PVR2DMemWrap (pool->pvr_context, GST_BUFFER_DATA (self), 0, pool->size,
NULL, &(self->src_mem));
if (pvr_error != PVR2D_OK) {
GST_LOG_OBJECT (pool->element, "Failed to Wrap buffer memory"
"returned %d", pvr_error);
} else {
self->wrapped = TRUE;
}
gst_buffer_set_caps (GST_BUFFER (self), pool->caps);
return self;
}
static void
gst_ducati_buffer_finalize (GstDucatiBuffer * self)
{
PVR2DERROR pvr_error;
GstPvrBufferPool *pool = self->pool;
gboolean resuscitated = FALSE;
GST_LOG_OBJECT (pool->element, "finalizing buffer %p", self);
GST_PVR_BUFFERPOOL_LOCK (pool);
g_queue_remove (pool->used_buffers, self);
if (pool->running) {
resuscitated = TRUE;
GST_LOG_OBJECT (pool->element, "reviving buffer %p", self);
g_queue_push_head (pool->free_buffers, self);
} else {
GST_LOG_OBJECT (pool->element, "the pool is shutting down");
}
GST_PVR_BUFFERPOOL_UNLOCK (pool);
if (resuscitated) {
GST_LOG_OBJECT (pool->element, "reviving buffer %p, %d", self, index);
gst_buffer_ref (GST_BUFFER (self));
GST_BUFFER_SIZE (self) = 0;
}
if (!resuscitated) {
GST_LOG_OBJECT (pool->element,
"buffer %p (data %p, len %u) not recovered, freeing",
self, GST_BUFFER_DATA (self), GST_BUFFER_SIZE (self));
if (self->wrapped) {
pvr_error = PVR2DMemFree (pool->pvr_context, self->src_mem);
if (pvr_error != PVR2D_OK) {
GST_ERROR_OBJECT (pool->element, "Failed to Unwrap buffer memory"
"returned %d", pvr_error);
}
self->wrapped = FALSE;
}
MemMgr_Free ((void *) GST_BUFFER_DATA (self));
GST_BUFFER_DATA (self) = NULL;
gst_mini_object_unref (GST_MINI_OBJECT (pool));
GST_MINI_OBJECT_CLASS (buffer_parent_class)->finalize (GST_MINI_OBJECT
(self));
}
}
static void
gst_ducati_buffer_class_init (gpointer g_class, gpointer class_data)
{
GstMiniObjectClass *mini_object_class = GST_MINI_OBJECT_CLASS (g_class);
buffer_parent_class = g_type_class_peek_parent (g_class);
mini_object_class->finalize = (GstMiniObjectFinalizeFunction)
GST_DEBUG_FUNCPTR (gst_ducati_buffer_finalize);
}
GType
gst_ducati_buffer_get_type (void)
{
static GType type;
if (G_UNLIKELY (type == 0)) {
static const GTypeInfo info = {
.class_size = sizeof (GstBufferClass),
.class_init = gst_ducati_buffer_class_init,
.instance_size = sizeof (GstDucatiBuffer),
};
type = g_type_register_static (GST_TYPE_BUFFER,
"GstDucatiBufferPvrsink", &info, 0);
}
return type;
}
/*
* GstDucatiBufferPool
*/
static GstMiniObjectClass *bufferpool_parent_class = NULL;
/** create new bufferpool
* @element : the element that owns this pool
* @caps: the caps to set on the buffer
* @num_buffers: the requested number of buffers in the pool
*/
GstPvrBufferPool *
gst_pvr_bufferpool_new (GstElement * element, GstCaps * caps, gint num_buffers,
gint size, PVR2DCONTEXTHANDLE pvr_context)
{
GstPvrBufferPool *self = (GstPvrBufferPool *)
gst_mini_object_new (GST_TYPE_PVRBUFFERPOOL);
GstStructure *s = gst_caps_get_structure (caps, 0);
self->element = gst_object_ref (element);
gst_structure_get_int (s, "width", &self->padded_width);
gst_structure_get_int (s, "height", &self->padded_height);
self->caps = gst_caps_ref (caps);
self->size = size;
self->pvr_context = pvr_context;
self->free_buffers = g_queue_new ();
self->used_buffers = g_queue_new ();
self->lock = g_mutex_new ();
self->running = TRUE;
return self;
}
static void
unwrap_buffer (gpointer buffer, gpointer user_data)
{
PVR2DERROR pvr_error;
GstDucatiBuffer *buf = GST_DUCATIBUFFER (buffer);
GstPvrBufferPool *pool = (GstPvrBufferPool *) user_data;
if (buf->wrapped) {
pvr_error = PVR2DMemFree (pool->pvr_context, buf->src_mem);
if (pvr_error != PVR2D_OK) {
GST_ERROR_OBJECT (pool->element, "Failed to Unwrap buffer memory"
"returned %d", pvr_error);
}
buf->wrapped = FALSE;
}
}
void
gst_pvr_bufferpool_stop_running (GstPvrBufferPool * self, gboolean unwrap)
{
gboolean empty = FALSE;
g_return_if_fail (self);
GST_PVR_BUFFERPOOL_LOCK (self);
self->running = FALSE;
GST_PVR_BUFFERPOOL_UNLOCK (self);
GST_DEBUG_OBJECT (self->element, "free available buffers");
/* free all buffers on the freelist */
while (!empty) {
GstDucatiBuffer *buf;
GST_PVR_BUFFERPOOL_LOCK (self);
buf = g_queue_pop_head (self->free_buffers);
GST_PVR_BUFFERPOOL_UNLOCK (self);
if (buf)
gst_buffer_unref (GST_BUFFER (buf));
else
empty = TRUE;
}
if (unwrap)
g_queue_foreach (self->used_buffers, unwrap_buffer, self);
gst_mini_object_unref (GST_MINI_OBJECT (self));
}
/** get buffer from bufferpool, allocate new buffer if needed */
GstDucatiBuffer *
gst_pvr_bufferpool_get (GstPvrBufferPool * self, GstBuffer * orig)
{
GstDucatiBuffer *buf = NULL;
g_return_val_if_fail (self, NULL);
GST_PVR_BUFFERPOOL_LOCK (self);
if (self->running) {
/* re-use a buffer off the freelist if any are available
*/
buf = g_queue_pop_head (self->free_buffers);
if (!buf)
buf = gst_ducati_buffer_new (self);
buf->orig = orig;
g_queue_push_head (self->used_buffers, buf);
}
GST_PVR_BUFFERPOOL_UNLOCK (self);
if (buf && orig) {
GST_BUFFER_TIMESTAMP (buf) = GST_BUFFER_TIMESTAMP (orig);
GST_BUFFER_DURATION (buf) = GST_BUFFER_DURATION (orig);
}
GST_BUFFER_SIZE (buf) = self->size;
return buf;
}
static void
gst_pvr_bufferpool_finalize (GstPvrBufferPool * self)
{
GST_DEBUG_OBJECT (self->element, "destroy bufferpool");
g_mutex_free (self->lock);
self->lock = NULL;
g_queue_free (self->free_buffers);
self->free_buffers = NULL;
g_queue_free (self->used_buffers);
self->used_buffers = NULL;
gst_caps_unref (self->caps);
self->caps = NULL;
gst_object_unref (self->element);
self->element = NULL;
GST_MINI_OBJECT_CLASS (bufferpool_parent_class)->finalize (GST_MINI_OBJECT
(self));
}
static void
gst_pvr_bufferpool_class_init (gpointer g_class, gpointer class_data)
{
GstMiniObjectClass *mini_object_class = GST_MINI_OBJECT_CLASS (g_class);
bufferpool_parent_class = g_type_class_peek_parent (g_class);
mini_object_class->finalize = (GstMiniObjectFinalizeFunction)
GST_DEBUG_FUNCPTR (gst_pvr_bufferpool_finalize);
}
GType
gst_pvr_bufferpool_get_type (void)
{
static GType type;
if (G_UNLIKELY (type == 0)) {
static const GTypeInfo info = {
.class_size = sizeof (GstMiniObjectClass),
.class_init = gst_pvr_bufferpool_class_init,
.instance_size = sizeof (GstPvrBufferPool),
};
type = g_type_register_static (GST_TYPE_MINI_OBJECT,
"GstPvrBufferPool", &info, 0);
}
return type;
}

View file

@ -0,0 +1,89 @@
/*
* GStreamer
* Copyright (c) 2010, 2011 Texas Instruments Incorporated
* Copyright (c) 2011, Collabora Ltda
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation
* version 2.1 of the License.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef __GSTPVRBUFFERPOOL_H__
#define __GSTPVRBUFFERPOOL_H__
#include "gstpvr.h"
#include <pvr2d.h>
G_BEGIN_DECLS
GType gst_ducati_buffer_get_type (void);
#define GST_TYPE_DUCATIBUFFER (gst_ducati_buffer_get_type())
#define GST_IS_DUCATIBUFFER(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_DUCATIBUFFER))
#define GST_DUCATIBUFFER(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_DUCATIBUFFER, GstDucatiBuffer))
GType gst_pvr_bufferpool_get_type (void);
#define GST_TYPE_PVRBUFFERPOOL (gst_pvr_bufferpool_get_type())
#define GST_IS_PVRBUFFERPOOL(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_PVRBUFFERPOOL))
#define GST_PVRBUFFERPOOL(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_PVRBUFFERPOOL, \
GstPvrBufferPool))
typedef struct _GstPvrBufferPool GstPvrBufferPool;
typedef struct _GstDucatiBuffer GstDucatiBuffer;
struct _GstPvrBufferPool
{
GstMiniObject parent;
/* output (padded) size including any codec padding: */
gint padded_width, padded_height;
gint size;
PVR2DCONTEXTHANDLE pvr_context;
GstCaps *caps;
GMutex *lock;
gboolean running; /* with lock */
GstElement *element; /* the element that owns us.. */
GQueue *free_buffers;
GQueue *used_buffers;
guint buffer_count;
};
GstPvrBufferPool * gst_pvr_bufferpool_new (GstElement * element,
GstCaps * caps, gint num_buffers, gint size,
PVR2DCONTEXTHANDLE pvr_context);
void gst_pvr_bufferpool_stop_running (GstPvrBufferPool * pool, gboolean unwrap);
GstDucatiBuffer * gst_pvr_bufferpool_get (GstPvrBufferPool * self,
GstBuffer * orig);
#define GST_PVR_BUFFERPOOL_LOCK(self) g_mutex_lock ((self)->lock)
#define GST_PVR_BUFFERPOOL_UNLOCK(self) g_mutex_unlock ((self)->lock)
struct _GstDucatiBuffer {
GstBuffer parent;
GstPvrBufferPool *pool; /* buffer-pool that this buffer belongs to */
GstBuffer *orig; /* original buffer, if we need to copy output */
PVR2DMEMINFO *src_mem; /* Memory wrapped by pvr */
gboolean wrapped;
};
GstBuffer * gst_ducati_buffer_get (GstDucatiBuffer * self);
PVR2DMEMINFO * gst_ducati_buffer_get_meminfo (GstDucatiBuffer * self);
G_END_DECLS
#endif /* __GSTPVRBUFFERPOOL_H__ */

1548
sys/pvr2d/gstpvrvideosink.c Normal file

File diff suppressed because it is too large Load diff

157
sys/pvr2d/gstpvrvideosink.h Normal file
View file

@ -0,0 +1,157 @@
/* GStreamer
*
* Copyright (C) 2011 - Collabora Ltda
* Copyright (C) 2011 - Texas Instruments
* @author: Luciana Fujii Pontello <luciana.fujii@collabora.co.uk>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GST_PVRVIDEOSINK_H__
#define __GST_PVRVIDEOSINK_H__
#include <gst/video/gstvideosink.h>
#include <gst/video/video.h>
#include "gstpvrbufferpool.h"
#include <string.h>
#include <math.h>
#include <pvr2d.h>
#include <EGL/egl.h>
#include <wsegl.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
G_BEGIN_DECLS
#define GST_TYPE_PVRVIDEOSINK (gst_pvrvideosink_get_type())
#define GST_PVRVIDEOSINK(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_PVRVIDEOSINK, GstPVRVideoSink))
#define GST_PVRVIDEOSINK_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_PVRVIDEOSINK, GstPVRVideoSinkClass))
#define GST_IS_PVRVIDEOSINK(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_PVRVIDEOSINK))
#define GST_IS_PVRVIDEOSINK_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_PVRVIDEOSINK))
typedef struct _GstDrawContext GstDrawContext;
typedef struct _GstXWindow GstXWindow;
typedef struct _GstPVRVideoBuffer GstPVRVideoBuffer;
typedef struct _GstPVRVideoBufferClass GstPVRVideoBufferClass;
typedef struct _GstPVRVideoSink GstPVRVideoSink;
typedef struct _GstPVRVideoSinkClass GstPVRVideoSinkClass;
struct _GstDrawContext
{
/* PVR2D */
PVR2DCONTEXTHANDLE pvr_context;
PVR2DMEMINFO dst_mem;
PPVR2D_3DBLT_EXT p_blt_info;
PPVR2DBLTINFO p_blt2d_info;
long stride;
PVR2DFORMAT display_format;
long display_width;
long display_height;
/* WSEGL */
const WSEGL_FunctionTable *wsegl_table;
WSEGLDisplayHandle display_handle;
const WSEGLCaps **glcaps;
WSEGLConfig *glconfig;
WSEGLDrawableHandle drawable_handle;
WSEGLRotationAngle rotation;
GMutex *x_lock;
Display *x_display;
gint screen_num;
gulong black;
};
struct _GstXWindow
{
Window window;
gint width, height;
gboolean internal;
GC gc;
};
/**
* GstPVRVideoSink:
* @running: used to inform @event_thread if it should run/shutdown
* @fps_n: the framerate fraction numerator
* @fps_d: the framerate fraction denominator
* @flow_lock: used to protect data flow routines from external calls such as
* events from @event_thread or methods from the #GstXOverlay interface
* @pool_lock: used to protect the buffer pool
* @x_lock: used to protect X calls
* @buffer_pool: a list of #GstPVRVideoBuffer that could be reused at next buffer
* allocation call
* @keep_aspect: used to remember if reverse negotiation scaling should respect
* aspect ratio
*
* The #GstPVRVideoSink data structure.
*/
struct _GstPVRVideoSink
{
/* Our element stuff */
GstVideoSink videosink;
gboolean running;
/* Framerate numerator and denominator */
GstVideoFormat format;
gint fps_n;
gint fps_d;
gint rowstride;
GThread *event_thread;
GMutex *flow_lock;
GMutex *pool_lock;
GstPvrBufferPool *buffer_pool;
gboolean pool_invalid;
gint num_buffers;
gboolean num_buffers_can_change;
gint min_queued_bufs;
gboolean keep_aspect;
GstCaps *current_caps;
GstDrawContext *dcontext;
GstXWindow *xwindow;
GstVideoRectangle render_rect;
gboolean have_render_rect;
gchar *media_title;
gboolean redraw_borders;
GstBuffer *current_buffer;
WSEGLDrawableParams render_params;
};
struct _GstPVRVideoSinkClass
{
GstVideoSinkClass parent_class;
};
GType gst_pvrvideosink_get_type (void);
G_END_DECLS
#endif /* __GST_PVRVIDEOSINK_H__ */

176
sys/pvr2d/pvr_includes/dri2_ws.h Executable file
View file

@ -0,0 +1,176 @@
/**********************************************************************
*
* Copyright(c) Imagination Technologies Ltd.
*
* The contents of this file are subject to the MIT license as set out below.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
* OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* This License is also included in this distribution in the file called
* "COPYING".
*
******************************************************************************/
#if !defined(__DRI2_WS_H__)
#define __DRI2_WS_H__
#define DRI2WS_DISPFLAG_DEFAULT_DISPLAY 0x00000001
/*
// Constants (macros) related to back-buffering.
*/
#define XWS_FLIP_BUFFERS 3
#define DRI2_FLIP_BUFFERS_NUM XWS_FLIP_BUFFERS
#define XWS_FLIP_BUFFER_INDEX (XWS_MAX_FLIP_BUFFERS - 1)
#define XWS_BLIT_BUFFERS 2
#define DRI2_BLIT_BUFFERS_NUM XWS_BLIT_BUFFERS
#define XWS_BLIT_BUFFER_INDEX (XWS_MAX_BLIT_BUFFERS - 1)
#if 0
#define MIN(a,b) ((a)<(b)?(a):(b))
#define MAX(a,b) ((a)>(b)?(a):(b))
#endif
#define XWS_MAX_BUFFERS MAX(XWS_FLIP_BUFFERS, XWS_BLIT_BUFFERS)
#define DRI2_MAX_BUFFERS_NUM XWS_MAX_BUFFERS
#define __DRI_BUFFER_EMPTY 103
/** Used for ugly ugly ugly swap interval passing to dri2 driver and receiving current frame index */
#define __DRI_BUFFER_PVR_CTRL 0x80 /* 100000XX <- last 2 bits for swap interval value */
#define __DRI_BUFFER_PVR_CTRL_RET 0x90 /* 11000000 */
#define DRI2_BACK_BUFFER_EXPORT_TYPE_BUFFERS 1
#define DRI2_BACK_BUFFER_EXPORT_TYPE_SWAPCHAIN 2
#define UNREFERENCED_PARAMETER(x) (x) = (x)
/*
* Structure used to pass information about back buffers between client application and
* X.Org. Watch out for equivalent structure in pvr_video lib
*/
typedef struct _PVRDRI2BackBuffersExport_
{
/* Type of export. _BUFFERS mean set of handles, _SWAPCHAIN mean Swap chain ID */
unsigned int ui32Type;
PVR2D_HANDLE hBuffers[DRI2_MAX_BUFFERS_NUM];
unsigned int ui32BuffersCount;
unsigned int ui32SwapChainID;
} PVRDRI2BackBuffersExport;
/*
// Private window system display information
*/
typedef struct DRI2WS_Display_TAG
{
unsigned int ui32RefCount;
Display *display;
int screen;
unsigned int ui32Flags;
unsigned int ui32Width;
unsigned int ui32Height;
unsigned int ui32StrideInBytes;
unsigned int ui32BytesPerPixel;
WSEGLPixelFormat ePixelFormat;
PVR2DFORMAT ePVR2DPixelFormat;
PVR2DCONTEXTHANDLE hContext;
PVR2DMEMINFO *psMemInfo;
int iDRMfd;
} DRI2WSDisplay;
typedef enum DRI2WS_DrawableType_TAG
{
DRI2_DRAWABLE_UNKNOWN = 0,
DRI2_DRAWABLE_WINDOW = 1,
DRI2_DRAWABLE_PIXMAP = 2,
} DRI2WS_DrawableType;
/*
// Private window system drawable information
*/
typedef struct DRI2WS_Drawable_TAG
{
DRI2WS_DrawableType eDrawableType;
Window nativeWin;
/** Index of current render-to back buffer (received from Xserver) */
unsigned int ui32BackBufferCurrent;
/** Number of buffers */
unsigned int ui32BackBufferNum;
/** Swap interval (works only in fliping/fullscreen case, values 0-3) */
unsigned int ui32SwapInterval;
/** PVR2D Handles received from Xserver (back buffers export structure) */
PVR2D_HANDLE hPVR2DBackBufferExport;
/** Stamp of current back buffer */
unsigned char ucBackBufferExportStamp;
/** Array of PVR2D Handles received from Xserver (our back buffers) */
PVR2D_HANDLE hPVR2DBackBuffer[XWS_MAX_BUFFERS];
/** Array of PVR2D mapped back buffers */
PVR2DMEMINFO *psMemBackBuffer[XWS_MAX_BUFFERS];
/** Stamp of current back buffer */
unsigned char ucFrontBufferStamp;
/** Array of PVR2D Handles received from Xserver (our back buffers) */
PVR2D_HANDLE hPVR2DFrontBuffer;
/** Array of PVR2D mapped back buffers */
PVR2DMEMINFO *psMemFrontBuffer;
/** ID of flip/swap chain received from X.Org */
unsigned int ui32FlipChainID;
/** PVR2D Handle of flip chain used to get buffers to draw to */
PVR2DFLIPCHAINHANDLE hFlipChain;
int iWidth;
int iHeight;
WSEGLPixelFormat ePixelFormat;
unsigned int ui32BytesPerPixel;
unsigned int ui32StrideInPixels;
unsigned int ui32StrideInBytes;
PVR2DFORMAT ePVR2DPixelFormat;
DRI2WSDisplay *psXWSDisplay;
} DRI2WSDrawable;
#endif /* __DRI2_WS_H__ */

123
sys/pvr2d/pvr_includes/img_defs.h Executable file
View file

@ -0,0 +1,123 @@
/**********************************************************************
*
* Copyright(c) Imagination Technologies Ltd.
*
* The contents of this file are subject to the MIT license as set out below.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
* OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* This License is also included in this distribution in the file called
* "COPYING".
*
******************************************************************************/
#if !defined (__IMG_DEFS_H__)
#define __IMG_DEFS_H__
#include "img_types.h"
typedef enum img_tag_TriStateSwitch
{
IMG_ON = 0x00,
IMG_OFF,
IMG_IGNORE
} img_TriStateSwitch, * img_pTriStateSwitch;
#define IMG_SUCCESS 0
#define IMG_NO_REG 1
#if defined (NO_INLINE_FUNCS)
#define INLINE
#define FORCE_INLINE
#else
#if defined (__cplusplus)
#define INLINE inline
#define FORCE_INLINE inline
#else
#if !defined(INLINE)
#define INLINE __inline
#endif
#define FORCE_INLINE static __inline
#endif
#endif
#ifndef PVR_UNREFERENCED_PARAMETER
#define PVR_UNREFERENCED_PARAMETER(param) (param) = (param)
#endif
#ifdef __GNUC__
#define unref__ __attribute__ ((unused))
#else
#define unref__
#endif
#ifndef _TCHAR_DEFINED
#if defined(UNICODE)
typedef unsigned short TCHAR, *PTCHAR, *PTSTR;
#else
typedef char TCHAR, *PTCHAR, *PTSTR;
#endif
#define _TCHAR_DEFINED
#endif
#if defined(__linux__) || defined(__METAG)
#define IMG_CALLCONV
#define IMG_INTERNAL __attribute__((visibility("hidden")))
#define IMG_EXPORT __attribute__((visibility("default")))
#define IMG_IMPORT
#define IMG_RESTRICT __restrict__
#else
#error("define an OS")
#endif
#ifndef IMG_ABORT
#define IMG_ABORT() abort()
#endif
#ifndef IMG_MALLOC
#define IMG_MALLOC(A) malloc (A)
#endif
#ifndef IMG_FREE
#define IMG_FREE(A) free (A)
#endif
#define IMG_CONST const
#if defined(__GNUC__)
#define IMG_FORMAT_PRINTF(x,y) __attribute__((format(printf,x,y)))
#else
#define IMG_FORMAT_PRINTF(x,y)
#endif
#if defined (_WIN64)
#define IMG_UNDEF (~0ULL)
#else
#define IMG_UNDEF (~0UL)
#endif
#endif

View file

@ -0,0 +1,143 @@
/**********************************************************************
*
* Copyright(c) Imagination Technologies Ltd.
*
* The contents of this file are subject to the MIT license as set out below.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
* OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* This License is also included in this distribution in the file called
* "COPYING".
*
******************************************************************************/
#ifndef __IMG_TYPES_H__
#define __IMG_TYPES_H__
#if !defined(IMG_ADDRSPACE_CPUVADDR_BITS)
#define IMG_ADDRSPACE_CPUVADDR_BITS 32
#endif
#if !defined(IMG_ADDRSPACE_PHYSADDR_BITS)
#define IMG_ADDRSPACE_PHYSADDR_BITS 32
#endif
typedef unsigned int IMG_UINT, *IMG_PUINT;
typedef signed int IMG_INT, *IMG_PINT;
typedef unsigned char IMG_UINT8, *IMG_PUINT8;
typedef unsigned char IMG_BYTE, *IMG_PBYTE;
typedef signed char IMG_INT8, *IMG_PINT8;
typedef char IMG_CHAR, *IMG_PCHAR;
typedef unsigned short IMG_UINT16, *IMG_PUINT16;
typedef signed short IMG_INT16, *IMG_PINT16;
#if !defined(IMG_UINT32_IS_ULONG)
typedef unsigned int IMG_UINT32, *IMG_PUINT32;
typedef signed int IMG_INT32, *IMG_PINT32;
#else
typedef unsigned long IMG_UINT32, *IMG_PUINT32;
typedef signed long IMG_INT32, *IMG_PINT32;
#endif
#if !defined(IMG_UINT32_MAX)
#define IMG_UINT32_MAX 0xFFFFFFFFUL
#endif
#if (defined(LINUX) || defined(__METAG))
#if !defined(USE_CODE)
typedef unsigned long long IMG_UINT64, *IMG_PUINT64;
typedef long long IMG_INT64, *IMG_PINT64;
#endif
#else
#error("define an OS")
#endif
#if !(defined(LINUX) && defined (__KERNEL__))
typedef float IMG_FLOAT, *IMG_PFLOAT;
typedef double IMG_DOUBLE, *IMG_PDOUBLE;
#endif
typedef enum tag_img_bool
{
IMG_FALSE = 0,
IMG_TRUE = 1,
IMG_FORCE_ALIGN = 0x7FFFFFFF
} IMG_BOOL, *IMG_PBOOL;
typedef void IMG_VOID, *IMG_PVOID;
typedef IMG_INT32 IMG_RESULT;
#if defined(_WIN64)
typedef unsigned __int64 IMG_UINTPTR_T;
#else
typedef unsigned int IMG_UINTPTR_T;
#endif
typedef IMG_PVOID IMG_HANDLE;
typedef void** IMG_HVOID, * IMG_PHVOID;
typedef IMG_UINT32 IMG_SIZE_T;
#define IMG_NULL 0
typedef IMG_UINT32 IMG_SID;
typedef IMG_PVOID IMG_CPU_VIRTADDR;
typedef struct _IMG_DEV_VIRTADDR
{
IMG_UINT32 uiAddr;
#define IMG_CAST_TO_DEVVADDR_UINT(var) (IMG_UINT32)(var)
} IMG_DEV_VIRTADDR;
typedef struct _IMG_CPU_PHYADDR
{
IMG_UINTPTR_T uiAddr;
} IMG_CPU_PHYADDR;
typedef struct _IMG_DEV_PHYADDR
{
#if IMG_ADDRSPACE_PHYSADDR_BITS == 32
IMG_UINTPTR_T uiAddr;
#else
IMG_UINT32 uiAddr;
IMG_UINT32 uiHighAddr;
#endif
} IMG_DEV_PHYADDR;
typedef struct _IMG_SYS_PHYADDR
{
IMG_UINTPTR_T uiAddr;
} IMG_SYS_PHYADDR;
#include "img_defs.h"
#endif

669
sys/pvr2d/pvr_includes/pvr2d.h Executable file
View file

@ -0,0 +1,669 @@
/**********************************************************************
*
* Copyright(c) Imagination Technologies Ltd.
*
* The contents of this file are subject to the MIT license as set out below.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
* OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* This License is also included in this distribution in the file called
* "COPYING".
*
******************************************************************************/
/******************************************************************************
Modifications :-
$Log: pvr2d.h $
--- Revision Logs Removed ---
******************************************************************************/
#ifndef _PVR2D_H_
#define _PVR2D_H_
#ifdef __cplusplus
extern "C" {
#endif
/* PVR2D Platform-specific definitions */
#if defined (__linux__)
#define PVR2D_EXPORT __attribute__((visibility("default")))
#define PVR2D_IMPORT
#else
#define PVR2D_EXPORT
#define PVR2D_IMPORT
#endif
/* PVR2D header revision */
#define PVR2D_REV_MAJOR 3
#define PVR2D_REV_MINOR 5
/* Basic types */
typedef enum
{
PVR2D_FALSE = 0,
PVR2D_TRUE
} PVR2D_BOOL;
typedef void* PVR2D_HANDLE;
typedef char PVR2D_CHAR, *PVR2D_PCHAR;
typedef unsigned char PVR2D_UCHAR, *PVR2D_PUCHAR;
typedef int PVR2D_INT, *PVR2D_PINT;
typedef unsigned int PVR2D_UINT, *PVR2D_PUINT;
typedef long PVR2D_LONG, *PVR2D_PLONG;
typedef unsigned long PVR2D_ULONG, *PVR2D_PULONG;
typedef void PVR2D_VOID, *PVR2D_PVOID;
/* error codes */
typedef enum
{
PVR2D_OK = 0,
PVR2DERROR_INVALID_PARAMETER = -1,
PVR2DERROR_DEVICE_UNAVAILABLE = -2,
PVR2DERROR_INVALID_CONTEXT = -3,
PVR2DERROR_MEMORY_UNAVAILABLE = -4,
PVR2DERROR_DEVICE_NOT_PRESENT = -5,
PVR2DERROR_IOCTL_ERROR = -6,
PVR2DERROR_GENERIC_ERROR = -7,
PVR2DERROR_BLT_NOTCOMPLETE = -8,
PVR2DERROR_HW_FEATURE_NOT_SUPPORTED = -9,
PVR2DERROR_NOT_YET_IMPLEMENTED = -10,
PVR2DERROR_MAPPING_FAILED = -11
}PVR2DERROR;
/* 32 bit PVR2D pixel format specifier */
typedef unsigned long PVR2DFORMAT;
/* Standard PVR2D pixel formats */
#define PVR2D_1BPP 0x00UL // 1bpp mask surface or palletized 1 bit source with 2x32 bit CLUT
#define PVR2D_RGB565 0x01UL // Common rgb 565 format
#define PVR2D_ARGB4444 0x02UL // Common argb 4444 format
#define PVR2D_RGB888 0x03UL // Common rgb 888 format (not supported)
#define PVR2D_ARGB8888 0x04UL // Common argb 8888 format
#define PVR2D_ARGB1555 0x05UL // Common argb 1555 format
#define PVR2D_ALPHA8 0x06UL // Alpha-only 8 bit per pixel (used with a constant fill colour)
#define PVR2D_ALPHA4 0x07UL // Alpha-only 4 bits per pixel (used with a constant fill colour)
#define PVR2D_PAL2 0x08UL // Palletized 2 bit format (requires 4x32 bit CLUT)
#define PVR2D_PAL4 0x09UL // Palletized 4 bit format (requires 16x32 bit CLUT)
#define PVR2D_PAL8 0x0AUL // Palletized 8 bit format (requires 256x32 bit CLUT)
#define PVR2D_U8 0x10UL // monochrome unsigned 8 bit
#define PVR2D_U88 0x11UL // monochrome unsigned 16 bit
#define PVR2D_S8 0x12UL // signed 8 bit
#define PVR2D_YUV422_YUYV 0x13UL // YUV 422 low-high byte order Y0UY1V
#define PVR2D_YUV422_UYVY 0x14UL // YUV 422 low-high byte order UY0VY1
#define PVR2D_YUV422_YVYU 0x15UL // YUV 422 low-high byte order Y0VY1U
#define PVR2D_YUV422_VYUY 0x16UL // YUV 422 low-high byte order VY0UY1
#define PVR2D_YUV420_2PLANE 0x17UL // YUV420 2 Plane
#define PVR2D_YUV420_3PLANE 0x18UL // YUV420 3 Plane
#define PVR2D_2101010ARGB 0x19UL // 32 bit 2 10 10 10
#define PVR2D_888RSGSBS 0x1AUL
#define PVR2D_16BPP_RAW 0x1BUL // 16 bit raw (no format conversion)
#define PVR2D_32BPP_RAW 0x1CUL // 32 bit raw
#define PVR2D_64BPP_RAW 0x1DUL // 64 bit raw
#define PVR2D_128BPP_RAW 0x1EUL // 128 bit raw
#define PVR2D_NO_OF_FORMATS 0x1FUL
/* Format modifier bit field (DstFormat and SrcFormat bits 16..23) */
#define PVR2D_FORMAT_MASK 0x0000FFFFUL // PVR2D Format bits
#define PVR2D_FORMAT_LAYOUT_MASK 0x000F0000UL // Format layout (strided / twiddled / tiled)
#define PVR2D_FORMAT_FLAGS_MASK 0x0FF00000UL // Surface Flags mask
/* Layout */
#define PVR2D_FORMAT_LAYOUT_SHIFT 16
#define PVR2D_FORMAT_LAYOUT_STRIDED 0x00000000UL
#define PVR2D_FORMAT_LAYOUT_TILED 0x00010000UL
#define PVR2D_FORMAT_LAYOUT_TWIDDLED 0x00020000UL
/*
PVR2D_SURFACE_PDUMP
This flag requests a surface pdump, to capture the pixel state after host writes.
Not needed if the surface state has resulted from previous SGX 2D/3D core writes.
*/
#define PVR2D_SURFACE_PDUMP 0x00100000UL // calls PVRSRVPDumpMem to capture the surface (pdump builds only)
/*
Low level 3D format extension - for blts via the 3D core only.
If the top bit of the format field is set then PVR2D reads it as a PVRSRV_PIXEL_FORMAT.
The outcome is hardware dependant.
There is no guarantee that any specific PVRSRV format will be supported.
*/
#define PVR2D_FORMAT_PVRSRV 0x80000000
/* wrap surface type */
typedef enum
{
PVR2D_WRAPFLAG_NONCONTIGUOUS = 0,
PVR2D_WRAPFLAG_CONTIGUOUS = 1,
}PVR2DWRAPFLAGS;
#define PVR2D_CONTEXT_FLAGS_PRIORITY_MASK 0x00000003
#define PVR2D_CONTEXT_FLAGS_LOW_PRIORITY_CONTEXT 1
#define PVR2D_CONTEXT_FLAGS_NORMAL_PRIORITY_CONTEXT 0
#define PVR2D_CONTEXT_FLAGS_HIGH_PRIORITY_CONTEXT 2
/* flags for control information of additional blits */
typedef enum
{
PVR2D_BLIT_DISABLE_ALL = 0x00000000, /* disable all additional controls */
PVR2D_BLIT_CK_ENABLE = 0x00000001, /* enable colour key */
PVR2D_BLIT_GLOBAL_ALPHA_ENABLE = 0x00000002, /* enable standard global alpha */
PVR2D_BLIT_PERPIXEL_ALPHABLEND_ENABLE = 0x00000004, /* enable per-pixel alpha bleding */
PVR2D_BLIT_PAT_SURFACE_ENABLE = 0x00000008, /* enable pattern surf (disable fill) */
PVR2D_BLIT_FULLY_SPECIFIED_ALPHA_ENABLE = 0x00000010, /* enable fully specified alpha */
PVR2D_BLIT_ROT_90 = 0x00000020, /* apply 90 degree rotation to the blt */
PVR2D_BLIT_ROT_180 = 0x00000040, /* apply 180 degree rotation to the blt */
PVR2D_BLIT_ROT_270 = 0x00000080, /* apply 270 degree rotation to the blt */
PVR2D_BLIT_COPYORDER_TL2BR = 0x00000100, /* copy order overrides */
PVR2D_BLIT_COPYORDER_BR2TL = 0x00000200,
PVR2D_BLIT_COPYORDER_TR2BL = 0x00000400,
PVR2D_BLIT_COPYORDER_BL2TR = 0x00000800,
PVR2D_BLIT_COLKEY_SOURCE = 0x00001000, /* Key colour is on the source surface */
PVR2D_BLIT_COLKEY_DEST = 0x00002000, /* Key colour is on the destination surface */
PVR2D_BLIT_COLKEY_MASKED = 0x00004000, /* Mask enabled for colour key */
PVR2D_BLIT_COLKEY_OP_PASS = 0x00008000, /* Colour key op = pass */
PVR2D_BLIT_COLKEY_OP_REJECT = 0x00010000, /* Colour key op = reject */
PVR2D_BLIT_PATH_2DCORE = 0x00100000, /* Blt via dedicated 2D Core or PTLA */
PVR2D_BLIT_PATH_3DCORE = 0x00200000, /* Blt via 3D Core */
PVR2D_BLIT_PATH_SWBLT = 0x00400000, /* Blt via host software */
PVR2D_BLIT_NO_SRC_SYNC_INFO = 0x00800000, /* Dont send a source sync info*/
PVR2D_BLIT_ISSUE_STATUS_UPDATES = 0x01000000, /* Issue status updates */
} PVR2DBLITFLAGS;
/* standard alpha-blending functions, AlphaBlendingFunc field of PVR2DBLTINFO */
typedef enum
{
PVR2D_ALPHA_OP_SRC_DSTINV = 1, /* source alpha : Cdst = Csrc*Asrc + Cdst*(1-Asrc) */
PVR2D_ALPHA_OP_SRCP_DSTINV = 2 /* premultiplied source alpha : Cdst = Csrc + Cdst*(1-Asrc) */
} PVR2D_ALPHABLENDFUNC;
/* blend ops for fully specified alpha (SGX 2D Core only) */
typedef enum
{
PVR2D_BLEND_OP_ZERO = 0,
PVR2D_BLEND_OP_ONE = 1,
PVR2D_BLEND_OP_SRC = 2,
PVR2D_BLEND_OP_DST = 3,
PVR2D_BLEND_OP_GLOBAL = 4,
PVR2D_BLEND_OP_SRC_PLUS_GLOBAL = 5,
PVR2D_BLEND_OP_DST_PLUS_GLOBAL = 6
}PVR2D_BLEND_OP;
/* SGX 2D Core Fully specified alpha blend : pAlpha field of PVR2DBLTINFO structure */
/* a fully specified Alpha Blend operation is defined as */
/* DST (ALPHA) = (ALPHA_1 * SRC (ALPHA)) + (ALPHA_3 * DST (ALPHA)) */
/* DST (RGB) = (ALPHA_2 * SRC (RGB)) + (ALPHA_4 * DST (RGB)) */
/* if the pre-multiplication stage is enabled then the equations become the following: */
/* PRE_MUL = ((SRC(A)) * (Global Alpha Value)) */
/* DST (ALPHA) = (ALPHA_1 * SRC (ALPHA)) + (PRE_MUL * DST (ALPHA)) */
/* DST (RGB) = (ALPHA_2 * SRC (RGB)) + (PRE_MUL * DST (RGB)) */
/* if the transparent source alpha stage is enabled then a source alpha of zero forces the */
/* source to be transparent for that pixel regardless of the blend equation being used. */
typedef struct _PVR2D_ALPHABLT
{
PVR2D_BLEND_OP eAlpha1;
PVR2D_BOOL bAlpha1Invert;
PVR2D_BLEND_OP eAlpha2;
PVR2D_BOOL bAlpha2Invert;
PVR2D_BLEND_OP eAlpha3;
PVR2D_BOOL bAlpha3Invert;
PVR2D_BLEND_OP eAlpha4;
PVR2D_BOOL bAlpha4Invert;
PVR2D_BOOL bPremulAlpha; /* enable pre-multiplication stage */
PVR2D_BOOL bTransAlpha; /* enable transparent source alpha stage */
PVR2D_BOOL bUpdateAlphaLookup; /* enable and update the 1555-Lookup alpha table */
PVR2D_UCHAR uAlphaLookup0; /* 8 bit alpha when A=0 in a 1555-Lookup surface */
PVR2D_UCHAR uAlphaLookup1; /* 8 bit alpha when A=1 in a 1555-Lookup surface */
PVR2D_UCHAR uGlobalRGB; /* Global Alpha Value for RGB, 0=transparent 255=opaque */
PVR2D_UCHAR uGlobalA; /* Global Alpha Value for Alpha */
} PVR2D_ALPHABLT, *PPVR2D_ALPHABLT;
/* surface memory info structure */
typedef struct _PVR2DMEMINFO
{
PVR2D_VOID *pBase;
PVR2D_ULONG ui32MemSize;
PVR2D_ULONG ui32DevAddr;
PVR2D_ULONG ulFlags;
PVR2D_VOID *hPrivateData;
PVR2D_VOID *hPrivateMapData;
}PVR2DMEMINFO, *PPVR2DMEMINFO;
#define PVR2D_MAX_DEVICE_NAME 20
typedef struct _PVR2DDEVICEINFO
{
PVR2D_ULONG ulDevID;
PVR2D_CHAR szDeviceName[PVR2D_MAX_DEVICE_NAME];
}PVR2DDEVICEINFO;
typedef struct _PVR2DISPLAYINFO
{
PVR2D_ULONG ulMaxFlipChains;
PVR2D_ULONG ulMaxBuffersInChain;
PVR2DFORMAT eFormat;
PVR2D_ULONG ulWidth;
PVR2D_ULONG ulHeight;
PVR2D_LONG lStride;
PVR2D_ULONG ulMinFlipInterval;
PVR2D_ULONG ulMaxFlipInterval;
}PVR2DDISPLAYINFO;
typedef struct _PVR2MISCDISPLAYINFO
{
PVR2D_ULONG ulPhysicalWidthmm;
PVR2D_ULONG ulPhysicalHeightmm;
PVR2D_ULONG ulUnused[10];
}PVR2DMISCDISPLAYINFO;
typedef struct _PVR2DBLTINFO
{
PVR2D_ULONG CopyCode; /* rop code */
PVR2D_ULONG Colour; /* fill colour */
PVR2D_ULONG ColourKey; /* colour key argb8888 (see CKEY_ defs below) */
PVR2D_UCHAR GlobalAlphaValue; /* global alpha blending */
PVR2D_UCHAR AlphaBlendingFunc; /* per-pixel alpha-blending function */
PVR2DBLITFLAGS BlitFlags; /* additional blit control information */
PVR2DMEMINFO *pDstMemInfo; /* destination memory */
PVR2D_ULONG DstOffset; /* byte offset from start of allocation to destination surface pixel 0,0 */
PVR2D_LONG DstStride; /* signed stride, the number of bytes from pixel 0,0 to 0,1 */
PVR2D_LONG DstX, DstY; /* pixel offset from start of dest surface to start of blt rectangle */
PVR2D_LONG DSizeX,DSizeY; /* blt size */
PVR2DFORMAT DstFormat; /* dest format */
PVR2D_ULONG DstSurfWidth; /* size of dest surface in pixels */
PVR2D_ULONG DstSurfHeight; /* size of dest surface in pixels */
PVR2DMEMINFO *pSrcMemInfo; /* source mem, (source fields are also used for patterns) */
PVR2D_ULONG SrcOffset; /* byte offset from start of allocation to src/pat surface pixel 0,0 */
PVR2D_LONG SrcStride; /* signed stride, the number of bytes from pixel 0,0 to 0,1 */
PVR2D_LONG SrcX, SrcY; /* pixel offset from start of surface to start of source rectangle */
/* for patterns this is the start offset within the pattern */
PVR2D_LONG SizeX,SizeY; /* source rectangle size or pattern size in pixels */
PVR2DFORMAT SrcFormat; /* source/pattern format */
PVR2DMEMINFO *pPalMemInfo; /* source/pattern palette memory containing argb8888 colour table */
PVR2D_ULONG PalOffset; /* byte offset from start of allocation to start of palette */
PVR2D_ULONG SrcSurfWidth; /* size of source surface in pixels */
PVR2D_ULONG SrcSurfHeight; /* size of source surface in pixels */
PVR2DMEMINFO *pMaskMemInfo; /* mask memory, 1bpp format implied */
PVR2D_ULONG MaskOffset; /* byte offset from start of allocation to mask surface pixel 0,0 */
PVR2D_LONG MaskStride; /* signed stride, the number of bytes from pixel 0,0 to 0,1 */
PVR2D_LONG MaskX, MaskY; /* mask rect top left (mask size = blt size) */
PVR2D_ULONG MaskSurfWidth; /* size of mask surface in pixels */
PVR2D_ULONG MaskSurfHeight; /* size of mask surface in pixels */
PPVR2D_ALPHABLT pAlpha; /* fully specified alpha blend (2DCore only) */
PVR2D_ULONG uSrcChromaPlane1; /* mem offset from start of source alloc to chroma plane 1 */
PVR2D_ULONG uSrcChromaPlane2; /* mem offset from start of source alloc to chroma plane 2 */
PVR2D_ULONG uDstChromaPlane1; /* mem offset from start of dest alloc to chroma plane 1 */
PVR2D_ULONG uDstChromaPlane2; /* mem offset from start of dest alloc to chroma plane 2 */
PVR2D_ULONG ColourKeyMask; /* 32 bit colour key mask, only valid when PVR2D_BLIT_COLKEY_MASKED is set */
}PVR2DBLTINFO, *PPVR2DBLTINFO;
typedef struct _PVR2DRECT
{
PVR2D_LONG left, top;
PVR2D_LONG right, bottom;
} PVR2DRECT;
typedef struct
{
PVR2DMEMINFO *pSurfMemInfo; /* surface memory */
PVR2D_ULONG SurfOffset; /* byte offset from start of allocation to destination surface pixel 0,0 */
PVR2D_LONG Stride; /* signed stride */
PVR2DFORMAT Format; /* format */
PVR2D_ULONG SurfWidth; /* surface width in pixels */
PVR2D_ULONG SurfHeight; /* surface height in pixels */
} PVR2D_SURFACE, *PPVR2D_SURFACE;
typedef struct
{
PVR2D_ULONG uChromaPlane1; /* YUV multiplane - byte offset from start of alloc to chroma plane 1 */
PVR2D_ULONG uChromaPlane2; /* YUV multiplane - byte offset from start of alloc to chroma plane 2 */
PVR2D_LONG Reserved[2]; /* Reserved, must be zero */
} PVR2D_SURFACE_EXT, *PPVR2D_SURFACE_EXT;
typedef struct
{
PVR2D_ULONG *pUseCode; /* USSE code */
PVR2D_ULONG UseCodeSize; /* usse code size in bytes */
} PVR2D_USECODE, *PPVR2D_USECODE;
typedef struct
{
PVR2D_SURFACE sDst; /* destination surface */
PVR2D_SURFACE sSrc; /* source surface */
PVR2DRECT rcDest; /* destination rectangle */
PVR2DRECT rcSource; /* source rectangle */
PVR2D_HANDLE hUseCode; /* custom USE code (NULL implies source copy) */
PVR2D_ULONG UseParams[2]; /* per-blt params for use code */
} PVR2D_3DBLT, *PPVR2D_3DBLT;
typedef struct
{
PVR2D_SURFACE sDst; /* destination surface */
PVR2DRECT rcDest; /* destination rectangle; scaling is supported */
PVR2D_SURFACE sSrc; /* source surface */
PVR2DRECT rcSource; /* source rectangle; scaling is supported */
PPVR2D_SURFACE pSrc2; /* optional second source surface (NULL if not required) */
PVR2DRECT* prcSource2; /* optional pSrc2 rectangle */
PVR2D_HANDLE hUseCode; /* custom USSE shader code (NULL implies default source copy) */
PVR2D_ULONG UseParams[2]; /* per-blt params for usse code */
PVR2D_ULONG uiNumTemporaryRegisters; /* no. of temporary registers used in custom shader code */
PVR2D_BOOL bDisableDestInput; /* set true if the destination is output only */
PPVR2D_SURFACE_EXT pDstExt; /* Extended format params for dest */
PPVR2D_SURFACE_EXT pSrcExt[2]; /* Extended format params for source 1 and 2 */
PVR2D_LONG Reserved[4]; /* Reserved, must be zero */
} PVR2D_3DBLT_EXT, *PPVR2D_3DBLT_EXT;
#define MAKE_COPY_BLIT(src,soff,dest,doff,sx,sy,dx,dy,sz)
typedef void* PVR2DCONTEXTHANDLE;
typedef void* PVR2DFLIPCHAINHANDLE;
// CopyCode field of PVR2DBLTINFO structure:
// the CopyCode field of the PVR2DBLTINFO structure should contain a rop3 or rop4 code.
// a rop3 is an 8 bit code that describes a blt with three inputs : source dest and pattern
// rop4 is a 16 bit code that describes a blt with four inputs : source dest pattern and mask
// common rop3 codes are defined below
// a colour fill blt is processed in the pattern channel as a constant colour with a rop code of 0xF0
// PVR2D_BLIT_PAT_SURFACE_ENABLE defines whether the pattern channel is a surface or a fill colour.
// a rop4 is defined by two rop3 codes, and the 1 bit-per-pixel mask surface defines which is used.
// a common rop4 is 0xAAF0 which is the mask copy blt used for text glyphs.
// CopyCode is taken to be a rop4 when pMaskMemInfo is non zero, otherwise it is assumed to be a rop3
// use the PVR2DMASKROP4 macro below to construct a rop4 from two rop3's
// rop3a is the rop used when mask pixel = 1, and rop3b when mask = 0
#define PVR2DROP4(rop3b, rop3a) ((rop3b<<8)|rop3a)
/* common rop codes */
#define PVR2DROPclear 0x00 /* 0 (whiteness) */
#define PVR2DROPset 0xFF /* 1 (blackness) */
#define PVR2DROPnoop 0xAA /* dst (used for masked blts) */
/* source and dest rop codes */
#define PVR2DROPand 0x88 /* src AND dst */
#define PVR2DROPandReverse 0x44 /* src AND NOT dst */
#define PVR2DROPcopy 0xCC /* src (used for source copy and alpha blts) */
#define PVR2DROPandInverted 0x22 /* NOT src AND dst */
#define PVR2DROPxor 0x66 /* src XOR dst */
#define PVR2DROPor 0xEE /* src OR dst */
#define PVR2DROPnor 0x11 /* NOT src AND NOT dst */
#define PVR2DROPequiv 0x99 /* NOT src XOR dst */
#define PVR2DROPinvert 0x55 /* NOT dst */
#define PVR2DROPorReverse 0xDD /* src OR NOT dst */
#define PVR2DROPcopyInverted 0x33 /* NOT src */
#define PVR2DROPorInverted 0xBB /* NOT src OR dst */
#define PVR2DROPnand 0x77 /* NOT src OR NOT dst */
/* pattern rop codes */
#define PVR2DPATROPand 0xA0 /* pat AND dst */
#define PVR2DPATROPandReverse 0x50 /* pat AND NOT dst */
#define PVR2DPATROPcopy 0xF0 /* pat (used for solid color fills and pattern blts) */
#define PVR2DPATROPandInverted 0x0A /* NOT pat AND dst */
#define PVR2DPATROPxor 0x5A /* pat XOR dst */
#define PVR2DPATROPor 0xFA /* pat OR dst */
#define PVR2DPATROPnor 0x05 /* NOT pat AND NOT dst */
#define PVR2DPATROPequiv 0xA5 /* NOT pat XOR dst */
#define PVR2DPATROPinvert 0x55 /* NOT dst */
#define PVR2DPATROPorReverse 0xF5 /* pat OR NOT dst */
#define PVR2DPATROPcopyInverted 0x0F /* NOT pat */
#define PVR2DPATROPorInverted 0xAF /* NOT pat OR dst */
#define PVR2DPATROPnand 0x5F /* NOT pat OR NOT dst */
/* common rop4 codes */
#define PVR2DROP4MaskedCopy PVR2DROP4(PVR2DROPnoop,PVR2DROPcopy) /* masked source copy blt (used for rounded window corners etc) */
#define PVR2DROP4MaskedFill PVR2DROP4(PVR2DROPnoop,PVR2DPATROPcopy) /* masked colour fill blt (used for text) */
/* Legacy support */
#define PVR2DROP3_PATMASK PVR2DPATROPcopy
#define PVR2DROP3_SRCMASK PVR2DROPcopy
/* pixmap memory alignment */
#define PVR2D_ALIGNMENT_4 4 /* DWORD alignment */
#define PVR2D_ALIGNMENT_ANY 0 /* no alignment */
#define PVR2D_ALIGNMENT_PALETTE 16 /* 16 byte alignment is required for palettes */
/* Heap number for PVR2DGetFrameBuffer */
#define PVR2D_FB_PRIMARY_SURFACE 0
#define PVR2D_PRESENT_PROPERTY_SRCSTRIDE (1UL << 0)
#define PVR2D_PRESENT_PROPERTY_DSTSIZE (1UL << 1)
#define PVR2D_PRESENT_PROPERTY_DSTPOS (1UL << 2)
#define PVR2D_PRESENT_PROPERTY_CLIPRECTS (1UL << 3)
#define PVR2D_PRESENT_PROPERTY_INTERVAL (1UL << 4)
#define PVR2D_CREATE_FLIPCHAIN_SHARED (1UL << 0)
#define PVR2D_CREATE_FLIPCHAIN_QUERY (1UL << 1)
#define PVR2D_CREATE_FLIPCHAIN_OEMOVERLAY (1UL << 2)
#define PVR2D_CREATE_FLIPCHAIN_AS_BLITCHAIN (1UL << 3)
/* Colour-key colour must be translated into argb8888 format */
#define CKEY_8888(P) (P)
#define CKEY_4444(P) (((P&0xF000UL)<<16) | ((P&0x0F00UL)<<12) | ((P&0x00F0UL)<<8) | ((P&0x000FUL)<<4))
#define CKEY_1555(P) (((P&0x8000UL)<<16) | ((P&0x7C00UL)<<9) | ((P&0x3E0UL)<<6) | ((P&0x1FUL)<<3))
#define CKEY_565(P) (((P&0xF800UL)<<8) | ((P&0x7E0UL)<<5) | ((P&0x1FUL)<<3))
#define CKEY_MASK_8888 0x00FFFFFFUL
#define CKEY_MASK_4444 0x00F0F0F0UL
#define CKEY_MASK_1555 0x00F8F8F8UL /* Alpha is not normally included in the key test */
#define CKEY_MASK_565 0x00F8FCF8UL
/* Fill colours must be translated into argb8888 format */
#define CFILL_4444(P) (((P&0xF000UL)<<16) | ((P&0x0F00UL)<<12) | ((P&0x00F0UL)<<8) | ((P&0x000FUL)<<4))
#define CFILL_1555(P) (((P&0x8000UL)<<16) | ((P&0x7C00UL)<<9) | ((P&0x3E0UL)<<6) | ((P&0x1FUL)<<3))
#define CFILL_565(P) (((P&0xF800UL)<<8) | ((P&0x7E0UL)<<5) | ((P&0x1FUL)<<3))
/* PVR2DCreateDeviceContext flags */
#define PVR2D_XSERVER_PROC 0x00000001UL /*!< Set for the Xserver connection */
/* PVR2DMemAlloc flags */
#define PVR2D_MEM_UNCACHED 0x00000000UL /* Default */
#define PVR2D_MEM_CACHED 0x00000001UL /* Caller must flush and sync when necessary */
#define PVR2D_MEM_WRITECOMBINE 0x00000002UL
/* Functions that the library exports */
PVR2D_IMPORT
int PVR2DEnumerateDevices(PVR2DDEVICEINFO *pDevInfo);
PVR2D_IMPORT
PVR2DERROR PVR2DCreateDeviceContext(PVR2D_ULONG ulDevID,
PVR2DCONTEXTHANDLE* phContext,
PVR2D_ULONG ulFlags);
PVR2D_IMPORT
PVR2DERROR PVR2DDestroyDeviceContext(PVR2DCONTEXTHANDLE hContext);
PVR2D_IMPORT
PVR2DERROR PVR2DGetDeviceInfo(PVR2DCONTEXTHANDLE hContext,
PVR2DDISPLAYINFO *pDisplayInfo);
PVR2D_IMPORT
PVR2DERROR PVR2DGetMiscDisplayInfo(PVR2DCONTEXTHANDLE hContext,
PVR2DMISCDISPLAYINFO *pMiscDisplayInfo);
PVR2D_IMPORT
PVR2DERROR PVR2DGetScreenMode(PVR2DCONTEXTHANDLE hContext,
PVR2DFORMAT *pFormat,
PVR2D_LONG *plWidth,
PVR2D_LONG *plHeight,
PVR2D_LONG *plStride,
PVR2D_INT *piRefreshRate);
PVR2D_IMPORT
PVR2DERROR PVR2DGetFrameBuffer(PVR2DCONTEXTHANDLE hContext,
PVR2D_INT nHeap,
PVR2DMEMINFO **ppsMemInfo);
PVR2D_IMPORT
PVR2DERROR PVR2DMemAlloc(PVR2DCONTEXTHANDLE hContext,
PVR2D_ULONG ulBytes,
PVR2D_ULONG ulAlign,
PVR2D_ULONG ulFlags,
PVR2DMEMINFO **ppsMemInfo);
PVR2D_IMPORT
PVR2DERROR PVR2DMemExport(PVR2DCONTEXTHANDLE hContext,
PVR2D_ULONG ulFlags,
PVR2DMEMINFO *psMemInfo,
PVR2D_HANDLE *phMemHandle);
PVR2D_IMPORT
PVR2DERROR PVR2DMemWrap(PVR2DCONTEXTHANDLE hContext,
PVR2D_VOID *pMem,
PVR2D_ULONG ulFlags,
PVR2D_ULONG ulBytes,
PVR2D_ULONG alPageAddress[],
PVR2DMEMINFO **ppsMemInfo);
PVR2D_IMPORT
PVR2DERROR PVR2DMemMap(PVR2DCONTEXTHANDLE hContext,
PVR2D_ULONG ulFlags,
PVR2D_HANDLE hMemHandle,
PVR2DMEMINFO **ppsDstMem);
PVR2D_IMPORT
PVR2DERROR PVR2DMemFree(PVR2DCONTEXTHANDLE hContext,
PVR2DMEMINFO *psMemInfo);
PVR2D_IMPORT
PVR2DERROR PVR2DBlt(PVR2DCONTEXTHANDLE hContext,
PVR2DBLTINFO *pBltInfo);
PVR2D_IMPORT
PVR2DERROR PVR2DBltClipped(PVR2DCONTEXTHANDLE hContext,
PVR2DBLTINFO *pBltInfo,
PVR2D_ULONG ulNumClipRects,
PVR2DRECT *pClipRects);
PVR2D_EXPORT
PVR2DERROR PVR2DSet1555Alpha (PVR2DCONTEXTHANDLE hContext,
PVR2D_UCHAR Alpha0, PVR2D_UCHAR Alpha1);
PVR2D_IMPORT
PVR2DERROR PVR2DQueryBlitsComplete(PVR2DCONTEXTHANDLE hContext,
const PVR2DMEMINFO *pMemInfo,
PVR2D_UINT uiWaitForComplete);
PVR2D_IMPORT
PVR2DERROR PVR2DSetPresentBltProperties(PVR2DCONTEXTHANDLE hContext,
PVR2D_ULONG ulPropertyMask,
PVR2D_LONG lSrcStride,
PVR2D_ULONG ulDstWidth,
PVR2D_ULONG ulDstHeight,
PVR2D_LONG lDstXPos,
PVR2D_LONG lDstYPos,
PVR2D_ULONG ulNumClipRects,
PVR2DRECT *pClipRects,
PVR2D_ULONG ulSwapInterval);
PVR2D_IMPORT
PVR2DERROR PVR2DPresentBlt(PVR2DCONTEXTHANDLE hContext,
PVR2DMEMINFO *pMemInfo,
PVR2D_LONG lRenderID);
PVR2D_IMPORT
PVR2DERROR PVR2DCreateFlipChain(PVR2DCONTEXTHANDLE hContext,
PVR2D_ULONG ulFlags,
PVR2D_ULONG ulNumBuffers,
PVR2D_ULONG ulWidth,
PVR2D_ULONG ulHeight,
PVR2DFORMAT eFormat,
PVR2D_LONG *plStride,
PVR2D_ULONG *pulFlipChainID,
PVR2DFLIPCHAINHANDLE *phFlipChain);
PVR2D_IMPORT
PVR2DERROR PVR2DDestroyFlipChain(PVR2DCONTEXTHANDLE hContext,
PVR2DFLIPCHAINHANDLE hFlipChain);
PVR2D_IMPORT
PVR2DERROR PVR2DGetFlipChainBuffers(PVR2DCONTEXTHANDLE hContext,
PVR2DFLIPCHAINHANDLE hFlipChain,
PVR2D_ULONG *pulNumBuffers,
PVR2DMEMINFO *psMemInfo[]);
PVR2D_IMPORT
PVR2DERROR PVR2DSetPresentFlipProperties(PVR2DCONTEXTHANDLE hContext,
PVR2DFLIPCHAINHANDLE hFlipChain,
PVR2D_ULONG ulPropertyMask,
PVR2D_LONG lDstXPos,
PVR2D_LONG lDstYPos,
PVR2D_ULONG ulNumClipRects,
PVR2DRECT *pClipRects,
PVR2D_ULONG ulSwapInterval);
PVR2D_IMPORT
PVR2DERROR PVR2DPresentFlip(PVR2DCONTEXTHANDLE hContext,
PVR2DFLIPCHAINHANDLE hFlipChain,
PVR2DMEMINFO *psMemInfo,
PVR2D_LONG lRenderID);
PVR2D_IMPORT
PVR2DERROR PVR2DGetAPIRev(PVR2D_LONG *lRevMajor, PVR2D_LONG *lRevMinor);
PVR2D_IMPORT
PVR2DERROR PVR2DLoadUseCode (const PVR2DCONTEXTHANDLE hContext, const PVR2D_UCHAR *pUseCode,
const PVR2D_ULONG UseCodeSize, PVR2D_HANDLE *pUseCodeHandle);
PVR2D_IMPORT
PVR2DERROR PVR2DFreeUseCode (const PVR2DCONTEXTHANDLE hContext, const PVR2D_HANDLE hUseCodeHandle);
PVR2D_IMPORT
PVR2DERROR PVR2DBlt3D (const PVR2DCONTEXTHANDLE hContext, const PPVR2D_3DBLT pBlt3D);
PVR2D_IMPORT
PVR2DERROR PVR2DBlt3DExt (const PVR2DCONTEXTHANDLE hContext, const PPVR2D_3DBLT_EXT pBlt3D);
#ifdef __cplusplus
}
#endif
#endif /* _PVR2D_H_ */
/******************************************************************************
End of file (pvr2d.h)
******************************************************************************/

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,855 @@
/**********************************************************************
*
* Copyright(c) Imagination Technologies Ltd.
*
* The contents of this file are subject to the MIT license as set out below.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
* OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* This License is also included in this distribution in the file called
* "COPYING".
*
******************************************************************************/
#if !defined (__SERVICESEXT_H__)
#define __SERVICESEXT_H__
#define PVRSRV_LOCKFLG_READONLY (1)
typedef enum _PVRSRV_ERROR_
{
PVRSRV_OK = 0,
PVRSRV_ERROR_OUT_OF_MEMORY,
PVRSRV_ERROR_TOO_FEW_BUFFERS,
PVRSRV_ERROR_INVALID_PARAMS,
PVRSRV_ERROR_INIT_FAILURE,
PVRSRV_ERROR_CANT_REGISTER_CALLBACK,
PVRSRV_ERROR_INVALID_DEVICE,
PVRSRV_ERROR_NOT_OWNER,
PVRSRV_ERROR_BAD_MAPPING,
PVRSRV_ERROR_TIMEOUT,
PVRSRV_ERROR_FLIP_CHAIN_EXISTS,
PVRSRV_ERROR_INVALID_SWAPINTERVAL,
PVRSRV_ERROR_SCENE_INVALID,
PVRSRV_ERROR_STREAM_ERROR,
PVRSRV_ERROR_FAILED_DEPENDENCIES,
PVRSRV_ERROR_CMD_NOT_PROCESSED,
PVRSRV_ERROR_CMD_TOO_BIG,
PVRSRV_ERROR_DEVICE_REGISTER_FAILED,
PVRSRV_ERROR_TOOMANYBUFFERS,
PVRSRV_ERROR_NOT_SUPPORTED,
PVRSRV_ERROR_PROCESSING_BLOCKED,
PVRSRV_ERROR_CANNOT_FLUSH_QUEUE,
PVRSRV_ERROR_CANNOT_GET_QUEUE_SPACE,
PVRSRV_ERROR_CANNOT_GET_RENDERDETAILS,
PVRSRV_ERROR_RETRY,
PVRSRV_ERROR_DDK_VERSION_MISMATCH,
PVRSRV_ERROR_BUILD_MISMATCH,
PVRSRV_ERROR_CORE_REVISION_MISMATCH,
PVRSRV_ERROR_UPLOAD_TOO_BIG,
PVRSRV_ERROR_INVALID_FLAGS,
PVRSRV_ERROR_FAILED_TO_REGISTER_PROCESS,
PVRSRV_ERROR_UNABLE_TO_LOAD_LIBRARY,
PVRSRV_ERROR_UNABLE_GET_FUNC_ADDR,
PVRSRV_ERROR_UNLOAD_LIBRARY_FAILED,
PVRSRV_ERROR_BRIDGE_CALL_FAILED,
PVRSRV_ERROR_IOCTL_CALL_FAILED,
PVRSRV_ERROR_MMU_CONTEXT_NOT_FOUND,
PVRSRV_ERROR_BUFFER_DEVICE_NOT_FOUND,
PVRSRV_ERROR_BUFFER_DEVICE_ALREADY_PRESENT,
PVRSRV_ERROR_PCI_DEVICE_NOT_FOUND,
PVRSRV_ERROR_PCI_CALL_FAILED,
PVRSRV_ERROR_PCI_REGION_TOO_SMALL,
PVRSRV_ERROR_PCI_REGION_UNAVAILABLE,
PVRSRV_ERROR_BAD_REGION_SIZE_MISMATCH,
PVRSRV_ERROR_REGISTER_BASE_NOT_SET,
PVRSRV_ERROR_FAILED_TO_ALLOC_USER_MEM,
PVRSRV_ERROR_FAILED_TO_ALLOC_VP_MEMORY,
PVRSRV_ERROR_FAILED_TO_MAP_SHARED_PBDESC,
PVRSRV_ERROR_FAILED_TO_GET_PHYS_ADDR,
PVRSRV_ERROR_FAILED_TO_ALLOC_VIRT_MEMORY,
PVRSRV_ERROR_FAILED_TO_COPY_VIRT_MEMORY,
PVRSRV_ERROR_FAILED_TO_ALLOC_PAGES,
PVRSRV_ERROR_FAILED_TO_FREE_PAGES,
PVRSRV_ERROR_FAILED_TO_COPY_PAGES,
PVRSRV_ERROR_UNABLE_TO_LOCK_PAGES,
PVRSRV_ERROR_UNABLE_TO_UNLOCK_PAGES,
PVRSRV_ERROR_STILL_MAPPED,
PVRSRV_ERROR_MAPPING_NOT_FOUND,
PVRSRV_ERROR_PHYS_ADDRESS_EXCEEDS_32BIT,
PVRSRV_ERROR_FAILED_TO_MAP_PAGE_TABLE,
PVRSRV_ERROR_INVALID_SEGMENT_BLOCK,
PVRSRV_ERROR_INVALID_SGXDEVDATA,
PVRSRV_ERROR_INVALID_DEVINFO,
PVRSRV_ERROR_INVALID_MEMINFO,
PVRSRV_ERROR_INVALID_MISCINFO,
PVRSRV_ERROR_UNKNOWN_IOCTL,
PVRSRV_ERROR_INVALID_CONTEXT,
PVRSRV_ERROR_UNABLE_TO_DESTROY_CONTEXT,
PVRSRV_ERROR_INVALID_HEAP,
PVRSRV_ERROR_INVALID_KERNELINFO,
PVRSRV_ERROR_UNKNOWN_POWER_STATE,
PVRSRV_ERROR_INVALID_HANDLE_TYPE,
PVRSRV_ERROR_INVALID_WRAP_TYPE,
PVRSRV_ERROR_INVALID_PHYS_ADDR,
PVRSRV_ERROR_INVALID_CPU_ADDR,
PVRSRV_ERROR_INVALID_HEAPINFO,
PVRSRV_ERROR_INVALID_PERPROC,
PVRSRV_ERROR_FAILED_TO_RETRIEVE_HEAPINFO,
PVRSRV_ERROR_INVALID_MAP_REQUEST,
PVRSRV_ERROR_INVALID_UNMAP_REQUEST,
PVRSRV_ERROR_UNABLE_TO_FIND_MAPPING_HEAP,
PVRSRV_ERROR_MAPPING_STILL_IN_USE,
PVRSRV_ERROR_EXCEEDED_HW_LIMITS,
PVRSRV_ERROR_NO_STAGING_BUFFER_ALLOCATED,
PVRSRV_ERROR_UNABLE_TO_CREATE_PERPROC_AREA,
PVRSRV_ERROR_UNABLE_TO_CREATE_EVENT,
PVRSRV_ERROR_UNABLE_TO_ENABLE_EVENT,
PVRSRV_ERROR_UNABLE_TO_REGISTER_EVENT,
PVRSRV_ERROR_UNABLE_TO_DESTROY_EVENT,
PVRSRV_ERROR_UNABLE_TO_CREATE_THREAD,
PVRSRV_ERROR_UNABLE_TO_CLOSE_THREAD,
PVRSRV_ERROR_THREAD_READ_ERROR,
PVRSRV_ERROR_UNABLE_TO_REGISTER_ISR_HANDLER,
PVRSRV_ERROR_UNABLE_TO_INSTALL_ISR,
PVRSRV_ERROR_UNABLE_TO_UNINSTALL_ISR,
PVRSRV_ERROR_ISR_ALREADY_INSTALLED,
PVRSRV_ERROR_ISR_NOT_INSTALLED,
PVRSRV_ERROR_UNABLE_TO_INITIALISE_INTERRUPT,
PVRSRV_ERROR_UNABLE_TO_RETRIEVE_INFO,
PVRSRV_ERROR_UNABLE_TO_DO_BACKWARDS_BLIT,
PVRSRV_ERROR_UNABLE_TO_CLOSE_SERVICES,
PVRSRV_ERROR_UNABLE_TO_REGISTER_CONTEXT,
PVRSRV_ERROR_UNABLE_TO_REGISTER_RESOURCE,
PVRSRV_ERROR_INVALID_CCB_COMMAND,
PVRSRV_ERROR_UNABLE_TO_LOCK_RESOURCE,
PVRSRV_ERROR_INVALID_LOCK_ID,
PVRSRV_ERROR_RESOURCE_NOT_LOCKED,
PVRSRV_ERROR_FLIP_FAILED,
PVRSRV_ERROR_UNBLANK_DISPLAY_FAILED,
PVRSRV_ERROR_TIMEOUT_POLLING_FOR_VALUE,
PVRSRV_ERROR_CREATE_RENDER_CONTEXT_FAILED,
PVRSRV_ERROR_UNKNOWN_PRIMARY_FRAG,
PVRSRV_ERROR_UNEXPECTED_SECONDARY_FRAG,
PVRSRV_ERROR_UNEXPECTED_PRIMARY_FRAG,
PVRSRV_ERROR_UNABLE_TO_INSERT_FENCE_ID,
PVRSRV_ERROR_BLIT_SETUP_FAILED,
PVRSRV_ERROR_PDUMP_NOT_AVAILABLE,
PVRSRV_ERROR_PDUMP_BUFFER_FULL,
PVRSRV_ERROR_PDUMP_BUF_OVERFLOW,
PVRSRV_ERROR_PDUMP_NOT_ACTIVE,
PVRSRV_ERROR_INCOMPLETE_LINE_OVERLAPS_PAGES,
PVRSRV_ERROR_MUTEX_DESTROY_FAILED,
PVRSRV_ERROR_MUTEX_INTERRUPTIBLE_ERROR,
PVRSRV_ERROR_INSUFFICIENT_SCRIPT_SPACE,
PVRSRV_ERROR_INSUFFICIENT_SPACE_FOR_COMMAND,
PVRSRV_ERROR_PROCESS_NOT_INITIALISED,
PVRSRV_ERROR_PROCESS_NOT_FOUND,
PVRSRV_ERROR_SRV_CONNECT_FAILED,
PVRSRV_ERROR_SRV_DISCONNECT_FAILED,
PVRSRV_ERROR_DEINT_PHASE_FAILED,
PVRSRV_ERROR_INIT2_PHASE_FAILED,
PVRSRV_ERROR_UNABLE_TO_FIND_RESOURCE,
PVRSRV_ERROR_NO_DC_DEVICES_FOUND,
PVRSRV_ERROR_UNABLE_TO_OPEN_DC_DEVICE,
PVRSRV_ERROR_UNABLE_TO_REMOVE_DEVICE,
PVRSRV_ERROR_NO_DEVICEDATA_FOUND,
PVRSRV_ERROR_NO_DEVICENODE_FOUND,
PVRSRV_ERROR_NO_CLIENTNODE_FOUND,
PVRSRV_ERROR_FAILED_TO_PROCESS_QUEUE,
PVRSRV_ERROR_UNABLE_TO_INIT_TASK,
PVRSRV_ERROR_UNABLE_TO_SCHEDULE_TASK,
PVRSRV_ERROR_UNABLE_TO_KILL_TASK,
PVRSRV_ERROR_UNABLE_TO_ENABLE_TIMER,
PVRSRV_ERROR_UNABLE_TO_DISABLE_TIMER,
PVRSRV_ERROR_UNABLE_TO_REMOVE_TIMER,
PVRSRV_ERROR_UNKNOWN_PIXEL_FORMAT,
PVRSRV_ERROR_UNKNOWN_SCRIPT_OPERATION,
PVRSRV_ERROR_HANDLE_INDEX_OUT_OF_RANGE,
PVRSRV_ERROR_HANDLE_NOT_ALLOCATED,
PVRSRV_ERROR_HANDLE_TYPE_MISMATCH,
PVRSRV_ERROR_UNABLE_TO_ADD_HANDLE,
PVRSRV_ERROR_HANDLE_NOT_SHAREABLE,
PVRSRV_ERROR_HANDLE_NOT_FOUND,
PVRSRV_ERROR_INVALID_SUBHANDLE,
PVRSRV_ERROR_HANDLE_BATCH_IN_USE,
PVRSRV_ERROR_HANDLE_BATCH_COMMIT_FAILURE,
PVRSRV_ERROR_UNABLE_TO_CREATE_HASH_TABLE,
PVRSRV_ERROR_INSERT_HASH_TABLE_DATA_FAILED,
PVRSRV_ERROR_UNSUPPORTED_BACKING_STORE,
PVRSRV_ERROR_UNABLE_TO_DESTROY_BM_HEAP,
PVRSRV_ERROR_UNKNOWN_INIT_SERVER_STATE,
PVRSRV_ERROR_NO_FREE_DEVICEIDS_AVALIABLE,
PVRSRV_ERROR_INVALID_DEVICEID,
PVRSRV_ERROR_DEVICEID_NOT_FOUND,
PVRSRV_ERROR_MEMORY_TEST_FAILED,
PVRSRV_ERROR_CPUPADDR_TEST_FAILED,
PVRSRV_ERROR_COPY_TEST_FAILED,
PVRSRV_ERROR_SEMAPHORE_NOT_INITIALISED,
PVRSRV_ERROR_UNABLE_TO_RELEASE_CLOCK,
PVRSRV_ERROR_CLOCK_REQUEST_FAILED,
PVRSRV_ERROR_DISABLE_CLOCK_FAILURE,
PVRSRV_ERROR_UNABLE_TO_SET_CLOCK_RATE,
PVRSRV_ERROR_UNABLE_TO_ROUND_CLOCK_RATE,
PVRSRV_ERROR_UNABLE_TO_ENABLE_CLOCK,
PVRSRV_ERROR_UNABLE_TO_GET_CLOCK,
PVRSRV_ERROR_UNABLE_TO_GET_PARENT_CLOCK,
PVRSRV_ERROR_UNABLE_TO_GET_SYSTEM_CLOCK,
PVRSRV_ERROR_UNKNOWN_SGL_ERROR,
PVRSRV_ERROR_SYSTEM_POWER_CHANGE_FAILURE,
PVRSRV_ERROR_DEVICE_POWER_CHANGE_FAILURE,
PVRSRV_ERROR_BAD_SYNC_STATE,
PVRSRV_ERROR_CACHEOP_FAILED,
PVRSRV_ERROR_FORCE_I32 = 0x7fffffff
} PVRSRV_ERROR;
typedef enum _PVRSRV_DEVICE_CLASS_
{
PVRSRV_DEVICE_CLASS_3D = 0 ,
PVRSRV_DEVICE_CLASS_DISPLAY = 1 ,
PVRSRV_DEVICE_CLASS_BUFFER = 2 ,
PVRSRV_DEVICE_CLASS_VIDEO = 3 ,
PVRSRV_DEVICE_CLASS_FORCE_I32 = 0x7fffffff
} PVRSRV_DEVICE_CLASS;
typedef enum _PVRSRV_SYS_POWER_STATE_
{
PVRSRV_SYS_POWER_STATE_Unspecified = -1,
PVRSRV_SYS_POWER_STATE_D0 = 0,
PVRSRV_SYS_POWER_STATE_D1 = 1,
PVRSRV_SYS_POWER_STATE_D2 = 2,
PVRSRV_SYS_POWER_STATE_D3 = 3,
PVRSRV_SYS_POWER_STATE_D4 = 4,
PVRSRV_SYS_POWER_STATE_FORCE_I32 = 0x7fffffff
} PVRSRV_SYS_POWER_STATE, *PPVRSRV_SYS_POWER_STATE;
typedef enum _PVRSRV_DEV_POWER_STATE_
{
PVRSRV_DEV_POWER_STATE_DEFAULT = -1,
PVRSRV_DEV_POWER_STATE_ON = 0,
PVRSRV_DEV_POWER_STATE_IDLE = 1,
PVRSRV_DEV_POWER_STATE_OFF = 2,
PVRSRV_DEV_POWER_STATE_FORCE_I32 = 0x7fffffff
} PVRSRV_DEV_POWER_STATE, *PPVRSRV_DEV_POWER_STATE;
typedef PVRSRV_ERROR (*PFN_PRE_POWER) (IMG_HANDLE hDevHandle,
PVRSRV_DEV_POWER_STATE eNewPowerState,
PVRSRV_DEV_POWER_STATE eCurrentPowerState);
typedef PVRSRV_ERROR (*PFN_POST_POWER) (IMG_HANDLE hDevHandle,
PVRSRV_DEV_POWER_STATE eNewPowerState,
PVRSRV_DEV_POWER_STATE eCurrentPowerState);
typedef PVRSRV_ERROR (*PFN_PRE_CLOCKSPEED_CHANGE) (IMG_HANDLE hDevHandle,
IMG_BOOL bIdleDevice,
PVRSRV_DEV_POWER_STATE eCurrentPowerState);
typedef PVRSRV_ERROR (*PFN_POST_CLOCKSPEED_CHANGE) (IMG_HANDLE hDevHandle,
IMG_BOOL bIdleDevice,
PVRSRV_DEV_POWER_STATE eCurrentPowerState);
typedef enum _PVRSRV_PIXEL_FORMAT_ {
PVRSRV_PIXEL_FORMAT_UNKNOWN = 0,
PVRSRV_PIXEL_FORMAT_RGB565 = 1,
PVRSRV_PIXEL_FORMAT_RGB555 = 2,
PVRSRV_PIXEL_FORMAT_RGB888 = 3,
PVRSRV_PIXEL_FORMAT_BGR888 = 4,
PVRSRV_PIXEL_FORMAT_GREY_SCALE = 8,
PVRSRV_PIXEL_FORMAT_PAL12 = 13,
PVRSRV_PIXEL_FORMAT_PAL8 = 14,
PVRSRV_PIXEL_FORMAT_PAL4 = 15,
PVRSRV_PIXEL_FORMAT_PAL2 = 16,
PVRSRV_PIXEL_FORMAT_PAL1 = 17,
PVRSRV_PIXEL_FORMAT_ARGB1555 = 18,
PVRSRV_PIXEL_FORMAT_ARGB4444 = 19,
PVRSRV_PIXEL_FORMAT_ARGB8888 = 20,
PVRSRV_PIXEL_FORMAT_ABGR8888 = 21,
PVRSRV_PIXEL_FORMAT_YV12 = 22,
PVRSRV_PIXEL_FORMAT_I420 = 23,
PVRSRV_PIXEL_FORMAT_IMC2 = 25,
PVRSRV_PIXEL_FORMAT_XRGB8888 = 26,
PVRSRV_PIXEL_FORMAT_XBGR8888 = 27,
PVRSRV_PIXEL_FORMAT_BGRA8888 = 28,
PVRSRV_PIXEL_FORMAT_XRGB4444 = 29,
PVRSRV_PIXEL_FORMAT_ARGB8332 = 30,
PVRSRV_PIXEL_FORMAT_A2RGB10 = 31,
PVRSRV_PIXEL_FORMAT_A2BGR10 = 32,
PVRSRV_PIXEL_FORMAT_P8 = 33,
PVRSRV_PIXEL_FORMAT_L8 = 34,
PVRSRV_PIXEL_FORMAT_A8L8 = 35,
PVRSRV_PIXEL_FORMAT_A4L4 = 36,
PVRSRV_PIXEL_FORMAT_L16 = 37,
PVRSRV_PIXEL_FORMAT_L6V5U5 = 38,
PVRSRV_PIXEL_FORMAT_V8U8 = 39,
PVRSRV_PIXEL_FORMAT_V16U16 = 40,
PVRSRV_PIXEL_FORMAT_QWVU8888 = 41,
PVRSRV_PIXEL_FORMAT_XLVU8888 = 42,
PVRSRV_PIXEL_FORMAT_QWVU16 = 43,
PVRSRV_PIXEL_FORMAT_D16 = 44,
PVRSRV_PIXEL_FORMAT_D24S8 = 45,
PVRSRV_PIXEL_FORMAT_D24X8 = 46,
PVRSRV_PIXEL_FORMAT_ABGR16 = 47,
PVRSRV_PIXEL_FORMAT_ABGR16F = 48,
PVRSRV_PIXEL_FORMAT_ABGR32 = 49,
PVRSRV_PIXEL_FORMAT_ABGR32F = 50,
PVRSRV_PIXEL_FORMAT_B10GR11 = 51,
PVRSRV_PIXEL_FORMAT_GR88 = 52,
PVRSRV_PIXEL_FORMAT_BGR32 = 53,
PVRSRV_PIXEL_FORMAT_GR32 = 54,
PVRSRV_PIXEL_FORMAT_E5BGR9 = 55,
PVRSRV_PIXEL_FORMAT_RESERVED1 = 56,
PVRSRV_PIXEL_FORMAT_RESERVED2 = 57,
PVRSRV_PIXEL_FORMAT_RESERVED3 = 58,
PVRSRV_PIXEL_FORMAT_RESERVED4 = 59,
PVRSRV_PIXEL_FORMAT_RESERVED5 = 60,
PVRSRV_PIXEL_FORMAT_R8G8_B8G8 = 61,
PVRSRV_PIXEL_FORMAT_G8R8_G8B8 = 62,
PVRSRV_PIXEL_FORMAT_NV11 = 63,
PVRSRV_PIXEL_FORMAT_NV12 = 64,
PVRSRV_PIXEL_FORMAT_YUY2 = 65,
PVRSRV_PIXEL_FORMAT_YUV420 = 66,
PVRSRV_PIXEL_FORMAT_YUV444 = 67,
PVRSRV_PIXEL_FORMAT_VUY444 = 68,
PVRSRV_PIXEL_FORMAT_YUYV = 69,
PVRSRV_PIXEL_FORMAT_YVYU = 70,
PVRSRV_PIXEL_FORMAT_UYVY = 71,
PVRSRV_PIXEL_FORMAT_VYUY = 72,
PVRSRV_PIXEL_FORMAT_FOURCC_ORG_UYVY = 73,
PVRSRV_PIXEL_FORMAT_FOURCC_ORG_YUYV = 74,
PVRSRV_PIXEL_FORMAT_FOURCC_ORG_YVYU = 75,
PVRSRV_PIXEL_FORMAT_FOURCC_ORG_VYUY = 76,
PVRSRV_PIXEL_FORMAT_FOURCC_ORG_AYUV = 77,
PVRSRV_PIXEL_FORMAT_A32B32G32R32 = 78,
PVRSRV_PIXEL_FORMAT_A32B32G32R32F = 79,
PVRSRV_PIXEL_FORMAT_A32B32G32R32_UINT = 80,
PVRSRV_PIXEL_FORMAT_A32B32G32R32_SINT = 81,
PVRSRV_PIXEL_FORMAT_B32G32R32 = 82,
PVRSRV_PIXEL_FORMAT_B32G32R32F = 83,
PVRSRV_PIXEL_FORMAT_B32G32R32_UINT = 84,
PVRSRV_PIXEL_FORMAT_B32G32R32_SINT = 85,
PVRSRV_PIXEL_FORMAT_G32R32 = 86,
PVRSRV_PIXEL_FORMAT_G32R32F = 87,
PVRSRV_PIXEL_FORMAT_G32R32_UINT = 88,
PVRSRV_PIXEL_FORMAT_G32R32_SINT = 89,
PVRSRV_PIXEL_FORMAT_D32F = 90,
PVRSRV_PIXEL_FORMAT_R32 = 91,
PVRSRV_PIXEL_FORMAT_R32F = 92,
PVRSRV_PIXEL_FORMAT_R32_UINT = 93,
PVRSRV_PIXEL_FORMAT_R32_SINT = 94,
PVRSRV_PIXEL_FORMAT_A16B16G16R16 = 95,
PVRSRV_PIXEL_FORMAT_A16B16G16R16F = 96,
PVRSRV_PIXEL_FORMAT_A16B16G16R16_SINT = 97,
PVRSRV_PIXEL_FORMAT_A16B16G16R16_SNORM = 98,
PVRSRV_PIXEL_FORMAT_A16B16G16R16_UINT = 99,
PVRSRV_PIXEL_FORMAT_A16B16G16R16_UNORM = 100,
PVRSRV_PIXEL_FORMAT_G16R16 = 101,
PVRSRV_PIXEL_FORMAT_G16R16F = 102,
PVRSRV_PIXEL_FORMAT_G16R16_UINT = 103,
PVRSRV_PIXEL_FORMAT_G16R16_UNORM = 104,
PVRSRV_PIXEL_FORMAT_G16R16_SINT = 105,
PVRSRV_PIXEL_FORMAT_G16R16_SNORM = 106,
PVRSRV_PIXEL_FORMAT_R16 = 107,
PVRSRV_PIXEL_FORMAT_R16F = 108,
PVRSRV_PIXEL_FORMAT_R16_UINT = 109,
PVRSRV_PIXEL_FORMAT_R16_UNORM = 110,
PVRSRV_PIXEL_FORMAT_R16_SINT = 111,
PVRSRV_PIXEL_FORMAT_R16_SNORM = 112,
PVRSRV_PIXEL_FORMAT_X8R8G8B8 = 113,
PVRSRV_PIXEL_FORMAT_X8R8G8B8_UNORM = 114,
PVRSRV_PIXEL_FORMAT_X8R8G8B8_UNORM_SRGB = 115,
PVRSRV_PIXEL_FORMAT_A8R8G8B8 = 116,
PVRSRV_PIXEL_FORMAT_A8R8G8B8_UNORM = 117,
PVRSRV_PIXEL_FORMAT_A8R8G8B8_UNORM_SRGB = 118,
PVRSRV_PIXEL_FORMAT_A8B8G8R8 = 119,
PVRSRV_PIXEL_FORMAT_A8B8G8R8_UINT = 120,
PVRSRV_PIXEL_FORMAT_A8B8G8R8_UNORM = 121,
PVRSRV_PIXEL_FORMAT_A8B8G8R8_UNORM_SRGB = 122,
PVRSRV_PIXEL_FORMAT_A8B8G8R8_SINT = 123,
PVRSRV_PIXEL_FORMAT_A8B8G8R8_SNORM = 124,
PVRSRV_PIXEL_FORMAT_G8R8 = 125,
PVRSRV_PIXEL_FORMAT_G8R8_UINT = 126,
PVRSRV_PIXEL_FORMAT_G8R8_UNORM = 127,
PVRSRV_PIXEL_FORMAT_G8R8_SINT = 128,
PVRSRV_PIXEL_FORMAT_G8R8_SNORM = 129,
PVRSRV_PIXEL_FORMAT_A8 = 130,
PVRSRV_PIXEL_FORMAT_R8 = 131,
PVRSRV_PIXEL_FORMAT_R8_UINT = 132,
PVRSRV_PIXEL_FORMAT_R8_UNORM = 133,
PVRSRV_PIXEL_FORMAT_R8_SINT = 134,
PVRSRV_PIXEL_FORMAT_R8_SNORM = 135,
PVRSRV_PIXEL_FORMAT_A2B10G10R10 = 136,
PVRSRV_PIXEL_FORMAT_A2B10G10R10_UNORM = 137,
PVRSRV_PIXEL_FORMAT_A2B10G10R10_UINT = 138,
PVRSRV_PIXEL_FORMAT_B10G11R11 = 139,
PVRSRV_PIXEL_FORMAT_B10G11R11F = 140,
PVRSRV_PIXEL_FORMAT_X24G8R32 = 141,
PVRSRV_PIXEL_FORMAT_G8R24 = 142,
PVRSRV_PIXEL_FORMAT_X8R24 = 143,
PVRSRV_PIXEL_FORMAT_E5B9G9R9 = 144,
PVRSRV_PIXEL_FORMAT_R1 = 145,
PVRSRV_PIXEL_FORMAT_RESERVED6 = 146,
PVRSRV_PIXEL_FORMAT_RESERVED7 = 147,
PVRSRV_PIXEL_FORMAT_RESERVED8 = 148,
PVRSRV_PIXEL_FORMAT_RESERVED9 = 149,
PVRSRV_PIXEL_FORMAT_RESERVED10 = 150,
PVRSRV_PIXEL_FORMAT_RESERVED11 = 151,
PVRSRV_PIXEL_FORMAT_RESERVED12 = 152,
PVRSRV_PIXEL_FORMAT_RESERVED13 = 153,
PVRSRV_PIXEL_FORMAT_RESERVED14 = 154,
PVRSRV_PIXEL_FORMAT_RESERVED15 = 155,
PVRSRV_PIXEL_FORMAT_RESERVED16 = 156,
PVRSRV_PIXEL_FORMAT_RESERVED17 = 157,
PVRSRV_PIXEL_FORMAT_RESERVED18 = 158,
PVRSRV_PIXEL_FORMAT_RESERVED19 = 159,
PVRSRV_PIXEL_FORMAT_RESERVED20 = 160,
PVRSRV_PIXEL_FORMAT_UBYTE4 = 161,
PVRSRV_PIXEL_FORMAT_SHORT4 = 162,
PVRSRV_PIXEL_FORMAT_SHORT4N = 163,
PVRSRV_PIXEL_FORMAT_USHORT4N = 164,
PVRSRV_PIXEL_FORMAT_SHORT2N = 165,
PVRSRV_PIXEL_FORMAT_SHORT2 = 166,
PVRSRV_PIXEL_FORMAT_USHORT2N = 167,
PVRSRV_PIXEL_FORMAT_UDEC3 = 168,
PVRSRV_PIXEL_FORMAT_DEC3N = 169,
PVRSRV_PIXEL_FORMAT_F16_2 = 170,
PVRSRV_PIXEL_FORMAT_F16_4 = 171,
PVRSRV_PIXEL_FORMAT_L_F16 = 172,
PVRSRV_PIXEL_FORMAT_L_F16_REP = 173,
PVRSRV_PIXEL_FORMAT_L_F16_A_F16 = 174,
PVRSRV_PIXEL_FORMAT_A_F16 = 175,
PVRSRV_PIXEL_FORMAT_B16G16R16F = 176,
PVRSRV_PIXEL_FORMAT_L_F32 = 177,
PVRSRV_PIXEL_FORMAT_A_F32 = 178,
PVRSRV_PIXEL_FORMAT_L_F32_A_F32 = 179,
PVRSRV_PIXEL_FORMAT_PVRTC2 = 180,
PVRSRV_PIXEL_FORMAT_PVRTC4 = 181,
PVRSRV_PIXEL_FORMAT_PVRTCII2 = 182,
PVRSRV_PIXEL_FORMAT_PVRTCII4 = 183,
PVRSRV_PIXEL_FORMAT_PVRTCIII = 184,
PVRSRV_PIXEL_FORMAT_PVRO8 = 185,
PVRSRV_PIXEL_FORMAT_PVRO88 = 186,
PVRSRV_PIXEL_FORMAT_PT1 = 187,
PVRSRV_PIXEL_FORMAT_PT2 = 188,
PVRSRV_PIXEL_FORMAT_PT4 = 189,
PVRSRV_PIXEL_FORMAT_PT8 = 190,
PVRSRV_PIXEL_FORMAT_PTW = 191,
PVRSRV_PIXEL_FORMAT_PTB = 192,
PVRSRV_PIXEL_FORMAT_MONO8 = 193,
PVRSRV_PIXEL_FORMAT_MONO16 = 194,
PVRSRV_PIXEL_FORMAT_C0_YUYV = 195,
PVRSRV_PIXEL_FORMAT_C0_UYVY = 196,
PVRSRV_PIXEL_FORMAT_C0_YVYU = 197,
PVRSRV_PIXEL_FORMAT_C0_VYUY = 198,
PVRSRV_PIXEL_FORMAT_C1_YUYV = 199,
PVRSRV_PIXEL_FORMAT_C1_UYVY = 200,
PVRSRV_PIXEL_FORMAT_C1_YVYU = 201,
PVRSRV_PIXEL_FORMAT_C1_VYUY = 202,
PVRSRV_PIXEL_FORMAT_C0_YUV420_2P_UV = 203,
PVRSRV_PIXEL_FORMAT_C0_YUV420_2P_VU = 204,
PVRSRV_PIXEL_FORMAT_C0_YUV420_3P = 205,
PVRSRV_PIXEL_FORMAT_C1_YUV420_2P_UV = 206,
PVRSRV_PIXEL_FORMAT_C1_YUV420_2P_VU = 207,
PVRSRV_PIXEL_FORMAT_C1_YUV420_3P = 208,
PVRSRV_PIXEL_FORMAT_A2B10G10R10F = 209,
PVRSRV_PIXEL_FORMAT_B8G8R8_SINT = 210,
PVRSRV_PIXEL_FORMAT_PVRF32SIGNMASK = 211,
PVRSRV_PIXEL_FORMAT_ABGR4444 = 212,
PVRSRV_PIXEL_FORMAT_ABGR1555 = 213,
PVRSRV_PIXEL_FORMAT_BGR565 = 214,
PVRSRV_PIXEL_FORMAT_FORCE_I32 = 0x7fffffff
} PVRSRV_PIXEL_FORMAT;
typedef enum _PVRSRV_ALPHA_FORMAT_ {
PVRSRV_ALPHA_FORMAT_UNKNOWN = 0x00000000,
PVRSRV_ALPHA_FORMAT_PRE = 0x00000001,
PVRSRV_ALPHA_FORMAT_NONPRE = 0x00000002,
PVRSRV_ALPHA_FORMAT_MASK = 0x0000000F,
} PVRSRV_ALPHA_FORMAT;
typedef enum _PVRSRV_COLOURSPACE_FORMAT_ {
PVRSRV_COLOURSPACE_FORMAT_UNKNOWN = 0x00000000,
PVRSRV_COLOURSPACE_FORMAT_LINEAR = 0x00010000,
PVRSRV_COLOURSPACE_FORMAT_NONLINEAR = 0x00020000,
PVRSRV_COLOURSPACE_FORMAT_MASK = 0x000F0000,
} PVRSRV_COLOURSPACE_FORMAT;
typedef enum _PVRSRV_ROTATION_ {
PVRSRV_ROTATE_0 = 0,
PVRSRV_ROTATE_90 = 1,
PVRSRV_ROTATE_180 = 2,
PVRSRV_ROTATE_270 = 3,
PVRSRV_FLIP_Y
} PVRSRV_ROTATION;
#define PVRSRV_CREATE_SWAPCHAIN_SHARED (1<<0)
#define PVRSRV_CREATE_SWAPCHAIN_QUERY (1<<1)
#define PVRSRV_CREATE_SWAPCHAIN_OEMOVERLAY (1<<2)
typedef struct _PVRSRV_SYNC_DATA_
{
IMG_UINT32 ui32WriteOpsPending;
volatile IMG_UINT32 ui32WriteOpsComplete;
IMG_UINT32 ui32ReadOpsPending;
volatile IMG_UINT32 ui32ReadOpsComplete;
IMG_UINT32 ui32LastOpDumpVal;
IMG_UINT32 ui32LastReadOpDumpVal;
} PVRSRV_SYNC_DATA;
typedef struct _PVRSRV_CLIENT_SYNC_INFO_
{
PVRSRV_SYNC_DATA *psSyncData;
IMG_DEV_VIRTADDR sWriteOpsCompleteDevVAddr;
IMG_DEV_VIRTADDR sReadOpsCompleteDevVAddr;
IMG_HANDLE hMappingInfo;
IMG_HANDLE hKernelSyncInfo;
} PVRSRV_CLIENT_SYNC_INFO, *PPVRSRV_CLIENT_SYNC_INFO;
typedef struct PVRSRV_RESOURCE_TAG
{
volatile IMG_UINT32 ui32Lock;
IMG_UINT32 ui32ID;
}PVRSRV_RESOURCE;
typedef PVRSRV_RESOURCE PVRSRV_RES_HANDLE;
typedef IMG_VOID (*PFN_CMD_COMPLETE) (IMG_HANDLE);
typedef IMG_VOID (**PPFN_CMD_COMPLETE) (IMG_HANDLE);
typedef IMG_BOOL (*PFN_CMD_PROC) (IMG_HANDLE, IMG_UINT32, IMG_VOID*);
typedef IMG_BOOL (**PPFN_CMD_PROC) (IMG_HANDLE, IMG_UINT32, IMG_VOID*);
typedef struct _IMG_RECT_
{
IMG_INT32 x0;
IMG_INT32 y0;
IMG_INT32 x1;
IMG_INT32 y1;
}IMG_RECT;
typedef struct _IMG_RECT_16_
{
IMG_INT16 x0;
IMG_INT16 y0;
IMG_INT16 x1;
IMG_INT16 y1;
}IMG_RECT_16;
typedef PVRSRV_ERROR (*PFN_GET_BUFFER_ADDR)(IMG_HANDLE,
IMG_HANDLE,
IMG_SYS_PHYADDR**,
IMG_SIZE_T*,
IMG_VOID**,
IMG_HANDLE*,
IMG_BOOL*,
IMG_UINT32*);
typedef struct DISPLAY_DIMS_TAG
{
IMG_UINT32 ui32ByteStride;
IMG_UINT32 ui32Width;
IMG_UINT32 ui32Height;
} DISPLAY_DIMS;
typedef struct DISPLAY_FORMAT_TAG
{
PVRSRV_PIXEL_FORMAT pixelformat;
} DISPLAY_FORMAT;
typedef struct DISPLAY_SURF_ATTRIBUTES_TAG
{
PVRSRV_PIXEL_FORMAT pixelformat;
DISPLAY_DIMS sDims;
} DISPLAY_SURF_ATTRIBUTES;
typedef struct DISPLAY_MODE_INFO_TAG
{
PVRSRV_PIXEL_FORMAT pixelformat;
DISPLAY_DIMS sDims;
IMG_UINT32 ui32RefreshHZ;
IMG_UINT32 ui32OEMFlags;
} DISPLAY_MODE_INFO;
#define MAX_DISPLAY_NAME_SIZE (50)
typedef struct DISPLAY_INFO_TAG
{
IMG_UINT32 ui32MaxSwapChains;
IMG_UINT32 ui32MaxSwapChainBuffers;
IMG_UINT32 ui32MinSwapInterval;
IMG_UINT32 ui32MaxSwapInterval;
IMG_UINT32 ui32PhysicalWidthmm;
IMG_UINT32 ui32PhysicalHeightmm;
IMG_CHAR szDisplayName[MAX_DISPLAY_NAME_SIZE];
#if defined(SUPPORT_HW_CURSOR)
IMG_UINT16 ui32CursorWidth;
IMG_UINT16 ui32CursorHeight;
#endif
} DISPLAY_INFO;
typedef struct ACCESS_INFO_TAG
{
IMG_UINT32 ui32Size;
IMG_UINT32 ui32FBPhysBaseAddress;
IMG_UINT32 ui32FBMemAvailable;
IMG_UINT32 ui32SysPhysBaseAddress;
IMG_UINT32 ui32SysSize;
IMG_UINT32 ui32DevIRQ;
}ACCESS_INFO;
typedef struct PVRSRV_CURSOR_SHAPE_TAG
{
IMG_UINT16 ui16Width;
IMG_UINT16 ui16Height;
IMG_INT16 i16XHot;
IMG_INT16 i16YHot;
IMG_VOID* pvMask;
IMG_INT16 i16MaskByteStride;
IMG_VOID* pvColour;
IMG_INT16 i16ColourByteStride;
PVRSRV_PIXEL_FORMAT eColourPixelFormat;
} PVRSRV_CURSOR_SHAPE;
#define PVRSRV_SET_CURSOR_VISIBILITY (1<<0)
#define PVRSRV_SET_CURSOR_POSITION (1<<1)
#define PVRSRV_SET_CURSOR_SHAPE (1<<2)
#define PVRSRV_SET_CURSOR_ROTATION (1<<3)
typedef struct PVRSRV_CURSOR_INFO_TAG
{
IMG_UINT32 ui32Flags;
IMG_BOOL bVisible;
IMG_INT16 i16XPos;
IMG_INT16 i16YPos;
PVRSRV_CURSOR_SHAPE sCursorShape;
IMG_UINT32 ui32Rotation;
} PVRSRV_CURSOR_INFO;
typedef struct _PVRSRV_REGISTRY_INFO_
{
IMG_UINT32 ui32DevCookie;
IMG_PCHAR pszKey;
IMG_PCHAR pszValue;
IMG_PCHAR pszBuf;
IMG_UINT32 ui32BufSize;
} PVRSRV_REGISTRY_INFO, *PPVRSRV_REGISTRY_INFO;
PVRSRV_ERROR IMG_CALLCONV PVRSRVReadRegistryString (PPVRSRV_REGISTRY_INFO psRegInfo);
PVRSRV_ERROR IMG_CALLCONV PVRSRVWriteRegistryString (PPVRSRV_REGISTRY_INFO psRegInfo);
#define PVRSRV_BC_FLAGS_YUVCSC_CONFORMANT_RANGE (0 << 0)
#define PVRSRV_BC_FLAGS_YUVCSC_FULL_RANGE (1 << 0)
#define PVRSRV_BC_FLAGS_YUVCSC_BT601 (0 << 1)
#define PVRSRV_BC_FLAGS_YUVCSC_BT709 (1 << 1)
#define MAX_BUFFER_DEVICE_NAME_SIZE (50)
typedef struct BUFFER_INFO_TAG
{
IMG_UINT32 ui32BufferCount;
IMG_UINT32 ui32BufferDeviceID;
PVRSRV_PIXEL_FORMAT pixelformat;
IMG_UINT32 ui32ByteStride;
IMG_UINT32 ui32Width;
IMG_UINT32 ui32Height;
IMG_UINT32 ui32Flags;
IMG_CHAR szDeviceName[MAX_BUFFER_DEVICE_NAME_SIZE];
} BUFFER_INFO;
typedef enum _OVERLAY_DEINTERLACE_MODE_
{
WEAVE=0x0,
BOB_ODD,
BOB_EVEN,
BOB_EVEN_NONINTERLEAVED
} OVERLAY_DEINTERLACE_MODE;
#endif

285
sys/pvr2d/pvr_includes/wsegl.h Executable file
View file

@ -0,0 +1,285 @@
/**********************************************************************
*
* Copyright(c) Imagination Technologies Ltd.
*
* The contents of this file are subject to the MIT license as set out below.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
* OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* This License is also included in this distribution in the file called
* "COPYING".
*
******************************************************************************/
#if !defined(__WSEGL_H__)
#define __WSEGL_H__
#ifdef __cplusplus
extern "C" {
#endif
/*
// WSEGL Platform-specific definitions
*/
#if defined(__linux__)
#define WSEGL_EXPORT __attribute__((visibility("default")))
#define WSEGL_IMPORT
#else
#define WSEGL_EXPORT
#define WSEGL_IMPORT
#endif
/*
// WSEGL API Version Number
*/
#define WSEGL_VERSION 2
#define WSEGL_DEFAULT_DISPLAY 0
#define WSEGL_DEFAULT_NATIVE_ENGINE 0
#define WSEGL_FALSE 0
#define WSEGL_TRUE 1
#define WSEGL_NULL 0
#define WSEGL_UNREFERENCED_PARAMETER(param) (param) = (param)
/*
// WSEGL handles
*/
typedef void *WSEGLDisplayHandle;
typedef void *WSEGLDrawableHandle;
/*
// Display capability type
*/
typedef enum WSEGLCapsType_TAG
{
WSEGL_NO_CAPS = 0,
WSEGL_CAP_MIN_SWAP_INTERVAL = 1, /* System default value = 1 */
WSEGL_CAP_MAX_SWAP_INTERVAL = 2, /* System default value = 1 */
WSEGL_CAP_WINDOWS_USE_HW_SYNC = 3, /* System default value = 0 (FALSE) */
WSEGL_CAP_PIXMAPS_USE_HW_SYNC = 4, /* System default value = 0 (FALSE) */
} WSEGLCapsType;
/*
// Display capability
*/
typedef struct WSEGLCaps_TAG
{
WSEGLCapsType eCapsType;
unsigned long ui32CapsValue;
} WSEGLCaps;
/*
// Drawable type
*/
#define WSEGL_NO_DRAWABLE 0x0
#define WSEGL_DRAWABLE_WINDOW 0x1
#define WSEGL_DRAWABLE_PIXMAP 0x2
/*
// Pixel format of display/drawable
*/
typedef enum WSEGLPixelFormat_TAG
{
/* These must not be re-ordered */
WSEGL_PIXELFORMAT_RGB565 = 0,
WSEGL_PIXELFORMAT_ARGB4444 = 1,
WSEGL_PIXELFORMAT_ARGB8888 = 2,
WSEGL_PIXELFORMAT_ARGB1555 = 3,
WSEGL_PIXELFORMAT_ABGR8888 = 4,
WSEGL_PIXELFORMAT_XBGR8888 = 5,
/* These are compatibility names only; new WSEGL
* modules should not use them.
*/
WSEGL_PIXELFORMAT_565 = WSEGL_PIXELFORMAT_RGB565,
WSEGL_PIXELFORMAT_4444 = WSEGL_PIXELFORMAT_ARGB4444,
WSEGL_PIXELFORMAT_8888 = WSEGL_PIXELFORMAT_ARGB8888,
WSEGL_PIXELFORMAT_1555 = WSEGL_PIXELFORMAT_ARGB1555,
} WSEGLPixelFormat;
/*
// Transparent of display/drawable
*/
typedef enum WSEGLTransparentType_TAG
{
WSEGL_OPAQUE = 0,
WSEGL_COLOR_KEY = 1,
} WSEGLTransparentType;
/*
// Display/drawable configuration
*/
typedef struct WSEGLConfig_TAG
{
/*
// Type of drawables this configuration applies to -
// OR'd values of drawable types.
*/
unsigned long ui32DrawableType;
/* Pixel format */
WSEGLPixelFormat ePixelFormat;
/* Native Renderable - set to WSEGL_TRUE if native renderable */
unsigned long ulNativeRenderable;
/* FrameBuffer Level Parameter */
unsigned long ulFrameBufferLevel;
/* Native Visual ID */
unsigned long ulNativeVisualID;
/* Native Visual */
void *hNativeVisual;
/* Transparent Type */
WSEGLTransparentType eTransparentType;
/* Transparent Color - only used if transparent type is COLOR_KEY */
unsigned long ulTransparentColor; /* packed as 0x00RRGGBB */
} WSEGLConfig;
/*
// WSEGL errors
*/
typedef enum WSEGLError_TAG
{
WSEGL_SUCCESS = 0,
WSEGL_CANNOT_INITIALISE = 1,
WSEGL_BAD_NATIVE_DISPLAY = 2,
WSEGL_BAD_NATIVE_WINDOW = 3,
WSEGL_BAD_NATIVE_PIXMAP = 4,
WSEGL_BAD_NATIVE_ENGINE = 5,
WSEGL_BAD_DRAWABLE = 6,
WSEGL_BAD_MATCH = 7,
WSEGL_OUT_OF_MEMORY = 8,
/* These are compatibility names only; new WSEGL
* modules should not use them.
*/
WSEGL_BAD_CONFIG = WSEGL_BAD_MATCH,
} WSEGLError;
/*
// Drawable orientation (in degrees anti-clockwise)
*/
typedef enum WSEGLRotationAngle_TAG
{
WSEGL_ROTATE_0 = 0,
WSEGL_ROTATE_90 = 1,
WSEGL_ROTATE_180 = 2,
WSEGL_ROTATE_270 = 3
} WSEGLRotationAngle;
/*
// Drawable information required by OpenGL-ES driver
*/
typedef struct WSEGLDrawableParams_TAG
{
/* Width in pixels of the drawable */
unsigned long ui32Width;
/* Height in pixels of the drawable */
unsigned long ui32Height;
/* Stride in pixels of the drawable */
unsigned long ui32Stride;
/* Pixel format of the drawable */
WSEGLPixelFormat ePixelFormat;
/* User space cpu virtual address of the drawable */
void *pvLinearAddress;
/* HW address of the drawable */
unsigned long ui32HWAddress;
/* Private data for the drawable */
void *hPrivateData;
} WSEGLDrawableParams;
/*
// Table of function pointers that is returned by WSEGL_GetFunctionTablePointer()
//
// The first entry in the table is the version number of the wsegl.h header file that
// the module has been written against, and should therefore be set to WSEGL_VERSION
*/
typedef struct WSEGL_FunctionTable_TAG
{
unsigned long ui32WSEGLVersion;
WSEGLError (*pfnWSEGL_IsDisplayValid)(NativeDisplayType);
WSEGLError (*pfnWSEGL_InitialiseDisplay)(NativeDisplayType, WSEGLDisplayHandle *, const WSEGLCaps **, WSEGLConfig **);
WSEGLError (*pfnWSEGL_CloseDisplay)(WSEGLDisplayHandle);
WSEGLError (*pfnWSEGL_CreateWindowDrawable)(WSEGLDisplayHandle, WSEGLConfig *, WSEGLDrawableHandle *, NativeWindowType, WSEGLRotationAngle *);
WSEGLError (*pfnWSEGL_CreatePixmapDrawable)(WSEGLDisplayHandle, WSEGLConfig *, WSEGLDrawableHandle *, NativePixmapType, WSEGLRotationAngle *);
WSEGLError (*pfnWSEGL_DeleteDrawable)(WSEGLDrawableHandle);
WSEGLError (*pfnWSEGL_SwapDrawable)(WSEGLDrawableHandle, unsigned long);
WSEGLError (*pfnWSEGL_SwapControlInterval)(WSEGLDrawableHandle, unsigned long);
WSEGLError (*pfnWSEGL_WaitNative)(WSEGLDrawableHandle, unsigned long);
WSEGLError (*pfnWSEGL_CopyFromDrawable)(WSEGLDrawableHandle, NativePixmapType);
WSEGLError (*pfnWSEGL_CopyFromPBuffer)(void *, unsigned long, unsigned long, unsigned long, WSEGLPixelFormat, NativePixmapType);
WSEGLError (*pfnWSEGL_GetDrawableParameters)(WSEGLDrawableHandle, WSEGLDrawableParams *, WSEGLDrawableParams *);
WSEGLError (*pfnWSEGL_ConnectDrawable)(WSEGLDrawableHandle);
WSEGLError (*pfnWSEGL_DisconnectDrawable)(WSEGLDrawableHandle);
} WSEGL_FunctionTable;
WSEGL_IMPORT const WSEGL_FunctionTable *WSEGL_GetFunctionTablePointer(void);
#ifdef __cplusplus
}
#endif
#endif /* __WSEGL_H__ */
/******************************************************************************
End of file (wsegl.h)
******************************************************************************/