mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 05:18:08 +02:00
more cleanups
This commit is contained in:
parent
65e30ac06a
commit
1929cacdbf
9 changed files with 376 additions and 4127 deletions
|
|
@ -1,4 +1,4 @@
|
|||
# $Id: Makefile,v 1.1.2.2 2002/12/04 16:00:05 keithw Exp $
|
||||
# $Id: Makefile,v 1.1.2.3 2002/12/11 14:44:50 keithw Exp $
|
||||
|
||||
# Mesa 3-D graphics library
|
||||
# Version: 5.0
|
||||
|
|
@ -8,7 +8,11 @@
|
|||
|
||||
MESA = ../../..
|
||||
MESABUILDDIR = $(MESA)/src
|
||||
INCLUDES = -I$(MESABUILDDIR) -I$(MESA)/include -I. -I../common -I$(MESABUILDDIR)/miniglx
|
||||
INSTALLDIR = /home/XF4/xc-trunk
|
||||
|
||||
INCLUDES = -I$(MESABUILDDIR) -I$(MESA)/include -I. -I../common \
|
||||
-I$(MESABUILDDIR)/miniglx -Iserver
|
||||
|
||||
CFLAGS = $(INCLUDES) -g -MD -DGLX_DIRECT_RENDERING
|
||||
|
||||
# The .a files for each mesa module required by this driver:
|
||||
|
|
@ -39,7 +43,7 @@ DRIVER_SOURCES = radeon_compat.c \
|
|||
radeon_vtxfmt_c.c \
|
||||
radeon_vtxfmt_sse.c \
|
||||
radeon_vtxfmt_x86.c \
|
||||
../common/mm.c
|
||||
../common/mm.c
|
||||
|
||||
C_SOURCES = $(DRIVER_SOURCES) \
|
||||
$(DRI_SOURCES)
|
||||
|
|
@ -66,6 +70,9 @@ default: radeon_dri.so
|
|||
radeon_dri.so: $(COREMESA) $(OBJECTS) Makefile
|
||||
rm -f $@ && gcc -o $@ -shared $(OBJECTS) $(COREMESA) -L$(MESA)/src/miniglx -lGL -lc -lm
|
||||
|
||||
install: radeon_dri.so
|
||||
install -C radeon_dri.so $(INSTALLDIR)/lib/modules/dri
|
||||
|
||||
clean:
|
||||
-rm -f *.o *~ *.d .\#* *.so
|
||||
|
||||
|
|
|
|||
|
|
@ -1,444 +0,0 @@
|
|||
/* radeon_common.h -- common header definitions for Radeon 2D/3D/DRM suite
|
||||
*
|
||||
* Copyright 2000 VA Linux Systems, Inc., Fremont, California.
|
||||
* Copyright 2002 Tungsten Graphics, Inc., Cedar Park, Texas.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Author:
|
||||
* Gareth Hughes <gareth@valinux.com>
|
||||
* Kevin E. Martin <martin@valinux.com>
|
||||
* Keith Whitwell <keith@tungstengraphics.com>
|
||||
*
|
||||
* Converted to common header format:
|
||||
* Jens Owen <jens@tungstengraphics.com>
|
||||
*
|
||||
* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86drmRadeon.h,v 1.6 2001/04/16 15:02:13 tsi Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _RADEON_COMMON_H_
|
||||
#define _RADEON_COMMON_H_
|
||||
|
||||
#include "xf86drm.h"
|
||||
|
||||
/* WARNING: If you change any of these defines, make sure to change
|
||||
* the kernel include file as well (radeon_drm.h)
|
||||
*/
|
||||
|
||||
/* Driver specific DRM command indices
|
||||
* NOTE: these are not OS specific, but they are driver specific
|
||||
*/
|
||||
#define DRM_RADEON_CP_INIT 0x00
|
||||
#define DRM_RADEON_CP_START 0x01
|
||||
#define DRM_RADEON_CP_STOP 0x02
|
||||
#define DRM_RADEON_CP_RESET 0x03
|
||||
#define DRM_RADEON_CP_IDLE 0x04
|
||||
#define DRM_RADEON_RESET 0x05
|
||||
#define DRM_RADEON_FULLSCREEN 0x06
|
||||
#define DRM_RADEON_SWAP 0x07
|
||||
#define DRM_RADEON_CLEAR 0x08
|
||||
#define DRM_RADEON_VERTEX 0x09
|
||||
#define DRM_RADEON_INDICES 0x0a
|
||||
#define DRM_RADEON_STIPPLE 0x0c
|
||||
#define DRM_RADEON_INDIRECT 0x0d
|
||||
#define DRM_RADEON_TEXTURE 0x0e
|
||||
#define DRM_RADEON_VERTEX2 0x0f
|
||||
#define DRM_RADEON_CMDBUF 0x10
|
||||
#define DRM_RADEON_GETPARAM 0x11
|
||||
#define DRM_RADEON_FLIP 0x12
|
||||
#define DRM_RADEON_ALLOC 0x13
|
||||
#define DRM_RADEON_FREE 0x14
|
||||
#define DRM_RADEON_INIT_HEAP 0x15
|
||||
#define DRM_RADEON_IRQ_EMIT 0x16
|
||||
#define DRM_RADEON_IRQ_WAIT 0x17
|
||||
#define DRM_RADEON_MAX_DRM_COMMAND_INDEX 0x39
|
||||
|
||||
|
||||
#define RADEON_FRONT 0x1
|
||||
#define RADEON_BACK 0x2
|
||||
#define RADEON_DEPTH 0x4
|
||||
#define RADEON_STENCIL 0x8
|
||||
|
||||
#define RADEON_CLEAR_X1 0
|
||||
#define RADEON_CLEAR_Y1 1
|
||||
#define RADEON_CLEAR_X2 2
|
||||
#define RADEON_CLEAR_Y2 3
|
||||
#define RADEON_CLEAR_DEPTH 4
|
||||
|
||||
|
||||
typedef struct {
|
||||
enum {
|
||||
DRM_RADEON_INIT_CP = 0x01,
|
||||
DRM_RADEON_CLEANUP_CP = 0x02,
|
||||
DRM_RADEON_INIT_R200_CP = 0x03
|
||||
} func;
|
||||
unsigned long sarea_priv_offset;
|
||||
int is_pci;
|
||||
int cp_mode;
|
||||
int agp_size;
|
||||
int ring_size;
|
||||
int usec_timeout;
|
||||
|
||||
unsigned int fb_bpp;
|
||||
unsigned int front_offset, front_pitch;
|
||||
unsigned int back_offset, back_pitch;
|
||||
unsigned int depth_bpp;
|
||||
unsigned int depth_offset, depth_pitch;
|
||||
|
||||
unsigned long fb_offset;
|
||||
unsigned long mmio_offset;
|
||||
unsigned long ring_offset;
|
||||
unsigned long ring_rptr_offset;
|
||||
unsigned long buffers_offset;
|
||||
unsigned long agp_textures_offset;
|
||||
} drmRadeonInit;
|
||||
|
||||
typedef struct {
|
||||
int flush;
|
||||
int idle;
|
||||
} drmRadeonCPStop;
|
||||
|
||||
typedef struct {
|
||||
int idx;
|
||||
int start;
|
||||
int end;
|
||||
int discard;
|
||||
} drmRadeonIndirect;
|
||||
|
||||
typedef union drmRadeonClearR {
|
||||
float f[5];
|
||||
unsigned int ui[5];
|
||||
} drmRadeonClearRect;
|
||||
|
||||
typedef struct drmRadeonClearT {
|
||||
unsigned int flags;
|
||||
unsigned int clear_color;
|
||||
unsigned int clear_depth;
|
||||
unsigned int color_mask;
|
||||
unsigned int depth_mask; /* misnamed field: should be stencil */
|
||||
drmRadeonClearRect *depth_boxes;
|
||||
} drmRadeonClearType;
|
||||
|
||||
typedef struct drmRadeonFullscreenT {
|
||||
enum {
|
||||
RADEON_INIT_FULLSCREEN = 0x01,
|
||||
RADEON_CLEANUP_FULLSCREEN = 0x02
|
||||
} func;
|
||||
} drmRadeonFullscreenType;
|
||||
|
||||
typedef struct {
|
||||
unsigned int *mask;
|
||||
} drmRadeonStipple;
|
||||
|
||||
typedef struct {
|
||||
unsigned int x;
|
||||
unsigned int y;
|
||||
unsigned int width;
|
||||
unsigned int height;
|
||||
const void *data;
|
||||
} drmRadeonTexImage;
|
||||
|
||||
typedef struct {
|
||||
int offset;
|
||||
int pitch;
|
||||
int format;
|
||||
int width; /* Texture image coordinates */
|
||||
int height;
|
||||
drmRadeonTexImage *image;
|
||||
} drmRadeonTexture;
|
||||
|
||||
|
||||
#define RADEON_MAX_TEXTURE_UNITS 3
|
||||
|
||||
/* Layout matches drm_radeon_state_t in linux drm_radeon.h.
|
||||
*/
|
||||
typedef struct {
|
||||
struct {
|
||||
unsigned int pp_misc; /* 0x1c14 */
|
||||
unsigned int pp_fog_color;
|
||||
unsigned int re_solid_color;
|
||||
unsigned int rb3d_blendcntl;
|
||||
unsigned int rb3d_depthoffset;
|
||||
unsigned int rb3d_depthpitch;
|
||||
unsigned int rb3d_zstencilcntl;
|
||||
unsigned int pp_cntl; /* 0x1c38 */
|
||||
unsigned int rb3d_cntl;
|
||||
unsigned int rb3d_coloroffset;
|
||||
unsigned int re_width_height;
|
||||
unsigned int rb3d_colorpitch;
|
||||
} context;
|
||||
struct {
|
||||
unsigned int se_cntl;
|
||||
} setup1;
|
||||
struct {
|
||||
unsigned int se_coord_fmt; /* 0x1c50 */
|
||||
} vertex;
|
||||
struct {
|
||||
unsigned int re_line_pattern; /* 0x1cd0 */
|
||||
unsigned int re_line_state;
|
||||
unsigned int se_line_width; /* 0x1db8 */
|
||||
} line;
|
||||
struct {
|
||||
unsigned int pp_lum_matrix; /* 0x1d00 */
|
||||
unsigned int pp_rot_matrix_0; /* 0x1d58 */
|
||||
unsigned int pp_rot_matrix_1;
|
||||
} bumpmap;
|
||||
struct {
|
||||
unsigned int rb3d_stencilrefmask; /* 0x1d7c */
|
||||
unsigned int rb3d_ropcntl;
|
||||
unsigned int rb3d_planemask;
|
||||
} mask;
|
||||
struct {
|
||||
unsigned int se_vport_xscale; /* 0x1d98 */
|
||||
unsigned int se_vport_xoffset;
|
||||
unsigned int se_vport_yscale;
|
||||
unsigned int se_vport_yoffset;
|
||||
unsigned int se_vport_zscale;
|
||||
unsigned int se_vport_zoffset;
|
||||
} viewport;
|
||||
struct {
|
||||
unsigned int se_cntl_status; /* 0x2140 */
|
||||
} setup2;
|
||||
struct {
|
||||
unsigned int re_top_left; /*ignored*/ /* 0x26c0 */
|
||||
unsigned int re_misc;
|
||||
} misc;
|
||||
struct {
|
||||
unsigned int pp_txfilter;
|
||||
unsigned int pp_txformat;
|
||||
unsigned int pp_txoffset;
|
||||
unsigned int pp_txcblend;
|
||||
unsigned int pp_txablend;
|
||||
unsigned int pp_tfactor;
|
||||
unsigned int pp_border_color;
|
||||
} texture[RADEON_MAX_TEXTURE_UNITS];
|
||||
struct {
|
||||
unsigned int se_zbias_factor;
|
||||
unsigned int se_zbias_constant;
|
||||
} zbias;
|
||||
unsigned int dirty;
|
||||
} drmRadeonState;
|
||||
|
||||
/* 1.1 vertex ioctl. Used in compatibility modes.
|
||||
*/
|
||||
typedef struct {
|
||||
int prim;
|
||||
int idx; /* Index of vertex buffer */
|
||||
int count; /* Number of vertices in buffer */
|
||||
int discard; /* Client finished with buffer? */
|
||||
} drmRadeonVertex;
|
||||
|
||||
typedef struct {
|
||||
unsigned int start;
|
||||
unsigned int finish;
|
||||
unsigned int prim:8;
|
||||
unsigned int stateidx:8;
|
||||
unsigned int numverts:16; /* overloaded as offset/64 for elt prims */
|
||||
unsigned int vc_format;
|
||||
} drmRadeonPrim;
|
||||
|
||||
typedef struct {
|
||||
int idx; /* Index of vertex buffer */
|
||||
int discard; /* Client finished with buffer? */
|
||||
int nr_states;
|
||||
drmRadeonState *state;
|
||||
int nr_prims;
|
||||
drmRadeonPrim *prim;
|
||||
} drmRadeonVertex2;
|
||||
|
||||
#define RADEON_MAX_STATES 16
|
||||
#define RADEON_MAX_PRIMS 64
|
||||
|
||||
/* Command buffer. Replace with true dma stream?
|
||||
*/
|
||||
typedef struct {
|
||||
int bufsz;
|
||||
char *buf;
|
||||
int nbox;
|
||||
drmClipRect *boxes;
|
||||
} drmRadeonCmdBuffer;
|
||||
|
||||
/* New style per-packet identifiers for use in cmd_buffer ioctl with
|
||||
* the RADEON_EMIT_PACKET command. Comments relate new packets to old
|
||||
* state bits and the packet size:
|
||||
*/
|
||||
#define RADEON_EMIT_PP_MISC 0 /* context/7 */
|
||||
#define RADEON_EMIT_PP_CNTL 1 /* context/3 */
|
||||
#define RADEON_EMIT_RB3D_COLORPITCH 2 /* context/1 */
|
||||
#define RADEON_EMIT_RE_LINE_PATTERN 3 /* line/2 */
|
||||
#define RADEON_EMIT_SE_LINE_WIDTH 4 /* line/1 */
|
||||
#define RADEON_EMIT_PP_LUM_MATRIX 5 /* bumpmap/1 */
|
||||
#define RADEON_EMIT_PP_ROT_MATRIX_0 6 /* bumpmap/2 */
|
||||
#define RADEON_EMIT_RB3D_STENCILREFMASK 7 /* masks/3 */
|
||||
#define RADEON_EMIT_SE_VPORT_XSCALE 8 /* viewport/6 */
|
||||
#define RADEON_EMIT_SE_CNTL 9 /* setup/2 */
|
||||
#define RADEON_EMIT_SE_CNTL_STATUS 10 /* setup/1 */
|
||||
#define RADEON_EMIT_RE_MISC 11 /* misc/1 */
|
||||
#define RADEON_EMIT_PP_TXFILTER_0 12 /* tex0/6 */
|
||||
#define RADEON_EMIT_PP_BORDER_COLOR_0 13 /* tex0/1 */
|
||||
#define RADEON_EMIT_PP_TXFILTER_1 14 /* tex1/6 */
|
||||
#define RADEON_EMIT_PP_BORDER_COLOR_1 15 /* tex1/1 */
|
||||
#define RADEON_EMIT_PP_TXFILTER_2 16 /* tex2/6 */
|
||||
#define RADEON_EMIT_PP_BORDER_COLOR_2 17 /* tex2/1 */
|
||||
#define RADEON_EMIT_SE_ZBIAS_FACTOR 18 /* zbias/2 */
|
||||
#define RADEON_EMIT_SE_TCL_OUTPUT_VTX_FMT 19 /* tcl/11 */
|
||||
#define RADEON_EMIT_SE_TCL_MATERIAL_EMMISSIVE_RED 20 /* material/17 */
|
||||
#define R200_EMIT_PP_TXCBLEND_0 21 /* tex0/4 */
|
||||
#define R200_EMIT_PP_TXCBLEND_1 22 /* tex1/4 */
|
||||
#define R200_EMIT_PP_TXCBLEND_2 23 /* tex2/4 */
|
||||
#define R200_EMIT_PP_TXCBLEND_3 24 /* tex3/4 */
|
||||
#define R200_EMIT_PP_TXCBLEND_4 25 /* tex4/4 */
|
||||
#define R200_EMIT_PP_TXCBLEND_5 26 /* tex5/4 */
|
||||
#define R200_EMIT_PP_TXCBLEND_6 27 /* /4 */
|
||||
#define R200_EMIT_PP_TXCBLEND_7 28 /* /4 */
|
||||
#define R200_EMIT_TCL_LIGHT_MODEL_CTL_0 29 /* tcl/6 */
|
||||
#define R200_EMIT_TFACTOR_0 30 /* tf/6 */
|
||||
#define R200_EMIT_VTX_FMT_0 31 /* vtx/4 */
|
||||
#define R200_EMIT_VAP_CTL 32 /* vap/1 */
|
||||
#define R200_EMIT_MATRIX_SELECT_0 33 /* msl/5 */
|
||||
#define R200_EMIT_TEX_PROC_CTL_2 34 /* tcg/5 */
|
||||
#define R200_EMIT_TCL_UCP_VERT_BLEND_CTL 35 /* tcl/1 */
|
||||
#define R200_EMIT_PP_TXFILTER_0 36 /* tex0/6 */
|
||||
#define R200_EMIT_PP_TXFILTER_1 37 /* tex1/6 */
|
||||
#define R200_EMIT_PP_TXFILTER_2 38 /* tex2/6 */
|
||||
#define R200_EMIT_PP_TXFILTER_3 39 /* tex3/6 */
|
||||
#define R200_EMIT_PP_TXFILTER_4 40 /* tex4/6 */
|
||||
#define R200_EMIT_PP_TXFILTER_5 41 /* tex5/6 */
|
||||
#define R200_EMIT_PP_TXOFFSET_0 42 /* tex0/1 */
|
||||
#define R200_EMIT_PP_TXOFFSET_1 43 /* tex1/1 */
|
||||
#define R200_EMIT_PP_TXOFFSET_2 44 /* tex2/1 */
|
||||
#define R200_EMIT_PP_TXOFFSET_3 45 /* tex3/1 */
|
||||
#define R200_EMIT_PP_TXOFFSET_4 46 /* tex4/1 */
|
||||
#define R200_EMIT_PP_TXOFFSET_5 47 /* tex5/1 */
|
||||
#define R200_EMIT_VTE_CNTL 48 /* vte/1 */
|
||||
#define R200_EMIT_OUTPUT_VTX_COMP_SEL 49 /* vtx/1 */
|
||||
#define R200_EMIT_PP_TAM_DEBUG3 50 /* tam/1 */
|
||||
#define R200_EMIT_PP_CNTL_X 51 /* cst/1 */
|
||||
#define R200_EMIT_RB3D_DEPTHXY_OFFSET 52 /* cst/1 */
|
||||
#define R200_EMIT_RE_AUX_SCISSOR_CNTL 53 /* cst/1 */
|
||||
#define R200_EMIT_RE_SCISSOR_TL_0 54 /* cst/2 */
|
||||
#define R200_EMIT_RE_SCISSOR_TL_1 55 /* cst/2 */
|
||||
#define R200_EMIT_RE_SCISSOR_TL_2 56 /* cst/2 */
|
||||
#define R200_EMIT_SE_VAP_CNTL_STATUS 57 /* cst/1 */
|
||||
#define R200_EMIT_SE_VTX_STATE_CNTL 58 /* cst/1 */
|
||||
#define R200_EMIT_RE_POINTSIZE 59 /* cst/1 */
|
||||
#define R200_EMIT_TCL_INPUT_VTX_VECTOR_ADDR_0 60 /* cst/4 */
|
||||
#define R200_EMIT_PP_CUBIC_FACES_0 61
|
||||
#define R200_EMIT_PP_CUBIC_OFFSETS_0 62
|
||||
#define R200_EMIT_PP_CUBIC_FACES_1 63
|
||||
#define R200_EMIT_PP_CUBIC_OFFSETS_1 64
|
||||
#define R200_EMIT_PP_CUBIC_FACES_2 65
|
||||
#define R200_EMIT_PP_CUBIC_OFFSETS_2 66
|
||||
#define R200_EMIT_PP_CUBIC_FACES_3 67
|
||||
#define R200_EMIT_PP_CUBIC_OFFSETS_3 68
|
||||
#define R200_EMIT_PP_CUBIC_FACES_4 69
|
||||
#define R200_EMIT_PP_CUBIC_OFFSETS_4 70
|
||||
#define R200_EMIT_PP_CUBIC_FACES_5 71
|
||||
#define R200_EMIT_PP_CUBIC_OFFSETS_5 72
|
||||
#define RADEON_MAX_STATE_PACKETS 73
|
||||
|
||||
|
||||
/* Commands understood by cmd_buffer ioctl. More can be added but
|
||||
* obviously these can't be removed or changed:
|
||||
*/
|
||||
#define RADEON_CMD_PACKET 1 /* emit one of the register packets above */
|
||||
#define RADEON_CMD_SCALARS 2 /* emit scalar data */
|
||||
#define RADEON_CMD_VECTORS 3 /* emit vector data */
|
||||
#define RADEON_CMD_DMA_DISCARD 4 /* discard current dma buf */
|
||||
#define RADEON_CMD_PACKET3 5 /* emit hw packet */
|
||||
#define RADEON_CMD_PACKET3_CLIP 6 /* emit hw packet wrapped in cliprects */
|
||||
#define RADEON_CMD_SCALARS2 7 /* R200 stopgap */
|
||||
#define RADEON_CMD_WAIT 8 /* synchronization */
|
||||
|
||||
typedef union {
|
||||
int i;
|
||||
struct {
|
||||
unsigned char cmd_type, pad0, pad1, pad2;
|
||||
} header;
|
||||
struct {
|
||||
unsigned char cmd_type, packet_id, pad0, pad1;
|
||||
} packet;
|
||||
struct {
|
||||
unsigned char cmd_type, offset, stride, count;
|
||||
} scalars;
|
||||
struct {
|
||||
unsigned char cmd_type, offset, stride, count;
|
||||
} vectors;
|
||||
struct {
|
||||
unsigned char cmd_type, buf_idx, pad0, pad1;
|
||||
} dma;
|
||||
struct {
|
||||
unsigned char cmd_type, flags, pad0, pad1;
|
||||
} wait;
|
||||
} drmRadeonCmdHeader;
|
||||
|
||||
|
||||
#define RADEON_WAIT_2D 0x1
|
||||
#define RADEON_WAIT_3D 0x2
|
||||
|
||||
|
||||
typedef struct drm_radeon_getparam {
|
||||
int param;
|
||||
int *value;
|
||||
} drmRadeonGetParam;
|
||||
|
||||
#define RADEON_PARAM_AGP_BUFFER_OFFSET 1
|
||||
#define RADEON_PARAM_LAST_FRAME 2
|
||||
#define RADEON_PARAM_LAST_DISPATCH 3
|
||||
#define RADEON_PARAM_LAST_CLEAR 4
|
||||
#define RADEON_PARAM_IRQ_NR 5
|
||||
#define RADEON_PARAM_AGP_BASE 6
|
||||
|
||||
|
||||
#define RADEON_MEM_REGION_AGP 1
|
||||
#define RADEON_MEM_REGION_FB 2
|
||||
|
||||
typedef struct drm_radeon_mem_alloc {
|
||||
int region;
|
||||
int alignment;
|
||||
int size;
|
||||
int *region_offset; /* offset from start of fb or agp */
|
||||
} drmRadeonMemAlloc;
|
||||
|
||||
typedef struct drm_radeon_mem_free {
|
||||
int region;
|
||||
int region_offset;
|
||||
} drmRadeonMemFree;
|
||||
|
||||
typedef struct drm_radeon_mem_init_heap {
|
||||
int region;
|
||||
int size;
|
||||
int start;
|
||||
} drmRadeonMemInitHeap;
|
||||
|
||||
/* 1.6: Userspace can request & wait on irq's:
|
||||
*/
|
||||
typedef struct drm_radeon_irq_emit {
|
||||
int *irq_seq;
|
||||
} drmRadeonIrqEmit;
|
||||
|
||||
typedef struct drm_radeon_irq_wait {
|
||||
int irq_seq;
|
||||
} drmRadeonIrqWait;
|
||||
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,237 +0,0 @@
|
|||
/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_sarea.h,v 1.4 2002/04/24 16:20:41 martin Exp $ */
|
||||
/*
|
||||
* Copyright 2000 ATI Technologies Inc., Markham, Ontario,
|
||||
* VA Linux Systems Inc., Fremont, California.
|
||||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation on the rights to use, copy, modify, merge,
|
||||
* publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
* and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the
|
||||
* next paragraph) shall be included in all copies or substantial
|
||||
* portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NON-INFRINGEMENT. IN NO EVENT SHALL ATI, VA LINUX SYSTEMS AND/OR
|
||||
* THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Authors:
|
||||
* Kevin E. Martin <martin@xfree86.org>
|
||||
* Gareth Hughes <gareth@valinux.com>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _RADEON_SAREA_H_
|
||||
#define _RADEON_SAREA_H_
|
||||
|
||||
/* WARNING: If you change any of these defines, make sure to change the
|
||||
* defines in the kernel file (radeon_drm.h)
|
||||
*/
|
||||
#ifndef __RADEON_SAREA_DEFINES__
|
||||
#define __RADEON_SAREA_DEFINES__
|
||||
|
||||
/* What needs to be changed for the current vertex buffer? */
|
||||
#define RADEON_UPLOAD_CONTEXT 0x00000001
|
||||
#define RADEON_UPLOAD_VERTFMT 0x00000002
|
||||
#define RADEON_UPLOAD_LINE 0x00000004
|
||||
#define RADEON_UPLOAD_BUMPMAP 0x00000008
|
||||
#define RADEON_UPLOAD_MASKS 0x00000010
|
||||
#define RADEON_UPLOAD_VIEWPORT 0x00000020
|
||||
#define RADEON_UPLOAD_SETUP 0x00000040
|
||||
#define RADEON_UPLOAD_TCL 0x00000080
|
||||
#define RADEON_UPLOAD_MISC 0x00000100
|
||||
#define RADEON_UPLOAD_TEX0 0x00000200
|
||||
#define RADEON_UPLOAD_TEX1 0x00000400
|
||||
#define RADEON_UPLOAD_TEX2 0x00000800
|
||||
#define RADEON_UPLOAD_TEX0IMAGES 0x00001000
|
||||
#define RADEON_UPLOAD_TEX1IMAGES 0x00002000
|
||||
#define RADEON_UPLOAD_TEX2IMAGES 0x00004000
|
||||
#define RADEON_UPLOAD_CLIPRECTS 0x00008000 /* handled client-side */
|
||||
#define RADEON_REQUIRE_QUIESCENCE 0x00010000
|
||||
#define RADEON_UPLOAD_ZBIAS 0x00020000
|
||||
#define RADEON_UPLOAD_ALL 0x0002ffff
|
||||
#define RADEON_UPLOAD_CONTEXT_ALL 0x000201ff
|
||||
|
||||
#define RADEON_FRONT 0x1
|
||||
#define RADEON_BACK 0x2
|
||||
#define RADEON_DEPTH 0x4
|
||||
#define RADEON_STENCIL 0x8
|
||||
|
||||
/* Primitive types */
|
||||
#define RADEON_POINTS 0x1
|
||||
#define RADEON_LINES 0x2
|
||||
#define RADEON_LINE_STRIP 0x3
|
||||
#define RADEON_TRIANGLES 0x4
|
||||
#define RADEON_TRIANGLE_FAN 0x5
|
||||
#define RADEON_TRIANGLE_STRIP 0x6
|
||||
#define RADEON_3VTX_POINTS 0x9
|
||||
#define RADEON_3VTX_LINES 0xa
|
||||
|
||||
/* Vertex/indirect buffer size */
|
||||
#define RADEON_BUFFER_SIZE 65536
|
||||
|
||||
/* Byte offsets for indirect buffer data */
|
||||
#define RADEON_INDEX_PRIM_OFFSET 20
|
||||
#define RADEON_HOSTDATA_BLIT_OFFSET 32
|
||||
|
||||
#define RADEON_SCRATCH_REG_OFFSET 32
|
||||
|
||||
/* Keep these small for testing */
|
||||
#define RADEON_NR_SAREA_CLIPRECTS 12
|
||||
|
||||
/* There are 2 heaps (local/AGP). Each region within a heap is a
|
||||
* minimum of 64k, and there are at most 64 of them per heap.
|
||||
*/
|
||||
#define RADEON_CARD_HEAP 0
|
||||
#define RADEON_AGP_HEAP 1
|
||||
#define RADEON_NR_TEX_HEAPS 2
|
||||
#define RADEON_NR_TEX_REGIONS 64
|
||||
#define RADEON_LOG_TEX_GRANULARITY 16
|
||||
|
||||
#define RADEON_MAX_TEXTURE_LEVELS 12
|
||||
#define RADEON_MAX_TEXTURE_UNITS 3
|
||||
|
||||
/* Blits have strict offset rules. All blit offset must be aligned on
|
||||
* a 1K-byte boundary.
|
||||
*/
|
||||
#define RADEON_OFFSET_SHIFT 10
|
||||
#define RADEON_OFFSET_ALIGN (1 << RADEON_OFFSET_SHIFT)
|
||||
#define RADEON_OFFSET_MASK (RADEON_OFFSET_ALIGN - 1)
|
||||
|
||||
#endif /* __RADEON_SAREA_DEFINES__ */
|
||||
|
||||
typedef struct {
|
||||
unsigned int red;
|
||||
unsigned int green;
|
||||
unsigned int blue;
|
||||
unsigned int alpha;
|
||||
} radeon_color_regs_t;
|
||||
|
||||
typedef struct {
|
||||
/* Context state */
|
||||
unsigned int pp_misc;
|
||||
unsigned int pp_fog_color;
|
||||
unsigned int re_solid_color;
|
||||
unsigned int rb3d_blendcntl;
|
||||
unsigned int rb3d_depthoffset;
|
||||
unsigned int rb3d_depthpitch;
|
||||
unsigned int rb3d_zstencilcntl;
|
||||
|
||||
unsigned int pp_cntl;
|
||||
unsigned int rb3d_cntl;
|
||||
unsigned int rb3d_coloroffset;
|
||||
unsigned int re_width_height;
|
||||
unsigned int rb3d_colorpitch;
|
||||
unsigned int se_cntl;
|
||||
|
||||
/* Vertex format state */
|
||||
unsigned int se_coord_fmt;
|
||||
|
||||
/* Line state */
|
||||
unsigned int re_line_pattern;
|
||||
unsigned int re_line_state;
|
||||
|
||||
unsigned int se_line_width;
|
||||
|
||||
/* Bumpmap state */
|
||||
unsigned int pp_lum_matrix;
|
||||
|
||||
unsigned int pp_rot_matrix_0;
|
||||
unsigned int pp_rot_matrix_1;
|
||||
|
||||
/* Mask state */
|
||||
unsigned int rb3d_stencilrefmask;
|
||||
unsigned int rb3d_ropcntl;
|
||||
unsigned int rb3d_planemask;
|
||||
|
||||
/* Viewport state */
|
||||
unsigned int se_vport_xscale;
|
||||
unsigned int se_vport_xoffset;
|
||||
unsigned int se_vport_yscale;
|
||||
unsigned int se_vport_yoffset;
|
||||
unsigned int se_vport_zscale;
|
||||
unsigned int se_vport_zoffset;
|
||||
|
||||
/* Setup state */
|
||||
unsigned int se_cntl_status;
|
||||
|
||||
/* Misc state */
|
||||
unsigned int re_top_left;
|
||||
unsigned int re_misc;
|
||||
} radeon_context_regs_t;
|
||||
|
||||
/* Setup registers for each texture unit */
|
||||
typedef struct {
|
||||
unsigned int pp_txfilter;
|
||||
unsigned int pp_txformat;
|
||||
unsigned int pp_txoffset;
|
||||
unsigned int pp_txcblend;
|
||||
unsigned int pp_txablend;
|
||||
unsigned int pp_tfactor;
|
||||
unsigned int pp_border_color;
|
||||
} radeon_texture_regs_t;
|
||||
|
||||
typedef struct {
|
||||
unsigned char next, prev; /* indices to form a circular LRU */
|
||||
unsigned char in_use; /* owned by a client, or free? */
|
||||
int age; /* tracked by clients to update local LRU's */
|
||||
} radeon_tex_region_t;
|
||||
|
||||
typedef struct {
|
||||
/* The channel for communication of state information to the kernel
|
||||
* on firing a vertex buffer.
|
||||
*/
|
||||
radeon_context_regs_t ContextState;
|
||||
radeon_texture_regs_t TexState[RADEON_MAX_TEXTURE_UNITS];
|
||||
unsigned int dirty;
|
||||
unsigned int vertsize;
|
||||
unsigned int vc_format;
|
||||
|
||||
/* The current cliprects, or a subset thereof */
|
||||
XF86DRIClipRectRec boxes[RADEON_NR_SAREA_CLIPRECTS];
|
||||
unsigned int nbox;
|
||||
|
||||
/* Counters for throttling of rendering clients */
|
||||
unsigned int last_frame;
|
||||
unsigned int last_dispatch;
|
||||
unsigned int last_clear;
|
||||
|
||||
/* Maintain an LRU of contiguous regions of texture space. If you
|
||||
* think you own a region of texture memory, and it has an age
|
||||
* different to the one you set, then you are mistaken and it has
|
||||
* been stolen by another client. If global texAge hasn't changed,
|
||||
* there is no need to walk the list.
|
||||
*
|
||||
* These regions can be used as a proxy for the fine-grained texture
|
||||
* information of other clients - by maintaining them in the same
|
||||
* lru which is used to age their own textures, clients have an
|
||||
* approximate lru for the whole of global texture space, and can
|
||||
* make informed decisions as to which areas to kick out. There is
|
||||
* no need to choose whether to kick out your own texture or someone
|
||||
* else's - simply eject them all in LRU order.
|
||||
*/
|
||||
/* Last elt is sentinal */
|
||||
radeon_tex_region_t texList[RADEON_NR_TEX_HEAPS][RADEON_NR_TEX_REGIONS+1];
|
||||
/* last time texture was uploaded */
|
||||
int texAge[RADEON_NR_TEX_HEAPS];
|
||||
|
||||
int ctxOwner; /* last context to upload state */
|
||||
int pfAllowPageFlip; /* set by the 2d driver, read by the client */
|
||||
int pfCurrentPage; /* set by kernel, read by others */
|
||||
int crtc2_base; /* for pageflipping with CloneMode */
|
||||
} RADEONSAREAPriv, *RADEONSAREAPrivPtr;
|
||||
|
||||
#endif
|
||||
|
|
@ -6,8 +6,7 @@ SOURCES = dispatch.c \
|
|||
dri_util.c \
|
||||
glapi.c \
|
||||
miniglx.c \
|
||||
xf86drm.c \
|
||||
XF86dri.c
|
||||
xf86drm.c
|
||||
|
||||
OBJS = $(SOURCES:.c=.o)
|
||||
|
||||
|
|
@ -30,6 +29,10 @@ libGL.so.1:
|
|||
libGL.so:
|
||||
ln -s libGL.so.1 libGL.so
|
||||
|
||||
|
||||
#miniglx.a: $(OBJECTS) Makefile
|
||||
# rm -f $@ && ar rcv $@ $(OBJECTS) && ranlib $@
|
||||
|
||||
glapi.c: ../glapi.c
|
||||
ln -s ../glapi.c .
|
||||
|
||||
|
|
|
|||
|
|
@ -1,549 +0,0 @@
|
|||
/* $XFree86: xc/lib/GL/dri/XF86dri.c,v 1.12 2001/08/27 17:40:57 dawes Exp $ */
|
||||
/**************************************************************************
|
||||
|
||||
Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
|
||||
Copyright 2000 VA Linux Systems, Inc.
|
||||
All Rights Reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sub license, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice (including the
|
||||
next paragraph) shall be included in all copies or substantial portions
|
||||
of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
|
||||
IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
|
||||
ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
**************************************************************************/
|
||||
|
||||
/*
|
||||
* Authors:
|
||||
* Keith Whitwell <keith@tungstengraphics.com>
|
||||
*/
|
||||
|
||||
/* Stubs to load a dri driver under fbdev. Built by combining pieces
|
||||
* of dri.c (server side) and XF86dri.c (client side).
|
||||
*
|
||||
* Interfaces with code lifted from the 2d ddx driver to perform
|
||||
* various initialization services which would ordinarily be done by
|
||||
* the X server.
|
||||
*
|
||||
* I've #ifdef-out quite a bit of the code in here temporarily. (Brian)
|
||||
*/
|
||||
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "miniglxP.h"
|
||||
#include "xf86dri.h"
|
||||
|
||||
|
||||
#define XF86DRI_MAJOR_VERSION 4
|
||||
#define XF86DRI_MINOR_VERSION 1
|
||||
#define XF86DRI_PATCH_VERSION 0
|
||||
|
||||
|
||||
|
||||
static void TRACE(const char *format, ...)
|
||||
{
|
||||
if (1) {
|
||||
va_list ap;
|
||||
va_start(ap, format);
|
||||
vfprintf( stderr, format, ap );
|
||||
va_end(ap);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Bool XF86DRIQueryVersion(dpy, majorVersion, minorVersion, patchVersion)
|
||||
Display* dpy;
|
||||
int* majorVersion;
|
||||
int* minorVersion;
|
||||
int* patchVersion;
|
||||
{
|
||||
*majorVersion = XF86DRI_MAJOR_VERSION;
|
||||
*minorVersion = XF86DRI_MINOR_VERSION;
|
||||
*patchVersion = XF86DRI_PATCH_VERSION;
|
||||
TRACE("QueryVersion\n");
|
||||
return True;
|
||||
}
|
||||
|
||||
Bool XF86DRIQueryDirectRenderingCapable(dpy, screen, isCapable)
|
||||
Display* dpy;
|
||||
int screen;
|
||||
Bool* isCapable;
|
||||
{
|
||||
TRACE("QueryDirectRenderingCapable... return True\n");
|
||||
*isCapable = True;
|
||||
return True;
|
||||
}
|
||||
|
||||
Bool XF86DRIOpenConnection(dpy, screen, hSAREA, busIdString)
|
||||
Display* dpy;
|
||||
int screen;
|
||||
drmHandlePtr hSAREA;
|
||||
char **busIdString;
|
||||
{
|
||||
#if 0
|
||||
DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
|
||||
|
||||
*hSAREA = pDRIPriv->hSAREA;
|
||||
*busIdString = strdup(pDRIPriv->pDriverInfo->busIdString);
|
||||
|
||||
TRACE("OpenConnection... return True\n");
|
||||
#endif
|
||||
return True;
|
||||
}
|
||||
|
||||
Bool XF86DRIAuthConnection(dpy, screen, magic)
|
||||
Display* dpy;
|
||||
int screen;
|
||||
drmMagic magic;
|
||||
{
|
||||
#if 0
|
||||
DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
|
||||
|
||||
if (drmAuthMagic(pDRIPriv->drmFD, magic)) return FALSE;
|
||||
#endif
|
||||
return True;
|
||||
}
|
||||
|
||||
Bool XF86DRICloseConnection(dpy, screen)
|
||||
Display* dpy;
|
||||
int screen;
|
||||
{
|
||||
return True;
|
||||
}
|
||||
|
||||
Bool XF86DRIGetClientDriverName(dpy, screen, ddxDriverMajorVersion,
|
||||
ddxDriverMinorVersion, ddxDriverPatchVersion, clientDriverName)
|
||||
Display* dpy;
|
||||
int screen;
|
||||
int* ddxDriverMajorVersion;
|
||||
int* ddxDriverMinorVersion;
|
||||
int* ddxDriverPatchVersion;
|
||||
char** clientDriverName;
|
||||
{
|
||||
#if 0
|
||||
DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
|
||||
|
||||
*ddxDriverMajorVersion = pDRIPriv->pDriverInfo->ddxDriverMajorVersion;
|
||||
*ddxDriverMinorVersion = pDRIPriv->pDriverInfo->ddxDriverMinorVersion;
|
||||
*ddxDriverPatchVersion = pDRIPriv->pDriverInfo->ddxDriverPatchVersion;
|
||||
*clientDriverName = strdup(pDRIPriv->pDriverInfo->clientDriverName);
|
||||
#endif
|
||||
return True;
|
||||
}
|
||||
|
||||
#if 0
|
||||
DRIContextPrivPtr
|
||||
DRICreateContextPriv(ScreenPtr pScreen,
|
||||
drmContextPtr pHWContext,
|
||||
DRIContextFlags flags)
|
||||
{
|
||||
DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
|
||||
|
||||
if (drmCreateContext(pDRIPriv->drmFD, pHWContext)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return DRICreateContextPrivFromHandle(pScreen, *pHWContext, flags);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
DRIContextPrivPtr
|
||||
DRICreateContextPrivFromHandle(ScreenPtr pScreen,
|
||||
drmContext hHWContext,
|
||||
DRIContextFlags flags)
|
||||
{
|
||||
DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
|
||||
DRIContextPrivPtr pDRIContextPriv;
|
||||
int contextPrivSize;
|
||||
|
||||
contextPrivSize = sizeof(DRIContextPrivRec) +
|
||||
pDRIPriv->pDriverInfo->contextSize;
|
||||
if (!(pDRIContextPriv = xcalloc(1, contextPrivSize))) {
|
||||
return NULL;
|
||||
}
|
||||
pDRIContextPriv->pContextStore = (void *)(pDRIContextPriv + 1);
|
||||
|
||||
drmAddContextTag(pDRIPriv->drmFD, hHWContext, pDRIContextPriv);
|
||||
|
||||
pDRIContextPriv->hwContext = hHWContext;
|
||||
pDRIContextPriv->pScreen = pScreen;
|
||||
pDRIContextPriv->flags = flags;
|
||||
pDRIContextPriv->valid3D = FALSE;
|
||||
|
||||
if (flags & DRI_CONTEXT_2DONLY) {
|
||||
if (drmSetContextFlags(pDRIPriv->drmFD,
|
||||
hHWContext,
|
||||
DRM_CONTEXT_2DONLY)) {
|
||||
DRIDrvMsg(0, X_ERROR,
|
||||
"[drm] failed to set 2D context flag\n");
|
||||
DRIDestroyContextPriv(pDRIContextPriv);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
if (flags & DRI_CONTEXT_PRESERVED) {
|
||||
if (drmSetContextFlags(pDRIPriv->drmFD,
|
||||
hHWContext,
|
||||
DRM_CONTEXT_PRESERVED)) {
|
||||
DRIDrvMsg(0, X_ERROR,
|
||||
"[drm] failed to set preserved flag\n");
|
||||
DRIDestroyContextPriv(pDRIContextPriv);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
return pDRIContextPriv;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
Bool
|
||||
DRICreateContext(ScreenPtr pScreen, VisualPtr visual,
|
||||
XID context, drmContextPtr pHWContext)
|
||||
{
|
||||
DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
|
||||
__GLXscreenInfo *pGLXScreen = &__glXActiveScreens[0];
|
||||
__GLXvisualConfig *pGLXVis = pGLXScreen->pGlxVisual;
|
||||
void **pVisualConfigPriv = pGLXScreen->pVisualPriv;
|
||||
DRIContextPrivPtr pDRIContextPriv;
|
||||
void *contextStore;
|
||||
int visNum;
|
||||
|
||||
/* Find the GLX visual associated with the one requested */
|
||||
for (visNum = 0;
|
||||
visNum < pGLXScreen->numVisuals;
|
||||
visNum++, pGLXVis++, pVisualConfigPriv++)
|
||||
if (pGLXVis->vid == visual->vid)
|
||||
break;
|
||||
if (visNum == pGLXScreen->numVisuals) {
|
||||
/* No matching GLX visual found */
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!(pDRIContextPriv = DRICreateContextPriv(pScreen, pHWContext, 0))) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
contextStore = DRIGetContextStore(pDRIContextPriv);
|
||||
if (pDRIPriv->pDriverInfo->CreateContext) {
|
||||
if (!((*pDRIPriv->pDriverInfo->CreateContext)(pScreen, visual,
|
||||
*pHWContext, *pVisualConfigPriv,
|
||||
(DRIContextType)(long)contextStore))) {
|
||||
DRIDestroyContextPriv(pDRIContextPriv);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
/* track this in case the client dies before cleanup */
|
||||
AddResource(context, DRIContextPrivResType, (pointer)pDRIContextPriv);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
Bool XF86DRICreateContext(dpy, screen, visual, context, hHWContext)
|
||||
Display* dpy;
|
||||
int screen;
|
||||
Visual* visual;
|
||||
XID* context;
|
||||
drmContextPtr hHWContext;
|
||||
{
|
||||
#if 0
|
||||
XExtDisplayInfo *info = find_display (dpy);
|
||||
xXF86DRICreateContextReply rep;
|
||||
xXF86DRICreateContextReq *req;
|
||||
|
||||
TRACE("CreateContext...\n");
|
||||
XF86DRICheckExtension (dpy, info, False);
|
||||
|
||||
LockDisplay(dpy);
|
||||
GetReq(XF86DRICreateContext, req);
|
||||
req->reqType = info->codes->major_opcode;
|
||||
req->driReqType = X_XF86DRICreateContext;
|
||||
req->visual = visual->visualid;
|
||||
req->screen = screen;
|
||||
*context = XAllocID(dpy);
|
||||
req->context = *context;
|
||||
if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
TRACE("CreateContext... return False\n");
|
||||
return False;
|
||||
}
|
||||
*hHWContext = rep.hHWContext;
|
||||
UnlockDisplay(dpy);
|
||||
SyncHandle();
|
||||
TRACE("CreateContext... return True\n");
|
||||
#endif
|
||||
return True;
|
||||
}
|
||||
|
||||
#if 0
|
||||
Bool
|
||||
DRIDestroyContextPriv(DRIContextPrivPtr pDRIContextPriv)
|
||||
{
|
||||
DRIScreenPrivPtr pDRIPriv;
|
||||
|
||||
if (!pDRIContextPriv) return TRUE;
|
||||
|
||||
pDRIPriv = DRI_SCREEN_PRIV(pDRIContextPriv->pScreen);
|
||||
|
||||
if (!(pDRIContextPriv->flags & DRI_CONTEXT_RESERVED)) {
|
||||
/* Don't delete reserved contexts from
|
||||
kernel area -- the kernel manages its
|
||||
reserved contexts itself. */
|
||||
if (drmDestroyContext(pDRIPriv->drmFD, pDRIContextPriv->hwContext))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Remove the tag last to prevent a race
|
||||
condition where the context has pending
|
||||
buffers. The context can't be re-used
|
||||
while in this thread, but buffers can be
|
||||
dispatched asynchronously. */
|
||||
drmDelContextTag(pDRIPriv->drmFD, pDRIContextPriv->hwContext);
|
||||
xfree(pDRIContextPriv);
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
Bool XF86DRIDestroyContext(dpy, screen, context)
|
||||
Display* dpy;
|
||||
int screen;
|
||||
XID context;
|
||||
{
|
||||
#if 0
|
||||
DRIContextPrivPtr pDRIContextPriv = (DRIContextPrivPtr)pResource;
|
||||
DRIScreenPrivPtr pDRIPriv;
|
||||
void *contextStore;
|
||||
|
||||
pDRIPriv = DRI_SCREEN_PRIV(pDRIContextPriv->pScreen);
|
||||
|
||||
TRACE("DestroyContext\n");
|
||||
return DRIDestroyContextPriv(pDRIContextPriv);
|
||||
#else
|
||||
return False;
|
||||
#endif
|
||||
}
|
||||
|
||||
Bool XF86DRICreateDrawable(dpy, screen, drawable, hHWDrawable)
|
||||
Display* dpy;
|
||||
int screen;
|
||||
Drawable drawable;
|
||||
drmDrawablePtr hHWDrawable;
|
||||
{
|
||||
#if 0
|
||||
DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
|
||||
DRIDrawablePrivPtr pDRIDrawablePriv;
|
||||
WindowPtr pWin;
|
||||
|
||||
if (pDrawable->type == DRAWABLE_WINDOW) {
|
||||
pWin = (WindowPtr)pDrawable;
|
||||
if ((pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin))) {
|
||||
pDRIDrawablePriv->refCount++;
|
||||
}
|
||||
else {
|
||||
/* allocate a DRI Window Private record */
|
||||
if (!(pDRIDrawablePriv = xalloc(sizeof(DRIDrawablePrivRec)))) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Only create a drmDrawable once */
|
||||
if (drmCreateDrawable(pDRIPriv->drmFD, hHWDrawable)) {
|
||||
xfree(pDRIDrawablePriv);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* add it to the list of DRI drawables for this screen */
|
||||
pDRIDrawablePriv->hwDrawable = *hHWDrawable;
|
||||
pDRIDrawablePriv->pScreen = pScreen;
|
||||
pDRIDrawablePriv->refCount = 1;
|
||||
pDRIDrawablePriv->drawableIndex = -1;
|
||||
|
||||
|
||||
/* track this in case this window is destroyed */
|
||||
AddResource(id, DRIDrawablePrivResType, (pointer)pWin);
|
||||
}
|
||||
}
|
||||
else { /* pixmap (or for GLX 1.3, a PBuffer) */
|
||||
/* NOT_DONE */
|
||||
return False;
|
||||
}
|
||||
#endif
|
||||
return True;
|
||||
}
|
||||
|
||||
#if 0
|
||||
Bool
|
||||
DRIDrawablePrivDelete(pointer pResource, XID id)
|
||||
{
|
||||
DrawablePtr pDrawable = (DrawablePtr)pResource;
|
||||
DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pDrawable->pScreen);
|
||||
DRIDrawablePrivPtr pDRIDrawablePriv;
|
||||
WindowPtr pWin;
|
||||
|
||||
if (pDrawable->type == DRAWABLE_WINDOW) {
|
||||
pWin = (WindowPtr)pDrawable;
|
||||
pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin);
|
||||
|
||||
if (pDRIDrawablePriv->drawableIndex != -1) {
|
||||
/* bump stamp to force outstanding 3D requests to resync */
|
||||
pDRIPriv->pSAREA->drawableTable[pDRIDrawablePriv->drawableIndex].stamp
|
||||
= DRIDrawableValidationStamp++;
|
||||
|
||||
/* release drawable table entry */
|
||||
pDRIPriv->DRIDrawables[pDRIDrawablePriv->drawableIndex] = NULL;
|
||||
}
|
||||
|
||||
if (drmDestroyDrawable(pDRIPriv->drmFD,
|
||||
pDRIDrawablePriv->hwDrawable)) {
|
||||
return FALSE;
|
||||
}
|
||||
xfree(pDRIDrawablePriv);
|
||||
}
|
||||
else { /* pixmap (or for GLX 1.3, a PBuffer) */
|
||||
/* NOT_DONE */
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
Bool XF86DRIDestroyDrawable(dpy, screen, drawable)
|
||||
Display* dpy;
|
||||
int screen;
|
||||
Drawable drawable;
|
||||
{
|
||||
#if 0
|
||||
DRIDrawablePrivPtr pDRIDrawablePriv;
|
||||
WindowPtr pWin;
|
||||
|
||||
|
||||
if (pDrawable->type == DRAWABLE_WINDOW) {
|
||||
pWin = (WindowPtr)pDrawable;
|
||||
pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin);
|
||||
pDRIDrawablePriv->refCount--;
|
||||
if (pDRIDrawablePriv->refCount <= 0) {
|
||||
/* This calls back DRIDrawablePrivDelete which frees private area */
|
||||
FreeResourceByType(id, DRIDrawablePrivResType, FALSE);
|
||||
}
|
||||
}
|
||||
else { /* pixmap (or for GLX 1.3, a PBuffer) */
|
||||
/* NOT_DONE */
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
return True;
|
||||
}
|
||||
|
||||
Bool XF86DRIGetDrawableInfo(dpy, screen, drawable,
|
||||
index, stamp, X, Y, W, H,
|
||||
numClipRects, pClipRects,
|
||||
backX, backY,
|
||||
numBackClipRects, pBackClipRects
|
||||
)
|
||||
Display* dpy;
|
||||
int screen;
|
||||
Drawable drawable;
|
||||
unsigned int* index;
|
||||
unsigned int* stamp;
|
||||
int* X;
|
||||
int* Y;
|
||||
int* W;
|
||||
int* H;
|
||||
int* numClipRects;
|
||||
XF86DRIClipRectPtr* pClipRects;
|
||||
int* backX;
|
||||
int* backY;
|
||||
int* numBackClipRects;
|
||||
XF86DRIClipRectPtr* pBackClipRects;
|
||||
{
|
||||
#if 0
|
||||
DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
|
||||
DRIDrawablePrivPtr pDRIDrawablePriv, pOldDrawPriv;
|
||||
int i;
|
||||
*index = 0;
|
||||
*stamp = 0;
|
||||
*X = 0;
|
||||
*Y = 0;
|
||||
*W = pScreen->w;
|
||||
*H = pScreen->h;
|
||||
*numClipRects = 1;
|
||||
*pClipRects = &pScreen->clipList;
|
||||
#else
|
||||
*index = 0;
|
||||
*stamp = 0;
|
||||
*X = 0;
|
||||
*Y = 0;
|
||||
*W = drawable->w;
|
||||
*H = drawable->h;
|
||||
*numClipRects = 1;
|
||||
*pClipRects = (XF86DRIClipRectPtr) malloc(sizeof(XF86DRIClipRectRec));
|
||||
(*pClipRects)[0].x1 = 0;
|
||||
(*pClipRects)[0].y1 = 0;
|
||||
(*pClipRects)[0].x2 = drawable->w;
|
||||
(*pClipRects)[0].y2 = drawable->h;
|
||||
#endif
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
Bool XF86DRIGetDeviceInfo(dpy, screen, hFrameBuffer,
|
||||
fbOrigin, fbSize, fbStride, devPrivateSize, pDevPrivate)
|
||||
Display* dpy;
|
||||
int screen;
|
||||
drmHandlePtr hFrameBuffer;
|
||||
int* fbOrigin;
|
||||
int* fbSize;
|
||||
int* fbStride;
|
||||
int* devPrivateSize;
|
||||
void** pDevPrivate;
|
||||
{
|
||||
#if 0
|
||||
DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
|
||||
|
||||
*hFrameBuffer = pDRIPriv->hFrameBuffer;
|
||||
*fbOrigin = 0;
|
||||
*fbSize = pDRIPriv->pDriverInfo->frameBufferSize;
|
||||
*fbStride = pDRIPriv->pDriverInfo->frameBufferStride;
|
||||
*devPrivateSize = 0;
|
||||
*pDevPrivate = 0;
|
||||
#endif
|
||||
return True;
|
||||
}
|
||||
|
||||
Bool XF86DRIOpenFullScreen(dpy, screen, drawable)
|
||||
Display* dpy;
|
||||
int screen;
|
||||
Drawable drawable;
|
||||
{
|
||||
return False;
|
||||
}
|
||||
|
||||
Bool XF86DRICloseFullScreen(dpy, screen, drawable)
|
||||
Display* dpy;
|
||||
int screen;
|
||||
Drawable drawable;
|
||||
{
|
||||
return True;
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -56,9 +56,18 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
#define CAPI /* XXX this should be globally defined somewhere */
|
||||
|
||||
#include "GL/miniglx.h" /* for GLXDrawable */
|
||||
#include "xf86dri.h" /* for XF86DRIClipRectPtr */
|
||||
#include "sarea.h" /* for XF86DRISAREAPtr */
|
||||
#include "GL/internal/glcore.h" /* for __GLcontextModes */
|
||||
#include "miniglxP.h" /* XID, etc */
|
||||
|
||||
/* Warning : Do not change XF86DRIClipRect without changing the kernel
|
||||
* structure! */
|
||||
typedef struct _XF86DRIClipRect {
|
||||
unsigned short x1; /* Upper left: inclusive */
|
||||
unsigned short y1;
|
||||
unsigned short x2; /* Lower right: exclusive */
|
||||
unsigned short y2;
|
||||
} XF86DRIClipRectRec, *XF86DRIClipRectPtr;
|
||||
|
||||
|
||||
typedef struct __DRIdisplayPrivateRec __DRIdisplayPrivate;
|
||||
|
|
|
|||
|
|
@ -1,145 +0,0 @@
|
|||
/* $XFree86: xc/lib/GL/dri/xf86dri.h,v 1.7 2000/12/07 20:26:02 dawes Exp $ */
|
||||
/**************************************************************************
|
||||
|
||||
Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
|
||||
Copyright 2000 VA Linux Systems, Inc.
|
||||
All Rights Reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sub license, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice (including the
|
||||
next paragraph) shall be included in all copies or substantial portions
|
||||
of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
|
||||
IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
|
||||
ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
**************************************************************************/
|
||||
|
||||
/*
|
||||
* Authors:
|
||||
* Kevin E. Martin <martin@valinux.com>
|
||||
* Jens Owen <jens@tungstengraphics.com>
|
||||
* Rickard E. (Rik) Faith <faith@valinux.com>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _XF86DRI_H_
|
||||
#define _XF86DRI_H_
|
||||
|
||||
#include <xf86drm.h>
|
||||
#include "miniglxP.h"
|
||||
|
||||
|
||||
#define X_XF86DRIQueryVersion 0
|
||||
#define X_XF86DRIQueryDirectRenderingCapable 1
|
||||
#define X_XF86DRIOpenConnection 2
|
||||
#define X_XF86DRICloseConnection 3
|
||||
#define X_XF86DRIGetClientDriverName 4
|
||||
#define X_XF86DRICreateContext 5
|
||||
#define X_XF86DRIDestroyContext 6
|
||||
#define X_XF86DRICreateDrawable 7
|
||||
#define X_XF86DRIDestroyDrawable 8
|
||||
#define X_XF86DRIGetDrawableInfo 9
|
||||
#define X_XF86DRIGetDeviceInfo 10
|
||||
#define X_XF86DRIAuthConnection 11
|
||||
#define X_XF86DRIOpenFullScreen 12
|
||||
#define X_XF86DRICloseFullScreen 13
|
||||
|
||||
#define XF86DRINumberEvents 0
|
||||
|
||||
#define XF86DRIClientNotLocal 0
|
||||
#define XF86DRIOperationNotSupported 1
|
||||
#define XF86DRINumberErrors (XF86DRIOperationNotSupported + 1)
|
||||
|
||||
/* Warning : Do not change XF86DRIClipRect without changing the kernel
|
||||
* structure! */
|
||||
typedef struct _XF86DRIClipRect {
|
||||
unsigned short x1; /* Upper left: inclusive */
|
||||
unsigned short y1;
|
||||
unsigned short x2; /* Lower right: exclusive */
|
||||
unsigned short y2;
|
||||
} XF86DRIClipRectRec, *XF86DRIClipRectPtr;
|
||||
|
||||
|
||||
|
||||
Bool XF86DRIOpenConnection(
|
||||
#if NeedFunctionPrototypes
|
||||
Display* /* dpy */,
|
||||
int /* screen */,
|
||||
drmHandlePtr /* hSAREA */,
|
||||
char** /* busIDString */
|
||||
#endif
|
||||
);
|
||||
|
||||
Bool XF86DRIGetClientDriverName(
|
||||
#if NeedFunctionPrototypes
|
||||
Display* /* dpy */,
|
||||
int /* screen */,
|
||||
int* /* ddxDriverMajorVersion */,
|
||||
int* /* ddxDriverMinorVersion */,
|
||||
int* /* ddxDriverPatchVersion */,
|
||||
char** /* clientDriverName */
|
||||
#endif
|
||||
);
|
||||
|
||||
Bool XF86DRICreateContext(
|
||||
#if NeedFunctionPrototypes
|
||||
Display* /* dpy */,
|
||||
int /* screen */,
|
||||
Visual* /* visual */,
|
||||
XID* /* ptr to returned context id */,
|
||||
drmContextPtr /* hHWContext */
|
||||
#endif
|
||||
);
|
||||
|
||||
|
||||
Bool XF86DRIGetDrawableInfo(
|
||||
#if NeedFunctionPrototypes
|
||||
Display* /* dpy */,
|
||||
int /* screen */,
|
||||
Drawable /* drawable */,
|
||||
unsigned int* /* index */,
|
||||
unsigned int* /* stamp */,
|
||||
int* /* X */,
|
||||
int* /* Y */,
|
||||
int* /* W */,
|
||||
int* /* H */,
|
||||
int* /* numClipRects */,
|
||||
XF86DRIClipRectPtr*,/* pClipRects */
|
||||
int* /* backX */,
|
||||
int* /* backY */,
|
||||
int* /* numBackClipRects */,
|
||||
XF86DRIClipRectPtr* /* pBackClipRects */
|
||||
#endif
|
||||
);
|
||||
|
||||
|
||||
Bool XF86DRIGetDeviceInfo(
|
||||
#if NeedFunctionPrototypes
|
||||
Display* /* dpy */,
|
||||
int /* screen */,
|
||||
drmHandlePtr /* hFrameBuffer */,
|
||||
int* /* fbOrigin */,
|
||||
int* /* fbSize */,
|
||||
int* /* fbStride */,
|
||||
int* /* devPrivateSize */,
|
||||
void** /* pDevPrivate */
|
||||
#endif
|
||||
);
|
||||
|
||||
|
||||
|
||||
#endif /* _XF86DRI_H_ */
|
||||
|
||||
Loading…
Add table
Reference in a new issue