summaryrefslogtreecommitdiff
path: root/src/gallium/state_trackers
diff options
context:
space:
mode:
authorZack Rusin <zack@kde.org>2009-06-08 00:07:04 -0400
committerZack Rusin <zack@kde.org>2009-07-06 17:21:36 -0400
commit21cce6afb03bf9b9adfc6d8a1a446bb3ef22c7a8 (patch)
treed31d186d5d0ee1227ce5d32a7402ac10425a39a3 /src/gallium/state_trackers
parentd66de6c341a859a30ef010c527f9a0c5865b5d65 (diff)
exa: some infrastucture work for accelerating composite
Diffstat (limited to 'src/gallium/state_trackers')
-rw-r--r--src/gallium/state_trackers/xorg/xorg_composite.c27
-rw-r--r--src/gallium/state_trackers/xorg/xorg_composite.h22
-rw-r--r--src/gallium/state_trackers/xorg/xorg_exa.c98
-rw-r--r--src/gallium/state_trackers/xorg/xorg_exa.h27
-rw-r--r--src/gallium/state_trackers/xorg/xorg_tracker.h5
5 files changed, 130 insertions, 49 deletions
diff --git a/src/gallium/state_trackers/xorg/xorg_composite.c b/src/gallium/state_trackers/xorg/xorg_composite.c
new file mode 100644
index 0000000000..255ae91f09
--- /dev/null
+++ b/src/gallium/state_trackers/xorg/xorg_composite.c
@@ -0,0 +1,27 @@
+#include "xorg_composite.h"
+
+
+boolean xorg_composite_accelerated(int op,
+ PicturePtr pSrcPicture,
+ PicturePtr pMaskPicture,
+ PicturePtr pDstPicture)
+{
+ return FALSE;
+}
+
+boolean xorg_composite_bind_state(struct exa_context *exa,
+ int op,
+ PicturePtr pSrcPicture,
+ PicturePtr pMaskPicture,
+ PicturePtr pDstPicture)
+{
+ return FALSE;
+}
+
+void xorg_composite(struct exa_context *exa,
+ struct exa_pixmap_priv *dst,
+ int srcX, int srcY, int maskX, int maskY,
+ int dstX, int dstY, int width, int height)
+{
+}
+
diff --git a/src/gallium/state_trackers/xorg/xorg_composite.h b/src/gallium/state_trackers/xorg/xorg_composite.h
new file mode 100644
index 0000000000..a52e0e6dff
--- /dev/null
+++ b/src/gallium/state_trackers/xorg/xorg_composite.h
@@ -0,0 +1,22 @@
+#ifndef XORG_COMPOSITE_H
+#define XORG_COMPOSITE_H
+
+#include "xorg_exa.h"
+
+boolean xorg_composite_accelerated(int op,
+ PicturePtr pSrcPicture,
+ PicturePtr pMaskPicture,
+ PicturePtr pDstPicture);
+
+boolean xorg_composite_bind_state(struct exa_context *exa,
+ int op,
+ PicturePtr pSrcPicture,
+ PicturePtr pMaskPicture,
+ PicturePtr pDstPicture);
+
+void xorg_composite(struct exa_context *exa,
+ struct exa_pixmap_priv *dst,
+ int srcX, int srcY, int maskX, int maskY,
+ int dstX, int dstY, int width, int height);
+
+#endif
diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c
index 0fbfed1e2a..2c4291aa4e 100644
--- a/src/gallium/state_trackers/xorg/xorg_exa.c
+++ b/src/gallium/state_trackers/xorg/xorg_exa.c
@@ -28,9 +28,14 @@
*
*/
-#include "xorg-server.h"
-#include "xf86.h"
+#include "xorg_exa.h"
#include "xorg_tracker.h"
+#include "xorg_composite.h"
+
+#include <xorg-server.h>
+#include <xf86.h>
+#include <picturestr.h>
+#include <picture.h>
#include "pipe/p_format.h"
#include "pipe/p_context.h"
@@ -39,24 +44,6 @@
#include "util/u_rect.h"
-struct exa_entity
-{
- ExaDriverPtr pExa;
- struct pipe_context *ctx;
- struct pipe_screen *scrn;
-};
-
-struct PixmapPriv
-{
- int flags;
- struct pipe_texture *tex;
- unsigned int color;
- struct pipe_surface *src_surf; /* for copies */
-
- struct pipe_transfer *map_transfer;
- unsigned map_count;
-};
-
/*
* Helper functions
*/
@@ -113,8 +100,8 @@ ExaPrepareAccess(PixmapPtr pPix, int index)
ScreenPtr pScreen = pPix->drawable.pScreen;
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
modesettingPtr ms = modesettingPTR(pScrn);
- struct exa_entity *exa = ms->exa;
- struct PixmapPriv *priv;
+ struct exa_context *exa = ms->exa;
+ struct exa_pixmap_priv *priv;
priv = exaGetPixmapDriverPrivate(pPix);
@@ -145,8 +132,8 @@ ExaFinishAccess(PixmapPtr pPix, int index)
ScreenPtr pScreen = pPix->drawable.pScreen;
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
modesettingPtr ms = modesettingPTR(pScrn);
- struct exa_entity *exa = ms->exa;
- struct PixmapPriv *priv;
+ struct exa_context *exa = ms->exa;
+ struct exa_pixmap_priv *priv;
priv = exaGetPixmapDriverPrivate(pPix);
if (!priv)
@@ -168,8 +155,8 @@ ExaDone(PixmapPtr pPixmap)
{
ScrnInfoPtr pScrn = xf86Screens[pPixmap->drawable.pScreen->myNum];
modesettingPtr ms = modesettingPTR(pScrn);
- struct PixmapPriv *priv = exaGetPixmapDriverPrivate(pPixmap);
- struct exa_entity *exa = ms->exa;
+ struct exa_pixmap_priv *priv = exaGetPixmapDriverPrivate(pPixmap);
+ struct exa_context *exa = ms->exa;
if (!priv)
return;
@@ -190,8 +177,8 @@ ExaPrepareSolid(PixmapPtr pPixmap, int alu, Pixel planeMask, Pixel fg)
{
ScrnInfoPtr pScrn = xf86Screens[pPixmap->drawable.pScreen->myNum];
modesettingPtr ms = modesettingPTR(pScrn);
- struct PixmapPriv *priv = exaGetPixmapDriverPrivate(pPixmap);
- struct exa_entity *exa = ms->exa;
+ struct exa_pixmap_priv *priv = exaGetPixmapDriverPrivate(pPixmap);
+ struct exa_context *exa = ms->exa;
if (1)
return FALSE;
@@ -221,8 +208,8 @@ ExaSolid(PixmapPtr pPixmap, int x0, int y0, int x1, int y1)
{
ScrnInfoPtr pScrn = xf86Screens[pPixmap->drawable.pScreen->myNum];
modesettingPtr ms = modesettingPTR(pScrn);
- struct exa_entity *exa = ms->exa;
- struct PixmapPriv *priv = exaGetPixmapDriverPrivate(pPixmap);
+ struct exa_context *exa = ms->exa;
+ struct exa_pixmap_priv *priv = exaGetPixmapDriverPrivate(pPixmap);
struct pipe_surface *surf =
exa->scrn->get_tex_surface(exa->scrn, priv->tex, 0, 0, 0,
PIPE_BUFFER_USAGE_GPU_READ |
@@ -240,9 +227,9 @@ ExaPrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int xdir,
{
ScrnInfoPtr pScrn = xf86Screens[pDstPixmap->drawable.pScreen->myNum];
modesettingPtr ms = modesettingPTR(pScrn);
- struct exa_entity *exa = ms->exa;
- struct PixmapPriv *priv = exaGetPixmapDriverPrivate(pDstPixmap);
- struct PixmapPriv *src_priv = exaGetPixmapDriverPrivate(pSrcPixmap);
+ struct exa_context *exa = ms->exa;
+ struct exa_pixmap_priv *priv = exaGetPixmapDriverPrivate(pDstPixmap);
+ struct exa_pixmap_priv *src_priv = exaGetPixmapDriverPrivate(pSrcPixmap);
if (1)
return FALSE;
@@ -279,8 +266,8 @@ ExaCopy(PixmapPtr pDstPixmap, int srcX, int srcY, int dstX, int dstY,
{
ScrnInfoPtr pScrn = xf86Screens[pDstPixmap->drawable.pScreen->myNum];
modesettingPtr ms = modesettingPTR(pScrn);
- struct exa_entity *exa = ms->exa;
- struct PixmapPriv *priv = exaGetPixmapDriverPrivate(pDstPixmap);
+ struct exa_context *exa = ms->exa;
+ struct exa_pixmap_priv *priv = exaGetPixmapDriverPrivate(pDstPixmap);
struct pipe_surface *surf =
exa->scrn->get_tex_surface(exa->scrn, priv->tex, 0, 0, 0,
PIPE_BUFFER_USAGE_GPU_READ |
@@ -296,13 +283,25 @@ ExaPrepareComposite(int op, PicturePtr pSrcPicture,
PicturePtr pMaskPicture, PicturePtr pDstPicture,
PixmapPtr pSrc, PixmapPtr pMask, PixmapPtr pDst)
{
- return FALSE;
+ ScrnInfoPtr pScrn = xf86Screens[pDst->drawable.pScreen->myNum];
+ modesettingPtr ms = modesettingPTR(pScrn);
+ struct exa_context *exa = ms->exa;
+
+ return xorg_composite_bind_state(exa, op, pSrcPicture, pMaskPicture,
+ pDstPicture);
}
static void
ExaComposite(PixmapPtr pDst, int srcX, int srcY, int maskX, int maskY,
int dstX, int dstY, int width, int height)
{
+ ScrnInfoPtr pScrn = xf86Screens[pDst->drawable.pScreen->myNum];
+ modesettingPtr ms = modesettingPTR(pScrn);
+ struct exa_context *exa = ms->exa;
+ struct exa_pixmap_priv *priv = exaGetPixmapDriverPrivate(pDst);
+
+ xorg_composite(exa, priv, srcX, srcY, maskX, maskY,
+ dstX, dstY, width, height);
}
static Bool
@@ -310,15 +309,18 @@ ExaCheckComposite(int op,
PicturePtr pSrcPicture, PicturePtr pMaskPicture,
PicturePtr pDstPicture)
{
- return FALSE;
+ return xorg_composite_accelerated(op,
+ pSrcPicture,
+ pMaskPicture,
+ pDstPicture);
}
static void *
ExaCreatePixmap(ScreenPtr pScreen, int size, int align)
{
- struct PixmapPriv *priv;
+ struct exa_pixmap_priv *priv;
- priv = xcalloc(1, sizeof(struct PixmapPriv));
+ priv = xcalloc(1, sizeof(struct exa_pixmap_priv));
if (!priv)
return NULL;
@@ -328,7 +330,7 @@ ExaCreatePixmap(ScreenPtr pScreen, int size, int align)
static void
ExaDestroyPixmap(ScreenPtr pScreen, void *dPriv)
{
- struct PixmapPriv *priv = (struct PixmapPriv *)dPriv;
+ struct exa_pixmap_priv *priv = (struct exa_pixmap_priv *)dPriv;
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
modesettingPtr ms = modesettingPTR(pScrn);
@@ -344,7 +346,7 @@ ExaDestroyPixmap(ScreenPtr pScreen, void *dPriv)
static Bool
ExaPixmapIsOffscreen(PixmapPtr pPixmap)
{
- struct PixmapPriv *priv;
+ struct exa_pixmap_priv *priv;
priv = exaGetPixmapDriverPrivate(pPixmap);
@@ -363,7 +365,7 @@ xorg_exa_get_pixmap_handle(PixmapPtr pPixmap)
ScreenPtr pScreen = pPixmap->drawable.pScreen;
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
modesettingPtr ms = modesettingPTR(pScrn);
- struct PixmapPriv *priv;
+ struct exa_pixmap_priv *priv;
struct pipe_buffer *buffer = NULL;
unsigned handle;
unsigned stride;
@@ -393,9 +395,9 @@ ExaModifyPixmapHeader(PixmapPtr pPixmap, int width, int height,
{
ScreenPtr pScreen = pPixmap->drawable.pScreen;
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- struct PixmapPriv *priv = exaGetPixmapDriverPrivate(pPixmap);
+ struct exa_pixmap_priv *priv = exaGetPixmapDriverPrivate(pPixmap);
modesettingPtr ms = modesettingPTR(pScrn);
- struct exa_entity *exa = ms->exa;
+ struct exa_context *exa = ms->exa;
if (!priv)
return FALSE;
@@ -456,7 +458,7 @@ ExaModifyPixmapHeader(PixmapPtr pPixmap, int width, int height,
struct pipe_texture *
xorg_exa_get_texture(PixmapPtr pPixmap)
{
- struct PixmapPriv *priv = exaGetPixmapDriverPrivate(pPixmap);
+ struct exa_pixmap_priv *priv = exaGetPixmapDriverPrivate(pPixmap);
struct pipe_texture *tex = NULL;
pipe_texture_reference(&tex, priv->tex);
return tex;
@@ -466,7 +468,7 @@ void
xorg_exa_close(ScrnInfoPtr pScrn)
{
modesettingPtr ms = modesettingPTR(pScrn);
- struct exa_entity *exa = ms->exa;
+ struct exa_context *exa = ms->exa;
if (exa->ctx)
exa->ctx->destroy(exa->ctx);
@@ -480,10 +482,10 @@ void *
xorg_exa_init(ScrnInfoPtr pScrn)
{
modesettingPtr ms = modesettingPTR(pScrn);
- struct exa_entity *exa;
+ struct exa_context *exa;
ExaDriverPtr pExa;
- exa = xcalloc(1, sizeof(struct exa_entity));
+ exa = xcalloc(1, sizeof(struct exa_context));
if (!exa)
return NULL;
diff --git a/src/gallium/state_trackers/xorg/xorg_exa.h b/src/gallium/state_trackers/xorg/xorg_exa.h
new file mode 100644
index 0000000000..650997aec6
--- /dev/null
+++ b/src/gallium/state_trackers/xorg/xorg_exa.h
@@ -0,0 +1,27 @@
+#ifndef XORG_EXA_H
+#define XORG_EXA_H
+
+#include "xorg_tracker.h"
+
+struct exa_context
+{
+ ExaDriverPtr pExa;
+ struct pipe_context *ctx;
+ struct pipe_screen *scrn;
+};
+
+
+struct exa_pixmap_priv
+{
+ int flags;
+ struct pipe_texture *tex;
+ unsigned int color;
+ struct pipe_surface *src_surf; /* for copies */
+
+ struct pipe_transfer *map_transfer;
+ unsigned map_count;
+};
+
+
+
+#endif
diff --git a/src/gallium/state_trackers/xorg/xorg_tracker.h b/src/gallium/state_trackers/xorg/xorg_tracker.h
index 95924b7d88..b4742bdbf5 100644
--- a/src/gallium/state_trackers/xorg/xorg_tracker.h
+++ b/src/gallium/state_trackers/xorg/xorg_tracker.h
@@ -31,11 +31,14 @@
#ifndef _XORG_TRACKER_H_
#define _XORG_TRACKER_H_
+#include <stdint.h>
#include <errno.h>
#include <drm.h>
#include <xf86drm.h>
#include <xf86drmMode.h>
-#include "exa.h"
+#include <xorg-server.h>
+#include <xf86.h>
+#include <exa.h>
#include "pipe/p_screen.h"
#include "state_tracker/drm_api.h"