glamor: first real attempt at rendering.
This commit is contained in:
parent
1b151f2e6a
commit
df083fab84
|
@ -16,4 +16,6 @@ AM_CFLAGS = $(XORG_CFLAGS) $(DIX_CFLAGS)
|
||||||
libglamor_la_SOURCES = \
|
libglamor_la_SOURCES = \
|
||||||
glamor.c \
|
glamor.c \
|
||||||
glamor_core.c \
|
glamor_core.c \
|
||||||
|
glamor_fill.c \
|
||||||
|
glamor_fillspans.c \
|
||||||
glamor.h
|
glamor.h
|
||||||
|
|
|
@ -36,22 +36,86 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include "GL/gl.h"
|
||||||
|
|
||||||
#include "glamor_priv.h"
|
#include "glamor_priv.h"
|
||||||
|
|
||||||
static void
|
static void
|
||||||
glamor_fill_spans(DrawablePtr drawable, GCPtr gc, int n,
|
glamor_set_color_from_fgpixel(PixmapPtr pixmap, unsigned long fg_pixel)
|
||||||
DDXPointPtr points, int *width, int sorted)
|
|
||||||
{
|
{
|
||||||
ScreenPtr screen = drawable->pScreen;
|
glColor4ub((fg_pixel >> 16) & 0xff,
|
||||||
PixmapPtr screen_pixmap = screen->GetScreenPixmap(screen);
|
(fg_pixel >> 8) & 0xff,
|
||||||
PixmapPtr dest_pixmap = glamor_get_drawable_pixmap(drawable);
|
(fg_pixel) & 0xff,
|
||||||
|
(fg_pixel >> 24) & 0xff);
|
||||||
|
}
|
||||||
|
|
||||||
if (1 || screen_pixmap != dest_pixmap) {
|
static Bool
|
||||||
fbFillSpans(drawable, gc, n, points, width, sorted);
|
glamor_set_destination_pixmap(PixmapPtr pixmap)
|
||||||
} else {
|
{
|
||||||
ErrorF("stub fill_spans\n");
|
ScreenPtr screen = pixmap->drawable.pScreen;
|
||||||
|
PixmapPtr screen_pixmap = screen->GetScreenPixmap(screen);
|
||||||
|
|
||||||
|
if (pixmap != screen_pixmap) {
|
||||||
|
ErrorF("stubbed drawing to non-screen pixmap\n");
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
glViewport(0, 0,
|
||||||
|
screen_pixmap->drawable.width,
|
||||||
|
screen_pixmap->drawable.height);
|
||||||
|
|
||||||
|
glMatrixMode(GL_PROJECTION);
|
||||||
|
glLoadIdentity();
|
||||||
|
glOrtho(0, screen_pixmap->drawable.width,
|
||||||
|
0, screen_pixmap->drawable.height,
|
||||||
|
-1.0, 1.0);
|
||||||
|
|
||||||
|
glMatrixMode(GL_MODELVIEW);
|
||||||
|
glLoadIdentity();
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
glamor_solid(PixmapPtr pixmap, int x, int y, int width, int height,
|
||||||
|
unsigned char alu, unsigned long planemask, unsigned long fg_pixel)
|
||||||
|
{
|
||||||
|
int x1 = x;
|
||||||
|
int x2 = x + width;
|
||||||
|
int y1 = y;
|
||||||
|
int y2 = y + height;
|
||||||
|
|
||||||
|
if (!glamor_set_destination_pixmap(pixmap))
|
||||||
|
return;
|
||||||
|
glamor_set_color_from_fgpixel(pixmap, fg_pixel);
|
||||||
|
|
||||||
|
glBegin(GL_TRIANGLE_FAN);
|
||||||
|
glVertex2f(x1, y1);
|
||||||
|
glVertex2f(x1, y2);
|
||||||
|
glVertex2f(x2, y2);
|
||||||
|
glVertex2f(x2, y1);
|
||||||
|
glEnd();
|
||||||
|
|
||||||
|
glFlush();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
glamor_stipple(PixmapPtr pixmap, PixmapPtr stipple,
|
||||||
|
int x, int y, int width, int height,
|
||||||
|
unsigned char alu, unsigned long planemask,
|
||||||
|
unsigned long fg_pixel, unsigned long bg_pixel,
|
||||||
|
int stipple_x, int stipple_y)
|
||||||
|
{
|
||||||
|
ErrorF("stubbed out stipple\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
glamor_tile(PixmapPtr pixmap, PixmapPtr tile,
|
||||||
|
int x, int y, int width, int height,
|
||||||
|
unsigned char alu, unsigned long planemask,
|
||||||
|
int tile_x, int tile_y)
|
||||||
|
{
|
||||||
|
ErrorF("stubbed out tile\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -62,7 +126,7 @@ glamor_put_image(DrawablePtr drawable, GCPtr gc, int depth, int x, int y,
|
||||||
PixmapPtr screen_pixmap = screen->GetScreenPixmap(screen);
|
PixmapPtr screen_pixmap = screen->GetScreenPixmap(screen);
|
||||||
PixmapPtr dest_pixmap = glamor_get_drawable_pixmap(drawable);
|
PixmapPtr dest_pixmap = glamor_get_drawable_pixmap(drawable);
|
||||||
|
|
||||||
if (1 || screen_pixmap != dest_pixmap) {
|
if (screen_pixmap != dest_pixmap) {
|
||||||
fbPutImage(drawable, gc, depth, x, y, w, h, leftPad, format, bits);
|
fbPutImage(drawable, gc, depth, x, y, w, h, leftPad, format, bits);
|
||||||
} else {
|
} else {
|
||||||
ErrorF("stub put_image\n");
|
ErrorF("stub put_image\n");
|
||||||
|
@ -71,20 +135,30 @@ glamor_put_image(DrawablePtr drawable, GCPtr gc, int depth, int x, int y,
|
||||||
|
|
||||||
static void
|
static void
|
||||||
glamor_set_spans(DrawablePtr drawable, GCPtr gc, char *src,
|
glamor_set_spans(DrawablePtr drawable, GCPtr gc, char *src,
|
||||||
DDXPointPtr points, int *width, int n, int sorted)
|
DDXPointPtr points, int *widths, int n, int sorted)
|
||||||
{
|
{
|
||||||
ScreenPtr screen = drawable->pScreen;
|
ScreenPtr screen = drawable->pScreen;
|
||||||
PixmapPtr screen_pixmap = screen->GetScreenPixmap(screen);
|
PixmapPtr screen_pixmap = screen->GetScreenPixmap(screen);
|
||||||
PixmapPtr dest_pixmap = glamor_get_drawable_pixmap(drawable);
|
PixmapPtr dest_pixmap = glamor_get_drawable_pixmap(drawable);
|
||||||
|
|
||||||
if (1 || screen_pixmap != dest_pixmap) {
|
if (screen_pixmap != dest_pixmap) {
|
||||||
fbSetSpans(drawable, gc, src, points, width, n, sorted);
|
fbSetSpans(drawable, gc, src, points, widths, n, sorted);
|
||||||
} else {
|
} else {
|
||||||
ErrorF("stub set_spans\n");
|
int i;
|
||||||
|
|
||||||
|
if (!glamor_set_destination_pixmap(dest_pixmap))
|
||||||
|
return;
|
||||||
|
for (i = 0; i < n; i++) {
|
||||||
|
glDrawPixels(points[i].x - dest_pixmap->screen_x,
|
||||||
|
points[i].y - dest_pixmap->screen_y,
|
||||||
|
widths[i],
|
||||||
|
1,
|
||||||
|
src);
|
||||||
|
src += PixmapBytePad(widths[i], drawable->depth);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* glamor_poly_lines() checks if it can accelerate the lines as a group of
|
* glamor_poly_lines() checks if it can accelerate the lines as a group of
|
||||||
* horizontal or vertical lines (rectangles), and uses existing rectangle fill
|
* horizontal or vertical lines (rectangles), and uses existing rectangle fill
|
||||||
|
@ -104,7 +178,7 @@ glamor_poly_lines(DrawablePtr drawable, GCPtr gc, int mode, int n,
|
||||||
/* Don't try to do wide lines or non-solid fill style. */
|
/* Don't try to do wide lines or non-solid fill style. */
|
||||||
if (gc->lineWidth != 0 || gc->lineStyle != LineSolid ||
|
if (gc->lineWidth != 0 || gc->lineStyle != LineSolid ||
|
||||||
gc->fillStyle != FillSolid) {
|
gc->fillStyle != FillSolid) {
|
||||||
if (1 || dest_pixmap != screen_pixmap)
|
if (dest_pixmap != screen_pixmap)
|
||||||
fbPolyLine(drawable, gc, mode, n, points);
|
fbPolyLine(drawable, gc, mode, n, points);
|
||||||
else
|
else
|
||||||
ErrorF("stub poly_line\n");
|
ErrorF("stub poly_line\n");
|
||||||
|
@ -126,7 +200,7 @@ glamor_poly_lines(DrawablePtr drawable, GCPtr gc, int mode, int n,
|
||||||
|
|
||||||
if (x1 != x2 && y1 != y2) {
|
if (x1 != x2 && y1 != y2) {
|
||||||
xfree(rects);
|
xfree(rects);
|
||||||
if (1 || dest_pixmap != screen_pixmap)
|
if (dest_pixmap != screen_pixmap)
|
||||||
fbPolyLine(drawable, gc, mode, n, points);
|
fbPolyLine(drawable, gc, mode, n, points);
|
||||||
else
|
else
|
||||||
ErrorF("stub poly_line\n");
|
ErrorF("stub poly_line\n");
|
||||||
|
|
|
@ -49,5 +49,33 @@ PixmapPtr glamor_get_drawable_pixmap(DrawablePtr drawable);
|
||||||
|
|
||||||
/* glamor_core.c */
|
/* glamor_core.c */
|
||||||
Bool glamor_create_gc(GCPtr gc);
|
Bool glamor_create_gc(GCPtr gc);
|
||||||
|
void glamor_solid(PixmapPtr pixmap, int x, int y, int width, int height,
|
||||||
|
unsigned char alu, unsigned long planemask,
|
||||||
|
unsigned long fg_pixel);
|
||||||
|
void glamor_stipple(PixmapPtr pixmap, PixmapPtr stipple,
|
||||||
|
int x, int y, int width, int height,
|
||||||
|
unsigned char alu, unsigned long planemask,
|
||||||
|
unsigned long fg_pixel, unsigned long bg_pixel,
|
||||||
|
int stipple_x, int stipple_y);
|
||||||
|
void glamor_tile(PixmapPtr pixmap, PixmapPtr tile,
|
||||||
|
int x, int y, int width, int height,
|
||||||
|
unsigned char alu, unsigned long planemask,
|
||||||
|
int tile_x, int tile_y);
|
||||||
|
|
||||||
|
/* glamor_fill.c */
|
||||||
|
void glamor_fill(DrawablePtr drawable,
|
||||||
|
GCPtr gc,
|
||||||
|
int x,
|
||||||
|
int y,
|
||||||
|
int width,
|
||||||
|
int height);
|
||||||
|
|
||||||
|
/* glamor_fillspans.c */
|
||||||
|
void glamor_fill_spans(DrawablePtr drawable,
|
||||||
|
GCPtr gc,
|
||||||
|
int n,
|
||||||
|
DDXPointPtr points,
|
||||||
|
int *widths,
|
||||||
|
int sorted);
|
||||||
|
|
||||||
#endif /* GLAMOR_PRIV_H */
|
#endif /* GLAMOR_PRIV_H */
|
||||||
|
|
|
@ -394,7 +394,10 @@ ephyrSetInternalDamage (ScreenPtr pScreen)
|
||||||
KdScreenInfo *screen = pScreenPriv->screen;
|
KdScreenInfo *screen = pScreenPriv->screen;
|
||||||
EphyrScrPriv *scrpriv = screen->driver;
|
EphyrScrPriv *scrpriv = screen->driver;
|
||||||
PixmapPtr pPixmap = NULL;
|
PixmapPtr pPixmap = NULL;
|
||||||
|
|
||||||
|
if (ephyrFuncs.initAccel == ephyr_glamor_init)
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
scrpriv->pDamage = DamageCreate ((DamageReportFunc) 0,
|
scrpriv->pDamage = DamageCreate ((DamageReportFunc) 0,
|
||||||
(DamageDestroyFunc) 0,
|
(DamageDestroyFunc) 0,
|
||||||
DamageReportNone,
|
DamageReportNone,
|
||||||
|
|
Loading…
Reference in New Issue