st/xorg: implement basics of xv

This commit is contained in:
Zack Rusin
2009-09-30 21:22:48 -04:00
parent f096cc7dc1
commit 4969d014e5
4 changed files with 66 additions and 6 deletions
+1
View File
@@ -5,6 +5,7 @@ LIBNAME = xorgtracker
LIBRARY_INCLUDES = \
-DHAVE_CONFIG_H \
-DHAVE_XEXTPROTO_71=1 \
$(shell pkg-config --cflags-only-I pixman-1 xorg-server libdrm xproto) \
-I$(TOP)/src/gallium/include \
-I$(TOP)/src/gallium/auxiliary \
+2 -2
View File
@@ -43,10 +43,10 @@
#include "xf86Modes.h"
#ifdef HAVE_XEXTPROTO_71
#include <X11/extensions/dpmsconst.h>
#include "X11/extensions/dpmsconst.h"
#else
#define DPMS_SERVER
#include <X11/extensions/dpms.h>
#include "X11/extensions/dpmsconst.h"
#endif
#include "pipe/p_inlines.h"
@@ -560,6 +560,8 @@ ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
ms->exa = xorg_exa_init(pScrn);
ms->debug_fallback = debug_get_bool_option("XORG_DEBUG_FALLBACK", TRUE);
xorg_init_video(pScreen);
miInitializeBackingStore(pScreen);
xf86SetBackingStore(pScreen);
xf86SetSilkenMouse(pScreen);
+61 -4
View File
@@ -40,26 +40,54 @@ static XF86ImageRec Images[NUM_IMAGES] = {
struct xorg_xv_port_priv {
RegionRec clip;
int brightness;
int contrast;
};
static void
stop_video(ScrnInfoPtr pScrn, pointer data, Bool shutdown)
{
struct xorg_xv_port_priv *priv = (struct xorg_xv_port_priv *)data;
REGION_EMPTY(pScrn->pScreen, &priv->clip);
}
static int
set_port_attribute(ScrnInfoPtr pScrn,
Atom attribute, INT32 value, pointer data)
{
return 0;
struct xorg_xv_port_priv *priv = (struct xorg_xv_port_priv *)data;
if (attribute == xvBrightness) {
if ((value < -128) || (value > 127))
return BadValue;
priv->brightness = value;
} else if (attribute == xvContrast) {
if ((value < 0) || (value > 255))
return BadValue;
priv->contrast = value;
} else
return BadMatch;
return Success;
}
static int
get_port_attribute(ScrnInfoPtr pScrn,
Atom attribute, INT32 * value, pointer data)
{
return 0;
struct xorg_xv_port_priv *priv = (struct xorg_xv_port_priv *)data;
if (attribute == xvBrightness)
*value = priv->brightness;
else if (attribute == xvContrast)
*value = priv->contrast;
else
return BadMatch;
return Success;
}
static void
@@ -69,6 +97,13 @@ query_best_size(ScrnInfoPtr pScrn,
short drw_w, short drw_h,
unsigned int *p_w, unsigned int *p_h, pointer data)
{
if (vid_w > (drw_w << 1))
drw_w = vid_w >> 1;
if (vid_h > (drw_h << 1))
drw_h = vid_h >> 1;
*p_w = drw_w;
*p_h = drw_h;
}
static int
@@ -91,7 +126,29 @@ query_image_attributes(ScrnInfoPtr pScrn,
unsigned short *w, unsigned short *h,
int *pitches, int *offsets)
{
return 0;
int size;
if (*w > IMAGE_MAX_WIDTH)
*w = IMAGE_MAX_WIDTH;
if (*h > IMAGE_MAX_HEIGHT)
*h = IMAGE_MAX_HEIGHT;
*w = (*w + 1) & ~1;
if (offsets)
offsets[0] = 0;
switch (id) {
case FOURCC_UYVY:
case FOURCC_YUY2:
default:
size = *w << 1;
if (pitches)
pitches[0] = size;
size *= *h;
break;
}
return size;
}
static struct xorg_xv_port_priv *
@@ -106,7 +163,7 @@ port_priv_create(ScreenPtr pScreen)
if (!priv)
return NULL;
REGION_NULL(pScreen, &priv->clip);
REGION_NULL(pScreen, &priv->clip);
return priv;
}