diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/drivers/dri/glamo/Makefile | 3 | ||||
-rw-r--r-- | src/mesa/drivers/dri/glamo/glamo-regs.h | 137 | ||||
-rw-r--r-- | src/mesa/drivers/dri/glamo/glamo_cmdq.c | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/glamo/glamo_context.c | 4 | ||||
-rw-r--r-- | src/mesa/drivers/dri/glamo/glamo_context.h | 4 | ||||
-rw-r--r-- | src/mesa/drivers/dri/glamo/glamo_regs.h | 134 | ||||
-rw-r--r-- | src/mesa/drivers/dri/glamo/glamo_state.c | 33 |
7 files changed, 312 insertions, 5 deletions
diff --git a/src/mesa/drivers/dri/glamo/Makefile b/src/mesa/drivers/dri/glamo/Makefile index 2e8de52390..a917ffe20f 100644 --- a/src/mesa/drivers/dri/glamo/Makefile +++ b/src/mesa/drivers/dri/glamo/Makefile @@ -6,7 +6,8 @@ include $(TOP)/configs/current LIBNAME = glamo_dri.so DRIVER_SOURCES = \ - glamo_screen.c glamo_context.c glamo_state.c glamo_fbo.c glamo_tris.c + glamo_screen.c glamo_context.c glamo_state.c glamo_fbo.c glamo_tris.c \ + glamo_cmdq.c C_SOURCES = \ $(COMMON_SOURCES) \ diff --git a/src/mesa/drivers/dri/glamo/glamo-regs.h b/src/mesa/drivers/dri/glamo/glamo-regs.h new file mode 100644 index 0000000000..8bf8d0d369 --- /dev/null +++ b/src/mesa/drivers/dri/glamo/glamo-regs.h @@ -0,0 +1,137 @@ +/* Smedia Glamo 336x/337x driver + * + * (C) 2007 by OpenMoko, Inc. + * Author: Harald Welte <laforge@openmoko.org> + * All rights reserved. + * + * Modified for Glamo Mesa driver by Thomas White <taw@bitwiz.org.uk> + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + + +#ifndef __GLAMO_REGS_H +#define __GLAMO_REGS_H + + +enum glamo_regster_offsets { + GLAMO_REGOFS_GENERIC = 0x0000, + GLAMO_REGOFS_HOSTBUS = 0x0200, + GLAMO_REGOFS_MEMORY = 0x0300, + GLAMO_REGOFS_VIDCAP = 0x0400, + GLAMO_REGOFS_ISP = 0x0500, + GLAMO_REGOFS_JPEG = 0x0800, + GLAMO_REGOFS_MPEG = 0x0c00, + GLAMO_REGOFS_LCD = 0x1100, + GLAMO_REGOFS_MMC = 0x1400, + GLAMO_REGOFS_MPROC0 = 0x1500, + GLAMO_REGOFS_MPROC1 = 0x1580, + GLAMO_REGOFS_CMDQUEUE = 0x1600, + GLAMO_REGOFS_RISC = 0x1680, + GLAMO_REGOFS_2D = 0x1700, + GLAMO_REGOFS_3D = 0x1b00, +}; + + +#define REG_MPEG(x) (GLAMO_REGOFS_MPEG+(x)) + +enum glamo_register_mpeg { + // + GLAMO_REG_MPEG_DC_ADDRL = REG_MPEG(0x3c), + GLAMO_REG_MPEG_DC_ADDRH = REG_MPEG(0x3e), + GLAMO_REG_MPEG_AC_ADDRL = REG_MPEG(0x40), + GLAMO_REG_MPEG_AC_ADDRH = REG_MPEG(0x42), + // + GLAMO_REG_MPEG_SAFE_1 = REG_MPEG(0x60), + GLAMO_REG_MPEG_SAFE_2 = REG_MPEG(0x62), + GLAMO_REG_MPEG_SAFE_3 = REG_MPEG(0x64), + // + GLAMO_REG_MPEG_DEC_OUT0_Y_ADDRL = REG_MPEG(0x6e), + GLAMO_REG_MPEG_DEC_OUT0_Y_ADDRH = REG_MPEG(0x70), + GLAMO_REG_MPEG_DEC_OUT0_U_ADDRL = REG_MPEG(0x72), + GLAMO_REG_MPEG_DEC_OUT0_U_ADDRH = REG_MPEG(0x74), + GLAMO_REG_MPEG_DEC_OUT0_V_ADDRL = REG_MPEG(0x76), + GLAMO_REG_MPEG_DEC_OUT0_V_ADDRH = REG_MPEG(0x78), + GLAMO_REG_MPEG_DEC_OUT1_Y_ADDRL = REG_MPEG(0x7a), + GLAMO_REG_MPEG_DEC_OUT1_Y_ADDRH = REG_MPEG(0x7c), + GLAMO_REG_MPEG_DEC_OUT1_U_ADDRL = REG_MPEG(0x7e), + GLAMO_REG_MPEG_DEC_OUT1_U_ADDRH = REG_MPEG(0x80), + GLAMO_REG_MPEG_DEC_OUT1_V_ADDRL = REG_MPEG(0x82), + GLAMO_REG_MPEG_DEC_OUT1_V_ADDRH = REG_MPEG(0x84), + GLAMO_REG_MPEG_DEC_OUT2_Y_ADDRL = REG_MPEG(0x86), + GLAMO_REG_MPEG_DEC_OUT2_Y_ADDRH = REG_MPEG(0x88), + GLAMO_REG_MPEG_DEC_OUT2_U_ADDRL = REG_MPEG(0x8a), + GLAMO_REG_MPEG_DEC_OUT2_U_ADDRH = REG_MPEG(0x8c), + GLAMO_REG_MPEG_DEC_OUT2_V_ADDRL = REG_MPEG(0x8e), + GLAMO_REG_MPEG_DEC_OUT2_V_ADDRH = REG_MPEG(0x90), + GLAMO_REG_MPEG_DEC_WIDTH = REG_MPEG(0x92), + GLAMO_REG_MPEG_DEC_HEIGHT = REG_MPEG(0x94), + GLAMO_REG_MPEG_SPECIAL = REG_MPEG(0x96), + GLAMO_REG_MPEG_DEC_IN_ADDRL = REG_MPEG(0x98), + GLAMO_REG_MPEG_DEC_IN_ADDRH = REG_MPEG(0x9a), + // + GLAMO_REG_MPEG_DEBLK_THRESHOLD = REG_MPEG(0xc0), + // + GLAMO_REG_MPEG_DEC_STATUS = REG_MPEG(0xc8), + GLAMO_REG_MPEG_DEC_RB0 = REG_MPEG(0xca), + GLAMO_REG_MPEG_DEC_RB1 = REG_MPEG(0xcc), +}; + + +#define REG_2D(x) (GLAMO_REGOFS_2D+(x)) + +enum glamo_register_2d { + GLAMO_REG_2D_SRC_ADDRL = REG_2D(0x00), + GLAMO_REG_2D_SRC_ADDRH = REG_2D(0x02), + GLAMO_REG_2D_SRC_PITCH = REG_2D(0x04), + GLAMO_REG_2D_SRC_X = REG_2D(0x06), + GLAMO_REG_2D_SRC_Y = REG_2D(0x08), + GLAMO_REG_2D_DST_X = REG_2D(0x0a), + GLAMO_REG_2D_DST_Y = REG_2D(0x0c), + GLAMO_REG_2D_DST_ADDRL = REG_2D(0x0e), + GLAMO_REG_2D_DST_ADDRH = REG_2D(0x10), + GLAMO_REG_2D_DST_PITCH = REG_2D(0x12), + GLAMO_REG_2D_DST_HEIGHT = REG_2D(0x14), + GLAMO_REG_2D_RECT_WIDTH = REG_2D(0x16), + GLAMO_REG_2D_RECT_HEIGHT = REG_2D(0x18), + GLAMO_REG_2D_PAT_ADDRL = REG_2D(0x1a), + GLAMO_REG_2D_PAT_ADDRH = REG_2D(0x1c), + GLAMO_REG_2D_PAT_FG = REG_2D(0x1e), + GLAMO_REG_2D_PAT_BG = REG_2D(0x20), + GLAMO_REG_2D_SRC_FG = REG_2D(0x22), + GLAMO_REG_2D_SRC_BG = REG_2D(0x24), + GLAMO_REG_2D_MASK1 = REG_2D(0x26), + GLAMO_REG_2D_MASK2 = REG_2D(0x28), + GLAMO_REG_2D_MASK3 = REG_2D(0x2a), + GLAMO_REG_2D_MASK4 = REG_2D(0x2c), + GLAMO_REG_2D_ROT_X = REG_2D(0x2e), + GLAMO_REG_2D_ROT_Y = REG_2D(0x30), + GLAMO_REG_2D_LEFT_CLIP = REG_2D(0x32), + GLAMO_REG_2D_TOP_CLIP = REG_2D(0x34), + GLAMO_REG_2D_RIGHT_CLIP = REG_2D(0x36), + GLAMO_REG_2D_BOTTOM_CLIP = REG_2D(0x38), + GLAMO_REG_2D_COMMAND1 = REG_2D(0x3A), + GLAMO_REG_2D_COMMAND2 = REG_2D(0x3C), + GLAMO_REG_2D_COMMAND3 = REG_2D(0x3E), + GLAMO_REG_2D_SAFE = REG_2D(0x40), + GLAMO_REG_2D_STATUS = REG_2D(0x42), + GLAMO_REG_2D_ID1 = REG_2D(0x44), + GLAMO_REG_2D_ID2 = REG_2D(0x46), + GLAMO_REG_2D_ID3 = REG_2D(0x48), +}; + + +#endif /* __GLAMO_REGS_H */ diff --git a/src/mesa/drivers/dri/glamo/glamo_cmdq.c b/src/mesa/drivers/dri/glamo/glamo_cmdq.c index 0973b5fd5c..a528aa6150 100644 --- a/src/mesa/drivers/dri/glamo/glamo_cmdq.c +++ b/src/mesa/drivers/dri/glamo/glamo_cmdq.c @@ -22,9 +22,11 @@ #include <stdint.h> #include <drm.h> +#include <glamo_drm.h> #include <glamo_bo.h> #include "glamo_context.h" +#include "glamo_cmdq.h" /* Submit the prepared command sequence to the kernel */ diff --git a/src/mesa/drivers/dri/glamo/glamo_context.c b/src/mesa/drivers/dri/glamo/glamo_context.c index a0769a27ee..d9990ae8e1 100644 --- a/src/mesa/drivers/dri/glamo/glamo_context.c +++ b/src/mesa/drivers/dri/glamo/glamo_context.c @@ -131,7 +131,7 @@ GLboolean glamoCreateContext(const __GLcontextModes *glVisual, context->driContext = driContextPriv; context->driScreen = sPriv; context->driDrawable = NULL; - context->driFd = sPriv->fd; + context->drm_fd = sPriv->fd; /* Initialize the software rasterizer and helper modules. */ _swrast_CreateContext(ctx); @@ -148,7 +148,7 @@ GLboolean glamoCreateContext(const __GLcontextModes *glVisual, _tnl_allow_pixel_fog(ctx, GL_TRUE); _tnl_allow_vertex_fog(ctx, GL_FALSE); - glamoInitCmdq(context); + GlamoInitCmdqCache(context); glamoInitStateFuncs(ctx); glamoInitTriFuncs(ctx); diff --git a/src/mesa/drivers/dri/glamo/glamo_context.h b/src/mesa/drivers/dri/glamo/glamo_context.h index b42dcd6839..c8bb10dbd8 100644 --- a/src/mesa/drivers/dri/glamo/glamo_context.h +++ b/src/mesa/drivers/dri/glamo/glamo_context.h @@ -29,14 +29,14 @@ #include "utils.h" #include "glamo_screen.h" -typedef struct glamo_context glamoContextRec; +typedef struct glamo_context glamoContext; typedef struct glamo_context *glamoContextPtr; struct glamo_context { GLcontext *glCtx; /* Must be first in this structure */ - int driFd; /* DRM fd */ + int drm_fd; /* DRM fd */ __DRIcontextPrivate *driContext; /* DRI context */ __DRIscreenPrivate *driScreen; /* DRI screen */ diff --git a/src/mesa/drivers/dri/glamo/glamo_regs.h b/src/mesa/drivers/dri/glamo/glamo_regs.h new file mode 100644 index 0000000000..ff5c754b20 --- /dev/null +++ b/src/mesa/drivers/dri/glamo/glamo_regs.h @@ -0,0 +1,134 @@ +#ifndef _GLAMO_REGS_H +#define _GLAMO_REGS_H + +/* Smedia Glamo 336x/337x driver + * + * (C) 2007 by OpenMoko, Inc. + * Author: Harald Welte <laforge@openmoko.org> + * All rights reserved. + * + * Modified for Glamo Mesa driver by Thomas White <taw@bitwiz.org.uk> + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +enum glamo_regster_offsets { + GLAMO_REGOFS_GENERIC = 0x0000, + GLAMO_REGOFS_HOSTBUS = 0x0200, + GLAMO_REGOFS_MEMORY = 0x0300, + GLAMO_REGOFS_VIDCAP = 0x0400, + GLAMO_REGOFS_ISP = 0x0500, + GLAMO_REGOFS_JPEG = 0x0800, + GLAMO_REGOFS_MPEG = 0x0c00, + GLAMO_REGOFS_LCD = 0x1100, + GLAMO_REGOFS_MMC = 0x1400, + GLAMO_REGOFS_MPROC0 = 0x1500, + GLAMO_REGOFS_MPROC1 = 0x1580, + GLAMO_REGOFS_CMDQUEUE = 0x1600, + GLAMO_REGOFS_RISC = 0x1680, + GLAMO_REGOFS_2D = 0x1700, + GLAMO_REGOFS_3D = 0x1b00, +}; + + +#define REG_MPEG(x) (GLAMO_REGOFS_MPEG+(x)) + +enum glamo_register_mpeg { + // + GLAMO_REG_MPEG_DC_ADDRL = REG_MPEG(0x3c), + GLAMO_REG_MPEG_DC_ADDRH = REG_MPEG(0x3e), + GLAMO_REG_MPEG_AC_ADDRL = REG_MPEG(0x40), + GLAMO_REG_MPEG_AC_ADDRH = REG_MPEG(0x42), + // + GLAMO_REG_MPEG_SAFE_1 = REG_MPEG(0x60), + GLAMO_REG_MPEG_SAFE_2 = REG_MPEG(0x62), + GLAMO_REG_MPEG_SAFE_3 = REG_MPEG(0x64), + // + GLAMO_REG_MPEG_DEC_OUT0_Y_ADDRL = REG_MPEG(0x6e), + GLAMO_REG_MPEG_DEC_OUT0_Y_ADDRH = REG_MPEG(0x70), + GLAMO_REG_MPEG_DEC_OUT0_U_ADDRL = REG_MPEG(0x72), + GLAMO_REG_MPEG_DEC_OUT0_U_ADDRH = REG_MPEG(0x74), + GLAMO_REG_MPEG_DEC_OUT0_V_ADDRL = REG_MPEG(0x76), + GLAMO_REG_MPEG_DEC_OUT0_V_ADDRH = REG_MPEG(0x78), + GLAMO_REG_MPEG_DEC_OUT1_Y_ADDRL = REG_MPEG(0x7a), + GLAMO_REG_MPEG_DEC_OUT1_Y_ADDRH = REG_MPEG(0x7c), + GLAMO_REG_MPEG_DEC_OUT1_U_ADDRL = REG_MPEG(0x7e), + GLAMO_REG_MPEG_DEC_OUT1_U_ADDRH = REG_MPEG(0x80), + GLAMO_REG_MPEG_DEC_OUT1_V_ADDRL = REG_MPEG(0x82), + GLAMO_REG_MPEG_DEC_OUT1_V_ADDRH = REG_MPEG(0x84), + GLAMO_REG_MPEG_DEC_OUT2_Y_ADDRL = REG_MPEG(0x86), + GLAMO_REG_MPEG_DEC_OUT2_Y_ADDRH = REG_MPEG(0x88), + GLAMO_REG_MPEG_DEC_OUT2_U_ADDRL = REG_MPEG(0x8a), + GLAMO_REG_MPEG_DEC_OUT2_U_ADDRH = REG_MPEG(0x8c), + GLAMO_REG_MPEG_DEC_OUT2_V_ADDRL = REG_MPEG(0x8e), + GLAMO_REG_MPEG_DEC_OUT2_V_ADDRH = REG_MPEG(0x90), + GLAMO_REG_MPEG_DEC_WIDTH = REG_MPEG(0x92), + GLAMO_REG_MPEG_DEC_HEIGHT = REG_MPEG(0x94), + GLAMO_REG_MPEG_SPECIAL = REG_MPEG(0x96), + GLAMO_REG_MPEG_DEC_IN_ADDRL = REG_MPEG(0x98), + GLAMO_REG_MPEG_DEC_IN_ADDRH = REG_MPEG(0x9a), + // + GLAMO_REG_MPEG_DEBLK_THRESHOLD = REG_MPEG(0xc0), + // + GLAMO_REG_MPEG_DEC_STATUS = REG_MPEG(0xc8), + GLAMO_REG_MPEG_DEC_RB0 = REG_MPEG(0xca), + GLAMO_REG_MPEG_DEC_RB1 = REG_MPEG(0xcc), +}; + + +#define REG_2D(x) (GLAMO_REGOFS_2D+(x)) + +enum glamo_register_2d { + GLAMO_REG_2D_SRC_ADDRL = REG_2D(0x00), + GLAMO_REG_2D_SRC_ADDRH = REG_2D(0x02), + GLAMO_REG_2D_SRC_PITCH = REG_2D(0x04), + GLAMO_REG_2D_SRC_X = REG_2D(0x06), + GLAMO_REG_2D_SRC_Y = REG_2D(0x08), + GLAMO_REG_2D_DST_X = REG_2D(0x0a), + GLAMO_REG_2D_DST_Y = REG_2D(0x0c), + GLAMO_REG_2D_DST_ADDRL = REG_2D(0x0e), + GLAMO_REG_2D_DST_ADDRH = REG_2D(0x10), + GLAMO_REG_2D_DST_PITCH = REG_2D(0x12), + GLAMO_REG_2D_DST_HEIGHT = REG_2D(0x14), + GLAMO_REG_2D_RECT_WIDTH = REG_2D(0x16), + GLAMO_REG_2D_RECT_HEIGHT = REG_2D(0x18), + GLAMO_REG_2D_PAT_ADDRL = REG_2D(0x1a), + GLAMO_REG_2D_PAT_ADDRH = REG_2D(0x1c), + GLAMO_REG_2D_PAT_FG = REG_2D(0x1e), + GLAMO_REG_2D_PAT_BG = REG_2D(0x20), + GLAMO_REG_2D_SRC_FG = REG_2D(0x22), + GLAMO_REG_2D_SRC_BG = REG_2D(0x24), + GLAMO_REG_2D_MASK1 = REG_2D(0x26), + GLAMO_REG_2D_MASK2 = REG_2D(0x28), + GLAMO_REG_2D_MASK3 = REG_2D(0x2a), + GLAMO_REG_2D_MASK4 = REG_2D(0x2c), + GLAMO_REG_2D_ROT_X = REG_2D(0x2e), + GLAMO_REG_2D_ROT_Y = REG_2D(0x30), + GLAMO_REG_2D_LEFT_CLIP = REG_2D(0x32), + GLAMO_REG_2D_TOP_CLIP = REG_2D(0x34), + GLAMO_REG_2D_RIGHT_CLIP = REG_2D(0x36), + GLAMO_REG_2D_BOTTOM_CLIP = REG_2D(0x38), + GLAMO_REG_2D_COMMAND1 = REG_2D(0x3A), + GLAMO_REG_2D_COMMAND2 = REG_2D(0x3C), + GLAMO_REG_2D_COMMAND3 = REG_2D(0x3E), + GLAMO_REG_2D_SAFE = REG_2D(0x40), + GLAMO_REG_2D_STATUS = REG_2D(0x42), + GLAMO_REG_2D_ID1 = REG_2D(0x44), + GLAMO_REG_2D_ID2 = REG_2D(0x46), + GLAMO_REG_2D_ID3 = REG_2D(0x48), +}; + +#endif /* _GLAMO_REGS_H */ diff --git a/src/mesa/drivers/dri/glamo/glamo_state.c b/src/mesa/drivers/dri/glamo/glamo_state.c index 2cb15887f9..2190fbeee7 100644 --- a/src/mesa/drivers/dri/glamo/glamo_state.c +++ b/src/mesa/drivers/dri/glamo/glamo_state.c @@ -54,6 +54,9 @@ #include "glamo_fbo.h" #include "glamo_state.h" +#include "glamo_context.h" +#include "glamo_cmdq.h" +#include "glamo_regs.h" static void glamoResizeBuffers(GLcontext *ctx, struct gl_framebuffer *fb, @@ -85,9 +88,39 @@ static void glamoResizeBuffers(GLcontext *ctx, struct gl_framebuffer *fb, static void glamoClear(GLcontext *ctx, GLbitfield mask) { + glamoContext *gCtx; + struct gl_framebuffer *fb; + int i; + + gCtx = GLAMO_CONTEXT(ctx); + fb = ctx->DrawBuffer; + printf("glamoClear (%f %f %f %f)\n", ctx->Color.ClearColor[0], ctx->Color.ClearColor[1], ctx->Color.ClearColor[2], ctx->Color.ClearColor[3]); fflush(stdout); + + for (i = 0; i < fb->_NumColorDrawBuffers; i++) { + + struct glamo_renderbuffer *grb; + + grb = glamo_renderbuffer(fb->_ColorDrawBuffers[i]); + + GlamoDRMAddCommandBO(gCtx, GLAMO_REG_2D_DST_ADDRL, grb->bo); + GlamoDRMAddCommand(gCtx, GLAMO_REG_2D_DST_PITCH, + grb->width & 0x7ff); + GlamoDRMAddCommand(gCtx, GLAMO_REG_2D_DST_HEIGHT, + grb->height); + GlamoDRMAddCommand(gCtx, GLAMO_REG_2D_PAT_FG, 0xabcd); + GlamoDRMAddCommand(gCtx, GLAMO_REG_2D_COMMAND2, 0xff); /* set */ + GlamoDRMAddCommand(gCtx, GLAMO_REG_2D_DST_X, fb->_Xmin); + GlamoDRMAddCommand(gCtx, GLAMO_REG_2D_DST_Y, fb->_Ymin); + GlamoDRMAddCommand(gCtx, GLAMO_REG_2D_RECT_WIDTH, + fb->_Xmax-fb->_Xmin); + GlamoDRMAddCommand(gCtx, GLAMO_REG_2D_RECT_HEIGHT, + fb->_Ymax-fb->_Ymin); + GlamoDRMAddCommand(gCtx, GLAMO_REG_2D_COMMAND3, 0); + + } } |