diff options
author | Zack Rusin <[email protected]> | 2009-09-30 21:22:48 -0400 |
---|---|---|
committer | Zack Rusin <[email protected]> | 2009-10-11 20:02:47 -0400 |
commit | 4969d014e5d55985119874c8db7cb98154185802 (patch) | |
tree | 04cd537863c4c9c3ccbf5364c15141315eadaa5c /src | |
parent | f096cc7dc1cdae1698eb7a340cd8c7f5ea0b1166 (diff) |
st/xorg: implement basics of xv
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/state_trackers/xorg/Makefile | 1 | ||||
-rw-r--r-- | src/gallium/state_trackers/xorg/xorg_crtc.c | 4 | ||||
-rw-r--r-- | src/gallium/state_trackers/xorg/xorg_driver.c | 2 | ||||
-rw-r--r-- | src/gallium/state_trackers/xorg/xorg_xv.c | 65 |
4 files changed, 66 insertions, 6 deletions
diff --git a/src/gallium/state_trackers/xorg/Makefile b/src/gallium/state_trackers/xorg/Makefile index 27a1990724d..030bac5fff2 100644 --- a/src/gallium/state_trackers/xorg/Makefile +++ b/src/gallium/state_trackers/xorg/Makefile @@ -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 \ diff --git a/src/gallium/state_trackers/xorg/xorg_crtc.c b/src/gallium/state_trackers/xorg/xorg_crtc.c index 67fe29a69da..95973586da8 100644 --- a/src/gallium/state_trackers/xorg/xorg_crtc.c +++ b/src/gallium/state_trackers/xorg/xorg_crtc.c @@ -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" diff --git a/src/gallium/state_trackers/xorg/xorg_driver.c b/src/gallium/state_trackers/xorg/xorg_driver.c index 4bc87aa613d..ab6c3d75580 100644 --- a/src/gallium/state_trackers/xorg/xorg_driver.c +++ b/src/gallium/state_trackers/xorg/xorg_driver.c @@ -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); diff --git a/src/gallium/state_trackers/xorg/xorg_xv.c b/src/gallium/state_trackers/xorg/xorg_xv.c index 88955d47fd3..27d52700ec7 100644 --- a/src/gallium/state_trackers/xorg/xorg_xv.c +++ b/src/gallium/state_trackers/xorg/xorg_xv.c @@ -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; } |